mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-05-01 13:14:02 +00:00
hv: add VHWP guest flag and its helper func
Currently CPU frequency control is hidden to guests, and controlled by hypervisor. While it is sufficient in most cases, some guest OS may still need CPU performance info to make multi-core scheduling decisions. This is seen on Linux kernel, which uses HWP highest performance level as CPU core's priority in multi-core scheduling (CONFIG_SCHED_MC_PRIO). Enabling this kernel feature could improve performance as single thread workloads are scheduled on the highest performance cores. This is significantly useful for guests with hybrid cores. The concept is to expose performance interface to guest who exclusively owns pCPU assigned to it. So that Linux guest can load intel_pstate driver which will then provide the kernel with each core's schedule priority. Intel_pstate driver also relies on CONFIG_ACPI_CPPC_LIB to implement this mechanic, this means we also need to provide ACPI _CPC in DM. This patch sets up a guest flag GUEST_FLAG_VHWP to indicate whether the guest can have VHWP feature. 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:
parent
e4e25f076c
commit
2edf141047
hypervisor
@ -213,6 +213,16 @@ bool is_static_configured_vm(const struct acrn_vm *vm)
|
||||
return ((vm_config->guest_flags & GUEST_FLAG_STATIC_VM) != 0U);
|
||||
}
|
||||
|
||||
/**
|
||||
* @pre vm != NULL && vm_config != NULL && vm->vmid < CONFIG_MAX_VM_NUM
|
||||
*/
|
||||
bool is_vhwp_configured(const struct acrn_vm *vm)
|
||||
{
|
||||
struct acrn_vm_config *vm_config = get_vm_config(vm->vm_id);
|
||||
|
||||
return ((vm_config->guest_flags & GUEST_FLAG_VHWP) != 0U);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief VT-d PI posted mode can possibly be used for PTDEVs assigned
|
||||
* to this VM if platform supports VT-d PI AND lapic passthru is not configured
|
||||
|
@ -274,6 +274,7 @@ struct acrn_vm *get_highest_severity_vm(bool runtime);
|
||||
bool vm_hide_mtrr(const struct acrn_vm *vm);
|
||||
void update_vm_vlapic_state(struct acrn_vm *vm);
|
||||
enum vm_vlapic_mode check_vm_vlapic_mode(const struct acrn_vm *vm);
|
||||
bool is_vhwp_configured(const struct acrn_vm *vm);
|
||||
/*
|
||||
* @pre vm != NULL
|
||||
*/
|
||||
|
@ -63,7 +63,7 @@
|
||||
#define GUEST_FLAG_TEE (1UL << 9U) /* Whether the VM is TEE VM */
|
||||
#define GUEST_FLAG_REE (1UL << 10U) /* Whether the VM is REE VM */
|
||||
#define GUEST_FLAG_PMU_PASSTHROUGH (1UL << 11U) /* Whether PMU is passed through */
|
||||
|
||||
#define GUEST_FLAG_VHWP (1UL << 12U) /* Whether the VM supports vHWP */
|
||||
|
||||
/* TODO: We may need to get this addr from guest ACPI instead of hardcode here */
|
||||
#define VIRTUAL_SLEEP_CTL_ADDR 0x400U /* Pre-launched VM uses ACPI reduced HW mode and sleep control register */
|
||||
|
Loading…
Reference in New Issue
Block a user