Skip to content

Commit c56dbf0

Browse files
committed
Merge: x86/mce/intel: drivers updates
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-10/-/merge_requests/1409 Description: updates for x86/mce/intel JIRA: https://issues.redhat.com/browse/RHEL-113399 Build Info: 68834699 Tested: Successful platform test results on Intel (intel-birchstream-gnr-cwf-ap-02) system. The following commits have been excluded from the backport: c435e60 x86/msr: Rename 'rdmsrl()' to 'rdmsrq()' 78255eb x86/msr: Rename 'wrmsrl()' to 'wrmsrq()' 6fe22ab x86/msr: Rename 'rdmsrl_safe()' to 'rdmsrq_safe()' 6fa17ef x86/msr: Rename 'wrmsrl_safe()' to 'wrmsrq_safe()' Signed-off-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: David Arcari <darcari@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Scott Weaver <scweaver@redhat.com>
2 parents 2d77fee + 1eacd6c commit c56dbf0

File tree

4 files changed

+25
-23
lines changed

4 files changed

+25
-23
lines changed

arch/x86/include/asm/mce.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static inline void cmci_rediscover(void) {}
244244
static inline void cmci_recheck(void) {}
245245
#endif
246246

247-
int mce_available(struct cpuinfo_x86 *c);
247+
bool mce_available(struct cpuinfo_x86 *c);
248248
bool mce_is_memory_error(struct mce *m);
249249
bool mce_is_correctable(struct mce *m);
250250
bool mce_usable_address(struct mce *m);
@@ -264,7 +264,7 @@ enum mcp_flags {
264264

265265
void machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
266266

267-
int mce_notify_irq(void);
267+
bool mce_notify_irq(void);
268268

269269
DECLARE_PER_CPU(struct mce, injectm);
270270

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,15 @@ static bool lvt_interrupt_supported(unsigned int bank, u32 msr_high_bits)
391391
return msr_high_bits & BIT(28);
392392
}
393393

394-
static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi)
394+
static bool lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi)
395395
{
396396
int msr = (hi & MASK_LVTOFF_HI) >> 20;
397397

398398
if (apic < 0) {
399399
pr_err(FW_BUG "cpu %d, failed to setup threshold interrupt "
400400
"for bank %d, block %d (MSR%08X=0x%x%08x)\n", b->cpu,
401401
b->bank, b->block, b->address, hi, lo);
402-
return 0;
402+
return false;
403403
}
404404

405405
if (apic != msr) {
@@ -409,15 +409,15 @@ static int lvt_off_valid(struct threshold_block *b, int apic, u32 lo, u32 hi)
409409
* was set is reserved. Return early here:
410410
*/
411411
if (mce_flags.smca)
412-
return 0;
412+
return false;
413413

414414
pr_err(FW_BUG "cpu %d, invalid threshold interrupt offset %d "
415415
"for bank %d, block %d (MSR%08X=0x%x%08x)\n",
416416
b->cpu, apic, b->bank, b->block, b->address, hi, lo);
417-
return 0;
417+
return false;
418418
}
419419

420-
return 1;
420+
return true;
421421
};
422422

423423
/* Reprogram MCx_MISC MSR behind this threshold bank. */

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,10 @@ static noinstr void mce_gather_info(struct mce *m, struct pt_regs *regs)
479479
}
480480
}
481481

482-
int mce_available(struct cpuinfo_x86 *c)
482+
bool mce_available(struct cpuinfo_x86 *c)
483483
{
484484
if (mca_cfg.disabled)
485-
return 0;
485+
return false;
486486
return cpu_has(c, X86_FEATURE_MCE) && cpu_has(c, X86_FEATURE_MCA);
487487
}
488488

@@ -1748,7 +1748,7 @@ static void mce_timer_delete_all(void)
17481748
* Can be called from interrupt context, but not from machine check/NMI
17491749
* context.
17501750
*/
1751-
int mce_notify_irq(void)
1751+
bool mce_notify_irq(void)
17521752
{
17531753
/* Not more than two messages every minute */
17541754
static DEFINE_RATELIMIT_STATE(ratelimit, 60*HZ, 2);
@@ -1759,9 +1759,9 @@ int mce_notify_irq(void)
17591759
if (__ratelimit(&ratelimit))
17601760
pr_info(HW_ERR "Machine check events logged\n");
17611761

1762-
return 1;
1762+
return true;
17631763
}
1764-
return 0;
1764+
return false;
17651765
}
17661766
EXPORT_SYMBOL_GPL(mce_notify_irq);
17671767

@@ -1985,25 +1985,25 @@ static int __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
19851985
return 0;
19861986
}
19871987

1988-
static int __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
1988+
static bool __mcheck_cpu_ancient_init(struct cpuinfo_x86 *c)
19891989
{
19901990
if (c->x86 != 5)
1991-
return 0;
1991+
return false;
19921992

19931993
switch (c->x86_vendor) {
19941994
case X86_VENDOR_INTEL:
19951995
intel_p5_mcheck_init(c);
19961996
mce_flags.p5 = 1;
1997-
return 1;
1997+
return true;
19981998
case X86_VENDOR_CENTAUR:
19991999
winchip_mcheck_init(c);
20002000
mce_flags.winchip = 1;
2001-
return 1;
2001+
return true;
20022002
default:
2003-
return 0;
2003+
return false;
20042004
}
20052005

2006-
return 0;
2006+
return false;
20072007
}
20082008

20092009
/*

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ static u16 cmci_threshold[MAX_NR_BANKS];
7575
*/
7676
#define CMCI_STORM_THRESHOLD 32749
7777

78-
static int cmci_supported(int *banks)
78+
static bool cmci_supported(int *banks)
7979
{
8080
u64 cap;
8181

8282
if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce)
83-
return 0;
83+
return false;
8484

8585
/*
8686
* Vendor check is not strictly needed, but the initial
@@ -89,12 +89,13 @@ static int cmci_supported(int *banks)
8989
*/
9090
if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL &&
9191
boot_cpu_data.x86_vendor != X86_VENDOR_ZHAOXIN)
92-
return 0;
92+
return false;
9393

9494
if (!boot_cpu_has(X86_FEATURE_APIC) || lapic_get_maxlvt() < 6)
95-
return 0;
95+
return false;
96+
9697
rdmsrl(MSR_IA32_MCG_CAP, cap);
97-
*banks = min_t(unsigned, MAX_NR_BANKS, cap & 0xff);
98+
*banks = min_t(unsigned, MAX_NR_BANKS, cap & MCG_BANKCNT_MASK);
9899
return !!(cap & MCG_CMCI_P);
99100
}
100101

@@ -477,6 +478,7 @@ void mce_intel_feature_init(struct cpuinfo_x86 *c)
477478
void mce_intel_feature_clear(struct cpuinfo_x86 *c)
478479
{
479480
intel_clear_lmce();
481+
cmci_clear();
480482
}
481483

482484
bool intel_filter_mce(struct mce *m)

0 commit comments

Comments
 (0)