PCI: Remove dead code after DMA alias work
v2 cover PCI: Remove dead code after DMA alias work
v1: inopportune DNS failure blocked patches, resending
Now that IOMMU drivers have completed the DMA alias transition, remove the left behind dead code. Thanks,
Alex
---
Alex Williamson (2):
PCI: Remove pci_get_dma_source()
PCI: Remove pci_find_upstream_pcie_bridge()
drivers/pci/quirks.c | 51 -------------------------------------------------- drivers/pci/search.c | 34 --------------------------------- include/linux/pci.h | 16 ---------------- 3 files changed, 101 deletions(-)
PATCH v2 1/2 PCI: Remove pci_find_upstream_pcie_bridge()
This is now dead code.
---
drivers/pci/search.c | 34 ---------------------------------- include/linux/pci.h | 11 ----------- 2 files changed, 45 deletions(-)
drivers/pci/search.c +0 -34
@@ -103,40 +103,6 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,return ret; } -/* -* find the upstream PCIe-to-PCI bridge of a PCI device -* if the device is PCIE, return NULL -* if the device isn't connected to a PCIe bridge (that is its parent is a -* legacy PCI bridge and the bridge is directly connected to bus 0), return its -* parent -*/ -struct pci_dev *pci_find_upstream_pcie_bridge (struct pci_dev *pdev) -{ -struct pci_dev *tmp =NULL ; - -if (pci_is_pcie (pdev)) -return NULL ; -while (1 ) { -if (pci_is_root_bus (pdev->bus)) -break ; - pdev = pdev->bus->self; -/* a p2p bridge */ -if (!pci_is_pcie (pdev)) { - tmp = pdev; -continue ; - } -/* PCI device should connect to a PCIe bridge */ -if (pci_pcie_type (pdev) !=PCI_EXP_TYPE_PCI_BRIDGE ) { -/* Busted hardware? */ -WARN_ON_ONCE (1 ); -return NULL ; - } -return pdev; - } - -return tmp; -} -static struct pci_bus *pci_do_find_bus (struct pci_bus *bus,unsigned char busnr) {struct pci_bus *child;
include/linux/pci.h +0 -11
@@ -1828,15 +1828,4 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,int (*fn)(struct pci_dev *pdev, u16 alias, void *data), void *data); -/** -* pci_find_upstream_pcie_bridge - find upstream PCIe-to-PCI bridge of a device -* @pdev: the PCI device -* -* if the device is PCIE, return NULL -* if the device isn't connected to a PCIe bridge (that is its parent is a -* legacy PCI bridge and the bridge is directly connected to bus 0), return its -* parent -*/ -struct pci_dev *pci_find_upstream_pcie_bridge (struct pci_dev *pdev); -#endif /* LINUX_PCI_H */
PATCH v2 2/2 PCI: Remove pci_get_dma_source()
In reply to Alex WilliamsonRemove dead code. We now have dma_alias_devfn to describe this
---
drivers/pci/quirks.c | 51 -------------------------------------------------- include/linux/pci.h | 5 ----- 2 files changed, 56 deletions(-)
drivers/pci/quirks.c +0 -51
@@ -3512,57 +3512,6 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias);/* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */ DECLARE_PCI_FIXUP_HEADER (0x8086 ,0x244e , quirk_use_pcie_bridge_dma_alias); -static struct pci_dev *pci_func_0_dma_source (struct pci_dev *dev) -{ -if (!PCI_FUNC (dev->devfn)) -return pci_dev_get (dev); - -return pci_get_slot (dev->bus,PCI_DEVFN (PCI_SLOT (dev->devfn),0 )); -} - -static const struct pci_dev_dma_source { -u16 vendor; -u16 device; -struct pci_dev *(*dma_source)(struct pci_dev *dev); -} pci_dev_dma_source[] = { -/* -* https://bugzilla.redhat.com/show_bug.cgi?id=605888 -* -* Some Ricoh devices use the function 0 source ID for DMA on -* other functions of a multifunction device. The DMA devices -* is therefore function 0, which will have implications of the -* iommu grouping of these devices. -*/ - {PCI_VENDOR_ID_RICOH ,0xe822 , pci_func_0_dma_source }, - {PCI_VENDOR_ID_RICOH ,0xe230 , pci_func_0_dma_source }, - {PCI_VENDOR_ID_RICOH ,0xe832 , pci_func_0_dma_source }, - {PCI_VENDOR_ID_RICOH ,0xe476 , pci_func_0_dma_source }, - {0 } -}; - -/* -* IOMMUs with isolation capabilities need to be programmed with the -* correct source ID of a device. In most cases, the source ID matches -* the device doing the DMA, but sometimes hardware is broken and will -* tag the DMA as being sourced from a different device. This function -* allows that translation. Note that the reference count of the -* returned device is incremented on all paths. -*/ -struct pci_dev *pci_get_dma_source (struct pci_dev *dev) -{ -const struct pci_dev_dma_source *i; - -for (i = pci_dev_dma_source; i->dma_source; i++) { -if ((i->vendor == dev->vendor || - i->vendor == (u16 )PCI_ANY_ID ) && - (i->device == dev->device || - i->device == (u16 )PCI_ANY_ID )) -return i->dma_source (dev); - } - -return pci_dev_get (dev); -} -/* * AMD has indicated that the devices below do not support peer-to-peer * in any system where they are found in the southbridge with an AMD
include/linux/pci.h +0 -5
@@ -1557,16 +1557,11 @@ enum pci_fixup_pass {#ifdef CONFIG_PCI_QUIRKS void pci_fixup_device (enum pci_fixup_pass pass,struct pci_dev *dev); -struct pci_dev *pci_get_dma_source (struct pci_dev *dev);int pci_dev_specific_acs_enabled (struct pci_dev *dev,u16 acs_flags);void pci_dev_specific_enable_acs (struct pci_dev *dev);#else static inline void pci_fixup_device (enum pci_fixup_pass pass,struct pci_dev *dev) { } -static inline struct pci_dev *pci_get_dma_source (struct pci_dev *dev) -{ -return pci_dev_get (dev); -}static inline int pci_dev_specific_acs_enabled (struct pci_dev *dev,u16 acs_flags) {
Quoted 5 lines · Alex Williamson
v1: inopportune DNS failure blocked patches, resending
Now that IOMMU drivers have completed the DMA alias transition, remove the left behind dead code. Thanks,
Quoted 7 lines
Alex
---
Alex Williamson (2):
PCI: Removepci_get_dma_source()
PCI: Removepci_find_upstream_pcie_bridge()
Applied to pci/virtualization for v3.18, thanks!
Quoted 4 lines
drivers/pci/quirks.c | 51 -------------------------------------------------- drivers/pci/search.c | 34 --------------------------------- include/linux/pci.h | 16 ---------------- 3 files changed, 101 deletions(-)