mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 20:53:46 +00:00
cpu: cache the maximum input value for CPUID extended function
Per SDM: When CPUID executes with EAX set to 80000000H, the processor returns the highest value the processor recognizes for returning extended processor information. The value is returned in the EAX register and is processor specific. This patch caches this value in the global cpuinfo_x86.cpuid_leaves. This value will be used to check the availability of any CPUID extended function. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
4542d3775d
commit
cc975f7858
@ -128,6 +128,7 @@ inline bool get_vmx_cap(void)
|
||||
static void get_cpu_capabilities(void)
|
||||
{
|
||||
uint32_t eax, unused;
|
||||
uint32_t max_extended_function_idx;
|
||||
uint32_t family, model;
|
||||
|
||||
cpuid(CPUID_FEATURES, &eax, &unused,
|
||||
@ -149,6 +150,12 @@ static void get_cpu_capabilities(void)
|
||||
&boot_cpu_data.cpuid_leaves[FEAT_7_0_ECX],
|
||||
&boot_cpu_data.cpuid_leaves[FEAT_7_0_EDX]);
|
||||
|
||||
cpuid(CPUID_MAX_EXTENDED_FUNCTION,
|
||||
&max_extended_function_idx,
|
||||
&unused, &unused, &unused);
|
||||
boot_cpu_data.cpuid_leaves[FEAT_8000_0000_EAX] =
|
||||
max_extended_function_idx;
|
||||
|
||||
cpuid(CPUID_EXTEND_FUNCTION_1, &unused, &unused,
|
||||
&boot_cpu_data.cpuid_leaves[FEAT_8000_0001_ECX],
|
||||
&boot_cpu_data.cpuid_leaves[FEAT_8000_0001_EDX]);
|
||||
|
@ -225,6 +225,7 @@ enum feature_word {
|
||||
FEAT_7_0_EBX, /* CPUID[EAX=7,ECX=0].EBX */
|
||||
FEAT_7_0_ECX, /* CPUID[EAX=7,ECX=0].ECX */
|
||||
FEAT_7_0_EDX, /* CPUID[EAX=7,ECX=0].EDX */
|
||||
FEAT_8000_0000_EAX, /* CPUID[8000_0000].EAX */
|
||||
FEAT_8000_0001_ECX, /* CPUID[8000_0001].ECX */
|
||||
FEAT_8000_0001_EDX, /* CPUID[8000_0001].EDX */
|
||||
FEATURE_WORDS,
|
||||
|
@ -113,7 +113,8 @@
|
||||
#define CPUID_TLB 2
|
||||
#define CPUID_SERIALNUM 3
|
||||
#define CPUID_EXTEND_FEATURE 7
|
||||
#define CPUID_EXTEND_FUNCTION_1 0x80000001
|
||||
#define CPUID_MAX_EXTENDED_FUNCTION 0x80000000
|
||||
#define CPUID_EXTEND_FUNCTION_1 0x80000001
|
||||
|
||||
static inline void __cpuid(uint32_t *eax, uint32_t *ebx,
|
||||
uint32_t *ecx, uint32_t *edx)
|
||||
|
Loading…
Reference in New Issue
Block a user