From c4a230f313544433a3a6b3732ec36d0eadba7464 Mon Sep 17 00:00:00 2001 From: Victor Sun Date: Tue, 15 Jan 2019 15:44:30 +0800 Subject: [PATCH] HV: rename the term of vm_description to vm_config This patch is a pure term change of vm_description to vm_config, the struct name of vm_description is changed to acrn_vm_config. The patch does not change any code logic or senmantic. Tracked-On: #2291 Signed-off-by: Victor Sun Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vlapic.c | 2 +- hypervisor/arch/x86/guest/vm.c | 44 +++++++++---------- hypervisor/arch/x86/vmcs.c | 2 +- hypervisor/boot/sbl/multiboot.c | 6 +-- hypervisor/common/hypercall.c | 10 ++--- hypervisor/debug/shell.c | 6 +-- hypervisor/dm/vmptable.c | 4 +- hypervisor/dm/vpci/partition_mode.c | 6 +-- hypervisor/include/arch/x86/guest/vm.h | 20 ++++----- hypervisor/partition/apl-mrb/vm_description.c | 16 +++---- hypervisor/partition/dnv-cb2/vm_description.c | 24 +++++----- 11 files changed, 70 insertions(+), 70 deletions(-) diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c index e95320121..4a2ad8061 100644 --- a/hypervisor/arch/x86/guest/vlapic.c +++ b/hypervisor/arch/x86/guest/vlapic.c @@ -2087,7 +2087,7 @@ static int32_t vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool w vlapic = vcpu_vlapic(vcpu); if (is_x2apic_enabled(vlapic)) { #ifdef CONFIG_PARTITION_MODE - if (vcpu->vm->vm_desc->lapic_pt) { + if (vcpu->vm->vm_config->lapic_pt) { if (msr == MSR_IA32_EXT_APIC_ICR) { error = vlapic_x2apic_pt_icr_access(vcpu->vm, *val); } diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index d19348c06..d3ad6a93a 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -59,9 +59,9 @@ struct acrn_vm *get_vm_from_vmid(uint16_t vm_id) } /** - * @pre vm_desc != NULL && rtn_vm != NULL + * @pre vm_config != NULL && rtn_vm != NULL */ -int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) +int32_t create_vm(struct acrn_vm_config *vm_config, struct acrn_vm **rtn_vm) { struct acrn_vm *vm = NULL; int32_t status = 0; @@ -69,7 +69,7 @@ int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) bool need_cleanup = false; #ifdef CONFIG_PARTITION_MODE - vm_id = vm_desc->vm_id; + vm_id = vm_config->vm_id; bitmap_set_lock(vm_id, &vmid_bitmap); #else vm_id = alloc_vm_id(); @@ -82,7 +82,7 @@ int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) vm->vm_id = vm_id; #ifdef CONFIG_PARTITION_MODE /* Map Virtual Machine to its VM Description */ - vm->vm_desc = vm_desc; + vm->vm_config = vm_config; #endif vm->hw.created_vcpus = 0U; vm->emul_mmio_regions = 0U; @@ -114,8 +114,8 @@ int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) } } else { - /* populate UOS vm fields according to vm_desc */ - vm->sworld_control.flag.supported = vm_desc->sworld_supported; + /* populate UOS vm fields according to vm_config */ + vm->sworld_control.flag.supported = vm_config->sworld_supported; if (vm->sworld_control.flag.supported != 0UL) { struct memory_ops *ept_mem_ops = &vm->arch_vm.ept_mem_ops; @@ -125,10 +125,10 @@ int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) } (void)memcpy_s(&vm->GUID[0], sizeof(vm->GUID), - &vm_desc->GUID[0], sizeof(vm_desc->GUID)); + &vm_config->GUID[0], sizeof(vm_config->GUID)); #ifdef CONFIG_PARTITION_MODE ept_mr_add(vm, (uint64_t *)vm->arch_vm.nworld_eptp, - vm_desc->start_hpa, 0UL, vm_desc->mem_size, + vm_config->start_hpa, 0UL, vm_config->mem_size, EPT_RWX|EPT_WB); init_vm_boot_info(vm); #endif @@ -163,7 +163,7 @@ int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm) #ifdef CONFIG_PARTITION_MODE /* Create virtual uart; just when uart enabled, vuart can work */ - if (vm_desc->vm_vuart && is_dbg_uart_enabled()) { + if (vm_config->vm_vuart && is_dbg_uart_enabled()) { vuart_init(vm); } vrtc_init(vm); @@ -361,23 +361,23 @@ int32_t prepare_vm(uint16_t pcpu_id) int32_t ret = 0; uint16_t i; struct acrn_vm *vm = NULL; - struct vm_description *vm_desc = NULL; + struct acrn_vm_config *vm_config = NULL; bool is_vm_bsp; - vm_desc = pcpu_vm_desc_map[pcpu_id].vm_desc_ptr; - is_vm_bsp = pcpu_vm_desc_map[pcpu_id].is_bsp; + vm_config = pcpu_vm_config_map[pcpu_id].vm_config_ptr; + is_vm_bsp = pcpu_vm_config_map[pcpu_id].is_bsp; if (is_vm_bsp) { - ret = create_vm(vm_desc, &vm); + ret = create_vm(vm_config, &vm); ASSERT(ret == 0, "VM creation failed!"); mptable_build(vm); - prepare_vcpu(vm, vm_desc->vm_pcpu_ids[0]); + prepare_vcpu(vm, vm_config->vm_pcpu_ids[0]); /* Prepare the AP for vm */ - for (i = 1U; i < vm_desc->vm_hw_num_cores; i++) - prepare_vcpu(vm, vm_desc->vm_pcpu_ids[i]); + for (i = 1U; i < vm_config->vm_hw_num_cores; i++) + prepare_vcpu(vm, vm_config->vm_pcpu_ids[i]); if (vm_sw_loader == NULL) { vm_sw_loader = general_sw_loader; @@ -388,7 +388,7 @@ int32_t prepare_vm(uint16_t pcpu_id) /* start vm BSP automatically */ start_vm(vm); - pr_acrnlog("Start VM%x", vm_desc->vm_id); + pr_acrnlog("Start VM%x", vm_config->vm_id); } return ret; @@ -402,16 +402,16 @@ static int32_t prepare_vm0(void) int32_t err; uint16_t i; struct acrn_vm *vm = NULL; - struct vm_description vm0_desc; + struct acrn_vm_config vm0_config; - (void)memset((void *)&vm0_desc, 0U, sizeof(vm0_desc)); - vm0_desc.vm_hw_num_cores = get_pcpu_nums(); + (void)memset((void *)&vm0_config, 0U, sizeof(vm0_config)); + vm0_config.vm_hw_num_cores = get_pcpu_nums(); - err = create_vm(&vm0_desc, &vm); + err = create_vm(&vm0_config, &vm); if (err == 0) { /* Allocate all cpus to vm0 at the beginning */ - for (i = 0U; i < vm0_desc.vm_hw_num_cores; i++) { + for (i = 0U; i < vm0_config.vm_hw_num_cores; i++) { err = prepare_vcpu(vm, i); if (err != 0) { break; diff --git a/hypervisor/arch/x86/vmcs.c b/hypervisor/arch/x86/vmcs.c index 5398a8758..7f9e4d29e 100644 --- a/hypervisor/arch/x86/vmcs.c +++ b/hypervisor/arch/x86/vmcs.c @@ -574,7 +574,7 @@ void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu) void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu) { uint32_t value32; - if(vcpu->vm->vm_desc->lapic_pt) { + if(vcpu->vm->vm_config->lapic_pt) { /* * Disable external interrupt exiting and irq ack * Disable posted interrupt processing diff --git a/hypervisor/boot/sbl/multiboot.c b/hypervisor/boot/sbl/multiboot.c index 788ebeb96..a6a37092c 100644 --- a/hypervisor/boot/sbl/multiboot.c +++ b/hypervisor/boot/sbl/multiboot.c @@ -48,9 +48,9 @@ int32_t init_vm_boot_info(struct acrn_vm *vm) vm->sw.kernel_info.kernel_src_addr = hpa2hva((uint64_t)mods[0].mm_mod_start); vm->sw.kernel_info.kernel_size = mods[0].mm_mod_end - mods[0].mm_mod_start; vm->sw.kernel_info.kernel_load_addr = (void *)(16 * 1024 * 1024UL); - vm->sw.linux_info.bootargs_src_addr = (void *)vm->vm_desc->bootargs; - vm->sw.linux_info.bootargs_size = strnlen_s(vm->vm_desc->bootargs, MEM_2K); - vm->sw.linux_info.bootargs_load_addr = (void *)(vm->vm_desc->mem_size - 8*1024UL); + vm->sw.linux_info.bootargs_src_addr = (void *)vm->vm_config->bootargs; + vm->sw.linux_info.bootargs_size = strnlen_s(vm->vm_config->bootargs, MEM_2K); + vm->sw.linux_info.bootargs_load_addr = (void *)(vm->vm_config->mem_size - 8*1024UL); clac(); ret = 0; } diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 28d6370f4..baaca4584 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -112,15 +112,15 @@ int32_t hcall_create_vm(struct acrn_vm *vm, uint64_t param) int32_t ret; struct acrn_vm *target_vm = NULL; struct acrn_create_vm cv; - struct vm_description vm_desc; + struct acrn_vm_config vm_config; (void)memset((void *)&cv, 0U, sizeof(cv)); if (copy_from_gpa(vm, &cv, param, sizeof(cv)) == 0) { - (void)memset(&vm_desc, 0U, sizeof(vm_desc)); - vm_desc.sworld_supported = ((cv.vm_flag & (SECURE_WORLD_ENABLED)) != 0U); - (void)memcpy_s(&vm_desc.GUID[0], 16U, &cv.GUID[0], 16U); + (void)memset(&vm_config, 0U, sizeof(vm_config)); + vm_config.sworld_supported = ((cv.vm_flag & (SECURE_WORLD_ENABLED)) != 0U); + (void)memcpy_s(&vm_config.GUID[0], 16U, &cv.GUID[0], 16U); - ret = create_vm(&vm_desc, &target_vm); + ret = create_vm(&vm_config, &target_vm); if (ret != 0) { dev_dbg(ACRN_DBG_HYCALL, "HCALL: Create VM failed"); cv.vmid = ACRN_INVALID_VMID; diff --git a/hypervisor/debug/shell.c b/hypervisor/debug/shell.c index c98a6205f..73ad75cb2 100644 --- a/hypervisor/debug/shell.c +++ b/hypervisor/debug/shell.c @@ -797,7 +797,7 @@ static int32_t shell_to_sos_console(__unused int32_t argc, __unused char **argv) struct acrn_vm *vm; struct acrn_vuart *vu; #ifdef CONFIG_PARTITION_MODE - struct vm_description *vm_desc; + struct acrn_vm_config *vm_config; if (argc == 2U) { guest_no = strtol_deci(argv[1]); @@ -812,8 +812,8 @@ static int32_t shell_to_sos_console(__unused int32_t argc, __unused char **argv) } #ifdef CONFIG_PARTITION_MODE - vm_desc = vm->vm_desc; - if (vm_desc != NULL && vm_desc->vm_vuart == false) { + vm_config = vm->vm_config; + if (vm_config != NULL && vm_config->vm_vuart == false) { snprintf(temp_str, TEMP_STR_SIZE, "No vUART configured for vm%d\n", guest_no); shell_puts(temp_str); return 0; diff --git a/hypervisor/dm/vmptable.c b/hypervisor/dm/vmptable.c index aa8f32ff9..fba3a49ba 100644 --- a/hypervisor/dm/vmptable.c +++ b/hypervisor/dm/vmptable.c @@ -82,7 +82,7 @@ int32_t mptable_build(struct acrn_vm *vm) struct mpfps *mpfp; size_t mptable_length; uint16_t i; - uint16_t vcpu_num = vm->vm_desc->vm_hw_num_cores; + uint16_t vcpu_num = vm->vm_config->vm_hw_num_cores; struct mptable_info *mptable = &vm->mptable; (void *)memcpy_s((void *)mptable, sizeof(struct mptable_info), @@ -100,7 +100,7 @@ int32_t mptable_build(struct acrn_vm *vm) } for (i = 0U; i < vcpu_num; i++) { - uint16_t pcpu_id = *(vm->vm_desc->vm_pcpu_ids + i); + uint16_t pcpu_id = *(vm->vm_config->vm_pcpu_ids + i); (void *)memcpy_s((void *)(mptable->proc_entry_array + i), sizeof(struct proc_entry), (const void *)&proc_entry_template, sizeof(struct proc_entry)); diff --git a/hypervisor/dm/vpci/partition_mode.c b/hypervisor/dm/vpci/partition_mode.c index 68b8133cc..adb6cff0f 100644 --- a/hypervisor/dm/vpci/partition_mode.c +++ b/hypervisor/dm/vpci/partition_mode.c @@ -38,7 +38,7 @@ static struct pci_vdev *partition_mode_find_vdev(struct acrn_vpci *vpci, union p struct pci_vdev *vdev; int32_t i; - vdev_array = vpci->vm->vm_desc->vpci_vdev_array; + vdev_array = vpci->vm->vm_config->vpci_vdev_array; for (i = 0; i < vdev_array->num_pci_vdev; i++) { vdev = &vdev_array->vpci_vdev_list[i]; if (vdev->vbdf.value == vbdf.value) { @@ -56,7 +56,7 @@ static int32_t partition_mode_vpci_init(const struct acrn_vm *vm) struct pci_vdev *vdev; int32_t i; - vdev_array = vm->vm_desc->vpci_vdev_array; + vdev_array = vm->vm_config->vpci_vdev_array; for (i = 0; i < vdev_array->num_pci_vdev; i++) { vdev = &vdev_array->vpci_vdev_list[i]; @@ -79,7 +79,7 @@ static void partition_mode_vpci_deinit(const struct acrn_vm *vm) struct pci_vdev *vdev; int32_t i; - vdev_array = vm->vm_desc->vpci_vdev_array; + vdev_array = vm->vm_config->vpci_vdev_array; for (i = 0; i < vdev_array->num_pci_vdev; i++) { vdev = &vdev_array->vpci_vdev_list[i]; diff --git a/hypervisor/include/arch/x86/guest/vm.h b/hypervisor/include/arch/x86/guest/vm.h index ca50f3118..244219820 100644 --- a/hypervisor/include/arch/x86/guest/vm.h +++ b/hypervisor/include/arch/x86/guest/vm.h @@ -155,7 +155,7 @@ struct acrn_vm { struct acrn_vpci vpci; #ifdef CONFIG_PARTITION_MODE struct mptable_info mptable; - struct vm_description *vm_desc; + struct acrn_vm_config *vm_config; uint8_t vrtc_offset; #endif @@ -172,7 +172,7 @@ struct vpci_vdev_array { }; #endif -struct vm_description { +struct acrn_vm_config { /* The physical CPU IDs associated with this VM - The first CPU listed * will be the VM's BSP */ @@ -268,26 +268,26 @@ void resume_vm(struct acrn_vm *vm); void resume_vm_from_s3(struct acrn_vm *vm, uint32_t wakeup_vec); void start_vm(struct acrn_vm *vm); int32_t reset_vm(struct acrn_vm *vm); -int32_t create_vm(struct vm_description *vm_desc, struct acrn_vm **rtn_vm); +int32_t create_vm(struct acrn_vm_config *vm_config, struct acrn_vm **rtn_vm); int32_t prepare_vm(uint16_t pcpu_id); #ifdef CONFIG_PARTITION_MODE -const struct vm_description_array *get_vm_desc_base(void); +const struct vm_config_arraies *get_vm_config_base(void); #endif struct acrn_vm *get_vm_from_vmid(uint16_t vm_id); #ifdef CONFIG_PARTITION_MODE -struct vm_description_array { - int32_t num_vm_desc; - struct vm_description vm_desc_array[]; +struct vm_config_arraies { + int32_t num_vm_config; + struct acrn_vm_config vm_config_array[]; }; -struct pcpu_vm_desc_mapping { - struct vm_description *vm_desc_ptr; +struct pcpu_vm_config_mapping { + struct acrn_vm_config *vm_config_ptr; bool is_bsp; }; -extern const struct pcpu_vm_desc_mapping pcpu_vm_desc_map[]; +extern const struct pcpu_vm_config_mapping pcpu_vm_config_map[]; void vrtc_init(struct acrn_vm *vm); #endif diff --git a/hypervisor/partition/apl-mrb/vm_description.c b/hypervisor/partition/apl-mrb/vm_description.c index df5fdbf1e..7ae5b944e 100644 --- a/hypervisor/partition/apl-mrb/vm_description.c +++ b/hypervisor/partition/apl-mrb/vm_description.c @@ -150,12 +150,12 @@ static struct vpci_vdev_array vpci_vdev_array2 = { /*******************************/ /* User Defined VM definitions */ /*******************************/ -struct vm_description_array vm_desc_partition = { +struct vm_config_arraies vm_config_partition = { /* Number of user virtual machines */ - .num_vm_desc = NUM_USER_VMS, + .num_vm_config = NUM_USER_VMS, /* Virtual Machine descriptions */ - .vm_desc_array = { + .vm_config_array = { { /* Internal variable, MUSTBE init to -1 */ .vm_hw_num_cores = VM1_NUM_CPUS, @@ -187,21 +187,21 @@ struct vm_description_array vm_desc_partition = { } }; -const struct pcpu_vm_desc_mapping pcpu_vm_desc_map[] = { +const struct pcpu_vm_config_mapping pcpu_vm_config_map[] = { { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[0], + .vm_config_ptr = &vm_config_partition.vm_config_array[0], .is_bsp = true, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[1], + .vm_config_ptr = &vm_config_partition.vm_config_array[1], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[0], + .vm_config_ptr = &vm_config_partition.vm_config_array[0], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[1], + .vm_config_ptr = &vm_config_partition.vm_config_array[1], .is_bsp = true, }, }; diff --git a/hypervisor/partition/dnv-cb2/vm_description.c b/hypervisor/partition/dnv-cb2/vm_description.c index e6fbe0dba..883c9a3e9 100644 --- a/hypervisor/partition/dnv-cb2/vm_description.c +++ b/hypervisor/partition/dnv-cb2/vm_description.c @@ -184,12 +184,12 @@ static struct vpci_vdev_array vpci_vdev_array2 = { /*******************************/ /* User Defined VM definitions */ /*******************************/ -struct vm_description_array vm_desc_partition = { +struct vm_config_arraies vm_config_partition = { /* Number of user virtual machines */ - .num_vm_desc = NUM_USER_VMS, + .num_vm_config = NUM_USER_VMS, /* Virtual Machine descriptions */ - .vm_desc_array = { + .vm_config_array = { { /* Internal variable, MUSTBE init to -1 */ .vm_hw_num_cores = VM1_NUM_CPUS, @@ -222,37 +222,37 @@ struct vm_description_array vm_desc_partition = { } }; -const struct pcpu_vm_desc_mapping pcpu_vm_desc_map[] = { +const struct pcpu_vm_config_mapping pcpu_vm_config_map[] = { { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[0], + .vm_config_ptr = &vm_config_partition.vm_config_array[0], .is_bsp = true, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[1], + .vm_config_ptr = &vm_config_partition.vm_config_array[1], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[0], + .vm_config_ptr = &vm_config_partition.vm_config_array[0], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[1], + .vm_config_ptr = &vm_config_partition.vm_config_array[1], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[0], + .vm_config_ptr = &vm_config_partition.vm_config_array[0], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[1], + .vm_config_ptr = &vm_config_partition.vm_config_array[1], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[0], + .vm_config_ptr = &vm_config_partition.vm_config_array[0], .is_bsp = false, }, { - .vm_desc_ptr = &vm_desc_partition.vm_desc_array[1], + .vm_config_ptr = &vm_config_partition.vm_config_array[1], .is_bsp = true, }, };