[Intel-xe] [PATCH 1/2] drm/xe: Ensure mutex are destroyed
Bommithi Sakeena
bommithi.sakeena at intel.com
Wed Sep 27 16:50:11 UTC 2023
Add missing mutex_destroy calls to fini functions or convert to
drmm_mutex_init where fini function is not available.
Fixes: c639b8b60dfe ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: Matthew Brost <matthew.brost at intel.com>
Signed-off-by: Bommithi Sakeena <bommithi.sakeena at intel.com>
---
drivers/gpu/drm/xe/xe_guc_ct.c | 2 +-
drivers/gpu/drm/xe/xe_guc_pc.c | 1 +
drivers/gpu/drm/xe/xe_guc_submit.c | 1 +
drivers/gpu/drm/xe/xe_pcode.c | 4 +++-
4 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
index 2046bd269bbd..8b686c8b3339 100644
--- a/drivers/gpu/drm/xe/xe_guc_ct.c
+++ b/drivers/gpu/drm/xe/xe_guc_ct.c
@@ -137,7 +137,7 @@ int xe_guc_ct_init(struct xe_guc_ct *ct)
xe_assert(xe, !(guc_ct_size() % PAGE_SIZE));
- mutex_init(&ct->lock);
+ drmm_mutex_init(&xe->drm, &ct->lock);
spin_lock_init(&ct->fast_lock);
xa_init(&ct->fence_lookup);
INIT_WORK(&ct->g2h_worker, g2h_worker_func);
diff --git a/drivers/gpu/drm/xe/xe_guc_pc.c b/drivers/gpu/drm/xe/xe_guc_pc.c
index 8a4d299d6cb0..d9375d1d582f 100644
--- a/drivers/gpu/drm/xe/xe_guc_pc.c
+++ b/drivers/gpu/drm/xe/xe_guc_pc.c
@@ -890,6 +890,7 @@ void xe_guc_pc_fini(struct xe_guc_pc *pc)
XE_WARN_ON(xe_guc_pc_stop(pc));
sysfs_remove_files(pc_to_gt(pc)->sysfs, pc_attrs);
xe_bo_unpin_map_no_vm(pc->bo);
+ mutex_destroy(&pc->freq_lock);
}
/**
diff --git a/drivers/gpu/drm/xe/xe_guc_submit.c b/drivers/gpu/drm/xe/xe_guc_submit.c
index ac5fc2c797a7..f7bb3d0eed56 100644
--- a/drivers/gpu/drm/xe/xe_guc_submit.c
+++ b/drivers/gpu/drm/xe/xe_guc_submit.c
@@ -194,6 +194,7 @@ static void guc_submit_fini(struct drm_device *drm, void *arg)
xa_destroy(&guc->submission_state.exec_queue_lookup);
ida_destroy(&guc->submission_state.guc_ids);
bitmap_free(guc->submission_state.guc_ids_bitmap);
+ mutex_destroy(&guc->submission_state.lock);
}
#define GUC_ID_MAX 65535
diff --git a/drivers/gpu/drm/xe/xe_pcode.c b/drivers/gpu/drm/xe/xe_pcode.c
index 7f1bf2297f51..4a240acf7625 100644
--- a/drivers/gpu/drm/xe/xe_pcode.c
+++ b/drivers/gpu/drm/xe/xe_pcode.c
@@ -8,6 +8,8 @@
#include <linux/delay.h>
#include <linux/errno.h>
+#include <drm/drm_managed.h>
+
#include "xe_gt.h"
#include "xe_mmio.h"
#include "xe_pcode_api.h"
@@ -276,7 +278,7 @@ int xe_pcode_init(struct xe_gt *gt)
*/
int xe_pcode_probe(struct xe_gt *gt)
{
- mutex_init(>->pcode.lock);
+ drmm_mutex_init(>_to_xe(gt)->drm, >->pcode.lock);
if (!IS_DGFX(gt_to_xe(gt)))
return 0;
--
2.34.1
More information about the Intel-xe
mailing list