Skip to content

Commit 612b5d5

Browse files
Alex Kluverardbiesheuvel
authored andcommitted
cper,edac,efi: Memory Error Record: bank group/address and chip id
Updates to the UEFI 2.8 Memory Error Record allow splitting the bank field into bank address and bank group, and using the last 3 bits of the extended field as a chip identifier. When needed, print correct version of bank field, bank group, and chip identification. Based on UEFI 2.8 Table 299. Memory Error Record. Signed-off-by: Alex Kluver <alex.kluver@hpe.com> Reviewed-by: Russ Anderson <russ.anderson@hpe.com> Reviewed-by: Kyle Meyer <kyle.meyer@hpe.com> Reviewed-by: Steve Wahl <steve.wahl@hpe.com> Acked-by: Borislav Petkov <bp@suse.de> Link: https://lore.kernel.org/r/20200819143544.155096-3-alex.kluver@hpe.com Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 9baf68c commit 612b5d5

3 files changed

Lines changed: 26 additions & 0 deletions

File tree

drivers/edac/ghes_edac.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -372,6 +372,12 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
372372
p += sprintf(p, "rank:%d ", mem_err->rank);
373373
if (mem_err->validation_bits & CPER_MEM_VALID_BANK)
374374
p += sprintf(p, "bank:%d ", mem_err->bank);
375+
if (mem_err->validation_bits & CPER_MEM_VALID_BANK_GROUP)
376+
p += sprintf(p, "bank_group:%d ",
377+
mem_err->bank >> CPER_MEM_BANK_GROUP_SHIFT);
378+
if (mem_err->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
379+
p += sprintf(p, "bank_address:%d ",
380+
mem_err->bank & CPER_MEM_BANK_ADDRESS_MASK);
375381
if (mem_err->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
376382
u32 row = mem_err->row;
377383

@@ -399,6 +405,9 @@ void ghes_edac_report_mem_error(int sev, struct cper_sec_mem_err *mem_err)
399405
strcpy(e->label, dimm->label);
400406
}
401407
}
408+
if (mem_err->validation_bits & CPER_MEM_VALID_CHIP_ID)
409+
p += sprintf(p, "chipID: %d ",
410+
mem_err->extended >> CPER_MEM_CHIP_ID_SHIFT);
402411
if (p > e->location)
403412
*(p - 1) = '\0';
404413

drivers/firmware/efi/cper.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,12 @@ static int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg)
232232
n += scnprintf(msg + n, len - n, "rank: %d ", mem->rank);
233233
if (mem->validation_bits & CPER_MEM_VALID_BANK)
234234
n += scnprintf(msg + n, len - n, "bank: %d ", mem->bank);
235+
if (mem->validation_bits & CPER_MEM_VALID_BANK_GROUP)
236+
n += scnprintf(msg + n, len - n, "bank_group: %d ",
237+
mem->bank >> CPER_MEM_BANK_GROUP_SHIFT);
238+
if (mem->validation_bits & CPER_MEM_VALID_BANK_ADDRESS)
239+
n += scnprintf(msg + n, len - n, "bank_address: %d ",
240+
mem->bank & CPER_MEM_BANK_ADDRESS_MASK);
235241
if (mem->validation_bits & CPER_MEM_VALID_DEVICE)
236242
n += scnprintf(msg + n, len - n, "device: %d ", mem->device);
237243
if (mem->validation_bits & (CPER_MEM_VALID_ROW | CPER_MEM_VALID_ROW_EXT)) {
@@ -254,6 +260,9 @@ static int cper_mem_err_location(struct cper_mem_err_compact *mem, char *msg)
254260
if (mem->validation_bits & CPER_MEM_VALID_TARGET_ID)
255261
scnprintf(msg + n, len - n, "target_id: 0x%016llx ",
256262
mem->target_id);
263+
if (mem->validation_bits & CPER_MEM_VALID_CHIP_ID)
264+
scnprintf(msg + n, len - n, "chip_id: %d ",
265+
mem->extended >> CPER_MEM_CHIP_ID_SHIFT);
257266

258267
msg[n] = '\0';
259268
return n;

include/linux/cper.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,10 +231,18 @@ enum {
231231
#define CPER_MEM_VALID_CARD_HANDLE 0x10000
232232
#define CPER_MEM_VALID_MODULE_HANDLE 0x20000
233233
#define CPER_MEM_VALID_ROW_EXT 0x40000
234+
#define CPER_MEM_VALID_BANK_GROUP 0x80000
235+
#define CPER_MEM_VALID_BANK_ADDRESS 0x100000
236+
#define CPER_MEM_VALID_CHIP_ID 0x200000
234237

235238
#define CPER_MEM_EXT_ROW_MASK 0x3
236239
#define CPER_MEM_EXT_ROW_SHIFT 16
237240

241+
#define CPER_MEM_BANK_ADDRESS_MASK 0xff
242+
#define CPER_MEM_BANK_GROUP_SHIFT 8
243+
244+
#define CPER_MEM_CHIP_ID_SHIFT 5
245+
238246
#define CPER_PCIE_VALID_PORT_TYPE 0x0001
239247
#define CPER_PCIE_VALID_VERSION 0x0002
240248
#define CPER_PCIE_VALID_COMMAND_STATUS 0x0004

0 commit comments

Comments
 (0)