Skip to content

Commit 9f34032

Browse files
yghannambp3tk0v
authored andcommitted
x86/mce: Remove __mcheck_cpu_init_early()
The __mcheck_cpu_init_early() function was introduced so that some vendor-specific features are detected before the first MCA polling event done in __mcheck_cpu_init_generic(). Currently, __mcheck_cpu_init_early() is only used on AMD-based systems and additional code will be needed to support various system configurations. However, the current and future vendor-specific code should be done during vendor init. This keeps all the vendor code in a common location and simplifies the generic init flow. Move all the __mcheck_cpu_init_early() code into mce_amd_feature_init(). Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Nikolay Borisov <nik.borisov@suse.com> Tested-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/20250825-wip-mca-updates-v5-6-865768a2eef8@amd.com
1 parent 0f134c5 commit 9f34032

2 files changed

Lines changed: 4 additions & 14 deletions

File tree

arch/x86/kernel/cpu/mce/amd.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,10 @@ void mce_amd_feature_init(struct cpuinfo_x86 *c)
653653
u32 low = 0, high = 0, address = 0;
654654
int offset = -1;
655655

656+
mce_flags.overflow_recov = cpu_feature_enabled(X86_FEATURE_OVERFLOW_RECOV);
657+
mce_flags.succor = cpu_feature_enabled(X86_FEATURE_SUCCOR);
658+
mce_flags.smca = cpu_feature_enabled(X86_FEATURE_SMCA);
659+
mce_flags.amd_threshold = 1;
656660

657661
for (bank = 0; bank < this_cpu_read(mce_num_banks); ++bank) {
658662
if (mce_flags.smca)

arch/x86/kernel/cpu/mce/core.c

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,19 +2034,6 @@ static bool __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
20342034
return false;
20352035
}
20362036

2037-
/*
2038-
* Init basic CPU features needed for early decoding of MCEs.
2039-
*/
2040-
static void __mcheck_cpu_init_early(struct cpuinfo_x86 *c)
2041-
{
2042-
if (c->x86_vendor == X86_VENDOR_AMD || c->x86_vendor == X86_VENDOR_HYGON) {
2043-
mce_flags.overflow_recov = !!cpu_has(c, X86_FEATURE_OVERFLOW_RECOV);
2044-
mce_flags.succor = !!cpu_has(c, X86_FEATURE_SUCCOR);
2045-
mce_flags.smca = !!cpu_has(c, X86_FEATURE_SMCA);
2046-
mce_flags.amd_threshold = 1;
2047-
}
2048-
}
2049-
20502037
static void mce_centaur_feature_init(struct cpuinfo_x86 *c)
20512038
{
20522039
struct mca_config *cfg = &mca_cfg;
@@ -2285,7 +2272,6 @@ void mcheck_cpu_init(struct cpuinfo_x86 *c)
22852272

22862273
mca_cfg.initialized = 1;
22872274

2288-
__mcheck_cpu_init_early(c);
22892275
__mcheck_cpu_init_generic();
22902276
__mcheck_cpu_init_vendor(c);
22912277
__mcheck_cpu_init_prepare_banks();

0 commit comments

Comments
 (0)