summaryrefslogtreecommitdiffstats
path: root/drivers/iommu/amd_iommu.c
diff options
context:
space:
mode:
authorJoerg Roedel <joerg.roedel@amd.com>2012-01-09 13:06:28 +0100
committerJoerg Roedel <joerg.roedel@amd.com>2012-01-09 13:06:28 +0100
commitf93ea733878733f3e98475bc3e2ccf789bebcfb8 (patch)
treece4981e49a75d5bac7f0d2fa4ddcdcc130cf56f0 /drivers/iommu/amd_iommu.c
parent00fb5430f547e411ab03385cfa548776aaac1c92 (diff)
parent95bdaf71ccf2cb4bba0c9a3d2baea0e7916f466b (diff)
downloadlinux-f93ea733878733f3e98475bc3e2ccf789bebcfb8.tar.gz
linux-f93ea733878733f3e98475bc3e2ccf789bebcfb8.tar.xz
linux-f93ea733878733f3e98475bc3e2ccf789bebcfb8.zip
Merge branches 'iommu/page-sizes' and 'iommu/group-id' into next
Conflicts: drivers/iommu/amd_iommu.c drivers/iommu/intel-iommu.c include/linux/iommu.h
Diffstat (limited to 'drivers/iommu/amd_iommu.c')
-rw-r--r--drivers/iommu/amd_iommu.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index edd291070b0b..cce1f03b8895 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -3188,6 +3188,26 @@ static int amd_iommu_domain_has_cap(struct iommu_domain *domain,
return 0;
}
+static int amd_iommu_device_group(struct device *dev, unsigned int *groupid)
+{
+ struct iommu_dev_data *dev_data = dev->archdata.iommu;
+ struct pci_dev *pdev = to_pci_dev(dev);
+ u16 devid;
+
+ if (!dev_data)
+ return -ENODEV;
+
+ if (pdev->is_virtfn || !iommu_group_mf)
+ devid = dev_data->devid;
+ else
+ devid = calc_devid(pdev->bus->number,
+ PCI_DEVFN(PCI_SLOT(pdev->devfn), 0));
+
+ *groupid = amd_iommu_alias_table[devid];
+
+ return 0;
+}
+
static struct iommu_ops amd_iommu_ops = {
.domain_init = amd_iommu_domain_init,
.domain_destroy = amd_iommu_domain_destroy,
@@ -3197,6 +3217,7 @@ static struct iommu_ops amd_iommu_ops = {
.unmap = amd_iommu_unmap,
.iova_to_phys = amd_iommu_iova_to_phys,
.domain_has_cap = amd_iommu_domain_has_cap,
+ .device_group = amd_iommu_device_group,
.pgsize_bitmap = AMD_IOMMU_PGSIZES,
};