HV: code cleanup for cpu state

Split pm.c from cpu_state_tbl.c to put guest power management related
functions, keep cpu_state_tbl.c to store host cpu state table and
related functions.

Signed-off-by: Victor Sun <victor.sun@intel.com>
Acked-by: Kevin Tian <kevin.tian@intel.com>
This commit is contained in:
Victor Sun
2018-04-17 12:12:33 +08:00
committed by Jack Ren
parent 9dbcf7afaf
commit c3374a519a
10 changed files with 122 additions and 90 deletions

View File

@@ -236,13 +236,17 @@ enum feature_word {
FEATURE_WORDS,
};
struct cpu_state_info {
uint8_t px_cnt;
struct cpu_px_data *px_data;
};
struct cpuinfo_x86 {
uint8_t x86, x86_model;
uint64_t physical_address_mask;
uint32_t cpuid_leaves[FEATURE_WORDS];
char model_name[64];
uint8_t px_cnt;
struct cpu_px_data *px_data;
struct cpu_state_info state_info;
};
extern struct cpuinfo_x86 boot_cpu_data;
@@ -259,6 +263,7 @@ bool is_vapic_supported(void);
bool is_vapic_intr_delivery_supported(void);
bool is_vapic_virt_reg_supported(void);
bool cpu_has_cap(uint32_t bit);
void load_cpu_state_data(void);
/* Read control register */
#define CPU_CR_READ(cr, result_ptr) \

View File

@@ -28,17 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef CPU_STATE_TBL_H
#define CPU_STATE_TBL_H
#ifndef PM_H
#define PM_H
struct cpu_state_table {
char model_name[64];
uint8_t px_cnt;
struct cpu_px_data *px_data;
};
void load_cpu_state_data(void);
void vm_setup_cpu_state(struct vm *vm);
int validate_pstate(struct vm *vm, uint64_t perf_ctl);
#endif /* CPU_STATE_TBL_H */
#endif /* PM_H */

View File

@@ -41,7 +41,7 @@
#include <io.h>
#include <vcpu.h>
#include <trusty.h>
#include <cpu_state_tbl.h>
#include <pm.h>
#include <vm.h>
#include <cpuid.h>
#include <mmu.h>