diff options
Diffstat (limited to 'drivers/vfio')
-rw-r--r-- | drivers/vfio/pci/vfio_pci.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 6d369fe9d30b..6c119944bbb6 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c | |||
@@ -408,7 +408,7 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma) | |||
408 | struct vfio_pci_device *vdev = device_data; | 408 | struct vfio_pci_device *vdev = device_data; |
409 | struct pci_dev *pdev = vdev->pdev; | 409 | struct pci_dev *pdev = vdev->pdev; |
410 | unsigned int index; | 410 | unsigned int index; |
411 | u64 phys_len, req_len, pgoff, req_start, phys; | 411 | u64 phys_len, req_len, pgoff, req_start; |
412 | int ret; | 412 | int ret; |
413 | 413 | ||
414 | index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT); | 414 | index = vma->vm_pgoff >> (VFIO_PCI_OFFSET_SHIFT - PAGE_SHIFT); |
@@ -463,10 +463,9 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma) | |||
463 | vma->vm_private_data = vdev; | 463 | vma->vm_private_data = vdev; |
464 | vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; | 464 | vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; |
465 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); | 465 | vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); |
466 | vma->vm_pgoff = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff; | ||
466 | 467 | ||
467 | phys = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff; | 468 | return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, |
468 | |||
469 | return remap_pfn_range(vma, vma->vm_start, phys, | ||
470 | req_len, vma->vm_page_prot); | 469 | req_len, vma->vm_page_prot); |
471 | } | 470 | } |
472 | 471 | ||