mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-06 06:02:20 +00:00
HV Cx: load cx data while create VM
Each VM would have its own Cx data, for now we copy it from boot_cpu_info. Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
parent
2f678be24d
commit
4b302372a0
@ -31,6 +31,7 @@
|
|||||||
#include <acrn_common.h>
|
#include <acrn_common.h>
|
||||||
#include <hv_lib.h>
|
#include <hv_lib.h>
|
||||||
#include <hv_arch.h>
|
#include <hv_arch.h>
|
||||||
|
#include <hv_debug.h>
|
||||||
|
|
||||||
int validate_pstate(struct vm *vm, uint64_t perf_ctl)
|
int validate_pstate(struct vm *vm, uint64_t perf_ctl)
|
||||||
{
|
{
|
||||||
@ -82,7 +83,35 @@ static void vm_setup_cpu_px(struct vm *vm)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void vm_setup_cpu_cx(struct vm *vm)
|
||||||
|
{
|
||||||
|
uint32_t cx_data_size;
|
||||||
|
|
||||||
|
vm->pm.cx_cnt = 0;
|
||||||
|
memset(vm->pm.cx_data, 0, MAX_CSTATE * sizeof(struct cpu_cx_data));
|
||||||
|
|
||||||
|
if ((!boot_cpu_data.state_info.cx_cnt)
|
||||||
|
|| (!boot_cpu_data.state_info.cx_data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT ((boot_cpu_data.state_info.cx_cnt <= MAX_CX_ENTRY),
|
||||||
|
"failed to setup cpu cx");
|
||||||
|
|
||||||
|
vm->pm.cx_cnt = boot_cpu_data.state_info.cx_cnt;
|
||||||
|
|
||||||
|
cx_data_size = vm->pm.cx_cnt * sizeof(struct cpu_cx_data);
|
||||||
|
|
||||||
|
/* please note pm.cx_data[0] is a empty space holder,
|
||||||
|
* pm.cx_data[1...MAX_CX_ENTRY] would be used to store cx entry datas.
|
||||||
|
*/
|
||||||
|
memcpy_s(vm->pm.cx_data + 1, cx_data_size,
|
||||||
|
boot_cpu_data.state_info.cx_data, cx_data_size);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void vm_setup_cpu_state(struct vm *vm)
|
void vm_setup_cpu_state(struct vm *vm)
|
||||||
{
|
{
|
||||||
vm_setup_cpu_px(vm);
|
vm_setup_cpu_px(vm);
|
||||||
|
vm_setup_cpu_cx(vm);
|
||||||
}
|
}
|
||||||
|
@ -81,8 +81,10 @@ struct vm_sw_info {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct vm_pm_info {
|
struct vm_pm_info {
|
||||||
uint8_t px_cnt;
|
uint8_t px_cnt; /* count of all Px states */
|
||||||
struct cpu_px_data px_data[MAX_PSTATE];
|
struct cpu_px_data px_data[MAX_PSTATE];
|
||||||
|
uint8_t cx_cnt; /* count of all Cx entries */
|
||||||
|
struct cpu_cx_data cx_data[MAX_CSTATE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* VM guest types */
|
/* VM guest types */
|
||||||
|
Loading…
Reference in New Issue
Block a user