From 05834927cc8ecec6900b16651b4881e78d542c19 Mon Sep 17 00:00:00 2001 From: Kaige Fu Date: Thu, 25 Oct 2018 15:05:13 +0000 Subject: [PATCH] HV: Fix boot failure of partition mode When drdh_info_array[0].ignore = false with partition mode enabled,the following assert error will be triggered when trying to boot vm: Assertion failed in file arch/x86/vtd.c: fatal error The root cause is that root_table_addr reading from CPU3(vm2's bsp) is NULL. This patch move the init_iommu which initialize root_table_addr before starting secondary cores and flush the cache at the end if the function to avoid getting NULL pointer from secondary cores. Tracked-On: #1160 Signed-off-by: Kaige Fu Reviewed-by: Binin Wu --- hypervisor/arch/x86/cpu.c | 4 ++-- hypervisor/arch/x86/vtd.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/hypervisor/arch/x86/cpu.c b/hypervisor/arch/x86/cpu.c index f25ec4cce..050541b66 100644 --- a/hypervisor/arch/x86/cpu.c +++ b/hypervisor/arch/x86/cpu.c @@ -482,6 +482,8 @@ static void bsp_boot_post(void) /* Initialize interrupts */ interrupt_init(BOOT_CPU_ID); + init_iommu(); + timer_init(); setup_notification(); setup_posted_intr_notification(); @@ -495,8 +497,6 @@ static void bsp_boot_post(void) ASSERT(get_cpu_id() == BOOT_CPU_ID, ""); - init_iommu(); - console_setup_timer(); exec_vmxon_instr(BOOT_CPU_ID); diff --git a/hypervisor/arch/x86/vtd.c b/hypervisor/arch/x86/vtd.c index f368c6f05..5be1ca93c 100644 --- a/hypervisor/arch/x86/vtd.c +++ b/hypervisor/arch/x86/vtd.c @@ -1286,6 +1286,8 @@ void init_iommu(void) register_hrhd_units(); enable_iommu(); + + cache_flush_invalidate_all(); } void init_iommu_vm0_domain(struct vm *vm0)