diff --git a/devicemodel/core/main.c b/devicemodel/core/main.c index 74bae85b8..758894a20 100644 --- a/devicemodel/core/main.c +++ b/devicemodel/core/main.c @@ -88,6 +88,7 @@ char *elf_file_name; uint8_t trusty_enabled; char *mac_seed; bool stdio_in_use; +bool lapic_pt; static int virtio_msix = 1; static bool debugexit_enabled; diff --git a/devicemodel/core/mptbl.c b/devicemodel/core/mptbl.c index ec8de49cc..2a68be22c 100644 --- a/devicemodel/core/mptbl.c +++ b/devicemodel/core/mptbl.c @@ -335,16 +335,19 @@ mptable_build(struct vmctx *ctx, int ncpu) curraddr += sizeof(*mpeb) * MPE_NUM_BUSES; mpch->entry_count += MPE_NUM_BUSES; - mpei = (io_apic_entry_ptr)curraddr; - mpt_build_ioapic_entries(mpei, 0); - curraddr += sizeof(*mpei); - mpch->entry_count++; + /* Don't generate io_apic entry for VM with lapic pt */ + if (!lapic_pt) { + mpei = (io_apic_entry_ptr)curraddr; + mpt_build_ioapic_entries(mpei, 0); + curraddr += sizeof(*mpei); + mpch->entry_count++; - mpie = (int_entry_ptr) curraddr; - ioints = mpt_count_ioint_entries(); - mpt_build_ioint_entries(mpie, 0); - curraddr += sizeof(*mpie) * ioints; - mpch->entry_count += ioints; + mpie = (int_entry_ptr) curraddr; + ioints = mpt_count_ioint_entries(); + mpt_build_ioint_entries(mpie, 0); + curraddr += sizeof(*mpie) * ioints; + mpch->entry_count += ioints; + } mpie = (int_entry_ptr)curraddr; mpt_build_localint_entries(mpie); diff --git a/devicemodel/include/dm.h b/devicemodel/include/dm.h index c2c08c538..994d48505 100644 --- a/devicemodel/include/dm.h +++ b/devicemodel/include/dm.h @@ -45,6 +45,7 @@ extern char *elf_file_name; extern char *vmname; extern bool stdio_in_use; extern char *mac_seed; +extern bool lapic_pt; int vmexit_task_switch(struct vmctx *ctx, struct vhm_request *vhm_req, int *vcpu);