From patchwork Mon Mar 11 14:25:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13588813 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.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 7D4B03FE23; Mon, 11 Mar 2024 14:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.40 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167147; cv=fail; b=oniv86J8vXi/WtEmpn5yaq+RbYWyICGyUkeStAbifiM2IdEShGh3AhdVKSQBqYUDEbMSrE0kcrzBgYvm5/t4IUNOnO2SUWuizUOq5PNpSOkD3bfcQZV73OXzAzbDv9KbjUPMTPdx2b5ngP0e85aKq5VwYxdhV8Sxy5Sg6DR5XbQ= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167147; c=relaxed/simple; bh=sFGwGwu5MQGwMP+3oOQzkUnb/byrGrkWfJaqi+5lKpo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A5xgyUjnpd5TSDJWfuVI53i7F+SLOPw4EkxS393ch8QE/dIfcxBT9kzjYkyJz1KOK003KKUEghv9KuafAe5H2MDCnjBGpKhcLL7zzICEUmjWgFmYN37fRf8N8kfnU51dNwrYXm/PP7l7jcXzlnEEbUzQcmXA0z/kYSlIAZXZk3Y= 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=ZZVqabQS; arc=fail smtp.client-ip=40.107.236.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="ZZVqabQS" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MuNj7z/qMpSBWlp21JCusmn8uxfLkXYxerGLUESV3hvUpRY772wH/U06GKWgKW0aZwk7zV6ATQLM4uN01X+tYQsnxnHlnGLJZuDDA3P1q6XcetfX3BX++q4iVoKSNg3uHGzNgYollRe39/tLHHTNNsNZZjO6BO2k0LiEoGB4+R/ctaZ35JJ8wAjPe3YAqaTVFrxzQI/SjdPvHJDTgll0W2lNRtPtTHuaDGFrUphnB1w2vo2I4jRDGey3d636VxbMTHdipUhSX69wl/vtT2X8POIXDPSXLwBwoVJY1yE5Vpn+lYpW1NAQOobQZLwVd7Y0eMD7CcXDQWtKsTcI1lvDsA== 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=9+KyVWWjsLAqYd3gMPBtA8GJc0YoJPaq66WclNHHAGs=; b=moAe810sqYbzCa744Y2Eg129qN14SzCJL0ilyDAsIgAVxA0Xj2SxABbgBE11wEHXQ03KOMk0Yzs7rsoEboba6ELa09EGea0yZHHSGuVz1slDH/dPJHyn16qs8uq+JTH04SNT+uMek4GchPP1NC0lMKxO2qUawH+4wmljAl0wYh1/c1WemZbF4jk4og58CaVg0UCVr0TldyDVZxxsO/HwLW+cv7nkp3UD9oHMc77FHf0JbOiXoBYTDmCu8CCd8f8loWqzWDuUKEzo+z6PqBidYPnEUPO3p9gYZPZyhzGn1HmPeRtj6pvD2TTLawTHdMgJksZh5r6MTn1WA9LCnUjyvg== 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=9+KyVWWjsLAqYd3gMPBtA8GJc0YoJPaq66WclNHHAGs=; b=ZZVqabQSoZKDAzt1BxQebzJgp891p5ZwVD0hRNKDeCw1Yo6fu9mPeYJJ8FydMpw52UtnQ2+RFzd82jESxNVTPDGhkG5hPg0nCx2/ILWjZk6oZfRIGzRwafP5h3E/thy24CYuveZjlsgM8KaXiFUBwhFPEi2EwGH0yL7JdZMJMwI= Received: from BN0PR03CA0026.namprd03.prod.outlook.com (2603:10b6:408:e6::31) by IA1PR12MB9064.namprd12.prod.outlook.com (2603:10b6:208:3a8::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 14:25:43 +0000 Received: from BN1PEPF00004681.namprd03.prod.outlook.com (2603:10b6:408:e6:cafe::e9) by BN0PR03CA0026.outlook.office365.com (2603:10b6:408:e6::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Mon, 11 Mar 2024 14:25:42 +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 BN1PEPF00004681.mail.protection.outlook.com (10.167.243.87) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7386.12 via Frontend Transport; Mon, 11 Mar 2024 14:25:42 +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, 11 Mar 2024 09:25:39 -0500 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v15 1/4] EINJ: Migrate to a platform driver Date: Mon, 11 Mar 2024 09:25:05 -0500 Message-ID: <20240311142508.31717-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311142508.31717-1-Benjamin.Cheatham@amd.com> References: <20240311142508.31717-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: BN1PEPF00004681:EE_|IA1PR12MB9064:EE_ X-MS-Office365-Filtering-Correlation-Id: ea22b7ac-147a-4b36-9abe-08dc41d72249 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oaDujucjVI24kq+JJSN8X9pI3JydsZDYR/Vd7oTxiUxMnKZdBluJtxhsReiJ3vJLNWTV3tbbNEaUCIgo5vu/uVXpj9PA/abrerZazczacMzG98CZre4RmAG7aOiEG8EWpBdJ3Glg5A41CSby/oFxG2JC4F7qJi90dTMbXRLLrcwDbpbbTR/q7GbeJmFbpVtcffGlj7WK//Bu2bhg2ZJGZoMmC+n4vGf10v2oaTe8CY7kDUAmvEtdIchf/MBKR79XjbRJfr19iKal/FdRvrMhAfeg5mrOwR7buMvu27Uydr4nnF/AHCPN50codXtj6kOZw1NXdQf3jPxm/7hkI3QxGEwuZ3+ksMTn1+idA0V5ojlAlkHpY4ufeS9hvmEIEi16TlB38Snd4TJdzvfENIqugbn82SWhkj/P+7fSK5hQoocpCg1nMU1bZ6BdRdVP8Z+xV4f8kaciQf5VprItGTxHKZBPcPdFIDHSPimV7MTWm0THbcnY9ryEWzHFdC/lO+AMwBs9kU7u5TDs/hP2/gD7aKvyOFWAe3KtgfXKb7MaP9D6NIRqwl37RrlLhbWh/3L7Kg9mnkeqf4N/jB+gVwutRCLQTQMNU+F01QabxxRVE8MuTjg2j2Tce57I9i6+ze2HYXDB7cVdYncmcdrX3FYjBGToZQcY+bbYMIcyVVuNJSStycykTnQ67sAdC/4rmu7RjdSXsafpqVBTjT3xIKZFxZuC+hswkJMUEE6vhD3D+cJ/IE42o68oBetI6K4zYzhc 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)(7416005)(1800799015)(376005)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 14:25:42.8322 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ea22b7ac-147a-4b36-9abe-08dc41d72249 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: BN1PEPF00004681.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB9064 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 safegaurd against the case EINJ didn't load. Reviewed-by: Jonathan Cameron Reviewed-by: Dan Williams Signed-off-by: Ben Cheatham --- 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 Mar 11 14:25:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13588814 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2088.outbound.protection.outlook.com [40.107.94.88]) (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 9A3CF4084D; Mon, 11 Mar 2024 14:26:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.94.88 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167172; cv=fail; b=hMkoN6Z38mlrlKoJhc6sBDsalX9M5fMrpvGD3EMDk46Dj7sSAFV08In7THbVr8wThWTmmBEK/7tq1tJbYbg9ZsAuUqAp9zOlaplm7rIxJIZT1dYGi24u//fJSZ8mOBhsm4CyQyFwBmRiOrkZL4MhKKHld8suXUXTENLN+Yo2phM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167172; c=relaxed/simple; bh=TKM1kd1XFlvg9B/8g8mySOwC89mtdmeWAgMIT6+Jgsg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GIjEO5T/JslisidHh4HdK9q229rEud48Xe56BE5iiPPLpI59p1WCKDxvQV3z4ehE6dl48XQNXLU2p2dIVOOwiOjzbJ7r4EEliBGmW/kQo+F49Dy5GfRcHamT/Kvu4/y+SVcRA+eh5AKOuiWCMrb1WhuvR6vqQZCNa+UsrnDrj9U= 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=3HIIDJPR; arc=fail smtp.client-ip=40.107.94.88 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="3HIIDJPR" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dRicrQP7WOm0OErwyO9KpYSv1pGMHdx7A/glHb0t+7UlmCpyWlgunLZ5O9f0pgt/ugzww7SoLp+aX1HTiK9nB3CRlZZ45SDWcHSKSJDb99d8hylqtpBzpejZ8dnKt1iOcX5NsMwUegvZiAw5b4fUES+cZD4ZHiyX1fLTAhx82xBBbRCIkGY1gas2Ki+HkG4Vi3kgVByRT2ga/potWXmta2zLXd4QxooEnfDBKauvhp5Ab3ehix55K+fmgsHC8joj7YUKpL/TRhXULQKhIPsGgE5SY2L+Fhme3hffG00IGgbdbRW8mTP8rBREBjOJZcHQl4yZqkfd8Z7N3yLmZ4hlKQ== 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=AAwzFdJycQF4gIZVK/583IG0BZoOYeC5/WuLmh4c8h8=; b=KcQ3D9chOcFeZtQxk15KFtResyB+pFr2WAz/MEhgUTK8HTca6sB4kAISiBepPgMZ9UItnyZLvhgf6CRe8rIXcg63MOkdlUO/WUt7st3LiB7MW0UHQFj/uQwliQe8ld3Gw1aWpbcB+/ym15ispiRcihDeSFIMUye4UcUt+WvMRiK17QusHG+7eMhZjC7dBuBSTerVct6w/qqz7wL43ZtnlaMmk8eYlNnfFxozvXOcNAEJpNfBqpPKYPw6OHhkkkeige1rbHwQvf9LPrjmfGfWqSxCsWmS8FgQqgBE1+NGrniBzVSJ9kI7OrL//Rri7uQolDtcP4ypr9gngEWzfn10Ow== 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=AAwzFdJycQF4gIZVK/583IG0BZoOYeC5/WuLmh4c8h8=; b=3HIIDJPRpcrhCV5uLxI5U2Tm+d/GFB7xvfRz/QeN7IEIHKLWPEPaQdFU3y//47brkwmcSYH+as+DD/DVbPmgRSR01fdNd6xGwrDzVizlKJE7D6iESdJGCT7ho8KxHCs9dQ6cXEFKXu3+wz0mw00ZlhxYINlJbtDBCK3EguM65IA= Received: from BN0PR10CA0011.namprd10.prod.outlook.com (2603:10b6:408:143::13) by PH7PR12MB6467.namprd12.prod.outlook.com (2603:10b6:510:1f5::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 14:26:03 +0000 Received: from BN1PEPF00004680.namprd03.prod.outlook.com (2603:10b6:408:143:cafe::d4) by BN0PR10CA0011.outlook.office365.com (2603:10b6:408:143::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35 via Frontend Transport; Mon, 11 Mar 2024 14:26:03 +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 BN1PEPF00004680.mail.protection.outlook.com (10.167.243.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7386.12 via Frontend Transport; Mon, 11 Mar 2024 14:26:02 +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, 11 Mar 2024 09:25:55 -0500 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v15 2/4] EINJ: Add CXL error type support Date: Mon, 11 Mar 2024 09:25:06 -0500 Message-ID: <20240311142508.31717-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311142508.31717-1-Benjamin.Cheatham@amd.com> References: <20240311142508.31717-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: BN1PEPF00004680:EE_|PH7PR12MB6467:EE_ X-MS-Office365-Filtering-Correlation-Id: ede48c85-efb4-4ca0-e316-08dc41d72e47 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rqW3Cme9QuwS90eoFrrbr0AB7A6nnwGlteNyTL2NOFBB92xmbls+1IYvCPLw56aaF7HaV3Hqy/RMLcS57FgJtDKc3RNqUxgTyoVJfoPu0pD7PJqA3v19FIBdXyyPiEVDsu6sM0CjTnSindasB2oCKYJB/Hq/F5bYiknSmlyXr9mig0v/Lz3AW99midOx253zEODVgtOyg9ekEWIJGg65xbIshXgD2W5HTaK4wrCm0oUFrC975YK0rubbo7BNOg2fsZj8k90hhpWZHOMYRurC9gxTalJkPxEXJjpdG7TJKPtG/JzEZtCl9IvpkhoZ3l6snVLn4jl8wiDZSsDEdQubVdxb6PQyBkQdkRVMCDWdVSghsgIqPwTU3jj2asBy8cFAngkwoLjHbPYr5NOAW7o3+smqFMwvj0h6HbyNvwnFztCsJOyWKZmW9hnkXwufxlueWzXs1LFWv3HZurhiXVHfP6A1B3nMDV642tN5LGcSvYficxUYzuPh+YMLxn7+jC/LXLaFdHSO6Qjh5ojlB3yxdsBReniafwHzuCf2ovbIB7/Uqexpax+2wEv17bRb861n0oa2ReuqkBjTd36oVBtcI6K8mhGnp5rPbCPDyTpFaHGXINA1DN5Ma0e3BVBf9OT6/bAoGqkwIpO1KiV2DrKMwqg6ndkrJvZV5FGwFrL5G6yZyHTLTwKiu5KNdnKGMwyr1JfmlQxpjr4U97xA20n5w/HY+1oe+4oicfLz4d2JH3dzs5ggwCIoD6Mv6u/v52Sm 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)(7416005)(1800799015)(82310400014)(36860700004)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 14:26:02.9536 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ede48c85-efb4-4ca0-e316-08dc41d72e47 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: BN1PEPF00004680.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6467 Move CXL protocol error types from einj.c (now einj-core.c) to einj-cxl.c. einj-cxl.c implements the necessary handling for CXL protocol error injection and exposes an API for the CXL core to use said functionality, while also allowing the EINJ module to be built without CXL support. Because CXL error types targeting CXL 1.0/1.1 ports require special handling, only allow them to be injected through the new cxl debugfs interface (next commit) and return an error when attempting to inject through the legacy interface. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- MAINTAINERS | 1 + drivers/acpi/apei/Kconfig | 12 +++ drivers/acpi/apei/Makefile | 2 + drivers/acpi/apei/apei-internal.h | 18 ++++ drivers/acpi/apei/{einj.c => einj-core.c} | 77 ++++++++++---- drivers/acpi/apei/einj-cxl.c | 116 ++++++++++++++++++++++ include/linux/einj-cxl.h | 44 ++++++++ 7 files changed, 252 insertions(+), 18 deletions(-) rename drivers/acpi/apei/{einj.c => einj-core.c} (93%) 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..cd2766c69d78 100644 --- a/drivers/acpi/apei/apei-internal.h +++ b/drivers/acpi/apei/apei-internal.h @@ -130,4 +130,22 @@ 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); +int einj_cxl_rch_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 93% rename from drivers/acpi/apei/einj.c rename to drivers/acpi/apei/einj-core.c index 937c69844dac..9affbe807ded 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,18 @@ 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; + } + + /* + * Injections targeting a CXL 1.0/1.1 port have to be injected + * via the einj_cxl_rch_error_inject() path as that does the proper + * validation of the given RCRB base (MMIO) address. + */ + if (einj_is_cxl_error_type(type) && (flags & SETWA_FLAGS_MEM)) { + return -EINVAL; + } /* * Disallow crazy address masks that give BIOS leeway to pick @@ -593,6 +609,21 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, return rc; } +int einj_cxl_rch_error_inject(u32 type, u32 flags, u64 param1, u64 param2, + u64 param3, u64 param4) +{ + int rc; + + if (!(einj_is_cxl_error_type(type) && (flags & SETWA_FLAGS_MEM))) + return -EINVAL; + + mutex_lock(&einj_mutex); + rc = __einj_error_inject(type, flags, param1, param2, param3, param4); + mutex_unlock(&einj_mutex); + + return rc; +} + static u32 error_type; static u32 error_flags; static u64 error_param1; @@ -613,12 +644,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" }, }; @@ -647,22 +672,26 @@ static int error_type_get(void *data, u64 *val) return 0; } -static int error_type_set(void *data, u64 val) +bool einj_is_cxl_error_type(u64 type) +{ + return (type & CXL_ERROR_MASK) && (!(type & ACPI5_VENDOR_BIT)); +} + +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 +700,21 @@ 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; +} + +static int error_type_set(void *data, u64 val) +{ + int rc; + + 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..bde7e20c7fbb --- /dev/null +++ b/drivers/acpi/apei/einj-cxl.c @@ -0,0 +1,116 @@ +// 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 + +#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[] = { + { ACPI_EINJ_CXL_CACHE_CORRECTABLE, "CXL.cache Protocol Correctable" }, + { ACPI_EINJ_CXL_CACHE_UNCORRECTABLE, "CXL.cache Protocol Uncorrectable non-fatal" }, + { ACPI_EINJ_CXL_CACHE_FATAL, "CXL.cache Protocol Uncorrectable fatal" }, + { ACPI_EINJ_CXL_MEM_CORRECTABLE, "CXL.mem Protocol Correctable" }, + { ACPI_EINJ_CXL_MEM_UNCORRECTABLE, "CXL.mem Protocol Uncorrectable non-fatal" }, + { ACPI_EINJ_CXL_MEM_FATAL, "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; + + /* 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_cxl_rch_error_inject(type, 0x2, rcrb, GENMASK_ULL(63, 0), + 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; + + /* 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..624ff6ff41f9 --- /dev/null +++ b/include/linux/einj-cxl.h @@ -0,0 +1,44 @@ +/* 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 +#include + +struct pci_dev; +struct seq_file; + +#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 Mar 11 14:25:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13588815 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2077.outbound.protection.outlook.com [40.107.220.77]) (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 C74443FE23; Mon, 11 Mar 2024 14:26:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.220.77 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167184; cv=fail; b=mXCfGSEXxXD3UasnyWHLpR0AhX9jRtB34BQqSep2jgZY02PLMrEohSV33lbmvHTVc6OPSHc9KNnP7RGorz56Qpy5IhVYzP+XazPjGinHd8qvcLa10PT8e8nSk3ehpCkK7X79yHd1GAd4Y3vrjAwWR7nJHQUylfhITC8UTjkYNpE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167184; c=relaxed/simple; bh=TNBEdbZMwaRQnhUEUf7SXKYiiDlKqa7VhYp9Dl3jdFM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=FnY886Aau1e52KHAuPIgdG7QndhSQa4J0fCDmRYx/ZE444sTz0cswI8u4oqGkGPZTEhCMxa2rtYZnaaKA+O2ITWs0h+qbgWhH7mRPu78V3NqHc4Y5PceKUWKMcxnvOn4ZERro8sJ9lJrS2Op+v64DPVFhxiSWGiivvzIlP4JuNQ= 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=5NzGWvWs; arc=fail smtp.client-ip=40.107.220.77 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="5NzGWvWs" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OUzhtoBUlzGdKaBx0jiMyeAACoYUEKG0pxff8h0gig3vF0oIShFnOR4I4wmuvkSXDn2qno0RfghoNjxI+suNOFYgi0Rox6xL1XyELxysP6M/Na/zBocR5OIJwOc7NRe41Q6Cdls151GVGOLpOKgtvQnk31qwvojWiiRWuYyeH9MwHTmX88JivD156ZiUjt3o7HZ6IXUlOnudjU7Z8e9Ddd53tqWh6pOOc36NvgPLx8Df9WGdnAxn6+FTNhoZSmvbcCqhTtjYVMxL2adfOOOMqUShDCWH4IQY7HOOYTVmBXCdmIryk+Imaiupw80T7ECp+9bcBSdfULTERFxHiz4xxQ== 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=XeCt7FNiNNomYvV8RLm9drmt8/6Gad1m9M+AQr/w3dY=; b=PghywatPq3ZEZuaTWDrgr44OqltRlRxiFvrLjvIXU99EOyFOO+Yf6XgnMFRnfdIBiJfd+SDIHfVdsaFaYrY9BmTlYz8XkoCsgiKYYbwLsdMEwlyeEUEsLTQYWyfxHYgbQFWhR2dVgh0NmhDpORBtGAqRkHe7mS8E3OAxMIlx8lazx8dgC6CPUWQVxlslicDiNV5tVsrfTTL/SM29nugV+32/RhW0eEwSLjS2YKgmQWRvEFJCnOKgmTsfefe205QXZVUQ4/YGCqLEHcCaujxgk7sl08QW7PZG1+v47s3rxc0kDWrOeldYzMSPgB/bQM8r4cUTs7CzOs7PPEp3zwm6mw== 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=XeCt7FNiNNomYvV8RLm9drmt8/6Gad1m9M+AQr/w3dY=; b=5NzGWvWsqh0rVi4ITcDYICz4C0YCzCJz1Q+r0vLeKHbCzOCd8i0KwAftzpqVGRZ9+Ew4JbknDrg1HwdCYXKsPDo8L9YwG6VYQGf7j5uPar+iepIrDejxn5H54Ddru//HSJLUV4LwVyf0jgVIcmuh9oX0tgQQmhfyq1EIouTLMGk= Received: from BN0PR08CA0010.namprd08.prod.outlook.com (2603:10b6:408:142::11) by IA1PR12MB6481.namprd12.prod.outlook.com (2603:10b6:208:3aa::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35; Mon, 11 Mar 2024 14:26:20 +0000 Received: from BN1PEPF00004684.namprd03.prod.outlook.com (2603:10b6:408:142:cafe::52) by BN0PR08CA0010.outlook.office365.com (2603:10b6:408:142::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.35 via Frontend Transport; Mon, 11 Mar 2024 14:26:20 +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 BN1PEPF00004684.mail.protection.outlook.com (10.167.243.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7386.12 via Frontend Transport; Mon, 11 Mar 2024 14:26:20 +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, 11 Mar 2024 09:26:15 -0500 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v15 3/4] cxl/core: Add CXL EINJ debugfs files Date: Mon, 11 Mar 2024 09:25:07 -0500 Message-ID: <20240311142508.31717-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311142508.31717-1-Benjamin.Cheatham@amd.com> References: <20240311142508.31717-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: BN1PEPF00004684:EE_|IA1PR12MB6481:EE_ X-MS-Office365-Filtering-Correlation-Id: 1176bbca-e46c-4c1c-8397-08dc41d738cc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: III8IN/Tl9Af3/3QbkcYFznl5x4DMBI1+14g/TjFU2Veu9ODTezaDHOqCViGohcyHSJpKTbVfg70KtRpMnmyHdgb2GHzmaSe8sv3+wr3eviWICAVCPXy7g4JHnLjAi3SZw821UM+CvLHxVpIQpb834crkVAtyBG8mIppKS6z5S0CWR6Cm5lEtTjYfcg6AZyXg9SzneeN5QqrFI9ofGbRj0zPg6IEYyBqML5pk45RUjZTS5VqG4GRA6sbzDswuy8dwe3ch2xEcufbLq6w5FeMdeU7QdYV0oBPujsjpk5mQ7f4dFwz8sC02OABOCXzZFmmzBdgHDxwBqJBz3UFx355PCGYKI0QaJa0sR7ty8/b/WqcGmYdMtuubSZeg3ObKdEEGlctmC8zCCNLpzCcL6vHiF50CSBs6ctzpzuTSUzcb3iDtqO0rdH1b0FpfHzVqRFCPz8eBTVC510gmJmiWPXoMI+Km0tys9G1HOyeTSlHIF9V6iT3TMuet8Ch7oXK4XGjUtGkh967kktaIup3qvPOqPf5J5iLPHzS7OCoDL8SJ1fdD2QpsYVDAHjrdNFjI9yMaiiOUskhjAnsOonEWscjIPPDSCGc9ErTcT7BDwasO06e16zB4bABHAEmjZgmDy6D5J17yLlXyvXOvkD2xASHCAWElPs6CqbtOppxY+q1cBzDn+TqvEPLb44p1abH7bM9xJWX9vlNfOBskXl5kEwi05B73PGQnB6lV64Ogg/Pzzas2KL3jevxpxnFa7RdpWgP 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)(7416005)(1800799015)(36860700004)(82310400014)(376005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 14:26:20.6000 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1176bbca-e46c-4c1c-8397-08dc41d738cc 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: BN1PEPF00004684.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6481 Export CXL helper functions in einj-cxl.c 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 module. The kernel/debug/cxl/$dport_dev/einj_inject file 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. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- Documentation/ABI/testing/debugfs-cxl | 30 +++++++++++++++++++ drivers/cxl/core/port.c | 42 +++++++++++++++++++++++++++ 2 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/core/port.c b/drivers/cxl/core/port.c index e59d9d37aa65..eeeb6e53fdc4 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,40 @@ 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, + "0x%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 +1184,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 +2258,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 Mar 11 14:25:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13588818 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2073.outbound.protection.outlook.com [40.107.223.73]) (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 690463FE20; Mon, 11 Mar 2024 14:26:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.73 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167201; cv=fail; b=qvO7SEkM1qrx3vUjuXW9EZj9rXGP1X3XTNrWFk/nq+KuDX5aqJLrkW8MNoq1y8Cia3U1tGIC5dd1WU0fxbWhDzuqm5XzcZ8lujcfA/ccIqFD9mhP5jXadOyt8pHVeIwAz3Mjte29dZr9luv8VWOwNS8vaPSpK9nYzs5nYpz9AYw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710167201; c=relaxed/simple; bh=WZ5YbEnhqKXopFQNcqS3vyv+MaIIL0oXRn3J90vnm8o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RRwI5y2zjhAuvYacRxhSUNQMG2Vv1s95bVMF0okzSaDKYkSj64ZoQc5T/Ek9Uu+SvXyLH1J9USbA5TePCuRxrpqB/F8zZ3XC0T13En//YL8IBrCR14JfIoQU6cxTCOMNXbu9TXdtIgBivJlRN+R3jXej9exwLcqySRpVJ9A8A2Y= 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=rPHemmIH; arc=fail smtp.client-ip=40.107.223.73 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="rPHemmIH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=k1qd+V/8VJiBRWVEZKkTkhl4zLayNd/pEBlgjkN7+2BjthmfqAWHpIhsCTOvhiffpu66KLeq3wgD7dWVrGodydReLei1Nxuub11X1fBg5asr9UCZJjbuujiGol4us0wNYjab04wUiKHcSqWunhAJBjLtV/0GxBIwkW9E4UpemcXpXwo3Pg5A2+3grEBenQQl0pKax3eJua9NTQva7zdtqkKYNL0sZqUdm6FeaZSmQEeMsXI/vKy5rlFi8Tt0Omro7Yc4lAcGqPDIYTxBc4kuWecXEdAhRT6Q1DAh2X2c23X8ey+Z9+4Ao96MBkj3I9tjRFKMHXsYcZSVlbmkKp4tQw== 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=HFBN5h+d7exIkliBEw4l96DipCKejqb1+Lo70+MyXu0=; b=eftd/K0E2P0xnav49Vy3BXt8sv1QYQ8SmWApPc0Ra7RCIdOy5PlctiwoThSiPY98NdXInt9fIl6OXpRviDBw6SUp6c2Qa6vlibU4plMuv2So1JZdeSfsCZSEt/ThOr3PPndDXyWVjZmD15wkO6XXKrxP1hVklrDxJ5uo7ALDWaFPXOS7GwDgUmwIqeRqiOfqwgEqqa9kvaCe6hgvkmx6nXoKu3YRnHvvKFaRlt39AfftbvjxM4ztEqRREhgsr8GM8ZiGbALP/mqoGU6cfeN+I4CqeqxCNo2bP4EYnOLwo4PD77GcC/+LPkZMkZc6kOJhhvDA0dJD6DM3ILTHomALeQ== 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=HFBN5h+d7exIkliBEw4l96DipCKejqb1+Lo70+MyXu0=; b=rPHemmIH+Qa8HzjuKqtTIRjmC3mGKC3bLS6etVXlpwxOmEVtgn3g8///SW73yiAvZOCNFtrx8ucWHwt0ygc+XPl0ceTGcKeFOMReUPLLKGEMQIbrTISCyUv0Mml5Wh85YJBEZhtSUZ/kIRdPlsDOdq1Chb0ezcQEuLBn/BLyJJs= Received: from BN0PR03CA0015.namprd03.prod.outlook.com (2603:10b6:408:e6::20) by DM6PR12MB4339.namprd12.prod.outlook.com (2603:10b6:5:2af::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36; Mon, 11 Mar 2024 14:26:35 +0000 Received: from BN1PEPF00004685.namprd03.prod.outlook.com (2603:10b6:408:e6:cafe::89) by BN0PR03CA0015.outlook.office365.com (2603:10b6:408:e6::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7362.36 via Frontend Transport; Mon, 11 Mar 2024 14:26:34 +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 BN1PEPF00004685.mail.protection.outlook.com (10.167.243.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7386.12 via Frontend Transport; Mon, 11 Mar 2024 14:26:34 +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, 11 Mar 2024 09:26:32 -0500 From: Ben Cheatham To: , , , , , CC: , , , , , , , Subject: [PATCH v15 4/4] EINJ, Documentation: Update EINJ kernel doc Date: Mon, 11 Mar 2024 09:25:08 -0500 Message-ID: <20240311142508.31717-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240311142508.31717-1-Benjamin.Cheatham@amd.com> References: <20240311142508.31717-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: BN1PEPF00004685:EE_|DM6PR12MB4339:EE_ X-MS-Office365-Filtering-Correlation-Id: 094b779a-c85b-4367-a425-08dc41d74158 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: tKpeVUYVo20ZZgFZELfvoY2v30c7tK5byUt/ytpFtEAfMhVipL9Ytvovx1XFMUg96youax1L+ro6Mo2nj2lgd7CG8R5B/qdOuDUqo38nWX+AdJq6n18CZBuIOOo2bbZ+CcpeFzxb2+9gGj/m/W/D479rm3pRKgsMgeF+0ANJGeP6Xk71Tb2eTYrsdm9p3UyRkzToUSciNxHqVY7qCJDHxEIINv5JI+2VFlTAPn3W1vPnobM3Th3sGtXTqC+3t1Kad15+U/KK6kbzOIvPV7QrQ8YBpMy1cW408eeEkcoOIl/fvHlrnC9fNXiLZJjaVEtZg9ugZOQE7Snfxf88Be3XgD17Ntm3d+KjmW43as07BcduRTy92y0L4paJzoiBps7tukrjCOUDtc1QMAwIunA7MPWR+CvIcEewt4gzhi9VagXucnN2t1jSs+5g5qCSi8HqIjOo7V2vts4jGW2S9GaFjfc54Tp/sPiq3AP7C63jLfxAS9DYZhYLnECOI9WwwRrqlItZNnTA1UW/rMTvMQqA/I8ZRb/aVksqc7MWSZe46xUwZpJHlihzeFdLuVlOO0Cz1tMQ6xEZprAXDkc4ruRbADzdFeYSoYK2s2oIjXz3RPzdTGJ6oXpfvX2Nb5b2wOzY7knkdrm6e8hArV3Iy/hWqRrhhNqK/J3K4OfWPZWDymDpcUsiyTHEckaif5W2lqiBQKon8muUe4hC22ler9QKlTBTMrwHN8v2TuFvrbHGi3hbze3l53le4YFikJvaRs+7 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)(376005)(36860700004)(7416005)(1800799015)(82310400014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2024 14:26:34.9401 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 094b779a-c85b-4367-a425-08dc41d74158 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: BN1PEPF00004685.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4339 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. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- .../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.