kernel: x86: add some more cpuid flags.
This commit is contained in:
@@ -261,11 +261,17 @@
|
|||||||
// https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features
|
// https://en.wikipedia.org/wiki/CPUID#EAX=7,_ECX=0:_Extended_Features
|
||||||
#define IA32_FEATURE_AVX512_4VNNIW (1 << 2) // AVX-512 4-register Neural Network Instructions
|
#define IA32_FEATURE_AVX512_4VNNIW (1 << 2) // AVX-512 4-register Neural Network Instructions
|
||||||
#define IA32_FEATURE_AVX512_4FMAPS (1 << 3) // AVX-512 4-register Multiply Accumulation Single precision
|
#define IA32_FEATURE_AVX512_4FMAPS (1 << 3) // AVX-512 4-register Multiply Accumulation Single precision
|
||||||
|
#define IA32_FEATURE_IBRS (1 << 26) // IBRS / IBPB Speculation Control
|
||||||
|
#define IA32_FEATURE_STIBP (1 << 27) // STIBP Speculation Control
|
||||||
|
|
||||||
|
|
||||||
// x86 defined features from cpuid eax 0x80000007, edx register
|
// x86 defined features from cpuid eax 0x80000007, edx register
|
||||||
#define IA32_FEATURE_INVARIANT_TSC (1 << 8)
|
#define IA32_FEATURE_INVARIANT_TSC (1 << 8)
|
||||||
|
|
||||||
|
// x86 defined features from cpuid eax 0x80000008, ebx register
|
||||||
|
#define IA32_FEATURE_AMD_EXT_IBPB (1 << 12) /* IBPB Support only (no IBRS) */
|
||||||
|
|
||||||
|
|
||||||
// cr4 flags
|
// cr4 flags
|
||||||
#define IA32_CR4_PAE (1UL << 5)
|
#define IA32_CR4_PAE (1UL << 5)
|
||||||
#define IA32_CR4_GLOBAL_PAGES (1UL << 7)
|
#define IA32_CR4_GLOBAL_PAGES (1UL << 7)
|
||||||
@@ -355,6 +361,7 @@ enum x86_feature_type {
|
|||||||
FEATURE_7_ECX, // cpuid eax=7, ecx registers
|
FEATURE_7_ECX, // cpuid eax=7, ecx registers
|
||||||
FEATURE_7_EDX, // cpuid eax=7, edx registers
|
FEATURE_7_EDX, // cpuid eax=7, edx registers
|
||||||
FEATURE_EXT_7_EDX, // cpuid eax=0x80000007, edx register
|
FEATURE_EXT_7_EDX, // cpuid eax=0x80000007, edx register
|
||||||
|
FEATURE_EXT_8_EBX, // cpuid eax=0x80000008, ebx register
|
||||||
|
|
||||||
FEATURE_NUM
|
FEATURE_NUM
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -536,7 +536,12 @@ dump_feature_string(int currentCPU, cpu_ent* cpu)
|
|||||||
strlcat(features, "avx512bw ", sizeof(features));
|
strlcat(features, "avx512bw ", sizeof(features));
|
||||||
if (cpu->arch.feature[FEATURE_7_EBX] & IA32_FEATURE_AVX512VI)
|
if (cpu->arch.feature[FEATURE_7_EBX] & IA32_FEATURE_AVX512VI)
|
||||||
strlcat(features, "avx512vi ", sizeof(features));
|
strlcat(features, "avx512vi ", sizeof(features));
|
||||||
|
if (cpu->arch.feature[FEATURE_7_EDX] & IA32_FEATURE_IBRS)
|
||||||
|
strlcat(features, "ibrs ", sizeof(features));
|
||||||
|
if (cpu->arch.feature[FEATURE_7_EDX] & IA32_FEATURE_STIBP)
|
||||||
|
strlcat(features, "stibp ", sizeof(features));
|
||||||
|
if (cpu->arch.feature[FEATURE_EXT_8_EBX] & IA32_FEATURE_AMD_EXT_IBPB)
|
||||||
|
strlcat(features, "ibpb ", sizeof(features));
|
||||||
dprintf("CPU %d: features: %s\n", currentCPU, features);
|
dprintf("CPU %d: features: %s\n", currentCPU, features);
|
||||||
}
|
}
|
||||||
#endif // DUMP_FEATURE_STRING
|
#endif // DUMP_FEATURE_STRING
|
||||||
@@ -989,6 +994,11 @@ detect_cpu(int currentCPU)
|
|||||||
cpu->arch.feature[FEATURE_EXT_7_EDX] = cpuid.regs.edx;
|
cpu->arch.feature[FEATURE_EXT_7_EDX] = cpuid.regs.edx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (maxExtendedLeaf >= 0x80000008) {
|
||||||
|
get_current_cpuid(&cpuid, 0x80000008, 0);
|
||||||
|
cpu->arch.feature[FEATURE_EXT_8_EBX] = cpuid.regs.ebx;
|
||||||
|
}
|
||||||
|
|
||||||
detect_cpu_topology(currentCPU, cpu, maxBasicLeaf, maxExtendedLeaf);
|
detect_cpu_topology(currentCPU, cpu, maxBasicLeaf, maxExtendedLeaf);
|
||||||
|
|
||||||
#if DUMP_FEATURE_STRING
|
#if DUMP_FEATURE_STRING
|
||||||
|
|||||||
Reference in New Issue
Block a user