Re: linux-next: manual merge of the vfio tree with the mm-stable tree

From: Ankit Agrawal

Date: Tue Dec 02 2025 - 12:11:40 EST


> From: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> Date: Mon, 1 Dec 2025 11:10:51 +1100
> Subject: [PATCH] fix up for "vfio/nvgrace-gpu: Add support for huge pfnmap"
>
> interacting with commit
>
> ebb9aeb980e5 ("vfio/nvgrace-gpu: register device memory for poison handling")
>
> from the mm-stable tree.
>
> Signed-off-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
> ---
> drivers/vfio/pci/nvgrace-gpu/main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgrace-gpu/main.c
> index 4104f46fb378..c6eddb7b823a 100644
> --- a/drivers/vfio/pci/nvgrace-gpu/main.c
> +++ b/drivers/vfio/pci/nvgrace-gpu/main.c
> @@ -292,6 +292,7 @@ static int nvgrace_gpu_mmap(struct vfio_device *core_vdev,
> struct mem_region *memregion;
> u64 req_len, pgoff, end;
> unsigned int index;
>+ int ret = 0;
>
> index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT);>
>

Thanks Stephen for taking a look at this and resolving the conflict.
However, there is a different change needed that I posted below
created over next-20251202. Let me know if you are okay with
merging it.

Thanks
Ankit Agrawal

---
drivers/vfio/pci/nvgrace-gpu/main.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/vfio/pci/nvgrace-gpu/main.c b/drivers/vfio/pci/nvgrace-gpu/main.c
index c6eddb7b823a..ed0c6a63e05a 100644
--- a/drivers/vfio/pci/nvgrace-gpu/main.c
+++ b/drivers/vfio/pci/nvgrace-gpu/main.c
@@ -77,13 +77,14 @@ static int
nvgrace_gpu_vfio_pci_register_pfn_range(struct mem_region *region,
struct vm_area_struct *vma)
{
- unsigned long nr_pages;
- int ret = 0;
+ unsigned long nr_pages, base_pfn;
+ int ret;

nr_pages = region->memlength >> PAGE_SHIFT;
+ base_pfn = PHYS_PFN(region->memphys);

- region->pfn_address_space.node.start = vma->vm_pgoff;
- region->pfn_address_space.node.last = vma->vm_pgoff + nr_pages - 1;
+ region->pfn_address_space.node.start = base_pfn;
+ region->pfn_address_space.node.last = base_pfn + nr_pages - 1;
region->pfn_address_space.mapping = vma->vm_file->f_mapping;

ret = register_pfn_address_space(&region->pfn_address_space);
--
2.34.1