Commit 8140a95d authored by Allen Kay's avatar Allen Kay Committed by David Woodhouse

intel-iommu: set iommu_superpage on VM domains to lowest common denominator

set dmar->iommu_superpage field to the smallest common denominator
of super page sizes supported by all active VT-d engines.  Initialize
this field in intel_iommu_domain_init() API so intel_iommu_map() API
will be able to use iommu_superpage field to determine the appropriate
super page size to use.
Signed-off-by: default avatarAllen Kay <allen.m.kay@intel.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 292827cb
...@@ -580,17 +580,18 @@ static void domain_update_iommu_snooping(struct dmar_domain *domain) ...@@ -580,17 +580,18 @@ static void domain_update_iommu_snooping(struct dmar_domain *domain)
static void domain_update_iommu_superpage(struct dmar_domain *domain) static void domain_update_iommu_superpage(struct dmar_domain *domain)
{ {
int i, mask = 0xf; struct dmar_drhd_unit *drhd;
struct intel_iommu *iommu = NULL;
int mask = 0xf;
if (!intel_iommu_superpage) { if (!intel_iommu_superpage) {
domain->iommu_superpage = 0; domain->iommu_superpage = 0;
return; return;
} }
domain->iommu_superpage = 4; /* 1TiB */ /* set iommu_superpage to the smallest common denominator */
for_each_active_iommu(iommu, drhd) {
for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) { mask &= cap_super_page_val(iommu->cap);
mask |= cap_super_page_val(g_iommus[i]->cap);
if (!mask) { if (!mask) {
break; break;
} }
...@@ -3748,6 +3749,7 @@ static int intel_iommu_domain_init(struct iommu_domain *domain) ...@@ -3748,6 +3749,7 @@ static int intel_iommu_domain_init(struct iommu_domain *domain)
vm_domain_exit(dmar_domain); vm_domain_exit(dmar_domain);
return -ENOMEM; return -ENOMEM;
} }
domain_update_iommu_cap(dmar_domain);
domain->priv = dmar_domain; domain->priv = dmar_domain;
return 0; return 0;
......
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