From patchwork Mon Oct 10 11:19:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13002485 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 9C56DC433F5 for ; Mon, 10 Oct 2022 11:20:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230253AbiJJLUd (ORCPT ); Mon, 10 Oct 2022 07:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231891AbiJJLU0 (ORCPT ); Mon, 10 Oct 2022 07:20:26 -0400 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2085.outbound.protection.outlook.com [40.107.102.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2F46B3ED57; Mon, 10 Oct 2022 04:20:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UBZLJADoWpX/fnmb6Q4BSSX5U8eaLuU033/HRnlT3uRiaS/RUlPSoW+7Kf1yiGLMRnX8p76cRhuYy2ZFn3UKFhmVCM3r6Cd8VlckieBv5rGs2ko8LMn+IAmqacbgh06YZWjz/9EzSQYlkl8nZgCI7KS2792etExoFiUaPnBa/2r85hKCMwUVSkqmyk5AA3MPUg0jZmkN+BbZkd0qMWsKjuej8H91kKsnt+du+o1qGRnaxRFgNWLL9jpQoLJZsM0wceAplBgd8Lq02qItUmL89y8ifmzU4d7QZqvXuZy+tscby5xvIjHnoomV4fLtdchxvAktpSED+zVCH7cBy4RgkQ== 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=0PKYm2+RokvDB36j+UmQZlu+NVHYjm6RltJ0EJ+ndJA=; b=cFnWHV+P/ZZ9nr04jvg+6GFbyUrKLVf/luTLay+BWYOfRFCZt0iQJuUo2YPW2/Hn42vKPSMimo3lccdRN9AaXpVaoFwv+14g8t/g0wjAkcmt0U1oOnBeHQyaKYN5kfP+ePlB+Mhw7o+0yXcffXcpNEqoHJKLwwrEB9dhEkibW6Fp4HgyaHhNIu4XnZ29brBoR48WXQu+jc8XOcxJ6FayslobEpTGaK9BsYRLjR8FDNxPW/b/9yr1/8dqhsaUTYy72fieCyOf+rJ3f+9EAxAQmnm8k3wzFr0+GrW7NmHedXgHiJmXhbuCtTKt8nXFVkkXvICYQSCViDqZuQ+F6YG7Vg== 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=0PKYm2+RokvDB36j+UmQZlu+NVHYjm6RltJ0EJ+ndJA=; b=h0Ds+EtMFbKA7a55/7am90/yTHX2+1AjHHRosH9YTUfxRW7r8tiEqp26JqdHgEZjd5HyVIqBW1VerMYbNrpPn7F7C+j0UIR8QNM9imlTppJLBttQ/vUG6PGDab/RYNlHzlaBsLCnNvrKyMIYpuIWf6PVlBP78Jrfpqt3SrFw07MUZA7WKKJTx7ZzdMCcrsHpP9hNlMs1Yt40IFD94BXHgPIQDnee6BBTy0xzYDf5X6LwbiELHQTcEIdIsnSKHFAUFRbdUkqiC/D3WqM/9eftuDJvBbj3K2mIiEVUOuwJBR4uv64wiFd9ght37o2PTRBdFea1UAFm8b1X0IYLRqMh8w== Received: from CY5PR03CA0015.namprd03.prod.outlook.com (2603:10b6:930:8::43) by PH7PR12MB7114.namprd12.prod.outlook.com (2603:10b6:510:1ed::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.30; Mon, 10 Oct 2022 11:20:22 +0000 Received: from CY4PEPF0000B8ED.namprd05.prod.outlook.com (2603:10b6:930:8:cafe::39) by CY5PR03CA0015.outlook.office365.com (2603:10b6:930:8::43) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Mon, 10 Oct 2022 11:20:22 +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 CY4PEPF0000B8ED.mail.protection.outlook.com (10.167.241.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.17 via Frontend Transport; Mon, 10 Oct 2022 11:20:22 +0000 Received: from rnnvmail202.nvidia.com (10.129.68.7) 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; Mon, 10 Oct 2022 04:20:05 -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; Mon, 10 Oct 2022 04:20:05 -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; Mon, 10 Oct 2022 04:20:01 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V1 1/3] PCI: endpoint: Add CORE_DEINIT callback support Date: Mon, 10 Oct 2022 16:49:51 +0530 Message-ID: <20221010111953.5422-2-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221010111953.5422-1-vidyas@nvidia.com> References: <20221010111953.5422-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PEPF0000B8ED:EE_|PH7PR12MB7114:EE_ X-MS-Office365-Filtering-Correlation-Id: b67f5d4f-fcf2-47de-bc4e-08daaab16c12 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 7HHs+INUe3Enek6VwxDHmxkXYdl8cXio5y6swCzKAWRZTKkDuAUEr4l8kNqCKc2g/a0lD4YdnYQypSP1iJvVoHbMc6ePfkaD2ofPxEduTeHi0A+8zYr72Hm9nNUbVjurmNXbxILuuaDauaijBZxkXiU/H4OmvJUOiZL12D8fWOTRyc6EBx4hFYCH+EVYFCvD0W7yanP4ZqcEUnlArheuNUbVSl3AvcpYgnf/rTETk6lfTpoo/AqhZ6udbtkTK75khjmblgdtaytRJ3c6ip6soRv9sY8vCDTEXbjpPslr8mDhoEIIiNxdyyCR4Ov5sRnUeQHJ8THsU3iNE5GCGpmzDOx49du9NJBFsxYv9bt0CJfdXTHar5M6FQelVu3MaZV3Jsi+ias4MspCLGxIw102tWSdQG/TZoC/dk6MbR2lGr2zliSvkq22kG3PdSUtEjAT985qBkRsXtMJ6SdNQzNuLTFOC7LQJdrVgGRutq0IU0tqzd38j4FxlXJCsA4YemX02EjhesKZmYjptjGonnozgTkXsUqqYxO88zuR4D8yRNxBIra5vmJ6LUu/ExEV8jQjSqbZ3YE72uK1Ri6dNX2GDXtTUAR4YCrr3pYDXi9sC3NEtOReXnjxMOIZ6MXyWSwrYiAlSZnks9o67RNP4XBRkOWtIkKa5wKMN5hhZC14sznzDJaYbPRGjJchHfKehr9tQ3AJDdYyHPfV1XicM91fXz8h+KBsHgxHgAcnsnW/WN7h0qbBolUcv++CedivmM9VKisXe/g/mQakq+Xc546JDQ== 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)(396003)(376002)(346002)(39860400002)(136003)(451199015)(40470700004)(46966006)(36840700001)(7416002)(426003)(5660300002)(47076005)(41300700001)(2906002)(4326008)(316002)(336012)(6666004)(356005)(82740400003)(7636003)(70206006)(40460700003)(54906003)(40480700001)(110136005)(26005)(7696005)(8676002)(70586007)(478600001)(83380400001)(8936002)(86362001)(82310400005)(186003)(36860700001)(36756003)(2616005)(1076003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 11:20:22.3727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b67f5d4f-fcf2-47de-bc4e-08daaab16c12 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: CY4PEPF0000B8ED.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB7114 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Function driver needs to clean up the hardware resources and stop all the running processes accessing the hardware during the endpoint controller deinitialization. Add core_deinit() callback support for the endpoint function driver to do the same. Signed-off-by: Vidya Sagar --- 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 Mon Oct 10 11:19:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13002486 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 ADAC0C433FE for ; Mon, 10 Oct 2022 11:20:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232073AbiJJLUe (ORCPT ); Mon, 10 Oct 2022 07:20:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232077AbiJJLU3 (ORCPT ); Mon, 10 Oct 2022 07:20:29 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2073.outbound.protection.outlook.com [40.107.92.73]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1350B4B0D1; Mon, 10 Oct 2022 04:20:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OXnTY4jkluqP0cYwLmtQlFRFKZfZ92KY+BtChzTtTKw/wqlgFV7nige3xLbgfIm+k9/u4Kjfe4JxwjKj/G6wgz+3uvHAyIX7NDBrKfWNbRmDFof+Yd5n2gThPE49AmeP/vWmxUSzMET7IkXTDUgIJAPDup9cXX4z+8IbaGPhhbQQ5dwzewWXsdO+MwvfwgtOfFJj968wnB7IHlyrG33xhxaaFiQuzw+GK4pZ5J79NmVYjtTSaKuH0nDObwWfq4Byh5Dsu1p7Jk7KNBoUMzz8rvv9FFNa3u3vH899goWkn1lohIsPR8eiNZ9SMZyHoAYnl6QycgfoU8yWBn81Pf8qNA== 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=DuVFhITOYzpkLWs84c5wgbEXOl2NbFeerQuf7zSu6Xo=; b=dxmFR+ggbLE6yOpzXhl1414Po5rR93jjwO1m8651U8HkOIaKPN5YWK/Eqsrf3KVZetmtwuJ9sjGc+DM0+TJlZMyPk1mPWcEMiX5Vq9nvMDChwnINOAe2DD1m+7oSXZvrMM9pEjno7svLsItvREs2kRnI/4YD8TqMLmp9wfTM7jiPKq8Js2qdUSFfbsFGYItQQ8/deebbgiBc1CQWxni8RPQENCg3B6ObrTgnpCy29fcDP7L6Yul3Vg3D1atgpu5pyVqG/fJZrJsuyHyZoA666ivREr8Fw1B7bwa7dzAapIx9O8zP+ap97sb4/kDd4OMBEeZZC0TCjWI8BAmUXAEVTQ== 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=DuVFhITOYzpkLWs84c5wgbEXOl2NbFeerQuf7zSu6Xo=; b=ZhK4mK7nBAU3YC+gH3qdHBbbVo0Pv9NSmFS7lFPuIE5E5NUPUp7YmmGKKifkT16H+QHbKqc33Kutwz9Fj4fqemSMjzJ+n0+imJbWNCoXUWaBRGqqRuaRJ0FqmaJ2wG/3x9iB6fiphgE2dxO2eFhqMZwpO/+pI6w2U0t8/wovdpxFGubEytFRglflwDgK745QeWM8T2dhyOsv22EctWtcLPHnHv/A3CN2T1WRpZKixVrTfspEND9xFROUXpDP2ITQUjGlu20FBgWwW9pNMW/1BdBAPrunkvJiLgkz4jpCAqt4+ryU2v3PW0LOFy6qsmBiPBeC1U9wubsGzGcL2dOk/g== Received: from MW4PR02CA0026.namprd02.prod.outlook.com (2603:10b6:303:16d::25) by IA1PR12MB6385.namprd12.prod.outlook.com (2603:10b6:208:38b::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5676.32; Mon, 10 Oct 2022 11:20:24 +0000 Received: from CO1NAM11FT100.eop-nam11.prod.protection.outlook.com (2603:10b6:303:16d:cafe::e6) by MW4PR02CA0026.outlook.office365.com (2603:10b6:303:16d::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Mon, 10 Oct 2022 11:20:23 +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 CO1NAM11FT100.mail.protection.outlook.com (10.13.175.133) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.10 via Frontend Transport; Mon, 10 Oct 2022 11:20:23 +0000 Received: from rnnvmail205.nvidia.com (10.129.68.10) 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; Mon, 10 Oct 2022 04:20:11 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail205.nvidia.com (10.129.68.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Mon, 10 Oct 2022 04:20:11 -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; Mon, 10 Oct 2022 04:20:07 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V1 2/3] PCIe: dwc: Add a DWC wrapper to pci_epc_deinit_notify() Date: Mon, 10 Oct 2022 16:49:52 +0530 Message-ID: <20221010111953.5422-3-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221010111953.5422-1-vidyas@nvidia.com> References: <20221010111953.5422-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT100:EE_|IA1PR12MB6385:EE_ X-MS-Office365-Filtering-Correlation-Id: 239f6153-f2e6-4a04-ae2e-08daaab16cdc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: N7dJXJmzbrGsd+lEZE9pINIdgCNC7SLibUlo/HXgrAjCgWfmEM0aHhkOau0CVc+b5jgZ19/8JraKsByF/OnquUc7WUJ78jJ6e8J4yV3OCd8lzC0gxiXJDe0ibtimxS36JIc52G4D/BRpNE4+MPW38STmKFnU5v7hmE3njSPqfykL9rgZ/bmFygae01cGdj89YOaXiN5JNLMKwhOuXbqIJMGxyFYgRv9U0jZPoRzrtVisrw0sItnUeD+3nx5zw5m75kbf/jVWVhUvVg0M1QjE51vziuRVznkbUyWGCWoimDIaMZirZv+NUG0hEWvj+xlPv2eNqKZx6yU283+amv38S7Urx0sSFM8nxFZY4O5Ui6cMe7kzpUNmT/Mr84WXdpR5nlO6JeRYxyPWJd2V4bz5k6oajaXEmfWXWf1q3Hh0swbhZlHlhhHqsv/OBysYGMY8YwStxGM8DDPmDO8ezFFbvmlcGu8Zi9eTlzY18jY8bFGkVneyANF8tepJBf7MRQGDSBU5s0LCZOMzAS8k/XfNOkWyqkBH6otlNPJirWhENBpE4hCyXN6aJX0KKPns/FvmqWK9lz7JbqKCxxlCTbymqhb3Egb6c7EYJjTJ18x+Xkq86egkaa30pGyYnYbT2zR2pyJK7VVXAr/rH7601BcKVPz2nWBLUXnabblDCQvgJsbdVFgsBVmlP+Tx9zQ5Xgn8nsVMvnvAcVIMz+Vn9rAWwFaMoGs6ikP4G4VgB8avERgOJQDnrJWZIuUJwapcfe9VgKdNCnsMsSE9hhPgV1Dajw== 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)(136003)(376002)(396003)(39860400002)(346002)(451199015)(46966006)(40470700004)(36840700001)(47076005)(356005)(316002)(478600001)(82740400003)(6666004)(40480700001)(7696005)(26005)(426003)(186003)(336012)(40460700003)(36756003)(1076003)(5660300002)(2616005)(8936002)(7416002)(41300700001)(54906003)(2906002)(70206006)(82310400005)(110136005)(7636003)(8676002)(86362001)(36860700001)(4326008)(70586007);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 11:20:23.7744 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 239f6153-f2e6-4a04-ae2e-08daaab16cdc 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: CO1NAM11FT100.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB6385 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Add a wrapper for the pci_epc_deinit_notify() at the DWC layer for all DWC host controller drivers to invoke during the endpoint controller deinitilization. Signed-off-by: Vidya Sagar --- 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 297d8b306ab8..d39ccb9ca7d0 100644 --- a/drivers/pci/controller/dwc/pcie-designware-ep.c +++ b/drivers/pci/controller/dwc/pcie-designware-ep.c @@ -742,6 +742,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 b00bee4b782c..f948b73e8c6f 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_deinit(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); @@ -496,6 +497,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_deinit(struct dw_pcie_ep *ep) { } From patchwork Mon Oct 10 11:19:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vidya Sagar X-Patchwork-Id: 13002487 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 77AFBC433FE for ; Mon, 10 Oct 2022 11:21:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231621AbiJJLVF (ORCPT ); Mon, 10 Oct 2022 07:21:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231891AbiJJLVE (ORCPT ); Mon, 10 Oct 2022 07:21:04 -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 1BE5066A7F; Mon, 10 Oct 2022 04:20:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V9P8xpBNq1o1yUkMVzDurEiOm0IRqZKcwfIXIiGmzgrwUT/A07BzuynRbu6vasvjT0+q9KF3i1OZh23FJeEbwek77PbWN4/O3SDhCYrMQGv/OVQg7K76tL55MlvoUQXw3nBc56lr03JIh2jcMiX6NRX1aqEaN4yGLF5wNr236PrE1h8yh1qvlnshLo+zzFJMoU5FGWjVVUY7amo/g00Hay8bq0xpg2AyHyybTpi2faFPpDj+jH2pAZr65YPHKsHZzuW6Bn1dFGUITCqAoq3R8iUhjM5AxgU9VIHEAFfAPHkMELkhT7N3CZr5qFUk9Sbw9Eio7N0eOgQRuarAZGYx+Q== 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=5sO+h+hA8R/EsIuJBHB5bYN20abLljjN0ZwtDp9TlAI=; b=fC/qBAkXlgTA/AoG8XqWh6fh4uTI9rvN0eaWxONaVJoKeWNPoYlGhFhNAOr7s4l740cGg/WZgtwZlGTY09ljQc91uNxfO3cfMc/3ajSaNmiK7ecch2gSxEEMC2sTFzeFukUE162q93j50ChWEWEafw9zAt+CYPkRC3kQc6xoU/MnDoonMkSOGlDlRtLglJ+9sICyGM99xOtr43QqovOhJBS6CInxBFkTbJfL6A5ni1uLGp6bA/eRUMclHbUsVZMj6sU+L1GO+8h7Tiz+dpKWecSLwh4UF+Zsp/0QekubcYkg3eRlTH3rIYh7kpl2Gq2wYnJ/Tq37TpCQfEdjRky8Tw== 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=5sO+h+hA8R/EsIuJBHB5bYN20abLljjN0ZwtDp9TlAI=; b=oNPgbTBbp7MDEtuTxwUoXGoKdDlNoyfrQ17E2qTC6GJB4qK8SrcLz2aIl5eqbGf/Z2bsKASt11HMYLQNcA7KcRaD4n4fRUMyr/SJpPHGbrQlThCj+KpWxRIMURgJQVni2lbWfkodzT9QPVR9oCeIZv3PWyJ4VZJREPlIu8TyWaKPcTmppkpzi3gtnHUfdu+5dS33+Ps3/Qj96hu/V/OXPeP2+iCUsl8zh/MomYxLPtGLarIRTyi776uyEGtQSJ6HqdeZ+95pKFzpEhMXLVedBg9FIvLrKe5GvV7E1I0Rd18Gt/FYcTNH/sZ6Vpdd1xSwn/XeR4TwQ8mD8dsU5XXPUQ== Received: from MW4PR03CA0180.namprd03.prod.outlook.com (2603:10b6:303:8d::35) by MW4PR12MB7216.namprd12.prod.outlook.com (2603:10b6:303:226::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5654.20; Mon, 10 Oct 2022 11:20:56 +0000 Received: from CO1NAM11FT036.eop-nam11.prod.protection.outlook.com (2603:10b6:303:8d:cafe::aa) by MW4PR03CA0180.outlook.office365.com (2603:10b6:303:8d::35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.15 via Frontend Transport; Mon, 10 Oct 2022 11:20: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 CO1NAM11FT036.mail.protection.outlook.com (10.13.174.124) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5709.10 via Frontend Transport; Mon, 10 Oct 2022 11:20:56 +0000 Received: from rnnvmail203.nvidia.com (10.129.68.9) 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; Mon, 10 Oct 2022 04:20:42 -0700 Received: from rnnvmail205.nvidia.com (10.129.68.10) by rnnvmail203.nvidia.com (10.129.68.9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.29; Mon, 10 Oct 2022 04:20:39 -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; Mon, 10 Oct 2022 04:20:35 -0700 From: Vidya Sagar To: , , , , , , , CC: , , , , , , , Subject: [PATCH V1 3/3] PCI: endpoint: Delete list entry before freeing Date: Mon, 10 Oct 2022 16:49:53 +0530 Message-ID: <20221010111953.5422-4-vidyas@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221010111953.5422-1-vidyas@nvidia.com> References: <20221010111953.5422-1-vidyas@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1NAM11FT036:EE_|MW4PR12MB7216:EE_ X-MS-Office365-Filtering-Correlation-Id: 1caa1dcf-eaef-4009-d746-08daaab18087 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: P5UQlgX3NPmXvnUTJIx870ymARFOkvB7sJie8vOtnClZVlQgXeY+4AtPmIbQ+oEnTB2NCdCvXqvV9CA/kFTAdW+/mgfQsPSeN4eEVvXGNSmjmBkee/B6kxhWjgizVyM96qhn+8dJQK2AK9cUh/j8r2+NGtknPSlPeyF4fZpCdlMD98LOOZGEHJTrD3WBnEXHmX9r3wty3f/ufC+fmZUMB2DLjtrXPf8RV2v0gs1FCpyS2rxuwu6AzLOyCLvmniSu6gGPd7GTzenu9o0dA0vCEp/UeK89pSuyio6tzImJQjwUcIIo0777n5fkH3G8Fn04sNSfjbm0vHN1X5Vu+8hn+WmRirIYCYOQkGWAF8oHvcdkXSTtd/6clpTUk0srwwt2bACiDLqrLegzy132pCaipIL1xvSeqVhGgVzwrd0a3S3vt5U+72xd55iwkC1DWvmsyJKfDITvOB66LQLLym2e3U4TkWc091k6Qyds7TBNXQKbLmHjFE88kuYobKxvnd609KOAL6F6RTpz+8rgzGfjQj7hD8DFWS82iX8wySqWZqD7upyaXm3JNT97XUi27f40pYjZXMSPyEllphWwkVhU2PNhWAeI6vJ+SeuWGxeCJExDsuDqSJUBfkwz6MFlUCt5BvuNrwBYx4rdf6klxDf+PpUJUQQuXFiD5JKKp5PSDXVCSZD3boMLxqoymIe733baJRsOz/cIrJFxZabTjsD900bAAuLHqPk/Zwpv77pZca3qw5wZ/4RxDKTUtpB5QkhKOwYs+8Dt0e5NVpH13E7S/w== 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)(396003)(376002)(136003)(39860400002)(346002)(451199015)(40470700004)(36840700001)(46966006)(8936002)(186003)(426003)(2616005)(40480700001)(478600001)(83380400001)(41300700001)(336012)(7696005)(36756003)(26005)(2906002)(7416002)(110136005)(5660300002)(1076003)(36860700001)(82740400003)(7636003)(4744005)(6666004)(47076005)(82310400005)(356005)(8676002)(4326008)(54906003)(316002)(86362001)(70586007)(40460700003)(70206006);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2022 11:20:56.7884 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1caa1dcf-eaef-4009-d746-08daaab18087 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: CO1NAM11FT036.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR12MB7216 Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org Currently epf_group list head is deleted without first deleting entries pointed by the list head. This patch fixes that by first deleting each entry from the list. Signed-off-by: Vidya Sagar --- 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); }