All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "John Garry" <john.garry@arm.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [RFC PATCH] PCI: Avoid bus reset for Realtek RTL8126
Date: Wed, 04 Nov 2026 17:28:17 +0000	[thread overview]
Message-ID: <sashiko-outbox-197764@kernel.org> (raw)
In-Reply-To: <20261103172758.1816004-1-john.garry@arm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] PCI: quirk_no_bus_reset() with DECLARE_PCI_FIXUP_FINAL runs too late
--

commit 6a48b331f38758a39c2143e3a32823e61b24d0c5
Author: John Garry <john.garry@arm.com>

PCI: Avoid bus reset for Realtek RTL8126

This commit adds a quirk_no_bus_reset() fixup for the Realtek RTL8126
(0x8126) PCI device to avoid bus-level resets that may fail to recover.

> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index fb3c5d517f91e..8346d223886a6 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -3850,6 +3850,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ASMEDIA, 0x1164, quirk_no_bus_reset);
>  /* Intel DG1 0x4905 may not recover from bus reset */
>  DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0x4905, quirk_no_bus_reset);
>  
> +/* Realtek RTL8126 may not recover from a bus reset */
> +DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_REALTEK, 0x8126, quirk_no_bus_reset);

[Severity: Medium]
Should this use DECLARE_PCI_FIXUP_HEADER instead of
DECLARE_PCI_FIXUP_FINAL, matching the other quirk_no_bus_reset() entries?

During PCI enumeration in drivers/pci/probe.c, pci_device_add() runs header
fixups before probing and caching supported reset methods and registering
the device:

drivers/pci/probe.c:pci_device_add() {
	/* Fix up broken headers */
	pci_fixup_device(pci_fixup_header, dev);

	pci_reassigndev_resource_alignment(dev);

	pci_init_capabilities(dev);
		-> pci_init_reset_methods(dev);
	...
	ret = device_add(&dev->dev);
		-> pci_dev_reset_attr_is_visible()
}

Final fixups do not run until later in drivers/pci/bus.c:

drivers/pci/bus.c:pci_bus_add_device() {
	pci_fixup_device(pci_fixup_final, dev);
	...
}

Because PCI_DEV_FLAGS_NO_BUS_RESET is not set on dev->dev_flags when
pci_init_reset_methods() probes pci_reset_bus_function(), the bus reset
method still succeeds during probing and is recorded in
dev->reset_methods[].

As a result, when a Realtek RTL8126 is enumerated, reset_method in sysfs
still advertises bus, pci_dev_reset_attr_is_visible() still exposes the
reset attribute via pci_reset_supported() even when bus is the only reset
method, and calling pci_reset_function() still runs
pci_dev_save_and_disable() and pci_dev_restore() before
__pci_reset_function_locked() fails with -ENOTTY.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103172758.1816004-1-john.garry@arm.com?part=1

      reply	other threads:[~2026-11-04 17:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 17:27 [RFC PATCH] PCI: Avoid bus reset for Realtek RTL8126 John Garry
2026-11-04 17:28 ` sashiko-bot [this message]

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-197764@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=john.garry@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.