#define dbm_assert(_dbm, _cond) xe_gt_assert(dbm_to_gt(_dbm), _cond)
#define dbm_mutex(_dbm) (&dbm_to_guc(_dbm)->submission_state.lock)
+static void dbm_print_locked(struct xe_guc_db_mgr *dbm, struct drm_printer *p, int indent);
+
static void __fini_dbm(struct drm_device *drm, void *arg)
{
struct xe_guc_db_mgr *dbm = arg;
xe_gt_err(dbm_to_gt(dbm), "GuC doorbells manager unclean (%u/%u)\n",
weight, dbm->count);
- xe_guc_db_mgr_print(dbm, &p, 1);
+ dbm_print_locked(dbm, &p, 1);
}
bitmap_free(dbm->bitmap);
mutex_unlock(dbm_mutex(dbm));
}
-/**
- * xe_guc_db_mgr_print() - Print status of GuC Doorbells Manager.
- * @dbm: the &xe_guc_db_mgr to print
- * @p: the &drm_printer to print to
- * @indent: tab indentation level
- */
-void xe_guc_db_mgr_print(struct xe_guc_db_mgr *dbm,
- struct drm_printer *p, int indent)
+static void dbm_print_locked(struct xe_guc_db_mgr *dbm, struct drm_printer *p, int indent)
{
unsigned int rs, re;
unsigned int total;
if (!dbm->bitmap)
return;
- mutex_lock(dbm_mutex(dbm));
-
total = 0;
for_each_clear_bitrange(rs, re, dbm->bitmap, dbm->count) {
drm_printf_indent(p, indent, "available range: %u..%u (%u)\n",
total += re - rs;
}
drm_printf_indent(p, indent, "reserved total: %u\n", total);
+}
+/**
+ * xe_guc_db_mgr_print() - Print status of GuC Doorbells Manager.
+ * @dbm: the &xe_guc_db_mgr to print
+ * @p: the &drm_printer to print to
+ * @indent: tab indentation level
+ */
+void xe_guc_db_mgr_print(struct xe_guc_db_mgr *dbm,
+ struct drm_printer *p, int indent)
+{
+ mutex_lock(dbm_mutex(dbm));
+ dbm_print_locked(dbm, p, indent);
mutex_unlock(dbm_mutex(dbm));
}