Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 321445
b: refs/heads/master
c: 31fe943
h: refs/heads/master
i:
  321443: aa68797
v: v3
  • Loading branch information
Alex Williamson authored and Joerg Roedel committed Aug 6, 2012
1 parent c7d3ffd commit b8cd062
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a4ff1fc2ccbd81e83ac51ea44570caa361c666af
refs/heads/master: 31fe943599b7e5870edb9decb7fbb9538b218f26
25 changes: 22 additions & 3 deletions trunk/drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,23 +296,42 @@ static int iommu_init_device(struct device *dev)
} else
dma_pdev = pci_dev_get(pdev);

/* Account for quirked devices */
swap_pci_ref(&dma_pdev, pci_get_dma_source(dma_pdev));

/*
* If it's a multifunction device that does not support our
* required ACS flags, add to the same group as function 0.
*/
if (dma_pdev->multifunction &&
!pci_acs_enabled(dma_pdev, REQ_ACS_FLAGS))
swap_pci_ref(&dma_pdev,
pci_get_slot(dma_pdev->bus,
PCI_DEVFN(PCI_SLOT(dma_pdev->devfn),
0)));

/*
* Devices on the root bus go through the iommu. If that's not us,
* find the next upstream device and test ACS up to the root bus.
* Finding the next device may require skipping virtual buses.
*/
while (!pci_is_root_bus(dma_pdev->bus)) {
if (pci_acs_path_enabled(dma_pdev->bus->self,
NULL, REQ_ACS_FLAGS))
struct pci_bus *bus = dma_pdev->bus;

while (!bus->self) {
if (!pci_is_root_bus(bus))
bus = bus->parent;
else
goto root_bus;
}

if (pci_acs_path_enabled(bus->self, NULL, REQ_ACS_FLAGS))
break;

swap_pci_ref(&dma_pdev, pci_dev_get(dma_pdev->bus->self));
swap_pci_ref(&dma_pdev, pci_dev_get(bus->self));
}

root_bus:
group = iommu_group_get(&dma_pdev->dev);
pci_dev_put(dma_pdev);
if (!group) {
Expand Down

0 comments on commit b8cd062

Please sign in to comment.