From patchwork Fri Aug 25 23:32:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13366418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7305FC83F05 for ; Fri, 25 Aug 2023 23:35:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231245AbjHYXej (ORCPT ); Fri, 25 Aug 2023 19:34:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbjHYXed (ORCPT ); Fri, 25 Aug 2023 19:34:33 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2075.outbound.protection.outlook.com [40.107.237.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AEF4A2D50; Fri, 25 Aug 2023 16:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WVPamRPfTGNNw9MDxHP/VaRXn8gAZ+k2UrHvEr/lG9qlYCuQWS6qXvuPyeW3baLp3Iv72e7krZgTKL9LExpCJgILK3ibkIvsjFvtcCqZYVNVu/2vk3a2Uyr+4ufT6+wLDkAJHko+1j1knGLPbsHiRDMZf1lK5IaOd11qx5mpfp+VmTtX2TItXqDstCoF9XnRSJod1/ImRZhltY9HfeHqVVebbdVCzOZq4WbBftBXjmsimaSXBrq+XdM+hqzF2mWcuABtwyA+quxaXdKt6nsO6rHxwLVu4z3nbt65+DMrtLgIEgEiX21n1Vab+V+kBqCAFis5SYE4sxwjIonkuhDn1A== 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=VdkeZNvPc3j4XjGaPvDKt4cGD4c97qZFxGq5V/vHyeo=; b=LjK6DqVWm36dljL7A+Irq5YV0XNEFMDCMoPMMFBwvTLNZdOW15jqY1HqTJW97Dda8kAGBzWucJCnCqFZCkDQ78ozMPspyKg5N2dG41ZfDbzyggpSF44jQkKLiFcGT9hwW/FSn2P745UYLBbihoNV/Zi5KHB1mjOobZqcA2RVA/juKb6HQB9RJ+XU2jczOmhh+T+N9MT2ZbRKZbnEZkNjljj/aQ/MNONUGoDYUoBr2TapXxiyHMq4R7VclOxkh/hPBN6OM443N9BigMncr1cRdx91OQC2uA3smdoyKtLlhBq7yzw/TZ/MBI+NKBsf+d6SePx3+s4bN08rGjNtmPicvg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=intel.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none 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=VdkeZNvPc3j4XjGaPvDKt4cGD4c97qZFxGq5V/vHyeo=; b=hpyKgoQWhxf2dw1+CZnH1lZn8+V0QkJn+kyp4/kD9Ko4TtPjYRPK66kZkgYlMgapWTjByOb6f4JctwJhcsV/rdYOStAClxNSQQ+K5rpWCOSqNdKmuczFQfmM9dZfzaixkQVCMFh2BZ3daGEbNwAoZq8fb+0244Zr1qOq9/rgXN4= Received: from SN6PR05CA0017.namprd05.prod.outlook.com (2603:10b6:805:de::30) by CY8PR12MB7171.namprd12.prod.outlook.com (2603:10b6:930:5c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.29; Fri, 25 Aug 2023 23:34:10 +0000 Received: from SN1PEPF0002636C.namprd02.prod.outlook.com (2603:10b6:805:de:cafe::1) by SN6PR05CA0017.outlook.office365.com (2603:10b6:805:de::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6723.20 via Frontend Transport; Fri, 25 Aug 2023 23:34:10 +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 SN1PEPF0002636C.mail.protection.outlook.com (10.167.241.137) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6699.15 via Frontend Transport; Fri, 25 Aug 2023 23:34:10 +0000 Received: from ethanolx7ea3host.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; Fri, 25 Aug 2023 18:34:09 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v9 09/15] cxl/pci: Update CXL error logging to use RAS register address Date: Fri, 25 Aug 2023 18:32:05 -0500 Message-ID: <20230825233211.3029825-10-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230825233211.3029825-1-terry.bowman@amd.com> References: <20230825233211.3029825-1-terry.bowman@amd.com> 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: SN1PEPF0002636C:EE_|CY8PR12MB7171:EE_ X-MS-Office365-Filtering-Correlation-Id: 05f2dd10-1273-47a1-a3dc-08dba5c3c87d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B8/nBKjLMoDOiATisppwspMHA5WLIJik+V/PJF0NAaZQgoX2PPL+K5bCflT94saflLeo2rLlNRvZ+KWAluRR//8uJQqC1C9eNDtEJOdT0Y0f60K8yz40+iDvWeraS1Wp+bEkssSAFl1a8aBWKBhNk+niScJ3M0/ueWuZbbRc/UF7kTd1Loudaqxd8C4wnKSD5WPSkIb6wQ8O5ooBh1Tsjx7Sf97yY2QtaPtd2Wrr7gKWxdPK+Yrj4ZMsFIMoaQ6kp0iEqomKxl4WkNnrq88Hezb7l57dqKyaq90cciNzO6PGqnHW2+/dQyNzRTkaRvSvLL+Ja8uyhr7ymMAaWQOcJRTyTEsD5vx0cfroZ6eUXHYxEIZMbCa0vNrmpBMc3CmqDItopFBSFFgz9V4RfRD8s1xOv1V/SD6Es1i1B/YBe0ONgRz1JoJVU+pTHVko+RU2PM+6Nz4HLFcnlMpyfg/wZ1XOGBU1s8bJycVkAmAuiLfRx2+N313XiDIQpa0mCNjLHSeCQMwRq41Ps7cZzwuaQ15NCCX3eJcfx46K/lDpkokWTDrJfRbgn4Oh41vpglxSDRqDGOJ6vve94+S0rpoRsmG16r0EwDdM0i3hiBOiIfMKxm3HpkJT0P8oP+6iv3IRBU5IeDuE8NiiAhv3gM6fOOjzL53UUVxdUTQfl4v/bqsQ/sPY6uZtAoGj51jTdthxJvfZKaAVBkF7qO/+1omS/lF/RGZ265tz0Tt82RoxqPxSCy6P+AQ2HYzGX9Zn1PSY9w6Ov/Mp9J5EG9is31o5zA== 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)(376002)(396003)(346002)(136003)(1800799009)(82310400011)(451199024)(186009)(46966006)(36840700001)(40470700004)(82740400003)(81166007)(356005)(40460700003)(8676002)(4326008)(8936002)(54906003)(41300700001)(316002)(6666004)(36756003)(7696005)(70206006)(70586007)(86362001)(110136005)(40480700001)(47076005)(7416002)(26005)(478600001)(16526019)(336012)(36860700001)(1076003)(44832011)(83380400001)(15650500001)(2906002)(2616005)(426003)(5660300002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Aug 2023 23:34:10.3315 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 05f2dd10-1273-47a1-a3dc-08dba5c3c87d 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: SN1PEPF0002636C.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB7171 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The CXL error handler currently only logs endpoint RAS status. The CXL topology includes several components providing RAS details to be logged during error handling.[1] Update the current handler's RAS logging to use a RAS register address. Also, update the error handler function names to be consistent with correctable and uncorrectable RAS. This will allow for adding support to log other CXL component's RAS details in the future. [1] CXL3.0 Table 8-22 CXL_Capability_ID Assignment Co-developed-by: Robert Richter Signed-off-by: Robert Richter Signed-off-by: Terry Bowman Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/pci.c | 44 +++++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 13 deletions(-) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index c7a7887ebdcf..edfee8035820 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -646,32 +646,36 @@ void read_cdat_data(struct cxl_port *port) } EXPORT_SYMBOL_NS_GPL(read_cdat_data, CXL); -void cxl_cor_error_detected(struct pci_dev *pdev) +static void __cxl_handle_cor_ras(struct cxl_dev_state *cxlds, + void __iomem *ras_base) { - struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); void __iomem *addr; u32 status; - if (!cxlds->regs.ras) + if (!ras_base) return; - addr = cxlds->regs.ras + CXL_RAS_CORRECTABLE_STATUS_OFFSET; + addr = ras_base + CXL_RAS_CORRECTABLE_STATUS_OFFSET; status = readl(addr); if (status & CXL_RAS_CORRECTABLE_STATUS_MASK) { writel(status & CXL_RAS_CORRECTABLE_STATUS_MASK, addr); trace_cxl_aer_correctable_error(cxlds->cxlmd, status); } } -EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); + +static void cxl_handle_endpoint_cor_ras(struct cxl_dev_state *cxlds) +{ + return __cxl_handle_cor_ras(cxlds, cxlds->regs.ras); +} /* CXL spec rev3.0 8.2.4.16.1 */ -static void header_log_copy(struct cxl_dev_state *cxlds, u32 *log) +static void header_log_copy(void __iomem *ras_base, u32 *log) { void __iomem *addr; u32 *log_addr; int i, log_u32_size = CXL_HEADERLOG_SIZE / sizeof(u32); - addr = cxlds->regs.ras + CXL_RAS_HEADER_LOG_OFFSET; + addr = ras_base + CXL_RAS_HEADER_LOG_OFFSET; log_addr = log; for (i = 0; i < log_u32_size; i++) { @@ -685,17 +689,18 @@ static void header_log_copy(struct cxl_dev_state *cxlds, u32 *log) * Log the state of the RAS status registers and prepare them to log the * next error status. Return 1 if reset needed. */ -static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) +static bool __cxl_handle_ras(struct cxl_dev_state *cxlds, + void __iomem *ras_base) { u32 hl[CXL_HEADERLOG_SIZE_U32]; void __iomem *addr; u32 status; u32 fe; - if (!cxlds->regs.ras) + if (!ras_base) return false; - addr = cxlds->regs.ras + CXL_RAS_UNCORRECTABLE_STATUS_OFFSET; + addr = ras_base + CXL_RAS_UNCORRECTABLE_STATUS_OFFSET; status = readl(addr); if (!(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK)) return false; @@ -703,7 +708,7 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) /* If multiple errors, log header points to first error from ctrl reg */ if (hweight32(status) > 1) { void __iomem *rcc_addr = - cxlds->regs.ras + CXL_RAS_CAP_CONTROL_OFFSET; + ras_base + CXL_RAS_CAP_CONTROL_OFFSET; fe = BIT(FIELD_GET(CXL_RAS_CAP_CONTROL_FE_MASK, readl(rcc_addr))); @@ -711,13 +716,26 @@ static bool cxl_report_and_clear(struct cxl_dev_state *cxlds) fe = status; } - header_log_copy(cxlds, hl); + header_log_copy(ras_base, hl); trace_cxl_aer_uncorrectable_error(cxlds->cxlmd, status, fe, hl); writel(status & CXL_RAS_UNCORRECTABLE_STATUS_MASK, addr); return true; } +static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds) +{ + return __cxl_handle_ras(cxlds, cxlds->regs.ras); +} + +void cxl_cor_error_detected(struct pci_dev *pdev) +{ + struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); + + cxl_handle_endpoint_cor_ras(cxlds); +} +EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); + pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, pci_channel_state_t state) { @@ -732,7 +750,7 @@ pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, * chance the situation is recoverable dump the status of the RAS * capability registers and bounce the active state of the memdev. */ - ue = cxl_report_and_clear(cxlds); + ue = cxl_handle_endpoint_ras(cxlds); switch (state) { case pci_channel_io_normal: