Skip to content

Commit d2664a9

Browse files
author
Myron Stowe
committed
PCI/PM: Set up runtime PM even for devices without PCI PM
JIRA: https://issues.redhat.com/browse/RHEL-90801 Upstream Status: 907a7a2 commit 907a7a2 Author: Mario Limonciello <mario.limonciello@amd.com> Date: Wed Jun 11 18:31:16 2025 -0500 PCI/PM: Set up runtime PM even for devices without PCI PM 4d4c10f ("PCI: Explicitly put devices into D0 when initializing") intended to put PCI devices into D0, but in doing so unintentionally changed runtime PM initialization not to occur on devices that don't support PCI PM. This caused a regression in vfio-pci due to an imbalance with its use. Adjust the logic in pci_pm_init() so that even if PCI PM isn't supported runtime PM is still initialized. Fixes: 4d4c10f ("PCI: Explicitly put devices into D0 when initializing") Reported-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Closes: https://lore.kernel.org/linux-pci/20250424043232.1848107-1-superm1@kernel.org/T/#m7e8929d6421690dc8bd6dc639d86c2b4db27cbc4 Reported-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Closes: https://lore.kernel.org/linux-pci/20250424043232.1848107-1-superm1@kernel.org/T/#m40d277dcdb9be64a1609a82412d1aa906263e201 Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Tested-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Tested-by: Nicolas Dichtel <nicolas.dichtel@6wind.com> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com> Acked-by: Rafael J. Wysocki <rafael@kernel.org> Cc: Alex Williamson <alex.williamson@redhat.com> Link: https://patch.msgid.link/20250611233117.61810-1-superm1@kernel.org Signed-off-by: Myron Stowe <mstowe@redhat.com>
1 parent 2259dc7 commit d2664a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/pci/pci.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3217,14 +3217,14 @@ void pci_pm_init(struct pci_dev *dev)
32173217
/* find PCI PM capability in list */
32183218
pm = pci_find_capability(dev, PCI_CAP_ID_PM);
32193219
if (!pm)
3220-
return;
3220+
goto poweron;
32213221
/* Check device's ability to generate PME# */
32223222
pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc);
32233223

32243224
if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
32253225
pci_err(dev, "unsupported PM cap regs version (%u)\n",
32263226
pmc & PCI_PM_CAP_VER_MASK);
3227-
return;
3227+
goto poweron;
32283228
}
32293229

32303230
dev->pm_cap = pm;
@@ -3269,6 +3269,7 @@ void pci_pm_init(struct pci_dev *dev)
32693269
pci_read_config_word(dev, PCI_STATUS, &status);
32703270
if (status & PCI_STATUS_IMM_READY)
32713271
dev->imm_ready = 1;
3272+
poweron:
32723273
pci_pm_power_up_and_verify_state(dev);
32733274
pm_runtime_forbid(&dev->dev);
32743275
pm_runtime_set_active(&dev->dev);

0 commit comments

Comments
 (0)