Re: [PATCH 4/5] vfio: Introduce vfio_device_ops.get_unmapped_area hook
From: Jason Gunthorpe
Date: Fri Jun 13 2025 - 10:23:26 EST
On Fri, Jun 13, 2025 at 09:41:10AM -0400, Peter Xu wrote:
> Add a hook to vfio_device_ops to allow sub-modules provide virtual
> addresses for an mmap() request.
>
> Note that the fallback will be mm_get_unmapped_area(), which should
> maintain the old behavior of generic VA allocation (__get_unmapped_area).
> It's a bit unfortunate that is needed, as the current get_unmapped_area()
> file ops cannot support a retval which fallbacks to the default. So that
> is needed both here and whenever sub-module will opt-in with its own.
>
> Signed-off-by: Peter Xu <peterx@xxxxxxxxxx>
> ---
> drivers/vfio/vfio_main.c | 18 ++++++++++++++++++
> include/linux/vfio.h | 7 +++++++
> 2 files changed, 25 insertions(+)
Reviewed-by: Jason Gunthorpe <jgg@xxxxxxxxxx>
Jason