Unverified Commit 4ef17653 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!4363 [OLK-5.10] add ACPI/EINJ CXL error types

Merge Pull Request from: @wjin123 
 
Title: [OLK-5.10] add ACPI/EINJ CXL error types

Content:
Intel Granite Rapids(GNR) and Serria Forest(SRF) BIOS already supported ACPI/EINJ CXL error types, backport upstream kernel commits to OLK-5.10 for supporting CXL error types on the two servers. Some minor related upstream commits also backported here.
upstream related commits:
f1e65718 ACPI: APEI: EINJ: warn on invalid argument when explicitly indicated by platform
fe6603ca ACPI: APEI: EINJ: Add CXL error types
53fc7e80 ACPI: APEI: EINJ: Limit error type to 32-bit width
87386ee8 ACPI: APEI: EINJ: Refactor available_error_type_show()
37ea9693 ACPI: APEI: EINJ: Fix formatting errors
ab59c893 ACPI, APEI, EINJ: Refuse to inject into the zero page
The backported codes has been verified on Intel GNR/SRF server.

Intel-kernel issue:
https://gitee.com/openeuler/intel-kernel/issues/I8ZRE0?from=project-issue

Test:
1.BIOS setting:
EDKII Menu -> Platform Configuration -> System Event Log -> Error Injection Settings -> WHEA Error Injection Support = Enable
EDKII Menu -> Platform Configuration -> System Event Log -> Error Injection Settings -> WHEA PCIe & CXL Error Injection Support = Enable
EDKII Menu -> Platform Configuration -> System Event Log -> Error Injection Settings -> WHEA PCIe & CXL Error Injection Action Table = Enable
2.after enter OS shell, run command "modprobe einj", then run "cat /sys/kernel/debug/apei/einj/available_error_types",
CXL error types should be displayed as below:
"
0x00001000 CXL.cache Protocol Correctable
0x00002000 CXL.cache Protocol Uncorrectable non-fatal
0x00004000 CXL.cache Protocol Uncorrectable fatal
0x00008000 CXL.mem Protocol Correctable
0x00010000 CXL.mem Protocol Uncorrectable non-fatal
0x00020000 CXL.mem Protocol Uncorrectable fatal
"

Known issue:
N/A

Default config change:
N/A
 
 
Link:https://gitee.com/openeuler/kernel/pulls/4363

 

Reviewed-by: default avatarJason Zeng <jason.zeng@intel.com>
Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Reviewed-by: default avatarXiaoFei Tan <tanxiaofei@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents eeed9987 2eff2d14
Loading
Loading
Loading
Loading
+46 −32
Original line number Diff line number Diff line
@@ -357,6 +357,7 @@ static int __einj_error_trigger(u64 trigger_paddr, u32 type,
	 */
	if ((param_extension || acpi5) && (type & MEM_ERROR_MASK) && param2) {
		struct apei_resources addr_resources;

		apei_resources_init(&addr_resources);
		trigger_param_region = einj_get_trigger_parameter_region(
			trigger_tab, param1, param2);
@@ -465,6 +466,7 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
			return rc;
		if (einj_param) {
			struct einj_parameter *v4param = einj_param;

			v4param->param1 = param1;
			v4param->param2 = param2;
		}
@@ -486,9 +488,15 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
	if (rc)
		return rc;
	val = apei_exec_ctx_get_output(&ctx);
	if (val != EINJ_STATUS_SUCCESS)
	if (val == EINJ_STATUS_FAIL)
		return -EBUSY;
	else if (val == EINJ_STATUS_INVAL)
		return -EINVAL;

	/*
	 * The error is injected into the platform successfully, then it needs
	 * to trigger the error.
	 */
	rc = apei_exec_run(&ctx, ACPI_EINJ_GET_TRIGGER_TABLE);
	if (rc)
		return rc;
@@ -550,6 +558,9 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,
	     !arch_is_platform_page(base_addr)))
		return -EINVAL;

	if (is_zero_pfn(base_addr >> PAGE_SHIFT))
		return -EADDRINUSE;

inject:
	mutex_lock(&einj_mutex);
	rc = __einj_error_inject(type, flags, param1, param2, param3, param4);
