diff --git a/arch/x86/ept.c b/arch/x86/ept.c index c0b4745be..b501b6da8 100644 --- a/arch/x86/ept.c +++ b/arch/x86/ept.c @@ -353,7 +353,7 @@ int dm_emulate_mmio_post(struct vcpu *vcpu) int cur = vcpu->vcpu_id; struct vhm_request_buffer *req_buf; - req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.req_buf); + req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page); vcpu->req.reqs.mmio_request.value = req_buf->req_queue[cur].reqs.mmio_request.value; diff --git a/arch/x86/guest/vm.c b/arch/x86/guest/vm.c index 9c7428ae9..324f64f37 100644 --- a/arch/x86/guest/vm.c +++ b/arch/x86/guest/vm.c @@ -169,7 +169,7 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm) /* Populate return VM handle */ *rtn_vm = vm; - vm->sw.req_buf = NULL; + vm->sw.io_shared_page = NULL; status = set_vcpuid_entries(vm); if (status) diff --git a/arch/x86/io.c b/arch/x86/io.c index 4f7bf87dd..7c23ac7ca 100644 --- a/arch/x86/io.c +++ b/arch/x86/io.c @@ -44,7 +44,7 @@ int dm_emulate_pio_post(struct vcpu *vcpu) 0xFFFFFFFFul >> (32 - 8 * vcpu->req.reqs.pio_request.size); uint64_t *rax; - req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.req_buf); + req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page); rax = &vcpu->arch_vcpu.contexts[cur_context].guest_cpu_regs.regs.rax; vcpu->req.reqs.pio_request.value = diff --git a/common/hypercall.c b/common/hypercall.c index 4fba7468b..889716477 100644 --- a/common/hypercall.c +++ b/common/hypercall.c @@ -212,7 +212,7 @@ int64_t hcall_resume_vm(uint64_t vmid) if (target_vm == NULL) return -1; - if (target_vm->sw.req_buf == NULL) + if (target_vm->sw.io_shared_page == NULL) ret = -1; else ret = start_vm(target_vm); @@ -342,11 +342,11 @@ int64_t hcall_set_ioreq_buffer(struct vm *vm, uint64_t vmid, uint64_t param) hpa = gpa2hpa(vm, iobuf.req_buf); if (hpa == 0) { pr_err("%s: invalid GPA.\n", __func__); - target_vm->sw.req_buf = NULL; + target_vm->sw.io_shared_page = NULL; return -EINVAL; } - target_vm->sw.req_buf = HPA2HVA(hpa); + target_vm->sw.io_shared_page = HPA2HVA(hpa); return ret; } @@ -360,7 +360,8 @@ static void complete_request(struct vcpu *vcpu) if (vcpu->state == VCPU_ZOMBIE) { struct vhm_request_buffer *req_buf; - req_buf = (struct vhm_request_buffer *)vcpu->vm->sw.req_buf; + req_buf = (struct vhm_request_buffer *) + vcpu->vm->sw.io_shared_page; req_buf->req_queue[vcpu->vcpu_id].valid = false; atomic_store_rel_32(&vcpu->ioreq_pending, 0); @@ -392,7 +393,7 @@ int64_t hcall_notify_req_finish(uint64_t vmid, uint64_t vcpu_id) struct vm *target_vm = get_vm_from_vmid(vmid); /* make sure we have set req_buf */ - if (!target_vm || target_vm->sw.req_buf == NULL) + if (!target_vm || target_vm->sw.io_shared_page == NULL) return -EINVAL; dev_dbg(ACRN_DBG_HYCALL, "[%d] NOTIFY_FINISH for vcpu %d", @@ -401,7 +402,7 @@ int64_t hcall_notify_req_finish(uint64_t vmid, uint64_t vcpu_id) vcpu = vcpu_from_vid(target_vm, vcpu_id); ASSERT(vcpu != NULL, "Failed to get VCPU context."); - req_buf = (struct vhm_request_buffer *)target_vm->sw.req_buf; + req_buf = (struct vhm_request_buffer *)target_vm->sw.io_shared_page; req = req_buf->req_queue + vcpu_id; if (req->valid && @@ -826,10 +827,10 @@ int acrn_insert_request_wait(struct vcpu *vcpu, struct vhm_request *req) "vhm_request page broken!"); - if (!vcpu || !req || vcpu->vm->sw.req_buf == NULL) + if (!vcpu || !req || vcpu->vm->sw.io_shared_page == NULL) return -EINVAL; - req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.req_buf); + req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page); /* ACRN insert request to VHM and inject upcall */ cur = vcpu->vcpu_id; @@ -860,10 +861,10 @@ int acrn_insert_request_nowait(struct vcpu *vcpu, struct vhm_request *req) struct vhm_request_buffer *req_buf; long cur; - if (!vcpu || !req || !vcpu->vm->sw.req_buf) + if (!vcpu || !req || !vcpu->vm->sw.io_shared_page) return -EINVAL; - req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.req_buf); + req_buf = (struct vhm_request_buffer *)(vcpu->vm->sw.io_shared_page); /* ACRN insert request to VHM and inject upcall */ cur = vcpu->vcpu_id; @@ -944,7 +945,7 @@ int get_req_info(char *str, int str_max) spinlock_obtain(&vm_list_lock); list_for_each(pos, &vm_list) { vm = list_entry(pos, struct vm, list); - req_buf = (struct vhm_request_buffer *)vm->sw.req_buf; + req_buf = (struct vhm_request_buffer *)vm->sw.io_shared_page; if (req_buf) { for (i = 0; i < VHM_REQUEST_MAX; i++) { req = req_buf->req_queue + i; diff --git a/include/arch/x86/guest/vm.h b/include/arch/x86/guest/vm.h index 6de56460a..3b608921c 100644 --- a/include/arch/x86/guest/vm.h +++ b/include/arch/x86/guest/vm.h @@ -76,8 +76,8 @@ struct vm_sw_info { struct sw_kernel_info kernel_info; /* Additional information specific to Linux guests */ struct sw_linux linux_info; - /* HVA to guest OS's request buffer */ - void *req_buf; + /* HVA to IO shared page */ + void *io_shared_page; }; struct vm_pm_info {