From 605738fc0c6bc81f46262c2882ce63ecfd22e610 Mon Sep 17 00:00:00 2001 From: "Li, Fei1" Date: Thu, 8 Nov 2018 18:00:59 +0800 Subject: [PATCH] hv: hypercall: remove hcall_set_vm_memory_region Since it's discarded. Tracked-On: #1124 Signed-off-by: Li, Fei1 Acked-by: Eddie Dong --- hypervisor/arch/x86/guest/vmcall.c | 5 --- hypervisor/common/hypercall.c | 40 ++---------------------- hypervisor/include/common/hypercall.h | 13 -------- hypervisor/include/public/acrn_hv_defs.h | 1 - 4 files changed, 2 insertions(+), 57 deletions(-) diff --git a/hypervisor/arch/x86/guest/vmcall.c b/hypervisor/arch/x86/guest/vmcall.c index 70e897dd5..0a78575d5 100644 --- a/hypervisor/arch/x86/guest/vmcall.c +++ b/hypervisor/arch/x86/guest/vmcall.c @@ -106,11 +106,6 @@ int vmcall_vmexit_handler(struct acrn_vcpu *vcpu) (uint16_t)param2); break; - case HC_VM_SET_MEMORY_REGION: - /* param1: vmid */ - ret = hcall_set_vm_memory_region(vm, (uint16_t)param1, param2); - break; - case HC_VM_SET_MEMORY_REGIONS: ret = hcall_set_vm_memory_regions(vm, param1); break; diff --git a/hypervisor/common/hypercall.c b/hypervisor/common/hypercall.c index 5f92fa248..1cd11eb3e 100644 --- a/hypervisor/common/hypercall.c +++ b/hypervisor/common/hypercall.c @@ -491,7 +491,7 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id) /** *@pre Pointer vm shall point to VM0 */ -static int32_t local_set_vm_memory_region(struct acrn_vm *vm, +static int32_t set_vm_memory_region(struct acrn_vm *vm, struct acrn_vm *target_vm, const struct vm_memory_region *region) { uint64_t hpa, base_paddr, gpa_end; @@ -568,42 +568,6 @@ static int32_t local_set_vm_memory_region(struct acrn_vm *vm, return 0; } -/** - * @brief setup ept memory mapping - * - * @param vm Pointer to VM data structure - * @param vmid ID of the VM - * @param param guest physical address. This gpa points to - * struct vm_set_memmap - * - * @pre Pointer vm shall point to VM0 - * @return 0 on success, non-zero on error. - */ -int32_t hcall_set_vm_memory_region(struct acrn_vm *vm, uint16_t vmid, uint64_t param) -{ - struct vm_memory_region region; - struct acrn_vm *target_vm = get_vm_from_vmid(vmid); - - if (target_vm == NULL) { - return -EINVAL; - } - - (void)memset((void *)®ion, 0U, sizeof(region)); - - if (copy_from_gpa(vm, ®ion, param, sizeof(region)) != 0) { - pr_err("%s: Unable copy param to vm\n", __func__); - return -EFAULT; - } - - - if (is_vm0(target_vm)) { - pr_err("%s: Targeting to service vm", __func__); - return -EPERM; - } - - return local_set_vm_memory_region(vm, target_vm, ®ion); -} - /** * @brief setup ept memory mapping for multi regions * @@ -646,7 +610,7 @@ int32_t hcall_set_vm_memory_regions(struct acrn_vm *vm, uint64_t param) /* the force pointer change below is for back compatible * to struct vm_memory_region, it will be removed in the future */ - int ret = local_set_vm_memory_region(vm, target_vm, ®ions[idx]); + int ret = set_vm_memory_region(vm, target_vm, ®ions[idx]); if (ret < 0) { return ret; } diff --git a/hypervisor/include/common/hypercall.h b/hypervisor/include/common/hypercall.h index 05889fd4d..4c029874b 100644 --- a/hypervisor/include/common/hypercall.h +++ b/hypervisor/include/common/hypercall.h @@ -212,19 +212,6 @@ int32_t hcall_set_ioreq_buffer(struct acrn_vm *vm, uint16_t vmid, uint64_t param */ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id); -/** - * @brief setup ept memory mapping - * - * @param vm Pointer to VM data structure - * @param vmid ID of the VM - * @param param guest physical address. This gpa points to - * struct vm_set_memmap - * - * @pre Pointer vm shall point to VM0 - * @return 0 on success, non-zero on error. - */ -int32_t hcall_set_vm_memory_region(struct acrn_vm *vm, uint16_t vmid, uint64_t param); - /** * @brief setup ept memory mapping for multi regions * diff --git a/hypervisor/include/public/acrn_hv_defs.h b/hypervisor/include/public/acrn_hv_defs.h index 029e8d4ac..62314ed52 100644 --- a/hypervisor/include/public/acrn_hv_defs.h +++ b/hypervisor/include/public/acrn_hv_defs.h @@ -52,7 +52,6 @@ /* Guest memory management */ #define HC_ID_MEM_BASE 0x40UL -#define HC_VM_SET_MEMORY_REGION BASE_HC_ID(HC_ID, HC_ID_MEM_BASE + 0x00UL) #define HC_VM_GPA2HPA BASE_HC_ID(HC_ID, HC_ID_MEM_BASE + 0x01UL) #define HC_VM_SET_MEMORY_REGIONS BASE_HC_ID(HC_ID, HC_ID_MEM_BASE + 0x02UL) #define HC_VM_WRITE_PROTECT_PAGE BASE_HC_ID(HC_ID, HC_ID_MEM_BASE + 0x03UL)