Revert "hv: init_iommu rework to enable IOMMU for partition mode ACRN"

This reverts commit d8508e4229.
This commit is contained in:
Zhang, wenling 2018-09-19 09:24:02 +08:00
parent 40dfd3fc24
commit d4afddc0a7

View File

@ -659,18 +659,9 @@ static void dmar_set_root_table(struct dmar_drhd_rt *dmar_uint)
{
uint64_t address;
uint32_t status;
void *root_table_vaddr = NULL;
spinlock_obtain(&(dmar_uint->lock));
root_table_vaddr = alloc_paging_struct();
if (root_table_vaddr != NULL) {
dmar_uint->root_table_addr = hva2hpa(root_table_vaddr);
} else {
ASSERT(false, "failed to allocate root table!");
}
/* Currently don't support extended root table */
address = dmar_uint->root_table_addr;
@ -982,7 +973,16 @@ static int add_iommu_device(struct iommu_domain *domain, uint16_t segment,
return 1;
}
ASSERT(dmar_uint->root_table_addr != 0UL, "root table is not setup");
if (dmar_uint->root_table_addr == 0UL) {
void *root_table_vaddr = alloc_paging_struct();
if (root_table_vaddr != NULL) {
dmar_uint->root_table_addr = hva2hpa(root_table_vaddr);
} else {
ASSERT(false, "failed to allocate root table!");
return 1;
}
}
root_table =
(struct dmar_root_entry *)hpa2hva(dmar_uint->root_table_addr);
@ -1277,8 +1277,6 @@ void init_iommu(void)
spinlock_init(&domain_lock);
register_hrhd_units();
enable_iommu();
}
void init_iommu_vm0_domain(struct vm *vm0)
@ -1298,4 +1296,5 @@ void init_iommu_vm0_domain(struct vm *vm0)
}
}
cache_flush_invalidate_all();
enable_iommu();
}