From mboxrd@z Thu Jan 1 00:00:00 1970 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 AB685EB64DA for ; Wed, 28 Jun 2023 13:30:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231133AbjF1Nal (ORCPT ); Wed, 28 Jun 2023 09:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232182AbjF1N3r (ORCPT ); Wed, 28 Jun 2023 09:29:47 -0400 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D47CC129; Wed, 28 Jun 2023 06:29:46 -0700 (PDT) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 040DE30004510; Wed, 28 Jun 2023 15:29:45 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id EBCC743C12D; Wed, 28 Jun 2023 15:29:44 +0200 (CEST) Date: Wed, 28 Jun 2023 15:29:44 +0200 From: Lukas Wunner To: Smita Koralahalli Cc: Sathyanarayanan Kuppuswamy , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Bjorn Helgaas , oohall@gmail.com, Mahesh J Salgaonkar , Yazen Ghannam , Fontenot Nathan Subject: Re: [PATCH v3 1/2] PCI: pciehp: Add support for async hotplug with native AER and DPC/EDR Message-ID: <20230628132944.GB14276@wunner.de> References: <20230621185152.105320-1-Smita.KoralahalliChannabasappa@amd.com> <20230621185152.105320-2-Smita.KoralahalliChannabasappa@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org On Tue, Jun 27, 2023 at 10:48:37AM -0700, Smita Koralahalli wrote: > On 6/22/2023 4:22 PM, Sathyanarayanan Kuppuswamy wrote: > > On 6/21/23 11:51 AM, Smita Koralahalli wrote: > > > +static void dpc_handle_surprise_removal(struct pci_dev *pdev) > > > +{ > > > + if (pdev->dpc_rp_extensions && dpc_wait_rp_inactive(pdev)) { > > > + pci_err(pdev, "failed to retrieve DPC root port on async remove\n"); > > > + goto out; > > > + } > > > + > > > + pci_aer_raw_clear_status(pdev); > > > + pci_clear_surpdn_errors(pdev); > > > + > > > + pci_write_config_word(pdev, pdev->dpc_cap + PCI_EXP_DPC_STATUS, > > > + PCI_EXP_DPC_STATUS_TRIGGER); > > > > Don't you need to wait for the link to go down? > > Yes will include, pcie_wait_for_link().. > > Should this check be here or at the beginning of the function before we > check pdev->dpc_rp_extensions? I'd just use the same order as dpc_reset_link(), i.e. checking for !pcie_wait_for_link() happens before the check for pdev->dpc_rp_extensions. Thanks, Lukas