From patchwork Thu Feb 8 20:00:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13550413 Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2067.outbound.protection.outlook.com [40.107.101.67]) (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 C7619381C5; Thu, 8 Feb 2024 20:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.67 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422471; cv=fail; b=o9j/26o1UXYwYBcxO7ey5CUzqPbJn4VPSK46W2aOyilWMpprAwKghJHd5lopPpmPTlyWLbhiITrQluLkFAG2CVWtGxs1HJzHdwLzukgstqPiOGZHt5cVsUm2CMZsAdtL2MJD7Q7L4CID9K8C6aVRUrxC1MFvWS1N9WhEP1pPo8A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422471; c=relaxed/simple; bh=MzE13wBHCafikVW22sGGLZm5lxsBCq9XfSiNA+V6/tg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hFqbeGqS4UTqGS2v118GtYaz/Wmpfb90sXI5o581l/qNYbUHS5c38v7vhlgFThLzfNF7pQYCo8KH+mCuQZrUOL5Z8ubAu5jBDDvPzeHpQI71y8BFd1u9Txes+d3uX5ZLhplBwV1nQteCEz3I1MeoC8UEXmh7B0OypNtfBCLIcV4= 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=Y8sC2a5R; arc=fail smtp.client-ip=40.107.101.67 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="Y8sC2a5R" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=kKKfKWsAwSjUy70hN/bqWc8u1chnlhVxMk4kiUd+PMN1s68YBraW180veenWv20+T8KSCtEQBZW7KshjJhnsop6zzwfpAT62gTMQomnjnvvziSap9s2CkWFhJkrzARFiCDc1fz+ty1uvBiwqbLYZAKCm16AFkvEB2nmTGPCvPHFxSIexsrqJNC0bf/fMWo5YIELO46u+h/ykzcZ7sYFog+X3J1iwE4sUpliHtgyR5GW7rTUvLN0t7ZJN26QQXYMlqzl/0kQX5MYCoy05+wwHSyvKDH7cAbunc+kVIuE8ttZTJpNVJhqibZIeFsHkxQ/V9KQr3dm3ViSnKaX3JOQocA== 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=ZU/kJGfNcdh8x/1kb+QE6e7tVM3onZ/EUJWuZz8SSy0=; b=RFle4PN/LDV1E3bKKjMWl0aXv740viAywONuL2GNkj3A1PChtkxJBB/5l7z3toN/xMcqmIVYc+9bU+w252gvp19f/tMUIVq5HeyCPnYv2z903eIDWqveighuccFosjAhfaipOGIwm8BvRWUqdNhRONEcFzbknzgHXBjMJLy67wZ6yLEWVcPZ0gMqjTId8eZYae7rB6vMuISFuLqURq5tZXrDBWewsI09eW+las3Je6CaHcpyKK3XcIjlXquL2HfFPhWN+aBh4UPecsTxr36wdwFywrtQsfRxKDqBqsbPP4PSR7OluP+l5OVx/+6QOkRbA15h1B8QElb73Dz0unbqEQ== 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=ZU/kJGfNcdh8x/1kb+QE6e7tVM3onZ/EUJWuZz8SSy0=; b=Y8sC2a5R8mN5MoE1og9/GSJoGriPawn46R43P1uGRceEpUBwrqVAyhrYN46tLSmVttLzX308fsauql2/caJNvdAbdTx1NEKrLORtqs7WkS+VaJqMvSu4NpUDOL1cbUEKGWTV28LPMdBFqd8JzvbgQRW6OEq8uBNZZ+0kA5JENTU= Received: from DS7PR03CA0134.namprd03.prod.outlook.com (2603:10b6:5:3b4::19) by CH3PR12MB8583.namprd12.prod.outlook.com (2603:10b6:610:15f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.14; Thu, 8 Feb 2024 20:01:04 +0000 Received: from CY4PEPF0000FCC5.namprd03.prod.outlook.com (2603:10b6:5:3b4:cafe::6f) by DS7PR03CA0134.outlook.office365.com (2603:10b6:5:3b4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.38 via Frontend Transport; Thu, 8 Feb 2024 20:01: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 CY4PEPF0000FCC5.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.13 via Frontend Transport; Thu, 8 Feb 2024 20:01:03 +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.34; Thu, 8 Feb 2024 14:01:02 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v11 1/4] cxl, ACPI, APEI, EINJ: Add CXL_EINJ Kconfig option Date: Thu, 8 Feb 2024 14:00:39 -0600 Message-ID: <20240208200042.432958-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> References: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC5:EE_|CH3PR12MB8583:EE_ X-MS-Office365-Filtering-Correlation-Id: d99c921d-4798-48b8-bb81-08dc28e0ae25 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eG6fShT6E8I9rtiUa07Hr0KiogKqsjwb8wOxkqUZNAgujT2rFUK+lNP664SOqUXqwZ5TG/wWvK0/0nYKLs05jBL9EgYvOm9XnTfZoPyu4muAoIpyccNtRvgUzAyRkEM0GQNumAxA3jQHytNb/s1whno33WiHP/J3DtSDu9QrK7VFmngwp8aNHHhMCnWLo9Cs8gz7kdXbXqHUCQnhyqJTX5TuDEPf9Mdd/SRFwPPTSRQFNIga1J1sa+kiNgDFlS59y84YrNiEZoR1AfX5OO4vWOxCm6fLnOYO4ePtSz8GTrvjlmdmGQBvmAT4KCFxAovQgJ9IlqhCc4IaG4W+0rkIo3OE6Y7UQ/+VurqmDiW28XG46CNwhV6c6Dvx8GhmZWmB6YJ4uFWGmc2x55CB2kA3yN0Jacw01JBB7Hei9+ndhBdfziYhXSQK8g1yrSUkWYJn7h+FE8e9qL9T1nb6ApsDLuamqYJM0hNxtZQ/KSnJijXcX77yXhR1+T/9eIU9khOKPJcczjwF+ER1Obokg4/zywptH9YE+LnfDmY5H40Cu4cnHCFD1L1zqzH+MLOfjUQuSGdhdoO8CldoxrfATJP6bzi7n/dYBMD6lhLCmDXnzcg= 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)(4636009)(39860400002)(396003)(346002)(136003)(376002)(230922051799003)(64100799003)(1800799012)(451199024)(186009)(82310400011)(40470700004)(36840700001)(46966006)(83380400001)(26005)(336012)(16526019)(81166007)(7416002)(82740400003)(36756003)(6666004)(5660300002)(2616005)(4326008)(7696005)(70206006)(2906002)(54906003)(316002)(8936002)(70586007)(110136005)(8676002)(1076003)(41300700001)(356005)(86362001)(426003)(478600001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 20:01:03.7699 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d99c921d-4798-48b8-bb81-08dc28e0ae25 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: CY4PEPF0000FCC5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH3PR12MB8583 Add CONFIG_CXL_EINJ to cxl/Kconfig. This option will allow for the CXL core module to access helpers inside the EINJ module, while also giving users the option of disabling CXL EINJ error types at build time. Also update CONFIG_ACPI_APEI_EINJ to set CONFIG_CXL_EINJ by default. Reviewed-by: Dan Williams Signed-off-by: Ben Cheatham --- drivers/cxl/Kconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/cxl/Kconfig b/drivers/cxl/Kconfig index 67998dbd1d46..95f215a2e5dc 100644 --- a/drivers/cxl/Kconfig +++ b/drivers/cxl/Kconfig @@ -157,4 +157,16 @@ config CXL_PMU monitoring units and provide standard perf based interfaces. If unsure say 'm'. + +config CXL_EINJ + bool "CXL Error INJection Support" + default ACPI_APEI_EINJ + depends on ACPI_APEI_EINJ >= CXL_BUS + 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' endif From patchwork Thu Feb 8 20:00:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13550414 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2074.outbound.protection.outlook.com [40.107.92.74]) (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 151FC38384; Thu, 8 Feb 2024 20:01:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422483; cv=fail; b=aQNFQl/Ij94Gm3uj15kie+S2/MgFBzdB1ZyWXDEhztMn23wFRKPsbOlSK9VAquBNXmo/VaW6ZA6+nOIo3OjdKFuKSAEzYvudm1Cca8o/dDlZ30Pniu1g2DI+8eLLHNLxI9jtxFdW9jvTCH+n1jo/10guvyewXemMpF34kQ6wzNo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422483; c=relaxed/simple; bh=aW5eIXAX1w7tS76EAB40NyxtptHQtMhlSs9hkvp7gRY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=reBnYJRTijYb6kbZ0nQTEbVv6p3vraGDK1FPuqC6dMAyDskPG6qk9Jfe2izgu1E+OqTvqkz62qS5b03GkqiQ3PAblilb2Qn1x60da+Npd4kxcfB5tfbEuuQj79mMCyuX17nCdI2V9pu4GLGIDE4Nym66s7GDPpYdD8vUn+56JB8= 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=CJLQjRny; arc=fail smtp.client-ip=40.107.92.74 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="CJLQjRny" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cxjDaKVKqlgT0XTjgmps8aC1rq+9seRuSSL/H/WERJa/QRtq6D/OX+dnc+NaT/AP7hRtqE6BjgAgJOE2Tp497BzmM5wd6PX891vyEA15WUKBH8hYUSZ+Z5ZJ0/wgB5j3zNQgW+jP/zQEE9guj64fqg+tjo7c6cpupYRdcmESpmWLaDR4ETiPPkDQmA3eUlloSSOWmZhJkRxgrw3cUHd7Rolou+dR/1aJ8kd2seRwlrrfGbUQvisVpI87nqT+rYDXqWwTxkVoHzLvOgx2K3hk62/gliQSHLSMcVQDr9clpdZivJYbx9g3+gZhDlrQAvEl1hBT1/TBCH+DHMkBgWHB7w== 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=91x3nv/rdM1PcgpsJvnF85Li/f7Wils1B7tOq2o+4gQ=; b=nmCLufNim8SVz5pIeNdicdHTxY6p39JIrB+aHHqxAqqrl7dnkgcrrCLGyPGdkQFuCb2NRvY4yIBgj1mU1wKlYF9zntLUgjzlUN17g3mVOd5KKtxVJD3BGDL7wdkNmjjds/mtWyTCJXgVVFgxpV8ViebXfe1DshZlOdMFtyorfRvzeGQUw8MKUpDVifh3OY5MhLGG/3lM8GOd1OFHpK6vG2ERqN9aZxrKOTrSbsJ9UNsLD6So3v7y0WcWwovovaQ4rep01NaAxZu1GQFRPTkSmiMTlR9e7QNtidJBzAnGbGvisLy69C60OBE6GI+Cog6a32yA7RPJumgedPJhRX0azg== 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=91x3nv/rdM1PcgpsJvnF85Li/f7Wils1B7tOq2o+4gQ=; b=CJLQjRnygHNt8JDM07ABwWe+RyOpktUqS5xOG+hrPbg7ZxgMWFO1fKyx4EFnPba003VOOzErh5K2iOx5DMd4uCjQS5eq00REckEpAssv3wMEPsTQZWg6W4hM/woUzNPDosoCiRHWZUFYBDAy4ENKURUeP0jn+PJ4GmKjW+hZLZQ= Received: from DS7PR03CA0146.namprd03.prod.outlook.com (2603:10b6:5:3b4::31) by PH0PR12MB7790.namprd12.prod.outlook.com (2603:10b6:510:289::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.17; Thu, 8 Feb 2024 20:01:16 +0000 Received: from CY4PEPF0000FCC5.namprd03.prod.outlook.com (2603:10b6:5:3b4:cafe::8) by DS7PR03CA0146.outlook.office365.com (2603:10b6:5:3b4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.39 via Frontend Transport; Thu, 8 Feb 2024 20:01:15 +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 CY4PEPF0000FCC5.mail.protection.outlook.com (10.167.242.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.13 via Frontend Transport; Thu, 8 Feb 2024 20:01:15 +0000 Received: from bcheatha-HP-EliteBook-845-G8-Notebook-PC.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.34; Thu, 8 Feb 2024 14:01:14 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v11 2/4] EINJ: Migrate to a platform driver Date: Thu, 8 Feb 2024 14:00:40 -0600 Message-ID: <20240208200042.432958-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> References: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC5:EE_|PH0PR12MB7790:EE_ X-MS-Office365-Filtering-Correlation-Id: 384d5824-6c78-4499-e068-08dc28e0b540 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4HLZn/p7uT4hO/MjVrzUG2uj7roMIl/Ee4RUnaDOlegisMBaPqH5r66l7TdlAkImKwFFUWNtOEjOu/JIjCBA2a0g0PHz+BUmmqImN1bNIstCVBt6KwtTHjWski4Wc/VjfgFTJ5tVK0LRChIKqWZh5qb2iLNZYr9OTVKNBlxXMUoEVOgr6p4bj/7mEsStIPXO+kcNKxHbN34Lkx18U/lAW2d+pruTvT2nfzlYzYGG7vZFnXP0B9Zfcf8peGdmVrKhzOlvbkAk2pmupe1IL96R9+cRsdlUyCYQ8465zKnIISYMnIMX0rg7T04uPij5tPq8aJD6RON5YgLan0fcoy2/Xl7ywbb/6maWU8gIzcw3r53lf+znRrnhwLpakFUg8M/2V+EqsSEWJdKby0Txr/TCKSVV4fI9ztRk4t1j4T8v9YiiKXLkxRYy5ZKI47Jzu4q91QZzIq9Yx5MH5BylgAwqSeqkk649lrZBKxbyZTGV+NLKRj89Le4dIGs63DsjOFgoS0PhSBzr2St4WWmJ6Aqr5DPlDZwqNqMTM5kpqiQ9OcGiV0pnwP3BqHCaoNubwQHavXzzIHlH1329QFv44SaJYl2/ZbjaOewRJSNLzKGymQM= 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)(4636009)(396003)(346002)(39860400002)(136003)(376002)(230922051799003)(230273577357003)(82310400011)(186009)(1800799012)(64100799003)(451199024)(40470700004)(46966006)(36840700001)(356005)(83380400001)(8676002)(316002)(70586007)(54906003)(70206006)(110136005)(4326008)(8936002)(82740400003)(7416002)(41300700001)(5660300002)(36756003)(6666004)(86362001)(2906002)(7696005)(478600001)(1076003)(26005)(2616005)(336012)(81166007)(426003)(16526019);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 20:01:15.7387 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 384d5824-6c78-4499-e068-08dc28e0b540 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: CY4PEPF0000FCC5.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH0PR12MB7790 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. Reviewed-by: Dan Williams Signed-off-by: Ben Cheatham Reviewed-by: Jonathan Cameron --- drivers/acpi/apei/einj.c | 44 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 013eb621dc92..73dde21d3e89 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" @@ -136,6 +137,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) @@ -684,7 +690,7 @@ static int einj_check_table(struct acpi_table_einj *einj_tab) return 0; } -static int __init einj_init(void) +static int __init einj_probe(struct platform_device *pdev) { int rc; acpi_status status; @@ -782,7 +788,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; @@ -801,6 +807,40 @@ static void __exit einj_exit(void) acpi_put_table((struct acpi_table_header *)einj_tab); } +static struct platform_device *einj_dev; +struct platform_driver einj_driver = { + .remove_new = einj_remove, + .driver = { + .name = "acpi-einj", + }, +}; + +static int __init einj_init(void) +{ + struct platform_device_info einj_dev_info = { + .name = "acpi-einj", + .id = -1, + }; + int rc; + + einj_dev = platform_device_register_full(&einj_dev_info); + if (IS_ERR_OR_NULL(einj_dev)) + return PTR_ERR(einj_dev); + + rc = platform_driver_probe(&einj_driver, einj_probe); + einj_initialized = rc == 0; + + return 0; +} + +static void __exit einj_exit(void) +{ + if (einj_initialized) + platform_driver_unregister(&einj_driver); + + platform_device_del(einj_dev); +} + module_init(einj_init); module_exit(einj_exit); From patchwork Thu Feb 8 20:00:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13550415 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2049.outbound.protection.outlook.com [40.107.223.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 A2BE7381DE; Thu, 8 Feb 2024 20:01:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.223.49 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422495; cv=fail; b=ceOJ/nKyqwBCy2uyPYfEMUImmcPAi1Ld2pnaeNCtB1suc2DQ2FkWWdulIc/Zf+OPWcWOOS2m1PKsx8eRFbeFRovh7S58R63qtSdl2SRsegNXEUxaC8634UFcdNWhR+zMoNbpQmhmSkky37s/BzPy6sYgpl/B+ni4UlOs3f0rjpE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422495; c=relaxed/simple; bh=mnCEzdVnRJnulunV6FGnlo0bv81ROT4sKZZkXJVJOws=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=OeLX/6YWbg3L4HCD76fzbeR6rV3caozXbl7CN0/94O/BhFE/0ZY0KlTIgc8KonGZm0fp87ai4BtMmB6pOlSi0jg0/70ohAol5w0l/4iGaVXN3vI/WGXB7ufRO2VtfLEfPlwx4AJKG2e8jDS9f9rPZod+Y6wfMlTwaCqlergLFOM= 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=zaSWdobP; arc=fail smtp.client-ip=40.107.223.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="zaSWdobP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=W7ew/9euSgq0sJ8Q53u1XIcszNZ+ZN5f8S3/YTjnusEwdwIewENUTSA4RDw2wj7a2BsUt9yXLzlZAMn+VB9Jcyl6Gh1x18Lx0rkrU9jNV7KostcskFhYvq18C+EYEM0o0DFy0YyrMHBsvhVPZ/vzDpxqf9xZwPNt/zCT1BkOPg7dMn3/MstkdNnsKDA0hqit6KffbY7wLKdBg/yK8M4kcpYm8Rj0WpUcGyBo1w8eYAqGS5RzO3j+jrD9Dl+awGSLBBRfdOGU/kwKEVzzfHX7GCDbubd6oBMB/J3vWQBxwkkSpvc16MGHmpDccnuMnUT6jfZeKqNPC09L4KkAXQY0Og== 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=Gm9HaP4CVNDZ7pvOvfpT8CXxmH+u9YjtNAdq67pdCyw=; b=WkCrQSWy4QsccNqZE66j2mZ5qoNU7ABdQ/F8k8Q+c4EqSRfO9+TF0rZCVQ19uf2AEaYYQuedE7sFn2M2BOHGxqyYZhGd2N6ZBGwnmbnud08rJ5qBMbDGeEekpAnX9sPkae992BZgbsRIqp4Ouy9mVgd1ueNjTYY2S9QQrw0c0CmqqkZk1fHDWJ3eolJKfaw8W50OE04zfQcKqtlwFjK/LhXLIq9udFcT6ktVkcGMP2+09bd3chhcxf4hnHHSCthuv4lAgz8yNJR/mVwIXVTyUnnSnKcHraK9eJTvTEentyeFjDl4TJ8HGERSYuassvAz+ChcoW9dQ+LG7jc7rZdlaw== 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=Gm9HaP4CVNDZ7pvOvfpT8CXxmH+u9YjtNAdq67pdCyw=; b=zaSWdobPDA38rJRxD97aQkfCHV1lXUPFY4LfCn7JdHUJ1gT7t4kfm1bW71KO3nPF8R2I8j4ICrmY8uJdeIRkp4hVBYDuL7vOwZL8a1qvogJ38phfXlpq5/3Re9/yWY5qaLUmpAEq3US/+FzEm4jyUyQi4b9GbH0vHb8gmvnSl4c= Received: from DS7PR03CA0020.namprd03.prod.outlook.com (2603:10b6:5:3b8::25) by MN0PR12MB5716.namprd12.prod.outlook.com (2603:10b6:208:373::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.11; Thu, 8 Feb 2024 20:01:30 +0000 Received: from CY4PEPF0000FCC3.namprd03.prod.outlook.com (2603:10b6:5:3b8:cafe::8a) by DS7PR03CA0020.outlook.office365.com (2603:10b6:5:3b8::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.38 via Frontend Transport; Thu, 8 Feb 2024 20:01:29 +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 CY4PEPF0000FCC3.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.13 via Frontend Transport; Thu, 8 Feb 2024 20:01:29 +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.34; Thu, 8 Feb 2024 14:01:26 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v11 3/4] cxl/core, EINJ: Add EINJ CXL debugfs files and EINJ helper functions Date: Thu, 8 Feb 2024 14:00:41 -0600 Message-ID: <20240208200042.432958-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> References: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC3:EE_|MN0PR12MB5716:EE_ X-MS-Office365-Filtering-Correlation-Id: 813b8080-067f-4eb3-d46a-08dc28e0bd7b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4zgv5C1xpjRNhox6EZw4UPnPMOh3xTaC4rT+mS64NN1KpjWSrDDpB4T5i/YgbArH/ALs2thsuLVK7XnmyPsmlTWN/XTjQmmJY+r+tUdgezUg8gyoa7E0CVN8ks0b7UOwyWRRniKMUBO9zxoJnRTiyWdE7atL9KAZtydDN5Qauqm0Q/3pxTmAH2vCNe61Jfg/lvX5DoAljNfWeQusQipHtPE7XeU8XyvB7ZnIaxPQWV9uvCwvRnxmEAUnR8TBvtjXVjCXA8RsfsLieJVKT6Rxk/M26fjmvrxLj6g4rReJRFA1Hs8g1v8/sCobaGRLnC7V7nkHHo34ZbZPdqNxF2FRCdhg6jo+ZiQ2ZddphqjSYCDFzidgrj9E0SCsIP0B1c8Tk8Uz8Yqwi+/C3iQHlyxKpFuETe3up3whgbrbQczeJPjP7pJVwRX+6knB+zqthMLBDrfGJDIqWePLWCPILwKt0ClQZgXUN0uICU2mLOyEmRv/Ra0B1MwVkUfjFNIn/NCErvIzfGFIxXuu76zo1MQRX9P142yqsiN8XAwTuroL4lOT2CQ85k3po/PkuFv+pijSCajVnNo69Nc4ZBq0cYgsLTtVULqUjqg1E+oFFZRWx1k= 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)(4636009)(396003)(346002)(376002)(39860400002)(136003)(230922051799003)(1800799012)(451199024)(64100799003)(186009)(82310400011)(36840700001)(40470700004)(46966006)(30864003)(81166007)(2906002)(356005)(82740400003)(86362001)(83380400001)(110136005)(6666004)(26005)(36756003)(1076003)(16526019)(7696005)(2616005)(336012)(478600001)(7416002)(426003)(5660300002)(316002)(70586007)(54906003)(70206006)(4326008)(8676002)(8936002)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 20:01:29.5624 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 813b8080-067f-4eb3-d46a-08dc28e0bd7b 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: CY4PEPF0000FCC3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5716 Implement CXL helper functions in the EINJ module for getting/injecting available CXL protocol error types and export them 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 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: Dan Williams Signed-off-by: Ben Cheatham --- Documentation/ABI/testing/debugfs-cxl | 22 ++++ MAINTAINERS | 1 + drivers/acpi/apei/einj.c | 158 ++++++++++++++++++++++++-- drivers/cxl/core/port.c | 39 +++++++ include/linux/einj-cxl.h | 45 ++++++++ 5 files changed, 255 insertions(+), 10 deletions(-) create mode 100644 include/linux/einj-cxl.h diff --git a/Documentation/ABI/testing/debugfs-cxl b/Documentation/ABI/testing/debugfs-cxl index fe61d372e3fa..bcd985cca66a 100644 --- a/Documentation/ABI/testing/debugfs-cxl +++ b/Documentation/ABI/testing/debugfs-cxl @@ -33,3 +33,25 @@ 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 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/MAINTAINERS b/MAINTAINERS index 9104430e148e..02d7feb2ed1f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5246,6 +5246,7 @@ L: linux-cxl@vger.kernel.org S: Maintained F: drivers/cxl/ F: include/uapi/linux/cxl_mem.h +F: include/linux/einj-cxl.h F: tools/testing/cxl/ COMPUTE EXPRESS LINK PMU (CPMU) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 73dde21d3e89..9137cc01f791 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -37,6 +38,20 @@ #define MEM_ERROR_MASK (ACPI_EINJ_MEMORY_CORRECTABLE | \ ACPI_EINJ_MEMORY_UNCORRECTABLE | \ ACPI_EINJ_MEMORY_FATAL) +#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 +#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. @@ -543,8 +558,11 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, if (type & ACPI5_VENDOR_BIT) { if (vendor_flags != SETWA_FLAGS_MEM) goto inject; - } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) + } else if (!(type & MEM_ERROR_MASK) && !(flags & SETWA_FLAGS_MEM)) { goto inject; + } else if ((type & CXL_ERROR_MASK) && (flags & SETWA_FLAGS_MEM)) { + goto inject; + } /* * Disallow crazy address masks that give BIOS leeway to pick @@ -596,6 +614,9 @@ static const char * const einj_error_type_string[] = { "0x00000200\tPlatform Correctable\n", "0x00000400\tPlatform Uncorrectable non-fatal\n", "0x00000800\tPlatform Uncorrectable fatal\n", +}; + +static const char * const einj_cxl_error_type_string[] = { "0x00001000\tCXL.cache Protocol Correctable\n", "0x00002000\tCXL.cache Protocol Uncorrectable non-fatal\n", "0x00004000\tCXL.cache Protocol Uncorrectable fatal\n", @@ -621,29 +642,44 @@ 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) +int einj_cxl_available_error_type_show(struct seq_file *m, void *v) { - *val = error_type; + 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_puts(m, einj_cxl_error_type_string[pos]); + } return 0; } +EXPORT_SYMBOL_NS_GPL(einj_cxl_available_error_type_show, CXL); -static int error_type_set(void *data, u64 val) +static int 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 & 0x7fffffff; /* Only one error type can be specified */ if (tval & (tval - 1)) @@ -652,9 +688,105 @@ 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 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 << 24; + + bus = pbus->number << 16; + *sbdf = seg | bus | dport_dev->devfn; + + return 0; +} + +int einj_cxl_inject_rch_error(u64 rcrb, u64 type) +{ + u64 param1 = 0, param2 = 0, param4 = 0; + u32 flags; + int rc; + + if (!einj_initialized) + return -ENXIO; + + /* Only CXL error types can be specified */ + if (type & ~CXL_ERROR_MASK || (type & ACPI5_VENDOR_BIT)) + return -EINVAL; + + rc = validate_error_type(type); + if (rc) + return rc; + + param1 = (u64) rcrb; + param2 = 0xfffffffffffff000; + flags = 0x2; + + return einj_error_inject(type, flags, param1, param2, 0, param4); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_rch_error, CXL); + +int einj_cxl_inject_error(struct pci_dev *dport, u64 type) +{ + u64 param1 = 0, param2 = 0, param4 = 0; + u32 flags; + int rc; + + if (!einj_initialized) + return -ENXIO; + + /* Only CXL error types can be specified */ + if (type & ~CXL_ERROR_MASK || (type & ACPI5_VENDOR_BIT)) + return -EINVAL; + + rc = validate_error_type(type); + if (rc) + return rc; + + rc = cxl_dport_get_sbdf(dport, ¶m4); + if (rc) + return rc; + + flags = 0x4; + + return einj_error_inject(type, flags, param1, param2, 0, param4); +} +EXPORT_SYMBOL_NS_GPL(einj_cxl_inject_error, CXL); + +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 (val & CXL_ERROR_MASK && !(val & ACPI5_VENDOR_BIT)) + return -EINVAL; + + rc = validate_error_type(val); + if (rc) + return rc; + error_type = val; return 0; @@ -690,6 +822,12 @@ static int einj_check_table(struct acpi_table_einj *einj_tab) return 0; } +bool einj_is_initialized(void) +{ + return einj_initialized; +} +EXPORT_SYMBOL_GPL(einj_is_initialized); + static int __init einj_probe(struct platform_device *pdev) { int rc; diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 8c00fd6be730..c52c92222be5 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include #include @@ -797,6 +798,37 @@ 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; + + /* + * 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 (!einj_is_initialized() || + (!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, @@ -1144,6 +1176,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; } @@ -2220,6 +2254,11 @@ static __init int cxl_core_init(void) cxl_debugfs = debugfs_create_dir("cxl", NULL); + if (einj_is_initialized()) { + debugfs_create_file("einj_types", 0400, cxl_debugfs, NULL, + &einj_cxl_available_error_type_fops); + } + cxl_mbox_init(); rc = cxl_memdev_init(); diff --git a/include/linux/einj-cxl.h b/include/linux/einj-cxl.h new file mode 100644 index 000000000000..af57cc8580a6 --- /dev/null +++ b/include/linux/einj-cxl.h @@ -0,0 +1,45 @@ +/* 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 CXL_EINJ_H +#define CXL_EINJ_H + +#include + +#if IS_ENABLED(CONFIG_ACPI_APEI_EINJ) +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_is_initialized(void); +#else +static inline int einj_cxl_available_error_type_show(struct seq_file *m, + void *v) +{ + return -ENXIO; +} + +static inline int einj_cxl_type_show(struct seq_file *m, void *data) +{ + 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_is_initialized(void) { return false; } +#endif + +#endif From patchwork Thu Feb 8 20:00:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13550416 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2062.outbound.protection.outlook.com [40.107.92.62]) (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 C640138F9D; Thu, 8 Feb 2024 20:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.62 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422514; cv=fail; b=p37rOEVfNTuqdlJ9y4mcfT4wrD4rdWMb5RoNvZWWEigPtkUNm9vcw89fxzJ6qBAdPHboI4SRpHNBvtx+AGNj9FirJ9vsJeIqcw5TklxaNYYDW7QYcDR+V1Ck9ZxC0pCLV2QiAo01+1TAH+iSG4TZZw9o1QququzDOIO2UnL61mo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707422514; c=relaxed/simple; bh=XLnYU8UrZhpHulYofq559kIxqoHkQNSLgW2cUZDxLUw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gtepeK74ovQCxX77wKXPPtFQrQrNTk/CIMYBtdBSP2a2FBLrQLTaTLqbJj6rNqvPr7Sl8EGBmfkk9l15UHfVfVeprTif++zHn1BKYWXHm28bcCma35RzXLreIaKM92fPjP4j9csAFBxZqmd3SnG8KOffWX11bD263GFswaJubtk= 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=Nv4/UJCD; arc=fail smtp.client-ip=40.107.92.62 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="Nv4/UJCD" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/VDMfzNMp6ke4B5foMDVAYLc10HIoR60pg59D6KzvKq4sFsLoz37DsMt4cr7maMti8cQ3XHtpfhoCxmStoofv6ww6OVDrMgTasZeHNAQhgVkUnzZCUSK0g+9C/9pORu8oD00j8HmtYmHPnmQKN+CpVk3yUEJc6OPlIYQJNjpOKwlm4BbnRZfFoD7WGdOhAhg37PGlrD6nz2Wi73b61kxuNR9TDo5AqHox29M8EOh7I5Ete1JyUVqV8V2osyr8sUjCh5aIEJRfu5J284QxW6pecoZ8yuoJzmRZU0le/vXK0eV0Ub9+AYkPIMMQRow6AbqfAB4k8ZsKxgKrJLYtn+sQ== 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=vtdrTip3zbGgGOjU6FyLvef5VVUAAFBkwzvO037G+rw=; b=DQ1XDiH0GGqepz3z6OQxipt8MeDa/DoP1sNTTj2j8wdAZROimet6d+VJ6OSkCsGyqXQYh9vqvJPSWXvdfeeFrJQ6+5/0uoTs7eLWO78vlVAbqSQHqIuZm/YTJgRPXOZuDem0Gb2hJXG5vDjR7fMGwol9sje8DzLaObLQAz7WMm1xgjW+Uapz0gNkKQcZ7+UHVeGsO4Y441jsd9T9uJsDGpLy5DJmQZAzNitE/FQkrbX0qP/sZ5gbd7lmdc5vEjnijLX0XmyYmNo5cQ8YkUtxA8w9VNgE12MxoatbwG/1GUtWFalA6DafxD0Z0AJt8CRLtZwi85m4eVVS1O3bM3oIgw== 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=vtdrTip3zbGgGOjU6FyLvef5VVUAAFBkwzvO037G+rw=; b=Nv4/UJCDWQzGw2T0XKgzv7sl8hlRB6OCozXW6TZmAr4b24e5iLny9TaIi2AoREB4tWDsU1P+g/4i7DbsRNS3tkZkqBH50ID90Y51mC/VT57HEX08CQNH7MW+JcaR/AubiuJpX++PsUiKGpZU1sgrWCVZWEhzVALfZE0gSWD7w10= Received: from DS7PR03CA0028.namprd03.prod.outlook.com (2603:10b6:5:3b8::33) by SJ0PR12MB6829.namprd12.prod.outlook.com (2603:10b6:a03:47b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.15; Thu, 8 Feb 2024 20:01:46 +0000 Received: from CY4PEPF0000FCC3.namprd03.prod.outlook.com (2603:10b6:5:3b8:cafe::a4) by DS7PR03CA0028.outlook.office365.com (2603:10b6:5:3b8::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.38 via Frontend Transport; Thu, 8 Feb 2024 20:01:46 +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 CY4PEPF0000FCC3.mail.protection.outlook.com (10.167.242.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7181.13 via Frontend Transport; Thu, 8 Feb 2024 20:01:46 +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.34; Thu, 8 Feb 2024 14:01:45 -0600 From: Ben Cheatham To: , , , , , , , CC: , , Subject: [PATCH v11 4/4] EINJ, Documentation: Update EINJ kernel doc Date: Thu, 8 Feb 2024 14:00:42 -0600 Message-ID: <20240208200042.432958-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> References: <20240208200042.432958-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000FCC3:EE_|SJ0PR12MB6829:EE_ X-MS-Office365-Filtering-Correlation-Id: 43d6bcdd-e91d-4a54-c979-08dc28e0c76b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SIBNxVV79/DcAkh8p8DTTtjwzZc1oSmclAIRmE0CSR7dICWJild78U4+M2+PcUdKtA9Rt9I4LzMoee+1ijkxzHqwSdyxYULgvEjbhgmXw4v3sBtEn5NjPV+ruovawHJnRMduNvHDDzJubeXz71hoZhqbcU7SNVkneYh6kbcBSFYj+/m7SyafMHQhImFWKS4A11/rdkd4XBVz9J1fFdRYXP0n7eDy3hkF4vvJoBCtPBvFeYZ5KdYPJLg0h7n66GKBkfkgsj1tRJ415YQYNffpxO9hqHw5b01XvuDekaHV5yKKCsS1zGXM+tPzJL+BnmOdbgsqWo4/aN7f0wqDxJiHyIU278G16EXKQdXpXVc00TXrxA83eQpMjOIo32jOBLUDMMf0OJmBGqMuWrbLXt1oEAPaUfSUgL1kIEuz4ccBsWDLfSZvu7HP0mnP6pM7vOd3f+Jyn5UsSaJ6tvN6nn1owBjkC/YoaaeCl11IxX0ZLS6eBpfU3Z7bZ3J2U5LbebCWjZeymlOtDqNqALu4seS/ag89mEOXb07RtOkxgK2cUJYkMrjT7ZPz0Q0F0o+QspzKXVxCLdBHEY5hQFAHYqOIhvo/ylZXBMRkECRevlregsM= 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)(4636009)(136003)(396003)(346002)(376002)(39860400002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(82310400011)(46966006)(36840700001)(40470700004)(41300700001)(15650500001)(7696005)(2616005)(336012)(70206006)(1076003)(4326008)(5660300002)(8936002)(8676002)(6666004)(7416002)(2906002)(478600001)(81166007)(82740400003)(316002)(54906003)(110136005)(19627235002)(86362001)(83380400001)(356005)(426003)(70586007)(26005)(36756003)(16526019);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2024 20:01:46.2189 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43d6bcdd-e91d-4a54-c979-08dc28e0c76b 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: CY4PEPF0000FCC3.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6829 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: Dan Williams Signed-off-by: Ben Cheatham Reviewed-by: Jonathan Cameron --- .../firmware-guide/acpi/apei/einj.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Documentation/firmware-guide/acpi/apei/einj.rst b/Documentation/firmware-guide/acpi/apei/einj.rst index d6b61d22f525..f179adf7b61c 100644 --- a/Documentation/firmware-guide/acpi/apei/einj.rst +++ b/Documentation/firmware-guide/acpi/apei/einj.rst @@ -181,6 +181,25 @@ You should see something like this in dmesg:: [22715.834759] EDAC sbridge MC3: PROCESSOR 0:306e7 TIME 1422553404 SOCKET 0 APIC 0 [22716.616173] EDAC MC3: 1 CE memory read error on CPU_SrcID#0_Channel#0_DIMM#0 (channel:0 slot:0 page:0x12345 offset:0x0 grain:32 syndrome:0x0 - area:DRAM err_code:0001:0090 socket:0 channel_mask:1 rank:0) +CXL error types are supported from ACPI 6.5 onwards. These error types +are not available in the legacy interface at /sys/kernel/debug/apei/einj, +and are instead at /sys/kernel/debug/cxl/. There is a file under debug/cxl +called "einj_type" that is analogous to available_error_type under debug/cxl. +There is also a "einj_inject" file in each $dport_dev directory under debug/cxl +that will inject a given error into the dport represented by $dport_dev. +For example, to inject a CXL.mem protocol correctable error into +$dport_dev=pci0000:0c:: + + # cd /sys/kernel/debug/cxl/ + # cat einj_type # See which error can be injected + 0x00008000 CXL.mem Protocol Correctable + 0x00010000 CXL.mem Protocol Uncorrectable non-fatal + 0x00020000 CXL.mem Protocol Uncorrectable fatal + # cd 0000:e0:01.1 # Navigate to dport to inject into + # echo 0x8000 > einj_inject # Inject error + +To use CXL error types, ``CONFIG_CXL_EINJ`` will need to be enabled. + Special notes for injection into SGX enclaves: There may be a separate BIOS setup option to enable SGX injection.