Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp23007536rwd; Fri, 30 Jun 2023 16:23:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlFE6y+CEwtZiPefjwnhBMivqmr9FZxhgj2jAdER4u95bN/0VccipPCSjzztcSspWwYec7J0 X-Received: by 2002:a17:903:2009:b0:1b6:972f:9dfb with SMTP id s9-20020a170903200900b001b6972f9dfbmr3452193pla.3.1688167416927; Fri, 30 Jun 2023 16:23:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688167416; cv=pass; d=google.com; s=arc-20160816; b=O+pQrWn/Pa/4T0BHbjVkZ96LucInmx/GWCQrK2BIhdVZcsuJj5rf14iXAPYNcQOa59 Q7ukVD0yrATsHvBh0LFpDcRJCvUFoorj6TmiEK9oFE1nnyfX6e/aQCrM4ml4yrEPr96j bzS27jJbv95CrM6hQ3YS+7RrbNK787x1CotgE7cIFMjAzqR7709ygPbfRaxanyXB34Nq 9nJ0jZ+91ckOIyumh68TfxXw+pQqJOqA6pv061OfvIFBKAp/cHlhvEU9QR3H3VpUkrHW AOHCzIIuCdh+24jPvs7XXFcSkrY9k+FB7CPeYIdwmCvQSuW1z+DT8Ylch1GfDYWfqDDM oCWQ== 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=btQEIKahGA+dVKNXsDbpcedjVIVjE9vkFI70RgFbKSs=; fh=Nka2zNXjBTGCGeVc5dvjv8E535Bqs2Y/Ti0O2ky3xE4=; b=F/IScXu0MZXwqYwzWoHnKDFclLyAXmcTv4GS7RdqhU26MiSFvGT8TaqT4HqJ2Dc8OW Cc8KW7fyOnNMYGOeTwgPPnx8kVZEanavey43tYRKZXSeZRm2NZVxISk2GdPhx8/iU/pz JJP4WS17MhldZqxn0OelIqXPzP6XeWI8UDjTRaLYRLl9Lu1nipKUapAcAzDU0R9uMWdu cgZ4hwa9y+uE7tvGTuLwU53QVbvry4BoGoq0no2X5gS72pPyOXrGXA1+YjldreOXxupg MTVEHBp2apBu2G1+Fa6WgJ901AevKUm64yh0SLX3xAFlg6FEzeg78aTkQyGkDB23twWM EeNw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=BO6lS2lt; 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 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l10-20020a170903120a00b001b1bf4c8688si13934478plh.231.2023.06.30.16.23.24; Fri, 30 Jun 2023 16:23:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=BO6lS2lt; 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 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232686AbjF3XT1 (ORCPT + 99 others); Fri, 30 Jun 2023 19:19:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232614AbjF3XTK (ORCPT ); Fri, 30 Jun 2023 19:19:10 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2067.outbound.protection.outlook.com [40.107.94.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45C1B3C05; Fri, 30 Jun 2023 16:18:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=PVR4lZePBeBaPmWo0zMdG46jpRw3EpQbAPCSNDG4tz9AZeMKVlCV3dyYbWGcdGUzgh3XoBMOl+5wLdu1qdqGrLKuwCqmSOf2u4lpJ4t/JkiA4eB/3eWiIpXYV/6mJkKnQ0d05uNDkx42/FSuL+G0zemW0YD0Oyo1UQhjdbferKHHrx9e0JRKz4GhkRwDHRUVj+TaBprtIlra7qV44/IZW2T0gPLGoka+zyb/CTB5u6tWyizzZE8AbLAhenqpvVnRCwP+HOfaokDPP+se/FmCPBYZSbXBmumv8rdmMU302v/gZjIMuB9nGa5iLFqW5OAxIBo5na0RpEjwWSV9g8MDXQ== 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=btQEIKahGA+dVKNXsDbpcedjVIVjE9vkFI70RgFbKSs=; b=iFTE6xoPEPUeG1As8NJAZIC28f7OmVB8ylH15DY0182Zi6CFcWgFRolDSn/uchh07j45kzY8ZvbReChB8qpSH0VvYjihXq878IKa4hiuvzXKbRTiYd/s7z+/7jkrZdiTWYx7edslT7CGSsPEdqNIemMI7TfDW2mT2WcsRu/iuSWTthn51nj92iZW3cxK9Azm3s3P1DjkErwSJ0RHy99rbAvixjWOg22eCQnZUxY1GZIDVuoI9YVAEwIw+Lm0cUDZrpgNhLI+I53twarT9y9Np90aae2pkkKtFx9SND/I7F0NXR5rAx7iTMbbYb8g+O39G8l8VNmHANyHYNidHuVfWw== 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=btQEIKahGA+dVKNXsDbpcedjVIVjE9vkFI70RgFbKSs=; b=BO6lS2ltZQ9nTKHXZMRsm85OwSiIRlt0n3zt4xRmf4vw5SWHEDvu2fU8ZWrPg+XdbjaykLsUzHtb4ewtD2mWzwBYus7VumEJqbTPZDmobBTYd1FEwrY6hYQCn7J378zT2/yAivo5QF6C4hfDdSWIUxLJBiBdpCEBSAS5NfaFDos= Received: from DS7PR03CA0306.namprd03.prod.outlook.com (2603:10b6:8:2b::14) by DM4PR12MB8570.namprd12.prod.outlook.com (2603:10b6:8:18b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.19; Fri, 30 Jun 2023 23:18:07 +0000 Received: from DM6NAM11FT025.eop-nam11.prod.protection.outlook.com (2603:10b6:8:2b:cafe::dd) by DS7PR03CA0306.outlook.office365.com (2603:10b6:8:2b::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6544.22 via Frontend Transport; Fri, 30 Jun 2023 23:18:07 +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 DM6NAM11FT025.mail.protection.outlook.com (10.13.172.197) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.6500.51 via Frontend Transport; Fri, 30 Jun 2023 23:18:07 +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.23; Fri, 30 Jun 2023 18:18:06 -0500 From: Terry Bowman To: , , , , , , , CC: , , , , Mahesh J Salgaonkar , Oliver O'Halloran , Subject: [PATCH v8 07/14] PCI/AER: Refactor cper_print_aer() for use by CXL driver module Date: Fri, 30 Jun 2023 18:16:28 -0500 Message-ID: <20230630231635.3132638-8-terry.bowman@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230630231635.3132638-1-terry.bowman@amd.com> References: <20230630231635.3132638-1-terry.bowman@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6NAM11FT025:EE_|DM4PR12MB8570:EE_ X-MS-Office365-Filtering-Correlation-Id: 4e0953f5-a83a-4936-dc43-08db79c04337 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 30O+BS0AhrJI7cQRRmP5+G86AXNLewn2+d8ODwNp7MuuqBPbtP3qblZ8Km+TG/1tyTaIK1e2RqllWJMsyppNYsqktCbthTbj1LLlWVuIcEWjct2UKRGxPoEjBu68H5VtIO4iQhEzHu0UAdcjH4lH7q4LM64o/A8iRS80NRixN/E/Wg/c6OqWi04nS5Q3qle3bnGCaS4JRW633cASRdrIWpXUsarlOKMzDDznlNEGbqm7ykWXMHEvkEOcZI1hGPBc8gTshJf44/Go5Ybz54R2cxCJC8QbwYykRAG2TylRZpMotN47ZF+mWtE2EU4cg0gm/Eci+hLk4l8YZEEaq3yWFts4yIdeo6+qJDxn1s0PNTuehhRe8GWm99+QMih++1uChE4bq9UA7snwzPA5gc6BHONY9djuBpK9EknJjAK+35QeBgJ8P2O0yKW+gakVznbDksFtUQwcizHO1VcjdFtX8EhzEl2VT6X89s3VCn4i1Dc2j+pnq6gNGvXYpNcqwBihHGZ73pm9WYV3yZ+OsU5hiC6DfzxDxbl6QveN/qmWePWZgan0ltExSzrRJu4XCP0OL8pOq3iSSOdDQN0jfsGYAi9V/Q/i0rmE/qj5MoSKYGln9OTSLpmp+f2f6HgsQzCPHOTXHQt+hTMDzuyf6rvengRJb1Ef17ho6/ncCoXrDKCr4p31Gw7bpDodSJjpS4xm7WK0qXvBbxXnsTUXEwhasFtqlmjoAKUBPto6qB2UEVoqT2Q+81G+phmU8Ky4ck/g5paLHp0jwLEnDEBFWppPDQ== 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:(13230028)(4636009)(39860400002)(376002)(136003)(396003)(346002)(451199021)(40470700004)(46966006)(36840700001)(5660300002)(8936002)(8676002)(7416002)(44832011)(70586007)(70206006)(4326008)(2906002)(316002)(41300700001)(54906003)(110136005)(478600001)(36860700001)(47076005)(40460700003)(6666004)(7696005)(40480700001)(1076003)(336012)(426003)(83380400001)(36756003)(2616005)(26005)(16526019)(186003)(81166007)(356005)(82740400003)(82310400005)(86362001)(36900700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2023 23:18:07.0692 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4e0953f5-a83a-4936-dc43-08db79c04337 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: DM6NAM11FT025.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB8570 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,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, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 8dd9a44e8a7d..f3bb7ea37b44 100644 --- a/drivers/cxl/core/port.c +++ b/drivers/cxl/core/port.c @@ -2062,3 +2062,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, -- 2.34.1