Skip to content

Commit f2a288d

Browse files
author
CKI KWF Bot
committed
Merge: Update x86/mce to upstream 6.17
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7437 JIRA: https://issues.redhat.com/browse/RHEL-118444 There are a number of fixes which should be migrated into RHEL. Note: various msr changes were not incorporated into this backport. Signed-off-by: David Arcari <darcari@redhat.com> Approved-by: Steve Best <sbest@redhat.com> Approved-by: Tony Camuso <tcamuso@redhat.com> Approved-by: Lenny Szubowicz <lszubowi@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2 parents 2be0070 + df87be5 commit f2a288d

File tree

15 files changed

+612
-584
lines changed

15 files changed

+612
-584
lines changed

arch/x86/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ config X86_MCE_INTEL
11701170
config X86_MCE_AMD
11711171
def_bool y
11721172
prompt "AMD MCE features"
1173-
depends on X86_MCE && X86_LOCAL_APIC && AMD_NB
1173+
depends on X86_MCE && X86_LOCAL_APIC
11741174
help
11751175
Additional support for AMD specific MCE features such as
11761176
the DRAM Error Threshold.

arch/x86/include/asm/amd_nb.h

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,40 +26,10 @@ struct amd_l3_cache {
2626
u8 subcaches[4];
2727
};
2828

29-
struct threshold_block {
30-
unsigned int block; /* Number within bank */
31-
unsigned int bank; /* MCA bank the block belongs to */
32-
unsigned int cpu; /* CPU which controls MCA bank */
33-
u32 address; /* MSR address for the block */
34-
u16 interrupt_enable; /* Enable/Disable APIC interrupt */
35-
bool interrupt_capable; /* Bank can generate an interrupt. */
36-
37-
u16 threshold_limit; /*
38-
* Value upon which threshold
39-
* interrupt is generated.
40-
*/
41-
42-
struct kobject kobj; /* sysfs object */
43-
struct list_head miscj; /*
44-
* List of threshold blocks
45-
* within a bank.
46-
*/
47-
};
48-
49-
struct threshold_bank {
50-
struct kobject *kobj;
51-
struct threshold_block *blocks;
52-
53-
/* initialized to the number of CPUs on the node sharing this bank */
54-
refcount_t cpus;
55-
unsigned int shared;
56-
};
57-
5829
struct amd_northbridge {
5930
struct pci_dev *misc;
6031
struct pci_dev *link;
6132
struct amd_l3_cache l3_cache;
62-
struct threshold_bank *bank4;
6333
};
6434

