Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp156295lqp; Fri, 12 Apr 2024 13:28:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXV0fQzD+1+CstO9YpyxPtMtPJz7WDw76FV+sopUHLR1LanlcE6E6vczD686E0J+E7OGfsz/ECQ9N98SpUzpl29PgN0Mj1Ywxiwe5ioxw== X-Google-Smtp-Source: AGHT+IEkwSLz0CqUq82VZ3xd9SSWAvsS21zgOEmLS5y1gEj4UvZDT5rTjAR2QC3vQ6/A1W6p/hy1 X-Received: by 2002:a17:90a:c095:b0:2a2:f281:66ed with SMTP id o21-20020a17090ac09500b002a2f28166edmr3634364pjs.21.1712953705911; Fri, 12 Apr 2024 13:28:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712953705; cv=pass; d=google.com; s=arc-20160816; b=T97ZsbqCovPtqLvangT2exeqhlPllS+Mj0gpO0WaV0pKdAO4nouQReRg4zW9W+10Tv atXnqWl76vYuZFTY+hSSetapbZIge7z/Kx4l1sGntgvDE9Q5pNDztd1Q9+XMloky/gDq Q4CES6BUK/FIMfdnCREYorQ3ozNlwD4cArZ5i9c/wDkjaq2aFk9T3enClaBdm4pW1QXB MsAaMe1qQKdOpf3iARs5hdt2iqHyLrM9xFJVp+r+p2JdZTmvxHLHVDE3YJQWRFn4zCYy 8YlA2HRDMYJAHIfGU66Kc/BzxFD6y/4ADrxYk0ig3eHov1irCA6OWdtsj3vIkeOxN3xg +GuA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:subject:cc:to:from :date:dkim-signature; bh=wkeDiZBuLc0eENuYzqyR4n8hGIaabeXCRUdbWIvL8m0=; fh=YIIC6+tko0R8tkc/lwZBp5mvPSklOziLrIHuDTg8cbc=; b=auH816hgbqWTIiaISXFylYVa6se4nHs66CYuj7xU5zFEWJ9Qn1XsNyT8luy18jP+ms kjeAEjc5snw6iN1rxPC8WNES7yObW7S3rcTgEMPQvEVt7NQ1Sit5fEYUX+9VMHgV2EIl kE/CE8I6eG2RiYjXCGjtYKDBkNviMT1t766SzUDuZGggijeRxLVou/1I05p78RFzKdDI 0u/N+gQ4NyYTzUfrxFeRKRbJjinvD4/An3s46ZGfjB0ISZbeWiO5aQYIG8NPp88JmB+S m7J+FtBMzEovgC7Va0K0tnn+7gMmfg+k0aE5rK4+AjP5WXy0TrILiyvbIGGBsCLzNSqZ mEqQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mBBFqL53; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ep14-20020a17090ae64e00b002a5beeaa6d5si6053459pjb.139.2024.04.12.13.28.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Apr 2024 13:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-143305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mBBFqL53; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-143305-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-143305-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 457CAB240C2 for ; Fri, 12 Apr 2024 20:22:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65E1914A091; Fri, 12 Apr 2024 20:22:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="mBBFqL53" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7295614F9C6; Fri, 12 Apr 2024 20:22:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712953338; cv=none; b=rD+7R/cTcxggeN7Awxc9EjklxDZVOtT0hKxrXgtD8ZXwlp4HYkyv4rNUjoGYq0LmcH/bRF4/D4Bnl0rGcarv509W4ie82iVObDbAOW9B0XgnkYR1t3wWMCMjHskqx3XdlVa5GFRZXKvf+5ud21ooNu1pXMoQavpa4qqI5dCxC54= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712953338; c=relaxed/simple; bh=sn2OmynqMr6J7esZV94bEU0Yo+Dr7urRItKlgNXXkk8=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=qhh+DVzwfvS1HMMy8VucMrmyNMPMbNMtnFnDrb2d2Auc/7qKpJ3fL2Oj8fkgMv2GmcoIn+KbmYz7B9d/r3WaFNzNwkGA8FHov+iv55PmjED/boSTRTexFMl3QSAo6BDO9qDBCUIsmTY+nQPIeT2dDcsIVjXNwASA39EblkdidJ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=mBBFqL53; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3A70C113CC; Fri, 12 Apr 2024 20:22:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712953338; bh=sn2OmynqMr6J7esZV94bEU0Yo+Dr7urRItKlgNXXkk8=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=mBBFqL53k8d8ZRiCErYU+z9y7mNs9HHDllT10pZ3ClqXZjEuN0B8ebU0XrYAbSEpa QIQCzjz9kSUPV2Gm101R8qF0Fzm/d2ECYeTqOYdngkP0oFGR/IEq1gIF5QqZJLwFLh FwyDBuniceg4diUmqI1tezD9L6IV7P6ymG4dV/PcGZyQNp9isKFZpILhe3DRxFroRZ kl6wGt76+5I0oZFe7K9D9ea7a2c8J3M7XvW75EVELJ4xyJA6ycIRtQUiukrwLyTuh2 Hbb4UXqrYyQamtx23jHin0qc0HsDUuz6DG1NpfKAu+Ky81T3wDDvRZtoadLACzqpGp 0K71g/atBsARQ== Date: Fri, 12 Apr 2024 15:22:16 -0500 From: Bjorn Helgaas To: Manivannan Sadhasivam Cc: Jingoo Han , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Vidya Sagar , Vignesh Raghavendra , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Minghuan Lian , Mingkai Hu , Roy Zang , Kunihiko Hayashi , Masami Hiramatsu , Kishon Vijay Abraham I , Jesper Nilsson , Srikanth Thokala , Shawn Lin , Heiko Stuebner , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-tegra@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Niklas Cassel , linux-arm-kernel@axis.com, linux-rockchip@lists.infradead.org Subject: Re: [PATCH v12 8/8] PCI: endpoint: Remove "core_init_notifier" flag Message-ID: <20240412202216.GA14590@bhelgaas> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240327-pci-dbi-rework-v12-8-082625472414@linaro.org> On Wed, Mar 27, 2024 at 02:43:37PM +0530, Manivannan Sadhasivam wrote: > "core_init_notifier" flag is set by the glue drivers requiring refclk from > the host to complete the DWC core initialization. Also, those drivers will > send a notification to the EPF drivers once the initialization is fully > completed using the pci_epc_init_notify() API. Only then, the EPF drivers > will start functioning. > > For the rest of the drivers generating refclk locally, EPF drivers will > start functioning post binding with them. EPF drivers rely on the > 'core_init_notifier' flag to differentiate between the drivers. > Unfortunately, this creates two different flows for the EPF drivers. > > So to avoid that, let's get rid of the "core_init_notifier" flag and follow > a single initialization flow for the EPF drivers. This is done by calling > the dw_pcie_ep_init_notify() from all glue drivers after the completion of > dw_pcie_ep_init_registers() API. This will allow all the glue drivers to > send the notification to the EPF drivers once the initialization is fully > completed. Thanks for doing this! I think this is a significantly nicer solution than core_init_notifier was. One question: both qcom and tegra194 call dw_pcie_ep_init_registers() from an interrupt handler, but they register that handler in a different order with respect to dw_pcie_ep_init(). I don't know what actually starts the process that leads to the interrupt, but if it's dw_pcie_ep_init(), then one of these (qcom, I think) must be racy: qcom_pcie_ep_probe dw_pcie_ep_init <- A qcom_pcie_ep_enable_irq_resources devm_request_threaded_irq(qcom_pcie_ep_perst_irq_thread) <- B qcom_pcie_ep_perst_irq_thread qcom_pcie_perst_deassert dw_pcie_ep_init_registers tegra_pcie_dw_probe tegra_pcie_config_ep devm_request_threaded_irq(tegra_pcie_ep_pex_rst_irq) <- B dw_pcie_ep_init <- A tegra_pcie_ep_pex_rst_irq pex_ep_event_pex_rst_deassert dw_pcie_ep_init_registers Whatever the right answer is, I think qcom and tegra194 should both order dw_pcie_ep_init() and the devm_request_threaded_irq() the same way. Bjorn