hv: Write _CPC to guests' ACPI when VHWP is enabled

When VHWP enabled, return 0 and px_cnt = 0 on ACRN_PMCMD_GET_PX_CNT,
so that DM will write _CPC to guests' ACPI.

Tracked-On: #8414
Signed-off-by: Wu Zhou <wu.zhou@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Wu Zhou 2023-04-23 16:39:02 +08:00 committed by acrnsi-robot
parent 8c38cd5734
commit 972cdeb318
1 changed files with 13 additions and 3 deletions

View File

@ -1109,11 +1109,21 @@ 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 (!is_pt_pstate(target_vm)) {
uint8_t px_cnt;
/* If the VM supports vHWP, then the guest is having continuous p-state. Thus it doesn't have a specific
* px_cnt. The hypercall returns success and px_cnt = 0.
* If the VM's p-state is hidden or hv doesn't have its p-state info, the hypercall returns -1.
*/
if (is_vhwp_configured(target_vm)) {
px_cnt = 0U;
} else if (!is_pt_pstate(target_vm)) {
break;
} else if (target_vm->pm.px_cnt == 0U) {
break;
} else {
px_cnt = target_vm->pm.px_cnt;
}
ret = copy_to_gpa(vm, &(target_vm->pm.px_cnt), param2, sizeof(target_vm->pm.px_cnt));
ret = copy_to_gpa(vm, &px_cnt, param2, sizeof(px_cnt));
break;
}
case ACRN_PMCMD_GET_PX_DATA: {