Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 316580
b: refs/heads/master
c: 9dcd613
h: refs/heads/master
v: v3
  • Loading branch information
Alex Williamson authored and Joerg Roedel committed Jun 25, 2012
1 parent df3f74e commit 7bfac28
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 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: d72e31c9374627068df29da8085ca18c92ae35d3
refs/heads/master: 9dcd61303af862c279df86aa97fde7ce371be774
24 changes: 23 additions & 1 deletion trunk/drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,11 @@ static bool check_device(struct device *dev)

static int iommu_init_device(struct device *dev)
{
struct pci_dev *pdev = to_pci_dev(dev);
struct pci_dev *dma_pdev, *pdev = to_pci_dev(dev);
struct iommu_dev_data *dev_data;
struct iommu_group *group;
u16 alias;
int ret;

if (dev->archdata.iommu)
return 0;
Expand All @@ -279,8 +281,26 @@ static int iommu_init_device(struct device *dev)
return -ENOTSUPP;
}
dev_data->alias_data = alias_data;

dma_pdev = pci_get_bus_and_slot(alias >> 8, alias & 0xff);
} else
dma_pdev = pci_dev_get(pdev);

group = iommu_group_get(&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);

if (ret)
return ret;

if (pci_iommuv2_capable(pdev)) {
struct amd_iommu *iommu;

Expand Down Expand Up @@ -309,6 +329,8 @@ static void iommu_ignore_device(struct device *dev)

static void iommu_uninit_device(struct device *dev)
{
iommu_group_remove_device(dev);

/*
* Nothing to do here - we keep dev_data around for unplugged devices
* and reuse it when the device is re-plugged - not doing so would
Expand Down

0 comments on commit 7bfac28

Please sign in to comment.