Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1614361rdd; Thu, 11 Jan 2024 04:40:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsWiUJ56NepdR2OtIGwmsPqysne3wi7Fz3wDwgUL8JkAfc50Yy6ih9LHQ5Q1T4XJKMXlbA X-Received: by 2002:a17:90a:ac14:b0:28d:c9b6:f610 with SMTP id o20-20020a17090aac1400b0028dc9b6f610mr934434pjq.1.1704976845636; Thu, 11 Jan 2024 04:40:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704976845; cv=none; d=google.com; s=arc-20160816; b=ei+A56TRHCtJCfgTA7YKgYGa/matzVYu+i64TnKzyBxXKeO3pGSFH8ecJXS7opNFeo qhjDz/Zmc6qTlXA5QbMj53pP3ykipMWrf6nUOyhpSCS/oMnZQ94mDdPxrknTM/Xy3evb 6E3OQdOzZL6yfDPMzL5tbxkCDb5UOpp4bKY/ak1dd+A8Wb4PfRLpAA3nFnoxPwPpNmom G2D2b5Ql8iuP56cYWSqVP+mXYLt8uQyw1qd0oitViaqFRzli9RJloycP2MuQqjwC1UnA t/3Rsc95va10DA7DaPwaplU/kXjW+Ud+umowBSUbZd8HiHBxuQ1NgSvXH7Pd8zRRqG6t nzJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=lUjrrZ3Jg1GUMAie5ebnK4hlRzI9jSk+yPsyIMgP7Cg=; fh=8vcDHWfo1mJ2h/Cy6pRJdyC1xbSSzHkIBwcNZjFGUwY=; b=KiBknojvcH3el8Hsb5KN21c78mTgqAZzfoCYLYdSB8aWhFw7wHwlfEtOKEsz9sT9kR WETpqyOH36rAW1lnG0Nu4WnDVv05MtYn+xs2lzSpHTYOAaSnkb9kPhmOkiqO/vo6Cv3y r7Oy/pdJMjfO714mc1I11s7oPeEp7nzESXqpKlrU/Ay0dGLKBLOmSnnsJmzCIVvcfUbc VQf6WRqit2SjijdKHbsvxlrvLqCnVfi00RYEekW467QALrN5utnmtQGgKsQZNI8DrTiL 4PNrvT2c46c3TJL+QvrtywEc6/2baC0Z+ze2pi2GSgFTVurLkSbahrpVyOALYNlHpVwK RIzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I7L9pOnj; spf=pass (google.com: domain of linux-wireless+bounces-1713-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id s20-20020a17090330d400b001d4752f5423si970816plc.495.2024.01.11.04.40.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 04:40:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1713-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I7L9pOnj; spf=pass (google.com: domain of linux-wireless+bounces-1713-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1713-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.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 3F181B22BCD for ; Thu, 11 Jan 2024 12:40:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53DC415AF1; Thu, 11 Jan 2024 12:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="I7L9pOnj" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) (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 CF8ED15ADF for ; Thu, 11 Jan 2024 12:40:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-pj1-f51.google.com with SMTP id 98e67ed59e1d1-28bc7155755so2786001a91.2 for ; Thu, 11 Jan 2024 04:40:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1704976825; x=1705581625; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=lUjrrZ3Jg1GUMAie5ebnK4hlRzI9jSk+yPsyIMgP7Cg=; b=I7L9pOnj2gmHPXX3UUbnrWYfZH2x5047cV/fypzF3Y4ux3Y0oF/TgcPKblFJhFqyfN uRt+i6HwRmtVLCXSAecx2Ihe27aeeuvT5TpzeIlMY+pOieEKi5vEYiIqh8Yh10B/i7CD RswIwp5eHwjY6N1qjV8nIrBBXxP6J14XSk3vW2Bn7p6zOzOIE/PEiBwUrY0QGlV1B3uq 5jloVDT1ujj9h5SuzxJPTboxkF1HAHNqZEefAsPr+DxEp2kTY7JW+n/TN6Iti8VvdcC1 B9JbnzOo84Tyhq4z4XFf3s4P+tBtYNJme3NJUYiuB1DgqPvdhTHQvmnigGmTOd/jg4fy 8JSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704976825; x=1705581625; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lUjrrZ3Jg1GUMAie5ebnK4hlRzI9jSk+yPsyIMgP7Cg=; b=VDHSM6jS3zyhrp9t9yFd5TV/yQj659+968NOQ0IiVG5fxRjOI4eBauuX4j6nGLROU8 vQLnCuALW0aH4Heff+7cgVazUvaQilFCPXqn4kjMXum4nRgLNbHeuz4PAyu8HM+/xslk goHXbhF8rfZVH6lhrPRVuaodLzIgUzvaFd0aU8GM9rb0XdQtzhzwxW5JaVXjtQnbau4h wMiDNikVAnxmCk1wzE0ECYefAO1vpJiPnOXQBfdFdPf8TnSRLSn6E7VUmfh1TFSqMzmp sf5bq3cC4h8cpuUXeCgzjSq/LSxiVEGfLM9eRYgHNTkOlq8K1/oJJ6z94uwTencgF4bL ZjDA== X-Gm-Message-State: AOJu0YykgJ/d5sq3R2hRRd7ggbe1K4w+Mw5pH47i/kg4d4jq9NOCV5uP 8C3EssWP0aHGtLHllRTGbPF1M8usPx97 X-Received: by 2002:a17:90a:4984:b0:28c:f1f3:4dcb with SMTP id d4-20020a17090a498400b0028cf1f34dcbmr914767pjh.69.1704976825101; Thu, 11 Jan 2024 04:40:25 -0800 (PST) Received: from thinkpad ([202.131.159.18]) by smtp.gmail.com with ESMTPSA id mf15-20020a17090b184f00b0028cef2025ddsm1418530pjb.15.2024.01.11.04.40.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 04:40:24 -0800 (PST) Date: Thu, 11 Jan 2024 18:10:09 +0530 From: Manivannan Sadhasivam To: Dan Williams Cc: Lukas Wunner , Bartosz Golaszewski , 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 , 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: <20240111124009.GA3003@thinkpad> References: <20240104130123.37115-1-brgl@bgdev.pl> <20240104130123.37115-4-brgl@bgdev.pl> <20240109144327.GA10780@wunner.de> <20240110132853.GA6860@wunner.de> <659f00ed271b3_5cee2942@dwillia2-xfh.jf.intel.com.notmuch> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <659f00ed271b3_5cee2942@dwillia2-xfh.jf.intel.com.notmuch> On Wed, Jan 10, 2024 at 12:41:17PM -0800, Dan Williams wrote: > [ add Terry ] > > > Lukas Wunner wrote: > > 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 platform > > > > > devices for child nodes of the port driver node. They will get matched > > > > > 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 *dev, > > > > > 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. > > > > > > > > devm functions can't be used in the PCI core, so symmetrically call > > > > of_platform_unpopulate() from of_pci_remove_node(). > > > > > > I don't doubt what you're saying is true (I've seen worse things) but > > > this is the probe() callback of a driver using the driver model. Why > > > wouldn't devres work? > > > > The long term plan is to move the functionality in portdrv to > > the PCI core. Because devm functions can't be used in the PCI > > core, adding new ones to portdrv will *add* a new roadblock to > > migrating portdrv to the PCI core. In other words, it makes > > future maintenance more difficult. > > > > Generally, only PCIe port services which share the same interrupt > > (hotplug, PME, bandwith notification, flit error counter, ...) > > need to live in portdrv. Arbitrary other stuff should not be > > shoehorned into portdrv. > > I came here to say the same thing. It is already the case that portdrv > is not a good model to build new functionality upon [1], and PCI core > enlightenment should be considered first. > The primary reason for plugging the power sequencing into portdrv is due to portdrv binding with all the bridge devices and acting as management driver for the bridges. This is where exactly the power sequencing part needs to be plugged in IMO. But if the idea of the portdrv is just to expose services based on interrupts, then please suggest a better place to plug this power sequencing part. - Mani > The portdrv model is impeding Terry's CXL Port error handling effort, so > I am on the lookout for portdrv growing new entanglements to unwind > later. > > [1]: http://lore.kernel.org/r/20221025232535.GA579167@bhelgaas > -- மணிவண்ணன் சதாசிவம்