@@ -1427,11 +1427,13 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
/* Must be set before calling __i915_printk */
dev_priv->dev = dev;
+ async_register_domain(&dev_priv->async_domain, false);
+
ret = i915_driver_init_early(dev_priv, dev,
(struct intel_device_info *)flags);
if (ret < 0)
- goto out_free_priv;
+ goto out_free_timeline;
intel_runtime_pm_get(dev_priv);
@@ -1475,7 +1477,9 @@ out_cleanup_mmio:
out_runtime_pm_put:
intel_runtime_pm_put(dev_priv);
i915_driver_cleanup_early(dev_priv);
-out_free_priv:
+out_free_timeline:
+ async_synchronize_full_domain(&dev_priv->async_domain);
+ async_unregister_domain(&dev_priv->async_domain);
i915_load_error(dev_priv, "Device initialization failed (%d)\n", ret);
kfree(dev_priv);
@@ -1542,6 +1546,10 @@ int i915_driver_unload(struct drm_device *dev)
intel_display_power_put(dev_priv, POWER_DOMAIN_INIT);
i915_driver_cleanup_early(dev_priv);
+
+ async_synchronize_full_domain(&dev_priv->async_domain);
+ async_unregister_domain(&dev_priv->async_domain);
+
kfree(dev_priv);
return 0;
@@ -586,6 +586,9 @@ static int i915_drm_suspend(struct drm_device *dev)
pci_power_t opregion_target_state;
int error;
+ /* Flush all pending resume tasks */
+ async_synchronize_full_domain(&dev_priv->async_domain);
+
/* ignore lid events during suspend */
mutex_lock(&dev_priv->modeset_restore_lock);
dev_priv->modeset_restore = MODESET_SUSPENDED;
@@ -642,6 +645,8 @@ static int i915_drm_suspend(struct drm_device *dev)
intel_csr_ucode_suspend(dev_priv);
out:
+ /* Flush all incomplete suspend tasks */
+ async_synchronize_full_domain(&dev_priv->async_domain);
enable_rpm_wakeref_asserts(dev_priv);
return error;
@@ -33,6 +33,7 @@
#include <uapi/drm/i915_drm.h>
#include <uapi/drm/drm_fourcc.h>
+#include <linux/async.h>
#include <linux/io-mapping.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
@@ -1732,6 +1733,9 @@ struct drm_i915_private {
struct kmem_cache *vmas;
struct kmem_cache *requests;
+ struct async_domain async_domain;
+ void *async_context;
+
const struct intel_device_info info;
int relative_constants_mode;