mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-04-27 11:22:17 +00:00
hv: ENODEV should be able to be set into RAX as hypercall return value
Some hypercalls return -ENODEV which should be set into RAX as return value, e.g. HC_ASSIGN_PCIDEV. So, remove the check in vmcall_vmexit_handler() and change return value to -EACCESS if the hypercall is not sent from Service VM or allowed VM. Tracked-On: #8598 Signed-off-by: Yi Sun <yi.y.sun@linux.intel.com>
This commit is contained in:
parent
aba53e78ef
commit
e07a9618f9
@ -257,7 +257,7 @@ static int32_t dispatch_hypercall(struct acrn_vcpu *vcpu)
|
||||
*/
|
||||
int32_t vmcall_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
int32_t ret;
|
||||
int32_t ret = -EACCES;
|
||||
struct acrn_vm *vm = vcpu->vm;
|
||||
/* hypercall ID from guest*/
|
||||
uint64_t hypcall_id = vcpu_get_gpreg(vcpu, CPU_REG_R8);
|
||||
@ -275,17 +275,13 @@ int32_t vmcall_vmexit_handler(struct acrn_vcpu *vcpu)
|
||||
*/
|
||||
if (!is_service_vm(vm) && !is_guest_hypercall(vm)) {
|
||||
vcpu_inject_ud(vcpu);
|
||||
ret = -ENODEV;
|
||||
} else if (!is_hypercall_from_ring0()) {
|
||||
vcpu_inject_gp(vcpu, 0U);
|
||||
ret = -EACCES;
|
||||
} else {
|
||||
ret = dispatch_hypercall(vcpu);
|
||||
}
|
||||
|
||||
if ((ret != -EACCES) && (ret != -ENODEV)) {
|
||||
vcpu_set_gpreg(vcpu, CPU_REG_RAX, (uint64_t)ret);
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
pr_err("ret=%d hypercall=0x%lx failed in %s\n", ret, hypcall_id, __func__);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user