From patchwork Tue Oct 10 20:02:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 732033 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 E484E2745F; Tue, 10 Oct 2023 20:03:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="hnVD+XhL" Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2071.outbound.protection.outlook.com [40.107.237.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AF23F4; Tue, 10 Oct 2023 13:03:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VfnOb3q7YtVVwqNWMTY6fCH22laewg33n3mhNC/ZsaAyPodRPU09LHcAu8QGM36/kZFG7RYLYYU84cQNTXa5PG/1AOM/4Fld8h9t48zvsV1gvBCLI0FG6HJQ9In78IaUYt5FcOJ/zXFJIso6SXqcKC3M03S88ywy9ohAiDVZSawAdxbAxtI8phRMh+np83aUgEZdnxCMXnY/zKW9H8mMLTtl8sYpTLAAA+YaewItp4Pvaeg89ev+igVgZTkNK6eVN02RqD7iRCsJ4D2WHy3/P5AugdMY4EfmWkbR9FdI/3QUG+1zloB7X8YIjKWYKUSxCv7kcMFKiZnZh5rwOPj4TA== 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=rWfIdvwc4u5ipDPQOfTOGfzt/HvN57Bb9SQTE92Prdk=; b=Hxi4kAzNAoewLREydOLAhMFknyyw4w46RzlGxHSSloCpU9ndJ7x8v7UhRkn40SItDDTQQcNSLPaOhA/AwvIUA0u3E6eTrujf5hSsfTPb+2gRz1xzDB7FX2tFD4cxV65yXZCm9p4PRO79hnYy9RhCb31myhLusLnz4+UhZuGXKOfshJE0la0aLFG1IrSwXYXawW2TM+gvRhAZxM8VGJCECqlTMyCg+QUhngnLn49g8sTaHeh983ovV0xyhlxW2FcsO8A6wVNF/xkozNt8OWSH+KGy8woriURrNgRh/YEysqJULMhZinqyfuQopHLLD9V9A5YhO7PgooAMynFw7qALWw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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 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=rWfIdvwc4u5ipDPQOfTOGfzt/HvN57Bb9SQTE92Prdk=; b=hnVD+XhLbxlTEUYJCWPk3aV/li2TQR2OuVSNwgVoS7JUrVA0eB8SW8tYKzL+kPdgN2WOqPhmIRhn3LoZgOPeuQeXm0xfKDLaB6hJcAe51ER6gWD2jpKGcn34jAv/9bt7prVZfJVQI9pWc3NcHnZ86IkuLPk2BTj0jVdoaprgcdA= Received: from DM6PR05CA0046.namprd05.prod.outlook.com (2603:10b6:5:335::15) by PH7PR12MB6465.namprd12.prod.outlook.com (2603:10b6:510:1f7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 20:03:15 +0000 Received: from DS2PEPF0000343E.namprd02.prod.outlook.com (2603:10b6:5:335:cafe::1d) by DM6PR05CA0046.outlook.office365.com (2603:10b6:5:335::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.21 via Frontend Transport; Tue, 10 Oct 2023 20:03: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 DS2PEPF0000343E.mail.protection.outlook.com (10.167.18.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 20:03: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.27; Tue, 10 Oct 2023 15:03:14 -0500 From: Ben Cheatham To: , , , CC: , Subject: [PATCH v6 1/5] cxl/port: Add EINJ debugfs files and callback support Date: Tue, 10 Oct 2023 15:02:50 -0500 Message-ID: <20231010200254.764273-2-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010200254.764273-1-Benjamin.Cheatham@amd.com> References: <20231010200254.764273-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-Originating-IP: [10.180.168.240] 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: DS2PEPF0000343E:EE_|PH7PR12MB6465:EE_ X-MS-Office365-Filtering-Correlation-Id: 30d6e208-0629-4782-750a-08dbc9cbf0ba X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ajxQ5xaXom1/qZe3MTzFT+7CAStt9v11sfKtYEWLtEgj9EPhOQicpgt81rMvAulZDeO9ia+DgVjv5vMxhF1Mkcnw9LBQBOEeV5gSXEUIq/s7qyZTm56C3sdUqQfT3Exz7Ac0NkIR/VL/ISp+f9ylX25C67PX+f04UDQp172RGepiOzyNBGQ22BFLTA6YxKGWbal038lcC9XXxJZZkzF75A+9ItXjUZI4maWaMoiYfD9mWd5edOOP4SB1LeR9DOTfxYqXaTokIaFRAICMSrP0tsRhX/+ktn8199uusn5kSq0OMJRqqY3daSwULjIQ6UkW/+UsbyBk2picqVn/vpQeSUrc1m4ciFlFzS8BDSCW58mEWTBcSXtA8u18ObaJxcjuQCOshFcIUmm1iwonJtb9QWRkyfSQx7535Jt64iomsB1L1o2yOOuCsuERWa1WissCqYgcDfQTBsvo5XSxvpgUHFaBW5MtSkisdxE6oE9wJOwZ1KgXyX4yXfOuQu86eg3G20rIh8G1+YU4egLwpugjQkScyGsxYIzLuJgRu8JdqwmgxF9jqZNjooqHGSKF2fFvbHN2S8H3dxqoIp/gQwwHuV46dKGuBxELR4maZxTsyd3eDq92BytdZNSYHxhZt4BL7r65qst2RSzHkzq0cQwsXozim5twCYH0dRQPv4/5ahpNKK3qUZpkJV+qFOyBZg3UfJY/o4Ebe+x54/wN7pIv6Js+heX8MmziyprMAZSjHUu7moJIk7vasS5TZLoCwP+nCqMC8NOzD3Ore3etzGOkag== 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)(136003)(39860400002)(346002)(376002)(230922051799003)(82310400011)(451199024)(64100799003)(1800799009)(186009)(46966006)(36840700001)(40470700004)(110136005)(316002)(70206006)(54906003)(41300700001)(5660300002)(8936002)(4326008)(8676002)(70586007)(40460700003)(36860700001)(86362001)(1076003)(81166007)(7696005)(40480700001)(2906002)(2616005)(82740400003)(356005)(6666004)(36756003)(336012)(26005)(16526019)(426003)(478600001)(47076005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 20:03:15.6415 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 30d6e208-0629-4782-750a-08dbc9cbf0ba 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: DS2PEPF0000343E.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6465 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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. 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..e87cb687cb1c 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: October, 2023 +KernelVersion: v6.7 +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: October, 2023 +KernelVersion: v6.7 +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 7ca01a834e18..005c5cf4618e 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -725,6 +725,72 @@ static int cxl_dport_setup_regs(struct cxl_dport *dport, component_reg_phys); } +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", 0x200, 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, @@ -788,6 +854,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); @@ -805,6 +872,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; @@ -1045,6 +1116,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); @@ -1054,6 +1126,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; @@ -1074,6 +1151,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"); @@ -1088,6 +1166,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 76d92561af29..12025ed6b64e 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -581,6 +581,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; @@ -604,6 +605,7 @@ struct cxl_port { size_t length; } cdat; bool cdat_available; + struct dentry *debug_dir; }; static inline struct cxl_dport * @@ -795,6 +797,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 Oct 10 20:02:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Cheatham X-Patchwork-Id: 731484 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 3B8A92745F; Tue, 10 Oct 2023 20:03:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="gksTjaIG" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2049.outbound.protection.outlook.com [40.107.94.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50747FB; Tue, 10 Oct 2023 13:03:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EM8B4mog/98Ar7LHC151nN6VuZSNyT2OreMXbnh9xn0hTjQz5hEiF6MabmoJEoDNx+SCmeWqDY+Q6xuGLs4LcWt3pQGGb/bUjvRr9gKs4jNuXFrwsAtIERfUCIQQ4vPMf7QQWSdwO8ExRwgwS+SZltTdKtlFd8gKzE6uunIOQM7hPSV0+0pL24L0Cl14LRdNUUwXA3fi6EsEgkw7aFEnGgHTXEdVYPyB3rcw5zCr7AgxyhJxmwMYq5enzpApIZhrLt+GuPNoKmLi2QQHktRQnRgmxldo2ClygbH2ynzaaumwDdwTI038k1+m2SWDCjMHqH/VH7CHCqGdiatAowQ+HA== 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=jUxIEXdpWjvHucilrNQJt3KojMbevuDw/g2WkUtA5+o=; b=LKTWR/DM6lLWtpciTGGzZPWSSkZur7lhrkM2BpkdG88NHCNzQtYXLWlfQwe25eIrpDlXEzqQ1I9V1UzZn8u2Rbxaa75rBj6y98sqbE3DWxe1YuaZGzJ5AgPg17XuRPF3A5NP2gja9NT254ON76rKnwtYct/n8370Gw+abszQgiIHgig8XfK2hNo8uO3Ti9ApJ5+LFG604+HNbJPNq/iApg8cfY97Eblncd7p5cMUWdBzlYVmStaR1t1QfiyTJlR1uVtjMnM/a2naK8cV+oTxSyomCq8efx9W6lzm9bs2TcjqYo7chtKUkOpgJ726aL/u5mdUvUJYBgspRSGKq1dW8Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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 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=jUxIEXdpWjvHucilrNQJt3KojMbevuDw/g2WkUtA5+o=; b=gksTjaIGrxa8yCbILhhq50wPFLeS17RhKdsd7xdVAOzfycXpcnUgrUvpLY+nCGS+4gi9GqlGuu+xlbMvb5EILimDXA9m1YIiVpKq8VmFoJ6/a6aQhvaTCIfxJzQI2byUs65aAoQg6D8jJQZct68jSvOaT5g20//G6k5Oit99QUs= Received: from DS7PR05CA0004.namprd05.prod.outlook.com (2603:10b6:5:3b9::9) by DS7PR12MB5960.namprd12.prod.outlook.com (2603:10b6:8:7f::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.37; Tue, 10 Oct 2023 20:03:28 +0000 Received: from DS2PEPF0000343C.namprd02.prod.outlook.com (2603:10b6:5:3b9:cafe::13) by DS7PR05CA0004.outlook.office365.com (2603:10b6:5:3b9::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.20 via Frontend Transport; Tue, 10 Oct 2023 20:03:28 +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 DS2PEPF0000343C.mail.protection.outlook.com (10.167.18.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 20:03:28 +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.27; Tue, 10 Oct 2023 15:03:26 -0500 From: Ben Cheatham To: , , , CC: , Subject: [PATCH v6 2/5] ACPI: Add CXL protocol error defines Date: Tue, 10 Oct 2023 15:02:51 -0500 Message-ID: <20231010200254.764273-3-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010200254.764273-1-Benjamin.Cheatham@amd.com> References: <20231010200254.764273-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-Originating-IP: [10.180.168.240] 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: DS2PEPF0000343C:EE_|DS7PR12MB5960:EE_ X-MS-Office365-Filtering-Correlation-Id: 97caa6a6-6a7d-42d9-0359-08dbc9cbf82e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: QrUj/H+05Ujr44pJaYcpW1IS89WO7YPHjAuEq59y25ROz/fOEOXUEY3ihXmvDo2aiow/PB1bs+M1i1CIEPpUulFEISiZDIZOaeY2b5cTktPbVVdPabuZy9kK4pQ5YrUESYk1C4AOb5IzIQVLorHS3Haq0tntGvwNII07X2xx5kSHF+vuGtIuUQ6f/MzTJhnbSiUih9BazSX8s+hpeSqJYKj/XiCfTD4TyxgkUzUVmNGv9Y+rkymB+B/3ZcstzOpBkDm/e8un1DONZJ304rvfcvgiB8zGt9V5Ku+MqSBHiNKMHYDNtX11tJ3Kpxsru8/3sk23Ga+iz3GKiox90JHlSB683ggqodXseruhAPBluPrxhcazp+qVg4rFX1MIA5H2GBMdEeqU2jF7z5MgLCJ1m7Zhu5wMUx+lf1I4kRiVtMZ2dAxAFA8Fkij1QmeH5bSKONnvqClDb/MilK8YdETNkSxDAaWWOkeF4ixyRzrEfaVFrgXDSMZiswKI21aoYwLwj+zlgP6uHSry5J0FAVxvImhCxX0QtNgT3TgygnZdiaHm6hCH7Y7n/PGmDWr+1f8Syfnt/8HKXD3gINTWUVgxmXv3rfGbj32K+udeqPDceE9LUGxmMC8PpFE0ayBeJAOh/pVT6L9A0snY73Q9i4NaIjwLdEQLCAzXikqF6vB/OLIPlge+DddZ6p2f7yYMZU+IoSv3YbEA9euQYMctSWAql+uV/tVYCTvCVBFEn8eB4O2M6ERfHmkxHBAVSVSvhRg8rziQvYDILKV6vj94Fkvx5Q== 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)(186009)(64100799003)(1800799009)(82310400011)(451199024)(46966006)(36840700001)(40470700004)(6666004)(7696005)(2616005)(1076003)(82740400003)(40460700003)(86362001)(316002)(40480700001)(36756003)(81166007)(36860700001)(356005)(83380400001)(336012)(966005)(2906002)(47076005)(426003)(41300700001)(478600001)(8936002)(8676002)(70206006)(4326008)(16526019)(26005)(5660300002)(110136005)(54906003)(70586007)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 20:03:28.1585 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 97caa6a6-6a7d-42d9-0359-08dbc9cbf82e 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: DS2PEPF0000343C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB5960 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Add CXL protocol error defines to include/actbl1.h to be used in later commits. 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 8d5572ad48cb..9741f1c40a4e 100644 --- a/include/acpi/actbl1.h +++ b/include/acpi/actbl1.h @@ -1093,6 +1093,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 Oct 10 20:02: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: 732032 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 CA33A2745F; Tue, 10 Oct 2023 20:03:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="1YOLKyEZ" Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2050.outbound.protection.outlook.com [40.107.94.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 409FD101; Tue, 10 Oct 2023 13:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RxQBRBLE6GnNP6OpjS7T4genGJN7P57/YHuLq1THTLDzSrYQJXpNvoBL0HlXSQyv+fpvMn/RZN7QoH/Flz4VzI6+dYKs/zewyQkr4Ph0my/9eTbY7xKgO8Zp+KJzYZzKfmjuz9Haiw7M1TKFFxYiXMYim0UhYDrwEdN3F1Oe9SS9DcOc2kYQFHsMCrshl0fcTKw6HE9RfMVYXo/vDGwxzwMztXjURIHjOBG32n40+PhvWE9x7pyjfCT9pCYsm9gX8oq6e+Od/KxUyCKjFRgXVgVjLfRWDoMZ8/gdf0i+V4yfhWjNFzOiiruyCuSM9YGMdbN9ck1hgn9XKqYduC7t5Q== 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=3pwb5rD5rHeOk4Ys8jvsX2T9TXZ3zjdRZ3ky5mycVjM=; b=GWNSy9tRJ4SLJxNJdUJ3nK57TrVkCHpUOjHrJAmXTubdbgfMk6a4wljOJJsmzCzZoTQJYZ0zryDZoXKSxqnuK6CcxnQEW1avicWV7qfxu07XPeACMGsIldQBEj90UB3x7WC1KJfBpEmPytcWX8NOGmnCmPVWtvILu1tmHHOPNxIFP+fJPMbeYBzE0potCXD6QfdjZHI4lOuF+WWcJNjkBROgzjcXeTCCxFyMXhF/3194qU3k0wORkMTpjKIjDnTfoidgru9CsNUpi9t62WeVUQCX/SgzBe543dqo5vzZpATAsyfHSnjb8qI5pveos7ikkBIVorQfBy5mWuN/NcB2ww== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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 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=3pwb5rD5rHeOk4Ys8jvsX2T9TXZ3zjdRZ3ky5mycVjM=; b=1YOLKyEZU7K+hr21nvKBhx1TuNyt92X6K8g2KgafSMpyDKiR+7I9l80tLMppDCZa5yl6sYHgjrNdstw1vEYI8tNJ9hxg7GClAmMaZzzLPVVGFrIsY+Uqq1BXAXqhQhkOCPyRee+Ps3icCJTA33M8UNB7sBfHZG4MUqQ3kGX67GQ= Received: from DS7PR05CA0020.namprd05.prod.outlook.com (2603:10b6:5:3b9::25) by CY5PR12MB6083.namprd12.prod.outlook.com (2603:10b6:930:29::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.42; Tue, 10 Oct 2023 20:03:41 +0000 Received: from DS2PEPF0000343C.namprd02.prod.outlook.com (2603:10b6:5:3b9:cafe::e1) by DS7PR05CA0020.outlook.office365.com (2603:10b6:5:3b9::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6886.20 via Frontend Transport; Tue, 10 Oct 2023 20:03: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 DS2PEPF0000343C.mail.protection.outlook.com (10.167.18.39) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 20:03:40 +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.27; Tue, 10 Oct 2023 15:03:39 -0500 From: Ben Cheatham To: , , , CC: , Subject: [PATCH v6 3/5] EINJ: Separate CXL errors from other EINJ errors Date: Tue, 10 Oct 2023 15:02:52 -0500 Message-ID: <20231010200254.764273-4-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010200254.764273-1-Benjamin.Cheatham@amd.com> References: <20231010200254.764273-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-Originating-IP: [10.180.168.240] 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: DS2PEPF0000343C:EE_|CY5PR12MB6083:EE_ X-MS-Office365-Filtering-Correlation-Id: 361e08da-2e64-454c-ae8b-08dbc9cbffaf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I8DJsY1GkPks3JAxu243ekhKPjPi9bm57PQJuC/U1ktV0Hr7jJTkyJNA8m0IsNOoCoZ+tT2kgS5Pzn+L2zXI07/mHnmdURlQcSHJHxKD0CZjm1WSwL4VJgoYyuqxrK4puX9LYf2DDgBit4a2q8wJHRq1NPul668tXcub0Op/qpQHf9l2MqqWc/yKefhYwWbvth/DMilbSnLZqspi5Uq+FbPy2ibJvKBwLSANjbZixnsQfPkQwdEsDBQmlmXpHWu7v6wxFQxfsVukzUY5hSiqlVTGqMcsi+G1IQT4I1lgA6z+njkxGYfCXfrYkXxMidw6fxSR6JMvqTvH4hSDFS9ACoj6jFnLY5Ot14ZpwCB0jSAIXMraL/b/3yOcZFiybPs4MiMuEU3iERILsa2lcuJA4YFHDmQt0IFxsOo8jV+O9D39qCrnj3dxLrTCprHOE3Ekoi8EUcHC/bC5TcUcdwACjHl5oNhajGofM0JnEOHDm95KpjH5IYMNw4ByjLgjfYwexlqEhXLG+enyPrDYA8NlpE+RmXE+kY15T+qoEkXQBzORDvj/cm8f9Y51nibU8zcFIchnXwjvlSfT3WiwdEHNNoCwYFyndoqNFoa/tiKiTFuqkNjCpd7hsLn8R3Eb/hacfqpW2ASsAQSQRh8jbGEFRdQf8BHTx178fqNOUGHrBOYz2rKpJn9nCW37sLYuvSxyZSozPeTGmwO47qRsLF0ZzFhXLJWR2h1cglEKNdwj5oUxZ8iYGDz0cVEopIY+JolGgwsaDivaAN/JMP+XbWnrqg== 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)(39860400002)(136003)(376002)(396003)(230922051799003)(64100799003)(451199024)(1800799009)(82310400011)(186009)(40470700004)(46966006)(36840700001)(6666004)(1076003)(40460700003)(356005)(40480700001)(70586007)(36756003)(82740400003)(81166007)(36860700001)(86362001)(426003)(7696005)(16526019)(336012)(2616005)(41300700001)(478600001)(8936002)(2906002)(47076005)(8676002)(4326008)(83380400001)(5660300002)(26005)(316002)(110136005)(70206006)(54906003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 20:03:40.7367 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 361e08da-2e64-454c-ae8b-08dbc9cbffaf 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: DS2PEPF0000343C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6083 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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. 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 Oct 10 20:02: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: 731483 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 B4E2429CEB; Tue, 10 Oct 2023 20:04:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="Ni7LdzSc" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5EE5F94; Tue, 10 Oct 2023 13:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cjSuw7Esg3VYozmvhbPGHKnWu1CIHP8BFQgJu3CehXNXJr0TZuZlyoyDAouO7CiRHwIsQLqdxOk4w+ZotZYjDiziO2TxfqQWHL0yJl9GBM/5kI8cn2ezT5cuGfpoQCPkr7xGeyNVNFkfc3sJQySyVzH8RlYrmUVIBv2ALMUU8De9c7UseW1McI3P6gBrV0J1XkzgaCT2yaOj192/iZGOSzaObRockDJIrRKDmlEVcT0qHl4scIJQfd6IMwUPteX1QUiDdZgAK6r21XtVLSu5JBNPpLDmUj5baLK6bOlX/9L0PNPFOFPWvQrk9hzx/ElEAQDyQdTECP3U8Ex0pIpcug== 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=uoKlsIXwSz7IIGh+jUGFjWqKnm0Bdw+GO+aeWW/uVU0=; b=gAtxK7nHdqYpDCXdorG3/zd94P/JTuvFWZ7IP3guyJIQsB5NTJ//IumRXT2W0W0frIzEEDE6dZZyLDw3GpwnS60XLF9zgmX1Ph159FtIznRs8GzrhROS2anbykch1ZcSIFgqgn/trIp4YCQ1RHIhPj+Mz31tDkP604QS9Ls3kJVrcO8JTlkkPkpJGmIAYHLHo+dpb+i5Dva5s58edqhosnqZNGcWuOB+pDHljO4W0/BPd5An1g8kpAg4iIN+a+QVOWFgYGiwFtvXyEurVLjEgKuYptQlyfaBQuhr6IuS7MuafYhyQ2PYdh2WWOLbclEgtJOlXGXtwJ+4uUp82Zq0qg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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 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=uoKlsIXwSz7IIGh+jUGFjWqKnm0Bdw+GO+aeWW/uVU0=; b=Ni7LdzScNRKoZsSaJFWJFPc5tCkhSFu6KWuekR1GQI5uXSv1wynLVAkRw4PxOYccHaMcnG3UTiD8YZFWkXc/uAE5eNfijuShHpcPOVAwcq48zywzWu41Z3CPXjDK+sPrQeDT7QwK+c6Thb67+LPHeF3dacR25iengC08lMCFdoU= Received: from DM6PR03CA0096.namprd03.prod.outlook.com (2603:10b6:5:333::29) by MW3PR12MB4348.namprd12.prod.outlook.com (2603:10b6:303:5f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38; Tue, 10 Oct 2023 20:03:53 +0000 Received: from DS2PEPF0000343A.namprd02.prod.outlook.com (2603:10b6:5:333:cafe::c) by DM6PR03CA0096.outlook.office365.com (2603:10b6:5:333::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 20:03:53 +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 DS2PEPF0000343A.mail.protection.outlook.com (10.167.18.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 20:03:53 +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.27; Tue, 10 Oct 2023 15:03:52 -0500 From: Ben Cheatham To: , , , CC: , Subject: [PATCH v6 4/5] cxl/port, EINJ: Add CXL EINJ callback functions Date: Tue, 10 Oct 2023 15:02:53 -0500 Message-ID: <20231010200254.764273-5-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010200254.764273-1-Benjamin.Cheatham@amd.com> References: <20231010200254.764273-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-Originating-IP: [10.180.168.240] 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: DS2PEPF0000343A:EE_|MW3PR12MB4348:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e5b8413-0bf3-45d6-e2bf-08dbc9cc075f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zXvywzX7XLU71LvP1PV435CYEX6kAISPwEt/wCqRuvMYc2Q9lo2mEdBYOWRww2NuDFYzhWZvFVKsbgCHTjAc+0X1JUo0neD/7EmLmA27WIq6gYkscfB2cIU7vhzm/AB/dHBAake/d/toJ1zXs/EOril0vt5Li1Xz5Ymy021F9/wTeGrCAWcu/P1hGOgKhFIT6MixD7gT5j8pquWySXBftdFKKkk3hhQsG8dq2Q/DvA3tFarWaAt5Wcz4C4E08Xj9gtk9xkyZgz12qN0IviITF3WIDU4QEyR/zRUb0UvJY+GesMntomndF93JLIi1d1VJ4yGZaIMcngpZlsn7mjkEvKu+bF0vy/d8YbjScvpnidyfBmimMAtyK2xSAfUXsBbYvPQQSRAh3QtNwvbI0dTAr2ehWBYowwMm0FHI0W+YSvQPoxlMIDDgku3IuecR0dteBZbVirn7zTFdfHgtcxKgN/7rtj6FHTbcEy54GX2vYOJQTRL1L8hF5LptwVbAUZtfDNgs5Skym2HcOfZLT7wYTty14QYHKuYEyrFzCdgMZfrLcFEd15kf8YkH1ULYCZiwb4VuTZpCF/u3Iqxkxpp4yVX9O9f5g030txVG0QAolbti5NhqxUA5NDWaWw885saKJqRWdlnY//IGW4XZrWIOff9tSV9TPD6vjSzn+uMnHly6ZBUC4IYiHvwsjG3lmrvqY6i8uz6YLUWmpJPiHSv9tRFzMEe5mf+ONCEIaKOIlv4WIMb3qtqrfsWMkM1Jc4AZlC0+A6nG+fi1sD6kdkVMZQ== 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)(1800799009)(64100799003)(451199024)(186009)(82310400011)(46966006)(36840700001)(40470700004)(36860700001)(83380400001)(47076005)(40480700001)(40460700003)(4326008)(8676002)(70586007)(54906003)(316002)(8936002)(70206006)(41300700001)(478600001)(2906002)(110136005)(86362001)(7696005)(426003)(5660300002)(36756003)(356005)(336012)(2616005)(1076003)(82740400003)(26005)(81166007)(16526019)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 20:03:53.6511 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e5b8413-0bf3-45d6-e2bf-08dbc9cc075f 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: DS2PEPF0000343A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4348 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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. Signed-off-by: Ben Cheatham --- drivers/acpi/apei/Kconfig | 3 ++ drivers/acpi/apei/einj.c | 103 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 106 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..801b159b505f 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,22 @@ 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 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++) + if (available_error_type & BIT(pos + 12)) + 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 +675,69 @@ 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, devfn; + + 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; + devfn = (PCI_DEVFN(PCI_SLOT(pdev->devfn),PCI_FUNC(pdev->devfn)) << 8); + *sbdf = seg | bus | 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 +749,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 +796,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 +876,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 +902,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 +934,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 Oct 10 20:02: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: 732031 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 B54A329CEB; Tue, 10 Oct 2023 20:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="TwM9m69Y" Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2048.outbound.protection.outlook.com [40.107.92.48]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A47D12E; Tue, 10 Oct 2023 13:04:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SJBe18LS66bHYBs+60TbEBG/opK1LUIxsLXBTgyBPPmHgt6xWll9ioL4/r/DXUMoDj0jA3QnJ/E9VGFt6Em8s+y+8ASncC7nzpEgxJmeVVP6UjqgCeLlmRX8Il6IqV28/A1384BqCB8YskZvRIhatPPhnA1VL+lueCbWc8ZDiR75Cnfb/Lno1eibwaZQ97GFfh2na0DXehHn5f/ANeXp2y4xSwSZLAdzQqwPzeMhOkF9YAgGQ03/19zpF7Tosni4Z3ROuQlqwi6+G7EH7YPrpwOXOiH/H5a/+vIzPkLoFQHtkaKF+gKYw5TyNmQCskNZUzIy5qeCu8tDG1iwtzzrmA== 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=UWirr0iuG6mAxg2Xd3VxPkxEOsVowqCmylTmVWaSNvs=; b=eS3h3bhjt2JkyNHSRMmqvYPcR/wvPf1xJJhfebt6ILfXcNKN9MS9nyFl6tIzGTj9RfOXvEnAUavEW0hbiVdMHAi995/l9Vg0AA8FnCGbBCBu6bAL605tDDQX48iTs56l2uGmRiXmwC215Vnn/n13GhZa7MeLxlmUSKn9TZvVIh/hSPqSfhUKKVIxhSr1jjYYhWLgGxBnV+UTFRAOddRBN+54ulmUcwuLSquQNYQiAYVD5o52yguNayUa/pTiJyvZnxRoJUDZwjR4kL8DzxaWDOyL2eB89NQA+KuifBvAc1vlGme8cKKWSbT8kenqJUG4PpqN0/NZ3trputMRB+dubw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org 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 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=UWirr0iuG6mAxg2Xd3VxPkxEOsVowqCmylTmVWaSNvs=; b=TwM9m69Yy1iKtymTX18bS9zhEEB2A69TUvWwbx3o/LSMqRfM3FWhbaM4pqC1gqC1pzVH9cGpGhWeQLvl5/vQd/wn+EMn1A5O0IEC0bXXxQNBf2pCC6S8RD1zZB+9YiaWcRnLCP1HVRSV1XxA+wL3LUsxHTdYp7yXzTl3JUhCEGk= Received: from CH2PR19CA0013.namprd19.prod.outlook.com (2603:10b6:610:4d::23) by MN0PR12MB6078.namprd12.prod.outlook.com (2603:10b6:208:3ca::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.39; Tue, 10 Oct 2023 20:04:06 +0000 Received: from DS1PEPF00017097.namprd05.prod.outlook.com (2603:10b6:610:4d:cafe::77) by CH2PR19CA0013.outlook.office365.com (2603:10b6:610:4d::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6863.38 via Frontend Transport; Tue, 10 Oct 2023 20:04:06 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by DS1PEPF00017097.mail.protection.outlook.com (10.167.18.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.22 via Frontend Transport; Tue, 10 Oct 2023 20:04:06 +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.27; Tue, 10 Oct 2023 15:04:05 -0500 From: Ben Cheatham To: , , , CC: , Subject: [PATCH v6 5/5] EINJ: Update EINJ documentation Date: Tue, 10 Oct 2023 15:02:54 -0500 Message-ID: <20231010200254.764273-6-Benjamin.Cheatham@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231010200254.764273-1-Benjamin.Cheatham@amd.com> References: <20231010200254.764273-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-Originating-IP: [10.180.168.240] 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: DS1PEPF00017097:EE_|MN0PR12MB6078:EE_ X-MS-Office365-Filtering-Correlation-Id: 7144ffaa-674f-4956-033b-08dbc9cc0f11 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: I+t8+JDvPkcjEI/KzfKdD69yV2FRqpszbpxSh1+E9u9V8FXD7f6naIWwG1pX2XN5GJJLymLBbCgCP62eRaf7fJ6amLoJj68DiEIr+p3fqSLBeYUBZhiVJs5vsyNB+QtqHfJTP079cdjiL/6wSz7hF+shBmsHJ/CGwwRoFlDPu6jwGY1PfWvjFJSi4pxJfp3vJQcvxSyBtYskcIbAyM4XqmdTLLsQvZJbOECcvBo4otX6YXAxX1VJ6OVi0CYU2tK15XJQZTyEMXUidT4R5VePioy57aPxhf48tULudBeWuG0zi9gT7Z+X3LQtvAy1MT+mGw/vz4sWBFU1ahgexSQKsQz4x0Mwh7lSFtnm1PNnRGP5PQsgy66yM2QU90L8YiTsqiKV6Jc4cA+X0ISAhrmaAT4LbzlzR3h4Kt0YsNQ+kqlZWYBBmMscaAaH/WoPMQNoX2WZaJ63nN5ep5uaKBh+lK+zqjOfo52ljjvYUtLT2tfpkSBnBXPfPkwmfmBSfnYM9w5TMNbiyFH7s33Gc7b7g6A3Akqx9i3zWgbtBfZcwCrQ+KXY0aSZzQLOQeiLDsZK8SmDCRLbN6GT0Y9sq/CMoxxqDDHlqnkxCBYy2OYEiIBvg6+MUpC1ILCQLKJpsBCPRVQF9iD/l38RUICJNQjoIfOX4KPnKLgupN4fe2YlCsbtSVed7/9KZyi+M+kn8aU80B2cEIHVQ6W2TKxLqNLMVV53Rd5DihxN2EyalbL3Uo0NBPfqH2LrHYsnJWchJwRMJDLw1oNHr5b9KJi5KEdM4Q== 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)(39860400002)(346002)(376002)(136003)(230922051799003)(451199024)(82310400011)(64100799003)(1800799009)(186009)(40470700004)(36840700001)(46966006)(40460700003)(1076003)(8676002)(6666004)(7696005)(70206006)(478600001)(2616005)(336012)(15650500001)(426003)(110136005)(54906003)(19627235002)(41300700001)(83380400001)(16526019)(8936002)(5660300002)(316002)(47076005)(70586007)(36860700001)(82740400003)(2906002)(86362001)(81166007)(36756003)(26005)(40480700001)(356005)(4326008)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2023 20:04:06.5404 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7144ffaa-674f-4956-033b-08dbc9cc0f11 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: DS1PEPF00017097.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB6078 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Update EINJ documentation with build requirements for CXL error types and how to inject CXL error types. 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.