Skip to content

Commit 308d4e8

Browse files
mingqiangchiNanlinXie
authored andcommitted
hv:move forward the initialization for iommu & ptdev
move 'init_iommu()' & 'ptdev_init()' before starting all secondary cores to avoid access uninitialized resource in partition mode. Tracked-On: #1842 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent bc10710 commit 308d4e8

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <page.h>
1111
#include <e820.h>
1212
#include <mmu.h>
13+
#include <vtd.h>
1314
#include <lapic.h>
1415
#include <per_cpu.h>
1516
#include <cpufeatures.h>
@@ -214,6 +215,12 @@ void init_cpu_post(uint16_t pcpu_id)
214215
setup_posted_intr_notification();
215216
init_pci_pdev_list();
216217

218+
if (init_iommu() != 0) {
219+
panic("failed to initialize iommu!");
220+
}
221+
222+
ptdev_init();
223+
217224
/* Start all secondary cores */
218225
startup_paddr = prepare_trampoline();
219226
start_cpus();

hypervisor/arch/x86/init.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,6 @@ static void init_debug_post(uint16_t pcpu_id)
4747
profiling_setup();
4848
}
4949

50-
/*TODO: move into pass-thru module */
51-
static void init_passthru(void)
52-
{
53-
if (init_iommu() != 0) {
54-
panic("failed to initialize iommu!");
55-
}
56-
57-
ptdev_init();
58-
}
59-
6050
/*TODO: move into guest-vcpu module */
6151
static void enter_guest_mode(uint16_t pcpu_id)
6252
{
@@ -81,8 +71,6 @@ static void init_primary_cpu_post(void)
8171

8272
init_debug_post(BOOT_CPU_ID);
8373

84-
init_passthru();
85-
8674
enter_guest_mode(BOOT_CPU_ID);
8775
}
8876

0 commit comments

Comments
 (0)