@@ -565,39 +576,39 @@ static u64 error_param2;
static u64 error_param3;
static u64 error_param4;
static struct dentry *einj_debug_dir;
static const char * const einj_error_type_string[] = {
	"0x00000001\tProcessor Correctable\n",
	"0x00000002\tProcessor Uncorrectable non-fatal\n",
	"0x00000004\tProcessor Uncorrectable fatal\n",
	"0x00000008\tMemory Correctable\n",
	"0x00000010\tMemory Uncorrectable non-fatal\n",
	"0x00000020\tMemory Uncorrectable fatal\n",
	"0x00000040\tPCI Express Correctable\n",
	"0x00000080\tPCI Express Uncorrectable non-fatal\n",
	"0x00000100\tPCI Express Uncorrectable fatal\n",
	"0x00000200\tPlatform Correctable\n",
	"0x00000400\tPlatform Uncorrectable non-fatal\n",
	"0x00000800\tPlatform Uncorrectable fatal\n",
	"0x00001000\tCXL.cache Protocol Correctable\n",
	"0x00002000\tCXL.cache Protocol Uncorrectable non-fatal\n",
	"0x00004000\tCXL.cache Protocol Uncorrectable fatal\n",
	"0x00008000\tCXL.mem Protocol Correctable\n",
	"0x00010000\tCXL.mem Protocol Uncorrectable non-fatal\n",
	"0x00020000\tCXL.mem Protocol Uncorrectable fatal\n",
};

static int available_error_type_show(struct seq_file *m, void *v)
{
	int rc;
	int pos;
	u32 available_error_type = 0;

	rc = einj_get_available_error_type(&available_error_type);
	if (rc)
		return rc;
	if (available_error_type & 0x0001)
		seq_printf(m, "0x00000001\tProcessor Correctable\n");
	if (available_error_type & 0x0002)
		seq_printf(m, "0x00000002\tProcessor Uncorrectable non-fatal\n");
	if (available_error_type & 0x0004)
		seq_printf(m, "0x00000004\tProcessor Uncorrectable fatal\n");
	if (available_error_type & 0x0008)
		seq_printf(m, "0x00000008\tMemory Correctable\n");
	if (available_error_type & 0x0010)
		seq_printf(m, "0x00000010\tMemory Uncorrectable non-fatal\n");
	if (available_error_type & 0x0020)
		seq_printf(m, "0x00000020\tMemory Uncorrectable fatal\n");
	if (available_error_type & 0x0040)
		seq_printf(m, "0x00000040\tPCI Express Correctable\n");
	if (available_error_type & 0x0080)
		seq_printf(m, "0x00000080\tPCI Express Uncorrectable non-fatal\n");
	if (available_error_type & 0x0100)
		seq_printf(m, "0x00000100\tPCI Express Uncorrectable fatal\n");
	if (available_error_type & 0x0200)
		seq_printf(m, "0x00000200\tPlatform Correctable\n");
	if (available_error_type & 0x0400)
		seq_printf(m, "0x00000400\tPlatform Uncorrectable non-fatal\n");
	if (available_error_type & 0x0800)
		seq_printf(m, "0x00000800\tPlatform Uncorrectable fatal\n");
	for (pos = 0; pos < ARRAY_SIZE(einj_error_type_string); pos++)
		if (available_error_type & BIT(pos))
			seq_puts(m, einj_error_type_string[pos]);

	return 0;
}
@@ -617,6 +628,10 @@ static int error_type_set(void *data, u64 val)
	u32 available_error_type = 0;
	u32 tval, vendor;

	/* Only low 32 bits for error type are valid */
	if (val & GENMASK_ULL(63, 32))
		return -EINVAL;

	/*
	 * Vendor defined types have 0x80000000 bit set, and
	 * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE
@@ -685,8 +700,7 @@ static int __init einj_init(void)
	if (status == AE_NOT_FOUND) {
		pr_warn("EINJ table not found.\n");
		return -ENODEV;
	}
	else if (ACPI_FAILURE(status)) {
	} else if (ACPI_FAILURE(status)) {
		pr_err("Failed to get EINJ table: %s\n",
				acpi_format_exception(status));
		return -EINVAL;