Skip to content

Commit 359d7a9

Browse files
qzhuo2bp3tk0v
authored andcommitted
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 <[email protected]> Suggested-by: Dave Hansen <[email protected]> Signed-off-by: Qiuxu Zhuo <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Tony Luck <[email protected]> Reviewed-by: Sohil Mehta <[email protected]> Reviewed-by: Yazen Ghannam <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 51a12c2 commit 359d7a9

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
@@ -1936,7 +1936,7 @@ static void apply_quirks_amd(struct cpuinfo_x86 *c)
19361936
* Various K7s with broken bank 0 around. Always disable
19371937
* by default.
19381938
*/
1939-
if (c->x86 == 6 && this_cpu_read(mce_num_banks) > 0)
1939+
if (c->x86 == 6 && this_cpu_read(mce_num_banks))
19401940
mce_banks[0].ctl = 0;
19411941

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

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

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

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

19831986
if (c->x86_vfm == INTEL_SANDYBRIDGE_X)

0 commit comments

Comments
 (0)