Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1094334rdd; Wed, 10 Jan 2024 08:27:13 -0800 (PST) X-Google-Smtp-Source: AGHT+IErnFOMtyJX6LRZ4OYTRIqXYqaTdmaLggFh+fTGzRcavO7R0Ib4FxB7/3R3z/BIg3DoUxP/ X-Received: by 2002:a17:906:27c7:b0:a28:ab7c:ad10 with SMTP id k7-20020a17090627c700b00a28ab7cad10mr366552ejc.251.1704904033237; Wed, 10 Jan 2024 08:27:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704904033; cv=none; d=google.com; s=arc-20160816; b=Y0vRDv5Fdk9izJ2nybT6b71yauQwTCh/JtaNTgr9D3inl3/1mf5WMZWao56Ti7vXbN c4pWToxYM0mBiaOScxdVUp1h60W0aFZt14A6Cpdvu+LFQE9wk10hyII+Yeauth9WxRT4 ycuxLmtOUMTTHUYj/+WvB5ZQyXTlR1gEPNu9+662h8Gl9yegCCFTH5WggxLBmxkcovXW qsWcd9OFSIorjv2EkG/nh+phycISaPPdxjqhrUa/uZDPxOpHlwFDIGjm27EtYVXONhbp vXK2YysovfVQfYpGv2WbfJn9KSQQiTI1qkEzWZGxPj4JX0EkLGKYV5eX/sOryZfTAyEF SY/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=7uB53QA0E7F+IhblD19yUURwvGBMy4pSNNv3aj7aRQ8=; fh=Ou2sfbatsjTy48V6fnteK8lVgKixen5XgSBvOE4W8KA=; b=O70USr3BtoTzxu2vedvPRpJ7jwhnZEuvqLn9B2dx1fzWF/OakhQFFFkNr9HaihvM0t QC0O2OE71KkKnWMRB7iXzfE+OT/0ViSzgPcTw/Q4RSwmckvwvKQqMZPu/6azvP+4QDdA nFaXvXnQZtXppG3+0lL7IQhG8vPtFphbbm4ZOP8FJkv5RUXVSAlEXfj4zapIJdmaLrt7 9js8vkGumXJAxaE2vBU2Vi+pT2+TrP9LxEVEgNKV0QjDGEcru50gbeSJE+YrbFRA8n3I vfztpz6/nk+TiGCvrYB9YI78FuNQ2cdt61QjRNcOVfUHHr08tdjAMhQrNIcLBOSuz+xT kQlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="O/O01Pjz"; spf=pass (google.com: domain of linux-wireless+bounces-1678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1678-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id gs21-20020a170906f19500b00a236de74149si1816858ejb.760.2024.01.10.08.27.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 08:27:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b="O/O01Pjz"; spf=pass (google.com: domain of linux-wireless+bounces-1678-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1678-linux.lists.archive=gmail.com@vger.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 am.mirrors.kernel.org (Postfix) with ESMTPS id EC7E01F23291 for ; Wed, 10 Jan 2024 16:27:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3277E4CB40; Wed, 10 Jan 2024 16:27:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="O/O01Pjz" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 907224CDE8 for ; Wed, 10 Jan 2024 16:27:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-vk1-f170.google.com with SMTP id 71dfb90a1353d-4b7153b8d76so793570e0c.0 for ; Wed, 10 Jan 2024 08:27:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704904023; x=1705508823; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=7uB53QA0E7F+IhblD19yUURwvGBMy4pSNNv3aj7aRQ8=; b=O/O01PjzdBA0CMwQh6BnBjoqZZTOQ6ncSWNIHlFtZ+Gj745Ech4CipC6PSpbfurRcM Z0euVyZuW4FgFjufAW4VRUB//m7Z1C/QF5h5hwqoNJ4M6UcO+aDkPZ7gA8HvDiMdXTaS cCs2n/XO6jMVttyHaUkmW9xjJK0pLmhEipXuo/SUSNBWMBCcO901yZbZCrPIfO9dvS5C yh/278g8Exy//M0VWusCqml4q1whH1jtZC5qvlRYOhq7C7szWj3U0mp3q+I6pRriCbGr LFZ8wGhBrQo/1rmsXcLFVxKnzVroAW6kq5+T5TqMeMg+i0HGMlrKWIUnJQmv2KHKaxLE oTyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704904023; x=1705508823; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7uB53QA0E7F+IhblD19yUURwvGBMy4pSNNv3aj7aRQ8=; b=t/pCizHwCxeybrsgXFGtg0h6zQLehvEoYbtPYGEcZp6ELWr6ZsEdp+fALU+z8PSQUy HWD+0G1d85sNWwn18gYOGxTGHZnc51ChgoM+UNRUmFjLsgPugM5kQ9WkMclV27B3KDwQ OSL88jB3BaYIPeJG3oacmQWw5W4fFfkdkqwXUGYZJI3gTpHr2nqZIEchycUcvLbZuq/t pd/cjy9XEUv1bgIoTZ5vw66CruY1A5R0TFPDS6lNV//FkgBaHGLPn2PAmlXVv2cV+Qvh 89rQ35jEoxPvq6xVgTko0X6PXL13LpXMpU+xKfKUuA/jZCb5i8ulLMMAexHFb1LrrOSS 6ahw== X-Gm-Message-State: AOJu0YxEM+jQahS2R1JI15LPJkU+qKqyxWYuW49DqPfIVYaA7mU59RLj gaXPgcGYdFwYFDgGwxcnGtd9Loe5UOguFkxANObpyQdENf0pgQ== X-Received: by 2002:a05:6122:270c:b0:4b6:aeb7:3f1d with SMTP id ej12-20020a056122270c00b004b6aeb73f1dmr611316vkb.9.1704904023230; Wed, 10 Jan 2024 08:27:03 -0800 (PST) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240104130123.37115-1-brgl@bgdev.pl> <20240104130123.37115-4-brgl@bgdev.pl> <20240109144327.GA10780@wunner.de> <20240110132853.GA6860@wunner.de> In-Reply-To: <20240110132853.GA6860@wunner.de> From: Bartosz Golaszewski Date: Wed, 10 Jan 2024 17:26:52 +0100 Message-ID: Subject: Re: [RFC 3/9] PCI/portdrv: create platform devices for child OF nodes To: Lukas Wunner 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 , =?UTF-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4gUHJhZG8=?= , Marek Szyprowski , Peng Fan , Robert Richter , Dan Williams , Jonathan Cameron , Terry Bowman , Kuppuswamy Sathyanarayanan , =?UTF-8?Q?Ilpo_J=C3=A4rvinen?= , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jan 10, 2024 at 2:28=E2=80=AFPM Lukas Wunner wrot= e: > > On Wed, Jan 10, 2024 at 01:55:18PM +0100, Bartosz Golaszewski wrote: > > On Tue, Jan 9, 2024 at 3:43???PM Lukas Wunner wrote: > > > On Thu, Jan 04, 2024 at 02:01:17PM +0100, Bartosz Golaszewski wrote: > > > > In order to introduce PCIe power-sequencing, we need to create plat= form > > > > devices for child nodes of the port driver node. They will get matc= hed > > > > against the pwrseq drivers (if one exists) and then the actuak PCIe > > > > device will reuse the node once it's detected on the bus. > > > [...] > > > > --- a/drivers/pci/pcie/portdrv.c > > > > +++ b/drivers/pci/pcie/portdrv.c > > > > @@ -715,7 +716,7 @@ static int pcie_portdrv_probe(struct pci_dev *d= ev, > > > > pm_runtime_allow(&dev->dev); > > > > } > > > > > > > > - return 0; > > > > + return devm_of_platform_populate(&dev->dev); > > > > } > > > > > > I think this belongs in of_pci_make_dev_node(), portdrv seems totally > > > the wrong place. Note that you're currently calling this for RCECs > > > (Root Complex Event Collectors) as well, which is likely not what > > > you want. > > > > > > > of_pci_make_dev_node() is only called when the relevant PCI device is > > instantiated which doesn't happen until it's powered-up and scanned - > > precisely the problem I'm trying to address. > > No, of_pci_make_dev_node() is called *before* device_attach(), > i.e. before portdrv has even probed. So it seems this should > work perfectly well for your use case. > 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? Bartosz [snip]