drm/xe/guc: Use drm_device-managed version of mutex_init()
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Sat, 6 Apr 2024 14:39:45 +0000 (16:39 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Mon, 8 Apr 2024 09:22:17 +0000 (11:22 +0200)
This is safer approach and will help resolve a cleanup ordering
conflict related to the GuC ID manager.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240406143946.979-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_guc_submit.c

index 9c30bd9ac8c06502736328920f96097ec21885d2..4c444fddfba6c17f8a76c81d452bdc83a25a4f5d 100644 (file)
@@ -238,7 +238,6 @@ static void guc_submit_fini(struct drm_device *drm, void *arg)
 
        xa_destroy(&guc->submission_state.exec_queue_lookup);
        free_submit_wq(guc);
-       mutex_destroy(&guc->submission_state.lock);
 }
 
 static const struct xe_exec_queue_ops guc_exec_queue_ops;
@@ -263,13 +262,16 @@ int xe_guc_submit_init(struct xe_guc *guc)
        struct xe_gt *gt = guc_to_gt(guc);
        int err;
 
+       err = drmm_mutex_init(&xe->drm, &guc->submission_state.lock);
+       if (err)
+               return err;
+
        err = alloc_submit_wq(guc);
        if (err)
                return err;
 
        gt->exec_queue_ops = &guc_exec_queue_ops;
 
-       mutex_init(&guc->submission_state.lock);
        xa_init(&guc->submission_state.exec_queue_lookup);
 
        spin_lock_init(&guc->submission_state.suspend.lock);