From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [83.223.95.100]) (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 74AEA4A987; Thu, 11 Jan 2024 15:02:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net 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 TLS RSA CA G1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id 9E573300000BE; Thu, 11 Jan 2024 16:02:01 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 8FBBBDAB62; Thu, 11 Jan 2024 16:02:01 +0100 (CET) Date: Thu, 11 Jan 2024 16:02:01 +0100 From: Lukas Wunner To: Bartosz Golaszewski Cc: Kalle Valo , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Catalin Marinas , Will Deacon , Bjorn Helgaas , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Linus Walleij , Geert Uytterhoeven , Arnd Bergmann , Neil Armstrong , =?iso-8859-1?Q?N=EDcolas_F_=2E_R_=2E_A_=2E?= Prado , Marek Szyprowski , Peng Fan , Robert Richter , Dan Williams , Jonathan Cameron , Terry Bowman , Kuppuswamy Sathyanarayanan , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Huacai Chen , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Bartosz Golaszewski Subject: Re: [RFC 3/9] PCI/portdrv: create platform devices for child OF nodes Message-ID: <20240111150201.GA28409@wunner.de> References: <20240104130123.37115-1-brgl@bgdev.pl> <20240104130123.37115-4-brgl@bgdev.pl> <20240109144327.GA10780@wunner.de> <20240110132853.GA6860@wunner.de> <20240110164105.GA13451@wunner.de> <20240111104211.GA32504@wunner.de> 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: User-Agent: Mutt/1.10.1 (2018-07-13) On Thu, Jan 11, 2024 at 05:09:09AM -0600, Bartosz Golaszewski wrote: > On Thu, 11 Jan 2024 11:42:11 +0100, Lukas Wunner said: > > On Wed, Jan 10, 2024 at 02:18:30PM -0600, Bartosz Golaszewski wrote: > >> On Wed, 10 Jan 2024 17:41:05 +0100, Lukas Wunner said: > >> > On Wed, Jan 10, 2024 at 05:26:52PM +0100, Bartosz Golaszewski wrote: > >> > > Seems like the following must be true but isn't in my case (from > >> > > pci_bus_add_device()): > >> > > > >> > > if (pci_is_bridge(dev)) > >> > > of_pci_make_dev_node(dev); > >> > > > >> > > Shouldn't it evaluate to true for ports? > >> > > >> > It should. > >> > > >> > What does "lspci -vvvvxxxx -s BB:DD.F" say for the port in question? > > # lspci -vvvvxxxx -s 0000:00:00 > 0000:00:00.0 PCI bridge: Qualcomm Technologies, Inc Device 010b > (prog-if 00 [Normal decode]) > Device tree node: /sys/firmware/devicetree/base/soc@0/pcie@1c00000/pcie@0 [...] > 00: cb 17 0b 01 07 05 10 00 00 00 04 06 00 00 01 00 ^^ The Header Type in config space is 0x1, i.e. PCI_HEADER_TYPE_BRIDGE. So pci_is_bridge(dev) does return true (unlike what you write above) and control flow enters of_pci_make_dev_node(). But perhaps of_pci_make_dev_node() returns immediately because: /* * If there is already a device tree node linked to this device, * return immediately. */ if (pci_device_to_OF_node(pdev)) return; ...and lspci does list a devicetree node for that Root Port. In any case, of_pci_make_dev_node() is the right place to add the call to of_platform_populate(). Just make sure it's called even if there is already a DT node for the Root Port itself. Thanks, Lukas