Commit 8140a95d228efbcd64d84150e794761a32463947

Authored by Allen Kay
Committed by David Woodhouse
1 parent 292827cb16

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: Allen Kay <allen.m.kay@intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

Showing 1 changed file with 7 additions and 5 deletions Side-by-side Diff

drivers/iommu/intel-iommu.c
... ... @@ -580,17 +580,18 @@
580 580  
581 581 static void domain_update_iommu_superpage(struct dmar_domain *domain)
582 582 {
583   - int i, mask = 0xf;
  583 + struct dmar_drhd_unit *drhd;
  584 + struct intel_iommu *iommu = NULL;
  585 + int mask = 0xf;
584 586  
585 587 if (!intel_iommu_superpage) {
586 588 domain->iommu_superpage = 0;
587 589 return;
588 590 }
589 591  
590   - domain->iommu_superpage = 4; /* 1TiB */
591   -
592   - for_each_set_bit(i, &domain->iommu_bmp, g_num_of_iommus) {
593   - mask |= cap_super_page_val(g_iommus[i]->cap);
  592 + /* set iommu_superpage to the smallest common denominator */
  593 + for_each_active_iommu(iommu, drhd) {
  594 + mask &= cap_super_page_val(iommu->cap);
594 595 if (!mask) {
595 596 break;
596 597 }
... ... @@ -3748,6 +3749,7 @@
3748 3749 vm_domain_exit(dmar_domain);
3749 3750 return -ENOMEM;
3750 3751 }
  3752 + domain_update_iommu_cap(dmar_domain);
3751 3753 domain->priv = dmar_domain;
3752 3754  
3753 3755 return 0;