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.
Acked-by: Anthony Xu
Acked-by: Eddie Dong
@@ -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));
- }
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));
- }
break;
}
case ACRN_PMCMD_GET_CX_DATA: {
