mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-07-13 15:10:43 +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:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user