Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org,
	linux-pci@vger.kernel.org
Subject: Re: [PATCH v2 04/16] PCI: Consistently use Header Type to detect bridge headers
Date: Sat, 05 Dec 2026 01:04:39 +0000	[thread overview]
Message-ID: <sashiko-outbox-250880@kernel.org> (raw)
In-Reply-To: <20261205003957.3304-5-ilpo.jarvinen@linux.intel.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] PCI: Header Type bridge release conflicts with
  pdev_resources_assignable()
--

commit 41cfb3d22724c17ea21af1abcdf645f81bdde152
Author: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

PCI: Consistently use Header Type to detect bridge headers

This commit updates pci_claim_bridge_resource(),
__pci_bridge_assign_resources(), and pci_bus_release_bridge_resources() to
check hdr_type instead of class when identifying PCI and CardBus bridges.

> diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c
> index c18664b5e5a25..cf062a9ac9a93 100644
> --- a/drivers/pci/setup-bus.c
> +++ b/drivers/pci/setup-bus.c
> @@ -948,7 +948,7 @@ int pci_claim_bridge_resource(struct pci_dev *bridge, int i)
>  	if (pci_claim_resource(bridge, i) == 0)
>  		return 0;	/* Claimed the window */
>  
> -	if ((bridge->class >> 8) != PCI_CLASS_BRIDGE_PCI)
> +	if (bridge->hdr_type != PCI_HEADER_TYPE_BRIDGE)
>  		return 0;
>  
>  	if (i > PCI_BRIDGE_PREF_MEM_WINDOW)
> @@ -1636,12 +1636,12 @@ static void __pci_bridge_assign_resources(struct pci_dev *bridge,
>  
>  	__pci_bus_assign_resources(b, add_list, fail_head);
>  
> -	switch (bridge->class >> 8) {
> -	case PCI_CLASS_BRIDGE_PCI:
> +	switch (bridge->hdr_type) {
> +	case PCI_HEADER_TYPE_BRIDGE:
>  		pci_setup_bridge(b);
>  		break;
>  
> -	case PCI_CLASS_BRIDGE_CARDBUS:
> +	case PCI_HEADER_TYPE_CARDBUS:
>  		pci_setup_cardbus_bridge(b);
>  		break;
>  
> @@ -1701,7 +1701,7 @@ static void pci_bus_release_bridge_resources(struct pci_bus *bus,
>  
>  		is_leaf_bridge = false;
>  
> -		if ((dev->class >> 8) != PCI_CLASS_BRIDGE_PCI)
> +		if (dev->hdr_type != PCI_HEADER_TYPE_BRIDGE)
>  			continue;
>  
>  		if (rel_type != whole_subtree)
> @@ -1718,7 +1718,7 @@ static void pci_bus_release_bridge_resources(struct pci_bus *bus,
>  	if (pci_is_root_bus(bus))
>  		return;
>  
> -	if ((bus->self->class >> 8) != PCI_CLASS_BRIDGE_PCI)
> +	if (bus->self->hdr_type != PCI_HEADER_TYPE_BRIDGE)
>  		return;
>  
>  	if ((rel_type == whole_subtree) || is_leaf_bridge)

[Severity: High]
Can this permanently disable bridge windows on Type 1 bridges that
pdev_resources_assignable() skips?

pdev_resources_assignable() still filters by Class Code, returning false for
PCI_CLASS_NOT_DEFINED, PCI_CLASS_BRIDGE_HOST, and firmware-enabled
PCI_CLASS_SYSTEM_PIC devices.  During a retry,
pci_bus_release_bridge_resources() now releases and disables their windows.

On the next round, pdev_sort_resources() skips bus->self because
pdev_resources_assignable() is false, so the window is never reassigned and
downstream devices are stranded.

With add_list enabled, __pci_bus_size_bridges() still queues the window on
add_list, which pdev_sort_resources() leaves unconsumed and triggers
WARN_ON_ONCE(add_list && !list_empty(add_list)).

Similarly, __pci_bridge_assign_resources() now calls pci_setup_bridge() on
bridges skipped by pdev_assign_resources_sorted(), and
pci_claim_bridge_resource() clips and reprograms windows that
pdev_resources_assignable() refuses to manage.

Should these paths also check pdev_resources_assignable(), or should
pdev_resources_assignable() be aligned with Header Type handling?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205003957.3304-1-ilpo.jarvinen@linux.intel.com?part=4

  reply	other threads:[~2026-12-05  1:04 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05  0:39 [PATCH v2 00/16] PCI: Resource release fixes and improvements Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 01/16] PCI: Release all resources before restoring them in BAR resize rollback Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 02/16] PCI: Set new BAR Size only after releasing the BARs for BAR resize Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 03/16] PCI: Abort BAR resize only if saving the resized BAR fails Ilpo Järvinen
2026-12-05  1:04   ` sashiko-bot
2026-12-05  1:25     ` Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 04/16] PCI: Consistently use Header Type to detect bridge headers Ilpo Järvinen
2026-12-05  1:04   ` sashiko-bot [this message]
2026-12-05  0:39 ` [PATCH v2 05/16] resource: Check that the resource is in the tree when releasing it Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 06/16] resource, kunit: Add test for releasing a resource not in the tree Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 07/16] resource: Add release_leaf_resource() Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 08/16] resource, kunit: Add test for release_leaf_resource() Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 09/16] PCI: Do not release resources with children in pci_release_resource() Ilpo Järvinen
2026-12-05  1:04   ` sashiko-bot
2026-12-05  1:29     ` Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 10/16] resource: Rename next_resource() and for_each_resource() Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 11/16] resource: Make resource_lock and resource tree traversal available Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 12/16] resource: Add release_resource_locked() Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 13/16] PCI: Split pci_resource_post_release() out of pci_release_resource() Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 14/16] PCI: Add iterators for devices and resources in bus windows Ilpo Järvinen
2026-12-05  1:02   ` sashiko-bot
2026-12-05  1:12     ` Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 15/16] PCI: Keep the range of fixed resources when releasing them Ilpo Järvinen
2026-12-05  0:39 ` [PATCH v2 16/16] PCI: Release only PCI resources when releasing a resource tree Ilpo Järvinen
2026-12-05  1:11   ` sashiko-bot
2026-12-05  1:57     ` Ilpo Järvinen
2026-12-05  0:50 ` ✗ CI.checkpatch: warning for PCI: Resource release fixes and improvements (rev2) Patchwork
2026-12-05  0:52 ` ✓ CI.KUnit: success " Patchwork
2026-12-05  1:27 ` ✓ Xe.CI.BAT: " Patchwork

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-250880@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=linux-pci@vger.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