Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1230701rdd; Wed, 10 Jan 2024 12:48:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsQvPRn9vW6c7tbP/fC89l1Y9l+dELPmNjdAY6+xqNnA271IzB26Uenzzt1cdVom2pNglD X-Received: by 2002:a05:600c:198a:b0:40e:5947:bd07 with SMTP id t10-20020a05600c198a00b0040e5947bd07mr10284wmq.37.1704919686422; Wed, 10 Jan 2024 12:48:06 -0800 (PST) Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id lj24-20020a170906f9d800b00a28219b04desi2019198ejb.658.2024.01.10.12.48.06 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 12:48:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="GpJ/3OUV"; arc=fail (signature failed); spf=pass (google.com: domain of linux-wireless+bounces-1681-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1681-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com 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 06F9D1F26EED for ; Wed, 10 Jan 2024 20:48:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E63C255C30; Wed, 10 Jan 2024 20:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GpJ/3OUV" X-Original-To: linux-wireless@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (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 A589458101; Wed, 10 Jan 2024 20:41:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1704919305; x=1736455305; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=ffGcAklL2lninX1ZFIw2hyes7AsdGzZjRBETjam5ZnU=; b=GpJ/3OUVuwx3RkI4scY91kFZ+DLAXNtV5OwpABCOpxKPIHFzLg5owPD2 IY3gXAXT+jTbOKaAvN/v0AyYPlbSBivl7jjImTiA/QFqA7kerKHjDSg+b kgF3xMDX41ThQHa5zcGmp3x4hrZEurHYqlMG8ehpgx3HCf1CjrfqrGbqw kN4K7sn/StAnbQHPZcpQr57w9d27Qi1BM0/IchRdNDRYW3dIDPms/tdIA 0Gfb+rG/5hJAZhDgZrMh8Wi9ZJMV5uYiWlc31FU4Jo9BvxqVyYjRChw7/ vdI8tUvOEHcilqg0I7ZGhFLFlI4sg+04PrrDA8Qk2A3YDXkgtLdVELs15 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="5380533" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="5380533" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Jan 2024 12:41:28 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10949"; a="925771272" X-IronPort-AV: E=Sophos;i="6.04,184,1695711600"; d="scan'208";a="925771272" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmsmga001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 10 Jan 2024 12:41:28 -0800 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 10 Jan 2024 12:41:28 -0800 Received: from fmsmsx602.amr.corp.intel.com (10.18.126.82) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Wed, 10 Jan 2024 12:41:27 -0800 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Wed, 10 Jan 2024 12:41:27 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.100) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Wed, 10 Jan 2024 12:41:27 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=d+VmXPUrY8yfixC13vrL+6Olyi8MuDoq0uSIB5tMXHzG58PbK6bZ6GHXHOujb6mBW1nzqrLCo1xNZjxLH99gMtUwKCJi7Nh4TbYsBicuPaR0zpZAzvOm98HoNx1mUc5vAup0wGCHNXUFibK58lv38/Q1lTFFSymbJYc+jShun4P1w9GzneQD5rO3Vt0iFn9L0Op0+RLXvgdItIY15Rr08qB0fv+Z15Sffrlj4xYR52UOjhHlPs6teDnTqv9jHYUB9lzqsae33j3SdrehgngWqyYtnRj9l+QrWn/aO0WIz1XpoE8uwWPPw2Ow3E6fOkwdWWsgVCVdP1Vz/7CO0svrsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=n6hZCnv3dg+fI5RBw3kVRLKzndNDUh/Q35f8fBTjEVM=; b=lTn9g8TmGNt1pIteWrIRkfrJ/wOMQqKTjMGGxKTNnD7N+AaFAKme0FPmwyj5UA8jJr6+I83GSuHDbB8bdwIqiX0SN/wyUK9NOx15xRSw+lV6wOrj0zE+n131ZdwozXo+LhIwD1djLJrkeaSrfxeuxCMX3dAeimyL1EVtcyty12e9kZmeTq0ae1e8ZWPLr5mG+dMj05OBBnjxF8nuf0/tb/LqOCoxZowm7WUDnSllq70dRrY9YwX7P2KSHtPjCiX9PqcvR1JzDTyKSKVM7v3qxLayf5508SN0phldaCZhO5gY6jfgHpZ5447KWvSQYUAj9sSXX4jewfzsePwPBLxu4g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from PH8PR11MB8107.namprd11.prod.outlook.com (2603:10b6:510:256::6) by IA1PR11MB7678.namprd11.prod.outlook.com (2603:10b6:208:3f4::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.21; Wed, 10 Jan 2024 20:41:22 +0000 Received: from PH8PR11MB8107.namprd11.prod.outlook.com ([fe80::6257:f90:c7dd:f0b2]) by PH8PR11MB8107.namprd11.prod.outlook.com ([fe80::6257:f90:c7dd:f0b2%4]) with mapi id 15.20.7181.015; Wed, 10 Jan 2024 20:41:22 +0000 Date: Wed, 10 Jan 2024 12:41:17 -0800 From: Dan Williams To: Lukas Wunner , 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 , , , , , , , , "Bartosz Golaszewski" Subject: Re: [RFC 3/9] PCI/portdrv: create platform devices for child OF nodes Message-ID: <659f00ed271b3_5cee2942@dwillia2-xfh.jf.intel.com.notmuch> References: <20240104130123.37115-1-brgl@bgdev.pl> <20240104130123.37115-4-brgl@bgdev.pl> <20240109144327.GA10780@wunner.de> <20240110132853.GA6860@wunner.de> Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20240110132853.GA6860@wunner.de> X-ClientProxiedBy: MW2PR16CA0001.namprd16.prod.outlook.com (2603:10b6:907::14) To PH8PR11MB8107.namprd11.prod.outlook.com (2603:10b6:510:256::6) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH8PR11MB8107:EE_|IA1PR11MB7678:EE_ X-MS-Office365-Filtering-Correlation-Id: 6369179d-9efb-4eee-f92a-08dc121c81a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: p524JGEwFSS2uHxKmuFSyqimT7zAyPY8tLoHD/cFs83sOUyLgZngMed10qNrbE4qHc+VJuFds0300I4cSkry64wrjdvmP26tmIxMX8t78RVW6FTXEp3OCNZUl+8Dl0o+5Mo63E9vlx+0Sv3n8JT9Z9h9csYSESyGqVlWuJ3O+OT+CXmgYqKN4B3l5cBsPgenV5hIMZqQjaOcRiL1IlSjR22BMsIH6cwNk+daOPc9hDPKeO3EsZu5VR9l6/RgWIdenNZuRm7iAXX39jgobRW3KarrdObyCGEzJU8VGNZhMmRp4latG1spI9Kr/NLCPmcHrxxek/E9nlt/cAax57/RgtqQJyERW0uqI63txRYoCRNcBLENty1++XCVa7oZ1dihEYOt+00dP+m85zfvKyNfRzQOx0heckAuWMHti+kwdx1L7Q5AwlsG78uYSm/uBAGwsoGtHhIenNMAV0xuQSUMlPGjC3t91135c9RASIj0SgyMA6nYkq+JJQJhOBzp3HY9RCgLsXMbiEeCTDt4gpMwS7NR1wkCTTe934iw/p5QBsM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR11MB8107.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(376002)(396003)(346002)(39860400002)(366004)(230922051799003)(451199024)(1800799012)(64100799003)(186009)(478600001)(6506007)(966005)(6486002)(26005)(9686003)(6666004)(6512007)(7416002)(66476007)(316002)(83380400001)(41300700001)(2906002)(66946007)(5660300002)(4326008)(8936002)(110136005)(8676002)(54906003)(66556008)(86362001)(38100700002)(82960400001)(7406005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?OUkq4zuUmoXIShFbM6OuObXnRqokWY8iG1wKStMKxlJnCFzLmri9D8eAdVcx?=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oeCpcJrbqYDkESXzfJFM3NLSUSHsbe?= =?us-ascii?Q?exlIo2F8Pugmh5gJp25de5iGAgsHKtnXlLHwmmKpUY8iD9rp5Vu542/n2mTP?= =?us-ascii?Q?9zt/OnTeBJ2saUpmEiXOxNMBPZS6F1fvRQ0/IYFOqvHcKpzbQOvgFV4B0vPX?= =?us-ascii?Q?OcKOPJWTWEcGUyd2doPx/nrYtlSFUuvnHA3CaaeGZsdMIe3zzyEtkjUswFDc?= =?us-ascii?Q?S17aXN9q+NoqladvhFLg9awFkVM5Hip/V85OdB7d+Rc2zXzQPEfqMq8n0D+m?= =?us-ascii?Q?XrK1U2hiypWoKZ+E9TFu2rdvYSiOkE5Tm9cEFNsR1aqruVwMGeknZpY0SFVY?= =?us-ascii?Q?KTWpy69zRvnqFLqozK2dcRADGrviNbRxBLtRQXItWwzasCrBi1qA+V++Lf4j?= =?us-ascii?Q?wi5ZtWdDiKYbHCxWENhmJx/HGB5S5huwIu2i1ZD9TspEjbVPV+P14OOr3hKa?= =?us-ascii?Q?uYwd9KI9FkAP14dRx1XbZ7FeJVe6cY1JyaxnuNV5jwvM0YLxYUiaPfFRvNuX?= =?us-ascii?Q?pXn469V7S0NPnUg/ZBFiJrdFtOlgDRs45lzdazzvb5iGy3QDAoMf+oX42856?= =?us-ascii?Q?2wHxH5nWtrqs5Cp+Xzk5JKbCjlnv50gC9HRzMwKN/jqg5o1yclwCUErJuS0K?= =?us-ascii?Q?eMp5dlt3dxo6SjIItoD0sVpRiKFqLOAdUrgU4uqTWMhNwYFFjTML3f1y6dzd?= =?us-ascii?Q?wQ=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 6369179d-9efb-4eee-f92a-08dc121c81a2 X-MS-Exchange-CrossTenant-AuthSource: PH8PR11MB8107.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 20:41:22.4522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UMgbOgl7lgfXWezTYZtX6Mp6rQowgBZRqFhuSApoHiCPASKMnvS2Lm9UOxqIfshoNLNjMCv1g5dHS7XffY9DGAKCjDK3NnKhvj6+HN0lz5I= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR11MB7678 X-OriginatorOrg: intel.com [ 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 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