aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLogan Gunthorpe <logang@deltatee.com>2018-05-30 16:13:11 -0400
committerBjorn Helgaas <bhelgaas@google.com>2018-06-30 14:45:33 -0400
commitf778a0d26fe3912424401e7b997155094de36487 (patch)
treeac8958b08bf48ac20a61b8a99d8637e9456e6630
parentad281ecf1c7d4c905607e049b967bb6412587ca1 (diff)
PCI: Expand documentation for pci_add_dma_alias()
Seeing there's been some confusion about the use of pci_add_dma_alias(), expand the comment to describe why it must be called early and how early it must be called. Also, expand on the purpose of this function and common reasons it would be used. [The comment was reworded to some extent by Alex Williamson] Signed-off-by: Logan Gunthorpe <logang@deltatee.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Doug Meyer <dmeyer@gigaio.com>
-rw-r--r--drivers/pci/pci.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 97acba712e4e..ea4a9d3be9f9 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5387,8 +5387,19 @@ int pci_set_vga_state(struct pci_dev *dev, bool decode,
5387 * @dev: the PCI device for which alias is added 5387 * @dev: the PCI device for which alias is added
5388 * @devfn: alias slot and function 5388 * @devfn: alias slot and function
5389 * 5389 *
5390 * This helper encodes 8-bit devfn as bit number in dma_alias_mask. 5390 * This helper encodes an 8-bit devfn as a bit number in dma_alias_mask
5391 * It should be called early, preferably as PCI fixup header quirk. 5391 * which is used to program permissible bus-devfn source addresses for DMA
5392 * requests in an IOMMU. These aliases factor into IOMMU group creation
5393 * and are useful for devices generating DMA requests beyond or different
5394 * from their logical bus-devfn. Examples include device quirks where the
5395 * device simply uses the wrong devfn, as well as non-transparent bridges
5396 * where the alias may be a proxy for devices in another domain.
5397 *
5398 * IOMMU group creation is performed during device discovery or addition,
5399 * prior to any potential DMA mapping and therefore prior to driver probing
5400 * (especially for userspace assigned devices where IOMMU group definition
5401 * cannot be left as a userspace activity). DMA aliases should therefore
5402 * be configured via quirks, such as the PCI fixup header quirk.
5392 */ 5403 */
5393void pci_add_dma_alias(struct pci_dev *dev, u8 devfn) 5404void pci_add_dma_alias(struct pci_dev *dev, u8 devfn)
5394{ 5405{