Skip to content

Commit d5f5e49

Browse files
qzhuo2aegl
authored andcommitted
EDAC/i10nm: Print an extra register set of retry_rd_err_log
Sapphire Rapids server adds an extra register set for logging more retry_rd_err_log data. So add code to print the extra register set. Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com> Signed-off-by: Tony Luck <tony.luck@intel.com> Link: https://lore.kernel.org/all/20220722233338.341567-1-tony.luck@intel.com
1 parent acd4cf6 commit d5f5e49

File tree

2 files changed

+72
-11
lines changed

2 files changed

+72
-11
lines changed

drivers/edac/i10nm_base.c

Lines changed: 70 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,38 @@ static u32 offsets_scrub_spr_hbm0[] = {0x2860, 0x2854, 0x2b08, 0x2858, 0x2828,
8383
static u32 offsets_scrub_spr_hbm1[] = {0x2c60, 0x2c54, 0x2f08, 0x2c58, 0x2c28, 0x0fa8};
8484
static u32 offsets_demand_icx[] = {0x22e54, 0x22e60, 0x22e64, 0x22e58, 0x22e5c, 0x20ee0};
8585
static u32 offsets_demand_spr[] = {0x22e54, 0x22e60, 0x22f10, 0x22e58, 0x22e5c, 0x20ee0};
86+
static u32 offsets_demand2_spr[] = {0x22c70, 0x22d80, 0x22f18, 0x22d58, 0x22c64, 0x20f10};
8687
static u32 offsets_demand_spr_hbm0[] = {0x2a54, 0x2a60, 0x2b10, 0x2a58, 0x2a5c, 0x0ee0};
8788
static u32 offsets_demand_spr_hbm1[] = {0x2e54, 0x2e60, 0x2f10, 0x2e58, 0x2e5c, 0x0fb0};
8889

8990
static void __enable_retry_rd_err_log(struct skx_imc *imc, int chan, bool enable,
90-
u32 *offsets_scrub, u32 *offsets_demand)
91+
u32 *offsets_scrub, u32 *offsets_demand,
92+
u32 *offsets_demand2)
9193
{
92-
u32 s, d;
94+
u32 s, d, d2;
9395

9496
s = I10NM_GET_REG32(imc, chan, offsets_scrub[0]);
9597
d = I10NM_GET_REG32(imc, chan, offsets_demand[0]);
98+
if (offsets_demand2)
99+
d2 = I10NM_GET_REG32(imc, chan, offsets_demand2[0]);
96100

97101
if (enable) {
98102
/* Save default configurations */
99103
imc->chan[chan].retry_rd_err_log_s = s;
100104
imc->chan[chan].retry_rd_err_log_d = d;
105+
if (offsets_demand2)
106+
imc->chan[chan].retry_rd_err_log_d2 = d2;
101107

102108
s &= ~RETRY_RD_ERR_LOG_NOOVER_UC;
103109
s |= RETRY_RD_ERR_LOG_EN;
104110
d &= ~RETRY_RD_ERR_LOG_NOOVER_UC;
105111
d |= RETRY_RD_ERR_LOG_EN;
112+
113+
if (offsets_demand2) {
114+
d2 &= ~RETRY_RD_ERR_LOG_UC;
115+
d2 |= RETRY_RD_ERR_LOG_NOOVER;
116+
d2 |= RETRY_RD_ERR_LOG_EN;
117+
}
106118
} else {
107119
/* Restore default configurations */
108120
if (imc->chan[chan].retry_rd_err_log_s & RETRY_RD_ERR_LOG_UC)
@@ -117,10 +129,21 @@ static void __enable_retry_rd_err_log(struct skx_imc *imc, int chan, bool enable
117129
d |= RETRY_RD_ERR_LOG_NOOVER;
118130
if (!(imc->chan[chan].retry_rd_err_log_d & RETRY_RD_ERR_LOG_EN))
119131
d &= ~RETRY_RD_ERR_LOG_EN;
132+
133+
if (offsets_demand2) {
134+
if (imc->chan[chan].retry_rd_err_log_d2 & RETRY_RD_ERR_LOG_UC)
135+
d2 |= RETRY_RD_ERR_LOG_UC;
136+
if (!(imc->chan[chan].retry_rd_err_log_d2 & RETRY_RD_ERR_LOG_NOOVER))
137+
d2 &= ~RETRY_RD_ERR_LOG_NOOVER;
138+
if (!(imc->chan[chan].retry_rd_err_log_d2 & RETRY_RD_ERR_LOG_EN))
139+
d2 &= ~RETRY_RD_ERR_LOG_EN;
140+
}
120141
}
121142

122143
I10NM_SET_REG32(imc, chan, offsets_scrub[0], s);
123144
I10NM_SET_REG32(imc, chan, offsets_demand[0], d);
145+
if (offsets_demand2)
146+
I10NM_SET_REG32(imc, chan, offsets_demand2[0], d2);
124147
}
125148

126149
static void enable_retry_rd_err_log(bool enable)
@@ -141,14 +164,17 @@ static void enable_retry_rd_err_log(bool enable)
141164
if (imc->hbm_mc) {
142165
__enable_retry_rd_err_log(imc, j, enable,
143166
res_cfg->offsets_scrub_hbm0,
144-
res_cfg->offsets_demand_hbm0);
167+
res_cfg->offsets_demand_hbm0,
168+
NULL);
145169
__enable_retry_rd_err_log(imc, j, enable,
146170
res_cfg->offsets_scrub_hbm1,
147-
res_cfg->offsets_demand_hbm1);
171+
res_cfg->offsets_demand_hbm1,
172+
NULL);
148173
} else {
149174
__enable_retry_rd_err_log(imc, j, enable,
150175
res_cfg->offsets_scrub,
151-
res_cfg->offsets_demand);
176+
res_cfg->offsets_demand,
177+
res_cfg->offsets_demand2);
152178
}
153179
}
154180
}
@@ -160,7 +186,10 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
160186
struct skx_imc *imc = &res->dev->imc[res->imc];
161187
u32 log0, log1, log2, log3, log4;
162188
u32 corr0, corr1, corr2, corr3;
189+
u32 lxg0, lxg1, lxg3, lxg4;
190+
u32 *xffsets = NULL;
163191
u64 log2a, log5;
192+
u64 lxg2a, lxg5;
164193
u32 *offsets;
165194
int n, pch;
166195

