Skip to content

Commit c5a8b5d

Browse files
yunxialiawilliam
authored andcommitted
vfio/pci: Remove shadow ROM specific code paths
After commit 0c0e073 ("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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alex Williamson <[email protected]>
1 parent b44a06b commit c5a8b5d

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

drivers/vfio/pci/vfio_pci_config.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,9 @@ static void vfio_bar_fixup(struct vfio_pci_core_device *vdev)
511511
mask = ~(pci_resource_len(pdev, PCI_ROM_RESOURCE) - 1);
512512
mask |= PCI_ROM_ADDRESS_ENABLE;
513513
*vbar &= cpu_to_le32((u32)mask);
514-
} else if (pdev->resource[PCI_ROM_RESOURCE].flags &
515-
IORESOURCE_ROM_SHADOW) {
516-
mask = ~(0x20000 - 1);
517-
mask |= PCI_ROM_ADDRESS_ENABLE;
518-
*vbar &= cpu_to_le32((u32)mask);
519-
} else
514+
} else {
520515
*vbar = 0;
516+
}
521517

522518
vdev->bardirty = false;
523519
}

drivers/vfio/pci/vfio_pci_core.c

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,14 +1057,8 @@ static int vfio_pci_ioctl_get_region_info(struct vfio_pci_core_device *vdev,
10571057

10581058
/* Report the BAR size, not the ROM size */
10591059
info.size = pci_resource_len(pdev, info.index);
1060-
if (!info.size) {
1061-
/* Shadow ROMs appear as PCI option ROMs */
1062-
if (pdev->resource[PCI_ROM_RESOURCE].flags &
1063-
IORESOURCE_ROM_SHADOW)
1064-
info.size = 0x20000;
1065-
else
1066-
break;
1067-
}
1060+
if (!info.size)
1061+
break;
10681062

10691063
/*
10701064
* Is it really there? Enable memory decode for implicit access

drivers/vfio/pci/vfio_pci_rdwr.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,6 @@ ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
237237

238238
if (pci_resource_start(pdev, bar))
239239
end = pci_resource_len(pdev, bar);
240-
else if (bar == PCI_ROM_RESOURCE &&
241-
pdev->resource[bar].flags & IORESOURCE_ROM_SHADOW)
242-
end = 0x20000;
243240
else
244241
return -EINVAL;
245242

0 commit comments

Comments
 (0)