PCI: Add support for DMA alias quirks

Some devices are broken and use a requester ID other than their physical
devfn.  Add a byte, using an existing gap in the pci_dev structure, to
store an alternate "alias" devfn.  A bit in the dev_flags tells us when
this is valid.  We then add the alias as one more step in the
pci_for_each_dma_alias() iterator.

Tested-by: George Spelvin <[email protected]>
Tested-by: Pat Erley <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
Signed-off-by: Bjorn Helgaas <[email protected]>
This commit is contained in:
Alex Williamson 2014-05-22 17:07:43 -06:00 • committed by Bjorn Helgaas
commit 31c2b8153c
2 changed files with 14 additions and 0 deletions

View file

@ -37,6 +37,17 @@ int pci_for_each_dma_alias(struct pci_dev *pdev,
if (ret)
return ret;
/*
* If the device is broken and uses an alias requester ID for
* DMA, iterate over that too.
*/
if (unlikely(pdev->dev_flags & PCI_DEV_FLAGS_DMA_ALIAS_DEVFN)) {
ret = fn(pdev, PCI_DEVID(pdev->bus->number,
pdev->dma_alias_devfn), data);
if (ret)
return ret;
}
for (bus = pdev->bus; !pci_is_root_bus(bus); bus = bus->parent) {
struct pci_dev *tmp;