@@ -177,8 +206,12 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
177206
offsets = scrub_err ? res_cfg->offsets_scrub_hbm0 :
178207
res_cfg->offsets_demand_hbm0;
179208
} else {
180-
offsets = scrub_err ? res_cfg->offsets_scrub :
181-
res_cfg->offsets_demand;
209+
if (scrub_err) {
210+
offsets = res_cfg->offsets_scrub;
211+
} else {
212+
offsets = res_cfg->offsets_demand;
213+
xffsets = res_cfg->offsets_demand2;
214+
}
182215
}
183216

184217
log0 = I10NM_GET_REG32(imc, res->channel, offsets[0]);
@@ -187,10 +220,28 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
187220
log4 = I10NM_GET_REG32(imc, res->channel, offsets[4]);
188221
log5 = I10NM_GET_REG64(imc, res->channel, offsets[5]);
189222

223+
if (xffsets) {
224+
lxg0 = I10NM_GET_REG32(imc, res->channel, xffsets[0]);
225+
lxg1 = I10NM_GET_REG32(imc, res->channel, xffsets[1]);
226+
lxg3 = I10NM_GET_REG32(imc, res->channel, xffsets[3]);
227+
lxg4 = I10NM_GET_REG32(imc, res->channel, xffsets[4]);
228+
lxg5 = I10NM_GET_REG64(imc, res->channel, xffsets[5]);
229+
}
230+
190231
if (res_cfg->type == SPR) {
191232
log2a = I10NM_GET_REG64(imc, res->channel, offsets[2]);
192-
n = snprintf(msg, len, " retry_rd_err_log[%.8x %.8x %.16llx %.8x %.8x %.16llx]",
233+
n = snprintf(msg, len, " retry_rd_err_log[%.8x %.8x %.16llx %.8x %.8x %.16llx",
193234
log0, log1, log2a, log3, log4, log5);
235+
236+
if (len - n > 0) {
237+
if (xffsets) {
238+
lxg2a = I10NM_GET_REG64(imc, res->channel, xffsets[2]);
239+
n += snprintf(msg + n, len - n, " %.8x %.8x %.16llx %.8x %.8x %.16llx]",
240+
lxg0, lxg1, lxg2a, lxg3, lxg4, lxg5);
241+
} else {
242+
n += snprintf(msg + n, len - n, "]");
243+
}
244+
}
194245
} else {
195246
log2 = I10NM_GET_REG32(imc, res->channel, offsets[2]);
196247
n = snprintf(msg, len, " retry_rd_err_log[%.8x %.8x %.8x %.8x %.8x %.16llx]",
@@ -225,9 +276,16 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
225276
corr3 & 0xffff, corr3 >> 16);
226277

227278
/* Clear status bits */
228-
if (retry_rd_err_log == 2 && (log0 & RETRY_RD_ERR_LOG_OVER_UC_V)) {
229-
log0 &= ~RETRY_RD_ERR_LOG_OVER_UC_V;
230-
I10NM_SET_REG32(imc, res->channel, offsets[0], log0);
279+
if (retry_rd_err_log == 2) {
280+
if (log0 & RETRY_RD_ERR_LOG_OVER_UC_V) {
281+
log0 &= ~RETRY_RD_ERR_LOG_OVER_UC_V;
282+
I10NM_SET_REG32(imc, res->channel, offsets[0], log0);
283+
}
284+
285+
if (xffsets && (lxg0 & RETRY_RD_ERR_LOG_OVER_UC_V)) {
286+
lxg0 &= ~RETRY_RD_ERR_LOG_OVER_UC_V;
287+
I10NM_SET_REG32(imc, res->channel, xffsets[0], lxg0);
288+
}
231289
}
232290
}
233291

@@ -568,6 +626,7 @@ static struct res_config spr_cfg = {
568626
.offsets_scrub_hbm0 = offsets_scrub_spr_hbm0,
569627
.offsets_scrub_hbm1 = offsets_scrub_spr_hbm1,
570628
.offsets_demand = offsets_demand_spr,
629+
.offsets_demand2 = offsets_demand2_spr,
571630
.offsets_demand_hbm0 = offsets_demand_spr_hbm0,
572631
.offsets_demand_hbm1 = offsets_demand_spr_hbm1,
573632
};

drivers/edac/skx_common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ struct skx_dev {
8686
struct pci_dev *edev;
8787
u32 retry_rd_err_log_s;
8888
u32 retry_rd_err_log_d;
89+
u32 retry_rd_err_log_d2;
8990
struct skx_dimm {
9091
u8 close_pg;
9192
u8 bank_xor_enable;
@@ -167,6 +168,7 @@ struct res_config {
167168
u32 *offsets_scrub_hbm0;
168169
u32 *offsets_scrub_hbm1;
169170
u32 *offsets_demand;
171+
u32 *offsets_demand2;
170172
u32 *offsets_demand_hbm0;
171173
u32 *offsets_demand_hbm1;
172174
};

0 commit comments

Comments
 (0)