diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2012-01-09 13:06:28 +0100 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2012-01-09 13:06:28 +0100 |
commit | f93ea733878733f3e98475bc3e2ccf789bebcfb8 (patch) | |
tree | ce4981e49a75d5bac7f0d2fa4ddcdcc130cf56f0 /drivers/iommu/amd_iommu.c | |
parent | 00fb5430f547e411ab03385cfa548776aaac1c92 (diff) | |
parent | 95bdaf71ccf2cb4bba0c9a3d2baea0e7916f466b (diff) |
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.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index edd291070b0..cce1f03b889 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, }; |