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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 97F43C5475B for ; Fri, 8 Mar 2024 13:25:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JmpTXEJELPb2eLKDjnknOs6xr4+2t1MzODoVeRqhCTE=; b=vibOVAYggaoD+U GS8WwU2ViD8U5/5YZ+Ddhi8AAUtenaE73aXreZxVu0Ix+LNRuRe2v312D5hDgXL5PHRr0IhwA9Aba KudSgVIT7XPEvnw1VtFJl7539FHrhc7eBfSyHmTG5LAhDmp+SjF+v1Dx92o9xWAS22jTa1CXi0DXF uhjv+1wlelqX5+zrHuDXStZQ+ejYICkUzA3ht3XZ3kL/+qlVDU7NNd6Sjp2I37DE8qvsHwExo/+wc RCVFUV0Apn3rG4Y7MZRtCbqz4yrMIAmtbpHJ+T+aysUqxekwl4lDhI61btrhhQxZNyev3pQBqZXao x88rkXbRaTCcr7si8OxA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1riaDZ-00000009Hgt-0516; Fri, 08 Mar 2024 13:24:57 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1riaDV-00000009HdC-2fb5 for linux-arm-kernel@lists.infradead.org; Fri, 08 Mar 2024 13:24:55 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id CF65ECE16B8; Fri, 8 Mar 2024 13:24:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E7CB0C433F1; Fri, 8 Mar 2024 13:24:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709904288; bh=LAdBrFiiqpPIYb+1fEVGEmGjUltxM7IwFgH3jq/rJDo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kCQZriwBir8HdF7tMJnCbXC/StQ5ZubtkrurJ/hNH5ABeLm3oUkbkLT4RFyY2E8eO WhEOBptb0FP//rwCm3NEOkHagnEj5gf5qMnmPMe/qNH0seeYsh4AqBQsrYd+RbrnH6 pDRLKSmQdbkECwUTmu2Qx8EiSpSPwjGi1C/wfhV39qWSt9mOUDcyucPUwdWxl7RKKL r8to3P6b356iIL9jCR8K8bfo8pwwI6jmqw7KiebRFq4G0i2mjya0l5XV7KTfiYE85w umqtSbSKWbmwfLY0nu5JqX3tCAiDkKwWTsmoxH+sE6t5e8phFPQm6vRX5Q9girR6xc MZOTZB3+scaNQ== Date: Fri, 8 Mar 2024 14:24:35 +0100 From: Niklas Cassel To: Manivannan Sadhasivam Cc: Jingoo Han , Gustavo Pimentel , Lorenzo Pieralisi , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Rob Herring , Bjorn Helgaas , Marek Vasut , Yoshihiro Shimoda , Thierry Reding , Jonathan Hunter , Kishon Vijay Abraham I , 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 , 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, linux-arm-kernel@axis.com, Frank Li Subject: Re: [PATCH v9 07/10] PCI: dwc: ep: Remove "core_init_notifier" flag Message-ID: References: <20240304-pci-dbi-rework-v9-0-29d433d99cda@linaro.org> <20240304-pci-dbi-rework-v9-7-29d433d99cda@linaro.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240304-pci-dbi-rework-v9-7-29d433d99cda@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240308_052454_049165_2E741EC1 X-CRM114-Status: GOOD ( 25.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Mar 04, 2024 at 02:52:19PM +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. > > Only difference here is that, the drivers requiring refclk from host will > send the notification once refclk is received, while others will send it > during probe time itself. > > Reviewed-by: Frank Li > Signed-off-by: Manivannan Sadhasivam > --- > diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c > index 18c80002d3bd..fc0282b0d626 100644 > --- a/drivers/pci/endpoint/functions/pci-epf-test.c > +++ b/drivers/pci/endpoint/functions/pci-epf-test.c > @@ -927,21 +928,12 @@ static int pci_epf_test_bind(struct pci_epf *epf) > if (ret) > return ret; > Hello Mani, Since you asked for testing, I gave your series a spin (with a driver without .core_init_notifier). There seems to be a problem that pci_epc_write_header() is never called. Debugging this, it seems that .core_init in pci-epf-test is never called. If I add debug prints in pci_epc_init_notify(), I see that it does not notify a single EPF driver. It appears that the patch in $subject will call pci_epc_init_notify() at EPC driver .probe() time, and at that point in time, there are no EPF drivers registered. They get registered later, when doing the configfs write. I would say that it is the following change that breaks things: > - if (!core_init_notifier) { > - ret = pci_epf_test_core_init(epf); > - if (ret) > - return ret; > - } > - Since without this code, pci_epf_test_core_init() will no longer be called, as there is currently no one that calls epf->core_init() for a EPF driver after it has been bound. (For drivers that call dw_pcie_ep_init_notify() in .probe()) I guess one way to solve this would be for the EPC core to keep track of the current EPC "core state" (up/down). If the core is "up" at EPF .bind() time, notify the EPF driver directly after .bind()? Kind regards, Niklas _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel