From patchwork Tue Nov 28 16:06:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13471426 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="AJ0PqEUm" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2085.outbound.protection.outlook.com [40.107.237.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72914DA; Tue, 28 Nov 2023 08:07:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g3c84fCmg56skiujxRbXQf5MIKttj5NJ9PMZW4efZeFCYTDDaKxAhbgvCxTkfiLa2MtcXO2OeIXafG2d/ODz6AIa1DLuzDxE10ltPapanqaKOXJMcLqbUD+4fTnL3zLCVT0e55npbXa+YMJ82pXH6VsI/KdX7VcCu0/xKUsWwZP2i8yvlLOqMjKfrg3LgNKnXvKTfcQmi6oNvK4RDooBspvdmeSxM1EVL0InuvLlyQvtESAYJPIgYTaUqP3XZ9LTreOSjAB/FVuWQNvsfGV/pFmKATKVWjl97nMNaexXho1lrX00kGcG/QxCFivEdU4PQe6zsb2njvl1/c3FFyN9cw== 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=ns6sYwxro6lc7RGkxwPb/0p/KGPAaDwl+r3CHX1WmF4=; b=YYc392T2aX2EXGqlTSDRPt0xBWvCURyMgMyay2i4h09FauvbS/8Sy259UW53tNUrUYFXppaDR6Fc+JKc0R+usk8akCZ6XI/YcyMj9qUTfwbX6lAZxHKmsMHyVxcAzcV4+R3drNmpQwbkyXxqOJXIk7/kKQ+THtCiH8RuRK43TWwzL+/he1JTPiWlbslsdtRRGt014vvSvi0laf8O2wlTgJ3Efb1xS1Vs3GcOE76nfiFqTCs4B+4m1FlVsGJdbl1gDkDTz6h1zgcjjQpAFgC58pKhEA/93scMq2qgXUC4tpIJxLrDTRok0XTU86d9VKfCY6Q3AraJDjtKerS81BazHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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=ns6sYwxro6lc7RGkxwPb/0p/KGPAaDwl+r3CHX1WmF4=; b=AJ0PqEUmKtOU6qPA6KM2aMOe7WhfIp6OAkOwCLGK/bb3IQgVTo+86UFo9/ZwUPG4kNXIfoPLf9z6fFba7a8jjwnCFqv7YCBhiZ5uAXbw2bULCuX5uh5sxSq9bJotTJM6d1fcc0XkWYXwKqAYYcjVaXk/y6HDK0KYm6ClNANjaJI= Received: from DS7PR07CA0011.namprd07.prod.outlook.com (2603:10b6:5:3af::22) by DM4PR12MB5748.namprd12.prod.outlook.com (2603:10b6:8:5f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29; Tue, 28 Nov 2023 16:07:25 +0000 Received: from DS1PEPF0001709C.namprd05.prod.outlook.com (2603:10b6:5:3af:cafe::ce) by DS7PR07CA0011.outlook.office365.com (2603:10b6:5:3af::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29 via Frontend Transport; Tue, 28 Nov 2023 16:07:25 +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 DS1PEPF0001709C.mail.protection.outlook.com (10.167.18.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7046.17 via Frontend Transport; Tue, 28 Nov 2023 16:07:25 +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; Tue, 28 Nov 2023 10:07:23 -0600 From: Ben Cheatham To: , , , , , , , CC: , , , Subject: [PATCH v7 1/5] cxl/port: Add EINJ debugfs files and callback support Date: Tue, 28 Nov 2023 10:06:52 -0600 Message-ID: <20231128160656.166609-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> References: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709C:EE_|DM4PR12MB5748:EE_ X-MS-Office365-Filtering-Correlation-Id: e9050e4c-e4a8-429d-2426-08dbf02c1cc0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wGEr0fDFP4Hiot7cJlEfqvPFbvEAkPt6PvslX2dv7163eCPTuZMiWVjWqDGmdcUhXDTvKZyW4nrv/3OrjVTo9CWNoJChIH2FVoDhRSrjlWxQ1GmDdh+bn5xjQaek2oXybo0cQJlcgEryWozPtJcaqTHO4u0MGqmwTxjg94dTwq1g6Gwb9v4su1bsSWZOCLhAvMYzpQhwjaIR2L1fgq2ni5SVUsVl/JfubLchGTUlgABDt+YQxXXk6W+DgfiVdn1IfrdHhOmYHoEIJiCDzwaC9LQPcUNGQmM0fReIA1V6JMvqvSsWwW4pflkdQUv3c/CQFiUPzelGIlyv8V7TtLaxa/p/PFpJ2YiOTnlmTq2+urmVgQlLZiiRLmjsNRMtIGgmRV9nT9vmSvdIHn3TQF0xBiU6btqGToWR+sxmNl2HDlivOsdlhj8hZ4cPiKgpyedla2DhIoR+Z3TZtGbq9ShEh19NLks2CCDgb8zPNFrScHIWV9xAu/ffe6TZmKrzeEcBYlKdu+Gyw9mdrSUDYx1X2H1gy2E76LzzO07FaoIgD9erSvt5s3/G+z7eiRDU8h+58xCT5qaBHtCMVU2wE7z7vF66+8wUWSVTTfoGueN/by51lQKSGzwMOWFVbYeii1v4U04Vo5ksBH14Lf9aDKHvbRSzz8XuQ1kDFsunk/Ah5WUwaLpz5amKLTelhSQt7g4HH+olAqNJFuZYXH+MdpGPY0w99GBNe3QIGhfnTEuBsce+roFtI/Acnrwn1Uun3kBrxzEblpz+7NiY3kV/Dudm4A== 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)(376002)(39860400002)(346002)(396003)(230922051799003)(64100799003)(451199024)(1800799012)(82310400011)(186009)(46966006)(40470700004)(36840700001)(36860700001)(36756003)(82740400003)(356005)(40460700003)(86362001)(81166007)(41300700001)(7696005)(478600001)(6666004)(7416002)(4326008)(5660300002)(8676002)(110136005)(54906003)(70586007)(70206006)(316002)(8936002)(2906002)(47076005)(40480700001)(426003)(336012)(16526019)(26005)(2616005)(1076003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 16:07:25.3701 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e9050e4c-e4a8-429d-2426-08dbf02c1cc0 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: DS1PEPF0001709C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5748 Add creation of debugfs directories for ports and dports under /sys/kernel/debug/cxl when EINJ support is enabled. The dport directories will contain files for injecting CXL protocol errors. These files are only usable once the EINJ module has loaded and registered callback functions with the CXL core module, before that occurs (or if the EINJ module isn't loaded) the files will do nothing and return an ENODEV error. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- Documentation/ABI/testing/debugfs-cxl | 27 +++++++++ drivers/cxl/core/port.c | 84 +++++++++++++++++++++++++++ drivers/cxl/cxl.h | 10 ++++ 3 files changed, 121 insertions(+) diff --git a/Documentation/ABI/testing/debugfs-cxl b/Documentation/ABI/testing/debugfs-cxl index fe61d372e3fa..782a1bb78884 100644 --- a/Documentation/ABI/testing/debugfs-cxl +++ b/Documentation/ABI/testing/debugfs-cxl @@ -33,3 +33,30 @@ 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/portX/dportY/einj_types +Date: November, 2023 +KernelVersion: v6.8 +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 dportY. This file is only visible if + CONFIG_ACPI_APEI_EINJ is enabled, and the EINJ module must + be able to reach one (or both) of the CXL_ACPI or CXL_PORT + modules to be functional. + +What: /sys/kernel/debug/cxl/portX/dportY/einj_inject +Date: November, 2023 +KernelVersion: v6.8 +Contact: linux-cxl@vger.kernel.org +Description: + (WO) Writing an integer to this file injects the corresponding + CXL protocol error into dportY (integer to type mapping is + available 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. This file is only visible if + CONFIG_ACPI_APEI_EINJ is enabled, and the EINJ module must + be able to reach one (or both) of the CXL_ACPI or CXL_PORT + modules to be functional. diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 38441634e4c6..acf10415a174 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -783,6 +783,72 @@ static int cxl_dport_setup_regs(struct device *host, struct cxl_dport *dport, return rc; } +static struct cxl_einj_ops einj_ops; +void cxl_einj_set_ops_cbs(struct cxl_einj_ops *ops) +{ + if (!IS_REACHABLE(CONFIG_ACPI_APEI_EINJ) || !ops) + return; + + einj_ops = *ops; +} +EXPORT_SYMBOL_NS_GPL(cxl_einj_set_ops_cbs, CXL); + +static int cxl_einj_type_show(struct seq_file *f, void *data) +{ + if (!einj_ops.einj_type) + return -ENODEV; + + return einj_ops.einj_type(f, data); +} + +static int cxl_einj_inject(void *data, u64 type) +{ + struct cxl_dport *dport = data; + + if (!einj_ops.einj_inject) + return -ENODEV; + + return einj_ops.einj_inject(dport, type); +} +DEFINE_DEBUGFS_ATTRIBUTE(cxl_einj_inject_fops, NULL, cxl_einj_inject, "%llx\n"); + +static int cxl_debugfs_create_dport_dir(struct dentry *port_dir, + struct cxl_dport *dport) +{ + struct dentry *dir; + char dir_name[32]; + + snprintf(dir_name, 31, "dport%d", dport->port_id); + dir = debugfs_create_dir(dir_name, port_dir); + if (IS_ERR(dir)) + return PTR_ERR(dir); + + debugfs_create_devm_seqfile(dport->dport_dev, "einj_types", dir, + cxl_einj_type_show); + + debugfs_create_file("einj_inject", 0200, dir, dport, + &cxl_einj_inject_fops); + return 0; +} + +static struct dentry *cxl_debugfs_create_port_dir(struct cxl_port *port) +{ + const char *dir_name = dev_name(&port->dev); + struct dentry *dir; + + if (!IS_ENABLED(CONFIG_ACPI_APEI_EINJ)) + return ERR_PTR(-ENODEV); + + dir = cxl_debugfs_create_dir(dir_name); + if (IS_ERR(dir)) { + dev_dbg(&port->dev, "Failed to create port debugfs dir: %ld\n", + PTR_ERR(dir)); + return dir; + } + + return dir; +} + static struct cxl_port *__devm_cxl_add_port(struct device *host, struct device *uport_dev, resource_size_t component_reg_phys, @@ -861,6 +927,7 @@ struct cxl_port *devm_cxl_add_port(struct device *host, struct cxl_dport *parent_dport) { struct cxl_port *port, *parent_port; + struct dentry *dir; port = __devm_cxl_add_port(host, uport_dev, component_reg_phys, parent_dport); @@ -878,6 +945,10 @@ struct cxl_port *devm_cxl_add_port(struct device *host, parent_port ? " to " : "", parent_port ? dev_name(&parent_port->dev) : "", parent_port ? "" : " (root port)"); + + dir = cxl_debugfs_create_port_dir(port); + if (!IS_ERR(dir)) + port->debug_dir = dir; } return port; @@ -1127,6 +1198,7 @@ struct cxl_dport *devm_cxl_add_dport(struct cxl_port *port, resource_size_t component_reg_phys) { struct cxl_dport *dport; + int rc; dport = __devm_cxl_add_dport(port, dport_dev, port_id, component_reg_phys, CXL_RESOURCE_NONE); @@ -1136,6 +1208,11 @@ struct cxl_dport *devm_cxl_add_dport(struct cxl_port *port, } else { dev_dbg(dport_dev, "dport added to %s\n", dev_name(&port->dev)); + + rc = cxl_debugfs_create_dport_dir(port->debug_dir, dport); + if (rc) + dev_dbg(dport_dev, + "Failed to create dport debugfs dir: %d\n", rc); } return dport; @@ -1156,6 +1233,7 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, resource_size_t rcrb) { struct cxl_dport *dport; + int rc; if (rcrb == CXL_RESOURCE_NONE) { dev_dbg(&port->dev, "failed to add RCH dport, missing RCRB\n"); @@ -1170,6 +1248,12 @@ struct cxl_dport *devm_cxl_add_rch_dport(struct cxl_port *port, } else { dev_dbg(dport_dev, "RCH dport added to %s\n", dev_name(&port->dev)); + + rc = cxl_debugfs_create_dport_dir(port->debug_dir, dport); + if (rc) + dev_dbg(dport_dev, + "Failed to create rch dport debugfs dir: %d\n", + rc); } return dport; diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index 687043ece101..3c7744fc3106 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -590,6 +590,7 @@ struct cxl_dax_region { * @depth: How deep this port is relative to the root. depth 0 is the root. * @cdat: Cached CDAT data * @cdat_available: Should a CDAT attribute be available in sysfs + * @debug_dir: dentry for port in cxl debugfs (optional) */ struct cxl_port { struct device dev; @@ -612,6 +613,7 @@ struct cxl_port { size_t length; } cdat; bool cdat_available; + struct dentry *debug_dir; }; static inline struct cxl_dport * @@ -813,6 +815,14 @@ bool is_cxl_nvdimm_bridge(struct device *dev); int devm_cxl_add_nvdimm(struct cxl_memdev *cxlmd); struct cxl_nvdimm_bridge *cxl_find_nvdimm_bridge(struct cxl_memdev *cxlmd); +struct cxl_einj_ops { + int (*einj_type)(struct seq_file *f, void *data); + int (*einj_inject)(struct cxl_dport *dport, u64 type); +}; + +void cxl_einj_set_ops_cbs(struct cxl_einj_ops *ops); + + #ifdef CONFIG_CXL_REGION bool is_cxl_pmem_region(struct device *dev); struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev); From patchwork Tue Nov 28 16:06:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13471427 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="k8R4mEOy" Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2061.outbound.protection.outlook.com [40.107.212.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4867131; Tue, 28 Nov 2023 08:07:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TnmpAtfg8add3M11QLlgDROU39iuMrdBUK89/KqwycI5UNziyEDGhmLCr5HrC3CVCInTRUoghVnimGINth9eOkdCsonewxuxJ2MTsfp2ZDhJN3VqXVqzW/r9RPFJ+XswvZaV2KTUa9/HY/d9Sb/sr/UUG5i6lF7G3YWpqOVXwngQ0SgBSxaU+UaNRmSjJW+/1lHXSm8I0Urm8LQI/NYSavM3bQfABkwLjWPaa/XPx0AybU8h7lu7l9vL1QjmEiji5mgJ9pMn3WsKcd+Rey1ioTA6UAvhPhBi/2BwLYqg0nxvaeJUucZGjjJefFFyV3Sg+UYSCPuz5MlUYU6zj3qdvQ== 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=SoymjZeBWJv98iRBUeXbhYNTbtjnAJrzXYv9neam/zE=; b=ZEzD/RsggO9IiD4U0ASPlMgJMYSaslGfglz1xiPTWqyvZyqOxKhE6hCiTlCXuhdt7tzvH3bHT0qK6RDSNHVD5nQnhz/3X4v2y1toy/j7M3tYC1nqHWHtCJtWP/Xpw/ki2VHqVvuhVhWYKjxBB5J9Jm8nwWb6QNWZi9cK5k7hG9PpWC3Lu9q3sjVtF93cijuisS9XleC+lU/7xErehCfqVMo+dj2XJK3j9NNJkXdCyfomxh4u5RUl6K0u6zGWsjcwYp66roiTf9naOI9X+5iD2TlxSZBNQaKFIxX5g0Dzb3P1IAoROdaXqqBtL/IJ3AaYIw9+YPYsHhRt9/zqAd5u0g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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=SoymjZeBWJv98iRBUeXbhYNTbtjnAJrzXYv9neam/zE=; b=k8R4mEOyyICQgFYuhjBdNOYJoNEQD4hUC9E8NUqWuFIu136toWTp5DX8aKC5p82bINUC4ZbT5XtsKLVE2NhP4zHchzUglQgWirz1lE2ONEFHvtf5DdoRazvf6LwyDX5SZL6ZR58RajE2oAM+6L+LDpDeyL3NUA2sRpJ7ixjIGvA= Received: from BYAPR08CA0067.namprd08.prod.outlook.com (2603:10b6:a03:117::44) by DM6PR12MB5005.namprd12.prod.outlook.com (2603:10b6:5:1be::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Tue, 28 Nov 2023 16:07:40 +0000 Received: from DS1PEPF0001709D.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::cc) by BYAPR08CA0067.outlook.office365.com (2603:10b6:a03:117::44) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29 via Frontend Transport; Tue, 28 Nov 2023 16:07:40 +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 DS1PEPF0001709D.mail.protection.outlook.com (10.167.18.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7046.17 via Frontend Transport; Tue, 28 Nov 2023 16:07:39 +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; Tue, 28 Nov 2023 10:07:37 -0600 From: Ben Cheatham To: , , , , , , , CC: , , , Subject: [PATCH v7 2/5] ACPI: Add CXL protocol error defines Date: Tue, 28 Nov 2023 10:06:53 -0600 Message-ID: <20231128160656.166609-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> References: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709D:EE_|DM6PR12MB5005:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b5d0b65-41bc-4a51-3fc2-08dbf02c256d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ofs+7zBr7SG1ycGQFTqGVjxtthREMWWTtSqPW14WaLqI7glRU+aw2Pb3xjwFawOJQSIlC0BE69pREqtj3edmuopFO7PQqB1rAiuUQrq7t11ytXpe0RyVIUiv3Lu0uBz2AjBDw1ZL0giz21mLNrbICM6KnC+SUHQXDDoXjA+19rMLBq/64kv5PMzJ8Asn7mEFwtC32otMQ6o6/vb2Q5gvFXhy6lTTTNFalT73DJ8yyAFj853QIYVomLYdcg+KEEGfpptYC1gV/uggLu/3XyoOEJNOpx/wtWVwnFfq/NBHgJteQHIL8NVF2tvyflbu5ORTzO+4AiH5goXkMB6jalu9Y6V++Rv83/Wz4UKkcypdhv4D+QebmUZtbnwVZYFGuHnen7iZuP/DcDwbXHV1UJJ2537pxR7sqS+bXgHd9qF5FkuT0uBEL0QZjqMyQpUzMDR+Z782QZDeGhW2nyjje3ZAhCt6VgM9FZMIqUE1bdKv3xJCMzwKQ9dfNjYjdh1XCbB8mYvx3I8n8VnYXkVVI/LwC8uZwf88Hc7VNXpgeFELM/rt4KESPiAeq4ni+HJusT8aenrWiVFWP1Ug4Ce/R4TKBjwKgT9lsNVR7AFhSH+SSgwd7Si9pSFsvMHzl3hpE8Os2xODiw/2ETYQgOndZlP7viHPiPWctCiYzmEEZvC7e+++qALE3B9DFM2gn92np1jv84oZ4rSU9kDUpfmejDZnDqyMLrMl1LrlYRv9pNIsWRHazxm2Xo7AiJlgRVGbBYjJmCBOJnZghzMgASDUtkhRJg== 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)(136003)(396003)(376002)(346002)(230922051799003)(186009)(1800799012)(451199024)(64100799003)(82310400011)(36840700001)(40470700004)(46966006)(2906002)(7416002)(5660300002)(70206006)(70586007)(110136005)(41300700001)(8676002)(8936002)(478600001)(7696005)(6666004)(4326008)(966005)(2616005)(316002)(16526019)(426003)(26005)(336012)(1076003)(83380400001)(54906003)(47076005)(40480700001)(36860700001)(86362001)(40460700003)(356005)(81166007)(36756003)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 16:07:39.9419 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b5d0b65-41bc-4a51-3fc2-08dbf02c256d 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: DS1PEPF0001709D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB5005 Add CXL protocol error defines to include/actbl1.h. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- I made a pull request for adding this support into the acpica project that has already been merged [1], Feel free to discard this commit and use the acpica changes instead. [1]: Link: https://github.com/acpica/acpica/pull/884 --- include/acpi/actbl1.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index a33375e055ad..1f58c5d86869 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -1096,6 +1096,12 @@ enum acpi_einj_command_status { #define ACPI_EINJ_PLATFORM_CORRECTABLE (1<<9) #define ACPI_EINJ_PLATFORM_UNCORRECTABLE (1<<10) #define ACPI_EINJ_PLATFORM_FATAL (1<<11) +#define ACPI_EINJ_CXL_CACHE_CORRECTABLE (1<<12) +#define ACPI_EINJ_CXL_CACHE_UNCORRECTABLE (1<<13) +#define ACPI_EINJ_CXL_CACHE_FATAL (1<<14) +#define ACPI_EINJ_CXL_MEM_CORRECTABLE (1<<15) +#define ACPI_EINJ_CXL_MEM_UNCORRECTABLE (1<<16) +#define ACPI_EINJ_CXL_MEM_FATAL (1<<17) #define ACPI_EINJ_VENDOR_DEFINED (1<<31) /******************************************************************************* From patchwork Tue Nov 28 16:06:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13471428 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="zLHsTA18" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2070.outbound.protection.outlook.com [40.107.237.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8348DA; Tue, 28 Nov 2023 08:08:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=crjElxsftwl3v+4V2HMHlzUv2lNGJBKF+/fPIVUiz2YHppaFEuhBHLJpdjNN3T7faGCH3dyTExiO0BxSn0fQhqDaHCx6zBA6s1NwQxV1ziynxuhycqQDLVXRhpY7nR4y1UZAjK6yyM7iQCBrQrD3yvEwSrDV96z9g4EmCjCTpgQ0o6hwMDUEjGPIl9AYbDxLvhhjTSR7dhVdAoJkQU7SjBxwT3xoM8jCeTx/JRgsZ0d6vZYCLV+nyC4GMiSfx3/3Jg18l6EHWnpvbbcCPcLudMYAsYq51H+TBREHyr9tW1WuJaiBWpV5csbwWWDHVlUC/9SCSr8Xi2ySgLLll2Bbsg== 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=HpdOUavzoqSck9qktjmzFE/mPcGFPOTqpJVv7ck2n1w=; b=K4vbmVHME33CoaIe5gtF0NBtFyD8oW0mtspHbrPKfD1Jbcv0ahwfCSTbOmktHeDsJcN7cvxYxlzokXiWZoBR4KoV3aRdJyvvoWUgcjrwKnmkdIADfp9LeMvQGG7Rfet1tcHFyMKaWDTyKFH1qLcyelBb9OFWuveMrqu9xlhC+mC8IN61NzaE2OMvc/axFLsveR4rnMr24MKq8YD4zv1vbTyd2Rxwx7lKDq930iNF6lA8gbIhl6yQ5oiwfTl5YNQDeKnPHfL5n4o9siizxrzz/cH4be1YPn/UJ0MD3xuANLRXDz10GFC8flqaazdZPiKscG6eyRIRLpsuPmNBfL01iQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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=HpdOUavzoqSck9qktjmzFE/mPcGFPOTqpJVv7ck2n1w=; b=zLHsTA18qrfdQbR8mTNHu2ySQHrj5NMRXyD9KwMySiRK8OAA0y+twkARVg7sljPCZ7TFy5iZS+r3L4BvvcNXhzTIVyvI9CjiOys8U5p9GSv6ypyLPM9q26KTiSziaD8OBOtSgpXZEeOJLDt+Suykbzs8bklIbCGhdh2GBj80xY8= Received: from BYAPR08CA0069.namprd08.prod.outlook.com (2603:10b6:a03:117::46) by SA1PR12MB9003.namprd12.prod.outlook.com (2603:10b6:806:389::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Tue, 28 Nov 2023 16:08:13 +0000 Received: from DS1PEPF0001709D.namprd05.prod.outlook.com (2603:10b6:a03:117:cafe::60) by BYAPR08CA0069.outlook.office365.com (2603:10b6:a03:117::46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29 via Frontend Transport; Tue, 28 Nov 2023 16:08:13 +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 DS1PEPF0001709D.mail.protection.outlook.com (10.167.18.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7046.17 via Frontend Transport; Tue, 28 Nov 2023 16:08:13 +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; Tue, 28 Nov 2023 10:08:08 -0600 From: Ben Cheatham To: , , , , , , , CC: , , , Subject: [PATCH v7 3/5] EINJ: Separate CXL errors from other EINJ errors Date: Tue, 28 Nov 2023 10:06:54 -0600 Message-ID: <20231128160656.166609-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> References: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709D:EE_|SA1PR12MB9003:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f16708b-423c-4eb8-29e9-08dbf02c392e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xtjAwOR1okEFeUvySze1nwMYOPI1unPq3H/ucXGUjpiDki4+T4ilTZReVAIhXooDomu1AyugIwt3+hTvm1V9aUnUFy+BcB84wwV/MYy2peCgM4WwbRxywJmg1gt8pEI6BCl8oAUVzccXFrvggvN/JTm1EZfXPS/FuU+WDjj0cc2n5NYqZ0RIPFs+S4pMaaJbSPJFKj8h0ENeGoJocpIz/p50o40NT+1fmd0oQ93UZVU2J7vK7JtAqQiZab/SNN9K99fk7pKCr0j0zNbzbHISI5ASgDJDzHx1qCOLITYZ8+lwazKfM++XDAMMcDfA4U3dmwjVsvDY0gl4PfQgCoCAD+uHZF97c/QXQlDFMOSE40QeWnjsIwBfk7Eqsz/qR1iZuICfLyGdh/3zMXExgi1WmuvqJHxG1FbzUPj4530oTVv/J2HwkEgEz0scy1wQFhWESyyhHjo1yVFlpl7aUPDPyBmKBOKM0Qz1e0+qcU9B6GfPdOGPC9qmlYYKt1QCcAuo/MinD36W4MRkqPFNx6TYbMK09XaUUgrxaZ1vxPX6P6N1hhFVwedM9sM9DNIa+ITydIPKPZUMpEquSEZ74/tfEXMG9/Xprm3DVqQeUkANtZjU9NnX2zCqHkvqRQHzEVmHbWKtlk/W/XaYJSCQu0h2JJtEDPEjXS5lxFE5bSDl90iNiCr19kd6jvBa0ZA7rQbqwEeMVRF6rli6yi5UEDzGWNFRoI2DGKFzdFkrwr7bzxUq+y3QJ7BXIu4+mhJ8ycHdcUStlwF/09C5ujbIvnT6SQ== 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)(346002)(136003)(39860400002)(376002)(396003)(230922051799003)(1800799012)(82310400011)(186009)(64100799003)(451199024)(46966006)(40470700004)(36840700001)(40480700001)(36756003)(41300700001)(36860700001)(1076003)(81166007)(47076005)(356005)(83380400001)(336012)(426003)(7416002)(82740400003)(5660300002)(70206006)(16526019)(86362001)(26005)(2616005)(2906002)(70586007)(7696005)(6666004)(8936002)(8676002)(4326008)(478600001)(40460700003)(110136005)(316002)(54906003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 16:08:13.0829 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0f16708b-423c-4eb8-29e9-08dbf02c392e 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: DS1PEPF0001709D.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB9003 Separate CXL error types from other EINJ error types and disallow them in the legacy EINJ interface under /sys/kernel/debug/apei/einj. Support for the CXL error types will be added under /sys/kernel/debug/cxl in the next commit. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- drivers/acpi/apei/einj.c | 56 +++++++++++++++++++++++++++++----------- 1 file changed, 41 insertions(+), 15 deletions(-) diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 013eb621dc92..330329ac2f1f 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -36,6 +36,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. @@ -537,8 +543,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 @@ -590,6 +599,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", @@ -615,29 +627,21 @@ static int available_error_type_show(struct seq_file *m, void *v) DEFINE_SHOW_ATTRIBUTE(available_error_type); -static int error_type_get(void *data, u64 *val) -{ - *val = error_type; - - return 0; -} - -static int error_type_set(void *data, u64 val) +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)) @@ -646,9 +650,31 @@ 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_get(void *data, u64 *val) +{ + *val = error_type; + + return 0; +} + +static int error_type_set(void *data, u64 val) +{ + int rc; + + 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; From patchwork Tue Nov 28 16:06:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13471429 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="BuqxhUa9" Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2069.outbound.protection.outlook.com [40.107.93.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78379127; Tue, 28 Nov 2023 08:08:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IFfo5kayrpfCojc43daM5m4/sqHCWyiWIbZQDFHEHEy4J3iAaVO8Mtz5X1BeMKVskt6I34IXVlK0W5RxFsXNx94/qusf27dz8Ex5AewzimUWItFqt/KZ7eOrW/iJ0JYcoSIKekC3VyC/Msv+eUVYE9tMHR3HrwFu1qyIRnQNvCuCoV2HEaag9qQ6scPJZXoSjjd+vT7AoR806LI84ZYiJJtUO7WC+RhxjMkrsqjYFWTH5FD4+XfdoJw9yP/M7ttQUXGbCHexaf+xmpehuRQEAjZnhcORoWT2J3U2J/Tb8j+Oqw7wLG1e+sr3EASh6EzRQyfM04zqq1MmZtZXUXIbjg== 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=s6I5Xyc73JTe3RYrhuUWYwpjFhVb/m/BBl1g1rIArk0=; b=SVjmPJIXE/Xi9JSJ8uLNQuj/pZWJlEcoi+PSqxPGYTEfUXx0SsrHrT3LPhfqK/q0Ua9aDESCaT7xcwcp3vztkdLe0cKdCJnvJSLJJQ2Gkht3RuB9fqTFtf6bOF5RLYj/pK9APXjReTtFlS4D+hv2MwPJqQ1aZHP5iWZwPImGSEmY9lMBiAW2kxMRZPWTUMIzINIv6UR9Ki0NwW+cY1MzFkZQldIq2FN3FLLt5lk6+jLl49E+Uoz2SVtr9+Y40F7NX0uVcYelNirZZTEr6xeurm1wLf5urpGLZyIOzmrpLmRbHzh4741UCrx/u0hiTEqZIPuoLW6Mtdo6kyA7Ye4jXg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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=s6I5Xyc73JTe3RYrhuUWYwpjFhVb/m/BBl1g1rIArk0=; b=BuqxhUa9jhMNuqFVCvAznF6/8wTNgbp3Qin2fqiHbenvfNcFba/TeY9Pk9AbaOPvsTc2pm3l96FggHDfa0lMEavMEP8arZnUHKH3DrI7ccYU67hbOkC3k93Y0cqgq1Q7YyWt55MwiO62O1FaDDdwf/ihnEhjTFihCN1aHF+bDKc= Received: from DS7PR07CA0008.namprd07.prod.outlook.com (2603:10b6:5:3af::21) by SJ2PR12MB9244.namprd12.prod.outlook.com (2603:10b6:a03:574::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Tue, 28 Nov 2023 16:08:25 +0000 Received: from DS1PEPF0001709C.namprd05.prod.outlook.com (2603:10b6:5:3af:cafe::7a) by DS7PR07CA0008.outlook.office365.com (2603:10b6:5:3af::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29 via Frontend Transport; Tue, 28 Nov 2023 16:08:25 +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 DS1PEPF0001709C.mail.protection.outlook.com (10.167.18.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7046.17 via Frontend Transport; Tue, 28 Nov 2023 16:08:25 +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; Tue, 28 Nov 2023 10:08:22 -0600 From: Ben Cheatham To: , , , , , , , CC: , , , Subject: [PATCH v7 4/5] cxl/port, EINJ: Add CXL EINJ callback functions Date: Tue, 28 Nov 2023 10:06:55 -0600 Message-ID: <20231128160656.166609-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> References: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709C:EE_|SJ2PR12MB9244:EE_ X-MS-Office365-Filtering-Correlation-Id: db7a791d-87ce-4709-d996-08dbf02c4066 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sASv7unwP/ei4hN8ZpkXQD9JKS37c9HraeSfb0O5LhxGrjRnxfLiFh3Cqg3lwD1cP0pfvRy0k2tpSKZrFhJ6i62/npfU13c4tDwsKupcjg369bb+1X1UTp2H79y7UZZ/jKVfVEEpEvr4zGYSrbZ23DOEK3MGkgKkEmtPUWxa5pE2lW2GYSFUertltlyz4064akpc/wZ/OD1FNTKdkeGpvB7OQO1j9DkRAzFJ9rgmMXjyRCLvNB+nPRA1ep6XvO0P+y1INNRymUnIizGbIUmvpqnPdsyO41Ez8WLJhkOlOFiZrBAHiihq2kaEXbQv+uEjma3b1un2ExMLis6xeeKH0gWQ2+Lwyq4QGcmps1PuvD7apaepehO/oZp9/lPGKZ3YwK/TtqrMh4kG5/+KdLNgEBwxQPt524IQ8oq3M97/iu7ZgjDTmgyzKnoo7jbJvcFe4Kod5zXzV4iqDjfl1NC9ARFRsuyLj8T6m7o+p0GSGMR7JZZ6ibCh1s/efumRlYY3gxpfaUsN4rH8Tu3sbv4kdPHjt9OcDr07VIZ8tgRnIVp3KDrqvpNS7M5Z3PefdO9gftl7RYY4K1VAioeAaPBN4vCbqsad5COl5TFY0YPBU+KxviEJWjkkBY3fxXCnyKV+s0a+q8o4yMWXIIo9DEGBVcTLearcNdfKzQbiuPFyDuADGSwYrlZMgmydfiyWSTD8IXl06hpcYyHRPP8isl0iIk4bTOHceX+kNUfbfl1uA9s3+pYiBwTd9Heo99xerV7CZx82+TQ4PQ4Wl7ejLnDMQg== 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)(376002)(346002)(136003)(396003)(39860400002)(230922051799003)(64100799003)(82310400011)(451199024)(1800799012)(186009)(36840700001)(46966006)(40470700004)(70586007)(110136005)(70206006)(36860700001)(336012)(426003)(54906003)(316002)(8936002)(4326008)(47076005)(8676002)(40460700003)(83380400001)(2906002)(36756003)(478600001)(6666004)(86362001)(7696005)(356005)(81166007)(82740400003)(41300700001)(16526019)(5660300002)(26005)(2616005)(40480700001)(1076003)(7416002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 16:08:25.1985 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: db7a791d-87ce-4709-d996-08dbf02c4066 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: DS1PEPF0001709C.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB9244 Add functions to the EINJ module to be used in the CXL module for CXL protocol error injection. The callbacks implement the einj_types and einj_inject files under /sys/kernel/debug/cxl/portX/dportY. These two files work in the same way as the available_error_types and error_inject files under /sys/kernel/debug/apei/einj, but only for CXL error types. If the dport is enumerated in RCH (CXL 1.1) mode, a CXL 1.1 error is injected into the dport; a CXL 2.0 error is injected otherwise. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- drivers/acpi/apei/Kconfig | 3 ++ drivers/acpi/apei/einj.c | 105 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/drivers/acpi/apei/Kconfig b/drivers/acpi/apei/Kconfig index 6b18f8bc7be3..100c27beb581 100644 --- a/drivers/acpi/apei/Kconfig +++ b/drivers/acpi/apei/Kconfig @@ -11,6 +11,9 @@ config ACPI_APEI select PSTORE select UEFI_CPER depends on HAVE_ACPI_APEI + imply CXL_BUS + imply CXL_ACPI + imply CXL_PORT help APEI allows to report errors (for example from the chipset) to the operating system. This improves NMI handling diff --git a/drivers/acpi/apei/einj.c b/drivers/acpi/apei/einj.c index 330329ac2f1f..98d5e6d60a02 100644 --- a/drivers/acpi/apei/einj.c +++ b/drivers/acpi/apei/einj.c @@ -21,9 +21,11 @@ #include #include #include +#include #include #include "apei-internal.h" +#include "../../cxl/cxl.h" #undef pr_fmt #define pr_fmt(fmt) "EINJ: " fmt @@ -627,6 +629,25 @@ static int available_error_type_show(struct seq_file *m, void *v) DEFINE_SHOW_ATTRIBUTE(available_error_type); +static int cxl_einj_available_error_type(struct seq_file *m, void *v) +{ + int cxl_err, rc; + u32 available_error_type = 0; + + 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; +} + static int validate_error_type(u64 type) { u32 tval, vendor, available_error_type = 0; @@ -657,6 +678,68 @@ static int validate_error_type(u64 type) return 0; } +static int cxl_dport_get_sbdf(struct cxl_dport *dport, u64 *sbdf) +{ + struct pci_dev *pdev; + struct pci_bus *pbus; + struct pci_host_bridge *bridge; + u64 seg = 0, bus; + + if (!dev_is_pci(dport->dport_dev)) + return -EINVAL; + + pdev = to_pci_dev(dport->dport_dev); + pbus = pdev->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 | pdev->devfn; + + return 0; +} + +static int cxl_einj_inject_error(struct cxl_dport *dport, u64 type) +{ + u64 param1 = 0, param2 = 0, param4 = 0; + u32 flags; + int rc; + + /* 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; + + /* + * If dport is in restricted mode, inject a CXL 1.1 error, + * otherwise inject a CXL 2.0 error + */ + if (dport->rch) { + if (dport->rcrb.base == CXL_RESOURCE_NONE) + return -EINVAL; + + param1 = (u64) dport->rcrb.base; + param2 = 0xfffffffffffff000; + flags = 0x2; + } else { + rc = cxl_dport_get_sbdf(dport, ¶m4); + if (rc) + return rc; + + flags = 0x4; + } + + return einj_error_inject(type, flags, param1, param2, 0, param4); +} + static int error_type_get(void *data, u64 *val) { *val = error_type; @@ -668,6 +751,7 @@ 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; @@ -714,6 +798,7 @@ static int __init einj_init(void) { int rc; acpi_status status; + struct cxl_einj_ops cxl_ops; struct apei_exec_context ctx; if (acpi_disabled) { @@ -793,6 +878,15 @@ static int __init einj_init(void) einj_debug_dir, &vendor_flags); } + if (IS_REACHABLE(CONFIG_CXL_ACPI) || IS_REACHABLE(CONFIG_CXL_PORT)) { + cxl_ops = (struct cxl_einj_ops) { + .einj_type = cxl_einj_available_error_type, + .einj_inject = cxl_einj_inject_error, + }; + + cxl_einj_set_ops_cbs(&cxl_ops); + } + pr_info("Error INJection is initialized.\n"); return 0; @@ -810,8 +904,18 @@ static int __init einj_init(void) static void __exit einj_exit(void) { + struct cxl_einj_ops cxl_ops; struct apei_exec_context ctx; + if (IS_REACHABLE(CONFIG_CXL_ACPI) || IS_REACHABLE(CONFIG_CXL_PORT)) { + cxl_ops = (struct cxl_einj_ops) { + .einj_type = NULL, + .einj_inject = NULL, + }; + + cxl_einj_set_ops_cbs(&cxl_ops); + } + if (einj_param) { acpi_size size = (acpi5) ? sizeof(struct set_error_type_with_address) : @@ -832,4 +936,5 @@ module_exit(einj_exit); MODULE_AUTHOR("Huang Ying"); MODULE_DESCRIPTION("APEI Error INJection support"); +MODULE_IMPORT_NS(CXL); MODULE_LICENSE("GPL"); From patchwork Tue Nov 28 16:06:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 13471430 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="La+tLA2H" Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2057.outbound.protection.outlook.com [40.107.220.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E33F2127; Tue, 28 Nov 2023 08:08:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hdBrRKwOlnB3QboGJwCel8hjV4ocbbSsu+PE/0mBgF4dFFE5/ElKYi/08sr1WurdNnkHGx43ePwDl5pEl4z/0xeOrv3RMZ/aEu0nFCVHhHerB5rkOfr1BMZgAzyL9FmbLiGx7h/T5sqvnttXcLqAO1/Xph+uVj81vZh58AkVzm3faviCbeFNr1qMSuMPOU68rVNVoIkY4qBymb7n/sVDIjL9zOs7S6QSmLgn4ezhp6TrrtqhnBcLAe7xsdI1JQ+YZTwvAIOW0WBXJda6Ut3Fy1hGq6O6IvFPi9t9+VKeoFoLZmnfCsVgR9wfpMjhncffi6WLax2c8rdPFJ1367cujQ== 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=7+maicyosk4giRcMRKR/SpjdeKPypkM5HpxIzjVaYC4=; b=aP6VLp8prNfMChQYvSX4r2mxv75kTHbD3DNOTLRcjYEKaMoOQBOXPcfUiwx+8ZIsus7ecCbGZdSJz8Gpn0KeAuPGLcY3YjfdtAh2b9SnRzCx6fiU4ZajFJXDLuHQI2RvfdnXbeE8V1Awn7GOcU0TFgZbCVxsYyEj5Gc44utki2PQWluzAPztJMqxQ16pnaAf3ObkeSuTe1bSgXq8JlTUUO7luViMHnjX9YIlzPtESH6tFPQ9YcSIaLUpMUx5ZAzBEPc4lTu1CuZr54j8S0iwP9NEbhyYtrxaGFA9icVf3KydGf4OHErYa9KzYC+xsxXnbPZihC9rwSavtRS5Yc/Eag== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=stgolabs.net 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=7+maicyosk4giRcMRKR/SpjdeKPypkM5HpxIzjVaYC4=; b=La+tLA2HFnsf17lGi4V2hREEPS+E8L8z71E/5DnLUwovxo5jYcrkWcnE6iSWaKUOLEe+WOTaOJ3BE0glH+xLG1Jd0dosOPA3qDNAdMT/okquQFuhTpD7EQ8FL77duxEogi/HhXQ183IVtbNn1W/v28Kjn/xsfiKHbE/fVdPIRfY= Received: from CH0PR03CA0275.namprd03.prod.outlook.com (2603:10b6:610:e6::10) by DM4PR12MB6230.namprd12.prod.outlook.com (2603:10b6:8:a7::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29; Tue, 28 Nov 2023 16:08:40 +0000 Received: from DS1PEPF0001709B.namprd05.prod.outlook.com (2603:10b6:610:e6:cafe::ea) by CH0PR03CA0275.outlook.office365.com (2603:10b6:610:e6::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.29 via Frontend Transport; Tue, 28 Nov 2023 16:08:40 +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 DS1PEPF0001709B.mail.protection.outlook.com (10.167.18.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7046.17 via Frontend Transport; Tue, 28 Nov 2023 16:08:39 +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; Tue, 28 Nov 2023 10:08:36 -0600 From: Ben Cheatham To: , , , , , , , CC: , , , Subject: [PATCH v7 5/5] EINJ: Update EINJ documentation Date: Tue, 28 Nov 2023 10:06:56 -0600 Message-ID: <20231128160656.166609-6-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> References: <20231128160656.166609-1-Benjamin.Cheatham@amd.com> Precedence: bulk X-Mailing-List: linux-acpi@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB03.amd.com (10.181.40.144) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0001709B:EE_|DM4PR12MB6230:EE_ X-MS-Office365-Filtering-Correlation-Id: 68f7ca55-d69d-4f25-1b02-08dbf02c4922 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wl1RDF3wO1CxnNQUAn5W+Al+FKOSLjmaRVbTB+QX6znnwGId1vUUiwa2khsQgPxB66dZBGziHSlB/XZ2eisIhBlu6ha5MwFSHbdUW5HHibqaQjB+yjlUHO1EkGRyWssMtICCg6Enq13jmIzABJkXGKbKVZ0hFF6cG3yutXWcnZJs0yokyr8mBsfsyLEivho6a9/cjJ2AQ2yIpnfKLTrsqaz9QHurbOnt3J1LMEdwPsw7zr62AW1sDzZO1v03RwExSd0XowsXwPg0wUuuTH4UlukN3c44SjuEPCnYTOGJAtA/sLkzvLNqnw7rSjIG5Gn1a7YD6m0y8PVZvVqtdLN5LAXP3zuu32qmikbRFrcMUIkjsul0qCSWkqkfztscp+MU+Z3lHIaE8q1pV0dpPkP+fcWGCAPIqaLvctvUrdYoMAbZbgRRliDVOYTlwqXN3B5wEB4vXQLFpVDt7+FTFYdavir7oEi9cquIXzOLocwqZXMqX318A5p611k3lys8fzDYjOZTprfzo9CTiC+rHhaK76x2E7trv58kSnckWLFkOdjJmWIDwlk7s7UUT2FiI2HURRDCbDMNFJBxeykJkVb2k55McWfLeFR3iohVbEY6GVnbXEa1E6cR5HjRBEyQ9VyB/chM8fNBKkbO/Q8hra8GszMw5QVI6G37u+6yJprm3CQRWoliNVm20bG4/yE0RVr9wqyJtRpXXEjbp/o22mdbrkenlDPqVA55ay/ZOP8/s1RbWxWGDSRR7ZbRal6vvJDFhDSPX5ryiY9UGfezI3QLeQ== 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)(136003)(39860400002)(376002)(230922051799003)(186009)(82310400011)(1800799012)(64100799003)(451199024)(46966006)(40470700004)(36840700001)(15650500001)(2906002)(7416002)(70206006)(70586007)(478600001)(54906003)(316002)(110136005)(8676002)(41300700001)(8936002)(7696005)(6666004)(5660300002)(4326008)(19627235002)(2616005)(426003)(16526019)(1076003)(336012)(26005)(83380400001)(47076005)(40480700001)(36860700001)(86362001)(40460700003)(356005)(81166007)(36756003)(82740400003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Nov 2023 16:08:39.8475 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 68f7ca55-d69d-4f25-1b02-08dbf02c4922 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: DS1PEPF0001709B.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6230 Update EINJ documentation with build requirements for CXL error types and how to inject CXL error types. Reviewed-by: Jonathan Cameron Signed-off-by: Ben Cheatham --- Documentation/firmware-guide/acpi/apei/einj.rst | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/firmware-guide/acpi/apei/einj.rst b/Documentation/firmware-guide/acpi/apei/einj.rst index d6b61d22f525..83afe3bac793 100644 --- a/Documentation/firmware-guide/acpi/apei/einj.rst +++ b/Documentation/firmware-guide/acpi/apei/einj.rst @@ -181,6 +181,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) +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, +but are instead at /sys/kernel/debug/cxl/portX/dportY. Inside the dportY +directory are two files, einj_types and einj_inject. These files work the +same as the available_error_type and error_inject files (read the error +types from einj_types and write the type to inject to einj_inject). + +To use these error types one of (or both) ``CONFIG_CXL_ACPI`` or +``CONFIG_CXL_PORT`` must be reachable by the EINJ module; if +``CONFIG_ACPI_APEI_EINJ`` == y/m, then at least one of ``CONFIG_CXL_ACPI`` +or ``CONFIG_CXL_PORT`` must also be set to y/m. + Special notes for injection into SGX enclaves: There may be a separate BIOS setup option to enable SGX injection.