From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Rob Herring" <robh+dt@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
"Conor Dooley" <conor+dt@kernel.org>,
cros-qcom-dts-watchers@chromium.org,
linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Subject: Re: [PATCH v2 01/21] arm64: dts: qcom: sm8250: Add PCIe bridge node
Date: Sun, 19 Jan 2025 20:55:34 +0530 [thread overview]
Message-ID: <20250119152534.d6berucbb2wbbi3z@thinkpad> (raw)
In-Reply-To: <20250115181340.GA539092@bhelgaas>
On Wed, Jan 15, 2025 at 12:13:40PM -0600, Bjorn Helgaas wrote:
> On Wed, Jan 15, 2025 at 11:29:18PM +0530, Manivannan Sadhasivam wrote:
> > On Wed, Jan 15, 2025 at 11:42:10AM -0600, Bjorn Helgaas wrote:
> > > On Wed, Jan 15, 2025 at 04:24:31PM +0530, Manivannan Sadhasivam wrote:
> > > > On Mon, Jan 06, 2025 at 05:07:05PM -0600, Bjorn Helgaas wrote:
> > > > > On Sun, Jan 05, 2025 at 03:46:12PM +0530, Manivannan Sadhasivam wrote:
> > > > > > On Fri, Jan 03, 2025 at 03:05:31PM -0600, Bjorn Helgaas wrote:
> > > > > > > On Thu, Mar 21, 2024 at 04:46:21PM +0530, Manivannan Sadhasivam wrote:
> > > > > > > > On Qcom SoCs, the PCIe host bridge is connected to a single PCIe bridge
> > > > > > > > for each controller instance. Hence, add a node to represent the bridge.
> > > > > > > >
> > > > > > > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > > > > > > > ---
> > > > > > > > arch/arm64/boot/dts/qcom/sm8250.dtsi | 30 ++++++++++++++++++++++++++++++
> > > > > > > > 1 file changed, 30 insertions(+)
> > > > > > > >
> > > > > > > > diff --git a/arch/arm64/boot/dts/qcom/sm8250.dtsi b/arch/arm64/boot/dts/qcom/sm8250.dtsi
> > > > > > > > index 39bd8f0eba1e..fe5485256b22 100644
> > > > > > > > --- a/arch/arm64/boot/dts/qcom/sm8250.dtsi
> > > > > > > > +++ b/arch/arm64/boot/dts/qcom/sm8250.dtsi
> > > > > > > > @@ -2203,6 +2203,16 @@ pcie0: pcie@1c00000 {
> > > > > > > > dma-coherent;
> > > > > > > >
> > > > > > > > status = "disabled";
> > > > > > > > +
> > > > > > > > + pcie@0 {
> > > > > > > > + device_type = "pci";
> > > > > > > > + reg = <0x0 0x0 0x0 0x0 0x0>;
> > > > > > > > + bus-range = <0x01 0xff>;
> > > > > > >
> > > > > > > Hi Mani, most or all of the patches in this series add this
> > > > > > > "bus-range" property. IIUC, these are all Root Ports and hence the
> > > > > > > secondary/subordinate bus numbers should be programmable.
> > > > > >
> > > > > > Right. It is not a functional dependency.
> > > > > >
> > > > > > > If that's the case, I don't think we need to include "bus-range" in DT
> > > > > > > for them, do we?
> > > > > >
> > > > > > We mostly include it to silence the below bindings check for the
> > > > > > endpoint device node:
> > > > > >
> > > > > > Warning (pci_device_bus_num): /soc@0/pcie@1c00000/pcie@0/wifi@0: PCI bus number 1 out of range, expected (0 - 0)
> > > > > >
> > > > > > DTC check is happy if the 'bus-range' property is absent in the
> > > > > > bridge node. But while validating the endpoint node (if defined), it
> > > > > > currently relies on the parent 'bus-range' property to verify the
> > > > > > bus number provided in the endpoint 'reg' property.
> > > > > >
> > > > > > I don't know else the check can verify the correctness of the
> > > > > > endpoint bus number. So deferring to Rob here.
> > > > >
> > > > > I should know more about how this works in DT, but I don't.
> > > > >
> > > > > I guess https://git.kernel.org/linus/83d2a0a1e2b9 ("arm64: dts: qcom:
> > > > > sm8250: Add PCIe bridge node") added this (subsequently renamed to
> > > > > "pcieport0"):
> > > > >
> > > > > + pcie@0 {
> > > > > + device_type = "pci";
> > > > > + reg = <0x0 0x0 0x0 0x0 0x0>;
> > > > > + bus-range = <0x01 0xff>;
> > > > >
> > > > > which is used at places like
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/boot/dts/qcom/qrb5165-rb5.dts?id=v6.12#n788:
> > > > >
> > > > > &pcieport0 {
> > > > > wifi@0 {
> > > > > compatible = "pci17cb,1101";
> > > > > reg = <0x10000 0x0 0x0 0x0 0x0>;
> > > > >
> > > > > Based on
> > > > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/pci/pci.txt?id=v6.12#n46
> > > > > (which is written for Root Ports and Switch Ports, but presumably
> > > > > applies to endpoints like wifi as well), "reg" contains the device's
> > > > > bus/device/function:
> > > > >
> > > > > - reg:
> > > > > Identifies the PCI-PCI bridge. As defined in the IEEE Std 1275-1994
> > > > > document, it is a five-cell address encoded as (phys.hi phys.mid
> > > > > phys.lo size.hi size.lo). phys.hi should contain the device's BDF as
> > > > > 0b00000000 bbbbbbbb dddddfff 00000000. The other cells should be zero.
> > > > >
> > > > > So 0x10000 would decode to 01:00.0, which matches the <1 1> bus-range.
> > > > >
> > > > > I don't know the reason for requiring the BDF there, but the venerable
> > > > > https://www.devicetree.org/open-firmware/bindings/pci/pci2_1.pdf, sec
> > > > > 4.1.1, says "reg" is mandatory for PCI Child Nodes, and the first
> > > > > entry must be the config space address (bus/device/function).
> > > > >
> > > > > I suppose maybe the BDF is needed to associate the properties with the
> > > > > correct device, and if the OS were to reprogram the bridge secondary
> > > > > bus number, it would have to remember the original value to preserve
> > > > > this association. I don't think Linux *does* remember that, but it
> > > > > also generally leaves the bridge bus numbers alone.
> > > >
> > > > Device drivers need to parse the properties defined in the device DT
> > > > node. And the only way to identify the node is by using its 'reg'
> > > > property which has the BDF identifier. This is common to other
> > > > busses where the device address is encoded in the 'reg' property.
> > >
> > > Does this assume there is some firmware to configure these bridges
> > > before Linux boots?
> >
> > No.
> >
> > > If bridges are completely unconfigured after
> > > power-on, their secondary and subordinate bus numbers will be zero, so
> > > a bus-range property for the bridge can only be an assumption about
> > > what Linux will do.
> >
> > Secondary bus number for sure is not an assumption as it depends on
> > the hardware topology which linux would know from DT. But
> > subordinate number could be considered as an assumption.
>
> If there's no firmware and the secondary bus number is 0 when Linux
> enumerates the bridge, does Linux know how to get the bus-range from
> DT and program the bridge's secondary bus?
>
Linux doesn't seem to make use of the secondary bus number from DT node of a
bridge, but there is no guarantee that other OSes making use of DT won't do.
> And does Linux know how to update the subordinate bus number in the
> case where several Root Ports specify 0xff in bus-range?
>
Same answer as above.
- Mani
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2025-01-19 15:25 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-21 11:16 [PATCH v2 00/21] Add PCIe bridge node in DT for Qcom SoCs Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 01/21] arm64: dts: qcom: sm8250: Add PCIe bridge node Manivannan Sadhasivam
2025-01-03 21:05 ` Bjorn Helgaas
2025-01-05 10:16 ` Manivannan Sadhasivam
2025-01-06 23:07 ` Bjorn Helgaas
2025-01-15 10:54 ` Manivannan Sadhasivam
2025-01-15 17:42 ` Bjorn Helgaas
2025-01-15 17:59 ` Manivannan Sadhasivam
2025-01-15 18:13 ` Bjorn Helgaas
2025-01-19 15:25 ` Manivannan Sadhasivam [this message]
2025-01-21 23:11 ` Bjorn Helgaas
2025-01-28 13:45 ` Manivannan Sadhasivam
2025-01-28 16:16 ` Bjorn Helgaas
2025-02-07 16:53 ` Manivannan Sadhasivam
2025-07-15 21:59 ` Rob Herring
2024-03-21 11:16 ` [PATCH v2 02/21] arm64: dts: qcom: sdm845: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 03/21] arm64: dts: qcom: sm8150: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 04/21] arm64: dts: qcom: sm8350: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 05/21] arm64: dts: qcom: sm8450: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 06/21] arm64: dts: qcom: sm8550: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 07/21] arm64: dts: qcom: sm8650: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 08/21] arm64: dts: qcom: sa8775p: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 09/21] arm64: dts: qcom: sc8280xp: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 10/21] arm64: dts: qcom: msm8998: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 11/21] arm64: dts: qcom: sc7280: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 12/21] arm64: dts: qcom: qcs404: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 13/21] arm64: dts: qcom: sc8180x: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 14/21] arm64: dts: qcom: msm8996: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 15/21] arm64: dts: qcom: ipq8074: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 16/21] arm64: dts: qcom: ipq6018: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 17/21] ARM: dts: qcom: ipq8064: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 18/21] ARM: dts: qcom: ipq4019: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 19/21] ARM: dts: qcom: apq8064: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 20/21] ARM: dts: qcom: sdx55: " Manivannan Sadhasivam
2024-03-21 11:16 ` [PATCH v2 21/21] arm64: dts: qcom: sm8650: Use "pcie" as the node name instead of "pci" Manivannan Sadhasivam
2024-03-23 0:11 ` [PATCH v2 00/21] Add PCIe bridge node in DT for Qcom SoCs Konrad Dybcio
2024-04-21 22:29 ` (subset) " Bjorn Andersson
2024-05-27 3:00 ` Bjorn Andersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250119152534.d6berucbb2wbbi3z@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=cros-qcom-dts-watchers@chromium.org \
--cc=devicetree@vger.kernel.org \
--cc=helgaas@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nfraprado@collabora.com \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox