Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3196843rwb; Mon, 19 Sep 2022 17:01:48 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56y/Zuq0/2abOm9uzAClp17+cCop9JfxBQWLSZ1w5a4XhcmPB48RPgB1biNbZDCodOhpHq X-Received: by 2002:a05:6a00:17a3:b0:540:97a3:f7a9 with SMTP id s35-20020a056a0017a300b0054097a3f7a9mr20400868pfg.12.1663632107898; Mon, 19 Sep 2022 17:01:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663632107; cv=none; d=google.com; s=arc-20160816; b=FKrcWwntfYcnJG8U8JvEopMyn1LiIMCdvGJHB5OLs/jovrvqcmRiTocpYqmJcnub+i RWiH+mr6EjEDqTsxKn/JjPa09/mB97RrmGl1+voRNBaQgUg4DORBWTNu7VFGJuzSFxFU ipb6RHQ61bzV/74iKtxdhsoLoHnmTNxjKJi7fitfaXNoBCftw0yWYdvavH6ITC6UvtU9 Aa2T7OflxL7Cl8ZUJWbypGPOyMBeb28GWklmytqRBRI2QvtgLVjkKXo02mZyQ1MsO7C9 wt+C/OuXlhuPMV8zsBMC++XBLTrDqBiI3OnB7lDrQ8uJFwg/EjNRwYRSE+zcRjxY2cuF R/8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=tLmTZyJASRmV+k2B31H+0ZVnV46WMvZIwu4VSltoBrw=; b=oKlJf6bSiasDJPovrHxI2SHpN3fmFk6ohR7oskRc3BdHJyDraLMMGANclgIRR6jC8u aBosE1wkR/D5NKuSh99+vvMOp7WWtLr4FV6CjxSY/H3d+Stmaasd4w4Zu7boFI4130RG ABjvj7lFBL0zOIoXGmQ6u08qgULKX3kDiuL1GN4updK6epgjGYdK/EK0w0a1MPVnGeyB GVQeC9yvcuKNeGf31T84fxd1GTUcSIWIG/03j+5RkzGLIAg7+CMHeYflMlEpPnHJ3/uQ jTwGajj99Croy2A1YTK9+Wpga5akqhQb1Mwy7cCbnj7AP/6O50dZ2e8bjEg8eGIEN+Vr U86w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=UKkyDLXs; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k17-20020a6568d1000000b00434a79d9439si1149006pgt.187.2022.09.19.17.01.35; Mon, 19 Sep 2022 17:01:47 -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=@kernel.org header.s=k20201202 header.b=UKkyDLXs; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229973AbiISWkW (ORCPT + 99 others); Mon, 19 Sep 2022 18:40:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbiISWkV (ORCPT ); Mon, 19 Sep 2022 18:40:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B679A28723; Mon, 19 Sep 2022 15:40:19 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 7CACDB821B1; Mon, 19 Sep 2022 22:40:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DF5A8C433D6; Mon, 19 Sep 2022 22:40:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663627217; bh=pHkxeihtgeIsqW4rQKtSSh7KacdZKQcvFCJJxp9CxfQ=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=UKkyDLXshPs9BjzEnqCZwuuzULGSnMIo9y60Po5KHO/dMV9NgJ6zpVpp6T/+giI6d M0hfZTk6xkpHhq4XZv2joyau5p9mc4N5kMpuvHGXM9qefyPMO9rUkptJPEPbicw4FQ MEm0B93IbpVPZpZOxff5XxjCVNUawm4jfzv/0nMRAqfrTJI0xmbayCW2s/HXNXyT/Y aMBuwaodI1qDZZUg9kihlrO8mAo7wtxXmPA0bY6SJdMzM2kom4aqkj5T8RcnRPZ9YX QvHA+V+F6BNVGs8k4G64rLHtTEIWzoDAaFn4cA7/TnPCSGiOKIRXzRdCNsjX5z7hfd 6YIzAzdQqXjfw== Date: Mon, 19 Sep 2022 17:40:14 -0500 From: Bjorn Helgaas To: Vidya Sagar Cc: jingoohan1@gmail.com, gustavo.pimentel@synopsys.com, lpieralisi@kernel.org, robh@kernel.org, kw@linux.com, bhelgaas@google.com, mani@kernel.org, Sergey.Semin@baikalelectronics.ru, dmitry.baryshkov@linaro.org, linmq006@gmail.com, ffclaire1224@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux-pci@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, kthota@nvidia.com, mmaddireddy@nvidia.com, sagar.tv@gmail.com Subject: Re: [PATCH V4 0/3] PCI: designware-ep: Fix DBI access before core init Message-ID: <20220919224014.GA1030798@bhelgaas> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220919183342.4090-1-vidyas@nvidia.com> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 On Tue, Sep 20, 2022 at 12:03:39AM +0530, Vidya Sagar wrote: > This series attempts to fix the issue with core register (Ex:- DBI) accesses > causing system hang issues in platforms where there is a dependency on the > availability of PCIe Reference clock from the host for their core > initialization. > This series is verified on Tegra194 & Tegra234 platforms. I think this design is just kind of weird, specifically, the fact that setting .core_init_notifier makes dw_pcie_ep_init() bail out early. The usual pattern is more like "if the specific driver sets this function pointer, the generic code calls it." The name "dw_pcie_ep_init_complete()" is not as helpful as it could be: it tells us something about what has happened before this point, but it doesn't tell us anything about what dw_pcie_ep_init_complete() *does*. Same thing with dw_pcie_ep_init_notify() -- it doesn't tell us anything about what the function *does*. I see that it calls pci_epc_init_notify(), which calls a notifier call chain (currently always empty except for a test case). I think pci_epc_linkup() is a better name because it says something about what's happening: the link is now up and we're telling somebody about it. "pci_epc_init_notify()" doesn't convey that. "pci_epc_core_initialized()" might. It looks like both qcom and tegra wait for an interrupt before calling dw_pcie_ep_init_notify(), but I'm a little concerned because I can't figure out what specifically they do to start the process that ultimately generates the interrupt. Presumably they request the IRQ *before* starting the process, but there's not much between the devm_request_threaded_irq() and the interrupt handler, which makes me wonder if both are racy. > Manivannan, could you please verify on qcom platforms? > > V4: > * Addressed review comments from Bjorn and Manivannan > * Added .ep_init_late() ops > * Added patches to refactor code in qcom and tegra platforms > > Vidya Sagar (3): > PCI: designware-ep: Fix DBI access before core init > PCI: qcom-ep: Refactor EP initialization completion > PCI: tegra194: Refactor EP initialization completion > > .../pci/controller/dwc/pcie-designware-ep.c | 112 ++++++++++-------- > drivers/pci/controller/dwc/pcie-designware.h | 10 +- > drivers/pci/controller/dwc/pcie-qcom-ep.c | 27 +++-- > drivers/pci/controller/dwc/pcie-tegra194.c | 4 +- > 4 files changed, 85 insertions(+), 68 deletions(-) > > -- > 2.17.1 >