mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-23 09:47:44 +00:00
hv:cleanup vmid related code
Remove structure vm_attr Wrap two APIs alloc_vm_id and free_vm_id Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -181,7 +181,7 @@ int32_t hcall_create_vm(struct vm *vm, uint64_t param)
|
||||
cv.vmid = ACRN_INVALID_VMID;
|
||||
ret = -1;
|
||||
} else {
|
||||
cv.vmid = target_vm->attr.id;
|
||||
cv.vmid = target_vm->vm_id;
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ int32_t hcall_notify_ioreq_finish(uint16_t vmid, uint16_t vcpu_id)
|
||||
vcpu = vcpu_from_vid(target_vm, vcpu_id);
|
||||
if (vcpu == NULL) {
|
||||
pr_err("%s, failed to get VCPU %d context from VM %d\n",
|
||||
__func__, vcpu_id, target_vm->attr.id);
|
||||
__func__, vcpu_id, target_vm->vm_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -410,13 +410,13 @@ static int32_t local_set_vm_memory_region(struct vm *vm,
|
||||
|
||||
if ((region->size & (CPU_PAGE_SIZE - 1UL)) != 0UL) {
|
||||
pr_err("%s: [vm%d] map size 0x%x is not page aligned",
|
||||
__func__, target_vm->attr.id, region->size);
|
||||
__func__, target_vm->vm_id, region->size);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
hpa = gpa2hpa(vm, region->vm0_gpa);
|
||||
dev_dbg(ACRN_DBG_HYCALL, "[vm%d] gpa=0x%x hpa=0x%x size=0x%x",
|
||||
target_vm->attr.id, region->gpa, hpa, region->size);
|
||||
target_vm->vm_id, region->gpa, hpa, region->size);
|
||||
|
||||
base_paddr = get_hv_image_base();
|
||||
if (((hpa <= base_paddr) &&
|
||||
@@ -540,7 +540,7 @@ static int32_t write_protect_page(struct vm *vm, struct wp_data *wp)
|
||||
|
||||
hpa = gpa2hpa(vm, wp->gpa);
|
||||
dev_dbg(ACRN_DBG_HYCALL, "[vm%d] gpa=0x%x hpa=0x%x",
|
||||
vm->attr.id, wp->gpa, hpa);
|
||||
vm->vm_id, wp->gpa, hpa);
|
||||
|
||||
base_paddr = get_hv_image_base();
|
||||
if (((hpa <= base_paddr) && (hpa + CPU_PAGE_SIZE > base_paddr)) ||
|
||||
@@ -665,7 +665,7 @@ int32_t hcall_assign_ptdev(struct vm *vm, uint16_t vmid, uint64_t param)
|
||||
|
||||
if (copy_from_gpa(vm, &bdf, param, sizeof(bdf)) != 0) {
|
||||
pr_err("%s: Unable copy param from vm %d\n",
|
||||
__func__, vm->attr.id);
|
||||
__func__, vm->vm_id);
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -673,7 +673,7 @@ int32_t hcall_assign_ptdev(struct vm *vm, uint16_t vmid, uint64_t param)
|
||||
if (target_vm->iommu == NULL) {
|
||||
if (target_vm->arch_vm.nworld_eptp == NULL) {
|
||||
pr_err("%s, EPT of VM not set!\n",
|
||||
__func__, target_vm->attr.id);
|
||||
__func__, target_vm->vm_id);
|
||||
return -EPERM;
|
||||
}
|
||||
/* TODO: how to get vm's address width? */
|
||||
|
@@ -188,7 +188,7 @@ void get_req_info(char *str_arg, int str_max)
|
||||
state, dir, &addr, &val);
|
||||
len = snprintf(str, size,
|
||||
"\r\n%d\t%d\t%d\t%s\t%s\t%s",
|
||||
vm->attr.id, i, client_id, type,
|
||||
vm->vm_id, i, client_id, type,
|
||||
state, dir);
|
||||
size -= len;
|
||||
str += len;
|
||||
|
@@ -137,7 +137,7 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
/* Set VCPU entry point to kernel entry */
|
||||
vcpu->entry_addr = sw_kernel->kernel_entry_addr;
|
||||
pr_info("%s, VM *d VCPU %hu Entry: 0x%016llx ",
|
||||
__func__, vm->attr.id, vcpu->vcpu_id, vcpu->entry_addr);
|
||||
__func__, vm->vm_id, vcpu->vcpu_id, vcpu->entry_addr);
|
||||
}
|
||||
|
||||
/* Calculate the host-physical address where the guest will be loaded */
|
||||
@@ -220,7 +220,7 @@ int general_sw_loader(struct vm *vm, struct vcpu *vcpu)
|
||||
cur_context->guest_cpu_regs.regs.rsi = create_zero_page(vm);
|
||||
|
||||
pr_info("%s, RSI pointing to zero page for VM %d at GPA %X",
|
||||
__func__, vm->attr.id,
|
||||
__func__, vm->vm_id,
|
||||
cur_context->guest_cpu_regs.regs.rsi);
|
||||
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user