File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ static inline void cmci_recheck(void) {}
245245int mce_available (struct cpuinfo_x86 * c );
246246bool mce_is_memory_error (struct mce * m );
247247bool mce_is_correctable (struct mce * m );
248- int mce_usable_address (struct mce * m );
248+ bool mce_usable_address (struct mce * m );
249249
250250DECLARE_PER_CPU (unsigned , mce_exception_count );
251251DECLARE_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)
453453 mce_schedule_work ();
454454}
455455
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 )
463457{
464458 if (!(m -> status & MCI_STATUS_ADDRV ))
465- return 0 ;
459+ return false ;
466460
467- if (m -> cpuvendor == X86_VENDOR_AMD )
461+ switch (m -> cpuvendor ) {
462+ case X86_VENDOR_AMD :
468463 return amd_mce_usable_address (m );
469464
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 );
483468
484- return 1 ;
469+ default :
470+ return true;
471+ }
485472}
486473EXPORT_SYMBOL_GPL (mce_usable_address );
487474
Original file line number Diff line number Diff line change @@ -536,3 +536,23 @@ bool intel_filter_mce(struct mce *m)
536536
537537 return false;
538538}
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);
4949void intel_init_lmce (void );
5050void intel_clear_lmce (void );
5151bool intel_filter_mce (struct mce * m );
52+ bool intel_mce_usable_address (struct mce * m );
5253#else
5354# define cmci_intel_adjust_timer mce_adjust_timer_default
5455static inline bool mce_intel_cmci_poll (void ) { return false; }
@@ -58,6 +59,7 @@ static inline void intel_init_cmci(void) { }
5859static inline void intel_init_lmce (void ) { }
5960static inline void intel_clear_lmce (void ) { }
6061static inline bool intel_filter_mce (struct mce * m ) { return false; }
62+ static inline bool intel_mce_usable_address (struct mce * m ) { return false; }
6163#endif
6264
6365void mce_timer_kick (unsigned long interval );
You can’t perform that action at this time.
0 commit comments