From patchwork Mon Feb 26 22:27:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13572984 Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on2041.outbound.protection.outlook.com [40.107.96.41]) (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 80537132C2A; Mon, 26 Feb 2024 22:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.96.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986463; cv=fail; b=cfzBSxpVUVttr1uOCxFRFygld0SwVIHQ1aVgIOt8Mgoe8TRjDvDlSuh1DXEnjVIMDhTpvdm29do25MZeaWpgUfHtNbD5aqVZxM91oYxLEQEaJ/arjon9Vi817AHaZxjZOIwJBGX2rr5xAQqeeHPA4xc7AtlEd788MGb0uRhVNoQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986463; c=relaxed/simple; bh=2hwaJ8e9qQWyGwPIKY/lKedGV/2rnKpvY1/D7E9lxig=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rf9svipnJQxEIPVXx8SftMMfvtsTir2I9B+qTczJlFv9UeMANgg6qQvSGGq+aX4CRkN4dayTKvjihFw+ust16fwkpRJGJiVD9MW/mU18ap3bJy9RCyAeIrxIJ+ue4EaHISXr5mnDUuT7I8dPSBXiMnSnD8yZqKF9Db0cfI10FCI= 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=KHNrxI7T; arc=fail smtp.client-ip=40.107.96.41 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="KHNrxI7T" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NJU6opDY+pox1zjCanBEQHs+lC9Z42FjPwKhDMsjUfIMxgJTsmFXIpw2zEvEEGi4zKcQYloKPT+Iic2vRP9MOG3IdKybwptKPgleYGWjgwYMnIQ/NjLW5qfAFcwUFvMPVWq/tB1DrXRm9Gq8Yknr31yJnLemYbsa06abGbftlddb+/4pXDs6xnoOw5O9cUaEP8u9q4yFG8ymo7BwCFxp2QLgB1Vw5Fx8j/A+NR3AED0/vd2moCGMmkQvduga0ufTA3Hu/KWbXSWeLViK1DHFss6NDuDO5CmsYnj0dQ0E7o3+F+lw1JkDQzuErO2j3W9DA7ajGG7nk3UlOSIDjGjrDQ== 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=vBZUOZ4/q9CTxMtpNhn3kQanHJCWCdAej3tYZHaDaHs=; b=oS+AL8HojTC6RBTHW5wSClJ6kT7xpyOLNZVksIN66p+h5ecw42X3xCP4mdZvsYyo9DX0LvMdb1aXbkBFzx6t6UxGdhtcXlsVXBHCINxx+4xXmoTwZW1Z30TW1ia35e11nRm/mZG98mxe6oeJ+PY68R1vx1jgFhzv7m9FQJTFSfegOjI/4G7MhtMKggeJtl7RDYqcHZeauCMdFSjw9Zyk8drMEuViUkbae8amsE/L9w1Dq3A77PdLFi9qnDx3BaMn1aDxgsj7ZvM4mtGIanSljq0MH+WKjskJl8XVME7oUBeOQNECpEPiUr7HjIcIza6usbYIZfG9LEDvT23FFZtdpQ== 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=vBZUOZ4/q9CTxMtpNhn3kQanHJCWCdAej3tYZHaDaHs=; b=KHNrxI7T7OPXEIwjXuO/f63TDaD8fACNNBnKtcpvMFNbqE2WwYriNwYuueiT0Y4fDdnqHzbu37NthNAjAlMwY0+2mKFGJCe9/hQxC66Qs8ywdNiuOrKegXomiJqKe18/DKBshbnilyRdgsq/fFlgtqIG8IZTJlif/bMXjtOIpTc= Received: from DS7PR07CA0006.namprd07.prod.outlook.com (2603:10b6:5:3af::16) by MN2PR12MB4519.namprd12.prod.outlook.com (2603:10b6:208:262::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.36; Mon, 26 Feb 2024 22:27:37 +0000 Received: from DS3PEPF000099D8.namprd04.prod.outlook.com (2603:10b6:5:3af:cafe::b1) by DS7PR07CA0006.outlook.office365.com (2603:10b6:5:3af::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 22:27: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 DS3PEPF000099D8.mail.protection.outlook.com (10.167.17.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; Mon, 26 Feb 2024 22:27: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; Mon, 26 Feb 2024 16:27:32 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v14 1/4] EINJ: Migrate to a platform driver Date: Mon, 26 Feb 2024 16:27:01 -0600 Message-ID: <20240226222704.1079449-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> References: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@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: DS3PEPF000099D8:EE_|MN2PR12MB4519:EE_ X-MS-Office365-Filtering-Correlation-Id: e7fbeef9-d18c-4d7e-ca2d-08dc371a22f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HoPwtKDTDB+DUgfnFgbGq+VDFSYCXg9rhn90sNQzukM1WWzJo1xY7qmYDaFhO1ga4f+cUm1Pxcx/DQRQuIuD7MhoDJWztQAMUrQyceqIsTVGLZ0j3LHYlxuzeE8qAPpJbNWLYsYkJc+tyn7uD39GlsrHERhT78Of8vmDuTdrnYEljjUEC1vM+iK7sqPEwky8B266/X83FDe1h52jYN0fqEl0lmy5V8ytDoaHqxeuWJEFaVA4g4H0QygGerCBv7+bYkBCAESPkOadmv1YOCAWc2ZfOAaJbceYR9UINGvYKiOA+UXp/pMiCr567NxPX0eqc3LNWQ6UWaOnt4GvbKSbTb0vqfHfpH1uEf9T3CT39D9s/a2Z9uT+5l5DyaijoHoT3EaHdr9ta+tQcdZQ1zWcEJBtP770EHo1lmNdolaZzTLxLlvUzBjcg7q8SdALH4fIut5QfWgo9GYZFLK714DGxhsZ0yPNJSSU7Ca6Mv3y+K/KIzUBsb3Rrn6LWvrkutpfy9uKTkBQ63PonTevpOeGMzexnnat8CyKbAz0gKJyI4OZFTKo+UxhkODL++GPAJWy9Ji54LxtYiV7fyU65P4ZqS4RTf924fIpvgbLmlAQaOOc5uk32Yl3abzB0/4tBnQmOg4HQ8U86s0gvGq8zLe0xByaPrr30oIMRgyVYi2pBCKTzKa0NSV6mynERAGo3MhqufehwXvajdRH9AHzNosIU4pou3GdL9PfWqTdk7td6LSollwh1i91TE8SjtTxEc9x 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)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 22:27:37.3990 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e7fbeef9-d18c-4d7e-ca2d-08dc371a22f9 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: DS3PEPF000099D8.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4519 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 Reviewed-by: Dan Williams Reviewed-by: Jonathan Cameron --- drivers/acpi/apei/einj.c | 48 ++++++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 89fb9331c611..937c69844dac 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,21 +709,21 @@ 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; struct apei_exec_context ctx; if (acpi_disabled) { - pr_info("ACPI disabled.\n"); + pr_debug("ACPI disabled.\n"); return -ENODEV; } 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_debug("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; +static 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(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 Mon Feb 26 22:27:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13572985 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2049.outbound.protection.outlook.com [40.107.220.49]) (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 A37AE132C2E; Mon, 26 Feb 2024 22:27:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986478; cv=fail; b=YzCT06N/x3+zeZ3yHEEuh5j3v0XzHgshWA6VeH4Nsz4UUtZOsq+/F9Hie9AX/q8X640YntUKJw+wC3mJky8VPUOSM4IJ53XDgYTP6hPznB8YMQTokYkdrWZ0FZULkdMe2O1yODXsT6rISLjI/1KjT8IDnLh4oOTxtAVgyUicg5Q= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986478; c=relaxed/simple; bh=bSkeKSHBNvKfA17GX7h08MgEzqdmbqyhtPyhTavKUbw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lDqxFEGAK2MShFTrUOvcHV4EaTOkZEZma+xwXkb3SCcc5MkhxG+XuhD4FoF/wr8uKUsUjUFiqaCAci0SHW//rzju/Cs9RYsFTCMOXJineDMJ8pIwPycZpAjTWZcbI4DYVPK42Py/oTB1WwPZUwtnmjQO5/U5zxJNeMhddDl3GU0= 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=VkbNiS16; arc=fail smtp.client-ip=40.107.220.49 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="VkbNiS16" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S15Ofp44Y7aDqOvV3D3G8Vz/VArEfv6hrmfrPn4G84h4Bf2DUTG9A89lMEFG+yxPsxUkaffylfNpvx+yGN9RMi7fgWf8OPxDCe6nnw9O+4DDSSm884S8odVgvLDsdhoFC8GLmfdaQa0QO9Ihbqi+DR6C0GGwHYY6XY1VkKisS34j99ZvMrkO5sIG9KkuzBiIYNgO6IAuZFHG2yOof5GO7i+pd8aacTYxK0+xfl7p9Pfxyjw0YAA5B10OxKjJXCOOnPDm5Lo9WwoeLQLFdoFNOTL99ZaipucnXUpFatAw4fH3IOMZHbjtxWREKmenUsD5b25sN9cg85l9gBdaOQ2tmw== 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=F4YxU/AZ7s74oS9DoBjfIW0oQOX/NVlJ3YU/SCFjzUA=; b=R00ZyO2e41IbIM+SVPph10jhXDECMAF1fet41ElM/d+BatG0Ij13pad4NmSoGXHl61V+ZarIHwXFWG68KzWfojz/Ls4uH/RFG6hx6YkWsC2SCrsNpAPUMv64yluqe1SppUtqWguRtHPzavgjZD/LZcJaNnH6m+aPKpqST4CohDXJt/ENbUCfpBScSaPSOXx/9JDciA56EhEDyHsYQbzk/qznUnlMPc57bOqMbphVcxdNta5QQXEuUAVZ2HIWrrc/qk/rP7eUT4D8lF8TrNFeJUhh095JF6XGA+bqxOSJVUT8tTc0zlrOcqQHB8lXjCOXGns45IZtW/e6kgma65r4aA== 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=F4YxU/AZ7s74oS9DoBjfIW0oQOX/NVlJ3YU/SCFjzUA=; b=VkbNiS16aqjvy/aAmqoRjvWPJmNEJrXsUjiWSJCgMssbDyFBTwBles4fUum4g/2FpfWCgPA41L0ZTXUIe4xwOFdzDyaq1gJj1pqZ0jloAfjAHTtg+HXQ7adRhdWrM3CSOE2LGcWQfM2C5f1kvDEA561s4gYA/mF2gieVIPa4w20= Received: from DM6PR07CA0090.namprd07.prod.outlook.com (2603:10b6:5:337::23) by CH0PR12MB5265.namprd12.prod.outlook.com (2603:10b6:610:d0::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 22:27:51 +0000 Received: from DS3PEPF000099D7.namprd04.prod.outlook.com (2603:10b6:5:337:cafe::26) by DM6PR07CA0090.outlook.office365.com (2603:10b6:5:337::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 22:27:51 +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 DS3PEPF000099D7.mail.protection.outlook.com (10.167.17.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Mon, 26 Feb 2024 22:27:51 +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; Mon, 26 Feb 2024 16:27:47 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v14 2/4] EINJ: Add CXL error type support Date: Mon, 26 Feb 2024 16:27:02 -0600 Message-ID: <20240226222704.1079449-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> References: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@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: DS3PEPF000099D7:EE_|CH0PR12MB5265:EE_ X-MS-Office365-Filtering-Correlation-Id: 6b683ff3-ac45-4ecd-e21f-08dc371a2b3d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KVNDy8cQc/Dd91P0ogT8dE7VvvLhurM3Zp3X6VOQuMRpnn++NWmq4WG6PWT9Yf/b1e0t+Hk7W13SdXcF75TmDiv6LGoauE7ATF7lyD2KX0kn8E3T6xKld3i6U+unxPUnI0OsjFe3ejSqaHt7lHZzUM0nOl2KfLJeSI4VgznM22Q9d9n1ONv6dLhrs476yFTr4v0FRY9V9gacNooS7s0MEDJyQ3FrRQ0L65tuNbY2pycjlMGjJSaGcoJyXLzWgCoqIOwKEH7FRkPz+/zCcBtGGEDG9r9Vi02me/dGneSgixnNa79Kdkpz2VNqg9oqCUKexbJY1F7B3k9VX5IgbEXOAPy2l6idUvUVSFkDRrCJHzoPs8RMaPKDUUemThxKjDQRy+1UUcjri+eBZUtXARkdOTP7xSDEfNHCTbNOBx8iTkka3Y2cAT5KwGlcAbjUhN/R8axgE7ypHTiwg+D68xbrn2M7lswRn0gQUmLDRr52Hb58OqPzUgPIALXvzz6Zw9zBTdH3tV1pv05LffFkqQ1rOqXDPlvvWkHTK8FPwPG77a21mFKDPFS//JSs0vXukJarbYR7WgWw9XJtLAsFLqTVMaIrq3oR8aMhO7QWxUXJqvCVi5CzFI99H67IJNqOfY/aqiOngEAvgNs9J1Vh5e/tliN+UPdCaUiCFsFjGyay/aFrhuSMp2Z2LPrb2PFGR5oXain8fSv4z0hEuOOdbyJnoOCgWrgQU3yAOwY4osKwaEqdYz6DMwwbje03DUX4QEV5 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)(82310400014)(36860700004);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 22:27:51.3139 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6b683ff3-ac45-4ecd-e21f-08dc371a2b3d 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: DS3PEPF000099D7.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5265 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 Signed-off-by: Ben Cheatham Reviewed-by: Jonathan Cameron --- MAINTAINERS | 1 + drivers/acpi/apei/Kconfig | 12 +++ drivers/acpi/apei/Makefile | 2 + drivers/acpi/apei/apei-internal.h | 16 +++ drivers/acpi/apei/{einj.c => einj-core.c} | 78 +++++++++----- drivers/acpi/apei/einj-cxl.c | 120 ++++++++++++++++++++++ include/linux/einj-cxl.h | 40 ++++++++ 7 files changed, 244 insertions(+), 25 deletions(-) rename drivers/acpi/apei/{einj.c => einj-core.c} (94%) create mode 100644 drivers/acpi/apei/einj-cxl.c create mode 100644 include/linux/einj-cxl.h diff --git a/MAINTAINERS b/MAINTAINERS index 2ecaaec6a6bf..90cf8403dd17 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..f01afa2805be 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 + bool "CXL Error INJection Support" + default ACPI_APEI_EINJ + depends on ACPI_APEI_EINJ && CXL_BUS <= 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..2c474e6477e1 100644 --- a/drivers/acpi/apei/Makefile +++ b/drivers/acpi/apei/Makefile @@ -2,6 +2,8 @@ obj-$(CONFIG_ACPI_APEI) += apei.o obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o +einj-y := einj-core.o +einj-$(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..ab039d24cd22 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h @@ -130,4 +130,20 @@ 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_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.c b/drivers/acpi/apei/einj-core.c similarity index 94% rename from drivers/acpi/apei/einj.c rename to drivers/acpi/apei/einj-core.c index 937c69844dac..1a5f53d81d09 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj-core.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. @@ -141,7 +147,7 @@ static DEFINE_MUTEX(einj_mutex); /* * Exported APIs use this flag to exit early if einj_probe() failed. */ -static bool einj_initialized __ro_after_init; +bool einj_initialized __ro_after_init; static void *einj_param; @@ -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; @@ -536,8 +542,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 +566,16 @@ 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; + /* + * If the error type is for a CXL 1.0/1.1 port then skip address + * checking here. The einj-cxl module should have already verified the + * supplied MMIO address is correct. + */ + } else if ((type & CXL_ERROR_MASK) && (flags & SETWA_FLAGS_MEM)) { + goto inject; + } /* * Disallow crazy address masks that give BIOS leeway to pick @@ -613,12 +627,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 +648,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 +671,37 @@ 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; +} + +bool einj_is_cxl_error_type(u64 type) +{ + return (type & CXL_ERROR_MASK) && (!(type & ACPI5_VENDOR_BIT)); +} + +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; diff --git a/drivers/acpi/apei/einj-cxl.c b/drivers/acpi/apei/einj-cxl.c new file mode 100644 index 000000000000..34badc6a801e --- /dev/null +++ b/drivers/acpi/apei/einj-cxl.c @@ -0,0 +1,120 @@ +// 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" + +/* Defined in einj-core.c */ +extern bool einj_initialized; + +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_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_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_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_initialized; +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_is_initialized, CXL); 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 Mon Feb 26 22:27:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13572986 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2040.outbound.protection.outlook.com [40.107.243.40]) (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 49938131E23; Mon, 26 Feb 2024 22:28:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.243.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986489; cv=fail; b=Q8cbdg+gyQ55YZI9tQ4vBg0sQ1o4qim+bbK3AZ1qXxXfWha32RiFBms4U8SIJivPZf3ZIRUaF23CCInKOSuORwkCl6m6UnQmHLt17zMDyMLewdBwx6OjFk25qe76+PoSaDRdgAJyyGKdase2VwQw7uGaD3Y3+Gc5Q3ZCZX7l/fg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986489; c=relaxed/simple; bh=ZN/HXXAlnqWE4jwnaBx2xKnUOsErrxKflN7W5Pj96dY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YNV3y5QLwkRxW6brkDun6wWySz5RJ1XqV/I0CrF2glsFxlDSjUJwF+YBQIxxOWayGjx0hD6rM5F0Pwq3K5i2/gPhtduxykneAt19Mjrm8U0Dj0butpKrwvwcuvCmcJZY03eggDo4/SUdPtBly+ymUJYr10Ns7WRkjbKeDZx0zNg= 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=BWBGRAqk; arc=fail smtp.client-ip=40.107.243.40 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="BWBGRAqk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K1sKDG7I85S6QN3y2x26nGP9Lu1Wny6wM55a9gYMSi7qFVROO3sVS0kPMQRrJ7GV2Md95QqzGy1qfJZd5k5tbLfrkZ4erBSLbMTF/tThQb6Ek8uRSz3BB/Od/jdtlqj2GgvyCtt0m1u1MNSnjjQ2uvV+y3QpjKuQPBO/M5zrpYz8ilq2pqf/bsYjZAEvkB5mxZ4Aht4XGdOQ/k85JaX2Hxc3+kii60dMv0MLG44B7JqCwfWZU+pZJipHq2PuJAwDacQAO1HsKaCXoBxd7M4vSdyILsQASZfYsRwaLNUOhWCs7OdW1B6ikDa1zr/GlCr+e4SMvxbBYKtnbr4x2xwNpw== 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=GGrOlPxQObimuLPNMs7cp1YZafu8dhqt27Y8dKSzDvg=; b=lyVKi8VViUTahgGZEhCM+cLwjPYDveBJ8EVtQxI9sC2to7EWObUOwY/0blp/zzdQnzRqQEVTJ5ZyOxL3ww78WT8sXMVc3hOzYuynk/CIhenfAHFk21T78vDrNRmx1WkjK6Z2fwJdsdo7lIatAsmwxxEyo1AFUTpW/UWfBLzygpr1r5DDfjFEWX7WAciFMD/hYLjq1n2CJbpj9DPjbeSteTwHdxmWHPDR5ig4eUnQbDzFfLWnBe7uf+shyLQeUp8ZzVoUUxKHK36fnoiJPGck2oMJWqLiiqgO0CpZhMeT7BPBHH5jVWYn9UZA8czLa/T100LTUYWlqsWLZw8DV97unQ== 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=GGrOlPxQObimuLPNMs7cp1YZafu8dhqt27Y8dKSzDvg=; b=BWBGRAqk8TbimBBUhP24dYR9hvOPYafqeBPGEjTBVPnmXq2P5nBfAIPjQxd2ny1jcgOULZ0CKGP/mj4Zak2TWe7Y+bBZEYmMBpeXz+ariinAVB7O8DXZJgs2exFVQ1PHQ5StrMAv1PRiNzbaI3tWEsY0y94/Z/eiTcsrXEXQclc= Received: from CH0PR04CA0048.namprd04.prod.outlook.com (2603:10b6:610:77::23) by CH0PR12MB8462.namprd12.prod.outlook.com (2603:10b6:610:190::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.34; Mon, 26 Feb 2024 22:28:06 +0000 Received: from DS3PEPF000099D3.namprd04.prod.outlook.com (2603:10b6:610:77:cafe::57) by CH0PR04CA0048.outlook.office365.com (2603:10b6:610:77::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 22:28:06 +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 DS3PEPF000099D3.mail.protection.outlook.com (10.167.17.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; Mon, 26 Feb 2024 22:28:05 +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; Mon, 26 Feb 2024 16:28:01 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v14 3/4] cxl/core: Add CXL EINJ debugfs files Date: Mon, 26 Feb 2024 16:27:03 -0600 Message-ID: <20240226222704.1079449-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> References: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@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: DS3PEPF000099D3:EE_|CH0PR12MB8462:EE_ X-MS-Office365-Filtering-Correlation-Id: 8d48c8e3-f54e-46e9-1fca-08dc371a33f9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: t5Hc6YYu7sKj520eirTCjEAqVI3RXgFLembQrw4i6+leNSdP9zF9raycg3/9HInZDcdKwzMBSPeWqsN8zpjThwElvXmOcNjnTrwBaJmoxkPnwaHLhZNDOXTL2HPTv5dyPF8APj0bUx68KVBlwaluaQn40iU0T1VluxYa1w/WOILhjIUeoqZDRCIGfYpCVRgocm4czZ7K8uIHo+KdGXKV2tkySOHxA+2Rt8BRw/vV/+qgTN1YM8Iou/2Y0ZvdSSXJm7wibcZl34EPX+Fv/j4yG3JQykx1fvdoRTHnuj/uB+U1bQ2fn2Ghb8WrSbefBiZ0uqlsNg/Vam+rP+WppU3p9Rb4DSLTCZKWQ6YP6CaUKsAb9NCEI9oYvBAB4xmw4kwhNV438JrNmeQX5mhQglFTRIh57Zf3FJU17nXr36BHSKZE9ixmm/KWonIGfl9mnhUscSRBN2gYJB2SGw+J0s2yyVjHVosXW/tyx4jtN5HWEPByVe9RVpX/CV9KQQKdN+dY7vc2h7lxKlBH2fcEz1pWMfI1dYVi2DQW8ZAPlGkrvEgXhpL7ybcx9tectp/fAuivXEb+M+l6M5iNnc/stfWoPXD1hn+Gi9UguoOU88JiNQTm2Qdknqf35YAVLjRISK9nM8jQgncE2eEutjaJgDuuRqrO7c/d1LqMIYjNXSKlj6xgWcD+2eWheWb39+AOXEp42UIPXR1ABjHTnje+7MItuYJXj0NAIBVz5Qo0Rn281JQNKSPp0eJ8D2wyCz4V05RI 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)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 22:28:05.9628 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8d48c8e3-f54e-46e9-1fca-08dc371a33f9 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: DS3PEPF000099D3.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB8462 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 Signed-off-by: Ben Cheatham Reviewed-by: Jonathan Cameron --- Documentation/ABI/testing/debugfs-cxl | 30 ++++++++++++++++++++ drivers/cxl/core/port.c | 41 +++++++++++++++++++++++++++ 2 files changed, 71 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/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 Mon Feb 26 22:27:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13572987 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2069.outbound.protection.outlook.com [40.107.237.69]) (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 D267D131E23; Mon, 26 Feb 2024 22:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.237.69 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986506; cv=fail; b=QaA88hqa03jiDsb4eVbQ2ipmwjcIug174RNRMKPafueDyMlnIs8V6BA4JiUl8h9Br1v5XVpVcdbjgW4kDy6mBxMfWR/S3CJoGjV755DotCgmp65Fsl3vQx+hhtWr49e8sB7nnO/FAiTFJDKvsLVIBbZgsXfnw4b6Un5dTIldK7k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708986506; c=relaxed/simple; bh=s3xALJvAIsNNWPniotW4fplEx5TTsSSVSTXwvrr/e7E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fG4SVX07SVe5etJfyV5GgT0ZoG68qgQtXWXiShrEFnEif3/7S/xRKNbiFHBe2B86T80yBQuxTZfuxj/cjXWRflCiES+MSfU49DgekI/W/w4net3fV3baOieOeC7RQA+KjEDH9LKTTg2YVMppzqqQ1Bd5DM+gKBPUL+Ct0ybOe2U= 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=cu3lNsiI; arc=fail smtp.client-ip=40.107.237.69 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="cu3lNsiI" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ITEmBMBMaIYW59hp5itZc2Q1tRkCRHZFxv7TjYQXL8DmKyI7aIZGjFaWpnqG4nEj6QinAZ0I3s/PuwkL50Kl+1OasBjljseVLcLZF0QSYtmEGcJRZzhLMkKdnqhuw58FPl4m90+FaLluqPml0epb9OxT6VPJ8wvQ74aAuoxatFWbCxGZTsysrcMTPrUGgzjRexR0jzmdLM+6y4Ye8Wx0+wzg7N4C4MZFKjX5Gv/GBBee5vjs01lnf7q9HFJRw5WW5b/iS+J3HWQYiolwOjpLd3+eChv6Li9LwWRuIn5JdkR8s4Zoq0pislDl8W2FjzY4Eb3W/+y9gPfYRtG00DRR0Q== 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=I9gip4Z8xkai3SeEkYmh5ADlDrXv0++QsVpTTfmRjmI=; b=A27CC9mZBQ1Tewu6jzelvk7Rt+ayVhC9SkspRnzOztC7xA1J9LZqcolcN5gfWDoyTgOw8Z8aAXhMynMvDSWKguLNrW4rzsJv0ORBcxPQXWUc++s+8yNY2xEVvrxMwstwJyC4G608uuBa7xi0EKhgoxSS0dIpa32O8udlFAEcYnhiIi4xIzPfVozR03eZJw/pnySsmxGYMm3EWY+Hd3wSXgXPSNHLAhWyDksrmX5sEh7SmyZD+McBL2YoqbMeTlO6S4q8Ic0c6LSpvsYQyKbKhV9NGTrFmXK6Z9vHk/QjhVFYhIK7FcaeUzfTV7s/riMQzp68pYMjcSueMNVD70Ojqg== 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=I9gip4Z8xkai3SeEkYmh5ADlDrXv0++QsVpTTfmRjmI=; b=cu3lNsiIraDilt4o8LtqT/rSDb4nih5TV2fLLCIxOsC6H/8bR6x6GUv7vgVAVMGB492BJpjZuo4Rjp4aMukKbBoDVhoWWmI1/xi8+bAS2wwlx9yIoE9Mv9tWxwEW76f5Qxs7fHq1krGWxgULa59+c+/S4dnx2+dhhisOjXq4864= Received: from CH2PR11CA0011.namprd11.prod.outlook.com (2603:10b6:610:54::21) by IA1PR12MB6138.namprd12.prod.outlook.com (2603:10b6:208:3ea::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.23; Mon, 26 Feb 2024 22:28:21 +0000 Received: from DS3PEPF000099DA.namprd04.prod.outlook.com (2603:10b6:610:54:cafe::2a) by CH2PR11CA0011.outlook.office365.com (2603:10b6:610:54::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.49 via Frontend Transport; Mon, 26 Feb 2024 22:28:21 +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 DS3PEPF000099DA.mail.protection.outlook.com (10.167.17.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; Mon, 26 Feb 2024 22:28:21 +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; Mon, 26 Feb 2024 16:28:17 -0600 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v14 4/4] EINJ, Documentation: Update EINJ kernel doc Date: Mon, 26 Feb 2024 16:27:04 -0600 Message-ID: <20240226222704.1079449-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> References: <20240226222704.1079449-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-cxl@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: DS3PEPF000099DA:EE_|IA1PR12MB6138:EE_ X-MS-Office365-Filtering-Correlation-Id: dedd1391-6ad3-49aa-224d-08dc371a3d20 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6MguVPeWAe2ws/23M7hRmcLgAeimTjcQm9cax94lFWC1Wn4dEF2F23Gad/mClP/DE52NpRigahVHpwbTln148E9YZypN52/pJKY6X6UK196m+srSCbWlJS4YT1xyTjxrnoKvgkGAFS25PShTj4C24KNo7kIPuGD180igIlbQilXtYxFAis7HEyLOD87up2jmEO1+rdttk3QjnTVTWtZatnX8vaOpiKzzUsEDqV1ux5kIFatu5/41gsUOqOX0s6AGKZ7tsWeYRbfBf1iEGxsqIa+ZO+9KZdpo95eS9o6SdxvIxdFFF+bRy635YcmrVvKT5TwdQ74FDFMZDMdCMLtMapGK7nAdMOaPcM2s2OXNuW9ceDDsUKTrLGOrU9LdZD+rknA/k+QpSJecswTHaSHqD6kG6U3vyyNpQ+JnKN+LBcHdYxoVbmFhqz6XlGxNa6r3RL43ZyZy9zyDTanl+aj1ozB/5S9RS3/99EmNUzc0L7j2+IfiO9lwltu5U4F3WsWrsYtFSgGX7qkMWnslfMaBaM9c4QNuUprkakJakzJw7uaPP89e0+KkmsxsyVtyccIMUQs/OPL0Ex7wl/pmHNcd5XQ1XzIn6XlbLrdZMBk68qkTGFQ0zqYTcfYIx+PB1yppmG+ZWESy/UIb2xfmaQCMTY3j5j6fcKvsS1H5HKytL0Fz0qV9wVx6YSvLkeqYqzi3HESL20ZqtZ9SG6oUaFDEX1+eShpkuv9/ycpoFq6ZXPmNL9MdRCrkvPchyVWhyW3R 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)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Feb 2024 22:28:21.3180 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: dedd1391-6ad3-49aa-224d-08dc371a3d20 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: DS3PEPF000099DA.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6138 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 Reviewed-by: Jonathan Cameron --- .../firmware-guide/acpi/apei/einj.rst | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/Documentation/firmware-guide/acpi/apei/einj.rst b/Documentation/firmware-guide/acpi/apei/einj.rst index d6b61d22f525..c52b9da08fa9 100644 --- a/Documentation/firmware-guide/acpi/apei/einj.rst +++ b/Documentation/firmware-guide/acpi/apei/einj.rst @@ -32,6 +32,10 @@ configuration:: CONFIG_ACPI_APEI CONFIG_ACPI_APEI_EINJ +...and to (optionally) enable CXL protocol error injection set:: + + CONFIG_ACPI_APEI_EINJ_CXL + The EINJ user interface is in /apei/einj. The following files belong to it: @@ -118,6 +122,24 @@ The following files belong to it: this actually works depends on what operations the BIOS actually includes in the trigger phase. +CXL error types are supported from ACPI 6.5 onwards (given a CXL port +is present). The EINJ user interface for CXL error types is at +/cxl. The following files belong to it: + +- einj_types: + + Provides the same functionality as available_error_types above, but + for CXL error types + +- $dport_dev/einj_inject: + + Injects a CXL error type into the CXL port represented by $dport_dev, + where $dport_dev is the name of the CXL port (usually a PCIe device name). + Error injections targeting a CXL 2.0+ port can use the legacy interface + under /apei/einj, while CXL 1.1/1.0 port injections + must use this file. + + BIOS versions based on the ACPI 4.0 specification have limited options in controlling where the errors are injected. Your BIOS may support an extension (enabled with the param_extension=1 module parameter, or boot @@ -181,6 +203,18 @@ 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) +A CXL error injection example with $dport_dev=0000:e0:01.1:: + + # cd /sys/kernel/debug/cxl/ + # ls + 0000:e0:01.1 0000:0c:00.0 + # cat einj_types # See which errors 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 + Special notes for injection into SGX enclaves: There may be a separate BIOS setup option to enable SGX injection.