Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1753970rdd; Thu, 11 Jan 2024 08:17:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IEcwjXuYPxhzKVsc5kV+H33KFl0G5QFfO6F9YCc6aRGYEv3NJ4j57c0Wd/BBfFpuWUzfl+D X-Received: by 2002:a05:6359:660e:b0:170:9559:4ffb with SMTP id sm14-20020a056359660e00b0017095594ffbmr66376rwb.8.1704989838404; Thu, 11 Jan 2024 08:17:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704989838; cv=none; d=google.com; s=arc-20160816; b=iLrw+aFz1J74JmcXBTNTGisnpKNEH3VbJSQRZpt1E/L2ymYZ9idwKbMaLpYOVdfOLm oq1N9SeojjsWugsZzGQUuENQEIATEpnwZoklJDEXiCuEHeZ7AkjGkzo3NLL6IdHGuajz +X78iAk4Qtlz4F2HD3BbeheBXsCv/7vSeE7etTgrJIY7FsEXLJ20mIXjwwvpiyLorEyR 6F+Itcs0KDJiawkKeQr9tWQpRPKTAgeciXVtNiWDDpTFLYR/+K9h07O/U0pYHAMzGlS4 xVFL8r0nhDInO6qbgnaPmS8GUMa04l3OyYw4dNUus87MWmRuRkM320yzJ6BypeY7qyXT KcLA== 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=M0L8Io9WOaU9zuxGb3WJPoQE4gX/uTxUJ5wFQjECB/w=; fh=Ou2sfbatsjTy48V6fnteK8lVgKixen5XgSBvOE4W8KA=; b=AnBwKD2gvOqWi7NlLO66F2t7QjBGB3MoIRasOkST5yok14j+bJvjvad3hJLssf8NIn CHQBbpMcTVw4sF92nHo1kR7ozrYb0PkWdJArsdmdhmSMTsvoqRARCu1BfJfEr4cyhR1e TMOV5BCJa1zgitTKytDrTgTELc428rFzIzSD+ggScdcuGpKIOQ8evkpWDuJ7NLDjpZcI zGA8PPNUw1Hxnvy5hT7fkSWXoz2CqyzOXLSnChaCyQqZj91nYKfdkZkz2YNwP2TSDCw5 OLV7TaosR6LTuo/WkzI1pT1JJc6ysw0++k1ttT2o8HW4XinFPzAxHR5RSV7NxJ+hz7om B7/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=B2scXr+O; spf=pass (google.com: domain of linux-wireless+bounces-1725-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1725-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id l5-20020a635b45000000b005c278ba0fe3si1371646pgm.556.2024.01.11.08.17.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 08:17:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1725-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=B2scXr+O; spf=pass (google.com: domain of linux-wireless+bounces-1725-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1725-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0BFE828742A for ; Thu, 11 Jan 2024 16:17:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3D8F950246; Thu, 11 Jan 2024 16:16:59 +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="B2scXr+O" X-Original-To: linux-wireless@vger.kernel.org Received: from mail-oi1-f172.google.com (mail-oi1-f172.google.com [209.85.167.172]) (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 B25FF4F8A0 for ; Thu, 11 Jan 2024 16:16:57 +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-oi1-f172.google.com with SMTP id 5614622812f47-3bbbc6b4ed1so3776394b6e.2 for ; Thu, 11 Jan 2024 08:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1704989817; x=1705594617; 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=M0L8Io9WOaU9zuxGb3WJPoQE4gX/uTxUJ5wFQjECB/w=; b=B2scXr+OKXWnyIR11WNhHl4HnA8sstMVDe5KXjsz/WyqmtmiCB38/AajhI34/s5Zb9 Crd5F7aju81hDfjiQs+5gnq8UaWJuK/n9TMraE4vEh1Gg5y78E8xiB6l/bzcuaj6Z/Pe 61NPE+Ye0I1ppuwtjod6jxvhHhni9e0TQ+nS9EYK7hTq3mTgGw0XrUMos3m0A5CEkB4I O5wuseypKGTGN3TfA2ZpwDrwE/u3wp/tN/3GKybqgdFvgUbjXUC8OGD1lb2YFc7MaUw9 FQYj33p0Wbhbc3fD8yR+tymfYdCD7U5vjcov6VvolmJkaMthF5PkY8/G/jv1jGWet1CB I4LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704989817; x=1705594617; 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=M0L8Io9WOaU9zuxGb3WJPoQE4gX/uTxUJ5wFQjECB/w=; b=DNIwx1jME1exbjL4oI3KOnHL7s6lpefIqVS8LC3UuAR13VSRuQKFzUctUzMr06IW1s Am+t1c++zqW4VzkeX5cpfQOrbJn6REmFWFN73/onRnfhuOMHI0Hi8ks8qp9AU4LM2f53 a6bskjSeX/zOmEOgwmarmcyISADm07V8a94fOD1VdLtZ28dwOcQivxZsBmtFmggyn4r+ +ZA1SKlge3m2yEZd3GPWsEG374DleQgylj4iMd9B3o+O3MJg67NsGnzGpIw45o+d5OUO OVk/m/reX/sOdMPgMkRGcFOAv0QbX6lLIcXB7vlut8xe2KWZpU0/LjIvdorg8llsvxSL nltQ== X-Gm-Message-State: AOJu0YyqIfGR7LWfU1GNSbIylJS+xA05jmd11Hhvx+dMyvIQ52qw7XVd rz6NR2ARiLTTsgKOc9cPElsPba1OT8hEUz3u7iIhmTkZS5nspQ== X-Received: by 2002:a05:6808:1289:b0:3bd:3e96:a8ab with SMTP id a9-20020a056808128900b003bd3e96a8abmr1572401oiw.53.1704989816773; Thu, 11 Jan 2024 08:16:56 -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> <20240110164105.GA13451@wunner.de> <20240111104211.GA32504@wunner.de> <20240111150201.GA28409@wunner.de> In-Reply-To: <20240111150201.GA28409@wunner.de> From: Bartosz Golaszewski Date: Thu, 11 Jan 2024 17:16:45 +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 Thu, Jan 11, 2024 at 4:02=E2=80=AFPM Lukas Wunner wrot= e: > > 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 s= aid: > > >> > On Wed, Jan 10, 2024 at 05:26:52PM +0100, Bartosz Golaszewski wrot= e: > > >> > > 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 questio= n? > > > > # 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@1c0000= 0/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: > No, it was actually a no-op due to CONFIG_PCI_DYNAMIC_OF_NODES not being set. But this is only available if CONFIG_OF_DYNAMIC is enabled which requires OF_UNITTEST (!). We definitely don't need to enable dynamic OF nodes. We don't want to modify the DT, we want to create devices for existing nodes. Also: with the approach in this RFC we maintain a clear hierarchy of devices with the port device being the parent of the power sequencing device which becomes the parent of the actual PCIe device (the port stays the parent of this device too). Bartosz > /* > * 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