Linux PCI subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Manivannan Sadhasivam" <manivannan.sadhasivam@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH v9 2/5] PCI/ERR: Add support for resetting the Root Ports in a platform specific way
Date: Wed, 29 Jul 2026 05:07:48 +0000	[thread overview]
Message-ID: <20260729050748.DCE2E1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260729-pci-port-reset-v9-2-53570b92064d@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] The Root Port configuration space is restored without being saved before the platform-specific reset, leading to permanent loss of runtime configuration changes.
--

--- Patch [2]: [PATCH v9 2/5] PCI/ERR: Add support for resetting the Root Ports in a platform specific way ---
commit 2b1b6bf7dae47cb5b5ce9a84251ceb7b5b08de2c
Author: Manivannan Sadhasivam <mani@kernel.org>
PCI/ERR: Add support for resetting the Root Ports in a platform specific way

This commit introduces a reset_root_port callback in struct pci_host_bridge
to allow platform-specific root port resets during error recovery. It
modifies pcibios_reset_secondary_bus() to invoke this callback if available.
The commit message states that it will save the Root Port config space before
the reset and restore it afterwards.

> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 77b17b13ee615..12e099489690b 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -4841,6 +4841,19 @@ void pci_reset_secondary_bus(struct pci_dev *dev)
>  
>  void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
>  {
> +	struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
> +	int ret;
> +
> +	if (pci_is_root_bus(dev->bus) && host->reset_root_port) {
> +		ret = host->reset_root_port(host, dev);
> +		if (ret)
> +			pci_err(dev, "Failed to reset Root Port: %d\n", ret);
> +		else
> +			pci_restore_state(dev);

[Severity: High]
The commit message states "save the Root Port config space before reset and
restore it afterwards". However, is a call to pci_save_state(dev) missing
before the call to host->reset_root_port()?

Calling pci_restore_state(dev) here without a preceding save operation could
restore a stale configuration saved at boot or during the last suspend. Can
this lead to the permanent loss of runtime configuration changes on the Root
Port, such as ASPM link states, dynamic AER masks, or Max Payload Size
adjustments?

> +
> +		return;
> +	}
> +
>  	pci_reset_secondary_bus(dev);
>  }

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260729-pci-port-reset-v9-0-53570b92064d@oss.qualcomm.com?part=2

  reply	other threads:[~2026-07-29  5:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  4:52 [PATCH v9 0/5] PCI: Add support for resetting the Root Ports in a platform specific way Manivannan Sadhasivam via B4 Relay
2026-07-29  4:52 ` [PATCH v9 1/5] PCI: dwc: ep: Clear MSI iATU mapping in dw_pcie_ep_cleanup() Manivannan Sadhasivam via B4 Relay
2026-07-29  5:15   ` sashiko-bot
2026-07-29  4:52 ` [PATCH v9 2/5] PCI/ERR: Add support for resetting the Root Ports in a platform specific way Manivannan Sadhasivam via B4 Relay
2026-07-29  5:07   ` sashiko-bot [this message]
2026-07-29  4:52 ` [PATCH v9 3/5] PCI: host-common: Add link down handling for Root Ports Manivannan Sadhasivam via B4 Relay
2026-07-29  5:07   ` sashiko-bot
2026-07-29  4:52 ` [PATCH v9 4/5] PCI: qcom: Add support for resetting the Root Port due to link down event Manivannan Sadhasivam via B4 Relay
2026-07-29  5:20   ` sashiko-bot
2026-07-29  4:52 ` [PATCH v9 5/5] misc: pci_endpoint_test: Add AER error handlers Manivannan Sadhasivam via B4 Relay
2026-07-29  5:07   ` 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=20260729050748.DCE2E1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --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