From f4ce9cc4a281778de4c313752f91ae19162f2985 Mon Sep 17 00:00:00 2001 From: Shuo A Liu Date: Thu, 23 May 2019 15:27:35 +0800 Subject: [PATCH] hv: make hypercall HC_CREATE_VCPU empty Now, we create vcpus while VM being created in hypervisor. The create vcpu hypercall will not be used any more. For compatbility, keep the hypercall HC_CREATE_VCPU do nothing. v4: Don't remove HC_CREATE_VCPU hypercall, let it do nothing. Tracked-On: #3663 Signed-off-by: Shuo A Liu --- hypervisor/arch/x86/guest/vmcall.c | 7 +---- hypervisor/common/hypercall.c | 38 ------------------------- hypervisor/include/common/hypercall.h | 17 ----------- hypervisor/include/public/acrn_common.h | 3 +- 4 files changed, 2 insertions(+), 63 deletions(-) diff --git a/hypervisor/arch/x86/guest/vmcall.c b/hypervisor/arch/x86/guest/vmcall.c index b1794e24e..c7a4d37ae 100644 --- a/hypervisor/arch/x86/guest/vmcall.c +++ b/hypervisor/arch/x86/guest/vmcall.c @@ -96,12 +96,7 @@ static int32_t dispatch_sos_hypercall(const struct acrn_vcpu *vcpu) break; case HC_CREATE_VCPU: - /* param1: relative vmid to sos, vm_id: absolute vmid */ - if (vmid_is_valid) { - spinlock_obtain(&vmm_hypercall_lock); - ret = hcall_create_vcpu(sos_vm, vm_id, param2); - spinlock_release(&vmm_hypercall_lock); - } + ret = 0; break; case HC_SET_VCPU_REGS: diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 2f579e85c..99d470af6 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -265,44 +265,6 @@ int32_t hcall_pause_vm(uint16_t vmid) return ret; } -/** - * @brief create vcpu - * - * Create a vcpu based on parameter for a VM, it will allocate vcpu from - * freed physical cpus, if there is no available pcpu, the function will - * return -1. - * - * @param vm Pointer to VM data structure - * @param vmid ID of the VM - * @param param guest physical address. This gpa points to - * struct acrn_create_vcpu - * - * @pre Pointer vm shall point to SOS_VM - * @return 0 on success, non-zero on error. - */ -int32_t hcall_create_vcpu(struct acrn_vm *vm, uint16_t vmid, uint64_t param) -{ - int32_t ret = -1; - uint16_t pcpu_id; - struct acrn_create_vcpu cv; - struct acrn_vm *target_vm = get_vm_from_vmid(vmid); - - if (!is_poweroff_vm(target_vm) && is_postlaunched_vm(target_vm) && (param != 0U)) { - if (copy_from_gpa(vm, &cv, param, sizeof(cv)) != 0) { - pr_err("%s: Unable copy param to vm\n", __func__); - } else { - pcpu_id = allocate_pcpu(); - if (pcpu_id == INVALID_CPU_ID) { - pr_err("%s: No physical available\n", __func__); - } else { - ret = prepare_vcpu(target_vm, pcpu_id); - } - } - } - - return ret; -} - /** * @brief reset virtual machine * diff --git a/hypervisor/include/common/hypercall.h b/hypervisor/include/common/hypercall.h index 2fe8bf9cd..54ce786b3 100644 --- a/hypervisor/include/common/hypercall.h +++ b/hypervisor/include/common/hypercall.h @@ -134,23 +134,6 @@ int32_t hcall_start_vm(uint16_t vmid); */ int32_t hcall_pause_vm(uint16_t vmid); -/** - * @brief create vcpu - * - * Create a vcpu based on parameter for a VM, it will allocate vcpu from - * freed physical cpus, if there is no available pcpu, the function will - * return -1. - * - * @param vm Pointer to VM data structure - * @param vmid ID of the VM - * @param param guest physical address. This gpa points to - * struct acrn_create_vcpu - * - * @pre Pointer vm shall point to SOS_VM - * @return 0 on success, non-zero on error. - */ -int32_t hcall_create_vcpu(struct acrn_vm *vm, uint16_t vmid, uint64_t param); - /** * @brief set vcpu regs * diff --git a/hypervisor/include/public/acrn_common.h b/hypervisor/include/public/acrn_common.h index 43aee8fc7..1527aade0 100644 --- a/hypervisor/include/public/acrn_common.h +++ b/hypervisor/include/public/acrn_common.h @@ -366,9 +366,8 @@ struct acrn_create_vm { uint8_t reserved2[16]; } __aligned(8); - /** - * @brief Info to create a VCPU + * @brief Info to create a VCPU (deprecated) * * the parameter for HC_CREATE_VCPU hypercall */