aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/pci.h
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2012-06-11 01:26:55 -0400
committerBjorn Helgaas <bhelgaas@google.com>2012-06-11 20:37:43 -0400
commit12ea6cad1c7d046e21decc18b0e2170c6794dc51 (patch)
treed72a1034cd7436c4b705e86f3cfc83dad03b3574 /include/linux/pci.h
parentcfaf025112d3856637ff34a767ef785ef5cf2ca9 (diff)
PCI: add PCI DMA source ID quirk
DMA transactions are tagged with the source ID of the device making the request. Occasionally hardware screws this up and uses the source ID of a different device (often the wrong function number of a multifunction device). A specific Ricoh multifunction device is a prime example of this problem and included in this patch. Given a pci_dev, this function returns the pci_dev to use as the source ID for DMA. When hardware works correctly, this returns the input device. For the components of the Ricoh multifunction device, it returns the pci_dev for function 0. This will be used by IOMMU drivers for determining the boundaries of IOMMU groups as multiple devices using the same source ID must be contained within the same group. This can also be used by existing streaming DMA paths for the same purpose. [bhelgaas: fold in pci_dev_get() for !CONFIG_PCI] Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Diffstat (limited to 'include/linux/pci.h')
-rw-r--r--include/linux/pci.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/pci.h b/include/linux/pci.h
index d8c379dba6ad..39983be7b25b 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1332,6 +1332,9 @@ static inline struct pci_dev *pci_get_bus_and_slot(unsigned int bus,
1332static inline int pci_domain_nr(struct pci_bus *bus) 1332static inline int pci_domain_nr(struct pci_bus *bus)
1333{ return 0; } 1333{ return 0; }
1334 1334
1335static inline struct pci_dev *pci_dev_get(struct pci_dev *dev)
1336{ return NULL; }
1337
1335#define dev_is_pci(d) (false) 1338#define dev_is_pci(d) (false)
1336#define dev_is_pf(d) (false) 1339#define dev_is_pf(d) (false)
1337#define dev_num_vf(d) (0) 1340#define dev_num_vf(d) (0)
@@ -1486,9 +1489,14 @@ enum pci_fixup_pass {
1486 1489
1487#ifdef CONFIG_PCI_QUIRKS 1490#ifdef CONFIG_PCI_QUIRKS
1488void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev); 1491void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev);
1492struct pci_dev *pci_get_dma_source(struct pci_dev *dev);
1489#else 1493#else
1490static inline void pci_fixup_device(enum pci_fixup_pass pass, 1494static inline void pci_fixup_device(enum pci_fixup_pass pass,
1491 struct pci_dev *dev) {} 1495 struct pci_dev *dev) {}
1496static inline struct pci_dev *pci_get_dma_source(struct pci_dev *dev)
1497{
1498 return pci_dev_get(dev);
1499}
1492#endif 1500#endif
1493 1501
1494void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); 1502void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen);