File tree Expand file tree Collapse file tree 4 files changed +33
-24
lines changed Expand file tree Collapse file tree 4 files changed +33
-24
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ static inline void cmci_recheck(void) {}
245
245
int mce_available (struct cpuinfo_x86 * c );
246
246
bool mce_is_memory_error (struct mce * m );
247
247
bool mce_is_correctable (struct mce * m );
248
- int mce_usable_address (struct mce * m );
248
+ bool mce_usable_address (struct mce * m );
249
249
250
250
DECLARE_PER_CPU (unsigned , mce_exception_count );
251
251
DECLARE_PER_CPU (unsigned , mce_poll_count );
Original file line number Diff line number Diff line change @@ -453,35 +453,22 @@ static void mce_irq_work_cb(struct irq_work *entry)
453
453
mce_schedule_work ();
454
454
}
455
455
456
- /*
457
- * Check if the address reported by the CPU is in a format we can parse.
458
- * It would be possible to add code for most other cases, but all would
459
- * be somewhat complicated (e.g. segment offset would require an instruction
460
- * parser). So only support physical addresses up to page granularity for now.
461
- */
462
- int mce_usable_address (struct mce * m )
456
+ bool mce_usable_address (struct mce * m )
463
457
{
464
458
if (!(m -> status & MCI_STATUS_ADDRV ))
465
- return 0 ;
459
+ return false ;
466
460
467
- if (m -> cpuvendor == X86_VENDOR_AMD )
461
+ switch (m -> cpuvendor ) {
462
+ case X86_VENDOR_AMD :
468
463
return amd_mce_usable_address (m );
469
464
470
- /* Checks after this one are Intel/Zhaoxin-specific: */
471
- if (boot_cpu_data .x86_vendor != X86_VENDOR_INTEL &&
472
- boot_cpu_data .x86_vendor != X86_VENDOR_ZHAOXIN )
473
- return 1 ;
474
-
475
- if (!(m -> status & MCI_STATUS_MISCV ))
476
- return 0 ;
477
-
478
- if (MCI_MISC_ADDR_LSB (m -> misc ) > PAGE_SHIFT )
479
- return 0 ;
480
-
481
- if (MCI_MISC_ADDR_MODE (m -> misc ) != MCI_MISC_ADDR_PHYS )
482
- return 0 ;
465
+ case X86_VENDOR_INTEL :
466
+ case X86_VENDOR_ZHAOXIN :
467
+ return intel_mce_usable_address (m );
483
468
484
- return 1 ;
469
+ default :
470
+ return true;
471
+ }
485
472
}
486
473
EXPORT_SYMBOL_GPL (mce_usable_address );
487
474
Original file line number Diff line number Diff line change @@ -536,3 +536,23 @@ bool intel_filter_mce(struct mce *m)
536
536
537
537
return false;
538
538
}
539
+
540
+ /*
541
+ * Check if the address reported by the CPU is in a format we can parse.
542
+ * It would be possible to add code for most other cases, but all would
543
+ * be somewhat complicated (e.g. segment offset would require an instruction
544
+ * parser). So only support physical addresses up to page granularity for now.
545
+ */
546
+ bool intel_mce_usable_address (struct mce * m )
547
+ {
548
+ if (!(m -> status & MCI_STATUS_MISCV ))
549
+ return false;
550
+
551
+ if (MCI_MISC_ADDR_LSB (m -> misc ) > PAGE_SHIFT )
552
+ return false;
553
+
554
+ if (MCI_MISC_ADDR_MODE (m -> misc ) != MCI_MISC_ADDR_PHYS )
555
+ return false;
556
+
557
+ return true;
558
+ }
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ void intel_init_cmci(void);
49
49
void intel_init_lmce (void );
50
50
void intel_clear_lmce (void );
51
51
bool intel_filter_mce (struct mce * m );
52
+ bool intel_mce_usable_address (struct mce * m );
52
53
#else
53
54
# define cmci_intel_adjust_timer mce_adjust_timer_default
54
55
static inline bool mce_intel_cmci_poll (void ) { return false; }
@@ -58,6 +59,7 @@ static inline void intel_init_cmci(void) { }
58
59
static inline void intel_init_lmce (void ) { }
59
60
static inline void intel_clear_lmce (void ) { }
60
61
static inline bool intel_filter_mce (struct mce * m ) { return false; }
62
+ static inline bool intel_mce_usable_address (struct mce * m ) { return false; }
61
63
#endif
62
64
63
65
void mce_timer_kick (unsigned long interval );
You can’t perform that action at this time.
0 commit comments