Re: [PATCH 3/4] hv: hypercall: return 0 for empty PX or CX tables


Eddie Dong
 

My Ack too.

-----Original Message-----
From: acrn-dev@... <acrn-dev@...> On
Behalf Of Xu, Anthony
Sent: Wednesday, November 17, 2021 7:14 AM
To: acrn-dev@...
Subject: Re: [acrn-dev] [PATCH 3/4] hv: hypercall: return 0 for empty PX or CX
tables

Acked-by: Anthony Xu <anthony.xu@...>

Getting count should not fail.
You can PR this patch.


Anthony



-----Original Message-----
From: acrn-dev@... <acrn-dev@...>
On Behalf Of Zhou, Wu
Sent: Tuesday, November 16, 2021 12:47 AM
To: acrn-dev@...
Subject: [acrn-dev] [PATCH 3/4] hv: hypercall: return 0 for empty PX
or CX tables

From: Helmut Buchsbaum
<helmut.buchsbaum@...>

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.

Signed-off-by: Helmut Buchsbaum
<helmut.buchsbaum@...>
---
hypervisor/common/hypercall.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/hypervisor/common/hypercall.c
b/hypervisor/common/hypercall.c index 7fa25abd3..ee3541453 100644
--- a/hypervisor/common/hypercall.c
+++ b/hypervisor/common/hypercall.c
@@ -1094,9 +1094,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: {
@@ -1121,9 +1119,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: {
--
2.17.1







Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.