Skip to content

Commit acd4cf6

Browse files
qzhuo2aegl
authored andcommitted
EDAC/i10nm: Retrieve and print retry_rd_err_log registers for HBM
An HBM memory channel is divided into two pseudo channels. Each pseudo channel has its own retry_rd_err_log registers. Retrieve and print retry_rd_err_log registers of the HBM pseudo channel if the memory error is from HBM. 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 14646de commit acd4cf6

File tree

2 files changed

+71
-17
lines changed

2 files changed

+71
-17
lines changed

drivers/edac/i10nm_base.c

Lines changed: 67 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,20 @@ static bool mem_cfg_2lm;
7979

8080
static u32 offsets_scrub_icx[] = {0x22c60, 0x22c54, 0x22c5c, 0x22c58, 0x22c28, 0x20ed8};
8181
static u32 offsets_scrub_spr[] = {0x22c60, 0x22c54, 0x22f08, 0x22c58, 0x22c28, 0x20ed8};
82+
static u32 offsets_scrub_spr_hbm0[] = {0x2860, 0x2854, 0x2b08, 0x2858, 0x2828, 0x0ed8};
83+
static u32 offsets_scrub_spr_hbm1[] = {0x2c60, 0x2c54, 0x2f08, 0x2c58, 0x2c28, 0x0fa8};
8284
static u32 offsets_demand_icx[] = {0x22e54, 0x22e60, 0x22e64, 0x22e58, 0x22e5c, 0x20ee0};
8385
static u32 offsets_demand_spr[] = {0x22e54, 0x22e60, 0x22f10, 0x22e58, 0x22e5c, 0x20ee0};
86+
static u32 offsets_demand_spr_hbm0[] = {0x2a54, 0x2a60, 0x2b10, 0x2a58, 0x2a5c, 0x0ee0};
87+
static u32 offsets_demand_spr_hbm1[] = {0x2e54, 0x2e60, 0x2f10, 0x2e58, 0x2e5c, 0x0fb0};
8488

85-
static void __enable_retry_rd_err_log(struct skx_imc *imc, int chan, bool enable)
89+
static void __enable_retry_rd_err_log(struct skx_imc *imc, int chan, bool enable,
90+
u32 *offsets_scrub, u32 *offsets_demand)
8691
{
8792
u32 s, d;
8893

89-
if (!imc->mbase)
90-
return;
91-
92-
s = I10NM_GET_REG32(imc, chan, res_cfg->offsets_scrub[0]);
93-
d = I10NM_GET_REG32(imc, chan, res_cfg->offsets_demand[0]);
94+
s = I10NM_GET_REG32(imc, chan, offsets_scrub[0]);
95+
d = I10NM_GET_REG32(imc, chan, offsets_demand[0]);
9496

9597
if (enable) {
9698
/* Save default configurations */
@@ -117,21 +119,39 @@ static void __enable_retry_rd_err_log(struct skx_imc *imc, int chan, bool enable
117119
d &= ~RETRY_RD_ERR_LOG_EN;
118120
}
119121

120-
I10NM_SET_REG32(imc, chan, res_cfg->offsets_scrub[0], s);
121-
I10NM_SET_REG32(imc, chan, res_cfg->offsets_demand[0], d);
122+
I10NM_SET_REG32(imc, chan, offsets_scrub[0], s);
123+
I10NM_SET_REG32(imc, chan, offsets_demand[0], d);
122124
}
123125

124126
static void enable_retry_rd_err_log(bool enable)
125127
{
128+
struct skx_imc *imc;
126129
struct skx_dev *d;
127130
int i, j;
128131

129132
edac_dbg(2, "\n");
130133

131134
list_for_each_entry(d, i10nm_edac_list, list)
132-
for (i = 0; i < I10NM_NUM_IMC; i++)
133-
for (j = 0; j < I10NM_NUM_CHANNELS; j++)
134-
__enable_retry_rd_err_log(&d->imc[i], j, enable);
135+
for (i = 0; i < I10NM_NUM_IMC; i++) {
136+
imc = &d->imc[i];
137+
if (!imc->mbase)
138+
continue;
139+
140+
for (j = 0; j < I10NM_NUM_CHANNELS; j++) {
141+
if (imc->hbm_mc) {
142+
__enable_retry_rd_err_log(imc, j, enable,
143+
res_cfg->offsets_scrub_hbm0,
144+
res_cfg->offsets_demand_hbm0);
145+
__enable_retry_rd_err_log(imc, j, enable,
146+
res_cfg->offsets_scrub_hbm1,
147+
res_cfg->offsets_demand_hbm1);
148+
} else {
149+
__enable_retry_rd_err_log(imc, j, enable,
150+
res_cfg->offsets_scrub,
151+
res_cfg->offsets_demand);
152+
}
153+
}
154+
}
135155
}
136156

137157
static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
@@ -142,12 +162,24 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
142162
u32 corr0, corr1, corr2, corr3;
143163
u64 log2a, log5;
144164
u32 *offsets;
145-
int n;
165+
int n, pch;
146166

147167
if (!imc->mbase)
148168
return;
149169

150-
offsets = scrub_err ? res_cfg->offsets_scrub : res_cfg->offsets_demand;
170+
if (imc->hbm_mc) {
171+
pch = res->cs & 1;
172+
173+
if (pch)
174+
offsets = scrub_err ? res_cfg->offsets_scrub_hbm1 :
175+
res_cfg->offsets_demand_hbm1;
176+
else
177+
offsets = scrub_err ? res_cfg->offsets_scrub_hbm0 :
178+
res_cfg->offsets_demand_hbm0;
179+
} else {
180+
offsets = scrub_err ? res_cfg->offsets_scrub :
181+
res_cfg->offsets_demand;
182+
}
151183

152184
log0 = I10NM_GET_REG32(imc, res->channel, offsets[0]);
153185
log1 = I10NM_GET_REG32(imc, res->channel, offsets[1]);
@@ -165,10 +197,24 @@ static void show_retry_rd_err_log(struct decoded_addr *res, char *msg,
165197
log0, log1, log2, log3, log4, log5);
166198
}
167199

