Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI: Enable Bus Master in pci_power_up()
@ 2026-01-13 20:56 Mario Limonciello (AMD)
  2026-01-14  0:01 ` Matthew Ruffell
  2026-01-14  9:52 ` Lukas Wunner
  0 siblings, 2 replies; 5+ messages in thread
From: Mario Limonciello (AMD) @ 2026-01-13 20:56 UTC (permalink / raw)
  To: mario.limonciello, bhelgaas, rafael
  Cc: Mario Limonciello (AMD), kengyu, Matthew Ruffell, linux-pci

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


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-01-14 15:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-13 20:56 [PATCH] PCI: Enable Bus Master in pci_power_up() Mario Limonciello (AMD)
2026-01-14  0:01 ` Matthew Ruffell
2026-01-14  9:52 ` Lukas Wunner
2026-01-14 14:59   ` Manivannan Sadhasivam
2026-01-14 15:08   ` Mario Limonciello

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox