Skip to content

Commit 0385216

Browse files
committed
x86/mce: Convert family/model mixed checks to VFM-based checks
JIRA: https://issues.redhat.com/browse/RHEL-118444 commit 359d7a9 Author: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Date: Thu Dec 12 22:01:01 2024 +0800 x86/mce: Convert family/model mixed checks to VFM-based checks Convert family/model mixed checks to VFM-based checks to make the code more compact. Simplify. [ bp: Drop the "what" from the commit message - it should be visible from the diff alone. ] Suggested-by: Sohil Mehta <sohil.mehta@intel.com> Suggested-by: Dave Hansen <dave.hansen@intel.com> Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Sohil Mehta <sohil.mehta@intel.com> Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com> Link: https://lore.kernel.org/r/20241212140103.66964-6-qiuxu.zhuo@intel.com Signed-off-by: David Arcari <darcari@redhat.com>
1 parent 98b1136 commit 0385216

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1935,7 +1935,7 @@ static void apply_quirks_amd(struct cpuinfo_x86 *c)
19351935
* Various K7s with broken bank 0 around. Always disable
19361936
* by default.
19371937
*/
1938-
if (c->x86 == 6 && this_cpu_read(mce_num_banks) > 0)
1938+
if (c->x86 == 6 && this_cpu_read(mce_num_banks))
19391939
mce_banks[0].ctl = 0;
19401940

19411941
/*
@@ -1953,6 +1953,10 @@ static void apply_quirks_intel(struct cpuinfo_x86 *c)
19531953
{
19541954
struct mce_bank *mce_banks = this_cpu_ptr(mce_banks_array);
19551955

1956+
/* Older CPUs (prior to family 6) don't need quirks. */
1957+
if (c->x86_vfm < INTEL_PENTIUM_PRO)
1958+
return;
1959+
19561960
/*
19571961
* SDM documents that on family 6 bank 0 should not be written
19581962
* because it aliases to another special BIOS controlled
@@ -1961,22 +1965,21 @@ static void apply_quirks_intel(struct cpuinfo_x86 *c)
19611965
* Don't ignore bank 0 completely because there could be a
19621966
* valid event later, merely don't write CTL0.
19631967
*/
1964-
if (c->x86 == 6 && c->x86_model < 0x1A && this_cpu_read(mce_num_banks) > 0)
1968+
if (c->x86_vfm < INTEL_NEHALEM_EP && this_cpu_read(mce_num_banks))
19651969
mce_banks[0].init = false;
19661970

19671971
/*
19681972
* All newer Intel systems support MCE broadcasting. Enable
19691973
* synchronization with a one second timeout.
19701974
*/
1971-
if ((c->x86 > 6 || (c->x86 == 6 && c->x86_model >= 0xe)) &&
1972-
mca_cfg.monarch_timeout < 0)
1975+
if (c->x86_vfm >= INTEL_CORE_YONAH && mca_cfg.monarch_timeout < 0)
19731976
mca_cfg.monarch_timeout = USEC_PER_SEC;
19741977

19751978
/*
19761979
* There are also broken BIOSes on some Pentium M and
19771980
* earlier systems:
19781981
*/
1979-
if (c->x86 == 6 && c->x86_model <= 13 && mca_cfg.bootlog < 0)
1982+
if (c->x86_vfm < INTEL_CORE_YONAH && mca_cfg.bootlog < 0)
19801983
mca_cfg.bootlog = 0;
19811984

19821985
if (c->x86_vfm == INTEL_SANDYBRIDGE_X)

0 commit comments

Comments
 (0)