168-
corr0 = I10NM_GET_REG32(imc, res->channel, 0x22c18);
169-
corr1 = I10NM_GET_REG32(imc, res->channel, 0x22c1c);
170-
corr2 = I10NM_GET_REG32(imc, res->channel, 0x22c20);
171-
corr3 = I10NM_GET_REG32(imc, res->channel, 0x22c24);
200+
if (imc->hbm_mc) {
201+
if (pch) {
202+
corr0 = I10NM_GET_REG32(imc, res->channel, 0x2c18);
203+
corr1 = I10NM_GET_REG32(imc, res->channel, 0x2c1c);
204+
corr2 = I10NM_GET_REG32(imc, res->channel, 0x2c20);
205+
corr3 = I10NM_GET_REG32(imc, res->channel, 0x2c24);
206+
} else {
207+
corr0 = I10NM_GET_REG32(imc, res->channel, 0x2818);
208+
corr1 = I10NM_GET_REG32(imc, res->channel, 0x281c);
209+
corr2 = I10NM_GET_REG32(imc, res->channel, 0x2820);
210+
corr3 = I10NM_GET_REG32(imc, res->channel, 0x2824);
211+
}
212+
} else {
213+
corr0 = I10NM_GET_REG32(imc, res->channel, 0x22c18);
214+
corr1 = I10NM_GET_REG32(imc, res->channel, 0x22c1c);
215+
corr2 = I10NM_GET_REG32(imc, res->channel, 0x22c20);
216+
corr3 = I10NM_GET_REG32(imc, res->channel, 0x22c24);
217+
}
172218

173219
if (len - n > 0)
174220
snprintf(msg + n, len - n,
@@ -519,7 +565,11 @@ static struct res_config spr_cfg = {
519565
.sad_all_devfn = PCI_DEVFN(10, 0),
520566
.sad_all_offset = 0x300,
521567
.offsets_scrub = offsets_scrub_spr,
568+
.offsets_scrub_hbm0 = offsets_scrub_spr_hbm0,
569+
.offsets_scrub_hbm1 = offsets_scrub_spr_hbm1,
522570
.offsets_demand = offsets_demand_spr,
571+
.offsets_demand_hbm0 = offsets_demand_spr_hbm0,
572+
.offsets_demand_hbm1 = offsets_demand_spr_hbm1,
523573
};
524574

525575
static const struct x86_cpu_id i10nm_cpuids[] = {

drivers/edac/skx_common.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ struct res_config {
164164
int sad_all_offset;
165165
/* Offsets of retry_rd_err_log registers */
166166
u32 *offsets_scrub;
167+
u32 *offsets_scrub_hbm0;
168+
u32 *offsets_scrub_hbm1;
167169
u32 *offsets_demand;
170+
u32 *offsets_demand_hbm0;
171+
u32 *offsets_demand_hbm1;
168172
};
169173

170174
typedef int (*get_dimm_config_f)(struct mem_ctl_info *mci,

0 commit comments

Comments
 (0)