diff options
author | Alex Williamson <alex.williamson@redhat.com> | 2016-02-23 02:02:46 +0300 |
---|---|---|
committer | Alex Williamson <alex.williamson@redhat.com> | 2016-02-23 02:10:09 +0300 |
commit | a13b64591747e8a4ab2df24540a17fca34de2d34 (patch) | |
tree | 9c0bc81f4e91de885e37c699a65f855eea541e9c /drivers/vfio/pci/vfio_pci_rdwr.c | |
parent | f572a960a15e8bb56599f6d2358a9c18f0808e91 (diff) | |
download | linux-a13b64591747e8a4ab2df24540a17fca34de2d34.tar.xz |
vfio/pci: Expose shadow ROM as PCI option ROM
Integrated graphics may have their ROM shadowed at 0xc0000 rather than
implement a PCI option ROM. Make this ROM appear to the user using
the ROM BAR.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Diffstat (limited to 'drivers/vfio/pci/vfio_pci_rdwr.c')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_rdwr.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/vfio/pci/vfio_pci_rdwr.c b/drivers/vfio/pci/vfio_pci_rdwr.c index 210db24d2204..5ffd1d9ad4bd 100644 --- a/drivers/vfio/pci/vfio_pci_rdwr.c +++ b/drivers/vfio/pci/vfio_pci_rdwr.c @@ -124,11 +124,14 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_device *vdev, char __user *buf, void __iomem *io; ssize_t done; - if (!pci_resource_start(pdev, bar)) + if (pci_resource_start(pdev, bar)) + end = pci_resource_len(pdev, bar); + else if (bar == PCI_ROM_RESOURCE && + pdev->resource[bar].flags & IORESOURCE_ROM_SHADOW) + end = 0x20000; + else return -EINVAL; - end = pci_resource_len(pdev, bar); - if (pos >= end) return -EINVAL; |