@@ -530,6 +530,7 @@ static int i915_set_dma_info(struct drm_i915_private *i915)
530530static int i915_driver_hw_probe (struct drm_i915_private * dev_priv )
531531{
532532 struct pci_dev * pdev = to_pci_dev (dev_priv -> drm .dev );
533+ struct pci_dev * root_pdev ;
533534 int ret ;
534535
535536 if (i915_inject_probe_failure (dev_priv ))
@@ -641,6 +642,15 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
641642
642643 intel_bw_init_hw (dev_priv );
643644
645+ /*
646+ * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
647+ * This should be totally removed when we handle the pci states properly
648+ * on runtime PM and on s2idle cases.
649+ */
650+ root_pdev = pcie_find_root_port (pdev );
651+ if (root_pdev )
652+ pci_d3cold_disable (root_pdev );
653+
644654 return 0 ;
645655
646656err_msi :
@@ -664,11 +674,16 @@ static int i915_driver_hw_probe(struct drm_i915_private *dev_priv)
664674static void i915_driver_hw_remove (struct drm_i915_private * dev_priv )
665675{
666676 struct pci_dev * pdev = to_pci_dev (dev_priv -> drm .dev );
677+ struct pci_dev * root_pdev ;
667678
668679 i915_perf_fini (dev_priv );
669680
670681 if (pdev -> msi_enabled )
671682 pci_disable_msi (pdev );
683+
684+ root_pdev = pcie_find_root_port (pdev );
685+ if (root_pdev )
686+ pci_d3cold_enable (root_pdev );
672687}
673688
674689/**
@@ -1193,14 +1208,6 @@ static int i915_drm_suspend_late(struct drm_device *dev, bool hibernation)
11931208 goto out ;
11941209 }
11951210
1196- /*
1197- * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
1198- * This should be totally removed when we handle the pci states properly
1199- * on runtime PM and on s2idle cases.
1200- */
1201- if (suspend_to_idle (dev_priv ))
1202- pci_d3cold_disable (pdev );
1203-
12041211 pci_disable_device (pdev );
12051212 /*
12061213 * During hibernation on some platforms the BIOS may try to access
@@ -1365,8 +1372,6 @@ static int i915_drm_resume_early(struct drm_device *dev)
13651372
13661373 pci_set_master (pdev );
13671374
1368- pci_d3cold_enable (pdev );
1369-
13701375 disable_rpm_wakeref_asserts (& dev_priv -> runtime_pm );
13711376
13721377 ret = vlv_resume_prepare (dev_priv , false);
@@ -1543,7 +1548,6 @@ static int intel_runtime_suspend(struct device *kdev)
15431548{
15441549 struct drm_i915_private * dev_priv = kdev_to_i915 (kdev );
15451550 struct intel_runtime_pm * rpm = & dev_priv -> runtime_pm ;
1546- struct pci_dev * pdev = to_pci_dev (dev_priv -> drm .dev );
15471551 int ret ;
15481552
15491553 if (drm_WARN_ON_ONCE (& dev_priv -> drm , !HAS_RUNTIME_PM (dev_priv )))
@@ -1589,12 +1593,6 @@ static int intel_runtime_suspend(struct device *kdev)
15891593 drm_err (& dev_priv -> drm ,
15901594 "Unclaimed access detected prior to suspending\n" );
15911595
1592- /*
1593- * FIXME: Temporary hammer to avoid freezing the machine on our DGFX
1594- * This should be totally removed when we handle the pci states properly
1595- * on runtime PM and on s2idle cases.
1596- */
1597- pci_d3cold_disable (pdev );
15981596 rpm -> suspended = true;
15991597
16001598 /*
@@ -1633,7 +1631,6 @@ static int intel_runtime_resume(struct device *kdev)
16331631{
16341632 struct drm_i915_private * dev_priv = kdev_to_i915 (kdev );
16351633 struct intel_runtime_pm * rpm = & dev_priv -> runtime_pm ;
1636- struct pci_dev * pdev = to_pci_dev (dev_priv -> drm .dev );
16371634 int ret ;
16381635
16391636 if (drm_WARN_ON_ONCE (& dev_priv -> drm , !HAS_RUNTIME_PM (dev_priv )))
@@ -1646,7 +1643,6 @@ static int intel_runtime_resume(struct device *kdev)
16461643
16471644 intel_opregion_notify_adapter (dev_priv , PCI_D0 );
16481645 rpm -> suspended = false;
1649- pci_d3cold_enable (pdev );
16501646 if (intel_uncore_unclaimed_mmio (& dev_priv -> uncore ))
16511647 drm_dbg (& dev_priv -> drm ,
16521648 "Unclaimed access during suspend, bios?\n" );
0 commit comments