Commit 003db633 authored by Ingo Molnar's avatar Ingo Molnar

Merge tag 'mca_cfg' of git://git.kernel.org/pub/scm/linux/kernel/git/ras/ras into x86/ras

Pull x86 RAS changes from Borislav Petkov:

 "Rework all config variables used throughout the MCA code and collect
  them together into a mca_config struct. This keeps them tightly and
  neatly packed together instead of spilled all over the place.

  Then, convert those which are used as booleans into real booleans and
  save some space."
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parents 2ab3f29d 1462594b
...@@ -119,6 +119,23 @@ struct mce_log { ...@@ -119,6 +119,23 @@ struct mce_log {
#define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1) #define K8_MCE_THRESHOLD_BASE (MCE_EXTENDED_BANK + 1)
#ifdef __KERNEL__ #ifdef __KERNEL__
struct mca_config {
bool dont_log_ce;
bool cmci_disabled;
bool ignore_ce;
bool disabled;
bool ser;
bool bios_cmci_threshold;
u8 banks;
s8 bootlog;
int tolerant;
int monarch_timeout;
int panic_timeout;
u32 rip_msr;
};
extern struct mca_config mca_cfg;
extern void mce_register_decode_chain(struct notifier_block *nb); extern void mce_register_decode_chain(struct notifier_block *nb);
extern void mce_unregister_decode_chain(struct notifier_block *nb); extern void mce_unregister_decode_chain(struct notifier_block *nb);
...@@ -126,7 +143,6 @@ extern void mce_unregister_decode_chain(struct notifier_block *nb); ...@@ -126,7 +143,6 @@ extern void mce_unregister_decode_chain(struct notifier_block *nb);
#include <linux/init.h> #include <linux/init.h>
#include <linux/atomic.h> #include <linux/atomic.h>
extern int mce_disabled;
extern int mce_p5_enabled; extern int mce_p5_enabled;
#ifdef CONFIG_X86_MCE #ifdef CONFIG_X86_MCE
...@@ -159,9 +175,6 @@ DECLARE_PER_CPU(struct device *, mce_device); ...@@ -159,9 +175,6 @@ DECLARE_PER_CPU(struct device *, mce_device);
#define MAX_NR_BANKS 32 #define MAX_NR_BANKS 32
#ifdef CONFIG_X86_MCE_INTEL #ifdef CONFIG_X86_MCE_INTEL
extern int mce_cmci_disabled;
extern int mce_ignore_ce;
extern int mce_bios_cmci_threshold;
void mce_intel_feature_init(struct cpuinfo_x86 *c); void mce_intel_feature_init(struct cpuinfo_x86 *c);
void cmci_clear(void); void cmci_clear(void);
void cmci_reenable(void); void cmci_reenable(void);
......
...@@ -24,8 +24,6 @@ struct mce_bank { ...@@ -24,8 +24,6 @@ struct mce_bank {
int mce_severity(struct mce *a, int tolerant, char **msg); int mce_severity(struct mce *a, int tolerant, char **msg);
struct dentry *mce_get_debugfs_dir(void); struct dentry *mce_get_debugfs_dir(void);
extern int mce_ser;
extern struct mce_bank *mce_banks; extern struct mce_bank *mce_banks;
#ifdef CONFIG_X86_MCE_INTEL #ifdef CONFIG_X86_MCE_INTEL
......
...@@ -193,9 +193,9 @@ int mce_severity(struct mce *m, int tolerant, char **msg) ...@@ -193,9 +193,9 @@ int mce_severity(struct mce *m, int tolerant, char **msg)
continue; continue;
if ((m->mcgstatus & s->mcgmask) != s->mcgres) if ((m->mcgstatus & s->mcgmask) != s->mcgres)
continue; continue;
if (s->ser == SER_REQUIRED && !mce_ser) if (s->ser == SER_REQUIRED && !mca_cfg.ser)
continue; continue;
if (s->ser == NO_SER && mce_ser) if (s->ser == NO_SER && mca_cfg.ser)
continue; continue;
if (s->context && ctx != s->context) if (s->context && ctx != s->context)
continue; continue;
......
This diff is collapsed.
...@@ -53,7 +53,7 @@ static int cmci_supported(int *banks) ...@@ -53,7 +53,7 @@ static int cmci_supported(int *banks)
{ {
u64 cap; u64 cap;
if (mce_cmci_disabled || mce_ignore_ce) if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce)
return 0; return 0;
/* /*
...@@ -200,7 +200,7 @@ static void cmci_discover(int banks) ...@@ -200,7 +200,7 @@ static void cmci_discover(int banks)
continue; continue;
} }
if (!mce_bios_cmci_threshold) { if (!mca_cfg.bios_cmci_threshold) {
val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK; val &= ~MCI_CTL2_CMCI_THRESHOLD_MASK;
val |= CMCI_THRESHOLD; val |= CMCI_THRESHOLD;
} else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) { } else if (!(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) {
...@@ -227,7 +227,7 @@ static void cmci_discover(int banks) ...@@ -227,7 +227,7 @@ static void cmci_discover(int banks)
* set the thresholds properly or does not work with * set the thresholds properly or does not work with
* this boot option. Note down now and report later. * this boot option. Note down now and report later.
*/ */
if (mce_bios_cmci_threshold && bios_zero_thresh && if (mca_cfg.bios_cmci_threshold && bios_zero_thresh &&
(val & MCI_CTL2_CMCI_THRESHOLD_MASK)) (val & MCI_CTL2_CMCI_THRESHOLD_MASK))
bios_wrong_thresh = 1; bios_wrong_thresh = 1;
} else { } else {
...@@ -235,7 +235,7 @@ static void cmci_discover(int banks) ...@@ -235,7 +235,7 @@ static void cmci_discover(int banks)
} }
} }
raw_spin_unlock_irqrestore(&cmci_discover_lock, flags); raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
if (mce_bios_cmci_threshold && bios_wrong_thresh) { if (mca_cfg.bios_cmci_threshold && bios_wrong_thresh) {
pr_info_once( pr_info_once(
"bios_cmci_threshold: Some banks do not have valid thresholds set\n"); "bios_cmci_threshold: Some banks do not have valid thresholds set\n");
pr_info_once( pr_info_once(
......
...@@ -1412,7 +1412,7 @@ __init void lguest_init(void) ...@@ -1412,7 +1412,7 @@ __init void lguest_init(void)
/* We don't have features. We have puppies! Puppies! */ /* We don't have features. We have puppies! Puppies! */
#ifdef CONFIG_X86_MCE #ifdef CONFIG_X86_MCE
mce_disabled = 1; mca_cfg.disabled = true;
#endif #endif
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
acpi_disabled = 1; acpi_disabled = 1;
......
...@@ -171,6 +171,27 @@ ssize_t device_show_int(struct device *dev, ...@@ -171,6 +171,27 @@ ssize_t device_show_int(struct device *dev,
} }
EXPORT_SYMBOL_GPL(device_show_int); EXPORT_SYMBOL_GPL(device_show_int);
ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
const char *buf, size_t size)
{
struct dev_ext_attribute *ea = to_ext_attr(attr);
if (strtobool(buf, ea->var) < 0)
return -EINVAL;
return size;
}
EXPORT_SYMBOL_GPL(device_store_bool);
ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct dev_ext_attribute *ea = to_ext_attr(attr);
return snprintf(buf, PAGE_SIZE, "%d\n", *(bool *)(ea->var));
}
EXPORT_SYMBOL_GPL(device_show_bool);
/** /**
* device_release - free device structure. * device_release - free device structure.
* @kobj: device's kobject. * @kobj: device's kobject.
......
...@@ -496,6 +496,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr, ...@@ -496,6 +496,10 @@ ssize_t device_show_int(struct device *dev, struct device_attribute *attr,
char *buf); char *buf);
ssize_t device_store_int(struct device *dev, struct device_attribute *attr, ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count); const char *buf, size_t count);
ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
char *buf);
ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count);
#define DEVICE_ATTR(_name, _mode, _show, _store) \ #define DEVICE_ATTR(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
...@@ -505,6 +509,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr, ...@@ -505,6 +509,9 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr,
#define DEVICE_INT_ATTR(_name, _mode, _var) \ #define DEVICE_INT_ATTR(_name, _mode, _var) \
struct dev_ext_attribute dev_attr_##_name = \ struct dev_ext_attribute dev_attr_##_name = \
{ __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
#define DEVICE_BOOL_ATTR(_name, _mode, _var) \
struct dev_ext_attribute dev_attr_##_name = \
{ __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
#define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
struct device_attribute dev_attr_##_name = \ struct device_attribute dev_attr_##_name = \
__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment