From patchwork Tue Feb 20 22:11:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13564612 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2052.outbound.protection.outlook.com [40.107.102.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D66A151CCC; Tue, 20 Feb 2024 22:12:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.102.52 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467140; cv=fail; b=DQwf6olNIrlWYt72vMd31/kBzGoZxA0evJJNpxp2V4NMM/YmBi878+voXk5W61KyV+V2sQvmCgKXY3wLRu/2AW+irAnpqQy3qm7S9AbID2ZKRkBHWS5w7sYTYem3KBBx35cgPW4dj37HBjbzaXIKYJHQ1XtrAnel6jzgj+oZFcM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467140; c=relaxed/simple; bh=bo0W7RURdjbWh2jl9SLAat3vjoTI0HvOCgUrWAT3Iiw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=VoKK1TgxNErCYX67Kh9JcCtWB6hI7rklCrW7wYa3kOylT4xRX3p+PF9vbCyITiJjktnbgRSJ1BRS0CFiH+wbvgKrJMHGr7YJX0ctfqW/ttAv8Q9GYp9dUtwSA2KEHctEX6fGy1poTj7oyo4tanZwKaAUuSLGjLLQHHXIb1TrzFI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=0JG0Yf5t; arc=fail smtp.client-ip=40.107.102.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="0JG0Yf5t" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Jw3qnPY2MqJm5axl5HECxwBpHoGQOcb13Tse+y2MsBeIu9ywX3X+JFWuxuWamvmdufq8P39QWSGil9VGR0cfUDCKmyKFt7mUDU2rtVsLO58J/rasJRkJhxyqLwzz7vii6ko6PooTJ12gnBpZhn/TzDS3Cec1C5BDSoCKCiaGnUXOLoMSHyTUQXHwHBS4/iQ/Urf8Rkh0ciiNsT+6GSDXVm+7rkuUhD7qMAcg7SymZ0Pv/Ozsoeaz4wk2mGQ3pAsoxUvfiMqHZ6lOjC0sHzv5L0m1E6NyjpahWSZ6dyCPWCTf5P0K7b1NV8Qqr4wIM25k03NQZ6M199KAJyh0m8lYlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=RK8uDivi4yRjU50+Lb4hnVSOoT4btSlih40OFvD8EqI=; b=YGr2xYIxxsS/pxY9J0rHfLE6/4u64wjiaYQVirCTePoXfMqMuqhJqIAZGHxARFl8w6yYd/iZ5w7m0UTEO0GVVpYjlkg7Xzm1hCirSTxR6qlLKu1P0PPXSNR0LydFmz6ZJ1pxv1UyOGFPX5FjasqNsbbrQ3UcKGscVePdXiuULYcc2EVO8B7HxchAEpRXIKb+DSXRjHnurK8XLtbBSJbOghnBBxYRx59J8Fv5xF5t65hFCmL4MdwgAZjRPrwg4RnI1FbRYZdsSX8DWdx4Omh4jKB1cYBvTIg7IHJG+gVtbxR2uLJKK5B0zVHSe9XhdQwwNp5y5n/nI3RMgEC94TJhOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=RK8uDivi4yRjU50+Lb4hnVSOoT4btSlih40OFvD8EqI=; b=0JG0Yf5tv7Rf+RJ3PTJZ9oi9iLXOqPEgDaiU8aMlwqxCDngvx+7woGxkEA6H+WXvZ0lSshVDEDqCqVkuebRMulnLAXNqJ9tML4iRp21yFdZ4GNIiLIiphAt8Q9wMapY60mbK4GfCybtmY44GZKcbJkc70dzqmytXfmR+RGPKiCY= Received: from SA0PR12CA0001.namprd12.prod.outlook.com (2603:10b6:806:6f::6) by DM4PR12MB6136.namprd12.prod.outlook.com (2603:10b6:8:a9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Tue, 20 Feb 2024 22:12:16 +0000 Received: from SN1PEPF0002529D.namprd05.prod.outlook.com (2603:10b6:806:6f:cafe::d3) by SA0PR12CA0001.outlook.office365.com (2603:10b6:806:6f::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.40 via Frontend Transport; Tue, 20 Feb 2024 22:12:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF0002529D.mail.protection.outlook.com (10.167.242.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 22:12:15 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 16:12:13 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v13 1/4] EINJ: Migrate to a platform driver Date: Tue, 20 Feb 2024 16:11:43 -0600 Message-ID: <20240220221146.399209-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> References: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF0002529D:EE_|DM4PR12MB6136:EE_ X-MS-Office365-Filtering-Correlation-Id: b1f9b10b-65f4-4a99-7f81-08dc3260ff24 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Rx8UgpqY8Q4eJSGT9KXfZwlCx4BBymNvXgiw7plRBXS/8D1CbN/Jo+dA7noiLs/bl2v3PrtaDKhqBZSjByQom8KuuNLR8G3GH2IuDlakmSME0HThFiivsGeM3np45WAUch+oGN3wPF8MyQDxNwOXoXI8+HxSbn01zRLRMmkbP+xEFreLd7dIrvrDXNkRADpK2UUJoK15YmN76Jsga28DE+cJk67IqwfrrqSCK6/2buFQ05tBGkfLv4QpQlHieIo51mr66xRCt1j+vGuD/oxCiTCiVR3KcOGh7xLrOBi2dHf5NUmxLR65AzZSfkPvf6GWSuDJoMY3yGxi08DSBxRJK9Z0iQVgA0OJ64J55gUMl/E+0X+wmkPMRqyVoPrZ6Vr2SZ3IdjtIglh+wtKgTvcY71QFHUG8QZ2EjMHo+W8pR29wqq0+Yh9b/103+ekxJKMSxMV2eQHNMW4vOcHX6YvSQSQZVP1sfKnkznJDTW5OLpeNxgJ6o3ANsyqd7HGi6LnBdoXlxsE9tcKHIVawVSZ2KB394y6u+W33NZnIsnmo8Puc5M0xgN3aK2Gv7wqtZ4bztju+BdYCp16HFsDq741Us92MbfVMQXZ/yFHYnKIjnByf1en5guF3JPRLJn8HEyRBw4sLsLdpElQ5Ku6pX7JZhWEiNO9w+f/Zv7fzqshRsU= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(230273577357003)(36860700004)(40470700004)(46966006);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 22:12:15.7817 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1f9b10b-65f4-4a99-7f81-08dc3260ff24 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF0002529D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6136 Change the EINJ module to install a platform device/driver on module init and move the module init() and exit() functions to driver probe and remove. This change allows the EINJ module to load regardless of whether setting up EINJ succeeds, which allows dependent modules to still load (i.e. the CXL core). Since EINJ may no longer be initialized when the module loads, any functions that are called from dependent/external modules should check the einj_initialized variable before calling any EINJ functions. Signed-off-by: Ben Cheatham --- drivers/acpi/apei/einj.c | 46 +++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 89fb9331c611..6ea323b9d8ef 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include "apei-internal.h" @@ -137,6 +138,11 @@ static struct apei_exec_ins_type einj_ins_type[] = { */ static DEFINE_MUTEX(einj_mutex); +/* + * Exported APIs use this flag to exit early if einj_probe() failed. + */ +static bool einj_initialized __ro_after_init; + static void *einj_param; static void einj_exec_ctx_init(struct apei_exec_context *ctx) @@ -703,7 +709,7 @@ static int einj_check_table(struct acpi_table_einj *einj_tab) return 0; } -static int __init einj_init(void) +static int __init einj_probe(struct platform_device *pdev) { int rc; acpi_status status; @@ -717,7 +723,7 @@ static int __init einj_init(void) status = acpi_get_table(ACPI_SIG_EINJ, 0, (struct acpi_table_header **)&einj_tab); if (status == AE_NOT_FOUND) { - pr_warn("EINJ table not found.\n"); + pr_info("EINJ table not found.\n"); return -ENODEV; } else if (ACPI_FAILURE(status)) { pr_err("Failed to get EINJ table: %s\n", @@ -805,7 +811,7 @@ static int __init einj_init(void) return rc; } -static void __exit einj_exit(void) +static void __exit einj_remove(struct platform_device *pdev) { struct apei_exec_context ctx; @@ -826,6 +832,40 @@ static void __exit einj_exit(void) acpi_put_table((struct acpi_table_header *)einj_tab); } +static struct platform_device *einj_dev; +struct platform_driver einj_driver = { + .remove_new = einj_remove, + .driver = { + .name = "acpi-einj", + }, +}; + +static int __init einj_init(void) +{ + struct platform_device_info einj_dev_info = { + .name = "acpi-einj", + .id = -1, + }; + int rc; + + einj_dev = platform_device_register_full(&einj_dev_info); + if (IS_ERR_OR_NULL(einj_dev)) + return PTR_ERR(einj_dev); + + rc = platform_driver_probe(&einj_driver, einj_probe); + einj_initialized = rc == 0; + + return 0; +} + +static void __exit einj_exit(void) +{ + if (einj_initialized) + platform_driver_unregister(&einj_driver); + + platform_device_del(einj_dev); +} + module_init(einj_init); module_exit(einj_exit); From patchwork Tue Feb 20 22:11:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13564613 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2089.outbound.protection.outlook.com [40.107.212.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BA6F151CCC; Tue, 20 Feb 2024 22:12:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.212.89 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467164; cv=fail; b=UuuhTLUXAc9ADYvAcAdV0xRDKnFAxLxpuHD3Geg7frvmslhaG9GDHH50359XI47wf9dS+e4cb/W1Aivxk8XP2KXiT/MeIiNHXZddipoUhGoJMBCn3+gugCylmXOxD4v4vLjLAKyqLyalt9FUpODLKOseJKdHERb3GcZFSIwwboI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467164; c=relaxed/simple; bh=et5DZ7n5KORvAoiDtJ0JUBn8tVnFZkzDj3nF+Usp6D8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gabuWme6i5ZhmGAKvtgHyCWpV/YMgM7RUm7BshdFUjOpXkdN/Nnk+FXBJ7NRbqgcqiwdOnr6Kjv3x/GMqihMTY01lB26d8Ql9fukFSWm85dof8i2f5eT4xhL6sjs/hl2fQqQfQWbuynwB20JKqkuvA6EMDxnpMSOiWQi1O37hek= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=PAKsfxIl; arc=fail smtp.client-ip=40.107.212.89 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="PAKsfxIl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UE7wSBtQg/cqTw6yqJyNK78WlEBknpdl3ftIuFtqmaNpTVxyJbR3pKJXhYnFDJDJ/4IWwzclGDF0PyfdMCmkUxOTiBqqt6QEhpSksk0GWYXICFiN9qziR2619BDGqcQotr0EGtqdHahckaCyOwMWyCw2NVwNX9Gp4Fjefa9Dxkqizz2MEVmGqxOKPQOr7PH2w0UUivxlERdmjw9wFUXW5wgkc6sk9LjA1FRczq9SFAk+YJQ/PsJ2pDBXzogje6HA6uFJ7iROj+9j/91nxHBsoHe5CmdYiU/eFRzz7UVPuIMG3TQ2xutSSJiSmYwB4FKTNGuSAYKEbll8BgZzfXdJGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WVQFvhScXI5bqgJiH88CNkIi9A9QmQibdv+hvsNLiDE=; b=m63H+/yraLba6NzDqO0FQaOCo1IwjQu57qa6ollpRfkUdO5Fk2djY9FrFTrXNErDwwofhZ0jlstLTkjxV94ArwGLz1AlnX1Jka/ZcJCmGCI5Lhd922jAZx/0w003Ii/CnkPOmNrWfMicKpeA/+S13GO18DZrlH5WK38soXpEaNZl2tJH+I4nTbRVex7IIxhuBvYJfJKL/DXbzUd+kZNcFiXrAVQPLBjksZd3NXc+SQA/ZldDSO+vGMzMDd3cAemsRCB9Z3H+Le2JiHrxu3IKgwQURJDOHjulOqwQCnO997W4Y+Yge6rzo0upmedezMFLzlf8Dq4+x4N6EHOb68B+2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WVQFvhScXI5bqgJiH88CNkIi9A9QmQibdv+hvsNLiDE=; b=PAKsfxIlvHtkbFjieWXUa4ISM7baVVCFB/uc0HKnNepx1mDY1twXOI1emFNdTriXikCsGkb09lRA1A/H1sYzae9vbu1TW0g9XPjpv0RZNYtQN7eyvG3UzgZ9cqrSIn2E9Mw9PPlaLDi2Dyx/ZVsIKN+TzPwt/iiKRs+0kQ3i7p8= Received: from PR1P264CA0043.FRAP264.PROD.OUTLOOK.COM (2603:10a6:102:2cb::20) by PH8PR12MB7230.namprd12.prod.outlook.com (2603:10b6:510:226::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.20; Tue, 20 Feb 2024 22:12:39 +0000 Received: from SN1PEPF000252A2.namprd05.prod.outlook.com (2603:10a6:102:2cb:cafe::aa) by PR1P264CA0043.outlook.office365.com (2603:10a6:102:2cb::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39 via Frontend Transport; Tue, 20 Feb 2024 22:12:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A2.mail.protection.outlook.com (10.167.242.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 22:12:37 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 16:12:29 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v13 2/4] EINJ: Add CXL error type support Date: Tue, 20 Feb 2024 16:11:44 -0600 Message-ID: <20240220221146.399209-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> References: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A2:EE_|PH8PR12MB7230:EE_ X-MS-Office365-Filtering-Correlation-Id: bce564b3-5284-4340-a40d-08dc32610be3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QWjigG1sflX/nOgM2UNuK+gu90teDvUvKYT3FXHhfF7ZZJQFvHDbAgU3GxzVizU4otExgbDAAFJ7/DfkiNHj9tTlz563w1cDBmlna8axAj/O0n9sKZ9yZiZl6FH7EBMORiAJDMsb18yloUF4TlOcnHoGJp8WfJGhJVFLa2FTFcjrFX7Vy/qK6UXTwAgqNqfyOn7UYhRp/oGiy/vli90m1LduQNr9bn19Jyc/teOlLYxqGhGS2IzitJHpLVViWn32M5tL8Rk8Qw694sVA8O6xgPisF7uc9qBQ1rdt/kSNGYruK6xK0RBF85GE+2BXuweSPSjchDBTa9ZnI7ocB3xqA/5XFmYOLbQCxKatVvjOtJ6S3DYtNAsDK6n/MoukGtSYSeKsF3/BQRMtHe4OJUS6yPE5BZ1Imh438o3jBkSzp1S9vFFPVKd7372yv8LY6S9RBdRL/qZf47IlVsH4DUD5tPVZkafG35tRLaxoJ0rWyNzrwGzMXcGJ1R5+Imufd+sXl0w22h5oL+jr9GHvQrqaYXlm8Thhj+ATmf0D8jQsXPxQd8Qn4SKGhaJ/fFunk6wEiD+tBTaYzhjxAx/RaMpFF6vANLP34QC2Wp7OIGGNwrAXd9umvMKcIu7QHnAlmzuMkjV6EyGLBiGMgEXopqyw0K84596Tfdiv8LH6H0YhvIg= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(46966006)(40470700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 22:12:37.1827 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bce564b3-5284-4340-a40d-08dc32610be3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A2.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7230 Remove CXL protocol error types from the EINJ module and move them to a new einj_cxl module. The einj_cxl module implements the necessary handling for CXL protocol error injection and exposes an API for the CXL core to use said functionality. Because the CXL error types require special handling, only allow them to be injected through the einj_cxl module and return an error when attempting to inject through "regular" EINJ. Signed-off-by: Ben Cheatham --- MAINTAINERS | 1 + drivers/acpi/apei/Kconfig | 12 +++ drivers/acpi/apei/Makefile | 1 + drivers/acpi/apei/apei-internal.h | 17 +++++ drivers/acpi/apei/einj-cxl.c | 121 ++++++++++++++++++++++++++++++ drivers/acpi/apei/einj.c | 81 ++++++++++++++------ include/linux/einj-cxl.h | 40 ++++++++++ 7 files changed, 249 insertions(+), 24 deletions(-) create mode 100644 drivers/acpi/apei/einj-cxl.c create mode 100644 include/linux/einj-cxl.h diff --git a/MAINTAINERS b/MAINTAINERS index 73d898383e51..51f9a0da57d7 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5289,6 +5289,7 @@ M: Dan Williams L: linux-cxl@vger.kernel.org S: Maintained F: drivers/cxl/ +F: include/linux/cxl-einj.h F: include/linux/cxl-event.h F: include/uapi/linux/cxl_mem.h F: tools/testing/cxl/ diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 6b18f8bc7be3..040a9b2de235 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig @@ -60,6 +60,18 @@ config ACPI_APEI_EINJ mainly used for debugging and testing the other parts of APEI and some other RAS features. +config ACPI_APEI_EINJ_CXL + tristate "CXL Error INJection Support" + default ACPI_APEI_EINJ + depends on ACPI_APEI_EINJ + help + Support for CXL protocol Error INJection through debugfs/cxl. + Availability and which errors are supported is dependent on + the host platform. Look to ACPI v6.5 section 18.6.4 and kernel + EINJ documentation for more information. + + If unsure say 'n' + config ACPI_APEI_ERST_DEBUG tristate "APEI Error Record Serialization Table (ERST) Debug Support" depends on ACPI_APEI diff --git a/drivers/acpi/apei/Makefile b/drivers/acpi/apei/Makefile index 4dfac2128737..c18e96d342b2 100644 --- a/drivers/acpi/apei/Makefile +++ b/drivers/acpi/apei/Makefile @@ -2,6 +2,7 @@ obj-$(CONFIG_ACPI_APEI) += apei.o obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o +obj-$(CONFIG_ACPI_APEI_EINJ_CXL) += einj-cxl.o obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o apei-y := apei-base.o hest.o erst.o bert.o diff --git a/drivers/acpi/apei/apei-internal.h b/drivers/acpi/apei/apei-internal.h index 67c2c3b959e1..336408f4f293 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h @@ -130,4 +130,21 @@ static inline u32 cper_estatus_len(struct acpi_hest_generic_status *estatus) } int apei_osc_setup(void); + +int einj_get_available_error_type(u32 *type); +int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, u64 param3, + u64 param4); +bool einj_is_initialized(void); +bool einj_is_cxl_error_type(u64 type); +int einj_validate_error_type(u64 type); + +#ifndef ACPI_EINJ_CXL_CACHE_CORRECTABLE +#define ACPI_EINJ_CXL_CACHE_CORRECTABLE BIT(12) +#define ACPI_EINJ_CXL_CACHE_UNCORRECTABLE BIT(13) +#define ACPI_EINJ_CXL_CACHE_FATAL BIT(14) +#define ACPI_EINJ_CXL_MEM_CORRECTABLE BIT(15) +#define ACPI_EINJ_CXL_MEM_UNCORRECTABLE BIT(16) +#define ACPI_EINJ_CXL_MEM_FATAL BIT(17) +#endif + #endif diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c new file mode 100644 index 000000000000..607d4f6adb98 --- /dev/null +++ b/drivers/acpi/apei/einj-cxl.c @@ -0,0 +1,121 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * CXL Error INJection support. Used by CXL core to inject + * protocol errors into CXL ports. + * + * Copyright (C) 2023 Advanced Micro Devices, Inc. + * + * Author: Ben Cheatham + */ +#include +#include + +#include "apei-internal.h" + +static struct { u32 mask; const char *str; } const einj_cxl_error_type_string[] = { + { BIT(12), "CXL.cache Protocol Correctable" }, + { BIT(13), "CXL.cache Protocol Uncorrectable non-fatal" }, + { BIT(14), "CXL.cache Protocol Uncorrectable fatal" }, + { BIT(15), "CXL.mem Protocol Correctable" }, + { BIT(16), "CXL.mem Protocol Uncorrectable non-fatal" }, + { BIT(17), "CXL.mem Protocol Uncorrectable fatal" }, +}; + +int einj_cxl_available_error_type_show(struct seq_file *m, void *v) +{ + int cxl_err, rc; + u32 available_error_type = 0; + + if (!einj_is_initialized()) + return -ENXIO; + + rc = einj_get_available_error_type(&available_error_type); + if (rc) + return rc; + + for (int pos = 0; pos < ARRAY_SIZE(einj_cxl_error_type_string); pos++) { + cxl_err = ACPI_EINJ_CXL_CACHE_CORRECTABLE << pos; + + if (available_error_type & cxl_err) + seq_printf(m, "0x%08x\t%s\n", + einj_cxl_error_type_string[pos].mask, + einj_cxl_error_type_string[pos].str); + } + + return 0; +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_available_error_type_show, CXL); + +static int cxl_dport_get_sbdf(struct pci_dev *dport_dev, u64 *sbdf) +{ + struct pci_bus *pbus; + struct pci_host_bridge *bridge; + u64 seg = 0, bus; + + pbus = dport_dev->bus; + bridge = pci_find_host_bridge(pbus); + + if (!bridge) + return -ENODEV; + + if (bridge->domain_nr != PCI_DOMAIN_NR_NOT_SET) + seg = bridge->domain_nr; + + bus = pbus->number; + *sbdf = (seg << 24) | (bus << 16) | dport_dev->devfn; + + return 0; +} + +int einj_cxl_inject_rch_error(u64 rcrb, u64 type) +{ + int rc; + + if (!einj_is_initialized()) + return -ENXIO; + + /* Only CXL error types can be specified */ + if (!einj_is_cxl_error_type(type)) + return -EINVAL; + + rc = einj_validate_error_type(type); + if (rc) + return rc; + + return einj_error_inject(type, 0x2, rcrb, GENMASK_ULL(63, 12), 0, 0); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_rch_error, CXL); + +int einj_cxl_inject_error(struct pci_dev *dport, u64 type) +{ + u64 param4 = 0; + int rc; + + if (!einj_is_initialized()) + return -ENXIO; + + /* Only CXL error types can be specified */ + if (!einj_is_cxl_error_type(type)) + return -EINVAL; + + rc = einj_validate_error_type(type); + if (rc) + return rc; + + rc = cxl_dport_get_sbdf(dport, ¶m4); + if (rc) + return rc; + + return einj_error_inject(type, 0x4, 0, 0, 0, param4); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_error, CXL); + +bool einj_cxl_is_initialized(void) +{ + return einj_is_initialized(); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_is_initialized, CXL); + +MODULE_AUTHOR("Ben Cheatham"); +MODULE_DESCRIPTION("CXL Error INJection support"); +MODULE_LICENSE("GPL"); diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 6ea323b9d8ef..e76e64df97a7 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -37,6 +37,12 @@ #define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \ ACPI_EINJ_MEMORY_UNCORRECTABLE | \ ACPI_EINJ_MEMORY_FATAL) +#define CXL_ERROR_MASK (ACPI_EINJ_CXL_CACHE_CORRECTABLE | \ + ACPI_EINJ_CXL_CACHE_UNCORRECTABLE | \ + ACPI_EINJ_CXL_CACHE_FATAL | \ + ACPI_EINJ_CXL_MEM_CORRECTABLE | \ + ACPI_EINJ_CXL_MEM_UNCORRECTABLE | \ + ACPI_EINJ_CXL_MEM_FATAL) /* * ACPI version 5 provides a SET_ERROR_TYPE_WITH_ADDRESS action. @@ -166,7 +172,7 @@ static int __einj_get_available_error_type(u32 *type) } /* Get error injection capabilities of the platform */ -static int einj_get_available_error_type(u32 *type) +int einj_get_available_error_type(u32 *type) { int rc; @@ -176,6 +182,7 @@ static int einj_get_available_error_type(u32 *type) return rc; } +EXPORT_SYMBOL_GPL(einj_get_available_error_type); static int einj_timedout(u64 *t) { @@ -536,8 +543,8 @@ static int __einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, } /* Inject the specified hardware error */ -static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, - u64 param3, u64 param4) +int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, u64 param3, + u64 param4) { int rc; u64 base_addr, size; @@ -560,8 +567,11 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, if (type & ACPI5_VENDOR_BIT) { if (vendor_flags != SETWA_FLAGS_MEM) goto inject; - } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) + } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) { goto inject; + } else if ((type & CXL_ERROR_MASK) && (flags & SETWA_FLAGS_MEM)) { + goto inject; + } /* * Disallow crazy address masks that give BIOS leeway to pick @@ -592,6 +602,7 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, return rc; } +EXPORT_SYMBOL_GPL(einj_error_inject); static u32 error_type; static u32 error_flags; @@ -613,12 +624,6 @@ static struct { u32 mask; const char *str; } const einj_error_type_string[] = { { BIT(9), "Platform Correctable" }, { BIT(10), "Platform Uncorrectable non-fatal" }, { BIT(11), "Platform Uncorrectable fatal"}, - { BIT(12), "CXL.cache Protocol Correctable" }, - { BIT(13), "CXL.cache Protocol Uncorrectable non-fatal" }, - { BIT(14), "CXL.cache Protocol Uncorrectable fatal" }, - { BIT(15), "CXL.mem Protocol Correctable" }, - { BIT(16), "CXL.mem Protocol Uncorrectable non-fatal" }, - { BIT(17), "CXL.mem Protocol Uncorrectable fatal" }, { BIT(31), "Vendor Defined Error Types" }, }; @@ -640,29 +645,21 @@ static int available_error_type_show(struct seq_file *m, void *v) DEFINE_SHOW_ATTRIBUTE(available_error_type); -static int error_type_get(void *data, u64 *val) -{ - *val = error_type; - - return 0; -} - -static int error_type_set(void *data, u64 val) +int einj_validate_error_type(u64 type) { + u32 tval, vendor, available_error_type = 0; int rc; - u32 available_error_type = 0; - u32 tval, vendor; /* Only low 32 bits for error type are valid */ - if (val & GENMASK_ULL(63, 32)) + if (type & GENMASK_ULL(63, 32)) return -EINVAL; /* * Vendor defined types have 0x80000000 bit set, and * are not enumerated by ACPI_EINJ_GET_ERROR_TYPE */ - vendor = val & ACPI5_VENDOR_BIT; - tval = val & 0x7fffffff; + vendor = type & ACPI5_VENDOR_BIT; + tval = type & GENMASK(30, 0); /* Only one error type can be specified */ if (tval & (tval - 1)) @@ -671,9 +668,39 @@ static int error_type_set(void *data, u64 val) rc = einj_get_available_error_type(&available_error_type); if (rc) return rc; - if (!(val & available_error_type)) + if (!(type & available_error_type)) return -EINVAL; } + + return 0; +} +EXPORT_SYMBOL_GPL(einj_validate_error_type); + +bool einj_is_cxl_error_type(u64 type) +{ + return (type & CXL_ERROR_MASK) && (!(type & ACPI5_VENDOR_BIT)); +} +EXPORT_SYMBOL_GPL(einj_is_cxl_error_type); + +static int error_type_get(void *data, u64 *val) +{ + *val = error_type; + + return 0; +} + +static int error_type_set(void *data, u64 val) +{ + int rc; + + /* CXL error types have to be injected from cxl debugfs */ + if (einj_is_cxl_error_type(val)) + return -EINVAL; + + rc = einj_validate_error_type(val); + if (rc) + return rc; + error_type = val; return 0; @@ -709,6 +736,12 @@ static int einj_check_table(struct acpi_table_einj *einj_tab) return 0; } +bool einj_is_initialized(void) +{ + return einj_initialized; +} +EXPORT_SYMBOL_GPL(einj_is_initialized); + static int __init einj_probe(struct platform_device *pdev) { int rc; diff --git a/include/linux/einj-cxl.h b/include/linux/einj-cxl.h new file mode 100644 index 000000000000..4a1f4600539a --- /dev/null +++ b/include/linux/einj-cxl.h @@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ +/* + * CXL protocol Error INJection support. + * + * Copyright (c) 2023 Advanced Micro Devices, Inc. + * All Rights Reserved. + * + * Author: Ben Cheatham + */ +#ifndef EINJ_CXL_H +#define EINJ_CXL_H + +#include + +#if IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL) +int einj_cxl_available_error_type_show(struct seq_file *m, void *v); +int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type); +int einj_cxl_inject_rch_error(u64 rcrb, u64 type); +bool einj_cxl_is_initialized(void); +#else /* !IS_ENABLED(CONFIG_ACPI_APEI_EINJ_CXL) */ +static inline int einj_cxl_available_error_type_show(struct seq_file *m, + void *v) +{ + return -ENXIO; +} + +static inline int einj_cxl_inject_error(struct pci_dev *dport_dev, u64 type) +{ + return -ENXIO; +} + +static inline int einj_cxl_inject_rch_error(u64 rcrb, u64 type) +{ + return -ENXIO; +} + +static inline bool einj_cxl_is_initialized(void) { return false; } +#endif /* CONFIG_ACPI_APEI_EINJ_CXL */ + +#endif /* EINJ_CXL_H */ From patchwork Tue Feb 20 22:11:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13564614 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2057.outbound.protection.outlook.com [40.107.96.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 102D0152DF8; Tue, 20 Feb 2024 22:12:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.57 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467179; cv=fail; b=h56d95ynfI8VljlSCyUM+AhYr00YRmsgDlbzqY+nACILuZvpJWZKTtVFppbO7afyY/kPZ6SxMF5NbCkcolIWNMsDkLIJBB31/7HlriSux74JYema2s8uxdn4NcmdmaYfxvIQf0Xy/CxMqlPzkVcTZoTWqztml9VwJSYcgG5hR0Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467179; c=relaxed/simple; bh=9HwD9KGWbTptEy7UVMaE5FLEGPhRUK/0tz49eWwxe9c=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tXh9zfgGefW1h1CuQ17jobpSFfacPwEZkt9dtM0MMjXC30/53S/TlEVBTNeoBlbq/LJhwURc/2/SgFYjwEBT5Dn0S0Z34qeMwPOgDOUJwcye9y4Jk65tZEvaBROFevB9pFe8/rIKSx7ufcixQiSJ1I0IHPHMP0aPN9fvt5rmhSE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=IFBVtdQs; arc=fail smtp.client-ip=40.107.96.57 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="IFBVtdQs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RQ6nSltXdeyvxHoyxTmbx/A0JSyDLyO8ZrERvzLqFrG6rHporDFEADN3YeN+7MEshZF5g5Tc9JOG/G+dW5em9yrkfFyhVjbvdAP6MDW6xR6F6MUXdlHKoqa6Yw9hKuNWEwi+KgVkr4hsetkXn5588MDWYVD/LwFh+Hry82XxMXRFJgX4OhTwKHClgdFUnKIVdyWrk+GEyxA7nNaI3HPOnzwsGr87JRCC1gBpU2cTD/RgrXoXvKacOEeTUygFF41FbmVjPGLLbh0SFWsPj54TaDnIwJ4K8P10gDf9ClHlx2SYaRQw+mrHFETIy9L/m73MbnYldX3Aj97O5YI2rg5t4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=fg0m92sRNdacpUC+fqCBZoYELdWS4tw+CqSlSR1Yn9g=; b=Mlvx2Bs+ZWoeK9IlVHU/qPm8bDOI/Syk8auEKpl5JTHG9oUNDvM8TtmesRlHHRJ8ck+OAHeVLTRu3uwMmK7xGiC3Y5sFI86xhFbd0uwFS7soo/6hgsQ4rcUo6r9NHDHQc85Lab4tUJEw6cqrES/bxvrJ2IgJvxmChHmR2FLAmjb9uGsV2DdGUQ9QhdHXEkSoKVh0lSm92XhwcHwrGqY2Jp+gasid8kxCeBGC5q/cbcNGjIY2m3Zqc/khPoODqU4P+YB3QMvirvvK/Ue63AdIaOOlUnbT2HEjAZOULFAg9ne8JZ3sUkaHmaiQvFaJhndz1gGe5/w3748yqvZjfZJHjg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=fg0m92sRNdacpUC+fqCBZoYELdWS4tw+CqSlSR1Yn9g=; b=IFBVtdQsCpcTTbKRkKRWjXoMOhiN5cs1Zrhf642v6gj1SghR1eKr+14L3G6ksyiyAbmkEi9E4fqGAmYBE2L29cpb3CzBWKwIL/7El7gw4RsvJUSeky+DxyqZSjs3aEtmBWT421CqR9TVYTQGwR7QwOzrQFcPWa2y+SEOyhAeOEQ= Received: from PH0PR07CA0014.namprd07.prod.outlook.com (2603:10b6:510:5::19) by PH8PR12MB7135.namprd12.prod.outlook.com (2603:10b6:510:22c::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.19; Tue, 20 Feb 2024 22:12:55 +0000 Received: from SN1PEPF000252A4.namprd05.prod.outlook.com (2603:10b6:510:5:cafe::5f) by PH0PR07CA0014.outlook.office365.com (2603:10b6:510:5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39 via Frontend Transport; Tue, 20 Feb 2024 22:12:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A4.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 22:12:55 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 16:12:50 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v13 3/4] cxl/core: Add CXL EINJ debugfs files Date: Tue, 20 Feb 2024 16:11:45 -0600 Message-ID: <20240220221146.399209-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> References: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A4:EE_|PH8PR12MB7135:EE_ X-MS-Office365-Filtering-Correlation-Id: 6a0f67cb-0252-48c7-53a3-08dc326116a1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1xYq5vlV9b/iMmMMg1aLXwlC02OL4cX9YebWhsKJgANDsAW3OP+Wo90UroxV3hpzsdlhBElV6kxcPYlZpwTCa+C6QDumMrYB3ttYg4GV0zofG8E0VfFhvHQHRV8aXJ9JYmb1NMyU7mbaLCIMn9ALdSU6irVuQF1SbERq3/tN4QiDNyhUhfx9i0bIXnr6Y8Y74CTnnZ0mD/ljt102DivQ8V+U4MVcAXTZ7EVEBPJ720NymCYP+j0TgqVVQqIFwWbutTo/mysvDEovCIpbkcjFjn1oIYmGZMkxYZ2ZSHI7P/DHX6ZuRlFAEQAVzmJ9OQLCO2/Yv80i+JtIdjjLBTNrE/DJWyC2JowBl/IlKB3kVrOKparNTeLRc9/3Fpj4byM481559Q0srSC2ZhBUiOtwQmK49zAatLP4c3hyfYgcpk9mw5strAm1OesMXscA0xFOznn3cS7CEO7BVBXuudkxtTRDT0mvm9HYXcxX07kjyV3IIdX72BvR9OmT2U0lEzLdaVD0BdoEm0hhSow8RTu4y1utWeSAKZ4ff+BK3kG6E+CpKhiwWx1D/vVsW5cFrJeiv7amm3MZ4+eey503RY5VmA9HwKk5HnW4NrLMj51kyTVmlvFnyHrljZJU7Hrw2iW5YantC/Zvx3efmOE3KfkrXCYHO1NrAi2r0dAVn9vYHS8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(40470700004)(46966006);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 22:12:55.2030 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a0f67cb-0252-48c7-53a3-08dc326116a1 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7135 Export CXL helper functions in the einj_cxl module for getting/injecting available CXL protocol error types to sysfs under kernel/debug/cxl. The kernel/debug/cxl/einj_types file will print the available CXL protocol errors in the same format as the available_error_types file provided by the einj_cxl module. The kernel/debug/cxl/$dport_dev/einj_inject is functionally the same as the error_type and error_inject files provided by the EINJ module, i.e.: writing an error type into $dport_dev/einj_inject will inject said error type into the CXL dport represented by $dport_dev. Signed-off-by: Ben Cheatham --- Documentation/ABI/testing/debugfs-cxl | 30 ++++++++++++++++++++ drivers/cxl/Kconfig | 1 + drivers/cxl/core/port.c | 41 +++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/Documentation/ABI/testing/debugfs-cxl b/Documentation/ABI/testing/debugfs-cxl index fe61d372e3fa..4c0f62f881ca 100644 --- a/Documentation/ABI/testing/debugfs-cxl +++ b/Documentation/ABI/testing/debugfs-cxl @@ -33,3 +33,33 @@ Description: device cannot clear poison from the address, -ENXIO is returned. The clear_poison attribute is only visible for devices supporting the capability. + +What: /sys/kernel/debug/cxl/einj_types +Date: January, 2024 +KernelVersion: v6.9 +Contact: linux-cxl@vger.kernel.org +Description: + (RO) Prints the CXL protocol error types made available by + the platform in the format "0x ". + The possible error types are (as of ACPI v6.5): + 0x1000 CXL.cache Protocol Correctable + 0x2000 CXL.cache Protocol Uncorrectable non-fatal + 0x4000 CXL.cache Protocol Uncorrectable fatal + 0x8000 CXL.mem Protocol Correctable + 0x10000 CXL.mem Protocol Uncorrectable non-fatal + 0x20000 CXL.mem Protocol Uncorrectable fatal + + The can be written to einj_inject to inject + into a chosen dport. + +What: /sys/kernel/debug/cxl/$dport_dev/einj_inject +Date: January, 2024 +KernelVersion: v6.9 +Contact: linux-cxl@vger.kernel.org +Description: + (WO) Writing an integer to this file injects the corresponding + CXL protocol error into $dport_dev ($dport_dev will be a device + name from /sys/bus/pci/devices). The integer to type mapping for + injection can be found by reading from einj_types. If the dport + was enumerated in RCH mode, a CXL 1.1 error is injected, otherwise + a CXL 2.0 error is injected. diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig index 67998dbd1d46..c86ae4c65c03 100644 --- a/drivers/cxl/Kconfig +++ b/drivers/cxl/Kconfig @@ -2,6 +2,7 @@ menuconfig CXL_BUS tristate "CXL (Compute Express Link) Devices Support" depends on PCI + depends on ACPI_APEI_EINJ_CXL || !ACPI_APEI_EINJ_CXL select FW_LOADER select FW_UPLOAD select PCI_DOE diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index e59d9d37aa65..3b579eef4d23 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -793,6 +794,39 @@ static int cxl_dport_setup_regs(struct device *host, struct cxl_dport *dport, return rc; } +DEFINE_SHOW_ATTRIBUTE(einj_cxl_available_error_type); + +static int cxl_einj_inject(void *data, u64 type) +{ + struct cxl_dport *dport = data; + + if (dport->rch) + return einj_cxl_inject_rch_error(dport->rcrb.base, type); + + return einj_cxl_inject_error(to_pci_dev(dport->dport_dev), type); +} +DEFINE_DEBUGFS_ATTRIBUTE(cxl_einj_inject_fops, NULL, cxl_einj_inject, "%llx\n"); + +static void cxl_debugfs_create_dport_dir(struct cxl_dport *dport) +{ + struct dentry *dir; + + if (!einj_cxl_is_initialized()) + return; + + /* + * dport_dev needs to be a PCIe port for CXL 2.0+ ports because + * EINJ expects a dport SBDF to be specified for 2.0 error injection. + */ + if (!dport->rch && !dev_is_pci(dport->dport_dev)) + return; + + dir = cxl_debugfs_create_dir(dev_name(dport->dport_dev)); + + debugfs_create_file("einj_inject", 0200, dir, dport, + &cxl_einj_inject_fops); +} + static struct cxl_port *__devm_cxl_add_port(struct device *host, struct device *uport_dev, resource_size_t component_reg_phys, @@ -1149,6 +1183,8 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, if (dev_is_pci(dport_dev)) dport->link_latency = cxl_pci_get_latency(to_pci_dev(dport_dev)); + cxl_debugfs_create_dport_dir(dport); + return dport; } @@ -2221,6 +2257,11 @@ static __init int cxl_core_init(void) cxl_debugfs = debugfs_create_dir("cxl", NULL); + if (einj_cxl_is_initialized()) { + debugfs_create_file("einj_types", 0400, cxl_debugfs, NULL, + &einj_cxl_available_error_type_fops); + } + cxl_mbox_init(); rc = cxl_memdev_init(); From patchwork Tue Feb 20 22:11:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13564615 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2081.outbound.protection.outlook.com [40.107.237.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5CB9941AAC; Tue, 20 Feb 2024 22:13:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.81 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467198; cv=fail; b=g8dMh1gqXMHwXjekE42CGLFimk9rfMr4CgGCfVO6yJMP0gbUDURsoroyCSU5APGZ4fj7SvH14zyTfgAfAubrKuNRlCy1/1wiYffaMGUyX1S142mSDO7kz9x5Xntc0Jr6cQO0U787UKZkShaqB7R98yvxPPQO9PVOs2usyc37Az8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708467198; c=relaxed/simple; bh=D4x+DsExJV9XUfdph+jiE9i9mkuhFK0JT0tqJzrmsTc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=izm3Gr/6n1HaypYlt9w4Q9kjdNz2P1odVjT/NR0RtzSREn4cncu+qAV0qiKIIVbAG9HAcORE73jc51cKKJ7MZeca3SDv3fQ93nAgv8Gj9kk3j4tdnYPARXJvmPXtovZWximmjY/CK0VkAro7FpNnqGDEvGEZDbzq48aHvRG3ArM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=SwkLONtW; arc=fail smtp.client-ip=40.107.237.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="SwkLONtW" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gmF1y+GYdXXXKQ5iP9St/SoxiQkamdUleiB3kxVpi9CdSzqNAPubNXugWD9ValXsq2ALp+6umDyQ2UJjVOtJAfyaw5GTxmX0sEYSLG+uCXWYrx2d1sQNnhXp3/cSxWQcLHI1clU+cZ50es2jaIOqEgqaXTAhLzvm+e4A3m5tjoDKP2LbObyx+EefhuhV1Zrvt1LZEEokw375ma+kPCgW/t9fk9liJKGnS6LScNUZp8QnzjCeKyGQCE3E+C0FwkYQV1bHD/ZE0l75AyzUnKfKCC5LEt/j2iA3aj5kcf9XrEqc8kUZZGvYFncxPuSDi37q7Ynoqu09qvVTJFBnAnb+gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qlxMyomHGM3/6tpI3AdRWHoeW+p22bBY77GnErVQa4A=; b=ZvtGjytk7LG6xPw/PzJ/qh1pTnD+SpNo9iyynePvBs6NdS1RyjzKb69tUcfUWKG1OQeDK7PWBWHmThjtrY8clLm8WaGasXlu6SZm3xU6bIULZwhwQx5y+Jtaf7kX+wJOr6QT2E8kvDFS30rNqMFi7FeyJN8QcJ4pSWUyx2lDpPAjj9Sq96+Gx/X/tCe6VS5sBEqCjSORUC5MptVZF6tVf7nBBnQOQl2lCR4C81qTpb+Rc6L5ADlZTERZk9D0koL74N/OvOhsmJV1uvr5IVJqxtof+JLIKLeVCY1I3IkxBKwIJyuwY6ledpuwCtfE0n0yFyhN1Jz4HfwZ+gIAC/KeNQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qlxMyomHGM3/6tpI3AdRWHoeW+p22bBY77GnErVQa4A=; b=SwkLONtWwMoow9t61kg4G4D34xcDMjhlcD5Xmc3uOAnQwFgVo6vX/XBI87ZVAShnbZTcLtxJkI/4DlpC+aloUGtnM7EkJnP0hAydOU5mU/kygkQo4QnV6nkpA4jkWWzqJU3djxs2cPrKxE8E1Zp8qr325ge+ns8RAg/pdaUjh+I= Received: from SA9PR13CA0082.namprd13.prod.outlook.com (2603:10b6:806:23::27) by IA0PR12MB8352.namprd12.prod.outlook.com (2603:10b6:208:3dd::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.20; Tue, 20 Feb 2024 22:13:13 +0000 Received: from SN1PEPF000252A4.namprd05.prod.outlook.com (2603:10b6:806:23:cafe::e4) by SA9PR13CA0082.outlook.office365.com (2603:10b6:806:23::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.12 via Frontend Transport; Tue, 20 Feb 2024 22:13:12 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by SN1PEPF000252A4.mail.protection.outlook.com (10.167.242.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 20 Feb 2024 22:13:12 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 20 Feb 2024 16:13:07 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v13 4/4] EINJ, Documentation: Update EINJ kernel doc Date: Tue, 20 Feb 2024 16:11:46 -0600 Message-ID: <20240220221146.399209-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> References: <20240220221146.399209-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SN1PEPF000252A4:EE_|IA0PR12MB8352:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ed64091-f0be-4990-9c7a-08dc3261212e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EeD7kALFmnKjTAOacbahXxyY4J+BCJa/+8QTb3vanp5tFoOuu1Z3hwlkdUuH35jfsDEf24LNqrBlqzVLyhxKOxnKjHlxSwG4j3/5CXD9dXE3tN8B3p+LoIplQhqgJ7pRbCm1g1DoZ83fqBw1yn8fBf+gINBGtg+poY2Xmeb/gEWzTDak5yF0N5jRU2ApuUelIp/QY2E6GVSCGVqgG44DMUnT4zi3m4OCDRCEYE+vVpl/u14IxHw5LFcJQTkne0H/DGChFdfv+xnEQBOrBPwirmhsulJBGajmISoTYBiCb7OJBY6uQke2KVKFgDps2fWRAGQIoFfRY6QDTzd8UW0Q5QLCwDSw+yJ/uYSwX9+HlLu9ayk0Nz5a5hu8L7LXb1CGh1OS9YhbWJHvoVRoUN94t4dfMxN1yf3qBWGr2Nc+m24vmVQN/kOsJvfBqfc4AEsBbC5u3RllJum4izRvkHRpznnn4KYbCfhx0bOqkQ4NFqWwe5w1gueO/CLfn2gW5M+gL8EGeUXeRLibtzQAGCC1WX9dkL1gKzec+Q6lmEQXWQMwVE487AHWKAtLEOUZFVyy+bp3daRkmqQM2GsoYEKa6hArhI0Nv6e9fP6HEt1F/VmXA0CAKlUVOdT2nA/ww5IK3K+C93JX3luknfbalgHUKQ4LmPloNKaQ0t/VwuwLMf8= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(36860700004)(46966006)(40470700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Feb 2024 22:13:12.9218 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ed64091-f0be-4990-9c7a-08dc3261212e X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: SN1PEPF000252A4.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8352 Update EINJ kernel document to include how to inject CXL protocol error types, build the kernel to include CXL error types, and give an example injection. Signed-off-by: Ben Cheatham --- .../firmware-guide/acpi/apei/einj.rst | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Documentation/firmware-guide/acpi/apei/einj.rst b/Documentation/firmware-guide/acpi/apei/einj.rst index d6b61d22f525..23741ec0de75 100644 --- a/Documentation/firmware-guide/acpi/apei/einj.rst +++ b/Documentation/firmware-guide/acpi/apei/einj.rst @@ -181,6 +181,27 @@ You should see something like this in dmesg:: [22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0 [22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0) +CXL error types are supported from ACPI 6.5 onwards (given a CXL port +is present). These error types are not available in the legacy interface +at /sys/kernel/debug/apei/einj, and are instead at /sys/kernel/debug/cxl/. +There is a file under debug/cxl called "einj_type" that is analogous to +available_error_type under debug/cxl. There is also a "einj_inject" file +in each $dport_dev directory under debug/cxl that will inject a given error +into the dport represented by $dport_dev. + +For example, to inject a CXL.mem protocol correctable error into +$dport_dev=pci0000:0c:: + + # cd /sys/kernel/debug/cxl/ + # cat einj_type # See which error can be injected + 0x00008000 CXL.mem Protocol Correctable + 0x00010000 CXL.mem Protocol Uncorrectable non-fatal + 0x00020000 CXL.mem Protocol Uncorrectable fatal + # cd 0000:e0:01.1 # Navigate to dport to inject into + # echo 0x8000 > einj_inject # Inject error + +To use CXL error types, ``CONFIG_ACPI_APEI_CXL_EINJ`` will need to be enabled. + Special notes for injection into SGX enclaves: There may be a separate BIOS setup option to enable SGX injection.