6535
struct amd_northbridge_info {

arch/x86/include/asm/intel-family.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@
4747
/* Wildcard match for FAM6 so X86_MATCH_VFM(ANY) works */
4848
#define INTEL_ANY IFM(X86_FAMILY_ANY, X86_MODEL_ANY)
4949

50+
#define INTEL_PENTIUM_PRO IFM(6, 0x01)
51+
5052
#define INTEL_FAM6_CORE_YONAH 0x0E
5153
#define INTEL_CORE_YONAH IFM(6, 0x0E)
5254

arch/x86/include/asm/mce.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ static inline void cmci_rediscover(void) {}
276276
static inline void cmci_recheck(void) {}
277277
#endif
278278

279-
int mce_available(struct cpuinfo_x86 *c);
279+
bool mce_available(struct cpuinfo_x86 *c);
280280
bool mce_is_memory_error(struct mce *m);
281281
bool mce_is_correctable(struct mce *m);
282282
bool mce_usable_address(struct mce *m);
@@ -293,9 +293,8 @@ enum mcp_flags {
293293
MCP_DONTLOG = BIT(2), /* only clear, don't log */
294294
MCP_QUEUE_LOG = BIT(3), /* only queue to genpool */
295295
};
296-
bool machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
297296

298-
int mce_notify_irq(void);
297+
void machine_check_poll(enum mcp_flags flags, mce_banks_t *b);
299298

300299
DECLARE_PER_CPU(struct mce, injectm);
301300

@@ -385,8 +384,6 @@ static inline bool amd_mce_is_memory_error(struct mce *m) { return false; };
385384
static inline void mce_amd_feature_init(struct cpuinfo_x86 *c) { }
386385
#endif
387386

388-
static inline void mce_hygon_feature_init(struct cpuinfo_x86 *c) { return mce_amd_feature_init(c); }
389-
390387
unsigned long copy_mc_fragile_handle_tail(char *to, char *from, unsigned len);
391388

392389
#endif /* _ASM_X86_MCE_H */

arch/x86/include/asm/msr.h

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,22 @@ struct saved_msrs {
3535
};
3636

3737
/*
38-
* both i386 and x86_64 returns 64-bit value in edx:eax, but gcc's "A"
39-
* constraint has different meanings. For i386, "A" means exactly
40-
* edx:eax, while for x86_64 it doesn't mean rdx:rax or edx:eax. Instead,
41-
* it means rax *or* rdx.
38+
* Both i386 and x86_64 returns 64-bit values in edx:eax for certain
39+
* instructions, but GCC's "A" constraint has different meanings.
40+
* For i386, "A" means exactly edx:eax, while for x86_64 it
41+
* means rax *or* rdx.
42+
*
43+
* These helpers wrapping these semantic differences save one instruction
44+
* clearing the high half of 'low':
4245
*/
4346
#ifdef CONFIG_X86_64
44-
/* Using 64-bit values saves one instruction clearing the high half of low */
45-
#define DECLARE_ARGS(val, low, high) unsigned long low, high
46-
#define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32)
47-
#define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
47+
# define EAX_EDX_DECLARE_ARGS(val, low, high) unsigned long low, high
48+
# define EAX_EDX_VAL(val, low, high) ((low) | (high) << 32)
49+
# define EAX_EDX_RET(val, low, high) "=a" (low), "=d" (high)
4850
#else
49-
#define DECLARE_ARGS(val, low, high) unsigned long long val
50-
#define EAX_EDX_VAL(val, low, high) (val)
51-
#define EAX_EDX_RET(val, low, high) "=A" (val)
51+
# define EAX_EDX_DECLARE_ARGS(val, low, high) u64 val
52+
# define EAX_EDX_VAL(val, low, high) (val)
53+
# define EAX_EDX_RET(val, low, high) "=A" (val)
5254
#endif
5355

5456
/*
@@ -77,9 +79,9 @@ static inline void do_trace_rdpmc(unsigned int msr, u64 val, int failed) {}
7779
* think of extending them - you will be slapped with a stinking trout or a frozen
7880
* shark will reach you, wherever you are! You've been warned.
7981
*/
80-
static __always_inline unsigned long long __rdmsr(unsigned int msr)
82+
static __always_inline u64 __rdmsr(unsigned int msr)
8183
{
82-
DECLARE_ARGS(val, low, high);
84+
EAX_EDX_DECLARE_ARGS(val, low, high);
8385

8486
asm volatile("1: rdmsr\n"
8587
"2:\n"
@@ -124,9 +126,9 @@ do { \
124126
__wrmsr((msr), (u32)((u64)(val)), \
125127
(u32)((u64)(val) >> 32))
126128

127-
static inline unsigned long long native_read_msr(unsigned int msr)
129+
static inline u64 native_read_msr(unsigned int msr)
128130
{
129-
unsigned long long val;
131+
u64 val;
130132

131133
val = __rdmsr(msr);
132134

@@ -136,10 +138,10 @@ static inline unsigned long long native_read_msr(unsigned int msr)
136138
return val;
137139
}
138140

139-
static inline unsigned long long native_read_msr_safe(unsigned int msr,
141+
static inline u64 native_read_msr_safe(unsigned int msr,
140142
int *err)
141143
{
142-
DECLARE_ARGS(val, low, high);
144+
EAX_EDX_DECLARE_ARGS(val, low, high);
143145

144146
asm volatile("1: rdmsr ; xor %[err],%[err]\n"
145147
"2:\n\t"
@@ -190,9 +192,9 @@ extern int wrmsr_safe_regs(u32 regs[8]);
190192
* CPU can and will speculatively execute that RDTSC, though, so the
191193
* results can be non-monotonic if compared on different CPUs.
192194
*/
193-
static __always_inline unsigned long long rdtsc(void)
195+
static __always_inline u64 rdtsc(void)
194196
{
195-
DECLARE_ARGS(val, low, high);
197+
EAX_EDX_DECLARE_ARGS(val, low, high);
196198

197199
asm volatile("rdtsc" : EAX_EDX_RET(val, low, high));
198200

@@ -207,9 +209,9 @@ static __always_inline unsigned long long rdtsc(void)
207209
* be impossible to observe non-monotonic rdtsc_unordered() behavior
208210
* across multiple CPUs as long as the TSC is synced.
209211
*/
210-
static __always_inline unsigned long long rdtsc_ordered(void)
212+
static __always_inline u64 rdtsc_ordered(void)
211213
{
212-
DECLARE_ARGS(val, low, high);
214+
EAX_EDX_DECLARE_ARGS(val, low, high);
213215

214216
/*
215217
* The RDTSC instruction is not ordered relative to memory
@@ -235,9 +237,9 @@ static __always_inline unsigned long long rdtsc_ordered(void)
235237
return EAX_EDX_VAL(val, low, high);
236238
}
237239

238-
static inline unsigned long long native_read_pmc(int counter)
240+
static inline u64 native_read_pmc(int counter)
239241
{
240-
DECLARE_ARGS(val, low, high);
242+
EAX_EDX_DECLARE_ARGS(val, low, high);
241243

242244
asm volatile("rdpmc" : EAX_EDX_RET(val, low, high) : "c" (counter));
243245
if (tracepoint_enabled(rdpmc))
@@ -291,7 +293,7 @@ static inline int wrmsr_safe(unsigned int msr, u32 low, u32 high)
291293
__err; \
292294
})
293295

294-
static inline int rdmsrl_safe(unsigned int msr, unsigned long long *p)
296+
static inline int rdmsrl_safe(unsigned int msr, u64 *p)
295297
{
296298
int err;
297299

arch/x86/kernel/cpu/intel.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,16 +311,18 @@ static void early_init_intel(struct cpuinfo_x86 *c)
311311
}
312312

313313
/*
314-
* There is a known erratum on Pentium III and Core Solo
315-
* and Core Duo CPUs.
316-
* " Page with PAT set to WC while associated MTRR is UC
317-
* may consolidate to UC "
318-
* Because of this erratum, it is better to stick with
319-
* setting WC in MTRR rather than using PAT on these CPUs.
314+
* PAT is broken on early family 6 CPUs, the last of which
315+
* is "Yonah" where the erratum is named "AN7":
320316
*
321-
* Enable PAT WC only on P4, Core 2 or later CPUs.
317+
* Page with PAT (Page Attribute Table) Set to USWC
318+
* (Uncacheable Speculative Write Combine) While
319+
* Associated MTRR (Memory Type Range Register) Is UC
320+
* (Uncacheable) May Consolidate to UC
321+
*
322+
* Disable PAT and fall back to MTRR on these CPUs.
322323
*/
323-
if (c->x86 == 6 && c->x86_model < 15)
324+
if (c->x86_vfm >= INTEL_PENTIUM_PRO &&
325+
c->x86_vfm <= INTEL_CORE_YONAH)
324326
clear_cpu_cap(c, X86_FEATURE_PAT);
325327

326328
/*

0 commit comments

Comments
 (0)