hv: change error code of undefined hypercall

This patch adds ENOTTY and ENOSYS to indicate undefined and obsoleted
request hyercall respectively, and uses ENOTTY as error code for undefined
hypercall instead of EINVAL to consistent with the ACRN kernel's return
value.

Tracked-On: #7029
Signed-off-by: Wen Qian <qian.wen@intel.com>
Signed-off-by: Li Fei <fei1.li@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
This commit is contained in:
Wen Qian 2022-01-26 10:37:56 +08:00 committed by acrnsi-robot
parent a5a005f129
commit e2f1990548
2 changed files with 6 additions and 2 deletions

View File

@ -205,7 +205,7 @@ struct acrn_vm *parse_target_vm(struct acrn_vm *service_vm, uint64_t hcall_id, u
static int32_t dispatch_hypercall(struct acrn_vcpu *vcpu)
{
int32_t ret = -EINVAL;
int32_t ret = -ENOTTY;
struct acrn_vm *vm = vcpu->vm;
uint64_t guest_flags = get_vm_config(vm->vm_id)->guest_flags; /* hypercall ID from guest */
uint64_t hcall_id = vcpu_get_gpreg(vcpu, CPU_REG_R8); /* hypercall ID from guest */
@ -237,7 +237,7 @@ static int32_t dispatch_hypercall(struct acrn_vcpu *vcpu)
((guest_flags & permission_flags) != 0UL)) {
ret = dispatch->handler(vcpu, vcpu->vm, param1, param2);
} else {
/* The vCPU is not allowed to invoke the given hypercall. Keep `ret` as -EINVAL and no
/* The vCPU is not allowed to invoke the given hypercall. Keep `ret` as -ENOTTY and no
* further actions required.
*/
}

View File

@ -23,6 +23,10 @@
#define ENODEV 19
/** Indicates that argument is not valid. */
#define EINVAL 22
/** Indicates the operation is undefined. */
#define ENOTTY 25
/** Indicates the operation is obsoleted. */
#define ENOSYS 38
/** Indicates that timeout occurs. */
#define ETIMEDOUT 110