Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347497
b: refs/heads/master
c: 2bff6a5
h: refs/heads/master
i:
  347495: 50375b5
v: v3
  • Loading branch information
Alex Williamson authored and Joerg Roedel committed Oct 24, 2012
1 parent cf28231 commit 511f890
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 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: 2851db21b88ff3e80e1b3ab5e23b1a49d6f734bf
refs/heads/master: 2bff6a508eb2ba8b341c20db3099e050e5496e3d
24 changes: 15 additions & 9 deletions trunk/drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,18 @@ static void swap_pci_ref(struct pci_dev **from, struct pci_dev *to)
*from = to;
}

static struct pci_bus *find_hosted_bus(struct pci_bus *bus)
{
while (!bus->self) {
if (!pci_is_root_bus(bus))
bus = bus->parent;
else
return ERR_PTR(-ENODEV);
}

return bus;
}

#define REQ_ACS_FLAGS (PCI_ACS_SV | PCI_ACS_RR | PCI_ACS_CR | PCI_ACS_UF)

static struct pci_dev *get_isolation_root(struct pci_dev *pdev)
Expand All @@ -300,22 +312,16 @@ static struct pci_dev *get_isolation_root(struct pci_dev *pdev)
* Finding the next device may require skipping virtual buses.
*/
while (!pci_is_root_bus(dma_pdev->bus)) {
struct pci_bus *bus = dma_pdev->bus;

while (!bus->self) {
if (!pci_is_root_bus(bus))
bus = bus->parent;
else
goto root_bus;
}
struct pci_bus *bus = find_hosted_bus(dma_pdev->bus);
if (IS_ERR(bus))
break;

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

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

root_bus:
return dma_pdev;
}

Expand Down

0 comments on commit 511f890

Please sign in to comment.