Commit dc534b25 authored by Joerg Roedel's avatar Joerg Roedel

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: default avatarJoerg Roedel <jroedel@suse.de>
parent 2452d9db
...@@ -1832,9 +1832,9 @@ static inline int guestwidth_to_adjustwidth(int gaw) ...@@ -1832,9 +1832,9 @@ static inline int guestwidth_to_adjustwidth(int gaw)
return agaw; 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; int adjust_width, agaw;
unsigned long sagaw; unsigned long sagaw;
...@@ -1843,7 +1843,6 @@ static int domain_init(struct dmar_domain *domain, int guest_width) ...@@ -1843,7 +1843,6 @@ static int domain_init(struct dmar_domain *domain, int guest_width)
domain_reserve_special_ranges(domain); domain_reserve_special_ranges(domain);
/* calculate AGAW */ /* calculate AGAW */
iommu = domain_get_iommu(domain);
if (guest_width > cap_mgaw(iommu->cap)) if (guest_width > cap_mgaw(iommu->cap))
guest_width = cap_mgaw(iommu->cap); guest_width = cap_mgaw(iommu->cap);
domain->gaw = guest_width; domain->gaw = guest_width;
...@@ -2389,7 +2388,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw) ...@@ -2389,7 +2388,7 @@ static struct dmar_domain *get_domain_for_dev(struct device *dev, int gaw)
return NULL; return NULL;
} }
domain_attach_iommu(domain, iommu); domain_attach_iommu(domain, iommu);
if (domain_init(domain, gaw)) { if (domain_init(domain, iommu, gaw)) {
domain_exit(domain); domain_exit(domain);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment