Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2717366rdh; Wed, 27 Sep 2023 10:29:05 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHUDoKXX3GqlXCcppv94NGhDuwOIXRioBl8GuLEaJLsTzBBz+mVn4DoG03FIVourqDKDZCf X-Received: by 2002:aca:1018:0:b0:3a8:83df:d5a4 with SMTP id 24-20020aca1018000000b003a883dfd5a4mr2492418oiq.59.1695835744831; Wed, 27 Sep 2023 10:29:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695835744; cv=pass; d=google.com; s=arc-20160816; b=iZKHkQ/6b0YKXEqgtY+BmQ8ZhG2nPQFj7SOMZDEtIiuFoZAKEBZwl2E4EF67T7t+pa +mjXZId4r0bXpYBr+5A1zCl7XYx/0OnsTFpRvZNfRlKu4MCA7+sheLNOSlaTiBV7nlb+ /jfQgNGSzO4Run1EBwMFSMJwzLco040kVW22HxzjQ57YPDqcKkJxkBBb/ToqQSVCT73X DQEbAVDXIiLwtPIQhvK6uvjcS2NLGYUOgARrfOYpFjwZ0YCP8PQlxPg2L9v8ZJotfXvx fNsbEV61brFB68RxZ/wa69Lil/UeNOv/07R+pniSY/SFuyIa2UjJGIFp6ZKpRkplejpv PUpQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QGKgniNpJFS9YbLdjmtCw4nqN+3EXACRrIBgxwXpQyU=; fh=8mQkxI/msGNGkxZc3km6VNrl0J/4T5ddSp1WxeodlBs=; b=c63+yuBRaxM8JPHfGx9RJDpTQEc63Jg+RiiUizsfc6DpqRK4hHPo7FENElCP0rEAgl No9jnH2AuHIAiUX1U15ojJNgusajMbt4uzIuFL68VtZh/EPhIDzMOM5Z+VmvIM3FfRcl 8a5AeQYN4A1RWZ4jx3qIntULuvf2Q+tCRyK2K4kut9I11u4/OAw71ZBRcBVdabLSusZx u/Hj5wD62Nwq8S46ME5aG1ndlr8AlgKX8nM+oG8P/+0her9LsRSg/+FZg62xEE9usf9T ZSgb4KJgw9ZFWflPgS1l8iqM8l+1Ie3D+iUsLvDgNm7uO/BK5MO/90TAGitKS+hOnzrB lQVA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=giMp3aEE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id v3-20020a655c43000000b00577f4d736bbsi14900851pgr.373.2023.09.27.10.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 10:29:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=giMp3aEE; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F0A2680A933F; Wed, 27 Sep 2023 08:47:42 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232770AbjI0Pr2 (ORCPT + 99 others); Wed, 27 Sep 2023 11:47:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233224AbjI0Pqz (ORCPT ); Wed, 27 Sep 2023 11:46:55 -0400 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2050.outbound.protection.outlook.com [40.107.244.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7A92272A7; Wed, 27 Sep 2023 08:46:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=li2jxgjl//IPKVSlY9LJwPGq9USzLeQRqWdx8bmT7E0PajiZJK9jdPDv7ZLf/giHYZrHDEantZjYQTodGuARBlnTdCLQ9Tzf/sbV/zasDuRIH4aH4Tf9ZHda6+iESizg6jJLaWnCdF6GHVLKVsuoUNroy6xxP+baPP+ol4QksObJa2CdJLyeqG4H+W6i/JdVTT2MYa3avfhc7DCIuQcLEiWJ6Dvg6qLyX6n38LkfPu4b8lC0H06Lew8QP7vc/2F+D0KhfXk8H8H2XEBsNc+FV7xvF2SoC09OXhrE7gsd+aZ2FiHR+gJVKV2Gc8J5NzrwaPRjj3+3eVA86W4evSerJg== 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=QGKgniNpJFS9YbLdjmtCw4nqN+3EXACRrIBgxwXpQyU=; b=RzkMGF2DmRAIr6r0QFkAo9Qukel410dzpj1E/dlovS55poSpm7erPeEAk47S+YdqlCwqZpp/3d7ecBglZ1dVQEufkEZ4KK32+fK/aAjfzbfgqFAyzPHpYLwD27ub1HDIWkoQH/QpRx1Jep0esj4K46szAMNZNS8iQSnIfyJwnALnlUq9bHycalZ1X/OVZmnzcMfy/UU682wx4WICukdLItZm79lcHO71/bEysswR+H+jiIuVUWmJFcXgQS3+eVepX+yxKs/a/AyyGKyBmHxulIdk5zf+oUCV1PnHGJWwvApFopCd+e+2wC6mIKayRjw3rfr9BnusZ0a5UG77m6lCPA== 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=QGKgniNpJFS9YbLdjmtCw4nqN+3EXACRrIBgxwXpQyU=; b=giMp3aEEq3a1cIiwWccezmbko4wQHi2YXYeK0R5nH4KuzQ4LZHB3GC11mgHdIDYsaez0YThJ2eWV800fNECnUbGjaZ6mXAAThdg39lHec6yYyRVgtBiqPoPwiLMDQMhPH7sd17dW/nARs9bc/u77xoS0p6YzGiE2RA2aiXgdrT8= Received: from BL0PR0102CA0042.prod.exchangelabs.com (2603:10b6:208:25::19) by MW4PR12MB7481.namprd12.prod.outlook.com (2603:10b6:303:212::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.21; Wed, 27 Sep 2023 15:46:52 +0000 Received: from BL02EPF0001A108.namprd05.prod.outlook.com (2603:10b6:208:25:cafe::56) by BL0PR0102CA0042.outlook.office365.com (2603:10b6:208:25::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6838.21 via Frontend Transport; Wed, 27 Sep 2023 15:46:51 +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 BL02EPF0001A108.mail.protection.outlook.com (10.167.241.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6838.14 via Frontend Transport; Wed, 27 Sep 2023 15:46:51 +0000 Received: from rric.localdomain (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; Wed, 27 Sep 2023 10:46:48 -0500 From: Robert Richter To: Alison Schofield , Vishal Verma , Ira Weiny , Ben Widawsky , Dan Williams , "Davidlohr Bueso" , Jonathan Cameron , Dave Jiang CC: , , Bjorn Helgaas , Terry Bowman , Robert Richter , Jonathan Cameron Subject: [PATCH v11 13/20] cxl/pci: Update CXL error logging to use RAS register address Date: Wed, 27 Sep 2023 17:43:32 +0200 Message-ID: <20230927154339.1600738-14-rrichter@amd.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230927154339.1600738-1-rrichter@amd.com> References: <20230927154339.1600738-1-rrichter@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain 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: BL02EPF0001A108:EE_|MW4PR12MB7481:EE_ X-MS-Office365-Filtering-Correlation-Id: f1500f99-1442-454a-b6f6-08dbbf70f7d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Nwlbn/UHu6rbAeMIwiR1Zix5wrp+8e2gDxDk/sfIU4wQWNAS7NsMqxY/MFIc7E52qNYjhZ+rztmoCoGi1wGRFV8L7KQW1EvICZEXjIfnyloLzn/nhJN/tObD5LUtoYCyqb10LHNz2aZRVXZobCRehGIlAFTHi69LHUbtZXjOhOOuvHmNbOnPwnInsZCOFr6qUc4y9LwhnC3CFtkTR7CAL/5u5BWIA9FioKb8WAtf+ufm2LZCQpX2IB2jpzDDSZxtLaX2ExN+2toamyjX9bIiaRgBMKSi7hDVD5tB6YIJQg5TaNL5H3SRZ6NkV63H4zGI3KENRpJnp4NE+12xYWFueeveY2cqAMKFv4D5XDmue1dliNS7HGpVC5XEOw3wYag3IErwiG9M0jgjdDn6A4mit9VanaV2tnsX3MKDdvi8mUMvqHDoeFoaU/iewWxmDKhque1Q+mVr2ZVS+eDhVyHxvFatswODqW6fibvAgpXPicv/YoonAIZWprXjfPSrQqpmITC8r46odnMdOJNePKtaHyfMfzbtPzawCXFHEZ6WohKFEJ+oiV/XaAelFm5c29ihglp18acEcFp/QzdvJ19NcVdMJ9upotSmDmSodIenKj1IjwE6mg1WSGvLi7IZgCpBM1DweXyJ3uu6ZJsBXKUxEM6WMyVarJVvcGRwMhWl8wy/48Sa9pY3w+vGlqafNh3F5M18EGjRye/kHrO0CSdb8c/fFo39b7lcnRJlBrL3+4owJfTgYI5ZkiM2aU68hv0gP8q8odmpnx3PIQDRei5s6sgOfdK+quzwbrEVoHRLRqWDdkezxmPeX4flZ+s5vc4u 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)(39860400002)(346002)(136003)(396003)(230922051799003)(82310400011)(1800799009)(186009)(451199024)(40470700004)(36840700001)(46966006)(1076003)(40460700003)(26005)(6666004)(478600001)(2616005)(16526019)(356005)(36756003)(336012)(426003)(83380400001)(5660300002)(82740400003)(47076005)(81166007)(36860700001)(7416002)(40480700001)(70586007)(110136005)(54906003)(70206006)(15650500001)(316002)(2906002)(41300700001)(8936002)(8676002)(4326008)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2023 15:46:51.7481 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: f1500f99-1442-454a-b6f6-08dbbf70f7d0 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: BL02EPF0001A108.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7481 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_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Wed, 27 Sep 2023 08:47:43 -0700 (PDT) From: Terry Bowman 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: Terry Bowman Signed-off-by: Robert Richter 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 4c6c5c7ba5a3..2b8883288539 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,18 @@ 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); +} + #ifdef CONFIG_PCIEAER_CXL void devm_cxl_setup_parent_dport(struct device *host, struct cxl_dport *dport) @@ -733,6 +743,14 @@ EXPORT_SYMBOL_NS_GPL(devm_cxl_setup_parent_dport, CXL); #endif +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) { @@ -747,7 +765,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: -- 2.30.2