Skip to contentSkip to conversation

intel_iommu: TM field should not be in reserved bits

PATCH Superseded [email protected] 2 participants 2 messages Sep 26, 2019

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 intel_iommu: TM field should not be in reserved bits

From: "Zhang, Qi" <[email protected]>

When dt is supported, TM field should not be Reserved(0).

Refer to VT-d Spec 9.8

---
 hw/i386/intel_iommu.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/i386/intel_iommu.c +7 -0
index f1de8fdb75..2696ceeb9d 100644
@@ -3567,6 +3567,13 @@ static void vtd_init(IntelIOMMUState *s)
 
     if (x86_iommu->dt_supported) {
         s->ecap |= VTD_ECAP_DT;
+        vtd_paging_entry_rsvd_field[1] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[2] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[3] &= ~(1ULL << 62);
+
+        vtd_paging_entry_rsvd_field[5] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[6] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[7] &= ~(1ULL << 62);
     }
 
     if (x86_iommu->pt_supported) {
Signature · 1 line
2.20.1
#1 lore raw
Quoted 17 lines · On Thu, Sep 26, 2019 at 01:49:22PM +0800, [email protected] wrote:

From: "Zhang, Qi" <[email protected]>

When dt is supported, TM field should not be Reserved(0).

Refer to VT-d Spec 9.8

---
 hw/i386/intel_iommu.c | 7 +++++++
 1 file changed, 7 insertions(+)
hw/i386/intel_iommu.c +0 -0
index f1de8fdb75..2696ceeb9d 100644

hw/i386/intel_iommu.c static void vtd_init(IntelIOMMUState *s) · line 3576

Quoted 10 lines
hw/i386/intel_iommu.c +7 -0
@@ -3567,6 +3567,13 @@ static void vtd_init(IntelIOMMUState *s)
 
     if (x86_iommu->dt_supported) {
         s->ecap |= VTD_ECAP_DT;
+        vtd_paging_entry_rsvd_field[1] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[2] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[3] &= ~(1ULL << 62);
+
+        vtd_paging_entry_rsvd_field[5] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[6] &= ~(1ULL << 62);
+        vtd_paging_entry_rsvd_field[7] &= ~(1ULL << 62);

Add a macro for this value, please.

And I think it's cleaner to pass dt_supported flag to VTD_SPTE_PAGE_LX_RSVD_MASK and VTD_SPTE_LPAGE_LX_RSVD_MASK, rather than set bits then clear them selectively.

Quoted 5 lines
hw/i386/intel_iommu.c +0 -0
     }
 
     if (x86_iommu->pt_supported) {
Signature · 1 line
2.20.1