Skip to contentSkip to conversation

vfio: vfio_pci_nvlink2: use a vma helper function

PATCH Alex Williamson 2 participants 3 messages May 16, 2019 – Jul 2, 2019 1 message not in the archive KVM

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

[Cc Alexey + kvm]

Quoted 23 lines · On Thu, 16 May 2019 20:38:26 +0800 "[email protected]"…

Use a vma helper function to simply code.

---
 drivers/vfio/pci/vfio_pci_nvlink2.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/vfio/pci/vfio_pci_nvlink2.c +0 -0
index 32f695ffe128..dc42aa0e47f6 100644
@@ -161,8 +161,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,


  atomic_inc(&data->mm->mm_count);
  ret = (int) mm_iommu_newdev(data->mm, data->useraddr,

drivers/vfio/pci/vfio_pci_nvlink2.c +1 -2
-			(vma->vm_end - vma->vm_start) >> PAGE_SHIFT,
-			data->gpu_hpa, &data->mem);
+			vma_pages(vma), data->gpu_hpa, &data->mem);


  trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr, vma->vm_end - vma->vm_start, ret);
--
2.20.1

#2 lore raw
Quoted 12 lines · Alex Williamson

[Cc Alexey + kvm]

Quoted 7 lines · On Thu, 16 May 2019 20:38:26 +0800 "[email protected]"…

Use a vma helper function to simply code.

---
 drivers/vfio/pci/vfio_pci_nvlink2.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 11 lines

drivers/vfio/pci/vfio_pci_nvlink2.c

Quoted 11 lines
drivers/vfio/pci/vfio_pci_nvlink2.c +0 -0
index 32f695ffe128..dc42aa0e47f6 100644
@@ -161,8 +161,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,


  atomic_inc(&data->mm->mm_count);
  ret = (int) mm_iommu_newdev(data->mm, data->useraddr,

drivers/vfio/pci/vfio_pci_nvlink2.c +1 -2
-			(vma->vm_end - vma->vm_start) >> PAGE_SHIFT,
-			data->gpu_hpa, &data->mem);
+			vma_pages(vma), data->gpu_hpa, &data->mem);

I did not realize we have been having this mighty helper since 2005 :)

Quoted 5 lines
Quoted 5 lines


  trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr, vma->vm_end - vma->vm_start, ret);
--
2.20.1

Signature · 1 line
Alexey
author Applied
#3 lore raw
In reply to a message not in the archive
Quoted 18 lines · On Thu, 16 May 2019 20:38:26 +0800 "[email protected]"…

Use a vma helper function to simply code.

---
 drivers/vfio/pci/vfio_pci_nvlink2.c | 3 +--

 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/vfio/pci/vfio_pci_nvlink2.c +0 -0
index 32f695ffe128..dc42aa0e47f6 100644
@@ -161,8 +161,7 @@ static int vfio_pci_nvgpu_mmap(struct vfio_pci_device *vdev,


  atomic_inc(&data->mm->mm_count);
  ret = (int) mm_iommu_newdev(data->mm, data->useraddr,

drivers/vfio/pci/vfio_pci_nvlink2.c +1 -2
-			(vma->vm_end - vma->vm_start) >> PAGE_SHIFT,
-			data->gpu_hpa, &data->mem);
+			vma_pages(vma), data->gpu_hpa, &data->mem);
Quoted 5 lines


  trace_vfio_pci_nvgpu_mmap(vdev->pdev, data->gpu_hpa, data->useraddr, vma->vm_end - vma->vm_start, ret);
--
2.20.1

Applied to vfio next branch for 5.3 with Alexey's R-b. Thanks!

Alex