Linux PCI subsystem development
 help / color / mirror / Atom feed
From: "Mario Limonciello (AMD)" <superm1@kernel.org>
To: mario.limonciello@amd.com, bhelgaas@google.com, rafael@kernel.org
Cc: "Mario Limonciello (AMD)" <superm1@kernel.org>,
	kengyu@lexical.tw,
	Matthew Ruffell <matthew.ruffell@canonical.com>,
	linux-pci@vger.kernel.org
Subject: [PATCH] PCI: Enable Bus Master in pci_power_up()
Date: Tue, 13 Jan 2026 14:56:14 -0600	[thread overview]
Message-ID: <20260113205626.127337-1-superm1@kernel.org> (raw)

commit 4d4c10f763d78 ("PCI: Explicitly put devices into D0 when
initializing") addressed the issue of devices not being explicitly
initialized to D0 during system startup, resolving mismatches between
firmware and OS states.

However, this change affected devices lacking runtime PM, as noted in
commit 907a7a2e5bf40 ("PCI/PM: Set up runtime PM even for devices without
PCI PM").

Matthew however reports that there is additional problems specifically on
AWS NVME hardware that can't handle a kexec since these changes were
introduced.

During a kexec reboot ever since commit 4fc9bbf98fd66 ("PCI: Disable Bus
Master only on kexec reboot") bus mastering will be turned off, and this
is a different flow than is observed for shutdown/reboot.  The problem
appears to be that because the device is actually in D0 during the
startup routine, clearing bus mastering as part of pci_device_shutdown()
leads to a mismatch during the next kernel boot.

I'd hypothesize that the firmware on this platform normally sets bus
mastering as part of startup and the difference in kexec behavior lead to
an incongruity.

Set bus mastering when the device powers up to fix the mismatch.

Cc: kengyu@lexical.tw
Reported-by: Matthew Ruffell <matthew.ruffell@canonical.com>
Closes: https://lore.kernel.org/linux-pci/CAKAwkKvmdKxRRA4cR=jJEdyadon6uKXe+aFXaGSe=PNSgwDf9g@mail.gmail.com/
Fixes: 4d4c10f763d78 ("PCI: Explicitly put devices into D0 when initializing")
Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
---
NOTE:
This could also be addressed by disabling the clearing of bus mastering across
a kexec reboot if that is preferred.
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 13dbb405dc31f..c0c0b5c9bf838 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1323,6 +1323,7 @@ int pci_power_up(struct pci_dev *dev)
 		return -EIO;
 	}
 
+	pci_set_master(dev);
 	pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
 	if (PCI_POSSIBLE_ERROR(pmcsr)) {
 		pci_err(dev, "Unable to change power state from %s to D0, device inaccessible\n",
-- 
2.43.0


             reply	other threads:[~2026-01-13 20:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-13 20:56 Mario Limonciello (AMD) [this message]
2026-01-14  0:01 ` [PATCH] PCI: Enable Bus Master in pci_power_up() Matthew Ruffell
2026-01-14  9:52 ` Lukas Wunner
2026-01-14 14:59   ` Manivannan Sadhasivam
2026-01-14 15:08   ` Mario Limonciello

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=20260113205626.127337-1-superm1@kernel.org \
    --to=superm1@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=kengyu@lexical.tw \
    --cc=linux-pci@vger.kernel.org \
    --cc=mario.limonciello@amd.com \
    --cc=matthew.ruffell@canonical.com \
    --cc=rafael@kernel.org \
    /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