Skip to contentSkip to conversation

iommu/vt-d: respect max guest address width in agaw

PATCH Applied Jacob Pan 2 participants 4 messages Nov 6, 2018 – Nov 8, 2018 IOMMU

lore
Share & tools
lore

Jacob Pan

author
#0 lore raw

PATCH v2 1/1 iommu/vt-d: respect max guest address width in agaw

Supported guest address witdh (SGAW) only indicates what the iommu's capabilities are wrt page table levels for second level page-tables. IOMMU should pick the right level depending on the Maximum Guest Address Width (MGAW).

For pass-through translation type, address width must be programmed with the largest AGAW supported by the HW.

---
 drivers/iommu/intel-iommu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/iommu/intel-iommu.c +5 -1
index 140d6ab..f16db3b 100644
@@ -719,7 +719,11 @@ int iommu_calculate_max_sagaw(struct intel_iommu *iommu)
  */
 int iommu_calculate_agaw(struct intel_iommu *iommu)
 {
-	return __iommu_calculate_agaw(iommu, DEFAULT_DOMAIN_ADDRESS_WIDTH);
+	unsigned long mgaw;
+
+	/* Respect Max Guest Address Width */
+	mgaw = min(cap_mgaw(iommu->cap), DEFAULT_DOMAIN_ADDRESS_WIDTH);
+	return __iommu_calculate_agaw(iommu, mgaw);
 }
 
 /* This functionin only returns single iommu in a domain */
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 2 lines · Jacob Pan
 drivers/iommu/intel-iommu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Applied, thanks.

author
#2 lore raw
Quoted 5 lines · On Wed, 7 Nov 2018 17:04:28 +0100 Joerg Roedel <[email protected]> wrote:
Quoted 2 lines · Jacob Pan
 drivers/iommu/intel-iommu.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)  

Applied, thanks.

Hi Joerg,
We have found some issues with this patch on some platforms. Please disregard this patch.

The intent of this patch was to fix some IOMMU with max address of 48 but SAGAW of both 48 and 57 bits. Need to do more investigation in the page table level calculation and context address width setup. Sorry about that.

Jacob

maintainer
#3 lore raw
Quoted 2 lines · Jacob Pan

We have found some issues with this patch on some platforms. Please disregard this patch.

Patch dropped.