Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Li,Rongqing" <lirongqing@baidu.com>
To: "sashiko-reviews@lists.linux.dev"
	<sashiko-reviews@lists.linux.dev>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: 答复: [外部邮件] Re: [PATCH] PCI: Save the Root Port state before a platform-specific reset
Date: Tue, 10 Nov 2026 08:19:05 +0000	[thread overview]
Message-ID: <f721aa07de544343bad01ba02b4ba247@baidu.com> (raw)
In-Reply-To: <sashiko-outbox-206352@kernel.org>

> 
> [Severity: High]
> Does calling pci_save_state(dev) here overwrite the Root Port's working saved
> state (saved during enumeration in pci_bus_add_device() and
> pcie_portdrv_probe()) with post-error or post-link-down register values?
> 
> During link-down recovery via pci_host_handle_link_down() ->
> pcie_do_recovery() -> pci_host_reset_root_port() -> pci_bus_error_reset(), the
> link is already down before pcibios_reset_secondary_bus() runs.  Downstream
> Ports clear PCI_EXP_DEVCTL2_LTR_EN on link down (and
> pci_bridge_reconfigure_ltr() in pci_restore_pcie_state() is a no-op for Root Ports
> because
> pci_upstream_bridge(dev) is NULL), while controllers such as pcie-dw-rockchip
> and pcie-qcom have already reset their non-sticky Root Port registers on the
> link-down event.  Saving state at this point captures those cleared registers and
> restores them after host->reset_root_port().
> 
> Similarly, in the fatal AER recovery path, aer_root_reset() disables Root Port AER
> interrupts before resetting the bus:
> 
> drivers/pci/pcie/aer.c:aer_root_reset() {
> 	if (host->native_aer && aer)
> 		aer_disable_irq(root);
> 	...
> 	} else {
> 		rc = pci_bus_error_reset(dev);
> }
> 
> Calling pci_save_state(dev) inside pcibios_reset_secondary_bus() records the
> IRQ-disabled PCI_ERR_ROOT_COMMAND value into dev->saved_cap_space, so
> any subsequent pci_restore_state(dev) will leave Root Port AER interrupts
> disabled.  And if host->reset_root_port() fails, dev->state_saved is left set with
> the broken state, causing pci_pm_suspend_noirq_common() to skip saving state
> and pci_prepare_to_sleep() on system suspend.
> 

I will send a v2 to fix the issue found by Sashiko

[Li,Rongqing] 


> --
> Sashiko AI
> review · https://sashiko.dev/#/patchset/20261110053348.2419-2-lirongqing
> @baidu.com?part=1

  reply	other threads:[~2026-11-10  8:19 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  5:33 [PATCH] PCI: Only restore state that was successfully saved around a reset lirongqing
2026-11-10  5:33 ` [PATCH] PCI: Save the Root Port state before a platform-specific reset lirongqing
2026-11-10  5:55   ` sashiko-bot
2026-11-10  8:19     ` Li,Rongqing [this message]
2026-11-10 10:16   ` Lukas Wunner
2026-11-12  2:47     ` 答复: [????] " Li,Rongqing
2026-11-10  5:51 ` [PATCH] PCI: Only restore state that was successfully saved around a reset sashiko-bot
2026-11-10  8:17   ` 答复: [外部邮件] " Li,Rongqing
2026-11-10 10:13 ` Lukas Wunner
2026-11-10 18:09 ` Farhan Ali
2026-11-12  2:31   ` 答复: [外部邮件] " Li,Rongqing

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=f721aa07de544343bad01ba02b4ba247@baidu.com \
    --to=lirongqing@baidu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox