Re: [PATCH 4/5] vfio: Introduce vfio_device_ops.get_unmapped_area hook

Jason Gunthorpe
2025-06-13T14:18:11Z

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@redhat.com>
> ---
> drivers/vfio/vfio_main.c | 18 ++++++++++++++++++
> include/linux/vfio.h | 7 +++++++
> 2 files changed, 25 insertions(+)

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Jason