diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 3a52b4216..4cffc66c5 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -292,9 +292,6 @@ int shutdown_vm(struct vm *vm) /* Free EPT allocated resources assigned to VM */ destroy_ept(vm); - /* Free MSR bitmap */ - free(vm->arch_vm.msr_bitmap); - /* TODO: De-initialize I/O Emulation */ free_io_emulation_resource(vm); diff --git a/hypervisor/arch/x86/guest/vmsr.c b/hypervisor/arch/x86/guest/vmsr.c index 3ef84905c..ba1faa2d7 100644 --- a/hypervisor/arch/x86/guest/vmsr.c +++ b/hypervisor/arch/x86/guest/vmsr.c @@ -55,7 +55,7 @@ void init_msr_emulation(struct vcpu *vcpu) { uint32_t i; uint32_t msrs_count = ARRAY_SIZE(emulated_msrs); - void *msr_bitmap; + uint8_t *msr_bitmap; uint64_t value64; ASSERT(msrs_count == IDX_MAX_MSR, @@ -63,12 +63,6 @@ void init_msr_emulation(struct vcpu *vcpu) /*msr bitmap, just allocated/init once, and used for all vm's vcpu*/ if (is_vcpu_bsp(vcpu)) { - - /* Allocate and initialize memory for MSR bitmap region*/ - vcpu->vm->arch_vm.msr_bitmap = alloc_page(); - ASSERT(vcpu->vm->arch_vm.msr_bitmap != NULL, ""); - (void)memset(vcpu->vm->arch_vm.msr_bitmap, 0x0U, CPU_PAGE_SIZE); - msr_bitmap = vcpu->vm->arch_vm.msr_bitmap; for (i = 0U; i < msrs_count; i++) { diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index 32a2036aa..9a43a706e 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -88,6 +88,8 @@ enum vm_state { struct vm_arch { /* I/O bitmaps A and B for this VM, MUST be 4-Kbyte aligned */ uint8_t io_bitmap[CPU_PAGE_SIZE*2]; + /* MSR bitmap region for this VM, MUST be 4-Kbyte aligned */ + uint8_t msr_bitmap[CPU_PAGE_SIZE]; uint64_t guest_init_pml4;/* Guest init pml4 */ /* EPT hierarchy for Normal World */ @@ -99,7 +101,6 @@ struct vm_arch { void *sworld_eptp; void *m2p; /* machine address to guest physical address */ void *tmp_pg_array; /* Page array for tmp guest paging struct */ - void *msr_bitmap; /* MSR bitmap page base address for this VM */ struct acrn_vioapic vioapic; /* Virtual IOAPIC base address */ struct acrn_vpic vpic; /* Virtual PIC */ /**