Skip to content

Commit

Permalink
hv:move forward the initialization for iommu & ptdev
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
mingqiangchi authored and NanlinXie committed Mar 1, 2019
1 parent bc10710 commit 308d4e8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
7 changes: 7 additions & 0 deletions hypervisor/arch/x86/cpu.c
Expand Up @@ -10,6 +10,7 @@
#include <page.h>
#include <e820.h>
#include <mmu.h>
#include <vtd.h>
#include <lapic.h>
#include <per_cpu.h>
#include <cpufeatures.h>
Expand Down Expand Up @@ -214,6 +215,12 @@ void init_cpu_post(uint16_t pcpu_id)
setup_posted_intr_notification();
init_pci_pdev_list();

if (init_iommu() != 0) {
panic("failed to initialize iommu!");
}

ptdev_init();

/* Start all secondary cores */
startup_paddr = prepare_trampoline();
start_cpus();
Expand Down
12 changes: 0 additions & 12 deletions hypervisor/arch/x86/init.c
Expand Up @@ -47,16 +47,6 @@ static void init_debug_post(uint16_t pcpu_id)
profiling_setup();
}

/*TODO: move into pass-thru module */
static void init_passthru(void)
{
if (init_iommu() != 0) {
panic("failed to initialize iommu!");
}

ptdev_init();
}

/*TODO: move into guest-vcpu module */
static void enter_guest_mode(uint16_t pcpu_id)
{
Expand All @@ -81,8 +71,6 @@ static void init_primary_cpu_post(void)

init_debug_post(BOOT_CPU_ID);

init_passthru();

enter_guest_mode(BOOT_CPU_ID);
}

Expand Down

0 comments on commit 308d4e8

Please sign in to comment.