Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, mce, severity: Cleanup severity table

The current format of an item in this table is:
condition(param, ..., level, message [, condition2 ...])

So we have to check both an item's head and tail to find the conditions
which match the item.

Format them in a more straight forward manner:
item(level, message, condition [, condition2 ...])

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Acked-by: Tony Luck <tony.luck@intel.com>
Link: http://lkml.kernel.org/r/4DEED61F.5010502@jp.fujitsu.com
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>

authored by

Hidetoshi Seto and committed by
Borislav Petkov
a17957cd 901d7691

+61 -72
+61 -72
arch/x86/kernel/cpu/mcheck/mce-severity.c
··· 43 43 unsigned char covered; 44 44 char *msg; 45 45 } severities[] = { 46 - #define KERNEL .context = IN_KERNEL 47 - #define USER .context = IN_USER 48 - #define SER .ser = SER_REQUIRED 49 - #define NOSER .ser = NO_SER 50 - #define SEV(s) .sev = MCE_ ## s ## _SEVERITY 51 - #define BITCLR(x, s, m, r...) { .mask = x, .result = 0, SEV(s), .msg = m, ## r } 52 - #define BITSET(x, s, m, r...) { .mask = x, .result = x, SEV(s), .msg = m, ## r } 53 - #define MCGMASK(x, res, s, m, r...) \ 54 - { .mcgmask = x, .mcgres = res, SEV(s), .msg = m, ## r } 55 - #define MASK(x, y, s, m, r...) \ 56 - { .mask = x, .result = y, SEV(s), .msg = m, ## r } 46 + #define MCESEV(s, m, c...) { .sev = MCE_ ## s ## _SEVERITY, .msg = m, ## c } 47 + #define KERNEL .context = IN_KERNEL 48 + #define USER .context = IN_USER 49 + #define SER .ser = SER_REQUIRED 50 + #define NOSER .ser = NO_SER 51 + #define BITCLR(x) .mask = x, .result = 0 52 + #define BITSET(x) .mask = x, .result = x 53 + #define MCGMASK(x, y) .mcgmask = x, .mcgres = y 54 + #define MASK(x, y) .mask = x, .result = y 57 55 #define MCI_UC_S (MCI_STATUS_UC|MCI_STATUS_S) 58 56 #define MCI_UC_SAR (MCI_STATUS_UC|MCI_STATUS_S|MCI_STATUS_AR) 59 57 #define MCACOD 0xffff 60 58 61 - BITCLR( 62 - MCI_STATUS_VAL, 63 - NO, "Invalid" 59 + MCESEV( 60 + NO, "Invalid", 61 + BITCLR(MCI_STATUS_VAL) 64 62 ), 65 - BITCLR( 66 - MCI_STATUS_EN, 67 - NO, "Not enabled" 63 + MCESEV( 64 + NO, "Not enabled", 65 + BITCLR(MCI_STATUS_EN) 68 66 ), 69 - BITSET( 70 - MCI_STATUS_PCC, 71 - PANIC, "Processor context corrupt" 67 + MCESEV( 68 + PANIC, "Processor context corrupt", 69 + BITSET(MCI_STATUS_PCC) 72 70 ), 73 71 /* When MCIP is not set something is very confused */ 74 - MCGMASK( 75 - MCG_STATUS_MCIP, 0, 76 - PANIC, "MCIP not set in MCA handler" 72 + MCESEV( 73 + PANIC, "MCIP not set in MCA handler", 74 + MCGMASK(MCG_STATUS_MCIP, 0) 77 75 ), 78 76 /* Neither return not error IP -- no chance to recover -> PANIC */ 79 - MCGMASK( 80 - MCG_STATUS_RIPV|MCG_STATUS_EIPV, 0, 81 - PANIC, "Neither restart nor error IP" 77 + MCESEV( 78 + PANIC, "Neither restart nor error IP", 79 + MCGMASK(MCG_STATUS_RIPV|MCG_STATUS_EIPV, 0) 82 80 ), 83 - MCGMASK( 84 - MCG_STATUS_RIPV, 0, 81 + MCESEV( 85 82 PANIC, "In kernel and no restart IP", 86 - KERNEL 83 + KERNEL, MCGMASK(MCG_STATUS_RIPV, 0) 87 84 ), 88 - BITCLR( 89 - MCI_STATUS_UC, 85 + MCESEV( 90 86 KEEP, "Corrected error", 91 - NOSER 87 + NOSER, BITCLR(MCI_STATUS_UC) 92 88 ), 93 89 94 90 /* ignore OVER for UCNA */ 95 - MASK( 96 - MCI_UC_SAR, MCI_STATUS_UC, 91 + MCESEV( 97 92 KEEP, "Uncorrected no action required", 98 - SER 93 + SER, MASK(MCI_UC_SAR, MCI_STATUS_UC) 99 94 ), 100 - MASK( 101 - MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_UC|MCI_STATUS_AR, 95 + MCESEV( 102 96 PANIC, "Illegal combination (UCNA with AR=1)", 103 - SER 97 + SER, 98 + MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_UC|MCI_STATUS_AR) 104 99 ), 105 - MASK( 106 - MCI_STATUS_S, 0, 100 + MCESEV( 107 101 KEEP, "Non signalled machine check", 108 - SER 102 + SER, MASK(MCI_STATUS_S, 0) 109 103 ), 110 104 111 105 /* AR add known MCACODs here */ 112 - MASK( 113 - MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_OVER|MCI_UC_SAR, 106 + MCESEV( 114 107 PANIC, "Action required with lost events", 115 - SER 108 + SER, 109 + MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_STATUS_OVER|MCI_UC_SAR) 116 110 ), 117 - MASK( 118 - MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_SAR, 111 + MCESEV( 119 112 PANIC, "Action required; unknown MCACOD", 120 - SER 113 + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_SAR) 121 114 ), 122 115 123 116 /* known AO MCACODs: */ 124 - MASK( 125 - MCI_UC_SAR|MCI_STATUS_OVER|0xfff0, MCI_UC_S|0xc0, 117 + MCESEV( 126 118 AO, "Action optional: memory scrubbing error", 127 - SER 119 + SER, MASK(MCI_UC_SAR|MCI_STATUS_OVER|0xfff0, MCI_UC_S|0xc0) 128 120 ), 129 - MASK( 130 - MCI_UC_SAR|MCI_STATUS_OVER|MCACOD, MCI_UC_S|0x17a, 121 + MCESEV( 131 122 AO, "Action optional: last level cache writeback error", 132 - SER 123 + SER, MASK(MCI_UC_SAR|MCI_STATUS_OVER|MCACOD, MCI_UC_S|0x17a) 124 + ), 125 + MCESEV( 126 + SOME, "Action optional unknown MCACOD", 127 + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S) 128 + ), 129 + MCESEV( 130 + SOME, "Action optional with lost events", 131 + SER, MASK(MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S|MCI_STATUS_OVER) 133 132 ), 134 133 135 - MASK( 136 - MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S, 137 - SOME, "Action optional unknown MCACOD", 138 - SER 134 + MCESEV( 135 + PANIC, "Overflowed uncorrected", 136 + BITSET(MCI_STATUS_UC|MCI_STATUS_OVER) 139 137 ), 140 - MASK( 141 - MCI_STATUS_OVER|MCI_UC_SAR, MCI_UC_S|MCI_STATUS_OVER, 142 - SOME, "Action optional with lost events", 143 - SER 138 + MCESEV( 139 + UC, "Uncorrected", 140 + BITSET(MCI_STATUS_UC) 144 141 ), 145 - BITSET( 146 - MCI_STATUS_UC|MCI_STATUS_OVER, 147 - PANIC, "Overflowed uncorrected" 148 - ), 149 - BITSET( 150 - MCI_STATUS_UC, 151 - UC, "Uncorrected" 152 - ), 153 - BITSET( 154 - 0, 155 - SOME, "No match" 142 + MCESEV( 143 + SOME, "No match", 144 + BITSET(0) 156 145 ) /* always matches. keep at end */ 157 146 }; 158 147