rename copy_from/to_vm to copy_from/to_gpa

the name copy_from/to_gpa should be more suitable.

Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Jason Chen CJ 2018-06-05 20:05:22 +08:00 committed by lijinxia
parent 8d35d8752b
commit 571fb33158
3 changed files with 29 additions and 29 deletions

View File

@ -388,12 +388,12 @@ static inline int copy_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
* - some other gpa from hypercall parameters, VHM should make sure it's
* continuous
*/
int copy_from_vm(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size)
int copy_from_gpa(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size)
{
return copy_gpa(vm, h_ptr, gpa, size, 1);
}
int copy_to_vm(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size)
int copy_to_gpa(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size)
{
return copy_gpa(vm, h_ptr, gpa, size, 0);
}

View File

@ -33,7 +33,7 @@ int64_t hcall_get_api_version(struct vm *vm, uint64_t param)
version.major_version = HV_API_MAJOR_VERSION;
version.minor_version = HV_API_MINOR_VERSION;
if (copy_to_vm(vm, &version, param, sizeof(version))) {
if (copy_to_gpa(vm, &version, param, sizeof(version))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -136,7 +136,7 @@ int64_t hcall_create_vm(struct vm *vm, uint64_t param)
struct vm_description vm_desc;
memset((void *)&cv, 0, sizeof(cv));
if (copy_from_vm(vm, &cv, param, sizeof(cv))) {
if (copy_from_gpa(vm, &cv, param, sizeof(cv))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -156,7 +156,7 @@ int64_t hcall_create_vm(struct vm *vm, uint64_t param)
ret = 0;
}
if (copy_to_vm(vm, &cv.vmid, param, sizeof(cv.vmid))) {
if (copy_to_gpa(vm, &cv.vmid, param, sizeof(cv.vmid))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -213,7 +213,7 @@ int64_t hcall_create_vcpu(struct vm *vm, uint64_t vmid, uint64_t param)
if (!target_vm || !param)
return -1;
if (copy_from_vm(vm, &cv, param, sizeof(cv))) {
if (copy_from_gpa(vm, &cv, param, sizeof(cv))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -234,7 +234,7 @@ int64_t hcall_assert_irqline(struct vm *vm, uint64_t vmid, uint64_t param)
int64_t ret = 0;
struct acrn_irqline irqline;
if (copy_from_vm(vm, &irqline, param, sizeof(irqline))) {
if (copy_from_gpa(vm, &irqline, param, sizeof(irqline))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -248,7 +248,7 @@ int64_t hcall_deassert_irqline(struct vm *vm, uint64_t vmid, uint64_t param)
int64_t ret = 0;
struct acrn_irqline irqline;
if (copy_from_vm(vm, &irqline, param, sizeof(irqline))) {
if (copy_from_gpa(vm, &irqline, param, sizeof(irqline))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -262,7 +262,7 @@ int64_t hcall_pulse_irqline(struct vm *vm, uint64_t vmid, uint64_t param)
int64_t ret = 0;
struct acrn_irqline irqline;
if (copy_from_vm(vm, &irqline, param, sizeof(irqline))) {
if (copy_from_gpa(vm, &irqline, param, sizeof(irqline))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -281,7 +281,7 @@ int64_t hcall_inject_msi(struct vm *vm, uint64_t vmid, uint64_t param)
return -1;
memset((void *)&msi, 0, sizeof(msi));
if (copy_from_vm(vm, &msi, param, sizeof(msi))) {
if (copy_from_gpa(vm, &msi, param, sizeof(msi))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -302,7 +302,7 @@ int64_t hcall_set_ioreq_buffer(struct vm *vm, uint64_t vmid, uint64_t param)
memset((void *)&iobuf, 0, sizeof(iobuf));
if (copy_from_vm(vm, &iobuf, param, sizeof(iobuf))) {
if (copy_from_gpa(vm, &iobuf, param, sizeof(iobuf))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -452,7 +452,7 @@ int64_t hcall_set_vm_memmap(struct vm *vm, uint64_t vmid, uint64_t param)
memset((void *)&memmap, 0, sizeof(memmap));
if (copy_from_vm(vm, &memmap, param, sizeof(memmap))) {
if (copy_from_gpa(vm, &memmap, param, sizeof(memmap))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -485,7 +485,7 @@ int64_t hcall_set_vm_memmaps(struct vm *vm, uint64_t param)
memset((void *)&set_memmaps, 0, sizeof(set_memmaps));
if (copy_from_vm(vm, &set_memmaps, param, sizeof(set_memmaps))) {
if (copy_from_gpa(vm, &set_memmaps, param, sizeof(set_memmaps))) {
pr_err("%s: Unable copy param from vm\n", __func__);
return -1;
}
@ -498,7 +498,7 @@ int64_t hcall_set_vm_memmaps(struct vm *vm, uint64_t param)
}
idx = 0;
/*TODO: use copy_from_vm for this buffer page */
/*TODO: use copy_from_gpa for this buffer page */
regions = GPA2HVA(vm, set_memmaps.memmaps_gpa);
while (idx < set_memmaps.memmaps_num) {
/* the force pointer change below is for back compatible
@ -524,7 +524,7 @@ int64_t hcall_remap_pci_msix(struct vm *vm, uint64_t vmid, uint64_t param)
memset((void *)&remap, 0, sizeof(remap));
if (copy_from_vm(vm, &remap, param, sizeof(remap))) {
if (copy_from_gpa(vm, &remap, param, sizeof(remap))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -543,7 +543,7 @@ int64_t hcall_remap_pci_msix(struct vm *vm, uint64_t vmid, uint64_t param)
remap.msi_data = info.pmsi_data;
remap.msi_addr = info.pmsi_addr;
if (copy_to_vm(vm, &remap, param, sizeof(remap))) {
if (copy_to_gpa(vm, &remap, param, sizeof(remap))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -563,12 +563,12 @@ int64_t hcall_gpa_to_hpa(struct vm *vm, uint64_t vmid, uint64_t param)
memset((void *)&v_gpa2hpa, 0, sizeof(v_gpa2hpa));
if (copy_from_vm(vm, &v_gpa2hpa, param, sizeof(v_gpa2hpa))) {
if (copy_from_gpa(vm, &v_gpa2hpa, param, sizeof(v_gpa2hpa))) {
pr_err("HCALL gpa2hpa: Unable copy param from vm\n");
return -1;
}
v_gpa2hpa.hpa = gpa2hpa(target_vm, v_gpa2hpa.gpa);
if (copy_to_vm(vm, &v_gpa2hpa, param, sizeof(v_gpa2hpa))) {
if (copy_to_gpa(vm, &v_gpa2hpa, param, sizeof(v_gpa2hpa))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -587,7 +587,7 @@ int64_t hcall_assign_ptdev(struct vm *vm, uint64_t vmid, uint64_t param)
return -EINVAL;
}
if (copy_from_vm(vm, &bdf, param, sizeof(bdf))) {
if (copy_from_gpa(vm, &bdf, param, sizeof(bdf))) {
pr_err("%s: Unable copy param from vm %d\n",
__func__, vm->attr.id);
return -EIO;
@ -622,7 +622,7 @@ int64_t hcall_deassign_ptdev(struct vm *vm, uint64_t vmid, uint64_t param)
if (target_vm == NULL)
return -1;
if (copy_from_vm(vm, &bdf, param, sizeof(bdf))) {
if (copy_from_gpa(vm, &bdf, param, sizeof(bdf))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -643,7 +643,7 @@ int64_t hcall_set_ptdev_intr_info(struct vm *vm, uint64_t vmid, uint64_t param)
memset((void *)&irq, 0, sizeof(irq));
if (copy_from_vm(vm, &irq, param, sizeof(irq))) {
if (copy_from_gpa(vm, &irq, param, sizeof(irq))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -673,7 +673,7 @@ hcall_reset_ptdev_intr_info(struct vm *vm, uint64_t vmid, uint64_t param)
memset((void *)&irq, 0, sizeof(irq));
if (copy_from_vm(vm, &irq, param, sizeof(irq))) {
if (copy_from_gpa(vm, &irq, param, sizeof(irq))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -697,7 +697,7 @@ int64_t hcall_setup_sbuf(struct vm *vm, uint64_t param)
memset((void *)&ssp, 0, sizeof(ssp));
if (copy_from_vm(vm, &ssp, param, sizeof(ssp))) {
if (copy_from_gpa(vm, &ssp, param, sizeof(ssp))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
}
@ -729,7 +729,7 @@ int64_t hcall_get_cpu_pm_state(struct vm *vm, uint64_t cmd, uint64_t param)
return -1;
}
if (copy_to_vm(vm, &(target_vm->pm.px_cnt), param,
if (copy_to_gpa(vm, &(target_vm->pm.px_cnt), param,
sizeof(target_vm->pm.px_cnt))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
@ -754,7 +754,7 @@ int64_t hcall_get_cpu_pm_state(struct vm *vm, uint64_t cmd, uint64_t param)
}
px_data = target_vm->pm.px_data + pn;
if (copy_to_vm(vm, px_data, param,
if (copy_to_gpa(vm, px_data, param,
sizeof(struct cpu_px_data))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
@ -768,7 +768,7 @@ int64_t hcall_get_cpu_pm_state(struct vm *vm, uint64_t cmd, uint64_t param)
return -1;
}
if (copy_to_vm(vm, &(target_vm->pm.cx_cnt), param,
if (copy_to_gpa(vm, &(target_vm->pm.cx_cnt), param,
sizeof(target_vm->pm.cx_cnt))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;
@ -790,7 +790,7 @@ int64_t hcall_get_cpu_pm_state(struct vm *vm, uint64_t cmd, uint64_t param)
cx_data = target_vm->pm.cx_data + cx_idx;
if (copy_to_vm(vm, cx_data, param,
if (copy_to_gpa(vm, cx_data, param,
sizeof(struct cpu_cx_data))) {
pr_err("%s: Unable copy param to vm\n", __func__);
return -1;

View File

@ -120,8 +120,8 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu);
typedef int (*vm_sw_loader_t)(struct vm *, struct vcpu *);
extern vm_sw_loader_t vm_sw_loader;
int copy_from_vm(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size);
int copy_to_vm(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size);
int copy_from_gpa(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size);
int copy_to_gpa(struct vm *vm, void *h_ptr, uint64_t gpa, uint32_t size);
int copy_from_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
uint32_t size, uint32_t *err_code);
int copy_to_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,