Skip to content

Commit 7dc249e

Browse files
committed
Merge branch 'pci/pm'
- Disable use of D3cold on Asus B1400 PCI-NVMe bridges because some BIOSes can't power them back on, replacing a more general ACPI sleep quirk (Daniel Drake) - Allow runtime PM when the driver enables it but doesn't need any runtime PM callbacks (Raag Jadav) - Drain runtime-idle callbacks before driver removal to avoid races between .remove() and .runtime_idle(), which caused intermittent page faults when the rtsx .runtime_idle() accessed registers that its .remove() had already unmapped (Rafael J. Wysocki) * pci/pm: PCI/PM: Drain runtime-idle callbacks before driver removal PCI/PM: Allow runtime PM with no PM callbacks at all Revert "ACPI: PM: Block ASUS B1400CEAE from suspend to idle by default" PCI: Disable D3cold on Asus B1400 PCI-NVMe bridge
2 parents 3dfd824 + 9d5286d commit 7dc249e

File tree

3 files changed

+56
-16
lines changed

3 files changed

+56
-16
lines changed

arch/x86/pci/fixup.c

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,54 @@ static void chromeos_fixup_apl_pci_l1ss_capability(struct pci_dev *dev)
907907
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x5ad6, chromeos_save_apl_pci_l1ss_capability);
908908
DECLARE_PCI_FIXUP_RESUME(PCI_VENDOR_ID_INTEL, 0x5ad6, chromeos_fixup_apl_pci_l1ss_capability);
909909

910+
/*
911+
* Disable D3cold on Asus B1400 PCI-NVMe bridge
912+
*
913+
* On this platform with VMD off, the NVMe device cannot successfully power
914+
* back on from D3cold. This appears to be an untested transition by the
915+
* vendor: Windows leaves the NVMe and parent bridge in D0 during suspend.
916+
*
917+
* We disable D3cold on the parent bridge for simplicity, and the fact that
918+
* both parent bridge and NVMe device share the same power resource.
919+
*
920+
* This is only needed on BIOS versions before 308; the newer versions flip
921+
* StorageD3Enable from 1 to 0.
922+
*/
923+
static const struct dmi_system_id asus_nvme_broken_d3cold_table[] = {
924+
{
925+
.matches = {
926+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
927+
DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.304"),
928+
},
929+
},
930+
{
931+
.matches = {
932+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
933+
DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.305"),
934+
},
935+
},
936+
{
937+
.matches = {
938+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
939+
DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.306"),
940+
},
941+
},
942+
{
943+
.matches = {
944+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
945+
DMI_MATCH(DMI_BIOS_VERSION, "B1400CEAE.307"),
946+
},
947+
},
948+
{}
949+
};
950+
951+
static void asus_disable_nvme_d3cold(struct pci_dev *pdev)
952+
{
953+
if (dmi_check_system(asus_nvme_broken_d3cold_table) > 0)
954+
pci_d3cold_disable(pdev);
955+
}
956+
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL, 0x9a09, asus_disable_nvme_d3cold);
957+
910958
#ifdef CONFIG_SUSPEND
911959
/*
912960
* Root Ports on some AMD SoCs advertise PME_Support for D3hot and D3cold, but

drivers/acpi/sleep.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,6 @@ static const struct dmi_system_id acpisleep_dmi_table[] __initconst = {
385385
DMI_MATCH(DMI_PRODUCT_NAME, "20GGA00L00"),
386386
},
387387
},
388-
/*
389-
* ASUS B1400CEAE hangs on resume from suspend (see
390-
* https://bugzilla.kernel.org/show_bug.cgi?id=215742).
391-
*/
392-
{
393-
.callback = init_default_s3,
394-
.ident = "ASUS B1400CEAE",
395-
.matches = {
396-
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
397-
DMI_MATCH(DMI_PRODUCT_NAME, "ASUS EXPERTBOOK B1400CEAE"),
398-
},
399-
},
400388
{},
401389
};
402390

drivers/pci/pci-driver.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,13 @@ static void pci_device_remove(struct device *dev)
464464

465465
if (drv->remove) {
466466
pm_runtime_get_sync(dev);
467+
/*
468+
* If the driver provides a .runtime_idle() callback and it has
469+
* started to run already, it may continue to run in parallel
470+
* with the code below, so wait until all of the runtime PM
471+
* activity has completed.
472+
*/
473+
pm_runtime_barrier(dev);
467474
drv->remove(pci_dev);
468475
pm_runtime_put_noidle(dev);
469476
}
@@ -1373,10 +1380,7 @@ static int pci_pm_runtime_idle(struct device *dev)
13731380
if (!pci_dev->driver)
13741381
return 0;
13751382

1376-
if (!pm)
1377-
return -ENOSYS;
1378-
1379-
if (pm->runtime_idle)
1383+
if (pm && pm->runtime_idle)
13801384
return pm->runtime_idle(dev);
13811385

13821386
return 0;

0 commit comments

Comments
 (0)