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>
This commit is contained in:
Jason Chen CJ 2018-04-10 21:34:12 +08:00 committed by Jack Ren
parent 3847a4d1a9
commit 403076e6b9
1 changed files with 3 additions and 7 deletions

View File

@ -965,14 +965,10 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
} }
if (dmar_uint->root_table_addr == 0) { if (dmar_uint->root_table_addr == 0) {
/* 1:1 mapping for hypervisor HEAP, dmar_uint->root_table_addr = HVA2HPA(alloc_paging_struct());
* physical address equals virtual address
*/
dmar_uint->root_table_addr =
(uint64_t)alloc_paging_struct();
} }
root_table = (uint64_t *)dmar_uint->root_table_addr; root_table = (uint64_t *)HPA2HVA(dmar_uint->root_table_addr);
root_entry = (struct dmar_root_entry *)&root_table[bus * 2]; root_entry = (struct dmar_root_entry *)&root_table[bus * 2];
@ -1071,7 +1067,7 @@ remove_iommu_device(struct iommu_domain *domain, uint16_t segment,
return 1; return 1;
} }
root_table = (uint64_t *)dmar_uint->root_table_addr; root_table = (uint64_t *)HPA2HVA(dmar_uint->root_table_addr);
root_entry = (struct dmar_root_entry *)&root_table[bus * 2]; root_entry = (struct dmar_root_entry *)&root_table[bus * 2];
context_table_addr = DMAR_GET_BITSLICE(root_entry->lower, context_table_addr = DMAR_GET_BITSLICE(root_entry->lower,