All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: Explicitly put devices into D0 when initializing
@ 2025-04-22 13:38 Mario Limonciello
  2025-04-23 19:12 ` Wysocki, Rafael J
  0 siblings, 1 reply; 3+ messages in thread
From: Mario Limonciello @ 2025-04-22 13:38 UTC (permalink / raw)
  To: mario.limonciello, bhelgaas, rafael.j.wysocki, huang.ying.caritas,
	stern
  Cc: linux-pci

From: Mario Limonciello <mario.limonciello@amd.com>

AMD BIOS team has root caused an issue that NVME storage failed to come
back from suspend to a lack of a call to _REG when NVME device was probed.

commit 112a7f9c8edbf ("PCI/ACPI: Call _REG when transitioning D-states")
added support for calling _REG when transitioning D-states, but this only
works if the device actually "transitions" D-states.

commit 967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI
devices") added support for runtime PM on PCI devices, but never actually
'explicitly' sets the device to D0.

To make sure that devices are in D0 and that platform methods such as
_REG are called, explicitly set all devices into D0 during initialization.

Fixes: 967577b062417 ("PCI/PM: Keep runtime PM enabled for unbound PCI devices")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
Note: an earlier internal version of this attempted to do this in local_pci_probe()
but this doesn't affect PCI root ports and we need _REG called on the root ports too.

 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 53a070394739a..cd87c8370dede 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3266,6 +3266,7 @@ void pci_pm_init(struct pci_dev *dev)
 	pci_read_config_word(dev, PCI_STATUS, &status);
 	if (status & PCI_STATUS_IMM_READY)
 		dev->imm_ready = 1;
+	pci_set_power_state(dev, PCI_D0);
 }
 
 static unsigned long pci_ea_flags(struct pci_dev *dev, u8 prop)
-- 
2.43.0


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

end of thread, other threads:[~2025-04-23 19:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-22 13:38 [PATCH] PCI: Explicitly put devices into D0 when initializing Mario Limonciello
2025-04-23 19:12 ` Wysocki, Rafael J
2025-04-23 19:30   ` Rafael J. Wysocki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.