diff --git a/hypervisor/arch/x86/configs/vm_config.c b/hypervisor/arch/x86/configs/vm_config.c index 58328a9ec..c07e0db59 100644 --- a/hypervisor/arch/x86/configs/vm_config.c +++ b/hypervisor/arch/x86/configs/vm_config.c @@ -83,7 +83,7 @@ bool sanitize_vm_config(void) */ for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) { vm_config = get_vm_config(vm_id); - switch (vm_config->type) { + switch (vm_config->load_order) { case PRE_LAUNCHED_VM: if (vm_config->pcpu_bitmap == 0U) { ret = false; diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index a55d50729..7de9a0687 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -59,7 +59,7 @@ bool is_valid_vm(const struct acrn_vm *vm) bool is_sos_vm(const struct acrn_vm *vm) { - return (vm != NULL) && (get_vm_config(vm->vm_id)->type == SOS_VM); + return (vm != NULL) && (get_vm_config(vm->vm_id)->load_order == SOS_VM); } /** @@ -68,7 +68,7 @@ bool is_sos_vm(const struct acrn_vm *vm) */ bool is_postlaunched_vm(const struct acrn_vm *vm) { - return (get_vm_config(vm->vm_id)->type == POST_LAUNCHED_VM); + return (get_vm_config(vm->vm_id)->load_order == POST_LAUNCHED_VM); } /** @@ -80,7 +80,7 @@ bool is_prelaunched_vm(const struct acrn_vm *vm) struct acrn_vm_config *vm_config; vm_config = get_vm_config(vm->vm_id); - return (vm_config->type == PRE_LAUNCHED_VM); + return (vm_config->load_order == PRE_LAUNCHED_VM); } /** @@ -344,7 +344,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_ sanitize_pte((uint64_t *)vm->arch_vm.nworld_eptp); /* Register default handlers for PIO & MMIO if it is SOS VM or Pre-launched VM */ - if ((vm_config->type == SOS_VM) || (vm_config->type == PRE_LAUNCHED_VM)) { + if ((vm_config->load_order == SOS_VM) || (vm_config->load_order == PRE_LAUNCHED_VM)) { register_pio_default_emulation_handler(vm); register_mmio_default_emulation_handler(vm); } @@ -379,7 +379,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_ snprintf(vm_config->name, 16, "ACRN VM_%d", vm_id); } - if (vm_config->type == PRE_LAUNCHED_VM) { + if (vm_config->load_order == PRE_LAUNCHED_VM) { create_prelaunched_vm_e820(vm); prepare_prelaunched_vm_memmap(vm, vm_config); (void)firmware_init_vm_boot_info(vm); @@ -429,7 +429,7 @@ int32_t create_vm(uint16_t vm_id, struct acrn_vm_config *vm_config, struct acrn_ /* Populate return VM handle */ *rtn_vm = vm; vm->sw.io_shared_page = NULL; - if ((vm_config->type == POST_LAUNCHED_VM) && (vm_config->guest_flags & GUEST_FLAG_IO_COMPLETION_POLLING) != 0U) { + if ((vm_config->load_order == POST_LAUNCHED_VM) && (vm_config->guest_flags & GUEST_FLAG_IO_COMPLETION_POLLING) != 0U) { /* enable IO completion polling mode per its guest flags in vm_config. */ vm->sw.is_completion_polling = true; } @@ -678,8 +678,8 @@ void launch_vms(uint16_t pcpu_id) for (vm_id = 0U; vm_id < CONFIG_MAX_VM_NUM; vm_id++) { vm_config = get_vm_config(vm_id); - if ((vm_config->type == SOS_VM) || (vm_config->type == PRE_LAUNCHED_VM)) { - if (vm_config->type == SOS_VM) { + if ((vm_config->load_order == SOS_VM) || (vm_config->load_order == PRE_LAUNCHED_VM)) { + if (vm_config->load_order == SOS_VM) { sos_vm_ptr = &vm_array[vm_id]; } diff --git a/hypervisor/boot/sbl/multiboot.c b/hypervisor/boot/sbl/multiboot.c index e0758796b..5909054ed 100644 --- a/hypervisor/boot/sbl/multiboot.c +++ b/hypervisor/boot/sbl/multiboot.c @@ -188,7 +188,7 @@ int32_t sbl_init_vm_boot_info(struct acrn_vm *vm) struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id); - if (vm_config->type == PRE_LAUNCHED_VM) { + if (vm_config->load_order == PRE_LAUNCHED_VM) { vm->sw.kernel_info.kernel_load_addr = (void *)(MEM_1M * 16U); vm->sw.linux_info.bootargs_src_addr = (void *)vm_config->os_config.bootargs; vm->sw.linux_info.bootargs_size = diff --git a/hypervisor/dm/io_req.c b/hypervisor/dm/io_req.c index 7a5b3ea05..219816f2a 100644 --- a/hypervisor/dm/io_req.c +++ b/hypervisor/dm/io_req.c @@ -545,7 +545,7 @@ emulate_io(struct acrn_vcpu *vcpu, struct io_request *io_req) break; } - if ((status == -ENODEV) && (vm_config->type == POST_LAUNCHED_VM)) { + if ((status == -ENODEV) && (vm_config->load_order == POST_LAUNCHED_VM)) { /* * No handler from HV side, search from VHM in Dom0 * diff --git a/hypervisor/dm/vpci/pci_pt.c b/hypervisor/dm/vpci/pci_pt.c index 4c9108de3..cb212fd8a 100644 --- a/hypervisor/dm/vpci/pci_pt.c +++ b/hypervisor/dm/vpci/pci_pt.c @@ -88,7 +88,7 @@ void vdev_pt_remap_msix_table_bar(struct pci_vdev *vdev) bar = &pdev->bar[msix->table_bar]; if (bar != NULL) { vdev->msix.mmio_hpa = bar->base; - if (vm_config->type == PRE_LAUNCHED_VM) { + if (vm_config->load_order == PRE_LAUNCHED_VM) { vdev->msix.mmio_gpa = vdev->bar[msix->table_bar].base; } else { vdev->msix.mmio_gpa = sos_vm_hpa2gpa(bar->base); @@ -139,7 +139,7 @@ void vdev_pt_remap_msix_table_bar(struct pci_vdev *vdev) if (msix->mmio_gpa != 0U) { - if (vm_config->type == PRE_LAUNCHED_VM) { + if (vm_config->load_order == PRE_LAUNCHED_VM) { addr_hi = vdev->msix.mmio_gpa + vdev->msix.mmio_size; addr_lo = vdev->msix.mmio_gpa; } else { diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index 4c52f391a..2a55e6ce4 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -118,7 +118,7 @@ static bool pci_cfgdata_io_read(struct acrn_vm *vm, struct acrn_vcpu *vcpu, uint if (vpci_is_valid_access(pi->cached_reg + offset, bytes)) { vm_config = get_vm_config(vm->vm_id); - switch (vm_config->type) { + switch (vm_config->load_order) { case PRE_LAUNCHED_VM: partition_mode_cfgread(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, &val); break; @@ -157,7 +157,7 @@ static bool pci_cfgdata_io_write(struct acrn_vm *vm, uint16_t addr, size_t bytes if (vpci_is_valid_access(pi->cached_reg + offset, bytes)) { vm_config = get_vm_config(vm->vm_id); - switch (vm_config->type) { + switch (vm_config->load_order) { case PRE_LAUNCHED_VM: partition_mode_cfgwrite(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, val); break; @@ -203,7 +203,7 @@ void vpci_init(struct acrn_vm *vm) vpci->vm = vm; vm_config = get_vm_config(vm->vm_id); - switch (vm_config->type) { + switch (vm_config->load_order) { case PRE_LAUNCHED_VM: ret = partition_mode_vpci_init(vm); break; @@ -241,7 +241,7 @@ void vpci_cleanup(const struct acrn_vm *vm) struct acrn_vm_config *vm_config; vm_config = get_vm_config(vm->vm_id); - switch (vm_config->type) { + switch (vm_config->load_order) { case PRE_LAUNCHED_VM: partition_mode_vpci_deinit(vm); break; diff --git a/hypervisor/include/arch/x86/vm_config.h b/hypervisor/include/arch/x86/vm_config.h index 47fea109d..75872e73d 100644 --- a/hypervisor/include/arch/x86/vm_config.h +++ b/hypervisor/include/arch/x86/vm_config.h @@ -22,7 +22,7 @@ * SOS_VM is launched by ACRN hypervisor, without LAPIC_PT; * POST_LAUNCHED_VM is launched by ACRN devicemodel, with/without LAPIC_PT depends on usecases. */ -enum acrn_vm_type { +enum acrn_vm_load_order { UNDEFINED_VM = 0, PRE_LAUNCHED_VM, SOS_VM, @@ -71,7 +71,7 @@ struct acrn_vm_pci_ptdev_config { } __aligned(8); struct acrn_vm_config { - enum acrn_vm_type type; /* specify the type of VM */ + enum acrn_vm_load_order load_order; /* specify the load order of VM */ char name[MAX_VM_OS_NAME_LEN]; /* VM name identifier, useful for debug. */ const uint8_t uuid[16]; /* UUID of the VM */ uint64_t pcpu_bitmap; /* from pcpu bitmap, we could know VM core number */ diff --git a/hypervisor/scenarios/logical_partition/vm_configurations.c b/hypervisor/scenarios/logical_partition/vm_configurations.c index 5802d99b6..eb14933ca 100644 --- a/hypervisor/scenarios/logical_partition/vm_configurations.c +++ b/hypervisor/scenarios/logical_partition/vm_configurations.c @@ -16,7 +16,7 @@ static struct mptable_info vm_mptables[CONFIG_MAX_VM_NUM]; struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { { /* VM0 */ - .type = PRE_LAUNCHED_VM, + .load_order = PRE_LAUNCHED_VM, .name = "ACRN PRE-LAUNCHED VM0", .uuid = {0x26U, 0xc5U, 0xe0U, 0xd8U, 0x8fU, 0x8aU, 0x47U, 0xd8U, \ 0x81U, 0x09U, 0xf2U, 0x01U, 0xebU, 0xd6U, 0x1aU, 0x5eU}, @@ -54,7 +54,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { .mptable = &vm_mptables[0], }, { /* VM1 */ - .type = PRE_LAUNCHED_VM, + .load_order = PRE_LAUNCHED_VM, .name = "ACRN PRE-LAUNCHED VM1", .uuid = {0xddU, 0x87U, 0xceU, 0x08U, 0x66U, 0xf9U, 0x47U, 0x3dU, \ 0xbcU, 0x58U, 0x76U, 0x05U, 0x83U, 0x7fU, 0x93U, 0x5eU}, diff --git a/hypervisor/scenarios/sdc/vm_configurations.c b/hypervisor/scenarios/sdc/vm_configurations.c index 844876391..55b14b359 100644 --- a/hypervisor/scenarios/sdc/vm_configurations.c +++ b/hypervisor/scenarios/sdc/vm_configurations.c @@ -11,7 +11,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { { - .type = SOS_VM, + .load_order = SOS_VM, .name = "ACRN SOS VM", .uuid = {0xdbU, 0xbbU, 0xd4U, 0x34U, 0x7aU, 0x57U, 0x42U, 0x16U, \ 0xa1U, 0x2cU, 0x22U, 0x01U, 0xf1U, 0xabU, 0x02U, 0x40U}, @@ -36,7 +36,7 @@ struct acrn_vm_config vm_configs[CONFIG_MAX_VM_NUM] = { } }, { - .type = POST_LAUNCHED_VM, + .load_order = POST_LAUNCHED_VM, .uuid = {0xd2U, 0x79U, 0x54U, 0x38U, 0x25U, 0xd6U, 0x11U, 0xe8U, \ 0x86U, 0x4eU, 0xcbU, 0x7aU, 0x18U, 0xb3U, 0x46U, 0x43U}, /* d2795438-25d6-11e8-864e-cb7a18b34643 */