From patchwork Thu Aug 31 17:02:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371737 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 84A5BC83F2F for ; Thu, 31 Aug 2023 17:03:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245687AbjHaRDD (ORCPT ); Thu, 31 Aug 2023 13:03:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236107AbjHaRDC (ORCPT ); Thu, 31 Aug 2023 13:03:02 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2088.outbound.protection.outlook.com [40.107.243.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05C9E8F; Thu, 31 Aug 2023 10:03:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=aIoAPjtFnd077DKUg0oS9qaAT/8BqsDbz1GSiGf+O7BfLynLncmjqlvR4kjJ/81nsfyMEfnAD0hMaPNz8Y1J57p8TP+kMeMaChWhlBCj8OREhf1+MhpcTBEFIUTgpUf2sn3Tu7SgcGjibLGfgzhtA+WoMK4wVy4NtZnuW22ZEbkVmZZybbRwDMMExB2wB3ot/Hf8PDAIq9jelj8eR9C61FHKFP3F2pVDLZIUiXWogMdwHL1wGLl8CuYKUhauyGmog2FgPafLnjhNRdnTVKbdKliucJsl0ihgarxGjokXRk/Qf7M3T66N7Epw1OXMktFYKXic3hggP3r+bSgc0h/1FA== 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=nKTwBQSQJY0K9wjFNf9fNy55PIqVdxgtMnfwSIJGyk0=; b=W+ACGSWMQits/YGNu70lWWVhUPYPEzEkjXpN5YzympXyictA42jVBCbdI82JAgcBEYriYa8ckdm61URAg4Qb/6SmKM/N6X/ffmxu/3486Tc/oiUk66MBD0iqnvJLWj9FHLjeFlMmb/IQMbJBgqqjp40jPV8oGi4lFcNZZdH2SEQMUf/0B6K6TacGclTlTop78oN5iOEAdiOxDUGbcvnqtfg67zUO4ergVdjnNHuKsqFliwOY9LThV0Axq3peKnioeXFLhowRuA1RE7czkCGpAqbCQGVmA9uEo9gAvnE6N5dn1iL/+YysPkP9uRPJMYx2aZ4mM+pw4M0vccZ3JVotvQ== 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=nKTwBQSQJY0K9wjFNf9fNy55PIqVdxgtMnfwSIJGyk0=; b=kq76Lp/UvJHU3ZwWM3C74h0XrLxMRCnF0NGzsd0555o9yguZ8xhho/VuPqXTYLf0SAc+vSg66EBoZ5JjXRtIHm6kl82WtTL7Lkjn0Fl3Tm4GhB+mQbuIA/Et/F9wgrty2PNgE7ujPDsxsZBJ775dqFpvnjto9GPvcIzETWH9cjs= Received: from PH7PR13CA0002.namprd13.prod.outlook.com (2603:10b6:510:174::6) by CY5PR12MB6105.namprd12.prod.outlook.com (2603:10b6:930:2a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.21; Thu, 31 Aug 2023 17:02:57 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:510:174:cafe::86) by PH7PR13CA0002.outlook.office365.com (2603:10b6:510:174::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.15 via Frontend Transport; Thu, 31 Aug 2023 17:02:57 +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 SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:02:57 +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; Thu, 31 Aug 2023 12:02:56 -0500 From: Terry Bowman To: , , , , , , , CC: , , , , Mahesh J Salgaonkar , Oliver O'Halloran , Subject: [PATCH v10 08/15] PCI/AER: Refactor cper_print_aer() for use by CXL driver module Date: Thu, 31 Aug 2023 12:02:41 -0500 Message-ID: <20230831170248.185078-1-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 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: SA2PEPF000015C8:EE_|CY5PR12MB6105:EE_ X-MS-Office365-Filtering-Correlation-Id: a15e1a94-0741-46a9-375b-08dbaa441fcd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: S0dUlgvG/otTPE1mpxZZ0Fjq1znelBCjtyRx3DDrTdvHdr58yisN5Y/2RQWy7dhzwrLmLhrFMnN/WkjXAeHSMylqHKivg3MCpioiDaWdQqvfimQ8RdWKR0Q7r1guxZMNCtvd16z+BQ6+9JgPtkmLKvNWI0TILwLhb6EK4YdzINPIe0jkH4P5ycJIe9qkZcN0lE2fNaz6r+mXihCdoM3whY8pSn/LzavdZIQl8s4H5amWyGdZZZDybBZrP7nW3zS1dl3iRhXrIJlDMhllmvcPR8xirqUEfMr2OVGFTiY9jL1KfMBUtMQjQsJPGmWqLuNd4qMY6AQy/1XH5YCjOnRbeatvvynPHxnnzonAWEt8C5tmEdpLirviVj/qecA+YbBtt38++5qBFGlpSl4jegsybXtoB7ZUPZmfr24NBhn+mNaNrk1yfrG+4POrGuPW361dXiIf0yqmWpE7fLwFKjTUepT6W10+HpbLOcqqAbigv2fVmrDO8K6L3I0anma95MPE8JUIQiJ7cGgMQyLtnhtSk2SzWZ1izxoRUZCaviACbPFUS/OeGH2W8EnWwA01gtfCf1GPb61sqQr1J7GKERmxduiP1DCJ9gybAIk8qqfhNhr5lQ+u1U9WR4B67x0mKj+Okm+2kufPWhjmBwqAM45S/s5UN8PnGBvgJbkxD4xeGQx9L6FkGRM2eZ+nptExu6bseW1QPey/jjMad+0mC68OYP64TuNdHFCcbVtTOgqHLkpZe2dWJucg/5jN/jGrdQIBcGEE7unkOdUHvkp1QyBtUg== 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)(346002)(136003)(376002)(396003)(82310400011)(451199024)(1800799009)(186009)(40470700004)(46966006)(36840700001)(1076003)(2616005)(36860700001)(41300700001)(8936002)(8676002)(4326008)(5660300002)(44832011)(7696005)(6666004)(47076005)(83380400001)(336012)(26005)(16526019)(426003)(82740400003)(356005)(40480700001)(70206006)(70586007)(110136005)(54906003)(316002)(36756003)(2906002)(86362001)(7416002)(478600001)(81166007)(40460700003)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:02:57.0004 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a15e1a94-0741-46a9-375b-08dbaa441fcd 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: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6105 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The CXL driver plans to use cper_print_aer() for logging restricted CXL host (RCH) AER errors. cper_print_aer() is not currently exported and therefore not usable by the CXL drivers built as loadable modules. Export the cper_print_aer() function. Use the EXPORT_SYMBOL_NS_GPL() variant to restrict the export to CXL drivers. The CONFIG_ACPI_APEI_PCIEAER kernel config is currently used to enable cper_print_aer(). cper_print_aer() logs the AER registers and is useful in PCIE AER logging outside of APEI. Remove the CONFIG_ACPI_APEI_PCIEAER dependency to enable cper_print_aer(). The cper_print_aer() function name implies CPER specific use but is useful in non-CPER cases as well. Rename cper_print_aer() to pci_print_aer(). Also, update cxl_core to import CXL namespace imports. Co-developed-by: Robert Richter Signed-off-by: Robert Richter Signed-off-by: Terry Bowman Cc: Mahesh J Salgaonkar Cc: "Oliver O'Halloran" Cc: Bjorn Helgaas Cc: linux-pci@vger.kernel.org Reviewed-by: Jonathan Cameron Acked-by: Bjorn Helgaas Reviewed-by: Dave Jiang --- drivers/cxl/core/port.c | 1 + drivers/pci/pcie/aer.c | 9 +++++---- include/linux/aer.h | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index da4f1b303d6c..45f8846d8c8a 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -2063,3 +2063,4 @@ static void cxl_core_exit(void) subsys_initcall(cxl_core_init); module_exit(cxl_core_exit); MODULE_LICENSE("GPL v2"); +MODULE_IMPORT_NS(CXL); diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index f6c24ded134c..d3344fcf1f79 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -771,9 +771,10 @@ int cper_severity_to_aer(int cper_severity) } } EXPORT_SYMBOL_GPL(cper_severity_to_aer); +#endif -void cper_print_aer(struct pci_dev *dev, int aer_severity, - struct aer_capability_regs *aer) +void pci_print_aer(struct pci_dev *dev, int aer_severity, + struct aer_capability_regs *aer) { int layer, agent, tlp_header_valid = 0; u32 status, mask; @@ -812,7 +813,7 @@ void cper_print_aer(struct pci_dev *dev, int aer_severity, trace_aer_event(dev_name(&dev->dev), (status & ~mask), aer_severity, tlp_header_valid, &aer->header_log); } -#endif +EXPORT_SYMBOL_NS_GPL(pci_print_aer, CXL); /** * add_error_device - list device to be handled @@ -1009,7 +1010,7 @@ static void aer_recover_work_func(struct work_struct *work) PCI_SLOT(entry.devfn), PCI_FUNC(entry.devfn)); continue; } - cper_print_aer(pdev, entry.severity, entry.regs); + pci_print_aer(pdev, entry.severity, entry.regs); if (entry.severity == AER_NONFATAL) pcie_do_recovery(pdev, pci_channel_io_normal, aer_root_reset); diff --git a/include/linux/aer.h b/include/linux/aer.h index 97f64ba1b34a..8f124b904314 100644 --- a/include/linux/aer.h +++ b/include/linux/aer.h @@ -64,7 +64,7 @@ static inline void pci_save_aer_state(struct pci_dev *dev) {} static inline void pci_restore_aer_state(struct pci_dev *dev) {} #endif -void cper_print_aer(struct pci_dev *dev, int aer_severity, +void pci_print_aer(struct pci_dev *dev, int aer_severity, struct aer_capability_regs *aer); int cper_severity_to_aer(int cper_severity); void aer_recover_queue(int domain, unsigned int bus, unsigned int devfn, From patchwork Thu Aug 31 17:02:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371738 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 8F545C83F2F for ; Thu, 31 Aug 2023 17:03:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236107AbjHaRDO (ORCPT ); Thu, 31 Aug 2023 13:03:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346782AbjHaRDO (ORCPT ); Thu, 31 Aug 2023 13:03:14 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2069.outbound.protection.outlook.com [40.107.92.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D571ACFF; Thu, 31 Aug 2023 10:03:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QgQy48Ur3jEA2z9Zb8NYjOxQ1TB3HPztZD7l0xIvWKxqoAnfH+1m68vYsmotMALjbLafj6AVfXjzjXcCPp0a17lR2xxFtILwHJZRQqa+cRr5ZyEwE/bujnppzBsA8U319n9u8w25+NvIsn+sb+zbF3ndxJPpmqsAQ4WLVhV6o7EsDO7osKAPwzM/19cTBZPKrGMumB3xWY89Zqih4b3xNVOpa1Uxud+EZtJRiQ6sWadQkzYtcF7b0s4BZaibrAruDHzSorkWM4szWa3X+1bzX8l2cVp92rv8pvc2lbAfv87v83SQq09edO9qAMNoDVIE+/lzRMgxQFxPA7wWNmIP/A== 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=aK1uFGMddTyh4liXgrI7mzMz3nGdLW2XAzRTWIVddiLGaONSgKcXRlcIk2yHNtXFJ8NRQSRdCOhWzyI+/kOovNsZHzIFmmC9XuzyHhr8z242IeFTFCgjl6jK9nk60p14lUXbyrBW92y9tRV4CAa9slRddj3dMZ3kQIYAb069QbrMMgeTMVUokCcG+p7lNE+4rux/VI1p9BlKwKIi1AhXrlS5bgJ+p+dZbe1jXltuVnEEWDQEnBixkhsFg6qsJCFKF+v77ffj3iUaKwLHUBXtUZgaK9RjY4PBnulyQYa08SzTUmD5UFwmzNiXeBHvwEs7FwW6Ab8H6OTazyEJAiPXzg== 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=pmmkpYAUaFbMalJp+NBk/VCGiNNBwSEJtoPWOd+E1aNvC25TgYAUyQcZz83mUWLxCuvZ9jD7QpspfAaigLe6Ky/MZy1m5uTGJ0cav2xpteNHTntP1sHbigw/RYKxGI8P+TNPBUsC0LiFIuwGydhzLrmq0JyJJHCpuHkyZzF/pKc= Received: from DS7PR05CA0018.namprd05.prod.outlook.com (2603:10b6:5:3b9::23) by CY8PR12MB8196.namprd12.prod.outlook.com (2603:10b6:930:78::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Thu, 31 Aug 2023 17:03:08 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:5:3b9:cafe::32) by DS7PR05CA0018.outlook.office365.com (2603:10b6:5:3b9::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.9 via Frontend Transport; Thu, 31 Aug 2023 17:03:08 +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 SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:03:08 +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; Thu, 31 Aug 2023 12:03:07 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v10 09/15] cxl/pci: Update CXL error logging to use RAS register address Date: Thu, 31 Aug 2023 12:02:42 -0500 Message-ID: <20230831170248.185078-2-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: SA2PEPF000015C6:EE_|CY8PR12MB8196:EE_ X-MS-Office365-Filtering-Correlation-Id: 84e45ed5-c9af-4e76-d04f-08dbaa4426aa X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HNe2uC2OpJQVMOOw9vFYJ+Vk/4APSVkW7cqnGhR+7xrurYpvzlak8CYq1Zhcrpe9vPV9Qj+h1vAxYkOvOJBBiYvoxdu53+Y6YvktQyGHAhLXLrnpLWKFMRuVSrB6nmt+iSZ1UUS51QASzS94KYmjknglJMCAdAcMqSQoUoyc3VIwADmLYvBRfP3ZHdibZDQyJflDkl6bPqoMm/996d95IWKLXoWMNdH2XF3I23QKuNpSws2Y9I2ypdb933Gan6TLlfGLV7pyPJAxPpmTFOkoZ5Jh2EmUkPAGSR8p0XzB+aDQjHqZeJcdDYpREmjdya6xhF+ew4a0uPVXoY4khKGSbSffo2870k8HdQiNEe68fahfXJeBmAre9ST8wDL2OdSfSGmkoHX/gL1uBKbQz2ZEsfloD8vnbSjp7ROiusX0z0uQqkEmnQI8B7azkEYi3RdWGnaVpP5V5c4DWWR7Ez9E3winAXvsop7i8+Uhz2mAj7iwJIZtoBPSY7VRicMn9TlgJXdZbRRUZ0xDBHEoRr/SXBYNLMPfwW7fL/mrBC8PoKewSvj+UswxnFfOHutr3DRhyqZZO/wpaUKinQ4FGBJgzZMYp+11Yhfa7VnVhgNFJ24sYwU8+o9QkODVxQsA80uVWLlAzPr61x6gt91w0QCj4HXu9MrkHruW7d2NcvlK1Dajf4gG65db3vEwWf3zyOlWRDv1vUsIBtI07VIs519+VeKtqzm6EdhT1cl8071a2bF5+nNhZqvzxhx20PnMPSNzvWKTTZhrcLOtBsY1oGeQ1w== 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)(376002)(39860400002)(346002)(186009)(82310400011)(451199024)(1800799009)(46966006)(40470700004)(36840700001)(15650500001)(41300700001)(40460700003)(81166007)(83380400001)(478600001)(82740400003)(356005)(36860700001)(47076005)(86362001)(6666004)(2616005)(26005)(7416002)(1076003)(7696005)(40480700001)(336012)(426003)(16526019)(5660300002)(70206006)(70586007)(316002)(110136005)(36756003)(54906003)(2906002)(4326008)(8676002)(8936002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:03:08.4721 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84e45ed5-c9af-4e76-d04f-08dbaa4426aa 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: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR12MB8196 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: From patchwork Thu Aug 31 17:02:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371741 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 01DD8C83F2F for ; Thu, 31 Aug 2023 17:03:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244979AbjHaRDm (ORCPT ); Thu, 31 Aug 2023 13:03:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346841AbjHaRDl (ORCPT ); Thu, 31 Aug 2023 13:03:41 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2061.outbound.protection.outlook.com [40.107.223.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5322A10D3; Thu, 31 Aug 2023 10:03:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=KV28jVzevrDkg8Jv+LxYD6DJDNn1Dz5gGPJwHAZxm1L7e5NTVyQOU6m3gLfcmYs0N9OTLLJnw+diGdN4mdSPZkNUMhnbIvW3jkfjJRzqUgn+W/1YayolpsiET7yk+Jwk3iq0gCMBsvm1W8+s1Tr3NWwZhMxreLn0giUAvJzovb+RzsENFEznnk1hggNwC6NFTpiqSD5lu0DVlPD6Eq6gJ5ZXvqKnADlQTC0bnAluQQp15FYc6qYy3a5n4TeadtGLyNySmqwghw4Vcvc19zCV8iNeIjHHLQYmUzskaXFeMilz/79wz/y5YDvK5WtDW9gOld9gY9f8klF64DVMzJHnJQ== 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=nQPBspj1nicTMKGofQ24VjrSI8sbSqFGkzE/N0x+rdE=; b=ftjtqxCIz/hdXnxA4UsDTGMpyMmdMviHDe4gage+eW7AFucXcThFWDWU++oATTWJc/OKYejZF6tqxcMKGZ/eJa2tQbg7lSReBciz3NFQvtA0f6r2STPLMwd9tl7v41LY7wibG5b/NxOMgE1FDQ+3T4b6WiinOJ+Ylw1WL7C18jJe92FzyXuEJSn/RTUR1ZEmKNnrMBh6ObDQIkSrnLSCu2yAD1vNHVQzF7nL4e227rWUw4Uzt6kyhCXXBaAhQlGz34kB1tGErcCRLOGBbumI8dHD2wvimO1m4CD8TuS9SKfOaK8S3z8yU77J5XA3gg9Tm5UBctY/nQ5ogLfzjPd+PA== 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=nQPBspj1nicTMKGofQ24VjrSI8sbSqFGkzE/N0x+rdE=; b=X5wkcsRBkEgt+6FYbix1MQPSESsDqqcJRtrosFXoGC6rQX1ziNSB54tAEcu0X+UzdFq0NfzD+GLI/eCng6tRfwBBZHv58+KnkP8RbsAW/ZlPMT+I3LOK4eEy2kKBC6y6B+8TvL2ktquHPtswkkT/71yfEsZoMv64b7u6Z2AQ1Vc= Received: from PH0PR07CA0053.namprd07.prod.outlook.com (2603:10b6:510:e::28) by DM3PR12MB9327.namprd12.prod.outlook.com (2603:10b6:0:42::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.35; Thu, 31 Aug 2023 17:03:21 +0000 Received: from SA2PEPF000015C9.namprd03.prod.outlook.com (2603:10b6:510:e:cafe::f2) by PH0PR07CA0053.outlook.office365.com (2603:10b6:510:e::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.21 via Frontend Transport; Thu, 31 Aug 2023 17:03:20 +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 SA2PEPF000015C9.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:03:19 +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; Thu, 31 Aug 2023 12:03:18 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v10 10/15] cxl/pci: Map RCH downstream AER registers for logging protocol errors Date: Thu, 31 Aug 2023 12:02:43 -0500 Message-ID: <20230831170248.185078-3-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: SA2PEPF000015C9:EE_|DM3PR12MB9327:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b6d0c16-444d-4b19-9f1a-08dbaa442d75 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: hkIfwnV2VKEFY2gNKJCzPzm+2ZUZ9254F+95OYh779yqaMxnt94WobrExdne5tJVmwDskX99fITGsEYrPEjg1Tny2ABZ3BaOyg6Hoj24QRp30f1dTStDQK1BEjFIj4+YuBN0SYbrs35mlbZe3i14kirOgFIpM+TQpg4eG++7ud/q2XS0kJmpxPzkRN/R1dX61MDac2pW8xqzAbNGNRLtNATdlqhC1DbAISgg4Knfxp5uPtWL4JgExpcXjW0824IyhIDPHR8hfQgkL2q6nPgoohpzrOyKkXDoQ8saCQfJ8hvYaO1Cfyv/hlMf7FfCqbXpKsYHALunwCRyW+Esjw8Fa8OgR2A/9PocPDJug1ZNFPNIQKJXye7/obx1//NOhqDaLMqu+ZD3/Es6aV/dtIsHDEG4IzOMK2GCr5ev6OouzK/wtvmZmzwdzlvdpjfCBIhSL4jZS9ULr3fSMARNB3oh98zuml5oUl2X4s6Oywzwc8euWMoX1Xl7AvZ00/uXYRXfmPO6WPn8wFTNP9/YCm9i2NamhW1ko1bKrQ3yVkC7uEp2Mc9Gw4fq0gCRzNdqoj3Ss1+L/fRSNCWoL9nmgHW4tIQjYbsZsnShaIO66Ur81uazTFax+ZN6TOiJl8X+27YQagvbW4wz8uxRYs0GOkOVrDyc1S1fO5c61VCdOZOCORO3eVk6r++jiURHxWSoP+uzkXJlGM0Irq1h9VCZwwDxbfoikXzej/PcGkRH9aG4IUml/suI2GocK0AT1CYU55eRhSuuPuRLzCixvJAW07jK7Q== 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)(346002)(396003)(376002)(82310400011)(451199024)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(41300700001)(316002)(4326008)(7416002)(426003)(336012)(16526019)(2616005)(2906002)(47076005)(86362001)(44832011)(5660300002)(83380400001)(36756003)(1076003)(26005)(36860700001)(40480700001)(8676002)(8936002)(6666004)(82740400003)(81166007)(356005)(7696005)(54906003)(110136005)(478600001)(70586007)(70206006)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:03:19.9457 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0b6d0c16-444d-4b19-9f1a-08dbaa442d75 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: SA2PEPF000015C9.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM3PR12MB9327 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The restricted CXL host (RCH) error handler will log protocol errors using AER and RAS status registers. The AER and RAS registers need to be virtually memory mapped before enabling interrupts. Update __devm_cxl_add_dport() to include RCH RAS and AER mapping. Add 'struct cxl_regs' to 'struct cxl_dport' for saving a pointer to the RCH downstream port's AER and RAS registers. 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/port.c | 34 ++++++++++++++++++++++++++++++++++ drivers/cxl/core/regs.c | 1 + drivers/cxl/cxl.h | 12 ++++++++++++ 3 files changed, 47 insertions(+) diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 45f8846d8c8a..2a22a7ed4704 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include @@ -949,6 +950,37 @@ static void cxl_dport_unlink(void *data) sysfs_remove_link(&port->dev.kobj, link_name); } +static void cxl_dport_map_rch_aer(struct cxl_dport *dport) +{ + struct cxl_rcrb_info *ri = &dport->rcrb; + struct cxl_port *port = dport->port; + void __iomem *dport_aer = NULL; + resource_size_t aer_phys; + + if (dport->rch && ri->aer_cap) { + aer_phys = ri->aer_cap + ri->base; + dport_aer = devm_cxl_iomap_block(&port->dev, aer_phys, + sizeof(struct aer_capability_regs)); + } + + dport->regs.dport_aer = dport_aer; +} + +static void cxl_dport_map_regs(struct cxl_dport *dport) +{ + struct cxl_register_map *map = &dport->comp_map; + struct device *dev = dport->dport_dev; + + if (!map->component_map.ras.valid) + dev_dbg(dev, "RAS registers not found\n"); + else if (cxl_map_component_regs(map, dev, &dport->regs.component, + BIT(CXL_CM_CAP_CAP_ID_RAS))) + dev_dbg(dev, "Failed to map RAS capability.\n"); + + if (dport->rch) + cxl_dport_map_rch_aer(dport); +} + static struct cxl_dport * __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, int port_id, resource_size_t component_reg_phys, @@ -1008,6 +1040,8 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, if (rc) return ERR_PTR(rc); + cxl_dport_map_regs(dport); + cond_cxl_root_lock(port); rc = add_dport(port, dport); cond_cxl_root_unlock(port); diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c index c8562cdbd17b..5cb78b76c757 100644 --- a/drivers/cxl/core/regs.c +++ b/drivers/cxl/core/regs.c @@ -199,6 +199,7 @@ void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr, return ret_val; } +EXPORT_SYMBOL_NS_GPL(devm_cxl_iomap_block, CXL); int cxl_map_component_regs(const struct cxl_register_map *map, struct device *dev, diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h index b4383697180f..251cda10c283 100644 --- a/drivers/cxl/cxl.h +++ b/drivers/cxl/cxl.h @@ -221,6 +221,14 @@ struct cxl_regs { struct_group_tagged(cxl_pmu_regs, pmu_regs, void __iomem *pmu; ); + + /* + * RCH downstream port specific RAS register + * @aer: CXL 3.0 8.2.1.1 RCH Downstream Port RCRB + */ + struct_group_tagged(cxl_rch_regs, rch_regs, + void __iomem *dport_aer; + ); }; struct cxl_reg_map { @@ -273,6 +281,8 @@ void cxl_probe_component_regs(struct device *dev, void __iomem *base, struct cxl_component_reg_map *map); void cxl_probe_device_regs(struct device *dev, void __iomem *base, struct cxl_device_reg_map *map); +void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr, + resource_size_t length); int cxl_map_component_regs(const struct cxl_register_map *map, struct device *dev, struct cxl_component_regs *regs, @@ -625,6 +635,7 @@ struct cxl_rcrb_info { * @rcrb: Data about the Root Complex Register Block layout * @rch: Indicate whether this dport was enumerated in RCH or VH mode * @port: reference to cxl_port that contains this downstream port + * @regs: Dport parsed register blocks */ struct cxl_dport { struct device *dport_dev; @@ -633,6 +644,7 @@ struct cxl_dport { struct cxl_rcrb_info rcrb; bool rch; struct cxl_port *port; + struct cxl_regs regs; }; /** From patchwork Thu Aug 31 17:02:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371742 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 E598EC83F2F for ; Thu, 31 Aug 2023 17:04:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238772AbjHaREN (ORCPT ); Thu, 31 Aug 2023 13:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346856AbjHaREI (ORCPT ); Thu, 31 Aug 2023 13:04:08 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3488410CE; Thu, 31 Aug 2023 10:03:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XR8ENDLwKYUjtQuaXNiHoJ1+jCXHC+caljLjgsnAsIDDQaDDPgFfV7hyztRblohI1VDNKoalgF6smyzzL0w0MgN/HHsW/uoE22pXV3f/I3gQaBVegomoqb86pmR0yJl8PHCoU2ncq2RpAuew/CALo4TlSi0knWZCwLuJqK0Bs7DcVTgDQYVn15/ZZPK4ajokrBHim5S563KL5CK5kq1zDtC6tc+0u8PGH3og9o+z4TG02NXq9iw20TahxMRb0Chqcylmd76HZ8bbEaqNLYhI3YlolAB+WaoANuIRB+moK+b24pA08yT/rSQBlDyQ0cabdWjOfNT4oERVInUsGmLlyQ== 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=zrropQhLceQl7tGToOfeISiMGtGWPfSCW9YAyl/WFo4=; b=ZI/XhxUFSNJaZ3uCwi8W2vHV1r7kTYa1ggQ/dGT6zFQYvCF9f+9HWYXVCJuU+LO6LxCKIRTIWex0Wnwg+OH5j4aG5Wtk64etqmHj7PpEscBkTRMiEq9d/cyyfP7PazKjki7v7Dz7uIZ2nBUAEV91iQ2qglzXH6aby1P7CyRk/AYoNnhcujFnoUs+hOpISFgsmxyUK+E9UmNaxL7E+zEwjnBOz14vMJzuq5zUtE/qFn/stXmqsA2k7mTWWB1Dcx3XZ4ux2u+ABGQyVdRrDhAS6GQVlIooxxCbCgBPLvJ6Wcs95nEGNaxZaEZy6ofRcVe1QEqsBTu2cWmfuSCJV3bV4g== 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=zrropQhLceQl7tGToOfeISiMGtGWPfSCW9YAyl/WFo4=; b=uhNSg2F+Gi59VoBIgM8/5iIYuZK+CVbH1TZXMvVhK8TwIh0my+azS4yNRv5nvQGAi2GLrNuTR7CwoguRqSuM8l7YhQkzWynSFLtM2OfK/gOaTmJFEtJC7Sejh8DJof2uILVl7F6qI+gPR24yrSsluPq1/oGHjY1Jm+np4hPEs4E= Received: from PH7PR17CA0031.namprd17.prod.outlook.com (2603:10b6:510:323::14) by SJ0PR12MB6926.namprd12.prod.outlook.com (2603:10b6:a03:485::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.22; Thu, 31 Aug 2023 17:03:34 +0000 Received: from SA2PEPF000015CD.namprd03.prod.outlook.com (2603:10b6:510:323:cafe::66) by PH7PR17CA0031.outlook.office365.com (2603:10b6:510:323::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.22 via Frontend Transport; Thu, 31 Aug 2023 17:03:34 +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 SA2PEPF000015CD.mail.protection.outlook.com (10.167.241.203) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:03:33 +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; Thu, 31 Aug 2023 12:03:29 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v10 11/15] cxl/pci: Add RCH downstream port error logging Date: Thu, 31 Aug 2023 12:02:44 -0500 Message-ID: <20230831170248.185078-4-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: SA2PEPF000015CD:EE_|SJ0PR12MB6926:EE_ X-MS-Office365-Filtering-Correlation-Id: 37a67cb5-a3e9-47ed-017c-08dbaa4435af X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7RIGUsqiZK71Ts5dNRwjVFcjQI+mUMmMmCrWiOsa7cY4f4DtTdwsAsJJErJuLqOrtrG1YKa0TaHSN1nryeq+B7yZv1NwUMbVPNIbtr9nXj/ddvMAdOGpCoun09OCY/MGhDzPIIpzuCUcmFON4AiFSGiA8eIk//qNUaG55az7EJ5N6siKq+H/NgmVJr/xHuTuiNal/guoGJD8l0LLHWxKnnle1h541n+3brmAEzX2RFXPH8JpiHkyllLQjNznqB+FBeIgd4Td8BJgnnRTlu2hGSDnOnNj5jdgAKZtqMrW6H4mnfRXPtRriwMzDjT7KgPaqoubb7fMLJwF2bsAgnLSQ7zXzZrMYAqKF+EftEXKMRVFY17uF2gd1p+DAuHpquPM/hp9nNDec86lL9fu0gZLwUaAzfW7mCq6LZ4uIhIBkwNlE5NX2EwzCHJrZSe44tEVqGV4srGqzKH4LlQCpb0fcTFNlmbaopNCWSeqDJGMJljYO7Qo9bWjZEo970QcnMc0mlsjxAbWECKuzdcwR9XZZgMzUhzRWn5MhjlGh6DBE1nPdrm02W5bYWQcv6CTrv4eC11ilQ1cgj215ZEIsRzlrwPRVVbaze/F4bUdJcPhL48pDLnNU8wgf6QkTWtwddX4UmUF1esQNIy3FpDqJzUR985sb8wqlq4wCLUhMvJFt7n1qooHBs6QXNI/S5RpbsCdVyngbb16XDQHl7mPmPrLZWX6rIybkgeAeeKCYo9cQ9eEmlmAFHFhFJWOcWphO7Q1Vxn5lAYv8C80l1+hKMV0vQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(39860400002)(396003)(376002)(346002)(136003)(1800799009)(451199024)(82310400011)(186009)(46966006)(36840700001)(40470700004)(6666004)(2906002)(5660300002)(86362001)(316002)(478600001)(7416002)(2616005)(47076005)(4326008)(8676002)(7696005)(36860700001)(44832011)(8936002)(40460700003)(26005)(1076003)(82740400003)(40480700001)(41300700001)(336012)(426003)(36756003)(356005)(83380400001)(81166007)(54906003)(70206006)(70586007)(110136005)(16526019)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:03:33.7435 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 37a67cb5-a3e9-47ed-017c-08dbaa4435af 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: SA2PEPF000015CD.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB6926 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org RCH downstream port error logging is missing in the current CXL driver. The missing AER and RAS error logging is needed for communicating driver error details to userspace. Update the driver to include PCIe AER and CXL RAS error logging. Add RCH downstream port error handling into the existing RCiEP handler. The downstream port error handler is added to the RCiEP error handler because the downstream port is implemented in a RCRB, is not PCI enumerable, and as a result is not directly accessible to the PCI AER root port driver. The AER root port driver calls the RCiEP handler for handling RCD errors and RCH downstream port protocol errors. Update existing RCiEP correctable and uncorrectable handlers to also call the RCH handler. The RCH handler will read the RCH AER registers, check for error severity, and if an error exists will log using an existing kernel AER trace routine. The RCH handler will also log downstream port RAS errors if they exist. 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 | 101 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 101 insertions(+) diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index edfee8035820..1c40270968b6 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -728,10 +729,107 @@ static bool cxl_handle_endpoint_ras(struct cxl_dev_state *cxlds) return __cxl_handle_ras(cxlds, cxlds->regs.ras); } +#ifdef CONFIG_PCIEAER_CXL + +static void cxl_handle_rdport_cor_ras(struct cxl_dev_state *cxlds, + struct cxl_dport *dport) +{ + return __cxl_handle_cor_ras(cxlds, dport->regs.ras); +} + +static bool cxl_handle_rdport_ras(struct cxl_dev_state *cxlds, + struct cxl_dport *dport) +{ + return __cxl_handle_ras(cxlds, dport->regs.ras); +} + +/* + * Copy the AER capability registers using 32 bit read accesses. + * This is necessary because RCRB AER capability is MMIO mapped. Clear the + * status after copying. + * + * @aer_base: base address of AER capability block in RCRB + * @aer_regs: destination for copying AER capability + */ +static bool cxl_rch_get_aer_info(void __iomem *aer_base, + struct aer_capability_regs *aer_regs) +{ + int read_cnt = sizeof(struct aer_capability_regs) / sizeof(u32); + u32 *aer_regs_buf = (u32 *)aer_regs; + int n; + + if (!aer_base) + return false; + + /* Use readl() to guarantee 32-bit accesses */ + for (n = 0; n < read_cnt; n++) + aer_regs_buf[n] = readl(aer_base + n * sizeof(u32)); + + writel(aer_regs->uncor_status, aer_base + PCI_ERR_UNCOR_STATUS); + writel(aer_regs->cor_status, aer_base + PCI_ERR_COR_STATUS); + + return true; +} + +/* Get AER severity. Return false if there is no error. */ +static bool cxl_rch_get_aer_severity(struct aer_capability_regs *aer_regs, + int *severity) +{ + if (aer_regs->uncor_status & ~aer_regs->uncor_mask) { + if (aer_regs->uncor_status & PCI_ERR_ROOT_FATAL_RCV) + *severity = AER_FATAL; + else + *severity = AER_NONFATAL; + return true; + } + + if (aer_regs->cor_status & ~aer_regs->cor_mask) { + *severity = AER_CORRECTABLE; + return true; + } + + return false; +} + +static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) +{ + struct pci_dev *pdev = to_pci_dev(cxlds->dev); + struct aer_capability_regs aer_regs; + struct cxl_dport *dport; + struct cxl_port *port; + int severity; + + port = cxl_pci_find_port(pdev, &dport); + if (!port) + return; + + put_device(&port->dev); + + if (!cxl_rch_get_aer_info(dport->regs.dport_aer, &aer_regs)) + return; + + if (!cxl_rch_get_aer_severity(&aer_regs, &severity)) + return; + + pci_print_aer(pdev, severity, &aer_regs); + + if (severity == AER_CORRECTABLE) + cxl_handle_rdport_cor_ras(cxlds, dport); + else + cxl_handle_rdport_ras(cxlds, dport); +} + +#else +static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) { } +#endif + void cxl_cor_error_detected(struct pci_dev *pdev) { struct cxl_dev_state *cxlds = pci_get_drvdata(pdev); + if (cxlds->rcd) + cxl_handle_rdport_errors(cxlds); + cxl_handle_endpoint_cor_ras(cxlds); } EXPORT_SYMBOL_NS_GPL(cxl_cor_error_detected, CXL); @@ -744,6 +842,9 @@ pci_ers_result_t cxl_error_detected(struct pci_dev *pdev, struct device *dev = &cxlmd->dev; bool ue; + if (cxlds->rcd) + cxl_handle_rdport_errors(cxlds); + /* * A frozen channel indicates an impending reset which is fatal to * CXL.mem operation, and will likely crash the system. On the off From patchwork Thu Aug 31 17:02:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371743 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 5366FC83F34 for ; Thu, 31 Aug 2023 17:04:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244879AbjHaREN (ORCPT ); Thu, 31 Aug 2023 13:04:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346855AbjHaREI (ORCPT ); Thu, 31 Aug 2023 13:04:08 -0400 Received: from NAM04-BN8-obe.outbound.protection.outlook.com (mail-bn8nam04on2060.outbound.protection.outlook.com [40.107.100.60]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1C351B2; Thu, 31 Aug 2023 10:03:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=COxd/sVHYo97IgLi8okp0pPTwk6kuHgLB0LuPGObMmZuZMv6+t8LtL670KLnhsd3WfgsmvInnc7K8Ewuc9vFQkrl9GjTaUZE09u3pv91r9nkD/YBKSVrxlJSiPMh1yUC9VeoCa6VebAHanABP5/3j5VINKkm0jtXZMDem653cHTlVwYc4IrJ5HogXTRAC017rfdzlHqbv5QCUkqHt4wEXpEeTJ+WnHZyLVXDPANNTHn0WP+hjuFINsxW2I8DD8krPI14MwndyMZnw8QA06xS1SXDHrsmqfeLk/jhpEHX0hf/HQTvVuakN+mxNRv97jd8eMcwNdFpRThS/j+ND5HXwA== 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=MTkkVGDXapof5hOE4XnqiEMQzlJecUOlAoRIEpC2gyg=; b=SbAHbMnk52umE5cbYZujr7j2E4lwwsgBZoVsb/zoqKqDFXOFBkjs26Uns3FrpnOTjEQm9A1o9ZrH2NtyPi2WyTYtigkB2jH5op/iNh+j2Qvsb+ihc2gbes5HJIPiodOlIqdmHYMOqJtTgU5ZT1/madvPoYT0Ho/yA+uSrUTAFau3jFvCoKHqPm+k1l1Etqt6dC+ZSdiO2eGTlhLI1W0GzctC0/LTXLywKQDH7woOHyP4WFSpuoNywMxLFuDimsRddl5UfHywmAlgE7+dfH/QyGeF20ocwnotV3hetnYNUKZitvgzYAAjSYGNWE8QHba7mMOncxZBwNd54lQv6Y5wDw== 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=MTkkVGDXapof5hOE4XnqiEMQzlJecUOlAoRIEpC2gyg=; b=oarOe5YGaudOH1WwNUpJgKJ9Zo+si6sKpsjVSzZq/dyC6mG1ffjfwdLeANV3j5nQmI2Xq+6r8mTYmXBrtfe1CJxafmxOQpsKD6PPzm/y4uvgdCS+T/HMeFQ6Nhe9+XnEfzumDUx1zSUs5aXv6YmWvkNNuDrR+mrmqxAN0vcr8hc= Received: from PH7PR13CA0005.namprd13.prod.outlook.com (2603:10b6:510:174::8) by SN7PR12MB7227.namprd12.prod.outlook.com (2603:10b6:806:2aa::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.21; Thu, 31 Aug 2023 17:03:41 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:510:174:cafe::61) by PH7PR13CA0005.outlook.office365.com (2603:10b6:510:174::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.13 via Frontend Transport; Thu, 31 Aug 2023 17:03:41 +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 SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:03:41 +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; Thu, 31 Aug 2023 12:03:40 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v10 12/15] cxl/pci: Disable root port interrupts in RCH mode Date: Thu, 31 Aug 2023 12:02:45 -0500 Message-ID: <20230831170248.185078-5-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: SA2PEPF000015C8:EE_|SN7PR12MB7227:EE_ X-MS-Office365-Filtering-Correlation-Id: 9c07a26b-63f5-4d27-9343-08dbaa443a3b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zRfVDS/GIMuv1uCnw5PODFlaLb4M3vjdfiezuG0184k8XNLTfloIjuN7BMfo1/IyRIEgK2brNC0R9UhhYBHriuoQlYT6QnEW7j9xdSUQnUnxYoBfHVhfZx5BYSlEgfj7zE3sn3j7PKcPyByvL27mWzGJOlanByoZLWDvQsS3suKgVNL0nD4pQP5tXqhlgLIBRhdPQbbk9tHDR4q6UqlOYm1ZV/YJHVZ32fbKMLx51RAjRO3uFaJjtAtrrbiVti21POWRgKMNoL3kPD/VFjy7+SpqYgF+SBUngK19JvW12RLu1tDX5+6RcxE4eSJuCVvWHb7iCPh/wQx+6c6wvn9P848VhJLe93YWXf+CQjWzMQaO2tc/erT71d3p+RqLuEFx9CTEHPUWTFp2+om0UhlK2cLjQYbimtZVDtYVmY969zHesVq2gg5r56wq4KfPa4Pb6r2do2CzqAIQy9YtZwR2upJo+57oH2lbS4f3U8XG4pGzPjPzYV29Xl9NqxVt9DlAeYn7+dFKJMnwS3mk07YHZl+hVmrWthsCnVQ/dgNHRU3B6AIfADKSJDpTf/hTKkB1UsNIKhOgBjCRKNF8EU7iFz+smBHxG8N50GU/jFrhqQ3g0FM+E2aTf41y6AuMxBoy+wksYBUo+/WaQ+BbxgCcr020aCdPswDsWGHhTZEAQeGsROsFadMy3LeVekZoYhfAFxiMhHtomm5lNX8/iY1DD3dVk6UgYis8VQu1NxWQuYyMES1YNEx/zcefuPI4Js6P16jbK2/IHKcbhQYT+rYtZg== 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)(1800799009)(186009)(82310400011)(451199024)(40470700004)(46966006)(36840700001)(40460700003)(41300700001)(7416002)(356005)(82740400003)(81166007)(86362001)(2616005)(478600001)(47076005)(83380400001)(336012)(26005)(16526019)(426003)(1076003)(7696005)(36860700001)(40480700001)(70586007)(70206006)(110136005)(36756003)(54906003)(316002)(2906002)(4326008)(8936002)(8676002)(5660300002)(44832011)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:03:41.3913 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9c07a26b-63f5-4d27-9343-08dbaa443a3b 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: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB7227 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org The RCH root port contains root command AER registers that should not be enabled.[1] Disable these to prevent root port interrupts. [1] CXL 3.0 - 12.2.1.1 RCH Downstream Port-detected Errors Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/cxl/core/core.h | 6 ++++++ drivers/cxl/core/pci.c | 29 +++++++++++++++++++++++++++++ drivers/cxl/core/port.c | 3 +++ 3 files changed, 38 insertions(+) diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h index f470ef5c0a6a..6b037030b936 100644 --- a/drivers/cxl/core/core.h +++ b/drivers/cxl/core/core.h @@ -87,4 +87,10 @@ enum cxl_poison_trace_type { CXL_POISON_TRACE_CLEAR, }; +#ifdef CONFIG_PCIEAER_CXL +void cxl_disable_rch_root_ints(struct cxl_dport *dport); +#else +static inline void cxl_disable_rch_root_ints(struct cxl_dport *dport) { }; +#endif + #endif /* __CXL_CORE_H__ */ diff --git a/drivers/cxl/core/pci.c b/drivers/cxl/core/pci.c index 1c40270968b6..e306d3c9638b 100644 --- a/drivers/cxl/core/pci.c +++ b/drivers/cxl/core/pci.c @@ -819,6 +819,35 @@ static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) cxl_handle_rdport_ras(cxlds, dport); } +void cxl_disable_rch_root_ints(struct cxl_dport *dport) +{ + void __iomem *aer_base = dport->regs.dport_aer; + struct pci_host_bridge *bridge; + u32 aer_cmd_mask, aer_cmd; + + if (!aer_base) + return; + + bridge = to_pci_host_bridge(dport->dport_dev); + + /* + * Disable RCH root port command interrupts. + * CXL 3.0 12.2.1.1 - RCH Downstream Port-detected Errors + * + * This sequence may not be necessary. CXL spec states disabling + * the root cmd register's interrupts is required. But, PCI spec + * shows these are disabled by default on reset. + */ + if (bridge->native_cxl_error) { + aer_cmd_mask = (PCI_ERR_ROOT_CMD_COR_EN | + PCI_ERR_ROOT_CMD_NONFATAL_EN | + PCI_ERR_ROOT_CMD_FATAL_EN); + aer_cmd = readl(aer_base + PCI_ERR_ROOT_COMMAND); + aer_cmd &= ~aer_cmd_mask; + writel(aer_cmd, aer_base + PCI_ERR_ROOT_COMMAND); + } +} + #else static void cxl_handle_rdport_errors(struct cxl_dev_state *cxlds) { } #endif diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c index 2a22a7ed4704..d195af72ed65 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -1042,6 +1042,9 @@ __devm_cxl_add_dport(struct cxl_port *port, struct device *dport_dev, cxl_dport_map_regs(dport); + if (dport->rch) + cxl_disable_rch_root_ints(dport); + cond_cxl_root_lock(port); rc = add_dport(port, dport); cond_cxl_root_unlock(port); From patchwork Thu Aug 31 17:02:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371744 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 9009DC83F32 for ; Thu, 31 Aug 2023 17:04:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232391AbjHaREW (ORCPT ); Thu, 31 Aug 2023 13:04:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238283AbjHaREU (ORCPT ); Thu, 31 Aug 2023 13:04:20 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2073.outbound.protection.outlook.com [40.107.93.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A23010EB; Thu, 31 Aug 2023 10:03:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JDxBxEhpnV25jbdBlgkIzvWRtw//uBx71dfJkurHLEBiSA22V+KdQ9th5yDj3s542oJVU8w8fv/WVVygIu0q8npSlxQGTiyojj2QaMgUF3CUIe4tDfewxgLb3IcQZ9vHmn19kxr4w4NOljdR+IIdRK7m8pp/DSmxRlqeDWl2+i4Oz/zYCH3OZJckykmwabSbFbWCU29PYUDKs4w/EKbrBxX6kEXq+j+LuOder3w4ZuOStxuZGwReF56nIAYjxDaydldZq1SG6IdLeWxQAY3RkI9v55TcsJc+nlzakddrrKYdiIXSKHCKku+Ji2wBlh3Kfs5yBVN/kowQKOS7VtZerw== 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=IYstJQr+GL/LJYik1NBn6/QzGLgvbSnp0Bwgf2p2jSI=; b=apUxLBPpw1Dnx21dtB7cbEXY3T2LHRh+hRDMAzT59FL+DI63kUvk3Qd2ZJr6mQB1+95FmVIIPikXqcsVZuTPlfmIUeu0J4RdoJTu6bCgmKc95XfFfMX72IYL+SlB3aeW5FWQwv4vWYhXD9YeYlytJsov2FACT+jO5d9towPWd5+bBRUk31D+6pnKr3ZdsnoJUqR9Ta3s9nzTQBxqB6o0jwCsKaZmjha0Di4Sb3NASlL0/110H3fOHFYKPpOjVIDncdZz6lb5vtwvqNKhNjJPvIcePdYlo5gU7jaia/I/lCwd+M65S3bJqe1OD6uPCOqLwaSXwhaoWRFbTyzCeXpe4Q== 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=IYstJQr+GL/LJYik1NBn6/QzGLgvbSnp0Bwgf2p2jSI=; b=afJrmiWX1A+g5x/ZaKJIwP7ZKoWSrk76fMfFzMWnYdBw4L1wwb7tk6j0YLzcLc30cBrvMgMiguIyWl+RY5zlW+nKl0RyrPqQI3fJFw4whbb/McdBBIgNPIDO1xlzspOZrOsaxv0hyNjgogKzVaCvWjR69V6nZDhTdN5Lq/FEsc0= Received: from PH7PR13CA0001.namprd13.prod.outlook.com (2603:10b6:510:174::7) by CY5PR12MB6525.namprd12.prod.outlook.com (2603:10b6:930:32::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6745.18; Thu, 31 Aug 2023 17:03:53 +0000 Received: from SA2PEPF000015C8.namprd03.prod.outlook.com (2603:10b6:510:174:cafe::9e) by PH7PR13CA0001.outlook.office365.com (2603:10b6:510:174::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.12 via Frontend Transport; Thu, 31 Aug 2023 17:03:52 +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 SA2PEPF000015C8.mail.protection.outlook.com (10.167.241.198) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:03:52 +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; Thu, 31 Aug 2023 12:03:51 -0500 From: Terry Bowman To: , , , , , , , CC: , , , , Oliver O'Halloran , , Subject: [PATCH v10 13/15] PCI/AER: Forward RCH downstream port-detected errors to the CXL.mem dev handler Date: Thu, 31 Aug 2023 12:02:46 -0500 Message-ID: <20230831170248.185078-6-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: SA2PEPF000015C8:EE_|CY5PR12MB6525:EE_ X-MS-Office365-Filtering-Correlation-Id: df8f982b-9865-4b1a-8289-08dbaa4440df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: y80wplkLoo4EM436q0c8yzJe1S5CW1HtLBNe541m2AQ7Hk/LgIgjEHZpHYUoYLN1FI1utt5g1K0wqwh1ivKt4lKt/TOTw4LNqfG2DGIm4OQqAp/HNAOR63ZTzCYShgjpMxZv5DF72GDH18BSZ+kh1/KWDx+xWczMPvvL+o+e7daUG87q7jOOFMU/mLjY57Yw7jekgzx+3Xg6p0MRW0NQ0TUYA6sSdRlS1J/aqXndZZyIswFz3NuXyEc0ufq4n5kqDRk35xugVMobRE1dojsSuNZEKQWJLavpH8Nark7gsfD2rVW0O2Q2Maixgoo4zK4r4Lft/CkYstFUgOLDQlR1Vpo7CahW/sUIf5MUcaSnJ2OwMwRoJ/4xQB1d2qOIzkeDxiBjUG34hS4rh3TO8S+fGrmVwJQHz9AypD5yJfhC+BUgxm+IkQVFkTMSeqvAPHlKc3GddN7OqJmw6YN2oORgssiDq+dKh38t2N1RoVfOqCZPuKhVysykYyCOPiCdPiR2oGIMbBfqw9bY/7djOO4jfeI1w6nlQz5LQvL6FDHMbeJry+ocjZ0vttYkdCiNiZgwc7FKxWe8emdK7rvpBfkuxDL9HMcdTY/Z6jKcUP//5GFjJWU20j5AX9LBG426RJ1T/twssle7pxHuxolNwO2++EfjicxnYOrwRKB86HKPtn0PIB4UcY5hmFoZykI0lku4ee8ckSJc+lQ6JzjLAAu8Z/zPSVObhYPk7jBtod+S8tPuu8Yb7TN3ArnB6X96N4wG6PHTfQPgeFSYpGmvSEe7LQ== 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)(346002)(396003)(376002)(82310400011)(451199024)(186009)(1800799009)(36840700001)(40470700004)(46966006)(40460700003)(41300700001)(316002)(4326008)(7416002)(426003)(336012)(16526019)(2616005)(2906002)(47076005)(86362001)(44832011)(5660300002)(83380400001)(36756003)(1076003)(26005)(36860700001)(40480700001)(8676002)(8936002)(6666004)(82740400003)(81166007)(356005)(966005)(7696005)(54906003)(110136005)(478600001)(70586007)(70206006)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:03:52.5320 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: df8f982b-9865-4b1a-8289-08dbaa4440df 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: SA2PEPF000015C8.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6525 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Robert Richter In Restricted CXL Device (RCD) mode a CXL device is exposed as an RCiEP, but CXL downstream and upstream ports are not enumerated and not visible in the PCIe hierarchy. [1] Protocol and link errors from these non-enumerated ports are signaled as internal AER errors, either Uncorrectable Internal Error (UIE) or Corrected Internal Errors (CIE) via an RCEC. Restricted CXL host (RCH) downstream port-detected errors have the Requester ID of the RCEC set in the RCEC's AER Error Source ID register. A CXL handler must then inspect the error status in various CXL registers residing in the dport's component register space (CXL RAS capability) or the dport's RCRB (PCIe AER extended capability). [2] Errors showing up in the RCEC's error handler must be handled and connected to the CXL subsystem. Implement this by forwarding the error to all CXL devices below the RCEC. Since the entire CXL device is controlled only using PCIe Configuration Space of device 0, function 0, only pass it there [3]. The error handling is limited to currently supported devices with the Memory Device class code set (CXL Type 3 Device, PCI_CLASS_MEMORY_CXL, 502h), handle downstream port errors in the device's cxl_pci driver. Support for other CXL Device Types (e.g. a CXL.cache Device) can be added later. To handle downstream port errors in addition to errors directed to the CXL endpoint device, a handler must also inspect the CXL RAS and PCIe AER capabilities of the CXL downstream port the device is connected to. Since CXL downstream port errors are signaled using internal errors, the handler requires those errors to be unmasked. This is subject of a follow-on patch. The reason for choosing this implementation is that the AER service driver claims the RCEC device, but does not allow it to register a custom specific handler to support CXL. Connecting the RCEC hard-wired with a CXL handler does not work, as the CXL subsystem might not be present all the time. The alternative to add an implementation to the portdrv to allow the registration of a custom RCEC error handler isn't worth doing it as CXL would be its only user. Instead, just check for an CXL RCEC and pass it down to the connected CXL device's error handler. With this approach the code can entirely be implemented in the PCIe AER driver and is independent of the CXL subsystem. The CXL driver only provides the handler. [1] CXL 3.0 spec: 9.11.8 CXL Devices Attached to an RCH [2] CXL 3.0 spec, 12.2.1.1 RCH Downstream Port-detected Errors [3] CXL 3.0 spec, 8.1.3 PCIe DVSEC for CXL Devices Co-developed-by: Terry Bowman Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Cc: "Oliver O'Halloran" Cc: Bjorn Helgaas Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-pci@vger.kernel.org Acked-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/pci/pcie/Kconfig | 12 +++++ drivers/pci/pcie/aer.c | 96 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 106 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/Kconfig b/drivers/pci/pcie/Kconfig index 228652a59f27..4f0e70fafe2d 100644 --- a/drivers/pci/pcie/Kconfig +++ b/drivers/pci/pcie/Kconfig @@ -49,6 +49,18 @@ config PCIEAER_INJECT gotten from: https://git.kernel.org/cgit/linux/kernel/git/gong.chen/aer-inject.git/ +config PCIEAER_CXL + bool "PCI Express CXL RAS support for Restricted Hosts (RCH)" + default y + depends on PCIEAER && CXL_PCI + help + Enables error handling of downstream ports of a CXL host + that is operating in RCD mode (Restricted CXL Host, RCH). + The downstream port reports AER errors to a given RCEC. + Errors are handled by the CXL memory device driver. + + If unsure, say Y. + # # PCI Express ECRC # diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index d3344fcf1f79..c354ca5e8f2b 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -946,14 +946,100 @@ static bool find_source_device(struct pci_dev *parent, return true; } +#ifdef CONFIG_PCIEAER_CXL + +static bool is_cxl_mem_dev(struct pci_dev *dev) +{ + /* + * The capability, status, and control fields in Device 0, + * Function 0 DVSEC control the CXL functionality of the + * entire device (CXL 3.0, 8.1.3). + */ + if (dev->devfn != PCI_DEVFN(0, 0)) + return false; + + /* + * CXL Memory Devices must have the 502h class code set (CXL + * 3.0, 8.1.12.1). + */ + if ((dev->class >> 8) != PCI_CLASS_MEMORY_CXL) + return false; + + return true; +} + +static bool cxl_error_is_native(struct pci_dev *dev) +{ + struct pci_host_bridge *host = pci_find_host_bridge(dev->bus); + + if (pcie_ports_native) + return true; + + return host->native_aer && host->native_cxl_error; +} + +static bool is_internal_error(struct aer_err_info *info) +{ + if (info->severity == AER_CORRECTABLE) + return info->status & PCI_ERR_COR_INTERNAL; + + return info->status & PCI_ERR_UNC_INTN; +} + +static int cxl_rch_handle_error_iter(struct pci_dev *dev, void *data) +{ + struct aer_err_info *info = (struct aer_err_info *)data; + const struct pci_error_handlers *err_handler; + + if (!is_cxl_mem_dev(dev) || !cxl_error_is_native(dev)) + return 0; + + /* protect dev->driver */ + device_lock(&dev->dev); + + err_handler = dev->driver ? dev->driver->err_handler : NULL; + if (!err_handler) + goto out; + + if (info->severity == AER_CORRECTABLE) { + if (err_handler->cor_error_detected) + err_handler->cor_error_detected(dev); + } else if (err_handler->error_detected) { + if (info->severity == AER_NONFATAL) + err_handler->error_detected(dev, pci_channel_io_normal); + else if (info->severity == AER_FATAL) + err_handler->error_detected(dev, pci_channel_io_frozen); + } +out: + device_unlock(&dev->dev); + return 0; +} + +static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) +{ + /* + * Internal errors of an RCEC indicate an AER error in an + * RCH's downstream port. Check and handle them in the CXL.mem + * device driver. + */ + if (pci_pcie_type(dev) == PCI_EXP_TYPE_RC_EC && + is_internal_error(info)) + pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); +} + +#else +static inline void cxl_rch_handle_error(struct pci_dev *dev, + struct aer_err_info *info) { } +#endif + /** - * handle_error_source - handle logging error into an event log + * pci_aer_handle_error - handle logging error into an event log * @dev: pointer to pci_dev data structure of error source device * @info: comprehensive error information * * Invoked when an error being detected by Root Port. */ -static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) +static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info) { int aer = dev->aer_cap; @@ -977,6 +1063,12 @@ static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) pcie_do_recovery(dev, pci_channel_io_normal, aer_root_reset); else if (info->severity == AER_FATAL) pcie_do_recovery(dev, pci_channel_io_frozen, aer_root_reset); +} + +static void handle_error_source(struct pci_dev *dev, struct aer_err_info *info) +{ + cxl_rch_handle_error(dev, info); + pci_aer_handle_error(dev, info); pci_dev_put(dev); } From patchwork Thu Aug 31 17:02:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371745 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 5CBA4C83F32 for ; Thu, 31 Aug 2023 17:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346852AbjHaRE2 (ORCPT ); Thu, 31 Aug 2023 13:04:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238283AbjHaRE1 (ORCPT ); Thu, 31 Aug 2023 13:04:27 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2076.outbound.protection.outlook.com [40.107.93.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48A24185; Thu, 31 Aug 2023 10:04:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fa3bjVYrMv6FFcX23/AZlUyV9OYkedZs52Jxz449F5oJNYA73A2XLvN8236u642OJMcXqXgSz/s3pqHtvDGY7j2z10a3RPVkZF2LhsGbZDD8qb7V5r2dW2I/ekyICkVBhmjch7F4/rFTq5eQi4RzOBmcvqguYEe4me8kCOGruIkDSILWW+KoLd1Qf0ZIMY375S7tSDJAIuuKa/ePGxugypC2Q9uFAZY1Vbjbo9ofhcPbK5B15upPy55G42FwaCMota/DPn7DzB1zIrIOWX6eeTbL57STMDQdgQIH+SEJpe/fLsu35NHKCE5d2qRzROHHGwOSYR3sFqAHRmhB4D7mKw== 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=omEvIhe6j83LbuOyZ/SUqwoTimOun3G14ApcXP+8OxY=; b=nNY539jmlHZFx4bQdjp6jYop/bya4a6vHYM6I6+RB4+iSeb8J+o9/+LXamqMTeoW5LJPd3QKiR5nll6bFjblH8ZFFy888Bf731Ptmk8VcjJxdxlw1ribBfP61ZWmmYa45kBl8kd5uoJd7VkgaCeUGAMDJBPs9Mrohi37lIlwg+Ro1IcA2BPhHKtDYxLF74I5VE+xAe0mnQncuRkHcPAgwTN0nzdl1P/8wDZm8HYJmouGKo0d5ICKgdHGIdGMdAhkaQFg/JYWek3yJZNqRjawmEV1Axw2me+F5pfhN8oNxZBoP+S7E8A+G4ifthEnp98aGtrSHg79TQwuiEZU7UOG0w== 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=omEvIhe6j83LbuOyZ/SUqwoTimOun3G14ApcXP+8OxY=; b=qIvLivNuWAu0YsqH3DMqpQdIX8GO+/eOmUHU8j+D9/8KHewlI2RT5u2eJhFE7SIXuInVc0VCeIesdE1nU3sk6L5W/SewXUTQ4zm8c7/Z2V0OkMrfhDR/EiX6dsXMkendE/aXEgmYtEUabU9iajo4Jl4XEtssAfQ2GXKTgh/h3zw= Received: from DM6PR13CA0009.namprd13.prod.outlook.com (2603:10b6:5:bc::22) by BN9PR12MB5324.namprd12.prod.outlook.com (2603:10b6:408:105::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Thu, 31 Aug 2023 17:04:07 +0000 Received: from CY4PEPF0000EE3B.namprd03.prod.outlook.com (2603:10b6:5:bc:cafe::d7) by DM6PR13CA0009.outlook.office365.com (2603:10b6:5:bc::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.14 via Frontend Transport; Thu, 31 Aug 2023 17: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 CY4PEPF0000EE3B.mail.protection.outlook.com (10.167.242.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.20 via Frontend Transport; Thu, 31 Aug 2023 17:04:06 +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; Thu, 31 Aug 2023 12:04:02 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v10 14/15] PCI/AER: Unmask RCEC internal errors to enable RCH downstream port error handling Date: Thu, 31 Aug 2023 12:02:47 -0500 Message-ID: <20230831170248.185078-7-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: CY4PEPF0000EE3B:EE_|BN9PR12MB5324:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fe746cc-f40d-4f4e-ac0a-08dbaa444932 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ZAE+79CzgqiHJZla8ChxgZjH7eRsk8AHQDLLiPq/7wJb92KxSjegvhPdr83FCdDCcd5SB8KNkQ6VGuMndUHmyTraKc5slgNdUXu9/RD1BmGhjFO0H1UINcTB/ogJLqegsctN3f1q2xyo4ub34SDvwGM8XzL49bz9ozgo4GF04YZw1etH2O5AXj/35ZT1g5CXoeRb2VUVuh1TtQRGWA8eqr0kwp35y4mWb0bRmpR+yBnFE2H6ccktC6rz0In1FXp1U5gRN/K/HsbbQPdTiGbqjVkKBMIO4kpmPnwcBNzZBRYGfkVZgLAUzkrRUkMQZsQCQ32mSDZ9TOnihC482VnrYFzTMZqzy++KGOaCwlfme5VK7YZcFFQRy/lwV/OMJ1E0Vxin4XDSWfv5u0KKwJ3+sDCay4bw5zbUy1P472Ep0v4b5S6kJEb4lZCGTwXTWI+z/oUs51IVaLTvJQIOOxBAG8ulvkVMxnNFmwmFat3UQQnNjEWqy5Wl/gKw5oKMFHaVUTnH8kJhYdd/Gley4NXCqCawfg48vOBGto3Z4ts44DRb28crKcZoGjrksgNYUBsEF+GZj+eqzNgcVdhJnGLvb8LuQgKv7SYFjp4J0pogZfTMJLvKGur20dxdtkQABHNuyqKis6wmZjUflLkD2sswrChzgwTGsVOj1AgEuXj/GYFCD+9S5+ntxXA0qtNs2/MsjYbRpUDMoKP8tPWwzv+7HXutBsca58eePehFuo9BwnaOwcxoasGYdXovlmhuGc+6WifjNDExf5OpfdvxObOl6g== 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)(1800799009)(82310400011)(186009)(451199024)(36840700001)(40470700004)(46966006)(478600001)(81166007)(356005)(83380400001)(82740400003)(26005)(16526019)(336012)(426003)(47076005)(36860700001)(2616005)(1076003)(40480700001)(7696005)(110136005)(6666004)(5660300002)(7416002)(8936002)(54906003)(40460700003)(36756003)(2906002)(44832011)(8676002)(316002)(41300700001)(4326008)(86362001)(70206006)(70586007)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:04:06.4519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0fe746cc-f40d-4f4e-ac0a-08dbaa444932 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: CY4PEPF0000EE3B.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5324 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Robert Richter AER corrected and uncorrectable internal errors (CIE/UIE) are masked in their corresponding mask registers per default once in power-up state. [1][2] Enable internal errors for RCECs to receive CXL downstream port errors of Restricted CXL Hosts (RCHs). [1] CXL 3.0 Spec, 12.2.1.1 - RCH Downstream Port Detected Errors [2] PCIe Base Spec r6.0, 7.8.4.3 Uncorrectable Error Mask Register, 7.8.4.6 Correctable Error Mask Register Co-developed-by: Terry Bowman Signed-off-by: Terry Bowman Signed-off-by: Robert Richter Acked-by: Bjorn Helgaas Reviewed-by: Jonathan Cameron Reviewed-by: Dave Jiang --- drivers/pci/pcie/aer.c | 57 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c index c354ca5e8f2b..916fbca95e53 100644 --- a/drivers/pci/pcie/aer.c +++ b/drivers/pci/pcie/aer.c @@ -948,6 +948,30 @@ static bool find_source_device(struct pci_dev *parent, #ifdef CONFIG_PCIEAER_CXL +/** + * pci_aer_unmask_internal_errors - unmask internal errors + * @dev: pointer to the pcie_dev data structure + * + * Unmasks internal errors in the Uncorrectable and Correctable Error + * Mask registers. + * + * Note: AER must be enabled and supported by the device which must be + * checked in advance, e.g. with pcie_aer_is_native(). + */ +static void pci_aer_unmask_internal_errors(struct pci_dev *dev) +{ + int aer = dev->aer_cap; + u32 mask; + + pci_read_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, &mask); + mask &= ~PCI_ERR_UNC_INTN; + pci_write_config_dword(dev, aer + PCI_ERR_UNCOR_MASK, mask); + + pci_read_config_dword(dev, aer + PCI_ERR_COR_MASK, &mask); + mask &= ~PCI_ERR_COR_INTERNAL; + pci_write_config_dword(dev, aer + PCI_ERR_COR_MASK, mask); +} + static bool is_cxl_mem_dev(struct pci_dev *dev) { /* @@ -1027,7 +1051,39 @@ static void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) pcie_walk_rcec(dev, cxl_rch_handle_error_iter, info); } +static int handles_cxl_error_iter(struct pci_dev *dev, void *data) +{ + bool *handles_cxl = data; + + if (!*handles_cxl) + *handles_cxl = is_cxl_mem_dev(dev) && cxl_error_is_native(dev); + + /* Non-zero terminates iteration */ + return *handles_cxl; +} + +static bool handles_cxl_errors(struct pci_dev *rcec) +{ + bool handles_cxl = false; + + if (pci_pcie_type(rcec) == PCI_EXP_TYPE_RC_EC && + pcie_aer_is_native(rcec)) + pcie_walk_rcec(rcec, handles_cxl_error_iter, &handles_cxl); + + return handles_cxl; +} + +static void cxl_rch_enable_rcec(struct pci_dev *rcec) +{ + if (!handles_cxl_errors(rcec)) + return; + + pci_aer_unmask_internal_errors(rcec); + pci_info(rcec, "CXL: Internal errors unmasked"); +} + #else +static inline void cxl_rch_enable_rcec(struct pci_dev *dev) { } static inline void cxl_rch_handle_error(struct pci_dev *dev, struct aer_err_info *info) { } #endif @@ -1428,6 +1484,7 @@ static int aer_probe(struct pcie_device *dev) return status; } + cxl_rch_enable_rcec(port); aer_enable_rootport(rpc); pci_info(port, "enabled with IRQ %d\n", dev->irq); return 0; From patchwork Thu Aug 31 17:02:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Bowman, Terry" X-Patchwork-Id: 13371746 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 E7006C83F35 for ; Thu, 31 Aug 2023 17:04:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346869AbjHaREa (ORCPT ); Thu, 31 Aug 2023 13:04:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346860AbjHaRE3 (ORCPT ); Thu, 31 Aug 2023 13:04:29 -0400 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2070.outbound.protection.outlook.com [40.107.220.70]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F20ACD6; Thu, 31 Aug 2023 10:04:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cNhCh9B8Idkd9UiB8MdwSMKBDPN+R9UpyCkJVf10l4w0VRgTCDw1t84DWbuhovj2sHAtM9G2LhnGaqgd0Gp8KtYP6DPIQsV2wITubdVw9t2AJmHMtoGDHpftv4aLu5Tz4AEzD9/ulKEHcYIxC1kwYjHrb2ICEv4Kvcmj89G5SwtxlIiwiBMxUrYpPCRsdw1RRXtzBMj62ElPg5cRlgDLcOLgYKBDRerNvWfJEKtuCM3lX/zA2Bg2x+GWrMHyq+IfuGvQUpVMUw98bIhGe3f7QaBS/X7F26sOeLSYTZ0OdRumAsZ7knmtyizOwyEEeNcvkjBMBZAwyldXbTUIVb6d4A== 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=NrvKsLLmcCbywLhMPwXf6Me1xobXx/KBZ7GQIIfi65U=; b=Gi6GsntDoJLuFC8QxnnzWDa1aIbbZ06gQTRa9qie16ze+rDAMtOQOGM+NJwq5gr3qvZDWC4L4owjRbdJKCoW8a0wH3RwStxg4Mv9NZSaER3KvHKCMG2Ujr5LD0NVzy/oQUhLYud6boUAXPPZwnGDG798t9aolQEnIOCf0Mh/u9Mlf2rpzl0bY4yGLc4w5fwvMO9XRtO7XLH5KGu4aqH3fRXjyV/wdDjM0GE3if1Re/sh9DiV2SR8mUf5Qidu31Xq5gei5xsqf0BhkrNswbo9F90qbQZyFRpCCsshqT1LXBA+mdWIb2N2UVm2xCUdV0GpLj6FSFvjl1n/jQHoYRFbJw== 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=NrvKsLLmcCbywLhMPwXf6Me1xobXx/KBZ7GQIIfi65U=; b=QBtCrikXaBu7BdW8tYPdi5YwanxXdgFcFlON+245kO+hnG7WVGV9EnsAnhS3iTxaM9kPmOimY7Rbx+L7yV27ccYNuq3VT1AF0E64GPiXsRJYqcaPobSV2WdkkbbBsnVPlDH1xwRKCKcR50ReAgDamQdP2HT4MfzcnVrjOKOBXnQ= Received: from PH8PR21CA0018.namprd21.prod.outlook.com (2603:10b6:510:2ce::8) by IA0PR12MB7507.namprd12.prod.outlook.com (2603:10b6:208:441::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6699.34; Thu, 31 Aug 2023 17:04:15 +0000 Received: from SA2PEPF000015C6.namprd03.prod.outlook.com (2603:10b6:510:2ce:cafe::e6) by PH8PR21CA0018.outlook.office365.com (2603:10b6:510:2ce::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6768.15 via Frontend Transport; Thu, 31 Aug 2023 17:04: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 SA2PEPF000015C6.mail.protection.outlook.com (10.167.241.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6745.17 via Frontend Transport; Thu, 31 Aug 2023 17:04:14 +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; Thu, 31 Aug 2023 12:04:13 -0500 From: Terry Bowman To: , , , , , , , CC: , , , Subject: [PATCH v10 15/15] cxl/core/regs: Rename phys_addr in cxl_map_component_regs() Date: Thu, 31 Aug 2023 12:02:48 -0500 Message-ID: <20230831170248.185078-8-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230831170248.185078-1-terry.bowman@amd.com> References: <20230831170248.185078-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: SA2PEPF000015C6:EE_|IA0PR12MB7507:EE_ X-MS-Office365-Filtering-Correlation-Id: 7ab71038-3508-4718-b7d6-08dbaa444e33 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yV8LAE3KWPMftisvgCakyMiGMQvgLdtDX9G1M3C+ZeaUoQhlB4wAbag8yOBdf371+F7Rr+j/yCSkpYL1ykN+KdhydwcFHdJOuKZXfuzBOIOHQWqpVoGPrG6aMy9ObwAuOTl9u4Jf57gt0M861xSXfHU3jTPl2KUlcDKl1zvttf3oX8NJfKBZKLbDYhT60Fpthji2UcFAoMInpLMmWQwjOt8JvISRel9bhQSSjZ/icvTklMWPddFMwKm5dVQ08IRDJuN+qO35NOCx6AXIMPxylE0E6cwSyoziunh6/HbWbBaPLEW/64jhRGSVh3kCHjaACq8IRe4jw6q1syc9Z3pFT1wWovkk8dk71Jfl44XdCJZAIFIvhTEM3Xo5a5p84B1X/cJrHqmPzyBJ0yvkjNUUJtvojfTY1kbu3RLSA0XZiDAj+P8VGthnPR0jCKqd5XnHs38GVBU4G+RSBqayAVlQMXQ/jTcX0TIgyCS9SiA4Tw250B9D+JvKRkeZYJhh3DjCETfPBvJ52/22pVhsPULuNa62igXErud5058UL/rEJMyLFHf/28KyOvtNWjWYI6PzcWr8vbHrtkmWDCSKxSJkhWv104wVpu1bGGo1LKG+vfs+u/p/vOzAT9ANBI4StHNjz92L6c2aSOX8GCCihmWBJyEzTAr008Pdk5UB8NbD2l0lvMkzVc77yfPC/8J15KleQT0Lldel1d7migSwscWLnz4t9C3e9SYhpMScAi5bWXpv+QpPuxK/2/CyHFTIJwH+RHCVtXMD5FXdaf9s8ECn1A== 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)(136003)(346002)(376002)(186009)(1800799009)(451199024)(82310400011)(40470700004)(46966006)(36840700001)(8936002)(6666004)(82740400003)(7696005)(47076005)(36756003)(40480700001)(86362001)(81166007)(356005)(36860700001)(40460700003)(2616005)(26005)(70206006)(336012)(426003)(5660300002)(16526019)(478600001)(1076003)(70586007)(110136005)(2906002)(41300700001)(4326008)(83380400001)(44832011)(7416002)(54906003)(316002)(8676002)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2023 17:04:14.8942 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7ab71038-3508-4718-b7d6-08dbaa444e33 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: SA2PEPF000015C6.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB7507 Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org From: Robert Richter Trivial change that renames variable phys_addr in cxl_map_component_regs() to shorten its length to keep the 80 char size limit for the line and also for consistency between the different paths. Signed-off-by: Robert Richter Signed-off-by: Terry Bowman Reviewed-by: Dave Jiang Reviewed-by: Jonathan Cameron --- drivers/cxl/core/regs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/cxl/core/regs.c b/drivers/cxl/core/regs.c index 5cb78b76c757..f8f26fe80489 100644 --- a/drivers/cxl/core/regs.c +++ b/drivers/cxl/core/regs.c @@ -217,16 +217,16 @@ int cxl_map_component_regs(const struct cxl_register_map *map, for (i = 0; i < ARRAY_SIZE(mapinfo); i++) { struct mapinfo *mi = &mapinfo[i]; - resource_size_t phys_addr; + resource_size_t addr; resource_size_t length; if (!mi->rmap->valid) continue; if (!test_bit(mi->rmap->id, &map_mask)) continue; - phys_addr = map->resource + mi->rmap->offset; + addr = map->resource + mi->rmap->offset; length = mi->rmap->size; - *(mi->addr) = devm_cxl_iomap_block(dev, phys_addr, length); + *(mi->addr) = devm_cxl_iomap_block(dev, addr, length); if (!*(mi->addr)) return -ENOMEM; }