aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/pci/quirks.c51
-rw-r--r--include/linux/pci.h5
2 files changed, 0 insertions, 56 deletions
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index da062d8ae36f..01c935cc38dc 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3514,57 +3514,6 @@ DECLARE_PCI_FIXUP_HEADER(0x1283, 0x8892, quirk_use_pcie_bridge_dma_alias);
3514/* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */ 3514/* Intel 82801, https://bugzilla.kernel.org/show_bug.cgi?id=44881#c49 */
3515DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias); 3515DECLARE_PCI_FIXUP_HEADER(0x8086, 0x244e, quirk_use_pcie_bridge_dma_alias);
3516 3516
3517static struct pci_dev *pci_func_0_dma_source(struct pci_dev *dev)
3518{
3519 if (!PCI_FUNC(dev->devfn))
3520 return pci_dev_get(dev);
3521
3522 return pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0));
3523}
3524
3525static const struct pci_dev_dma_source {
3526 u16 vendor;
3527 u16 device;
3528 struct pci_dev *(*dma_source)(struct pci_dev *dev);
3529} pci_dev_dma_source[] = {
3530 /*
3531 * https://bugzilla.redhat.com/show_bug.cgi?id=605888
3532 *
3533 * Some Ricoh devices use the function 0 source ID for DMA on
3534 * other functions of a multifunction device. The DMA devices
3535 * is therefore function 0, which will have implications of the
3536 * iommu grouping of these devices.
3537 */
3538 { PCI_VENDOR_ID_RICOH, 0xe822, pci_func_0_dma_source },
3539 { PCI_VENDOR_ID_RICOH, 0xe230, pci_func_0_dma_source },
3540 { PCI_VENDOR_ID_RICOH, 0xe832, pci_func_0_dma_source },
3541 { PCI_VENDOR_ID_RICOH, 0xe476, pci_func_0_dma_source },
3542 { 0 }
3543};
3544
3545/*
3546 * IOMMUs with isolation capabilities need to be programmed with the
3547 * correct source ID of a device. In most cases, the source ID matches
3548 * the device doing the DMA, but sometimes hardware is broken and will
3549 * tag the DMA as being sourced from a different device. This function
3550 * allows that translation. Note that the reference count of the
3551 * returned device is incremented on all paths.
3552 */
3553struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
3554{
3555 const struct pci_dev_dma_source *i;
3556
3557 for (i = pci_dev_dma_source; i->dma_source; i++) {
3558 if ((i->vendor == dev->vendor ||
3559 i->vendor == (u16)PCI_ANY_ID) &&
3560 (i->device == dev->device ||
3561 i->device == (u16)PCI_ANY_ID))
3562 return i->dma_source(dev);
3563 }
3564
3565 return pci_dev_get(dev);
3566}
3567
3568/* 3517/*
3569 * AMD has indicated that the devices below do not support peer-to-peer 3518 * AMD has indicated that the devices below do not support peer-to-peer
3570 * in any system where they are found in the southbridge with an AMD 3519 * in any system where they are found in the southbridge with an AMD
diff --git a/include/linux/pci.h b/include/linux/pci.h
index bf5a47c0cb42..d68d8e33c196 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1557,16 +1557,11 @@ enum pci_fixup_pass {
1557 1557
1558#ifdef CONFIG_PCI_QUIRKS 1558#ifdef CONFIG_PCI_QUIRKS
1559void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1559void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1560struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1561int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags); 1560int pci_dev_specific_acs_enabled(struct pci_dev *dev, u16 acs_flags);
1562void pci_dev_specific_enable_acs(struct pci_dev *dev); 1561void pci_dev_specific_enable_acs(struct pci_dev *dev);
1563#else 1562#else
1564static inline void pci_fixup_device(enum pci_fixup_pass pass, 1563static inline void pci_fixup_device(enum pci_fixup_pass pass,
1565 struct pci_dev *dev) { } 1564 struct pci_dev *dev) { }
1566static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
1567{
1568 return pci_dev_get(dev);
1569}
1570static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev, 1565static inline int pci_dev_specific_acs_enabled(struct pci_dev *dev,
1571 u16 acs_flags) 1566 u16 acs_flags)
1572{ 1567{