vtd: context_table_addr should be hpa

add necessary HPA2HVA/HVA2HPA transition for context_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:41:30 +08:00 committed by Jack Ren
parent 403076e6b9
commit 4ea7588241
1 changed files with 3 additions and 4 deletions

View File

@ -974,8 +974,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
if (!DMAR_GET_BITSLICE(root_entry->lower, ROOT_ENTRY_LOWER_PRESENT)) {
/* create context table for the bus if not present */
context_table_addr =
(uint64_t)alloc_paging_struct();
context_table_addr = HVA2HPA(alloc_paging_struct());
context_table_addr = context_table_addr >> 12;
@ -994,7 +993,7 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
context_table_addr = context_table_addr << 12;
context_table = (uint64_t *)context_table_addr;
context_table = (uint64_t *)HPA2HVA(context_table_addr);
context_entry = (struct dmar_context_entry *)&context_table[devfun * 2];
/* the context entry should not be present */
@ -1073,7 +1072,7 @@ remove_iommu_device(struct iommu_domain *domain, uint16_t segment,
context_table_addr = DMAR_GET_BITSLICE(root_entry->lower,
ROOT_ENTRY_LOWER_CTP);
context_table_addr = context_table_addr << 12;
context_table = (uint64_t *)context_table_addr;
context_table = (uint64_t *)HPA2HVA(context_table_addr);
context_entry = (struct dmar_context_entry *)&context_table[devfun * 2];