aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-23 08:46:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-23 08:46:36 -0400
commit0d1b82cd8ac2e8856ae9045c97782ac1c359929c (patch)
treec96759ae13f5c0338db5f7b6c9c4401c359240c6
parentc05f3642f4304dd081876e77a68555b6aba4483f (diff)
parent711f76a328cbe5b49164bb14bcb593fa52102051 (diff)
Merge branch 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull RAS updates from Ingo Molnar: "Misc smaller fixes and cleanups" * 'ras-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/mcelog: Remove one mce_helper definition x86/mce: Add macros for the corrected error count bit field x86/mce: Use BIT_ULL(x) for bit mask definitions x86/mce-inject: Reset injection struct after injection
-rw-r--r--arch/x86/include/asm/mce.h53
-rw-r--r--arch/x86/kernel/cpu/mcheck/dev-mcelog.c3
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-inject.c6
3 files changed, 34 insertions, 28 deletions
diff --git a/arch/x86/include/asm/mce.h b/arch/x86/include/asm/mce.h
index 3a17107594c8..97d6969f9a8a 100644
--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -10,41 +10,44 @@
10 10
11/* MCG_CAP register defines */ 11/* MCG_CAP register defines */
12#define MCG_BANKCNT_MASK 0xff /* Number of Banks */ 12#define MCG_BANKCNT_MASK 0xff /* Number of Banks */
13#define MCG_CTL_P (1ULL<<8) /* MCG_CTL register available */ 13#define MCG_CTL_P BIT_ULL(8) /* MCG_CTL register available */
14#define MCG_EXT_P (1ULL<<9) /* Extended registers available */ 14#define MCG_EXT_P BIT_ULL(9) /* Extended registers available */
15#define MCG_CMCI_P (1ULL<<10) /* CMCI supported */ 15#define MCG_CMCI_P BIT_ULL(10) /* CMCI supported */
16#define MCG_EXT_CNT_MASK 0xff0000 /* Number of Extended registers */ 16#define MCG_EXT_CNT_MASK 0xff0000 /* Number of Extended registers */
17#define MCG_EXT_CNT_SHIFT 16 17#define MCG_EXT_CNT_SHIFT 16
18#define MCG_EXT_CNT(c) (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT) 18#define MCG_EXT_CNT(c) (((c) & MCG_EXT_CNT_MASK) >> MCG_EXT_CNT_SHIFT)
19#define MCG_SER_P (1ULL<<24) /* MCA recovery/new status bits */ 19#define MCG_SER_P BIT_ULL(24) /* MCA recovery/new status bits */
20#define MCG_ELOG_P (1ULL<<26) /* Extended error log supported */ 20#define MCG_ELOG_P BIT_ULL(26) /* Extended error log supported */
21#define MCG_LMCE_P (1ULL<<27) /* Local machine check supported */ 21#define MCG_LMCE_P BIT_ULL(27) /* Local machine check supported */
22 22
23/* MCG_STATUS register defines */ 23/* MCG_STATUS register defines */
24#define MCG_STATUS_RIPV (1ULL<<0) /* restart ip valid */ 24#define MCG_STATUS_RIPV BIT_ULL(0) /* restart ip valid */
25#define MCG_STATUS_EIPV (1ULL<<1) /* ip points to correct instruction */ 25#define MCG_STATUS_EIPV BIT_ULL(1) /* ip points to correct instruction */
26#define MCG_STATUS_MCIP (1ULL<<2) /* machine check in progress */ 26#define MCG_STATUS_MCIP BIT_ULL(2) /* machine check in progress */
27#define MCG_STATUS_LMCES (1ULL<<3) /* LMCE signaled */ 27#define MCG_STATUS_LMCES BIT_ULL(3) /* LMCE signaled */
28 28
29/* MCG_EXT_CTL register defines */ 29/* MCG_EXT_CTL register defines */
30#define MCG_EXT_CTL_LMCE_EN (1ULL<<0) /* Enable LMCE */ 30#define MCG_EXT_CTL_LMCE_EN BIT_ULL(0) /* Enable LMCE */
31 31
32/* MCi_STATUS register defines */ 32/* MCi_STATUS register defines */
33#define MCI_STATUS_VAL (1ULL<<63) /* valid error */ 33#define MCI_STATUS_VAL BIT_ULL(63) /* valid error */
34#define MCI_STATUS_OVER (1ULL<<62) /* previous errors lost */ 34#define MCI_STATUS_OVER BIT_ULL(62) /* previous errors lost */
35#define MCI_STATUS_UC (1ULL<<61) /* uncorrected error */ 35#define MCI_STATUS_UC BIT_ULL(61) /* uncorrected error */
36#define MCI_STATUS_EN (1ULL<<60) /* error enabled */ 36#define MCI_STATUS_EN BIT_ULL(60) /* error enabled */
37#define MCI_STATUS_MISCV (1ULL<<59) /* misc error reg. valid */ 37#define MCI_STATUS_MISCV BIT_ULL(59) /* misc error reg. valid */
38#define MCI_STATUS_ADDRV (1ULL<<58) /* addr reg. valid */ 38#define MCI_STATUS_ADDRV BIT_ULL(58) /* addr reg. valid */
39#define MCI_STATUS_PCC (1ULL<<57) /* processor context corrupt */ 39#define MCI_STATUS_PCC BIT_ULL(57) /* processor context corrupt */
40#define MCI_STATUS_S (1ULL<<56) /* Signaled machine check */ 40#define MCI_STATUS_S BIT_ULL(56) /* Signaled machine check */
41#define MCI_STATUS_AR (1ULL<<55) /* Action required */ 41#define MCI_STATUS_AR BIT_ULL(55) /* Action required */
42#define MCI_STATUS_CEC_SHIFT 38 /* Corrected Error Count */
43#define MCI_STATUS_CEC_MASK GENMASK_ULL(52,38)
44#define MCI_STATUS_CEC(c) (((c) & MCI_STATUS_CEC_MASK) >> MCI_STATUS_CEC_SHIFT)
42 45
43/* AMD-specific bits */ 46/* AMD-specific bits */
44#define MCI_STATUS_TCC (1ULL<<55) /* Task context corrupt */ 47#define MCI_STATUS_TCC BIT_ULL(55) /* Task context corrupt */
45#define MCI_STATUS_SYNDV (1ULL<<53) /* synd reg. valid */ 48#define MCI_STATUS_SYNDV BIT_ULL(53) /* synd reg. valid */
46#define MCI_STATUS_DEFERRED (1ULL<<44) /* uncorrected error, deferred exception */ 49#define MCI_STATUS_DEFERRED BIT_ULL(44) /* uncorrected error, deferred exception */
47#define MCI_STATUS_POISON (1ULL<<43) /* access poisonous data */ 50#define MCI_STATUS_POISON BIT_ULL(43) /* access poisonous data */
48 51
49/* 52/*
50 * McaX field if set indicates a given bank supports MCA extensions: 53 * McaX field if set indicates a given bank supports MCA extensions:
@@ -84,7 +87,7 @@
84#define MCI_MISC_ADDR_GENERIC 7 /* generic */ 87#define MCI_MISC_ADDR_GENERIC 7 /* generic */
85 88
86/* CTL2 register defines */ 89/* CTL2 register defines */
87#define MCI_CTL2_CMCI_EN (1ULL << 30) 90#define MCI_CTL2_CMCI_EN BIT_ULL(30)
88#define MCI_CTL2_CMCI_THRESHOLD_MASK 0x7fffULL 91#define MCI_CTL2_CMCI_THRESHOLD_MASK 0x7fffULL
89 92
90#define MCJ_CTX_MASK 3 93#define MCJ_CTX_MASK 3
diff --git a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
index 97685a0c3175..27f394ac983f 100644
--- a/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
+++ b/arch/x86/kernel/cpu/mcheck/dev-mcelog.c
@@ -38,9 +38,6 @@ static struct mce_log_buffer mcelog = {
38 38
39static DECLARE_WAIT_QUEUE_HEAD(mce_chrdev_wait); 39static DECLARE_WAIT_QUEUE_HEAD(mce_chrdev_wait);
40 40
41/* User mode helper program triggered by machine check event */
42extern char mce_helper[128];
43
44static int dev_mce_log(struct notifier_block *nb, unsigned long val, 41static int dev_mce_log(struct notifier_block *nb, unsigned long val,
45 void *data) 42 void *data)
46{ 43{
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index c805a06e14c3..1fc424c40a31 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -108,6 +108,9 @@ static void setup_inj_struct(struct mce *m)
108 memset(m, 0, sizeof(struct mce)); 108 memset(m, 0, sizeof(struct mce));
109 109
110 m->cpuvendor = boot_cpu_data.x86_vendor; 110 m->cpuvendor = boot_cpu_data.x86_vendor;
111 m->time = ktime_get_real_seconds();
112 m->cpuid = cpuid_eax(1);
113 m->microcode = boot_cpu_data.microcode;
111} 114}
112 115
113/* Update fake mce registers on current CPU. */ 116/* Update fake mce registers on current CPU. */
@@ -576,6 +579,9 @@ static int inj_bank_set(void *data, u64 val)
576 m->bank = val; 579 m->bank = val;
577 do_inject(); 580 do_inject();
578 581
582 /* Reset injection struct */
583 setup_inj_struct(&i_mce);
584
579 return 0; 585 return 0;
580} 586}
581 587