Skip to content

Commit 403076e

Browse files
JasonChenCJjren1
authored andcommitted
vtd: dmar_uint->root_table_addr should be hpa
add necessary HPA2HVA/HVA2HPA transition for root_table_addr Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com> Acked-by: Tian, Kevin <kevin.tian@intel.com> Acked-by: Xu, Anthony <anthony.xu@intel.com>
1 parent 3847a4d commit 403076e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

hypervisor/arch/x86/vtd.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -965,14 +965,10 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
965965
}
966966

967967
if (dmar_uint->root_table_addr == 0) {
968-
/* 1:1 mapping for hypervisor HEAP,
969-
* physical address equals virtual address
970-
*/
971-
dmar_uint->root_table_addr =
972-
(uint64_t)alloc_paging_struct();
968+
dmar_uint->root_table_addr = HVA2HPA(alloc_paging_struct());
973969
}
974970

975-
root_table = (uint64_t *)dmar_uint->root_table_addr;
971+
root_table = (uint64_t *)HPA2HVA(dmar_uint->root_table_addr);
976972

977973
root_entry = (struct dmar_root_entry *)&root_table[bus * 2];
978974

@@ -1071,7 +1067,7 @@ remove_iommu_device(struct iommu_domain *domain, uint16_t segment,
10711067
return 1;
10721068
}
10731069

1074-
root_table = (uint64_t *)dmar_uint->root_table_addr;
1070+
root_table = (uint64_t *)HPA2HVA(dmar_uint->root_table_addr);
10751071
root_entry = (struct dmar_root_entry *)&root_table[bus * 2];
10761072

10771073
context_table_addr = DMAR_GET_BITSLICE(root_entry->lower,

0 commit comments

Comments
 (0)