Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347498
b: refs/heads/master
c: ce7ac4a
h: refs/heads/master
v: v3
  • Loading branch information
Alex Williamson authored and Joerg Roedel committed Oct 24, 2012
1 parent 511f890 commit c6c21a6
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 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: 2bff6a508eb2ba8b341c20db3099e050e5496e3d
refs/heads/master: ce7ac4abf2401dfdcb1ac4c7277dab8ed90c8788
30 changes: 19 additions & 11 deletions trunk/drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,24 @@ static struct pci_dev *get_isolation_root(struct pci_dev *pdev)
return dma_pdev;
}

static int use_pdev_iommu_group(struct pci_dev *pdev, struct device *dev)
{
struct iommu_group *group = iommu_group_get(&pdev->dev);
int ret;

if (!group) {
group = iommu_group_alloc();
if (IS_ERR(group))
return PTR_ERR(group);

WARN_ON(&pdev->dev != dev);
}

ret = iommu_group_add_device(group, dev);
iommu_group_put(group);
return ret;
}

static int init_iommu_group(struct device *dev)
{
struct iommu_dev_data *dev_data;
Expand Down Expand Up @@ -353,18 +371,8 @@ static int init_iommu_group(struct device *dev)
dma_pdev = pci_dev_get(to_pci_dev(dev));

dma_pdev = get_isolation_root(dma_pdev);
group = iommu_group_get(&dma_pdev->dev);
ret = use_pdev_iommu_group(dma_pdev, dev);
pci_dev_put(dma_pdev);
if (!group) {
group = iommu_group_alloc();
if (IS_ERR(group))
return PTR_ERR(group);
}

ret = iommu_group_add_device(group, dev);

iommu_group_put(group);

return ret;
}

Expand Down

0 comments on commit c6c21a6

Please sign in to comment.