diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index c8f48af57..c8197d60b 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -32,6 +32,7 @@ #include #include #include +#include vm_sw_loader_t vm_sw_loader; @@ -257,6 +258,10 @@ static void prepare_prelaunched_vm_memmap(struct acrn_vm *vm, const struct acrn_ remaining_hpa_size = vm_config->memory.size_hpa2; } } + + for (i = 0U; i < MAX_MMIO_DEV_NUM; i++) { + (void)assign_mmio_dev(vm, &vm_config->mmiodevs[i]); + } } /** @@ -328,6 +333,10 @@ static void prepare_sos_vm_memmap(struct acrn_vm *vm) if (vm_config->load_order == PRE_LAUNCHED_VM) { ept_del_mr(vm, pml4_page, vm_config->memory.start_hpa, vm_config->memory.size); } + + for (i = 0U; i < MAX_MMIO_DEV_NUM; i++) { + (void)deassign_mmio_dev(vm, &vm_config->mmiodevs[i]); + } } /* unmap AP trampoline code for security diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index 66ae37b7f..4f4f8df67 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -14,6 +14,7 @@ #include #include #include +#include #define CONFIG_MAX_VM_NUM (PRE_VM_NUM + SOS_VM_NUM + MAX_POST_VM_NUM) @@ -33,6 +34,8 @@ #define PCI_DEV_TYPE_HVEMUL (1U << 1U) #define PCI_DEV_TYPE_SOSEMUL (1U << 2U) +#define MAX_MMIO_DEV_NUM 2U + #define CONFIG_SOS_VM .load_order = SOS_VM, \ .uuid = SOS_VM_UUID, \ .severity = SEVERITY_SOS, \ @@ -174,6 +177,8 @@ struct acrn_vm_config { */ struct vuart_config vuart[MAX_VUART_NUM_PER_VM];/* vuart configuration for VM */ + + struct acrn_mmiodev mmiodevs[MAX_MMIO_DEV_NUM]; } __aligned(8); struct acrn_vm_config *get_vm_config(uint16_t vm_id);