]> git.karo-electronics.de Git - linux-beck.git/commitdiff
iommu/vt-d: Pass an iommu pointer to domain_init()
authorJoerg Roedel <jroedel@suse.de>
Wed, 22 Jul 2015 10:44:02 +0000 (12:44 +0200)
committerJoerg Roedel <jroedel@suse.de>
Wed, 12 Aug 2015 14:23:36 +0000 (16:23 +0200)
This allows to do domain->iommu attachment after domain_init
has run.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/intel-iommu.c

index 62c27eff549d062ecc678ff7517040636be4a08b..de5384e7e0521cc3139e524d27273da837518b24 100644 (file)
@@ -1832,9 +1832,9 @@ static inline int guestwidth_to_adjustwidth(int gaw)
        return agaw;
 }
 
-static int domain_init(struct dmar_domain *domain, int guest_width)
+static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu,
+                      int guest_width)
 {
-       struct intel_iommu *iommu;
        int adjust_width, agaw;
        unsigned long sagaw;
 
@@ -1843,7 +1843,6 @@ static int domain_init(struct dmar_domain *domain, int guest_width)
        domain_reserve_special_ranges(domain);
 
        /* calculate AGAW */
-       iommu = domain_get_iommu(domain);
        if (guest_width > cap_mgaw(iommu->cap))
                guest_width = cap_mgaw(iommu->cap);
        domain->gaw = guest_width;
@@ -2389,7 +2388,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
                return NULL;
        }
        domain_attach_iommu(domain, iommu);
-       if (domain_init(domain, gaw)) {
+       if (domain_init(domain, iommu, gaw)) {
                domain_exit(domain);
                return NULL;
        }