summaryrefslogtreecommitdiff
path: root/drivers/iommu
diff options
context:
space:
mode:
authorJoerg Roedel <jroedel@suse.de>2015-07-21 12:18:21 +0300
committerJoerg Roedel <jroedel@suse.de>2015-08-12 17:23:33 +0300
commite2411427f7d3ddcf8d5f35d5ab0a397180deac3a (patch)
tree3feaaf3680770bf12713d58da5692e3931c2e0d0 /drivers/iommu
parent8bf478163e69e42973c7070179a11815139e5bf0 (diff)
downloadlinux-e2411427f7d3ddcf8d5f35d5ab0a397180deac3a.tar.xz
iommu/vt-d: Get rid of iommu_attach_vm_domain()
The special case for VM domains is not needed, as other domains could be attached to the iommu in the same way. So get rid of this special case. Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r--drivers/iommu/intel-iommu.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 90ab4b0d975c..0a07b44fbc82 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -1671,8 +1671,13 @@ static int __iommu_attach_domain(struct dmar_domain *domain,
int num;
unsigned long ndomains;
+ num = domain->iommu_did[iommu->seq_id];
+ if (num)
+ return num;
+
ndomains = cap_ndoms(iommu->cap);
- num = find_first_zero_bit(iommu->domain_ids, ndomains);
+ num = find_first_zero_bit(iommu->domain_ids, ndomains);
+
if (num < ndomains) {
set_bit(num, iommu->domain_ids);
set_iommu_domain(iommu, num, domain);
@@ -1681,6 +1686,9 @@ static int __iommu_attach_domain(struct dmar_domain *domain,
num = -ENOSPC;
}
+ if (num < 0)
+ pr_err("%s: No free domain ids\n", iommu->name);
+
return num;
}
@@ -1693,24 +1701,10 @@ static int iommu_attach_domain(struct dmar_domain *domain,
spin_lock_irqsave(&iommu->lock, flags);
num = __iommu_attach_domain(domain, iommu);
spin_unlock_irqrestore(&iommu->lock, flags);
- if (num < 0)
- pr_err("%s: No free domain ids\n", iommu->name);
return num;
}
-static int iommu_attach_vm_domain(struct dmar_domain *domain,
- struct intel_iommu *iommu)
-{
- int num;
-
- num = domain->iommu_did[iommu->seq_id];
- if (num)
- return num;
-
- return __iommu_attach_domain(domain, iommu);
-}
-
static void iommu_detach_domain(struct dmar_domain *domain,
struct intel_iommu *iommu)
{
@@ -1947,7 +1941,7 @@ static int domain_context_mapping_one(struct dmar_domain *domain,
if (domain_type_is_vm_or_si(domain)) {
if (domain_type_is_vm(domain)) {
- id = iommu_attach_vm_domain(domain, iommu);
+ id = __iommu_attach_domain(domain, iommu);
if (id < 0) {
spin_unlock_irqrestore(&iommu->lock, flags);
pr_err("%s: No free domain ids\n", iommu->name);