162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci// Copyright (C) 2018, Advanced Micro Devices, Inc.
362306a36Sopenharmony_ci
462306a36Sopenharmony_ci#include <linux/cper.h>
562306a36Sopenharmony_ci#include <linux/acpi.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/*
862306a36Sopenharmony_ci * We don't need a "CPER_IA" prefix since these are all locally defined.
962306a36Sopenharmony_ci * This will save us a lot of line space.
1062306a36Sopenharmony_ci */
1162306a36Sopenharmony_ci#define VALID_LAPIC_ID			BIT_ULL(0)
1262306a36Sopenharmony_ci#define VALID_CPUID_INFO		BIT_ULL(1)
1362306a36Sopenharmony_ci#define VALID_PROC_ERR_INFO_NUM(bits)	(((bits) & GENMASK_ULL(7, 2)) >> 2)
1462306a36Sopenharmony_ci#define VALID_PROC_CXT_INFO_NUM(bits)	(((bits) & GENMASK_ULL(13, 8)) >> 8)
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define INFO_ERR_STRUCT_TYPE_CACHE					\
1762306a36Sopenharmony_ci	GUID_INIT(0xA55701F5, 0xE3EF, 0x43DE, 0xAC, 0x72, 0x24, 0x9B,	\
1862306a36Sopenharmony_ci		  0x57, 0x3F, 0xAD, 0x2C)
1962306a36Sopenharmony_ci#define INFO_ERR_STRUCT_TYPE_TLB					\
2062306a36Sopenharmony_ci	GUID_INIT(0xFC06B535, 0x5E1F, 0x4562, 0x9F, 0x25, 0x0A, 0x3B,	\
2162306a36Sopenharmony_ci		  0x9A, 0xDB, 0x63, 0xC3)
2262306a36Sopenharmony_ci#define INFO_ERR_STRUCT_TYPE_BUS					\
2362306a36Sopenharmony_ci	GUID_INIT(0x1CF3F8B3, 0xC5B1, 0x49a2, 0xAA, 0x59, 0x5E, 0xEF,	\
2462306a36Sopenharmony_ci		  0x92, 0xFF, 0xA6, 0x3C)
2562306a36Sopenharmony_ci#define INFO_ERR_STRUCT_TYPE_MS						\
2662306a36Sopenharmony_ci	GUID_INIT(0x48AB7F57, 0xDC34, 0x4f6c, 0xA7, 0xD3, 0xB0, 0xB5,	\
2762306a36Sopenharmony_ci		  0xB0, 0xA7, 0x43, 0x14)
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define INFO_VALID_CHECK_INFO		BIT_ULL(0)
3062306a36Sopenharmony_ci#define INFO_VALID_TARGET_ID		BIT_ULL(1)
3162306a36Sopenharmony_ci#define INFO_VALID_REQUESTOR_ID		BIT_ULL(2)
3262306a36Sopenharmony_ci#define INFO_VALID_RESPONDER_ID		BIT_ULL(3)
3362306a36Sopenharmony_ci#define INFO_VALID_IP			BIT_ULL(4)
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#define CHECK_VALID_TRANS_TYPE		BIT_ULL(0)
3662306a36Sopenharmony_ci#define CHECK_VALID_OPERATION		BIT_ULL(1)
3762306a36Sopenharmony_ci#define CHECK_VALID_LEVEL		BIT_ULL(2)
3862306a36Sopenharmony_ci#define CHECK_VALID_PCC			BIT_ULL(3)
3962306a36Sopenharmony_ci#define CHECK_VALID_UNCORRECTED		BIT_ULL(4)
4062306a36Sopenharmony_ci#define CHECK_VALID_PRECISE_IP		BIT_ULL(5)
4162306a36Sopenharmony_ci#define CHECK_VALID_RESTARTABLE_IP	BIT_ULL(6)
4262306a36Sopenharmony_ci#define CHECK_VALID_OVERFLOW		BIT_ULL(7)
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define CHECK_VALID_BUS_PART_TYPE	BIT_ULL(8)
4562306a36Sopenharmony_ci#define CHECK_VALID_BUS_TIME_OUT	BIT_ULL(9)
4662306a36Sopenharmony_ci#define CHECK_VALID_BUS_ADDR_SPACE	BIT_ULL(10)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci#define CHECK_VALID_BITS(check)		(((check) & GENMASK_ULL(15, 0)))
4962306a36Sopenharmony_ci#define CHECK_TRANS_TYPE(check)		(((check) & GENMASK_ULL(17, 16)) >> 16)
5062306a36Sopenharmony_ci#define CHECK_OPERATION(check)		(((check) & GENMASK_ULL(21, 18)) >> 18)
5162306a36Sopenharmony_ci#define CHECK_LEVEL(check)		(((check) & GENMASK_ULL(24, 22)) >> 22)
5262306a36Sopenharmony_ci#define CHECK_PCC			BIT_ULL(25)
5362306a36Sopenharmony_ci#define CHECK_UNCORRECTED		BIT_ULL(26)
5462306a36Sopenharmony_ci#define CHECK_PRECISE_IP		BIT_ULL(27)
5562306a36Sopenharmony_ci#define CHECK_RESTARTABLE_IP		BIT_ULL(28)
5662306a36Sopenharmony_ci#define CHECK_OVERFLOW			BIT_ULL(29)
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci#define CHECK_BUS_PART_TYPE(check)	(((check) & GENMASK_ULL(31, 30)) >> 30)
5962306a36Sopenharmony_ci#define CHECK_BUS_TIME_OUT		BIT_ULL(32)
6062306a36Sopenharmony_ci#define CHECK_BUS_ADDR_SPACE(check)	(((check) & GENMASK_ULL(34, 33)) >> 33)
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci#define CHECK_VALID_MS_ERR_TYPE		BIT_ULL(0)
6362306a36Sopenharmony_ci#define CHECK_VALID_MS_PCC		BIT_ULL(1)
6462306a36Sopenharmony_ci#define CHECK_VALID_MS_UNCORRECTED	BIT_ULL(2)
6562306a36Sopenharmony_ci#define CHECK_VALID_MS_PRECISE_IP	BIT_ULL(3)
6662306a36Sopenharmony_ci#define CHECK_VALID_MS_RESTARTABLE_IP	BIT_ULL(4)
6762306a36Sopenharmony_ci#define CHECK_VALID_MS_OVERFLOW		BIT_ULL(5)
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define CHECK_MS_ERR_TYPE(check)	(((check) & GENMASK_ULL(18, 16)) >> 16)
7062306a36Sopenharmony_ci#define CHECK_MS_PCC			BIT_ULL(19)
7162306a36Sopenharmony_ci#define CHECK_MS_UNCORRECTED		BIT_ULL(20)
7262306a36Sopenharmony_ci#define CHECK_MS_PRECISE_IP		BIT_ULL(21)
7362306a36Sopenharmony_ci#define CHECK_MS_RESTARTABLE_IP		BIT_ULL(22)
7462306a36Sopenharmony_ci#define CHECK_MS_OVERFLOW		BIT_ULL(23)
7562306a36Sopenharmony_ci
7662306a36Sopenharmony_ci#define CTX_TYPE_MSR			1
7762306a36Sopenharmony_ci#define CTX_TYPE_MMREG			7
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_cienum err_types {
8062306a36Sopenharmony_ci	ERR_TYPE_CACHE = 0,
8162306a36Sopenharmony_ci	ERR_TYPE_TLB,
8262306a36Sopenharmony_ci	ERR_TYPE_BUS,
8362306a36Sopenharmony_ci	ERR_TYPE_MS,
8462306a36Sopenharmony_ci	N_ERR_TYPES
8562306a36Sopenharmony_ci};
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_cistatic enum err_types cper_get_err_type(const guid_t *err_type)
8862306a36Sopenharmony_ci{
8962306a36Sopenharmony_ci	if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_CACHE))
9062306a36Sopenharmony_ci		return ERR_TYPE_CACHE;
9162306a36Sopenharmony_ci	else if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_TLB))
9262306a36Sopenharmony_ci		return ERR_TYPE_TLB;
9362306a36Sopenharmony_ci	else if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_BUS))
9462306a36Sopenharmony_ci		return ERR_TYPE_BUS;
9562306a36Sopenharmony_ci	else if (guid_equal(err_type, &INFO_ERR_STRUCT_TYPE_MS))
9662306a36Sopenharmony_ci		return ERR_TYPE_MS;
9762306a36Sopenharmony_ci	else
9862306a36Sopenharmony_ci		return N_ERR_TYPES;
9962306a36Sopenharmony_ci}
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_cistatic const char * const ia_check_trans_type_strs[] = {
10262306a36Sopenharmony_ci	"Instruction",
10362306a36Sopenharmony_ci	"Data Access",
10462306a36Sopenharmony_ci	"Generic",
10562306a36Sopenharmony_ci};
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_cistatic const char * const ia_check_op_strs[] = {
10862306a36Sopenharmony_ci	"generic error",
10962306a36Sopenharmony_ci	"generic read",
11062306a36Sopenharmony_ci	"generic write",
11162306a36Sopenharmony_ci	"data read",
11262306a36Sopenharmony_ci	"data write",
11362306a36Sopenharmony_ci	"instruction fetch",
11462306a36Sopenharmony_ci	"prefetch",
11562306a36Sopenharmony_ci	"eviction",
11662306a36Sopenharmony_ci	"snoop",
11762306a36Sopenharmony_ci};
11862306a36Sopenharmony_ci
11962306a36Sopenharmony_cistatic const char * const ia_check_bus_part_type_strs[] = {
12062306a36Sopenharmony_ci	"Local Processor originated request",
12162306a36Sopenharmony_ci	"Local Processor responded to request",
12262306a36Sopenharmony_ci	"Local Processor observed",
12362306a36Sopenharmony_ci	"Generic",
12462306a36Sopenharmony_ci};
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_cistatic const char * const ia_check_bus_addr_space_strs[] = {
12762306a36Sopenharmony_ci	"Memory Access",
12862306a36Sopenharmony_ci	"Reserved",
12962306a36Sopenharmony_ci	"I/O",
13062306a36Sopenharmony_ci	"Other Transaction",
13162306a36Sopenharmony_ci};
13262306a36Sopenharmony_ci
13362306a36Sopenharmony_cistatic const char * const ia_check_ms_error_type_strs[] = {
13462306a36Sopenharmony_ci	"No Error",
13562306a36Sopenharmony_ci	"Unclassified",
13662306a36Sopenharmony_ci	"Microcode ROM Parity Error",
13762306a36Sopenharmony_ci	"External Error",
13862306a36Sopenharmony_ci	"FRC Error",
13962306a36Sopenharmony_ci	"Internal Unclassified",
14062306a36Sopenharmony_ci};
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_cistatic const char * const ia_reg_ctx_strs[] = {
14362306a36Sopenharmony_ci	"Unclassified Data",
14462306a36Sopenharmony_ci	"MSR Registers (Machine Check and other MSRs)",
14562306a36Sopenharmony_ci	"32-bit Mode Execution Context",
14662306a36Sopenharmony_ci	"64-bit Mode Execution Context",
14762306a36Sopenharmony_ci	"FXSAVE Context",
14862306a36Sopenharmony_ci	"32-bit Mode Debug Registers (DR0-DR7)",
14962306a36Sopenharmony_ci	"64-bit Mode Debug Registers (DR0-DR7)",
15062306a36Sopenharmony_ci	"Memory Mapped Registers",
15162306a36Sopenharmony_ci};
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_cistatic inline void print_bool(char *str, const char *pfx, u64 check, u64 bit)
15462306a36Sopenharmony_ci{
15562306a36Sopenharmony_ci	printk("%s%s: %s\n", pfx, str, (check & bit) ? "true" : "false");
15662306a36Sopenharmony_ci}
15762306a36Sopenharmony_ci
15862306a36Sopenharmony_cistatic void print_err_info_ms(const char *pfx, u16 validation_bits, u64 check)
15962306a36Sopenharmony_ci{
16062306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_MS_ERR_TYPE) {
16162306a36Sopenharmony_ci		u8 err_type = CHECK_MS_ERR_TYPE(check);
16262306a36Sopenharmony_ci
16362306a36Sopenharmony_ci		printk("%sError Type: %u, %s\n", pfx, err_type,
16462306a36Sopenharmony_ci		       err_type < ARRAY_SIZE(ia_check_ms_error_type_strs) ?
16562306a36Sopenharmony_ci		       ia_check_ms_error_type_strs[err_type] : "unknown");
16662306a36Sopenharmony_ci	}
16762306a36Sopenharmony_ci
16862306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_MS_PCC)
16962306a36Sopenharmony_ci		print_bool("Processor Context Corrupt", pfx, check, CHECK_MS_PCC);
17062306a36Sopenharmony_ci
17162306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_MS_UNCORRECTED)
17262306a36Sopenharmony_ci		print_bool("Uncorrected", pfx, check, CHECK_MS_UNCORRECTED);
17362306a36Sopenharmony_ci
17462306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_MS_PRECISE_IP)
17562306a36Sopenharmony_ci		print_bool("Precise IP", pfx, check, CHECK_MS_PRECISE_IP);
17662306a36Sopenharmony_ci
17762306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_MS_RESTARTABLE_IP)
17862306a36Sopenharmony_ci		print_bool("Restartable IP", pfx, check, CHECK_MS_RESTARTABLE_IP);
17962306a36Sopenharmony_ci
18062306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_MS_OVERFLOW)
18162306a36Sopenharmony_ci		print_bool("Overflow", pfx, check, CHECK_MS_OVERFLOW);
18262306a36Sopenharmony_ci}
18362306a36Sopenharmony_ci
18462306a36Sopenharmony_cistatic void print_err_info(const char *pfx, u8 err_type, u64 check)
18562306a36Sopenharmony_ci{
18662306a36Sopenharmony_ci	u16 validation_bits = CHECK_VALID_BITS(check);
18762306a36Sopenharmony_ci
18862306a36Sopenharmony_ci	/*
18962306a36Sopenharmony_ci	 * The MS Check structure varies a lot from the others, so use a
19062306a36Sopenharmony_ci	 * separate function for decoding.
19162306a36Sopenharmony_ci	 */
19262306a36Sopenharmony_ci	if (err_type == ERR_TYPE_MS)
19362306a36Sopenharmony_ci		return print_err_info_ms(pfx, validation_bits, check);
19462306a36Sopenharmony_ci
19562306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_TRANS_TYPE) {
19662306a36Sopenharmony_ci		u8 trans_type = CHECK_TRANS_TYPE(check);
19762306a36Sopenharmony_ci
19862306a36Sopenharmony_ci		printk("%sTransaction Type: %u, %s\n", pfx, trans_type,
19962306a36Sopenharmony_ci		       trans_type < ARRAY_SIZE(ia_check_trans_type_strs) ?
20062306a36Sopenharmony_ci		       ia_check_trans_type_strs[trans_type] : "unknown");
20162306a36Sopenharmony_ci	}
20262306a36Sopenharmony_ci
20362306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_OPERATION) {
20462306a36Sopenharmony_ci		u8 op = CHECK_OPERATION(check);
20562306a36Sopenharmony_ci
20662306a36Sopenharmony_ci		/*
20762306a36Sopenharmony_ci		 * CACHE has more operation types than TLB or BUS, though the
20862306a36Sopenharmony_ci		 * name and the order are the same.
20962306a36Sopenharmony_ci		 */
21062306a36Sopenharmony_ci		u8 max_ops = (err_type == ERR_TYPE_CACHE) ? 9 : 7;
21162306a36Sopenharmony_ci
21262306a36Sopenharmony_ci		printk("%sOperation: %u, %s\n", pfx, op,
21362306a36Sopenharmony_ci		       op < max_ops ? ia_check_op_strs[op] : "unknown");
21462306a36Sopenharmony_ci	}
21562306a36Sopenharmony_ci
21662306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_LEVEL)
21762306a36Sopenharmony_ci		printk("%sLevel: %llu\n", pfx, CHECK_LEVEL(check));
21862306a36Sopenharmony_ci
21962306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_PCC)
22062306a36Sopenharmony_ci		print_bool("Processor Context Corrupt", pfx, check, CHECK_PCC);
22162306a36Sopenharmony_ci
22262306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_UNCORRECTED)
22362306a36Sopenharmony_ci		print_bool("Uncorrected", pfx, check, CHECK_UNCORRECTED);
22462306a36Sopenharmony_ci
22562306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_PRECISE_IP)
22662306a36Sopenharmony_ci		print_bool("Precise IP", pfx, check, CHECK_PRECISE_IP);
22762306a36Sopenharmony_ci
22862306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_RESTARTABLE_IP)
22962306a36Sopenharmony_ci		print_bool("Restartable IP", pfx, check, CHECK_RESTARTABLE_IP);
23062306a36Sopenharmony_ci
23162306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_OVERFLOW)
23262306a36Sopenharmony_ci		print_bool("Overflow", pfx, check, CHECK_OVERFLOW);
23362306a36Sopenharmony_ci
23462306a36Sopenharmony_ci	if (err_type != ERR_TYPE_BUS)
23562306a36Sopenharmony_ci		return;
23662306a36Sopenharmony_ci
23762306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_BUS_PART_TYPE) {
23862306a36Sopenharmony_ci		u8 part_type = CHECK_BUS_PART_TYPE(check);
23962306a36Sopenharmony_ci
24062306a36Sopenharmony_ci		printk("%sParticipation Type: %u, %s\n", pfx, part_type,
24162306a36Sopenharmony_ci		       part_type < ARRAY_SIZE(ia_check_bus_part_type_strs) ?
24262306a36Sopenharmony_ci		       ia_check_bus_part_type_strs[part_type] : "unknown");
24362306a36Sopenharmony_ci	}
24462306a36Sopenharmony_ci
24562306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_BUS_TIME_OUT)
24662306a36Sopenharmony_ci		print_bool("Time Out", pfx, check, CHECK_BUS_TIME_OUT);
24762306a36Sopenharmony_ci
24862306a36Sopenharmony_ci	if (validation_bits & CHECK_VALID_BUS_ADDR_SPACE) {
24962306a36Sopenharmony_ci		u8 addr_space = CHECK_BUS_ADDR_SPACE(check);
25062306a36Sopenharmony_ci
25162306a36Sopenharmony_ci		printk("%sAddress Space: %u, %s\n", pfx, addr_space,
25262306a36Sopenharmony_ci		       addr_space < ARRAY_SIZE(ia_check_bus_addr_space_strs) ?
25362306a36Sopenharmony_ci		       ia_check_bus_addr_space_strs[addr_space] : "unknown");
25462306a36Sopenharmony_ci	}
25562306a36Sopenharmony_ci}
25662306a36Sopenharmony_ci
25762306a36Sopenharmony_civoid cper_print_proc_ia(const char *pfx, const struct cper_sec_proc_ia *proc)
25862306a36Sopenharmony_ci{
25962306a36Sopenharmony_ci	int i;
26062306a36Sopenharmony_ci	struct cper_ia_err_info *err_info;
26162306a36Sopenharmony_ci	struct cper_ia_proc_ctx *ctx_info;
26262306a36Sopenharmony_ci	char newpfx[64], infopfx[64];
26362306a36Sopenharmony_ci	u8 err_type;
26462306a36Sopenharmony_ci
26562306a36Sopenharmony_ci	if (proc->validation_bits & VALID_LAPIC_ID)
26662306a36Sopenharmony_ci		printk("%sLocal APIC_ID: 0x%llx\n", pfx, proc->lapic_id);
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci	if (proc->validation_bits & VALID_CPUID_INFO) {
26962306a36Sopenharmony_ci		printk("%sCPUID Info:\n", pfx);
27062306a36Sopenharmony_ci		print_hex_dump(pfx, "", DUMP_PREFIX_OFFSET, 16, 4, proc->cpuid,
27162306a36Sopenharmony_ci			       sizeof(proc->cpuid), 0);
27262306a36Sopenharmony_ci	}
27362306a36Sopenharmony_ci
27462306a36Sopenharmony_ci	snprintf(newpfx, sizeof(newpfx), "%s ", pfx);
27562306a36Sopenharmony_ci
27662306a36Sopenharmony_ci	err_info = (struct cper_ia_err_info *)(proc + 1);
27762306a36Sopenharmony_ci	for (i = 0; i < VALID_PROC_ERR_INFO_NUM(proc->validation_bits); i++) {
27862306a36Sopenharmony_ci		printk("%sError Information Structure %d:\n", pfx, i);
27962306a36Sopenharmony_ci
28062306a36Sopenharmony_ci		err_type = cper_get_err_type(&err_info->err_type);
28162306a36Sopenharmony_ci		printk("%sError Structure Type: %s\n", newpfx,
28262306a36Sopenharmony_ci		       err_type < ARRAY_SIZE(cper_proc_error_type_strs) ?
28362306a36Sopenharmony_ci		       cper_proc_error_type_strs[err_type] : "unknown");
28462306a36Sopenharmony_ci
28562306a36Sopenharmony_ci		if (err_type >= N_ERR_TYPES) {
28662306a36Sopenharmony_ci			printk("%sError Structure Type: %pUl\n", newpfx,
28762306a36Sopenharmony_ci			       &err_info->err_type);
28862306a36Sopenharmony_ci		}
28962306a36Sopenharmony_ci
29062306a36Sopenharmony_ci		if (err_info->validation_bits & INFO_VALID_CHECK_INFO) {
29162306a36Sopenharmony_ci			printk("%sCheck Information: 0x%016llx\n", newpfx,
29262306a36Sopenharmony_ci			       err_info->check_info);
29362306a36Sopenharmony_ci
29462306a36Sopenharmony_ci			if (err_type < N_ERR_TYPES) {
29562306a36Sopenharmony_ci				snprintf(infopfx, sizeof(infopfx), "%s ",
29662306a36Sopenharmony_ci					 newpfx);
29762306a36Sopenharmony_ci
29862306a36Sopenharmony_ci				print_err_info(infopfx, err_type,
29962306a36Sopenharmony_ci					       err_info->check_info);
30062306a36Sopenharmony_ci			}
30162306a36Sopenharmony_ci		}
30262306a36Sopenharmony_ci
30362306a36Sopenharmony_ci		if (err_info->validation_bits & INFO_VALID_TARGET_ID) {
30462306a36Sopenharmony_ci			printk("%sTarget Identifier: 0x%016llx\n",
30562306a36Sopenharmony_ci			       newpfx, err_info->target_id);
30662306a36Sopenharmony_ci		}
30762306a36Sopenharmony_ci
30862306a36Sopenharmony_ci		if (err_info->validation_bits & INFO_VALID_REQUESTOR_ID) {
30962306a36Sopenharmony_ci			printk("%sRequestor Identifier: 0x%016llx\n",
31062306a36Sopenharmony_ci			       newpfx, err_info->requestor_id);
31162306a36Sopenharmony_ci		}
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci		if (err_info->validation_bits & INFO_VALID_RESPONDER_ID) {
31462306a36Sopenharmony_ci			printk("%sResponder Identifier: 0x%016llx\n",
31562306a36Sopenharmony_ci			       newpfx, err_info->responder_id);
31662306a36Sopenharmony_ci		}
31762306a36Sopenharmony_ci
31862306a36Sopenharmony_ci		if (err_info->validation_bits & INFO_VALID_IP) {
31962306a36Sopenharmony_ci			printk("%sInstruction Pointer: 0x%016llx\n",
32062306a36Sopenharmony_ci			       newpfx, err_info->ip);
32162306a36Sopenharmony_ci		}
32262306a36Sopenharmony_ci
32362306a36Sopenharmony_ci		err_info++;
32462306a36Sopenharmony_ci	}
32562306a36Sopenharmony_ci
32662306a36Sopenharmony_ci	ctx_info = (struct cper_ia_proc_ctx *)err_info;
32762306a36Sopenharmony_ci	for (i = 0; i < VALID_PROC_CXT_INFO_NUM(proc->validation_bits); i++) {
32862306a36Sopenharmony_ci		int size = sizeof(*ctx_info) + ctx_info->reg_arr_size;
32962306a36Sopenharmony_ci		int groupsize = 4;
33062306a36Sopenharmony_ci
33162306a36Sopenharmony_ci		printk("%sContext Information Structure %d:\n", pfx, i);
33262306a36Sopenharmony_ci
33362306a36Sopenharmony_ci		printk("%sRegister Context Type: %s\n", newpfx,
33462306a36Sopenharmony_ci		       ctx_info->reg_ctx_type < ARRAY_SIZE(ia_reg_ctx_strs) ?
33562306a36Sopenharmony_ci		       ia_reg_ctx_strs[ctx_info->reg_ctx_type] : "unknown");
33662306a36Sopenharmony_ci
33762306a36Sopenharmony_ci		printk("%sRegister Array Size: 0x%04x\n", newpfx,
33862306a36Sopenharmony_ci		       ctx_info->reg_arr_size);
33962306a36Sopenharmony_ci
34062306a36Sopenharmony_ci		if (ctx_info->reg_ctx_type == CTX_TYPE_MSR) {
34162306a36Sopenharmony_ci			groupsize = 8; /* MSRs are 8 bytes wide. */
34262306a36Sopenharmony_ci			printk("%sMSR Address: 0x%08x\n", newpfx,
34362306a36Sopenharmony_ci			       ctx_info->msr_addr);
34462306a36Sopenharmony_ci		}
34562306a36Sopenharmony_ci
34662306a36Sopenharmony_ci		if (ctx_info->reg_ctx_type == CTX_TYPE_MMREG) {
34762306a36Sopenharmony_ci			printk("%sMM Register Address: 0x%016llx\n", newpfx,
34862306a36Sopenharmony_ci			       ctx_info->mm_reg_addr);
34962306a36Sopenharmony_ci		}
35062306a36Sopenharmony_ci
35162306a36Sopenharmony_ci		if (ctx_info->reg_ctx_type != CTX_TYPE_MSR ||
35262306a36Sopenharmony_ci		    arch_apei_report_x86_error(ctx_info, proc->lapic_id)) {
35362306a36Sopenharmony_ci			printk("%sRegister Array:\n", newpfx);
35462306a36Sopenharmony_ci			print_hex_dump(newpfx, "", DUMP_PREFIX_OFFSET, 16,
35562306a36Sopenharmony_ci				       groupsize, (ctx_info + 1),
35662306a36Sopenharmony_ci				       ctx_info->reg_arr_size, 0);
35762306a36Sopenharmony_ci		}
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci		ctx_info = (struct cper_ia_proc_ctx *)((long)ctx_info + size);
36062306a36Sopenharmony_ci	}
36162306a36Sopenharmony_ci}
362