diff options
author | Joerg Roedel <jroedel@suse.de> | 2015-07-22 06:44:02 -0400 |
---|---|---|
committer | Joerg Roedel <jroedel@suse.de> | 2015-08-12 10:23:36 -0400 |
commit | dc534b25d11f42e6b4caa5b1918f549d9c0e9d4d (patch) | |
tree | ec7d8febc8016a3b25672ac263e461dfee3cdd27 /drivers/iommu | |
parent | 2452d9db1218fdb1c29afb921838c323987f5799 (diff) |
iommu/vt-d: Pass an iommu pointer to domain_init()
This allows to do domain->iommu attachment after domain_init
has run.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/intel-iommu.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 62c27eff549d..de5384e7e052 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
@@ -1832,9 +1832,9 @@ static inline int guestwidth_to_adjustwidth(int gaw) | |||
1832 | return agaw; | 1832 | return agaw; |
1833 | } | 1833 | } |
1834 | 1834 | ||
1835 | static int domain_init(struct dmar_domain *domain, int guest_width) | 1835 | static int domain_init(struct dmar_domain *domain, struct intel_iommu *iommu, |
1836 | int guest_width) | ||
1836 | { | 1837 | { |
1837 | struct intel_iommu *iommu; | ||
1838 | int adjust_width, agaw; | 1838 | int adjust_width, agaw; |
1839 | unsigned long sagaw; | 1839 | unsigned long sagaw; |
1840 | 1840 | ||
@@ -1843,7 +1843,6 @@ static int domain_init(struct dmar_domain *domain, int guest_width) | |||
1843 | domain_reserve_special_ranges(domain); | 1843 | domain_reserve_special_ranges(domain); |
1844 | 1844 | ||
1845 | /* calculate AGAW */ | 1845 | /* calculate AGAW */ |
1846 | iommu = domain_get_iommu(domain); | ||
1847 | if (guest_width > cap_mgaw(iommu->cap)) | 1846 | if (guest_width > cap_mgaw(iommu->cap)) |
1848 | guest_width = cap_mgaw(iommu->cap); | 1847 | guest_width = cap_mgaw(iommu->cap); |
1849 | domain->gaw = guest_width; | 1848 | domain->gaw = guest_width; |
@@ -2389,7 +2388,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) | |||
2389 | return NULL; | 2388 | return NULL; |
2390 | } | 2389 | } |
2391 | domain_attach_iommu(domain, iommu); | 2390 | domain_attach_iommu(domain, iommu); |
2392 | if (domain_init(domain, gaw)) { | 2391 | if (domain_init(domain, iommu, gaw)) { |
2393 | domain_exit(domain); | 2392 | domain_exit(domain); |
2394 | return NULL; | 2393 | return NULL; |
2395 | } | 2394 | } |