mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: lirongqing <lirongqing@baidu.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Niklas Schnelle <schnelle@linux.ibm.com>,
	Farhan Ali <alifm@linux.ibm.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
	Frank Li <Frank.Li@nxp.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: Only restore state that was successfully saved around a reset
Date: Tue, 10 Nov 2026 11:13:45 +0100	[thread overview]
Message-ID: <avLuWagPGyPhLYvl@wunner.de> (raw)
In-Reply-To: <20261110053348.2419-1-lirongqing@baidu.com>

On Tue, Nov 10, 2026 at 01:33:47PM +0800, lirongqing wrote:
> pci_dev_save_and_disable() returns early when config space is inaccessible,
> without saving anything, but pci_dev_restore() calls pci_restore_state()
> unconditionally and pci_restore_state() does not look at state_saved. After
> the reset makes config space accessible again, the all-zero or stale
> saved_config_space[] array is written back to the device, clearing Command,
> BARs and, for bridges, the bus number registers.
> 
> Clear state_saved when the save is skipped and only restore when a state
> was saved.

The state_saved flag is used internally by the PCI core for
suspend/resume.  If a driver calls pci_save_state() on suspend,
the flag is set and that tells the PCI core that the driver already
put the device into a lower power state, obviating the need for the
PCI core to do that.

Please do not use the flag for a completely different purpose.

Thanks,

Lukas

      parent reply	other threads:[~2026-11-10 10:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  5:33 lirongqing
2026-11-10  5:33 ` [PATCH] PCI: Save the Root Port state before a platform-specific reset lirongqing
2026-11-10 10:16   ` Lukas Wunner
2026-11-10 10:13 ` Lukas Wunner [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=avLuWagPGyPhLYvl@wunner.de \
    --to=lukas@wunner.de \
    --cc=Frank.Li@nxp.com \
    --cc=alifm@linux.ibm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lirongqing@baidu.com \
    --cc=manivannan.sadhasivam@oss.qualcomm.com \
    --cc=schnelle@linux.ibm.com \
    /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

all inboxes | Powered by JetHome®