hv: hypercall: return 0 for empty PX or CX tables
Avoid failing hypercalls by returning 0 for empty PX and CX tables on HC_PM_GET_CPU_STATE/PMCMD_GET_PX_CNT and HC_PM_GET_CPU_STATE/PMCMD_GET_CX_CNT. Tracked-On: #6848 Signed-off-by: Helmut Buchsbaum <helmut.buchsbaum@opensource.tttech-industrial.com> Acked-by: Anthony Xu <anthony.xu@intel.com> Acked-by: Eddie Dong <eddie.dong@Intel.com>
This commit is contained in:
parent
e97b171ca2
commit
2f54a1862e
|
@ -1096,9 +1096,7 @@ int32_t hcall_get_cpu_pm_state(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm
|
|||
if (is_created_vm(target_vm)) {
|
||||
switch (cmd & PMCMD_TYPE_MASK) {
|
||||
case ACRN_PMCMD_GET_PX_CNT: {
|
||||
if (target_vm->pm.px_cnt != 0U) {
|
||||
ret = copy_to_gpa(vm, &(target_vm->pm.px_cnt), param2, sizeof(target_vm->pm.px_cnt));
|
||||
}
|
||||
ret = copy_to_gpa(vm, &(target_vm->pm.px_cnt), param2, sizeof(target_vm->pm.px_cnt));
|
||||
break;
|
||||
}
|
||||
case ACRN_PMCMD_GET_PX_DATA: {
|
||||
|
@ -1123,9 +1121,7 @@ int32_t hcall_get_cpu_pm_state(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm
|
|||
break;
|
||||
}
|
||||
case ACRN_PMCMD_GET_CX_CNT: {
|
||||
if (target_vm->pm.cx_cnt != 0U) {
|
||||
ret = copy_to_gpa(vm, &(target_vm->pm.cx_cnt), param2, sizeof(target_vm->pm.cx_cnt));
|
||||
}
|
||||
ret = copy_to_gpa(vm, &(target_vm->pm.cx_cnt), param2, sizeof(target_vm->pm.cx_cnt));
|
||||
break;
|
||||
}
|
||||
case ACRN_PMCMD_GET_CX_DATA: {
|
||||
|
|
Loading…
Reference in New Issue