RE: [PATCH v7 2/6] vfio/nvgrace-gpu: Add support for huge pfnmap

From: Shameer Kolothum

Date: Wed Nov 26 2025 - 03:59:26 EST




> -----Original Message-----
> From: Ankit Agrawal <ankita@xxxxxxxxxx>
> Sent: 26 November 2025 05:26
> To: Ankit Agrawal <ankita@xxxxxxxxxx>; jgg@xxxxxxxx; Yishai Hadas
> <yishaih@xxxxxxxxxx>; Shameer Kolothum <skolothumtho@xxxxxxxxxx>;
> kevin.tian@xxxxxxxxx; alex@xxxxxxxxxxx; Aniket Agashe
> <aniketa@xxxxxxxxxx>; Vikram Sethi <vsethi@xxxxxxxxxx>; Matt Ochs
> <mochs@xxxxxxxxxx>
> Cc: Yunxiang.Li@xxxxxxx; yi.l.liu@xxxxxxxxx;
> zhangdongdong@xxxxxxxxxxxxxxxxxx; Avihai Horon <avihaih@xxxxxxxxxx>;
> bhelgaas@xxxxxxxxxx; peterx@xxxxxxxxxx; pstanner@xxxxxxxxxx; Alistair
> Popple <apopple@xxxxxxxxxx>; kvm@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx; Neo Jia <cjia@xxxxxxxxxx>; Kirti Wankhede
> <kwankhede@xxxxxxxxxx>; Tarun Gupta (SW-GPU) <targupta@xxxxxxxxxx>;
> Zhi Wang <zhiw@xxxxxxxxxx>; Dan Williams <danw@xxxxxxxxxx>; Dheeraj
> Nigam <dnigam@xxxxxxxxxx>; Krishnakant Jaju <kjaju@xxxxxxxxxx>
> Subject: [PATCH v7 2/6] vfio/nvgrace-gpu: Add support for huge pfnmap
>
> From: Ankit Agrawal <ankita@xxxxxxxxxx>
>
> NVIDIA's Grace based systems have large device memory. The device
> memory is mapped as VM_PFNMAP in the VMM VMA. The nvgrace-gpu
> module could make use of the huge PFNMAP support added in mm [1].
>
> To make use of the huge pfnmap support, fault/huge_fault ops
> based mapping mechanism needs to be implemented. Currently nvgrace-gpu
> module relies on remap_pfn_range to do the mapping during VM bootup.
> Replace it to instead rely on fault and use vfio_pci_vmf_insert_pfn
> to setup the mapping.
>
> Moreover to enable huge pfnmap, nvgrace-gpu module is updated by
> adding huge_fault ops implementation. The implementation establishes
> mapping according to the order request. Note that if the PFN or the
> VMA address is unaligned to the order, the mapping fallbacks to
> the PTE level.
>
> Link: https://lore.kernel.org/all/20240826204353.2228736-1-
> peterx@xxxxxxxxxx/ [1]
>
> Cc: Shameer Kolothum <skolothumtho@xxxxxxxxxx>
> Cc: Alex Williamson <alex@xxxxxxxxxxx>
> Cc: Jason Gunthorpe <jgg@xxxxxxxx>
> Cc: Vikram Sethi <vsethi@xxxxxxxxxx>
> Reviewed-by: Zhi Wang <zhiw@xxxxxxxxxx>
> Signed-off-by: Ankit Agrawal <ankita@xxxxxxxxxx>

Reviewed-by: Shameer Kolothum <skolothumtho@xxxxxxxxxx>