From patchwork Thu Oct 13 18:18:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 2297 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp428232wrs; Thu, 13 Oct 2022 11:51:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5oZhvR4MwWMpdrdD0KQw0VPv4LswZPYvGf5ugl3/1Cun5PoFSpDvVnC3fRYO/8l65SfpAc X-Received: by 2002:a17:902:e5ca:b0:183:88dd:1d34 with SMTP id u10-20020a170902e5ca00b0018388dd1d34mr1108530plf.134.1665687083832; Thu, 13 Oct 2022 11:51:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665687083; cv=pass; d=google.com; s=arc-20160816; b=0LqiLAyWUJb5QlcwJBx/aetRJhYb/1HpZaPLAJYt5+w6S/YLUMEwQWECYOAiB/xFSM KO6e5nW7a6LD2WI2SdTA9uYo80OrfkEJ9ixROuGTKEqm0aFabnNREkKeURlPz8F2J1LF bByNmFab6+KNL1nqExfhhq3CyB9+RYWsBFYYYn0QJ3uz5pcZAh5eBVewWK4D/neDR1TB aGCeA5x+mxNZnUN3M60KEL9xHp7XNr15Dg2xScUntVIsyAHPypR+R4K3fXriKUdKeyDB tWYrmE8h5J5P/PPuOVRkt2YjSdmB9vO/B4MCz0QFUMd7o31saEpImzGVpo5+7lfYKPzu +NbA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=S3cy18Z3zPwKeR82/S2tMeEOQVTTzj1T9s1HDYRLS5g=; b=qNYgPk/9fTI6DvoGXnkqXBIZr7fdgUEpAiV1rLv7YviWIY4ffWkqyRptMsPX5ZqLyS Y8HqoJi+uNSkmN0tnhQazuxUM7Vc0HKghs7CD1joWXTkAIygy3ijvYb/OoxElc00V97v B5SAwTfCGnXOooh0gD9Sp51RGixFQ91MRT15VZ5X8dJFtlVjxw/W1Egt5X67XfqRsSUC dqtPR5JTm6jFTCMMhr9fYKelaB9yIcw1uNZFdFxp5l2mXG8K1pqr2Y/x7ceCZrjtI91P aTtCtRqXrDVDtkBZAR/E2r75PAujoeICA6+CqZfZeSl3jn+ESnGk9sw9dNXsVU2fZZTm bigg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=hOdUDO1V; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q32-20020a17090a4fa300b00202c7f4631esi6474683pjh.19.2022.10.13.11.51.11; Thu, 13 Oct 2022 11:51:23 -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=@Nvidia.com header.s=selector2 header.b=hOdUDO1V; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231947AbiJMSak (ORCPT + 99 others); Thu, 13 Oct 2022 14:30:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbiJMSaA (ORCPT ); Thu, 13 Oct 2022 14:30:00 -0400 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2061f.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe59::61f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0AE03182C78; Thu, 13 Oct 2022 11:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UF4abMpEEpJm3oc2xaX/CkOcuPFNXitfphtL4b0XTjqWawFbL/UfwW3puQD/uCFMCHApFKe6RXkKQH/DGTImouwRaPdRjtN+7mh85rPx7eojZUMB9L+iEQ3hyuv09F/bmzQH2oHEYiNAIl2Aa54ZQMyJ82XVH17M0jMMbnZ+J3/u0fLbBu5L2EN0gwZAByq7iy4XQ2vmoO0M/Qwlc9KPCz5FDcL/HN4QMZ725Q6krbEX0G/Ejc/k1RUD0EUb5ca9vH4ecPDARiDNtfQk2SKAT35fEzdTzLNcZ5xr59EmnH4AZbcKXQ6jTogp0r8/zVVQkjM4E0iJaOGdqGHd/uNy3A== 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=S3cy18Z3zPwKeR82/S2tMeEOQVTTzj1T9s1HDYRLS5g=; b=eC9ST6jx8qkMqnTOPN332cPFlK3atWcSX122ukVDTvpTWshb8eca3G/yruQKdyVnVkC+tr/cWFCZCEkc80mtUbXJxvmRLXzpdv2MrlFh6IXeXQSze2VY9r4QzF0RwH3fYQ52Fg1OoRwMFxZUoSxCcxi9WW6o+4dwlnFWKOmmjuZbrOqfL817MkDbrImSkdFf502xe+QrLBenRizVLo5Y4O5K0m2jjyJNvER7ODGS9FxcJHdvkXGyeG46scAp4KDZxF8Bsgvykw3eaiTv2efopsO8WCQD8SiBjqIfYE+zkUVq9ZF3gH89zR55EaOnmQgcLye+NTwSKUq0og2ju1AB7A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=S3cy18Z3zPwKeR82/S2tMeEOQVTTzj1T9s1HDYRLS5g=; b=hOdUDO1VLeaqAykWwCcq9e2GzAzinu5ZHk0JR+dNE/I4bDKlSQW/Jd+JJ8BMY9FAc+8UFdHX1ynGkNv7Tk24SOWaG3B540XBdERx7BNFxQKB/YeknYNg6BvpUyAQFy0FlAEghjtxQ+QRdkvTKorY//zg9LgL/qSaDVKurvERHdUuTMFbbfTkaYFh0OUHiGmRk3W5pFzskLIVTPJreYN94oDMWZNipWHtOOeBHCywq7ZKHxrx+MPP5xla1vuMTlUQL/FVtDVQhO0C5cR/aAbBojybmyEex3njsgLxQErAFnNZP0ESbQV2uiH6Lv/1Z/qQ5jCgyl8NbebVGXZ9CoL8Mw== Received: from MN2PR20CA0032.namprd20.prod.outlook.com (2603:10b6:208:e8::45) by SJ0PR12MB5662.namprd12.prod.outlook.com (2603:10b6:a03:429::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.22; Thu, 13 Oct 2022 18:18:48 +0000 Received: from BL02EPF0000C408.namprd05.prod.outlook.com (2603:10b6:208:e8:cafe::e1) by MN2PR20CA0032.outlook.office365.com (2603:10b6:208:e8::45) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.22 via Frontend Transport; Thu, 13 Oct 2022 18:18:47 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF0000C408.mail.protection.outlook.com (10.167.241.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Thu, 13 Oct 2022 18:18:47 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 13 Oct 2022 11:18:27 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 13 Oct 2022 11:18:27 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Thu, 13 Oct 2022 11:18:23 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V2 1/4] PCI: endpoint: Add core_deinit() callback support Date: Thu, 13 Oct 2022 23:48:12 +0530 Message-ID: <20221013181815.2133-2-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221013181815.2133-1-vidyas@nvidia.com> References: <20221013181815.2133-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0000C408:EE_|SJ0PR12MB5662:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f80a3fe-7389-45c7-b950-08daad475f03 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: xyfLdC1ghsCjwj2KttnmouswCn7SIO0rxAV3BQU75eEa+nbPgt8dKxv22FRPSgyJysE8JU4i8shTxhtUiUlD/FTYQnE0cn8in3gT0vOvnxzs7fp8m5D+9oAmmn1DyhNXZUqnk0LcMoqkOpHqcrEKfdgbVlyhD9fo3d0jCy+LNPHmsNYoqvJqiIUb1blz8Ga7M76DZbfy87CXRutJr1EgqewMyVSM2SQo11/G4AJTIZOqJ+F7CXQsI3Ly8IM00I52DLF8J7fodWdZXpzqv0LZ1IZe0P9GVrD50xY6ljj0uEraWXDeor1FFZdh1C8MYYZ0Qb6BhzVqgI+HdJHdtNre9DYSMWyLWp/33Dk6T4flMnVdN8JkxAY5RlhMgW0srQOe9qLqSJmT6KK8N6Tl030jfYOE7K85ezIan0h7Y5UyKm88ByOzcquh4TRVS/HqaWYa+E/DYDaS8M7XvheMuCQOJyu5Y8GvRRIWhR8HhQjx+oAE7TpPqof3XH1F9xDyz/vk4czlV7ePqbON52HiaxJBeW1Ff6EmzhPbB/KxVWevzJNxk0YJDjItQux5lM/3cJSHV5gb7QW9SQAkWgVlPq/fBFa1yRd8fst7B+p9kApg0MhO1E8Lor3hphD8TkAft5i6lEIwwnrAswEqAUlSLpDRt11C4wqkIOnEkPupTUtjSylkBQOBvvkvAY7OLld9Vww03d2/E1aCP4dMb84r/IxIZoiyfHPGpZIOU1lsTAUvIJ1IoJ/WwCXU/j2vEdtxFtqDP4Ni/WIQNWKTbmTPm59lyg== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(136003)(376002)(396003)(346002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(7696005)(26005)(70206006)(70586007)(82740400003)(8676002)(5660300002)(41300700001)(36756003)(54906003)(316002)(110136005)(86362001)(6666004)(4326008)(40460700003)(7636003)(47076005)(40480700001)(186003)(426003)(2616005)(36860700001)(83380400001)(1076003)(356005)(336012)(82310400005)(8936002)(7416002)(2906002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2022 18:18:47.2365 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f80a3fe-7389-45c7-b950-08daad475f03 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0000C408.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR12MB5662 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746599499689518119?= X-GMAIL-MSGID: =?utf-8?q?1746599499689518119?= The endpoint function driver should undo the things done in core_init() and stop hardware access before deinitializing the controller. Add core_deinit() callback support for function driver to do this cleanup. This core_deinit() callback should be invoked by the controller driver before deinitializing the controller. Signed-off-by: Vidya Sagar --- V2: * Reworded the commit message drivers/pci/endpoint/pci-epc-core.c | 26 ++++++++++++++++++++++++++ include/linux/pci-epc.h | 1 + include/linux/pci-epf.h | 2 ++ 3 files changed, 29 insertions(+) diff --git a/drivers/pci/endpoint/pci-epc-core.c b/drivers/pci/endpoint/pci-epc-core.c index 5dac1496cf16..689450f01f75 100644 --- a/drivers/pci/endpoint/pci-epc-core.c +++ b/drivers/pci/endpoint/pci-epc-core.c @@ -732,6 +732,32 @@ void pci_epc_init_notify(struct pci_epc *epc) } EXPORT_SYMBOL_GPL(pci_epc_init_notify); +/** + * pci_epc_deinit_notify() - Notify the EPF device that EPC device's core + * deinitialization is scheduled. + * @epc: the EPC device whose core deinitialization is scheduled + * + * Invoke to Notify the EPF device that the EPC device's deinitialization + * is scheduled. + */ +void pci_epc_deinit_notify(struct pci_epc *epc) +{ + struct pci_epf *epf; + + if (!epc || IS_ERR(epc)) + return; + + mutex_lock(&epc->list_lock); + list_for_each_entry(epf, &epc->pci_epf, list) { + mutex_lock(&epf->lock); + if (epf->event_ops->core_deinit) + epf->event_ops->core_deinit(epf); + mutex_unlock(&epf->lock); + } + mutex_unlock(&epc->list_lock); +} +EXPORT_SYMBOL_GPL(pci_epc_deinit_notify); + /** * pci_epc_destroy() - destroy the EPC device * @epc: the EPC device that has to be destroyed diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h index 301bb0e53707..b95dc4b3e302 100644 --- a/include/linux/pci-epc.h +++ b/include/linux/pci-epc.h @@ -204,6 +204,7 @@ int pci_epc_add_epf(struct pci_epc *epc, struct pci_epf *epf, enum pci_epc_interface_type type); void pci_epc_linkup(struct pci_epc *epc); void pci_epc_init_notify(struct pci_epc *epc); +void pci_epc_deinit_notify(struct pci_epc *epc); void pci_epc_remove_epf(struct pci_epc *epc, struct pci_epf *epf, enum pci_epc_interface_type type); int pci_epc_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no, diff --git a/include/linux/pci-epf.h b/include/linux/pci-epf.h index a215dc8ce693..fa51579951db 100644 --- a/include/linux/pci-epf.h +++ b/include/linux/pci-epf.h @@ -70,10 +70,12 @@ struct pci_epf_ops { /** * struct pci_epf_event_ops - Callbacks for capturing the EPC events * @core_init: Callback for the EPC initialization complete event + * @core_deinit: Callback for the EPC deinitialization schedule event * @link_up: Callback for the EPC link up event */ struct pci_epc_event_ops { int (*core_init)(struct pci_epf *epf); + int (*core_deinit)(struct pci_epf *epf); int (*link_up)(struct pci_epf *epf); }; From patchwork Thu Oct 13 18:18:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 2293 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp426577wrs; Thu, 13 Oct 2022 11:47:03 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4j1OTfloIAZbe9ihF0jKLvTwQJlhEVSiVCm4Rdtl/+dN65Q52gCsBBHdOYYQAKyrAVgcn1 X-Received: by 2002:aa7:9407:0:b0:563:3fdc:8af4 with SMTP id x7-20020aa79407000000b005633fdc8af4mr1065057pfo.57.1665686823461; Thu, 13 Oct 2022 11:47:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665686823; cv=pass; d=google.com; s=arc-20160816; b=BJ9+7qyZ0BhAhGY26N5UpovwVJPmHs+GqMlroecisudra9XM27XS4qu3RnT0wrMSOw JvMIRE4Eqr36d2tR4UDyDcdpmlaoKM2z7jrv/G2kj5nTnFuFQeYs76j6DqmeD2jTlsmu nSH6S/A5dSNsUaSuaOh7p7ePo+G4x7JUJukKdfhGp8Og5Frc2N1/HTlXGrb58GSC4xPV +6sHJbuo3xH6iNZXvQHDdlhSSI4ZJ9GvdmYkfpRXTz6UJHazHsFHAJjOu9ztxZ6L8DgE QAVvqyEOaohMv7YVkaEI67KaVPP0UeTqoeptKAju2xPSVIsbn4MW8E8uw3vruLo4DF2B BNcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=EsA4uQ01EdG+ilnai4rK6DBD0JGZanSoznoK5UreRrY=; b=HqwwIdaqU//DcCku/JL3cOBtpdGcUC0VntoHhU1kVGO+2nk9MpVev1/ap0bUItlTvM jSaDuzXG40uHgAyjB55FZ8iU+MxKRe0DvRpSAAZRou/Ma0/5/EGVyVTDH79IitQ6Qoc0 Gk7E9LpXGUtoH4XihBQy/jzC8xjgkFQnzW8f3ewFgJAfNrLDYMoPGjhOz7Bm7Zl9t8qS wRW+kYD6Uo4y8oYQ6hcoSFCKgHKhiHPC55PuvHcUreiQvaP9QE5wgNVUfjhRmEAP4dKJ /xT5w9SHMr2i4X4EBjVHMcDT0lOL3LjSBfZaeog6u7hW4EDnCalbhhaNJgY+lcCZg6Pk F+dA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=BF2C3Qmo; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 38-20020a631466000000b0045af77fa685si169570pgu.235.2022.10.13.11.46.51; Thu, 13 Oct 2022 11:47:03 -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=@Nvidia.com header.s=selector2 header.b=BF2C3Qmo; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229608AbiJMSac (ORCPT + 99 others); Thu, 13 Oct 2022 14:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231390AbiJMS3z (ORCPT ); Thu, 13 Oct 2022 14:29:55 -0400 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20600.outbound.protection.outlook.com [IPv6:2a01:111:f400:7eae::600]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 052875F7D; Thu, 13 Oct 2022 11:25:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C0pNJ6HQflBerQqdtcPn9y8XOZrVvvoO647FTQHzehOeiTJVRv0+21HKbxxECRmmDm0YJ+2aRKxZaHYSiYz8mLvBB47e0odlXCxETPZQMedZZpl9fkca0+Dp3wGDOGuTintvALJ7GLCT6s35PT1ufye4PNpmQ75eoQyDES5xhuurKOOzy8rd+YNwjlDaoYBlt2Tcha8GeH7OW6b6a+bMgjtoIUQ3gvXMxWOfgxaYtR8+6nNomCWp+koJrZWnWGRnWrTHYeCzwpRkAhEFV+mepPfbD53sDiVWmx9kOs/hES55WacKYT6yuMd1al5tfzJ0iDwJvMHVWtnj9DGH6Vayyw== 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=EsA4uQ01EdG+ilnai4rK6DBD0JGZanSoznoK5UreRrY=; b=AONtkKEkg+un6kxYtN6XMDGmZVCBnHghKrhGquZ6+rseWIVMkAzWwoWxRA1z7hqZEUCMQVvhUucb3mgemnX4MxWXQhdOPteDwRtEpAx0m6mlJ7I/OVM199Uzl4GMPefSUN+yFXxCPtQr2XWCiRE63CDrbU9H0+pjbKydMDggdgAicYU1G5ApmRGtg6cEnzFD+PZutsTlZ31zYDNbT5IBDtQhuAr+giwDq1r/FHOJC/L934A//efqbuTo7d+WGuaCvPVFZ01jqJ/brxdZAQbVuHGntIGUMNjar0lGLQ7B7Jebg9Kfj/uJFWM1nvv8f4ysBcU+IHlVtcxdxxm9xXHryg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EsA4uQ01EdG+ilnai4rK6DBD0JGZanSoznoK5UreRrY=; b=BF2C3Qmol6z6Z2gv3IuWdogdykD94wiJ2/Ol8ax0v8E73qGJykafzqTf04BhoMA3GTpVxv+oMBQV7GthBEL6BTj/pfHOhgz2aeDLAbdWiRX0S5h3DSCf+goCs+zhrpJKQU09R/e2suelY7+szEI33NKoQh9Mj9ZgaOsxTJRYJ2e9nbihL+iasHlZ+2Tq76Qy3oatlVIdGna0YrdM6H6zbO/3gjHPZUNbRreccFrVHrjdLtrQHQ6HqS9sN9uIhMH3p9vwI0VzwFCitYIcvVCv7EtJZbQ0KNx0I7gy/wY9gDKlcyXVtC4Yt0W6XOJoQ0vgEY3z5XIuEYlVYnoOqvp/+Q== Received: from MN2PR17CA0029.namprd17.prod.outlook.com (2603:10b6:208:15e::42) by PH7PR12MB5832.namprd12.prod.outlook.com (2603:10b6:510:1d7::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.21; Thu, 13 Oct 2022 18:18:52 +0000 Received: from BL02EPF0000C402.namprd05.prod.outlook.com (2603:10b6:208:15e:cafe::91) by MN2PR17CA0029.outlook.office365.com (2603:10b6:208:15e::42) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26 via Frontend Transport; Thu, 13 Oct 2022 18:18:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by BL02EPF0000C402.mail.protection.outlook.com (10.167.241.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Thu, 13 Oct 2022 18:18:51 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 13 Oct 2022 11:18:33 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 13 Oct 2022 11:18:33 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Thu, 13 Oct 2022 11:18:29 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V2 2/4] PCI: dwc: Add a DWC wrapper to pci_epc_deinit_notify() Date: Thu, 13 Oct 2022 23:48:13 +0530 Message-ID: <20221013181815.2133-3-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221013181815.2133-1-vidyas@nvidia.com> References: <20221013181815.2133-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0000C402:EE_|PH7PR12MB5832:EE_ X-MS-Office365-Filtering-Correlation-Id: 9f97d747-93e6-4f22-6b45-08daad47616b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: kuaNDDcFR0Q8CfqSyaSevcpOIoaJboFc7/FFs2JPBRtnvETkAaqwqCBJCQ6+C8ZSfY2/7FjK1FUTcA5o1z5ax/Ud+LCjt9A50XgFwnKDBaIyu7VDoRdkjUuRtKSZXAUzYgq3oeKvyAoTu9bmtyXrfkkj3x5O0m29EwyQiWhRnbHC58YKhVlDiD0Vrf6r2+zSr/ZhX2bY/VmYmbqAGZ0g7dOZMjCf6/52XRS6yY92rpF8NjjuDEey1RS/BV/HRRPUflaeY7XCNNOljQx19Y85rbrn6fwqcZkwWf0/t8aiJv6o+HplPOmOOYJbTskzk7jEWEocyUnbWK/YCzt/zqVg6X8YMvJNP9kAT6NoYU3VZxTTSMqzkC0FUxtfW0clzXGi1MrO7x6YRDqvsXnnG2WuNq+jktZTv761DElAqblczGbPDyRxuM5PC7yT4tAsWLS1CPPRLBrGOyTFJeOMRTBguPpEAytUKppvWyJWcs6aAl8iRIT8SOWiLi9Sntk5ugaG4S56ZhCumVeY6S7qK0J7CLG9Z/TQSC87FLdDSLRyOoSGJtrPUDGmYeH2HZ5figbd0QFSkzftwKZlQt3iQdbc5TEgNRLhScgdc0y20gzaNb2OxKG12dqnT76DvAF2ev8hT2fh97GquYV6Emwfm8df7g+NE8ORXEDS8ArGjRgRXgponiXI5zbe7+CP17//vFWOVEzxpA/qxO6TbDGD+bAPbSwxtM5vnciwBBGB1mXjekjKFI+U/lVrPEoidKIolHVBlZ3JNJcEztbiTUPXZ8ZKCg== X-Forefront-Antispam-Report: CIP:216.228.117.161;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge2.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(39860400002)(346002)(136003)(376002)(396003)(451199015)(46966006)(40470700004)(36840700001)(2616005)(1076003)(186003)(426003)(336012)(7416002)(47076005)(356005)(82740400003)(41300700001)(36860700001)(5660300002)(8936002)(2906002)(4326008)(7636003)(40480700001)(110136005)(40460700003)(8676002)(26005)(7696005)(316002)(82310400005)(478600001)(6666004)(54906003)(70206006)(70586007)(83380400001)(36756003)(86362001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2022 18:18:51.2715 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9f97d747-93e6-4f22-6b45-08daad47616b X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.161];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0000C402.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB5832 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746599226732285546?= X-GMAIL-MSGID: =?utf-8?q?1746599226732285546?= Add a wrapper for the pci_epc_deinit_notify() at the DWC layer for all the DesignWare based platform controller drivers to invoke during their respective endpoint controllers deinitialization. Signed-off-by: Vidya Sagar --- V2: * Reworded the commit message drivers/pci/controller/dwc/pcie-designware-ep.c | 8 ++++++++ drivers/pci/controller/dwc/pcie-designware.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c index f300ea2f7bf7..fd11c2e68fef 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -737,6 +737,14 @@ int dw_pcie_ep_init_notify(struct dw_pcie_ep *ep) } EXPORT_SYMBOL_GPL(dw_pcie_ep_init_notify); +void dw_pcie_ep_deinit_notify(struct dw_pcie_ep *ep) +{ + struct pci_epc *epc = ep->epc; + + pci_epc_deinit_notify(epc); +} +EXPORT_SYMBOL_GPL(dw_pcie_ep_deinit_notify); + int dw_pcie_ep_init(struct dw_pcie_ep *ep) { int ret; diff --git a/drivers/pci/controller/dwc/pcie-designware.h b/drivers/pci/controller/dwc/pcie-designware.h index 7252513956b7..0f3ab39c5281 100644 --- a/drivers/pci/controller/dwc/pcie-designware.h +++ b/drivers/pci/controller/dwc/pcie-designware.h @@ -469,6 +469,7 @@ static inline void __iomem *dw_pcie_own_conf_map_bus(struct pci_bus *bus, void dw_pcie_ep_linkup(struct dw_pcie_ep *ep); int dw_pcie_ep_init(struct dw_pcie_ep *ep); int dw_pcie_ep_init_notify(struct dw_pcie_ep *ep); +void dw_pcie_ep_deinit_notify(struct dw_pcie_ep *ep); void dw_pcie_ep_exit(struct dw_pcie_ep *ep); int dw_pcie_ep_raise_legacy_irq(struct dw_pcie_ep *ep, u8 func_no); int dw_pcie_ep_raise_msi_irq(struct dw_pcie_ep *ep, u8 func_no, @@ -495,6 +496,10 @@ static inline int dw_pcie_ep_init_notify(struct dw_pcie_ep *ep) return 0; } +static inline void dw_pcie_ep_deinit_notify(struct dw_pcie_ep *ep) +{ +} + static inline void dw_pcie_ep_exit(struct dw_pcie_ep *ep) { } From patchwork Thu Oct 13 18:18:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 2281 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp424726wrs; Thu, 13 Oct 2022 11:42:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7tbgvkoX/KiPjvSnCiGIMaXTR0zWIVCWXA8fR2l9wT8srU7vQ+y+GmSQjRsV1N8zJsiZtd X-Received: by 2002:a17:90b:4ac5:b0:20d:ae54:f08b with SMTP id mh5-20020a17090b4ac500b0020dae54f08bmr2997043pjb.174.1665686529905; Thu, 13 Oct 2022 11:42:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665686529; cv=pass; d=google.com; s=arc-20160816; b=ImuAMkUE1Xl1kNK4Ix8KmJSoBlRYkuwvFGqUN6uCa2KF+cT3D7DT+hCilPYqU4pCql M+ZMgxZGu0cBVY15DjTkN/m/QMl6G+kU73txU5fUVAjHf0qchST6BcbnCy1OK9w5Gpsy A1M5hnoVUt0JGbfvL0eo83a5vJzVNSY+AiuCatybbP99WIdeUbqNNi+sg6kN2xJ1ZOpL RAbMybdyqlcUMF8awC/uAQGNTbrtik7WNXzfQjmkViQwzN6ToyfoJZcD7Ud6bk0qpyTp fDySc+1fm0t3E4DMsXb8vuswdYDxyYVypkMYQk6SAPiiZZfliZ+zaUeyiYBf7DVWb/Wu DS1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=5feri6YkamJmIEH1jzL6zd6yHlJlKpI7WApsvrqNihA=; b=wX7OQXoNTX4i9L3UsM7IXk05+VWmRpK23pIJjTX5Gg3haTZHZGjBKFJkr7bzW+xk+e w0fGlHhIwXI3+F5kVV2zFbEZar4tsCdGRT7Ogo4PE5ocBiDf6nxCWC2pb+esdu5/R9g6 2uzMfjZ3o0WqTa0hBjbcVkewp4uc9wHGhScmkTl6LJm5X02bqliYbp3rT57BHw/Vi2Rp 5K4V5YvNzVWfSN2t+cK6rZXmS1M2vEOTpVWr9XkVJKAJ2W6KFuj7gSypIxpn9TF/kyds ZDqN+NjwzBQxZV4r+Ev/uxrf7oE/c90AFknBnMmYwKRKjld3zsTXWK1+1VmmPs5jZPUl VLuw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=uQNhdGJA; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me8-20020a17090b17c800b001fd6e58cd98si3594651pjb.123.2022.10.13.11.41.57; Thu, 13 Oct 2022 11:42:09 -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=@Nvidia.com header.s=selector2 header.b=uQNhdGJA; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231920AbiJMS06 (ORCPT + 99 others); Thu, 13 Oct 2022 14:26:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiJMS0h (ORCPT ); Thu, 13 Oct 2022 14:26:37 -0400 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2061e.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e88::61e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA75E1911E7; Thu, 13 Oct 2022 11:22:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oCG+/zRb29oxa8O83NxK4QeyXEhFBnGFrLwXCIMn8+Bvf6ugsOoJ9fclFVGuesNYegK07AQuRWzBpW2bathwL7eKBckS5Yv9APAYb/cmGybdGrv5IaGD/r4CFZySNZVxnUdy+ZzFmE4eCyJN5EGtgK4mWMUIeTSdUhtJ2vWe1evxHnGGqSKAm4TZFj1jjwu6XpBRj3ggvlmOuVYTZd5A58+RUbIueXpebEmT2gBZTFxnMHASZlvLB9nSuT1u1C5Nrl3yEiP4EPecKZTaZmfcbULjLK8OpPfl3Vh6HlkHS9J6qLmbSi/JzNd/kjmR5K6C5FW/Y5obYiR1D5GIMhNIHw== 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=5feri6YkamJmIEH1jzL6zd6yHlJlKpI7WApsvrqNihA=; b=ge21OhL0H1sPuYbYmkdbBxQD7uFnnFwBzmfmecqaRiBMvkka08WYM3jcYwjNUbJp1GWct+cbQfKu9VE+SPtKZYtFf/ed6XjpE6gQUIZ2Gkh9libRzjjIEPTHKzl+2dOoOsuGcjxRkwZ8XQsHZ3tLM6Wvaf7isQRWDRIylh2W8lhP2kKLBNDUO6IC2hh4JkRigiBrx+Dd6k7TwMu+sKCe/zWMNSlMNPQZAf0DQEiz6YzS1Xm9u4fWjarGjFdEbgNIcxj2i+C7swrfM8NEy79ZHRkClnLcN4RSmnlEW+dnfqX9KDw6QK169CNjzAMeTDVJ3MMB5NlJeHFpbopsSdCwQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5feri6YkamJmIEH1jzL6zd6yHlJlKpI7WApsvrqNihA=; b=uQNhdGJAf20tdL6P6+u7pSpMWA/PoSQOl1kOslVsyJgJctPttKdGVpropjwvCb234Y2iF8Wd/AqXx1uUZAxLHVnK2o5ZAThmAw6QWQqMwWWaDo1+cwVpBYBplJMh0YqauTIatUnXXCM2Dx9KPpEr7Mbjqfei9MBJOiqupq4lLmyjFLiLYe1qAZi8t6rFGrXK7B1Y8xxgZn2zWh/3LDuwPPc0sIP9xjNEnOKbGS2eJyOtwOVtc3BIHURHka+Ln+bfDckZLHmYVQVLfytOhUCYW1UNgrDomXVLW2PC5fLaO+lw5dVcAwZgpHXyEjohmlr/kPSEgweIcvcPLve0SvFRTQ== Received: from BN9PR03CA0410.namprd03.prod.outlook.com (2603:10b6:408:111::25) by PH8PR12MB6770.namprd12.prod.outlook.com (2603:10b6:510:1c5::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.22; Thu, 13 Oct 2022 18:18:55 +0000 Received: from BN8NAM11FT075.eop-nam11.prod.protection.outlook.com (2603:10b6:408:111:cafe::33) by BN9PR03CA0410.outlook.office365.com (2603:10b6:408:111::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26 via Frontend Transport; Thu, 13 Oct 2022 18:18:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT075.mail.protection.outlook.com (10.13.176.208) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20 via Frontend Transport; Thu, 13 Oct 2022 18:18:54 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 13 Oct 2022 11:18:39 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 13 Oct 2022 11:18:38 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Thu, 13 Oct 2022 11:18:34 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V2 3/4] PCI: endpoint: Delete list entry before freeing Date: Thu, 13 Oct 2022 23:48:14 +0530 Message-ID: <20221013181815.2133-4-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221013181815.2133-1-vidyas@nvidia.com> References: <20221013181815.2133-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT075:EE_|PH8PR12MB6770:EE_ X-MS-Office365-Filtering-Correlation-Id: 2eade0b4-9761-4f96-eda1-08daad476351 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jB9YtQLgNpirn3xF45mL/axsRelsk+NXgCORsLowHaGGnDngLl791WQkFhh1lA3zBKAx7SBH7TmHG1/8yBkYR8349pvwaqoCbyeeGRt3awGPDZxIrEu1DKkOxFLEFCPEdOJ/Mu3SxAJLRbzRnyqN8HvTYqSukRUflueQsdIeO5MEy/ChhAktivAJUPzDZPhPawB/zSMCUKCIrS5dsosm9bNlNfglv4b7JsfpjdIL8KZpKtFJNJr3T0DHOOu6lfmYkrLR5Gso7rLL5FLgled9pA6fhNVULbXxmLWh8pCUa7v+D/Wo+7R1Xt3WCx2eNCJ8ckmqM6+T8CPDszaG2sMWJf/wearBnqC4/pLCXrGoilQ+FTFMUE1GjFS6GP7Gon5Bxs7ZgIJS9efiYJcEwoRJ2yG+r701gk+En0wlsej6ldk0tJazlLwlr9O2pjOfUEGYpn7uiXBcKZvfcFJrCz+TigrcZlMT+sw9htcZVyCM5nQ/ENh3S5deWNgI/77d8Ham8Mz4Tlpi3CCIpAhKqM3A2hTPvNLidbjxZq7u26uYHXzKIz5sfAlMhWjmdYxzaTK2sFWCsh+8s6jv2K0JqTsw0rCBNVOymeL9rGLPAcSN9qaBjVfSjSJd9dR2VkC6rd3y6ivLa8zyY1SebCOUTQ9EuDEfksNp1TjTyEcEl56mAewxUDnWdfcnHhoLB/JyUJ1JuZOKqqiDh36ATfxyOjUN3Vg3tILr1TS8xhI69riisy2Uwr6xfLg66LSPtBCAr789ILdMqlC3Xt00fru9fAiAug== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(346002)(39860400002)(136003)(396003)(376002)(451199015)(46966006)(36840700001)(40470700004)(36756003)(36860700001)(356005)(82740400003)(5660300002)(2906002)(7416002)(336012)(186003)(1076003)(2616005)(83380400001)(86362001)(7636003)(47076005)(426003)(7696005)(41300700001)(8676002)(110136005)(316002)(6666004)(54906003)(70206006)(70586007)(4326008)(478600001)(40480700001)(82310400005)(26005)(8936002)(40460700003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2022 18:18:54.5068 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2eade0b4-9761-4f96-eda1-08daad476351 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT075.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6770 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746598918622009012?= X-GMAIL-MSGID: =?utf-8?q?1746598918622009012?= Currently, epf_group list is traversed, and each group entry is freed and epf_group list head is deleted in the end. Deleting the list head is corrupting the data in the group entries that are already freed, leading to random crashes. To fix this issue, delete each group entry and then free it, and don't delete epf_group list head. Signed-off-by: Vidya Sagar Reviewed-by: Manivannan Sadhasivam --- V2: * Reworded the commit message drivers/pci/endpoint/pci-epf-core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c index 9ed556936f48..a7f4ae33905d 100644 --- a/drivers/pci/endpoint/pci-epf-core.c +++ b/drivers/pci/endpoint/pci-epf-core.c @@ -340,9 +340,10 @@ static void pci_epf_remove_cfs(struct pci_epf_driver *driver) return; mutex_lock(&pci_epf_mutex); - list_for_each_entry_safe(group, tmp, &driver->epf_group, group_entry) + list_for_each_entry_safe(group, tmp, &driver->epf_group, group_entry) { + list_del(&group->group_entry); pci_ep_cfs_remove_epf_group(group); - list_del(&driver->epf_group); + } mutex_unlock(&pci_epf_mutex); } From patchwork Thu Oct 13 18:18:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 2291 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp426310wrs; Thu, 13 Oct 2022 11:46:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4cydIDlCsfGwyKQJAxUh9R69ZQTjDpukGwmyso8D2SBIizGaQRzb2fYqoDKDEJLazZ5Muc X-Received: by 2002:a17:906:d550:b0:78d:a6d4:c18f with SMTP id cr16-20020a170906d55000b0078da6d4c18fmr844869ejc.113.1665686782995; Thu, 13 Oct 2022 11:46:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665686782; cv=pass; d=google.com; s=arc-20160816; b=C1lYV31glVvMSnZnzs+qszWqfO45Jb2mfJtoBtLihIDmL7FxX9bCylHXeKSUKRo4Ek Qef9AFmbop7y+mPoCJS/REjVlLZQOgijY1IBEeQTgaAfnsfXPw9aNYDXXzrUbe665han dL6zd9Mid1FVYY+63WUrLiqiUKtzq9IWTcD7RiG/yDtwbBsOnHm4EDUxQDyxPGhKTyQ0 uFyXsuJ5hI/bNo0WapmFFHSRq5YJlFhJ3m3W7iOJbnZ0PPDKGCUEUT74A0iTqavbFYx+ V5whzFXFLQ9o/aSh7UTQFEgequln4GwPvSpzQQlLC2J9s80YMSrkYZoLjdZM7oCO6khk /3Nw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=s8RCBMImUbu57RwVzJxz+QL/TLIHkFPMcizQMJVRBo8=; b=VURvKWMjwmjcaOtkNU5qLKTYe4EkSD6uAR0mJ1GfqE36JNgZFgOCeJdrtC9S1N39QL lVU4fb0PWg/jh6TNEVGjGC2wviJ04e7NEIWN2z7HnQJnU19AegzxHTFEpYHjYdLcRdFC Xq7Qp/riqIMFDK+2R0Y88g/BJNbco+G+czP/rrkDKhOJh/+nLqu/pDDVNjvs2Z9J68vM 9JLvCjLGM5GDsTU88Ta5gBc2pPRPCwhTqW2cX7s6G6Bag+1FjvIKYHl70K2rRO4ufJ6A 9RHpqrZegn93auX5iZxUWYUwOch+yEuO1WI68yDHsdSNxjhfAYZgOaFN4QuOz9j3NE6F X+Jw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=ZeKGLJKg; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gs8-20020a1709072d0800b007825337afeesi489114ejc.273.2022.10.13.11.45.55; Thu, 13 Oct 2022 11:46:22 -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=@Nvidia.com header.s=selector2 header.b=ZeKGLJKg; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.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=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbiJMS0G (ORCPT + 99 others); Thu, 13 Oct 2022 14:26:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55340 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231933AbiJMSZf (ORCPT ); Thu, 13 Oct 2022 14:25:35 -0400 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on20622.outbound.protection.outlook.com [IPv6:2a01:111:f400:7e89::622]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6B22BC60D; Thu, 13 Oct 2022 11:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fN167mHGzTILW1AqvNq+/pYk4rGckIW0DsjtFZFhGFyDtT7GjwCyBzlXaM2z0+HfObn7h6IOO/DNg2M0CqSob929Hq1GUOpAUbUFG1MasvcaiuG851iFPuKMmlGN6seGkaNELirH1aQCq31xT4zbhIJKILvK7ERPW6Vu+GFiPVgc4vRNxeSoveXq3zyoglCQaHgfZz/zWH87N33QTV7w38Y/mwy/zjDnz5+NWCu3faba9VVhgTKsgkwHjQt6XNh8e4NHldenju6qapDbtjn7b11KlnBKfAiOz27nyQpSYNmOrHaLqhahYio3DYngW1OVXaTm9r3a0gyZN6dlNc3MfA== 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=s8RCBMImUbu57RwVzJxz+QL/TLIHkFPMcizQMJVRBo8=; b=RFD5/lwVUsER+2o3CNwYLKgph0hz6YQcsVut/eX6yG/5sA4oph76bSAPEp2MIpMcTHiC0V6QLZOjTMB8v6ktS7ElnISjBZWBCFC+DVjNY0vp7v/mU6tguaG2I7aLfIrQ5S7LAErMnl4nl5Us9NEZRujCzRXRbhwqSUAUOvaDPE8Z70Kz9ru5ZananRXpsSJ5RyabqcyUxLvlvfytrJn5B2JYjY6N7fNxYawinv88Q5MVJUVLXxsDXXuAHrxcVpw8CwUhdyEeoe9o1uTZHeJQadgtb0R6KuBhy0M6Z/gSbE9BnInyAnj+STeVA6tvpYl5A9L4smduPazF8nFsEPHySA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.160) smtp.rcpttodomain=gmail.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s8RCBMImUbu57RwVzJxz+QL/TLIHkFPMcizQMJVRBo8=; b=ZeKGLJKgZM9Vw8PkK9AdEUO0fmyY0wd9K5yaPEuHLnOzmHO7pvjLnNcWJi0fQwMy2ym+berS1BHHVNy0zXz9dH/SLc0jGE9zvNMd9Vn1aNFoP5hrjX77I5h25vr6ZN2cSM29iS4/E2pDYQ5ULejIfs6tN0B/Ml6Dbd9ya11H4y6iARteDm3W52PrnuICCopC6mwpX+qgg47ln562Hx9Oe0zz2fFP71gCVvQTrRiirbzO8/zBUdzRfkO0OZeTHHYr+xWbr2RitKP1lRg3tM49tXbG0iFiJZG3Qhc+uDIVL2aIG81g1A1SZfm9qbj7guqd5jE2VfIkumrQ8N5i3ZRhwQ== Received: from BN9P223CA0006.NAMP223.PROD.OUTLOOK.COM (2603:10b6:408:10b::11) by DS7PR12MB6094.namprd12.prod.outlook.com (2603:10b6:8:9d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.22; Thu, 13 Oct 2022 18:18:56 +0000 Received: from BN8NAM11FT067.eop-nam11.prod.protection.outlook.com (2603:10b6:408:10b:cafe::30) by BN9P223CA0006.outlook.office365.com (2603:10b6:408:10b::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.26 via Frontend Transport; Thu, 13 Oct 2022 18:18:56 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.160) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.160 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.160; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.160) by BN8NAM11FT067.mail.protection.outlook.com (10.13.177.159) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5723.20 via Frontend Transport; Thu, 13 Oct 2022 18:18:56 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) by mail.nvidia.com (10.129.200.66) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.26; Thu, 13 Oct 2022 11:18:45 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail202.nvidia.com (10.129.68.7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Thu, 13 Oct 2022 11:18:44 -0700 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.129.68.10) with Microsoft SMTP Server id 15.2.986.29 via Frontend Transport; Thu, 13 Oct 2022 11:18:40 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V2 4/4] PCI: endpoint: Add deinit in epf test driver Date: Thu, 13 Oct 2022 23:48:15 +0530 Message-ID: <20221013181815.2133-5-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221013181815.2133-1-vidyas@nvidia.com> References: <20221013181815.2133-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8NAM11FT067:EE_|DS7PR12MB6094:EE_ X-MS-Office365-Filtering-Correlation-Id: aff33bd5-fcb5-40ee-e84a-08daad476488 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: dY+keJHieQEgB7A31rw5JS2Fq8JeL7GxvhEh4pciiAPMLfa44qbMUDP7JcCo1jy0UKVHwHewwY8ib8aDdvPtCpAR5+yrrlEiIV7SpB1xkpyNEZ4K6jwl82AJxhJBrf1jpT8ldjPxeT2WmmUFko1DD5AJNP8gu23lueMJ4OClPr/d35DdSSfNc1tVZqGDGjiees6oy9TiThwC3Pzr1JLP7o+F0sLB5VYv0zZgRQOjbTLeADpUqWiqp9B3Pmm5KQsUtLjLjEX7X5wOb5H0A2IMYwj/R66Ub38k6gVQr7oE4AFjoLm5baDmVFOEdy5QtOSgcepj11vfOpQ19uH0ba5dGJYEsJVRWI6PLl3v+LFKeLPBbY8qeIRTgxzrPywwFzHsXMq8V9mOBFzuJ9r/CYRN9w9iaqxWwQHbcGErqlQ9DV7Ovctxnoj6B5JNQOZOoWWrvE9fzb07uVcfGraLw66s98AKXf0fUyElk02cQP7BckiGnSDafo4+20uyqAXztXCJayfm7o2gWnvOTTE2wcvB03Q905Hn/GjbAtSGW4L3BbPP5Ogw+xuXHJ+KslZpFFvxlYV6W6YPtYAGbtlotikbiVDMduV+7MxLbo3dlYEZP99qIsbEKJhWaFJ1wPspVNxb2UBhi8Wo164w7cWZtwPD5miDUuF70EslR3s3TR3HnAuN2b67LG7976YqoULU7eRPvML0qpKr/GgnmYtUkVBS6BM6i1mDIxaZXrIk9CkGMPdPiU1pDTqrhpyHV8lCAq5XGy0xWVCHkR+5dNCCrg5d8g== X-Forefront-Antispam-Report: CIP:216.228.117.160;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc6edge1.nvidia.com;CAT:NONE;SFS:(13230022)(4636009)(376002)(396003)(346002)(136003)(39860400002)(451199015)(36840700001)(40470700004)(46966006)(478600001)(86362001)(36860700001)(54906003)(8936002)(47076005)(40480700001)(110136005)(316002)(426003)(82740400003)(70586007)(70206006)(82310400005)(40460700003)(41300700001)(356005)(36756003)(336012)(7696005)(186003)(7636003)(7416002)(1076003)(26005)(2906002)(2616005)(6666004)(8676002)(4326008)(5660300002);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Oct 2022 18:18:56.5136 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: aff33bd5-fcb5-40ee-e84a-08daad476488 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.117.160];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: BN8NAM11FT067.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB6094 X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, SPF_HELO_PASS,SPF_NONE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746599184252113428?= X-GMAIL-MSGID: =?utf-8?q?1746599184252113428?= Add support for clearing the BAR info during the deinitialization phase of the epf test driver. Signed-off-by: Vidya Sagar --- V2: * This is a new patch in this series drivers/pci/endpoint/functions/pci-epf-test.c | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c index 136470019a24..25ac3d161fac 100644 --- a/drivers/pci/endpoint/functions/pci-epf-test.c +++ b/drivers/pci/endpoint/functions/pci-epf-test.c @@ -826,6 +826,35 @@ static int pci_epf_test_core_init(struct pci_epf *epf) return 0; } +static int pci_epf_test_clear_bar(struct pci_epf *epf) +{ + int bar, add; + struct pci_epf_bar *epf_bar; + struct pci_epc *epc = epf->epc; + struct pci_epf_test *epf_test = epf_get_drvdata(epf); + const struct pci_epc_features *epc_features; + + epc_features = epf_test->epc_features; + + for (bar = 0; bar < PCI_STD_NUM_BARS; bar += add) { + epf_bar = &epf->bar[bar]; + add = (epf_bar->flags & PCI_BASE_ADDRESS_MEM_TYPE_64) ? 2 : 1; + + if (!!(epc_features->reserved_bar & (1 << bar))) + continue; + + pci_epc_clear_bar(epc, epf->func_no, epf->vfunc_no, epf_bar); + } + + return 0; +} + +static int pci_epf_test_core_deinit(struct pci_epf *epf) +{ + pci_epf_test_clear_bar(epf); + return 0; +} + int pci_epf_test_link_up(struct pci_epf *epf) { struct pci_epf_test *epf_test = epf_get_drvdata(epf); @@ -839,6 +868,7 @@ int pci_epf_test_link_up(struct pci_epf *epf) static const struct pci_epc_event_ops pci_epf_test_event_ops = { .core_init = pci_epf_test_core_init, .link_up = pci_epf_test_link_up, + .core_deinit = pci_epf_test_core_deinit, }; static int pci_epf_test_alloc_space(struct pci_epf *epf)