aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Petkov <bp@alien8.de>2012-10-15 14:25:17 -0400
committerBorislav Petkov <bp@alien8.de>2012-10-26 08:37:57 -0400
commit7af19e4afdafa4adb5fffc569d5bb1c5e568ba98 (patch)
treedd8734d0170efa1e805c19cdd4b7fdb3096635f4
parent84c2559dee2d69606f1fd4ce6563e79e7611a7b7 (diff)
x86, MCA: Convert the next three variables batch
Move them into the mca_config struct and adjust code touching them accordingly. Signed-off-by: Borislav Petkov <bp@alien8.de> Acked-by: Tony Luck <tony.luck@intel.com>
-rw-r--r--arch/x86/include/asm/mce.h6
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c35
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c2
3 files changed, 21 insertions, 22 deletions
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 73ba1853951a..a711e3f4fbc7 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -122,13 +122,17 @@ struct mce_log {
122 122
123struct mca_config { 123struct mca_config {
124 bool dont_log_ce; 124 bool dont_log_ce;
125 bool cmci_disabled;
126 bool ignore_ce;
125 u8 banks; 127 u8 banks;
126 s8 bootlog; 128 s8 bootlog;
127 int tolerant; 129 int tolerant;
128 int monarch_timeout; 130 int monarch_timeout;
131 int panic_timeout;
129 u32 rip_msr; 132 u32 rip_msr;
130}; 133};
131 134
135extern struct mca_config mca_cfg;
132extern void mce_register_decode_chain(struct notifier_block *nb); 136extern void mce_register_decode_chain(struct notifier_block *nb);
133extern void mce_unregister_decode_chain(struct notifier_block *nb); 137extern void mce_unregister_decode_chain(struct notifier_block *nb);
134 138
@@ -169,8 +173,6 @@ DECLARE_PER_CPU(struct device *, mce_device);
169#define MAX_NR_BANKS 32 173#define MAX_NR_BANKS 32
170 174
171#ifdef CONFIG_X86_MCE_INTEL 175#ifdef CONFIG_X86_MCE_INTEL
172extern int mce_cmci_disabled;
173extern int mce_ignore_ce;
174extern int mce_bios_cmci_threshold; 176extern int mce_bios_cmci_threshold;
175void mce_intel_feature_init(struct cpuinfo_x86 *c); 177void mce_intel_feature_init(struct cpuinfo_x86 *c);
176void cmci_clear(void); 178void cmci_clear(void);
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index aa11019eeb0e..8c7a90d89852 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -66,9 +66,6 @@ atomic_t mce_entry;
66 66
67DEFINE_PER_CPU(unsigned, mce_exception_count); 67DEFINE_PER_CPU(unsigned, mce_exception_count);
68 68
69static int mce_panic_timeout __read_mostly;
70int mce_cmci_disabled __read_mostly;
71int mce_ignore_ce __read_mostly;
72int mce_ser __read_mostly; 69int mce_ser __read_mostly;
73int mce_bios_cmci_threshold __read_mostly; 70int mce_bios_cmci_threshold __read_mostly;
74 71
@@ -302,7 +299,7 @@ static void wait_for_panic(void)
302 while (timeout-- > 0) 299 while (timeout-- > 0)
303 udelay(1); 300 udelay(1);
304 if (panic_timeout == 0) 301 if (panic_timeout == 0)
305 panic_timeout = mce_panic_timeout; 302 panic_timeout = mca_cfg.panic_timeout;
306 panic("Panicing machine check CPU died"); 303 panic("Panicing machine check CPU died");
307} 304}
308 305
@@ -360,7 +357,7 @@ static void mce_panic(char *msg, struct mce *final, char *exp)
360 pr_emerg(HW_ERR "Machine check: %s\n", exp); 357 pr_emerg(HW_ERR "Machine check: %s\n", exp);
361 if (!fake_panic) { 358 if (!fake_panic) {
362 if (panic_timeout == 0) 359 if (panic_timeout == 0)
363 panic_timeout = mce_panic_timeout; 360 panic_timeout = mca_cfg.panic_timeout;
364 panic(msg); 361 panic(msg);
365 } else 362 } else
366 pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg); 363 pr_emerg(HW_ERR "Fake kernel panic: %s\n", msg);
@@ -1600,7 +1597,7 @@ static int __cpuinit __mcheck_cpu_apply_quirks(struct cpuinfo_x86 *c)
1600 if (cfg->monarch_timeout < 0) 1597 if (cfg->monarch_timeout < 0)
1601 cfg->monarch_timeout = 0; 1598 cfg->monarch_timeout = 0;
1602 if (cfg->bootlog != 0) 1599 if (cfg->bootlog != 0)
1603 mce_panic_timeout = 30; 1600 cfg->panic_timeout = 30;
1604 1601
1605 return 0; 1602 return 0;
1606} 1603}
@@ -1645,7 +1642,7 @@ static void mce_start_timer(unsigned int cpu, struct timer_list *t)
1645 1642
1646 __this_cpu_write(mce_next_interval, iv); 1643 __this_cpu_write(mce_next_interval, iv);
1647 1644
1648 if (mce_ignore_ce || !iv) 1645 if (mca_cfg.ignore_ce || !iv)
1649 return; 1646 return;
1650 1647
1651 t->expires = round_jiffies(jiffies + iv); 1648 t->expires = round_jiffies(jiffies + iv);
@@ -1972,11 +1969,11 @@ static int __init mcheck_enable(char *str)
1972 if (!strcmp(str, "off")) 1969 if (!strcmp(str, "off"))
1973 mce_disabled = 1; 1970 mce_disabled = 1;
1974 else if (!strcmp(str, "no_cmci")) 1971 else if (!strcmp(str, "no_cmci"))
1975 mce_cmci_disabled = 1; 1972 cfg->cmci_disabled = true;
1976 else if (!strcmp(str, "dont_log_ce")) 1973 else if (!strcmp(str, "dont_log_ce"))
1977 cfg->dont_log_ce = true; 1974 cfg->dont_log_ce = true;
1978 else if (!strcmp(str, "ignore_ce")) 1975 else if (!strcmp(str, "ignore_ce"))
1979 mce_ignore_ce = 1; 1976 cfg->ignore_ce = true;
1980 else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog")) 1977 else if (!strcmp(str, "bootlog") || !strcmp(str, "nobootlog"))
1981 cfg->bootlog = (str[0] == 'b'); 1978 cfg->bootlog = (str[0] == 'b');
1982 else if (!strcmp(str, "bios_cmci_threshold")) 1979 else if (!strcmp(str, "bios_cmci_threshold"))
@@ -2154,15 +2151,15 @@ static ssize_t set_ignore_ce(struct device *s,
2154 if (strict_strtoull(buf, 0, &new) < 0) 2151 if (strict_strtoull(buf, 0, &new) < 0)
2155 return -EINVAL; 2152 return -EINVAL;
2156 2153
2157 if (mce_ignore_ce ^ !!new) { 2154 if (mca_cfg.ignore_ce ^ !!new) {
2158 if (new) { 2155 if (new) {
2159 /* disable ce features */ 2156 /* disable ce features */
2160 mce_timer_delete_all(); 2157 mce_timer_delete_all();
2161 on_each_cpu(mce_disable_cmci, NULL, 1); 2158 on_each_cpu(mce_disable_cmci, NULL, 1);
2162 mce_ignore_ce = 1; 2159 mca_cfg.ignore_ce = true;
2163 } else { 2160 } else {
2164 /* enable ce features */ 2161 /* enable ce features */
2165 mce_ignore_ce = 0; 2162 mca_cfg.ignore_ce = false;
2166 on_each_cpu(mce_enable_ce, (void *)1, 1); 2163 on_each_cpu(mce_enable_ce, (void *)1, 1);
2167 } 2164 }
2168 } 2165 }
@@ -2178,14 +2175,14 @@ static ssize_t set_cmci_disabled(struct device *s,
2178 if (strict_strtoull(buf, 0, &new) < 0) 2175 if (strict_strtoull(buf, 0, &new) < 0)
2179 return -EINVAL; 2176 return -EINVAL;
2180 2177
2181 if (mce_cmci_disabled ^ !!new) { 2178 if (mca_cfg.cmci_disabled ^ !!new) {
2182 if (new) { 2179 if (new) {
2183 /* disable cmci */ 2180 /* disable cmci */
2184 on_each_cpu(mce_disable_cmci, NULL, 1); 2181 on_each_cpu(mce_disable_cmci, NULL, 1);
2185 mce_cmci_disabled = 1; 2182 mca_cfg.cmci_disabled = true;
2186 } else { 2183 } else {
2187 /* enable cmci */ 2184 /* enable cmci */
2188 mce_cmci_disabled = 0; 2185 mca_cfg.cmci_disabled = false;
2189 on_each_cpu(mce_enable_ce, NULL, 1); 2186 on_each_cpu(mce_enable_ce, NULL, 1);
2190 } 2187 }
2191 } 2188 }
@@ -2212,13 +2209,13 @@ static struct dev_ext_attribute dev_attr_check_interval = {
2212}; 2209};
2213 2210
2214static struct dev_ext_attribute dev_attr_ignore_ce = { 2211static struct dev_ext_attribute dev_attr_ignore_ce = {
2215 __ATTR(ignore_ce, 0644, device_show_int, set_ignore_ce), 2212 __ATTR(ignore_ce, 0644, device_show_bool, set_ignore_ce),
2216 &mce_ignore_ce 2213 &mca_cfg.ignore_ce
2217}; 2214};
2218 2215
2219static struct dev_ext_attribute dev_attr_cmci_disabled = { 2216static struct dev_ext_attribute dev_attr_cmci_disabled = {
2220 __ATTR(cmci_disabled, 0644, device_show_int, set_cmci_disabled), 2217 __ATTR(cmci_disabled, 0644, device_show_bool, set_cmci_disabled),
2221 &mce_cmci_disabled 2218 &mca_cfg.cmci_disabled
2222}; 2219};
2223 2220
2224static struct device_attribute *mce_device_attrs[] = { 2221static struct device_attribute *mce_device_attrs[] = {
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 5f88abf07e9c..1acd8ecba1c3 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -53,7 +53,7 @@ static int cmci_supported(int *banks)
53{ 53{
54 u64 cap; 54 u64 cap;
55 55
56 if (mce_cmci_disabled || mce_ignore_ce) 56 if (mca_cfg.cmci_disabled || mca_cfg.ignore_ce)
57 return 0; 57 return 0;
58 58
59 /* 59 /*