mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-01-05 15:45:05 +00:00
HV Cx: add hypercall function to retrieve host cx
The patch add function in vhm hypercall to retrieve physical cx data to VHM/DM. Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
@@ -729,6 +729,40 @@ int64_t hcall_get_cpu_pm_state(struct vm *vm, uint64_t cmd, uint64_t param)
|
||||
|
||||
return 0;
|
||||
}
|
||||
case PMCMD_GET_CX_CNT: {
|
||||
|
||||
if (!target_vm->pm.cx_cnt) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (copy_to_vm(vm, &(target_vm->pm.cx_cnt), param)) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
case PMCMD_GET_CX_DATA: {
|
||||
uint8_t cx_idx;
|
||||
struct cpu_cx_data *cx_data;
|
||||
|
||||
if (!target_vm->pm.cx_cnt) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cx_idx = (cmd & PMCMD_STATE_NUM_MASK) >> PMCMD_STATE_NUM_SHIFT;
|
||||
if (!cx_idx || (cx_idx > target_vm->pm.cx_cnt)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
cx_data = target_vm->pm.cx_data + cx_idx;
|
||||
|
||||
if (copy_to_vm(vm, cx_data, param)) {
|
||||
pr_err("%s: Unable copy param to vm\n", __func__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
default:
|
||||
return -1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user