]> www.infradead.org Git - users/willy/pagecache.git/commitdiff
vfio/pci: Remove shadow ROM specific code paths
authorYunxiang Li <Yunxiang.Li@amd.com>
Thu, 2 Jan 2025 18:50:12 +0000 (13:50 -0500)
committerAlex Williamson <alex.williamson@redhat.com>
Mon, 6 Jan 2025 15:09:54 +0000 (08:09 -0700)
After commit 0c0e0736acad ("PCI: Set ROM shadow location in arch code,
not in PCI core"), the shadow ROM works the same as regular ROM BARs so
these code paths are no longer needed.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Link: https://lore.kernel.org/r/20250102185013.15082-2-Yunxiang.Li@amd.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/pci/vfio_pci_config.c
drivers/vfio/pci/vfio_pci_core.c
drivers/vfio/pci/vfio_pci_rdwr.c

index ea2745c1ac5e686caba729c80ddf91ce790cff8e..e41c3a965663e2bfb83d69fad2583a4a5cf906f5 100644 (file)
@@ -511,13 +511,9 @@ static void vfio_bar_fixup(struct vfio_pci_core_device *vdev)
                mask = ~(pci_resource_len(pdev, PCI_ROM_RESOURCE) - 1);
                mask |= PCI_ROM_ADDRESS_ENABLE;
                *vbar &= cpu_to_le32((u32)mask);
-       } else if (pdev->resource[PCI_ROM_RESOURCE].flags &
-                                       IORESOURCE_ROM_SHADOW) {
-               mask = ~(0x20000 - 1);
-               mask |= PCI_ROM_ADDRESS_ENABLE;
-               *vbar &= cpu_to_le32((u32)mask);
-       } else
+       } else {
                *vbar = 0;
+       }
 
        vdev->bardirty = false;
 }
index 1a4ed5a357d360be795a1ce3e152bc6aff65ec72..b97a3833ffd1462b99b309b7b8e3c36132b12114 100644 (file)
@@ -1057,14 +1057,8 @@ static int vfio_pci_ioctl_get_region_info(struct vfio_pci_core_device *vdev,
 
                /* Report the BAR size, not the ROM size */
                info.size = pci_resource_len(pdev, info.index);
-               if (!info.size) {
-                       /* Shadow ROMs appear as PCI option ROMs */
-                       if (pdev->resource[PCI_ROM_RESOURCE].flags &
-                           IORESOURCE_ROM_SHADOW)
-                               info.size = 0x20000;
-                       else
-                               break;
-               }
+               if (!info.size)
+                       break;
 
                /*
                 * Is it really there?  Enable memory decode for implicit access
index 78a3d0809415e04c4681d6288c6e38b494fd63b0..0f74f58571fb121d85a5b6a14a6e1af8aa2b1caa 100644 (file)
@@ -237,9 +237,6 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
 
        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;