Merge tag 'drm-xe-fixes-2025-11-27' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes

Driver Changes:
 - Fix resource leak in xe_guc_ct_init_noalloc()'s error path (Shuicheng Lin)
 - Fix stack_depot usage without STACKDEPOT_ALWAYS_INIT (Lucas)
 - Fix overflow in conversion from clock tics to msec (Harish Chegondi)

Signed-off-by: Dave Airlie <airlied@redhat.com>

From: Lucas De Marchi <lucas.demarchi@intel.com>
Link: https://patch.msgid.link/7ejiqjgthpqybg5svmkind2pszk4fqadxuq7rngchaaw76iept@5pn6sngqj6lk
This commit is contained in:
Dave Airlie
2025-11-28 12:10:19 +10:00
2 changed files with 10 additions and 12 deletions

View File

@@ -93,11 +93,6 @@ int xe_gt_clock_init(struct xe_gt *gt)
return 0;
}
static u64 div_u64_roundup(u64 n, u32 d)
{
return div_u64(n + d - 1, d);
}
/**
* xe_gt_clock_interval_to_ms - Convert sampled GT clock ticks to msec
*
@@ -108,5 +103,5 @@ static u64 div_u64_roundup(u64 n, u32 d)
*/
u64 xe_gt_clock_interval_to_ms(struct xe_gt *gt, u64 count)
{
return div_u64_roundup(count * MSEC_PER_SEC, gt->info.reference_clock);
return mul_u64_u32_div(count, MSEC_PER_SEC, gt->info.reference_clock);
}

View File

@@ -226,6 +226,12 @@ int xe_guc_ct_init_noalloc(struct xe_guc_ct *ct)
xe_gt_assert(gt, !(guc_ct_size() % PAGE_SIZE));
err = drmm_mutex_init(&xe->drm, &ct->lock);
if (err)
return err;
primelockdep(ct);
ct->g2h_wq = alloc_ordered_workqueue("xe-g2h-wq", WQ_MEM_RECLAIM);
if (!ct->g2h_wq)
return -ENOMEM;
@@ -237,16 +243,13 @@ int xe_guc_ct_init_noalloc(struct xe_guc_ct *ct)
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
spin_lock_init(&ct->dead.lock);
INIT_WORK(&ct->dead.worker, ct_dead_worker_func);
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG_GUC)
stack_depot_init();
#endif
#endif
init_waitqueue_head(&ct->wq);
init_waitqueue_head(&ct->g2h_fence_wq);
err = drmm_mutex_init(&xe->drm, &ct->lock);
if (err)
return err;
primelockdep(ct);
err = drmm_add_action_or_reset(&xe->drm, guc_ct_fini, ct);
if (err)
return err;