diff options
author | Alex Williamson | 2016-02-23 00:02:46 +0100 |
---|---|---|
committer | Alex Williamson | 2016-02-23 00:10:09 +0100 |
commit | a13b64591747e8a4ab2df24540a17fca34de2d34 (patch) | |
tree | 9c0bc81f4e91de885e37c699a65f855eea541e9c /drivers/vfio/pci/vfio_pci_config.c | |
parent | vfio/pci: Intel IGD host and LCP bridge config space access (diff) | |
download | kernel-qcow2-linux-a13b64591747e8a4ab2df24540a17fca34de2d34.tar.gz kernel-qcow2-linux-a13b64591747e8a4ab2df24540a17fca34de2d34.tar.xz kernel-qcow2-linux-a13b64591747e8a4ab2df24540a17fca34de2d34.zip |
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_config.c')
-rw-r--r-- | drivers/vfio/pci/vfio_pci_config.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index 88dc646c0144..142c533efec7 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -475,14 +475,19 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev) bar = (__le32 *)&vdev->vconfig[PCI_ROM_ADDRESS]; /* - * NB. we expose the actual BAR size here, regardless of whether - * we can read it. When we report the REGION_INFO for the ROM - * we report what PCI tells us is the actual ROM size. + * NB. REGION_INFO will have reported zero size if we weren't able + * to read the ROM, but we still return the actual BAR size here if + * it exists (or the shadow ROM space). */ if (pci_resource_start(pdev, PCI_ROM_RESOURCE)) { mask = ~(pci_resource_len(pdev, PCI_ROM_RESOURCE) - 1); mask |= PCI_ROM_ADDRESS_ENABLE; *bar &= cpu_to_le32((u32)mask); + } else if (pdev->resource[PCI_ROM_RESOURCE].flags & + IORESOURCE_ROM_SHADOW) { + mask = ~(0x20000 - 1); + mask |= PCI_ROM_ADDRESS_ENABLE; + *bar &= cpu_to_le32((u32)mask); } else *bar = 0; |