mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-20 16:28:10 +00:00
HV: setup px info when create vm
The vm px info would be used for guest Pstate control. Currently it is copied from host boot cpu. Signed-off-by: Victor Sun <victor.sun@intel.com> Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
@@ -31,6 +31,7 @@
|
||||
#include <hv_lib.h>
|
||||
#include <cpu.h>
|
||||
#include <acrn_common.h>
|
||||
#include <hv_arch.h>
|
||||
#include <cpu_state_tbl.h>
|
||||
|
||||
/* The table includes cpu px info of Intel A3960 SoC */
|
||||
@@ -105,3 +106,32 @@ void load_cpu_state_data(void)
|
||||
boot_cpu_data.px_data = (cpu_state_tbl + tbl_idx)->px_data;
|
||||
|
||||
}
|
||||
|
||||
void vm_setup_cpu_px(struct vm *vm)
|
||||
{
|
||||
uint32_t px_data_size;
|
||||
|
||||
vm->pm.px_cnt = 0;
|
||||
memset(vm->pm.px_data, 0, MAX_PSTATE * sizeof(struct cpu_px_data));
|
||||
|
||||
if ((!boot_cpu_data.px_cnt) || (!boot_cpu_data.px_data)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (boot_cpu_data.px_cnt > MAX_PSTATE) {
|
||||
vm->pm.px_cnt = MAX_PSTATE;
|
||||
} else {
|
||||
vm->pm.px_cnt = boot_cpu_data.px_cnt;
|
||||
}
|
||||
|
||||
px_data_size = vm->pm.px_cnt * sizeof(struct cpu_px_data);
|
||||
|
||||
memcpy_s(vm->pm.px_data, px_data_size,
|
||||
boot_cpu_data.px_data, px_data_size);
|
||||
|
||||
}
|
||||
|
||||
void vm_setup_cpu_state(struct vm *vm)
|
||||
{
|
||||
vm_setup_cpu_px(vm);
|
||||
}
|
||||
|
@@ -34,6 +34,7 @@
|
||||
#include <bsp_extern.h>
|
||||
#include <hv_debug.h>
|
||||
#include <multiboot.h>
|
||||
#include <cpu_state_tbl.h>
|
||||
|
||||
/* Local variables */
|
||||
|
||||
@@ -153,6 +154,8 @@ int create_vm(struct vm_description *vm_desc, struct vm **rtn_vm)
|
||||
*/
|
||||
setup_io_bitmap(vm);
|
||||
|
||||
vm_setup_cpu_state(vm);
|
||||
|
||||
/* Create virtual uart */
|
||||
if (is_vm0(vm))
|
||||
vm->vuart = vuart_init(vm);
|
||||
|
Reference in New Issue
Block a user