mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-08 11:39:39 +00:00
hv: dm: Use new power management data structures
struct cpu_px_data -> struct acrn_pstate_data struct cpu_cx_data -> struct acrn_cstate_data enum pm_cmd_type -> enum acrn_pm_cmd_type struct acpi_generic_address -> struct acrn_acpi_generic_address cpu_cx_data -> acrn_cstate_data cpu_px_data -> acrn_pstate_data IC_PM_GET_CPU_STATE -> ACRN_IOCTL_PM_GET_CPU_STATE PMCMD_GET_PX_CNT -> ACRN_PMCMD_GET_PX_CNT PMCMD_GET_CX_CNT -> ACRN_PMCMD_GET_CX_CNT PMCMD_GET_PX_DATA -> ACRN_PMCMD_GET_PX_DATA PMCMD_GET_CX_DATA -> ACRN_PMCMD_GET_CX_DATA Tracked-On: #6282 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
parent
98c80d75b8
commit
6e0b12180c
@ -649,7 +649,7 @@ vm_set_vcpu_regs(struct vmctx *ctx, struct acrn_vcpu_regs *vcpu_regs)
|
||||
int
|
||||
vm_get_cpu_state(struct vmctx *ctx, void *state_buf)
|
||||
{
|
||||
return ioctl(ctx->fd, IC_PM_GET_CPU_STATE, state_buf);
|
||||
return ioctl(ctx->fd, ACRN_IOCTL_PM_GET_CPU_STATE, state_buf);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -26,7 +26,7 @@ static inline uint8_t get_vcpu_px_cnt(struct vmctx *ctx, int vcpu_id)
|
||||
{
|
||||
uint64_t px_cnt;
|
||||
|
||||
if (get_vcpu_pm_info(ctx, vcpu_id, PMCMD_GET_PX_CNT, &px_cnt)) {
|
||||
if (get_vcpu_pm_info(ctx, vcpu_id, ACRN_PMCMD_GET_PX_CNT, &px_cnt)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -37,7 +37,7 @@ uint8_t get_vcpu_cx_cnt(struct vmctx *ctx, int vcpu_id)
|
||||
{
|
||||
uint64_t cx_cnt;
|
||||
|
||||
if (get_vcpu_pm_info(ctx, vcpu_id, PMCMD_GET_CX_CNT, &cx_cnt)) {
|
||||
if (get_vcpu_pm_info(ctx, vcpu_id, ACRN_PMCMD_GET_CX_CNT, &cx_cnt)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -45,12 +45,12 @@ uint8_t get_vcpu_cx_cnt(struct vmctx *ctx, int vcpu_id)
|
||||
}
|
||||
|
||||
static int get_vcpu_px_data(struct vmctx *ctx, int vcpu_id,
|
||||
int px_num, struct cpu_px_data *vcpu_px_data)
|
||||
int px_num, struct acrn_pstate_data *vcpu_px_data)
|
||||
{
|
||||
uint64_t *pm_ioctl_buf;
|
||||
enum pm_cmd_type cmd_type = PMCMD_GET_PX_DATA;
|
||||
enum acrn_pm_cmd_type cmd_type = ACRN_PMCMD_GET_PX_DATA;
|
||||
|
||||
pm_ioctl_buf = malloc(sizeof(struct cpu_px_data));
|
||||
pm_ioctl_buf = malloc(sizeof(struct acrn_pstate_data));
|
||||
if (!pm_ioctl_buf) {
|
||||
return -1;
|
||||
}
|
||||
@ -67,19 +67,19 @@ static int get_vcpu_px_data(struct vmctx *ctx, int vcpu_id,
|
||||
}
|
||||
|
||||
memcpy(vcpu_px_data, pm_ioctl_buf,
|
||||
sizeof(struct cpu_px_data));
|
||||
sizeof(struct acrn_pstate_data));
|
||||
|
||||
free(pm_ioctl_buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int get_vcpu_cx_data(struct vmctx *ctx, int vcpu_id,
|
||||
int cx_num, struct cpu_cx_data *vcpu_cx_data)
|
||||
int cx_num, struct acrn_cstate_data *vcpu_cx_data)
|
||||
{
|
||||
uint64_t *pm_ioctl_buf;
|
||||
enum pm_cmd_type cmd_type = PMCMD_GET_CX_DATA;
|
||||
enum acrn_pm_cmd_type cmd_type = ACRN_PMCMD_GET_CX_DATA;
|
||||
|
||||
pm_ioctl_buf = malloc(sizeof(struct cpu_cx_data));
|
||||
pm_ioctl_buf = malloc(sizeof(struct acrn_cstate_data));
|
||||
if (!pm_ioctl_buf) {
|
||||
return -1;
|
||||
}
|
||||
@ -96,7 +96,7 @@ int get_vcpu_cx_data(struct vmctx *ctx, int vcpu_id,
|
||||
}
|
||||
|
||||
memcpy(vcpu_cx_data, pm_ioctl_buf,
|
||||
sizeof(struct cpu_cx_data));
|
||||
sizeof(struct acrn_cstate_data));
|
||||
|
||||
free(pm_ioctl_buf);
|
||||
return 0;
|
||||
@ -146,8 +146,8 @@ void dsdt_write_cst(struct vmctx *ctx, int vcpu_id)
|
||||
int i;
|
||||
uint8_t vcpu_cx_cnt;
|
||||
char *cx_asi;
|
||||
struct acpi_generic_address cx_reg;
|
||||
struct cpu_cx_data *vcpu_cx_data;
|
||||
struct acrn_acpi_generic_address cx_reg;
|
||||
struct acrn_cstate_data *vcpu_cx_data;
|
||||
|
||||
vcpu_cx_cnt = get_vcpu_cx_cnt(ctx, vcpu_id);
|
||||
if (!vcpu_cx_cnt) {
|
||||
@ -155,7 +155,7 @@ void dsdt_write_cst(struct vmctx *ctx, int vcpu_id)
|
||||
}
|
||||
|
||||
/* vcpu_cx_data start from C1, cx_cnt is total Cx entry num. */
|
||||
vcpu_cx_data = malloc(vcpu_cx_cnt * sizeof(struct cpu_cx_data));
|
||||
vcpu_cx_data = malloc(vcpu_cx_cnt * sizeof(struct acrn_cstate_data));
|
||||
if (!vcpu_cx_data) {
|
||||
return;
|
||||
}
|
||||
@ -258,14 +258,14 @@ static void dsdt_write_pss(struct vmctx *ctx, int vcpu_id)
|
||||
{
|
||||
uint8_t vcpu_px_cnt;
|
||||
int i;
|
||||
struct cpu_px_data *vcpu_px_data;
|
||||
struct acrn_pstate_data *vcpu_px_data;
|
||||
|
||||
vcpu_px_cnt = get_vcpu_px_cnt(ctx, vcpu_id);
|
||||
if (!vcpu_px_cnt) {
|
||||
return;
|
||||
}
|
||||
|
||||
vcpu_px_data = malloc(vcpu_px_cnt * sizeof(struct cpu_px_data));
|
||||
vcpu_px_data = malloc(vcpu_px_cnt * sizeof(struct acrn_pstate_data));
|
||||
if (!vcpu_px_data) {
|
||||
return;
|
||||
}
|
||||
|
@ -130,8 +130,8 @@
|
||||
_IOW(ACRN_IOCTL_TYPE, 0x5A, struct acrn_vdev)
|
||||
|
||||
/* Power management */
|
||||
#define IC_ID_PM_BASE 0x60UL
|
||||
#define IC_PM_GET_CPU_STATE _IC_ID(IC_ID, IC_ID_PM_BASE + 0x00)
|
||||
#define ACRN_IOCTL_PM_GET_CPU_STATE \
|
||||
_IOWR(ACRN_IOCTL_TYPE, 0x60, __u64)
|
||||
|
||||
/* VHM eventfd */
|
||||
#define IC_ID_EVENT_BASE 0x70UL
|
||||
|
@ -66,10 +66,10 @@ static inline uint64_t get_acpi_dt_qword(const uint8_t *dt_addr, uint32_t dt_off
|
||||
|
||||
/* get a GAS struct from given table and its offset.
|
||||
* ACPI table stores packed gas, but it is not guaranteed that
|
||||
* struct acpi_generic_address is packed, so do not use memcpy in function.
|
||||
* struct acrn_acpi_generic_address is packed, so do not use memcpy in function.
|
||||
* @pre dt_addr != NULL && gas != NULL
|
||||
*/
|
||||
static inline void get_acpi_dt_gas(const uint8_t *dt_addr, uint32_t dt_offset, struct acpi_generic_address *gas)
|
||||
static inline void get_acpi_dt_gas(const uint8_t *dt_addr, uint32_t dt_offset, struct acrn_acpi_generic_address *gas)
|
||||
{
|
||||
struct packed_gas *dt_gas = (struct packed_gas *)(dt_addr + dt_offset);
|
||||
|
||||
@ -133,17 +133,17 @@ int32_t acpi_fixup(void)
|
||||
uint8_t *facp_addr = NULL, *facs_addr = NULL, *mcfg_addr = NULL, *rtct_tbl_addr = NULL;
|
||||
struct acpi_mcfg_allocation *mcfg_table = NULL;
|
||||
int32_t ret = 0;
|
||||
struct acpi_generic_address pm1a_cnt, pm1a_evt;
|
||||
struct acrn_acpi_generic_address pm1a_cnt, pm1a_evt;
|
||||
struct pm_s_state_data *sx_data = get_host_sstate_data();
|
||||
|
||||
facp_addr = (uint8_t *)get_acpi_tbl(ACPI_SIG_FADT);
|
||||
if (facp_addr != NULL) {
|
||||
get_acpi_dt_gas(facp_addr, OFFSET_PM1A_EVT, &pm1a_evt);
|
||||
get_acpi_dt_gas(facp_addr, OFFSET_PM1A_CNT, &pm1a_cnt);
|
||||
(void)memcpy_s((void *)&sx_data->pm1a_evt, sizeof(struct acpi_generic_address),
|
||||
(const void *)&pm1a_evt, sizeof(struct acpi_generic_address));
|
||||
(void)memcpy_s((void *)&sx_data->pm1a_cnt, sizeof(struct acpi_generic_address),
|
||||
(const void *)&pm1a_cnt, sizeof(struct acpi_generic_address));
|
||||
(void)memcpy_s((void *)&sx_data->pm1a_evt, sizeof(struct acrn_acpi_generic_address),
|
||||
(const void *)&pm1a_evt, sizeof(struct acrn_acpi_generic_address));
|
||||
(void)memcpy_s((void *)&sx_data->pm1a_cnt, sizeof(struct acrn_acpi_generic_address),
|
||||
(const void *)&pm1a_cnt, sizeof(struct acrn_acpi_generic_address));
|
||||
|
||||
facs_addr = (uint8_t *)get_facs_table(facp_addr);
|
||||
if (facs_addr != NULL) {
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include <asm/board.h>
|
||||
|
||||
/* The table includes cpu px info of Intel A3960 SoC */
|
||||
static const struct cpu_px_data px_a3960[17] = {
|
||||
static const struct acrn_pstate_data px_a3960[17] = {
|
||||
{0x960UL, 0UL, 0xAUL, 0xAUL, 0x1800UL, 0x1800UL}, /* P0 */
|
||||
{0x8FCUL, 0UL, 0xAUL, 0xAUL, 0x1700UL, 0x1700UL}, /* P1 */
|
||||
{0x898UL, 0UL, 0xAUL, 0xAUL, 0x1600UL, 0x1600UL}, /* P2 */
|
||||
@ -33,14 +33,14 @@ static const struct cpu_px_data px_a3960[17] = {
|
||||
};
|
||||
|
||||
/* The table includes cpu cx info of Intel Broxton SoC such as A39x0, J3455, N3350 */
|
||||
static const struct cpu_cx_data cx_bxt[3] = {
|
||||
static const struct acrn_cstate_data cx_bxt[3] = {
|
||||
{{SPACE_FFixedHW, 0x0U, 0U, 0U, 0UL}, 0x1U, 0x1U, 0x3E8UL}, /* C1 */
|
||||
{{SPACE_SYSTEM_IO, 0x8U, 0U, 0U, 0x415UL}, 0x2U, 0x32U, 0x0AUL}, /* C2 */
|
||||
{{SPACE_SYSTEM_IO, 0x8U, 0U, 0U, 0x419UL}, 0x3U, 0x96U, 0x0AUL} /* C3 */
|
||||
};
|
||||
|
||||
/* The table includes cpu px info of Intel A3950 SoC */
|
||||
static const struct cpu_px_data px_a3950[13] = {
|
||||
static const struct acrn_pstate_data px_a3950[13] = {
|
||||
{0x7D0UL, 0UL, 0xAUL, 0xAUL, 0x1400UL, 0x1400UL}, /* P0 */
|
||||
{0x76CUL, 0UL, 0xAUL, 0xAUL, 0x1300UL, 0x1300UL}, /* P1 */
|
||||
{0x708UL, 0UL, 0xAUL, 0xAUL, 0x1200UL, 0x1200UL}, /* P2 */
|
||||
@ -57,7 +57,7 @@ static const struct cpu_px_data px_a3950[13] = {
|
||||
};
|
||||
|
||||
/* The table includes cpu px info of Intel J3455 SoC */
|
||||
static const struct cpu_px_data px_j3455[9] = {
|
||||
static const struct acrn_pstate_data px_j3455[9] = {
|
||||
{0x5DDUL, 0UL, 0xAUL, 0xAUL, 0x1700UL, 0x1700UL}, /* P0 */
|
||||
{0x5DCUL, 0UL, 0xAUL, 0xAUL, 0x0F00UL, 0x0F00UL}, /* P1 */
|
||||
{0x578UL, 0UL, 0xAUL, 0xAUL, 0x0E00UL, 0x0E00UL}, /* P2 */
|
||||
@ -70,7 +70,7 @@ static const struct cpu_px_data px_j3455[9] = {
|
||||
};
|
||||
|
||||
/* The table includes cpu px info of Intel N3350 SoC */
|
||||
static const struct cpu_px_data px_n3350[5] = {
|
||||
static const struct acrn_pstate_data px_n3350[5] = {
|
||||
{0x44DUL, 0UL, 0xAUL, 0xAUL, 0x1800UL, 0x1800UL}, /* P0 */
|
||||
{0x44CUL, 0UL, 0xAUL, 0xAUL, 0x0B00UL, 0x0B00UL}, /* P1 */
|
||||
{0x3E8UL, 0UL, 0xAUL, 0xAUL, 0x0A00UL, 0x0A00UL}, /* P2 */
|
||||
@ -79,7 +79,7 @@ static const struct cpu_px_data px_n3350[5] = {
|
||||
};
|
||||
|
||||
/* The table includes cpu cx info of Intel i7-8650U SoC */
|
||||
static const struct cpu_px_data px_i78650[16] = {
|
||||
static const struct acrn_pstate_data px_i78650[16] = {
|
||||
{0x835UL, 0x0UL, 0xAUL, 0xAUL, 0x2A00UL, 0x2A00UL}, /* P0 */
|
||||
{0x834UL, 0x0UL, 0xAUL, 0xAUL, 0x1500UL, 0x1500UL}, /* P1 */
|
||||
{0x76CUL, 0x0UL, 0xAUL, 0xAUL, 0x1300UL, 0x1300UL}, /* P2 */
|
||||
@ -99,7 +99,7 @@ static const struct cpu_px_data px_i78650[16] = {
|
||||
};
|
||||
|
||||
/* The table includes cpu cx info of Intel i7-8650U SoC */
|
||||
static const struct cpu_cx_data cx_i78650[3] = {
|
||||
static const struct acrn_cstate_data cx_i78650[3] = {
|
||||
{{SPACE_FFixedHW, 0x0U, 0U, 0U, 0UL}, 0x1U, 0x1U, 0UL}, /* C1 */
|
||||
{{SPACE_SYSTEM_IO, 0x8U, 0U, 0U, 0x1816UL}, 0x2U, 0x97U, 0UL}, /* C2 */
|
||||
{{SPACE_SYSTEM_IO, 0x8U, 0U, 0U, 0x1819UL}, 0x3U, 0x40AU, 0UL} /* C3 */
|
||||
|
@ -31,7 +31,7 @@ int32_t validate_pstate(const struct acrn_vm *vm, uint64_t perf_ctl)
|
||||
ret = 0;
|
||||
} else {
|
||||
uint8_t px_cnt = vm->pm.px_cnt;
|
||||
const struct cpu_px_data *px_data = vm->pm.px_data;
|
||||
const struct acrn_pstate_data *px_data = vm->pm.px_data;
|
||||
|
||||
if ((px_cnt != 0U) && (px_data != NULL)) {
|
||||
uint64_t px_target_val, max_px_ctl_val, min_px_ctl_val;
|
||||
@ -57,13 +57,13 @@ static void vm_setup_cpu_px(struct acrn_vm *vm)
|
||||
struct cpu_state_info *pm_state_info = get_cpu_pm_state_info();
|
||||
|
||||
vm->pm.px_cnt = 0U;
|
||||
(void)memset(vm->pm.px_data, 0U, MAX_PSTATE * sizeof(struct cpu_px_data));
|
||||
(void)memset(vm->pm.px_data, 0U, MAX_PSTATE * sizeof(struct acrn_pstate_data));
|
||||
|
||||
if ((pm_state_info->px_cnt != 0U) && (pm_state_info->px_data != NULL)) {
|
||||
ASSERT((pm_state_info->px_cnt <= MAX_PSTATE), "failed to setup cpu px");
|
||||
|
||||
vm->pm.px_cnt = pm_state_info->px_cnt;
|
||||
px_data_size = ((uint32_t)vm->pm.px_cnt) * sizeof(struct cpu_px_data);
|
||||
px_data_size = ((uint32_t)vm->pm.px_cnt) * sizeof(struct acrn_pstate_data);
|
||||
(void)memcpy_s(vm->pm.px_data, px_data_size, pm_state_info->px_data, px_data_size);
|
||||
}
|
||||
}
|
||||
@ -74,13 +74,13 @@ static void vm_setup_cpu_cx(struct acrn_vm *vm)
|
||||
struct cpu_state_info *pm_state_info = get_cpu_pm_state_info();
|
||||
|
||||
vm->pm.cx_cnt = 0U;
|
||||
(void)memset(vm->pm.cx_data, 0U, MAX_CSTATE * sizeof(struct cpu_cx_data));
|
||||
(void)memset(vm->pm.cx_data, 0U, MAX_CSTATE * sizeof(struct acrn_cstate_data));
|
||||
|
||||
if ((pm_state_info->cx_cnt != 0U) && (pm_state_info->cx_data != NULL)) {
|
||||
ASSERT((pm_state_info->cx_cnt <= MAX_CX_ENTRY), "failed to setup cpu cx");
|
||||
|
||||
vm->pm.cx_cnt = pm_state_info->cx_cnt;
|
||||
cx_data_size = ((uint32_t)vm->pm.cx_cnt) * sizeof(struct cpu_cx_data);
|
||||
cx_data_size = ((uint32_t)vm->pm.cx_cnt) * sizeof(struct acrn_cstate_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.
|
||||
@ -94,7 +94,7 @@ static inline void init_cx_port(struct acrn_vm *vm)
|
||||
uint8_t cx_idx;
|
||||
|
||||
for (cx_idx = 2U; cx_idx <= vm->pm.cx_cnt; cx_idx++) {
|
||||
struct cpu_cx_data *cx_data = vm->pm.cx_data + cx_idx;
|
||||
struct acrn_cstate_data *cx_data = vm->pm.cx_data + cx_idx;
|
||||
|
||||
if (cx_data->cx_reg.space_id == SPACE_SYSTEM_IO) {
|
||||
uint16_t port = (uint16_t)cx_data->cx_reg.address;
|
||||
@ -245,7 +245,7 @@ static bool pm1ab_io_write(struct acrn_vcpu *vcpu, uint16_t addr, size_t width,
|
||||
return true;
|
||||
}
|
||||
|
||||
static void register_gas_io_handler(struct acrn_vm *vm, uint32_t pio_idx, const struct acpi_generic_address *gas)
|
||||
static void register_gas_io_handler(struct acrn_vm *vm, uint32_t pio_idx, const struct acrn_acpi_generic_address *gas)
|
||||
{
|
||||
uint8_t io_len[5] = {0U, 1U, 2U, 4U, 8U};
|
||||
struct vm_io_range gas_io;
|
||||
|
@ -201,7 +201,7 @@ void register_reset_port_handler(struct acrn_vm *vm)
|
||||
/* Don't support SOS and pre-launched VM re-launch for now. */
|
||||
if (!is_postlaunched_vm(vm) || is_rt_vm(vm)) {
|
||||
struct acpi_reset_reg *reset_reg = get_host_reset_reg_data();
|
||||
struct acpi_generic_address *gas = &(reset_reg->reg);
|
||||
struct acrn_acpi_generic_address *gas = &(reset_reg->reg);
|
||||
|
||||
struct vm_io_range io_range = {
|
||||
.len = 1U
|
||||
|
@ -97,7 +97,7 @@ void restore_msrs(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
static void acpi_gas_write(const struct acpi_generic_address *gas, uint32_t val)
|
||||
static void acpi_gas_write(const struct acrn_acpi_generic_address *gas, uint32_t val)
|
||||
{
|
||||
uint16_t val16 = (uint16_t)val;
|
||||
|
||||
@ -108,7 +108,7 @@ static void acpi_gas_write(const struct acpi_generic_address *gas, uint32_t val)
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t acpi_gas_read(const struct acpi_generic_address *gas)
|
||||
static uint32_t acpi_gas_read(const struct acrn_acpi_generic_address *gas)
|
||||
{
|
||||
uint32_t ret = 0U;
|
||||
|
||||
@ -239,7 +239,7 @@ void host_enter_s3(const struct pm_s_state_data *sstate_data, uint32_t pm1a_cnt_
|
||||
|
||||
void reset_host(void)
|
||||
{
|
||||
struct acpi_generic_address *gas = &(host_reset_reg.reg);
|
||||
struct acrn_acpi_generic_address *gas = &(host_reset_reg.reg);
|
||||
|
||||
|
||||
/* TODO: gracefully shut down all guests before doing host reset. */
|
||||
|
@ -1097,15 +1097,15 @@ 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 PMCMD_GET_PX_CNT: {
|
||||
case ACRN_PMCMD_GET_PX_CNT: {
|
||||
if (target_vm->pm.px_cnt != 0U) {
|
||||
ret = copy_to_gpa(vm, &(target_vm->pm.px_cnt), param2, sizeof(target_vm->pm.px_cnt));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PMCMD_GET_PX_DATA: {
|
||||
case ACRN_PMCMD_GET_PX_DATA: {
|
||||
uint8_t pn;
|
||||
struct cpu_px_data *px_data;
|
||||
struct acrn_pstate_data *px_data;
|
||||
|
||||
/* For now we put px data as per-vm,
|
||||
* If it is stored as per-cpu in the future,
|
||||
@ -1121,18 +1121,18 @@ int32_t hcall_get_cpu_pm_state(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm
|
||||
}
|
||||
|
||||
px_data = target_vm->pm.px_data + pn;
|
||||
ret = copy_to_gpa(vm, px_data, param2, sizeof(struct cpu_px_data));
|
||||
ret = copy_to_gpa(vm, px_data, param2, sizeof(struct acrn_pstate_data));
|
||||
break;
|
||||
}
|
||||
case PMCMD_GET_CX_CNT: {
|
||||
case ACRN_PMCMD_GET_CX_CNT: {
|
||||
if (target_vm->pm.cx_cnt != 0U) {
|
||||
ret = copy_to_gpa(vm, &(target_vm->pm.cx_cnt), param2, sizeof(target_vm->pm.cx_cnt));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PMCMD_GET_CX_DATA: {
|
||||
case ACRN_PMCMD_GET_CX_DATA: {
|
||||
uint8_t cx_idx;
|
||||
struct cpu_cx_data *cx_data;
|
||||
struct acrn_cstate_data *cx_data;
|
||||
|
||||
if (target_vm->pm.cx_cnt == 0U) {
|
||||
break;
|
||||
@ -1145,7 +1145,7 @@ int32_t hcall_get_cpu_pm_state(struct acrn_vcpu *vcpu, struct acrn_vm *target_vm
|
||||
}
|
||||
|
||||
cx_data = target_vm->pm.cx_data + cx_idx;
|
||||
ret = copy_to_gpa(vm, cx_data, param2, sizeof(struct cpu_cx_data));
|
||||
ret = copy_to_gpa(vm, cx_data, param2, sizeof(struct acrn_cstate_data));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -75,9 +75,9 @@ struct vm_sw_info {
|
||||
|
||||
struct vm_pm_info {
|
||||
uint8_t px_cnt; /* count of all Px states */
|
||||
struct cpu_px_data px_data[MAX_PSTATE];
|
||||
struct acrn_pstate_data px_data[MAX_PSTATE];
|
||||
uint8_t cx_cnt; /* count of all Cx entries */
|
||||
struct cpu_cx_data cx_data[MAX_CSTATE];
|
||||
struct acrn_cstate_data cx_data[MAX_CSTATE];
|
||||
struct pm_s_state_data *sx_state_data; /* data for S3/S5 implementation */
|
||||
};
|
||||
|
||||
|
@ -13,10 +13,10 @@
|
||||
#define BIT_WAK_STS 15U
|
||||
|
||||
struct cpu_state_info {
|
||||
uint8_t px_cnt; /* count of all Px states */
|
||||
const struct cpu_px_data *px_data;
|
||||
uint8_t cx_cnt; /* count of all Cx entries */
|
||||
const struct cpu_cx_data *cx_data;
|
||||
uint8_t px_cnt; /* count of all Px states */
|
||||
const struct acrn_pstate_data *px_data;
|
||||
uint8_t cx_cnt; /* count of all Cx entries */
|
||||
const struct acrn_cstate_data *cx_data;
|
||||
};
|
||||
|
||||
struct cpu_state_table {
|
||||
@ -25,7 +25,7 @@ struct cpu_state_table {
|
||||
};
|
||||
|
||||
struct acpi_reset_reg {
|
||||
struct acpi_generic_address reg;
|
||||
struct acrn_acpi_generic_address reg;
|
||||
uint8_t val;
|
||||
};
|
||||
|
||||
|
@ -570,22 +570,22 @@ struct acrn_vm_pci_msix_remap {
|
||||
#define SPACE_PLATFORM_COMM 10U
|
||||
#define SPACE_FFixedHW 0x7FU
|
||||
|
||||
struct acpi_generic_address {
|
||||
struct acrn_acpi_generic_address {
|
||||
uint8_t space_id;
|
||||
uint8_t bit_width;
|
||||
uint8_t bit_offset;
|
||||
uint8_t access_size;
|
||||
uint64_t address;
|
||||
} __aligned(8);
|
||||
} __attribute__ ((__packed__));
|
||||
|
||||
struct cpu_cx_data {
|
||||
struct acpi_generic_address cx_reg;
|
||||
struct acrn_cstate_data {
|
||||
struct acrn_acpi_generic_address cx_reg;
|
||||
uint8_t type;
|
||||
uint32_t latency;
|
||||
uint64_t power;
|
||||
} __aligned(8);
|
||||
|
||||
struct cpu_px_data {
|
||||
struct acrn_pstate_data {
|
||||
uint64_t core_frequency; /* megahertz */
|
||||
uint64_t power; /* milliWatts */
|
||||
uint64_t transition_latency; /* microseconds */
|
||||
@ -601,10 +601,10 @@ struct acpi_sx_pkg {
|
||||
} __aligned(8);
|
||||
|
||||
struct pm_s_state_data {
|
||||
struct acpi_generic_address pm1a_evt;
|
||||
struct acpi_generic_address pm1b_evt;
|
||||
struct acpi_generic_address pm1a_cnt;
|
||||
struct acpi_generic_address pm1b_cnt;
|
||||
struct acrn_acpi_generic_address pm1a_evt;
|
||||
struct acrn_acpi_generic_address pm1b_evt;
|
||||
struct acrn_acpi_generic_address pm1a_cnt;
|
||||
struct acrn_acpi_generic_address pm1b_cnt;
|
||||
struct acpi_sx_pkg s3_pkg;
|
||||
struct acpi_sx_pkg s5_pkg;
|
||||
uint32_t *wake_vector_32;
|
||||
@ -612,7 +612,7 @@ struct pm_s_state_data {
|
||||
} __aligned(8);
|
||||
|
||||
/**
|
||||
* @brief Info PM command from DM/VHM.
|
||||
* @brief Info PM command from DM/HSM.
|
||||
*
|
||||
* The command would specify request type(e.g. get px count or data) for
|
||||
* specific VM and specific VCPU with specific state number.
|
||||
@ -628,11 +628,11 @@ struct pm_s_state_data {
|
||||
#define PMCMD_VCPUID_SHIFT 16U
|
||||
#define PMCMD_STATE_NUM_SHIFT 8U
|
||||
|
||||
enum pm_cmd_type {
|
||||
PMCMD_GET_PX_CNT,
|
||||
PMCMD_GET_PX_DATA,
|
||||
PMCMD_GET_CX_CNT,
|
||||
PMCMD_GET_CX_DATA,
|
||||
enum acrn_pm_cmd_type {
|
||||
ACRN_PMCMD_GET_PX_CNT,
|
||||
ACRN_PMCMD_GET_PX_DATA,
|
||||
ACRN_PMCMD_GET_CX_CNT,
|
||||
ACRN_PMCMD_GET_CX_DATA,
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -202,12 +202,12 @@ def gen_single_data(data_lines, domain_str, config):
|
||||
if line_i == 0:
|
||||
if "not available" in data_l:
|
||||
print(data_l.strip(), file=config)
|
||||
print("static const struct cpu_{}x_data board_cpu_{}x[0];".format(domain_str, domain_str), file=config)
|
||||
print("static const struct acrn_{}state_data board_cpu_{}x[0];".format(domain_str, domain_str), file=config)
|
||||
print("", file=config)
|
||||
data_statues = False
|
||||
break
|
||||
else:
|
||||
print("static const struct cpu_{}x_data board_cpu_{}x[{}] = {{".format(domain_str, domain_str, data_len), file=config)
|
||||
print("static const struct acrn_{}state_data board_cpu_{}x[{}] = {{".format(domain_str, domain_str, data_len), file=config)
|
||||
print("\t{0}".format(data_l.strip()), file=config)
|
||||
line_i += 1
|
||||
if data_statues:
|
||||
|
@ -105,13 +105,13 @@ struct platform_clos_info platform_l3_clos_array[MAX_CACHE_CLOS_NUM_ENTRIES];
|
||||
struct platform_clos_info platform_mba_clos_array[MAX_MBA_CLOS_NUM_ENTRIES];
|
||||
#endif
|
||||
|
||||
static const struct cpu_cx_data board_cpu_cx[3] = {
|
||||
static const struct acrn_cstate_data board_cpu_cx[3] = {
|
||||
{{SPACE_FFixedHW, 0x00U, 0x00U, 0x00U, 0x00UL}, 0x01U, 0x01U, 0x00U}, /* C1 */
|
||||
{{SPACE_SYSTEM_IO, 0x08U, 0x00U, 0x00U, 0x1816UL}, 0x02U, 0xFDU, 0x00U}, /* C2 */
|
||||
{{SPACE_SYSTEM_IO, 0x08U, 0x00U, 0x00U, 0x1819UL}, 0x03U, 0x418U, 0x00U}, /* C3 */
|
||||
};
|
||||
|
||||
static const struct cpu_px_data board_cpu_px[2] = {
|
||||
static const struct acrn_pstate_data board_cpu_px[2] = {
|
||||
{0x5DDUL, 0x00UL, 0x0AUL, 0x0AUL, 0x000F00UL, 0x000F00UL}, /* P0 */
|
||||
{0x5DCUL, 0x00UL, 0x0AUL, 0x0AUL, 0x000F00UL, 0x000F00UL}, /* P1 */
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user