diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2012-10-10 09:10:31 -0600 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2012-10-10 09:10:31 -0600 |
commit | 34002f54d2bd8e8ac04f0da0847f71a8a06a5d38 (patch) | |
tree | 97f205940afdc9d6e684f213aad522cb5a1f0916 /drivers/vfio | |
parent | 2474542f64432398f503373f53bdf620491bcfa8 (diff) | |
download | op-kernel-dev-34002f54d2bd8e8ac04f0da0847f71a8a06a5d38.zip op-kernel-dev-34002f54d2bd8e8ac04f0da0847f71a8a06a5d38.tar.gz |
vfio: Fix PCI mmap after b3b9c293
Our mmap path mistakely relied on vma->vm_pgoff to get set in
remap_pfn_range. After b3b9c293, that path only applies to
copy-on-write mappings. Set it in our own code.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
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 6d369fe..6c11994 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) struct vfio_pci_device *vdev = device_data; struct pci_dev *pdev = vdev->pdev; unsigned int index; - u64 phys_len, req_len, pgoff, req_start, phys; + u64 phys_len, req_len, pgoff, req_start; int ret; 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) vma->vm_private_data = vdev; vma->vm_flags |= VM_IO | VM_DONTEXPAND | VM_DONTDUMP; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); + vma->vm_pgoff = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff; - phys = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff; - - return remap_pfn_range(vma, vma->vm_start, phys, + return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff, req_len, vma->vm_page_prot); } |