Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Cui Chao" <cuichao1753@phytium.com.cn>
Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: PCI: Add linux,pci-domain-reuse property
Date: Mon, 02 Nov 2026 09:58:32 +0000	[thread overview]
Message-ID: <sashiko-outbox-193224@kernel.org> (raw)
In-Reply-To: <20261102095150.2370959-2-cuichao1753@phytium.com.cn>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: PCI: redundant linux,pci-domain-reuse OS-policy property
--

commit 4d7d1f09f7c3c39f32142c31f5a0c2f23d8b30fc
Author: Cui Chao <cuichao1753@phytium.com.cn>

dt-bindings: PCI: Add linux,pci-domain-reuse property

This commit adds an optional boolean property linux,pci-domain-reuse to the
generic PCI host bridge Device Tree binding so that multiple host bridges with
disjoint resources can share the same software PCI domain number.

> diff --git a/Documentation/devicetree/bindings/pci/host-generic-pci.yaml b/Documentation/devicetree/bindings/pci/host-generic-pci.yaml
> index 420d551e9af97..1b439e2f38af7 100644
> --- a/Documentation/devicetree/bindings/pci/host-generic-pci.yaml
> +++ b/Documentation/devicetree/bindings/pci/host-generic-pci.yaml
> @@ -114,6 +114,16 @@ properties:
>        Requests with Address Type (AT).
>      type: boolean
>  
> +  linux,pci-domain-reuse:
> +    description:
> +      Boolean indicating that this host bridge is allowed to reuse the same
> +      "linux,pci-domain" value as another host bridge on the platform. Host
> +      bridges reusing the same domain must have disjoint ECAM, bus-range,
> +      memory, and IO windows so that (domain, bus) tuples remain globally
> +      unique. A duplicate domain on a host bridge without this property
> +      remains an error.
> +    type: boolean

[Severity: Medium]
Is a new Device Tree property needed here when the hardware topology of
multiple host bridges sharing a domain with disjoint bus ranges is already
fully described by setting the same linux,pci-domain alongside disjoint
bus-range, reg, and ranges properties?

In the PCI core, pci_register_host_bridge() in drivers/pci/probe.c already
tracks per-domain bus number resources via get_pci_domain_busn_res() and
pci_bus_insert_busn_res(), and rejects conflicting (domain, busnr) tuples:

drivers/pci/probe.c:pci_register_host_bridge() {
    ...
	b = pci_find_bus(pci_domain_nr(bus), bridge->busnr);
	if (b) {
		/* Ignore it if we already got here via a different bridge */
		dev_dbg(&b->dev, "bus already known\n");
		err = -EEXIST;
		goto free;
	}
    ...
}

The only reason duplicate linux,pci-domain values currently fail in Device
Tree is that of_pci_bus_find_domain_nr() in drivers/pci/pci.c unconditionally
allocates static DT domain numbers from pci_domain_nr_static_ida:

drivers/pci/pci.c:of_pci_bus_find_domain_nr() {
    ...
		domain_nr = of_get_pci_domain_nr(parent->of_node);
		if (domain_nr >= 0)
			return ida_alloc_range(&pci_domain_nr_static_ida,
					       domain_nr, domain_nr,
					       GFP_KERNEL);
    ...
}

Could the kernel distinguish valid multi-bridge domain sharing (disjoint
bus-range) from accidental DT duplication (overlapping bus-range) directly
using existing DT properties, rather than introducing a Linux-specific policy
property in the binding ABI?

Also, if a binding property were used, shouldn't it live in
Documentation/devicetree/bindings/pci/pci-host-bridge.yaml where
linux,pci-domain is defined (and parsed by generic OF PCI code in
drivers/pci/pci.c), rather than only in host-generic-pci.yaml?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261102095150.2370959-1-cuichao1753@phytium.com.cn?part=1

  reply	other threads:[~2026-11-02  9:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02  9:51 [RFC PATCH 0/2] Allow reusing PCI domain numbers in DT Cui Chao
2026-11-02  9:51 ` [PATCH 1/2] dt-bindings: PCI: Add linux,pci-domain-reuse property Cui Chao
2026-11-02  9:58   ` sashiko-bot [this message]
2026-11-02 10:00   ` Krzysztof Kozlowski
2026-11-03  2:57     ` Cui Chao
2026-11-02  9:51 ` [PATCH 2/2] PCI: Allow reusing PCI domain numbers in DT Cui Chao
2026-11-02 10:02   ` sashiko-bot

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=sashiko-outbox-193224@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=cuichao1753@phytium.com.cn \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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