Commit 64229e8f authored by Lu Baolu's avatar Lu Baolu Committed by Joerg Roedel

iommu/vt-d: Update first level super page capability

First-level translation may map input addresses to 4-KByte pages,
2-MByte pages, or 1-GByte pages. Support for 4-KByte pages and
2-Mbyte pages are mandatory for first-level translation. Hardware
support for 1-GByte page is reported through the FL1GP field in
the Capability Register.
Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent cb8b892d
...@@ -685,11 +685,12 @@ static int domain_update_iommu_snooping(struct intel_iommu *skip) ...@@ -685,11 +685,12 @@ static int domain_update_iommu_snooping(struct intel_iommu *skip)
return ret; return ret;
} }
static int domain_update_iommu_superpage(struct intel_iommu *skip) static int domain_update_iommu_superpage(struct dmar_domain *domain,
struct intel_iommu *skip)
{ {
struct dmar_drhd_unit *drhd; struct dmar_drhd_unit *drhd;
struct intel_iommu *iommu; struct intel_iommu *iommu;
int mask = 0xf; int mask = 0x3;
if (!intel_iommu_superpage) { if (!intel_iommu_superpage) {
return 0; return 0;
...@@ -699,7 +700,13 @@ static int domain_update_iommu_superpage(struct intel_iommu *skip) ...@@ -699,7 +700,13 @@ static int domain_update_iommu_superpage(struct intel_iommu *skip)
rcu_read_lock(); rcu_read_lock();
for_each_active_iommu(iommu, drhd) { for_each_active_iommu(iommu, drhd) {
if (iommu != skip) { if (iommu != skip) {
mask &= cap_super_page_val(iommu->cap); if (domain && domain_use_first_level(domain)) {
if (!cap_fl1gp_support(iommu->cap))
mask = 0x1;
} else {
mask &= cap_super_page_val(iommu->cap);
}
if (!mask) if (!mask)
break; break;
} }
...@@ -714,7 +721,7 @@ static void domain_update_iommu_cap(struct dmar_domain *domain) ...@@ -714,7 +721,7 @@ static void domain_update_iommu_cap(struct dmar_domain *domain)
{ {
domain_update_iommu_coherency(domain); domain_update_iommu_coherency(domain);
domain->iommu_snooping = domain_update_iommu_snooping(NULL); domain->iommu_snooping = domain_update_iommu_snooping(NULL);
domain->iommu_superpage = domain_update_iommu_superpage(NULL); domain->iommu_superpage = domain_update_iommu_superpage(domain, NULL);
} }
struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus, struct context_entry *iommu_context_addr(struct intel_iommu *iommu, u8 bus,
...@@ -4604,7 +4611,7 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru) ...@@ -4604,7 +4611,7 @@ static int intel_iommu_add(struct dmar_drhd_unit *dmaru)
iommu->name); iommu->name);
return -ENXIO; return -ENXIO;
} }
sp = domain_update_iommu_superpage(iommu) - 1; sp = domain_update_iommu_superpage(NULL, iommu) - 1;
if (sp >= 0 && !(cap_super_page_val(iommu->cap) & (1 << sp))) { if (sp >= 0 && !(cap_super_page_val(iommu->cap) & (1 << sp))) {
pr_warn("%s: Doesn't support large page.\n", pr_warn("%s: Doesn't support large page.\n",
iommu->name); iommu->name);
......
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