When the system is being shutdown, we no longer care about the results
of outstanding GPU operations, and so we can cancel them to speed up the
reboot. This helps most if we happen to be stuck waiting for a timeout
to declare the GPU hung.

Signed-off-by: Chris Wilson <[email protected]>
---
 drivers/gpu/drm/i915/i915_pci.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 1b81d7cb209e..cf2396856d38 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -763,11 +763,25 @@ static int i915_pci_probe(struct pci_dev *pdev, const 
struct pci_device_id *ent)
        return 0;
 }
 
+static void i915_pci_shutdown(struct pci_dev *pdev)
+{
+       struct drm_i915_private *i915;
+
+       i915 = pci_get_drvdata(pdev);
+       if (!i915) /* driver load aborted? */
+               return;
+
+       /* Cancel any outstanding rendering */
+       if (READ_ONCE(i915->gt.awake))
+               i915_gem_set_wedged(i915);
+}
+
 static struct pci_driver i915_pci_driver = {
        .name = DRIVER_NAME,
        .id_table = pciidlist,
        .probe = i915_pci_probe,
        .remove = i915_pci_remove,
+       .shutdown = i915_pci_shutdown,
        .driver.pm = &i915_pm_ops,
 };
 
-- 
2.19.2

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to