Skip to content

Commit 5035794

Browse files
tursulinjnikula
authored andcommitted
drm/i915/gsc: Mark internal GSC engine with reserved uabi class
The GSC CS is not exposed to the user, so we skipped assigning a uabi class number for it. However, the trace logs use the uabi class and instance to identify the engine, so leaving uabi class unset makes the GSC CS show up as the RCS in those logs. Given that the engine is not exposed to the user, we can't add a new case in the uabi enum, so we insted internally define a kernel internal class as -1. At the same time remove special handling for the name and complete the uabi_classes array so internal class is automatically correctly assigned. Engine will show as 65535:0 other0 in the logs/traces which should be unique enough. v2: * Fix uabi class u8 vs u16 type confusion. Signed-off-by: Tvrtko Ursulin <[email protected]> Fixes: 194babe ("drm/i915/mtl: don't expose GSC command streamer to the user") Cc: Daniele Ceraolo Spurio <[email protected]> Cc: Alan Previn <[email protected]> Cc: Matt Roper <[email protected]> Reviewed-by: Daniele Ceraolo Spurio <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit dfed6b5) Signed-off-by: Jani Nikula <[email protected]>
1 parent 2cc14f5 commit 5035794

File tree

1 file changed

+22
-17
lines changed

1 file changed

+22
-17
lines changed

drivers/gpu/drm/i915/gt/intel_engine_user.c

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ void intel_engine_add_user(struct intel_engine_cs *engine)
4141
llist_add(&engine->uabi_llist, &engine->i915->uabi_engines_llist);
4242
}
4343

44-
static const u8 uabi_classes[] = {
44+
#define I915_NO_UABI_CLASS ((u16)(-1))
45+
46+
static const u16 uabi_classes[] = {
4547
[RENDER_CLASS] = I915_ENGINE_CLASS_RENDER,
4648
[COPY_ENGINE_CLASS] = I915_ENGINE_CLASS_COPY,
4749
[VIDEO_DECODE_CLASS] = I915_ENGINE_CLASS_VIDEO,
4850
[VIDEO_ENHANCEMENT_CLASS] = I915_ENGINE_CLASS_VIDEO_ENHANCE,
4951
[COMPUTE_CLASS] = I915_ENGINE_CLASS_COMPUTE,
52+
[OTHER_CLASS] = I915_NO_UABI_CLASS, /* Not exposed to users, no uabi class. */
5053
};
5154

5255
static int engine_cmp(void *priv, const struct list_head *A,
@@ -200,6 +203,7 @@ static void engine_rename(struct intel_engine_cs *engine, const char *name, u16
200203

201204
void intel_engines_driver_register(struct drm_i915_private *i915)
202205
{
206+
u16 name_instance, other_instance = 0;
203207
struct legacy_ring ring = {};
204208
struct list_head *it, *next;
205209
struct rb_node **p, *prev;
@@ -216,27 +220,28 @@ void intel_engines_driver_register(struct drm_i915_private *i915)
216220
if (intel_gt_has_unrecoverable_error(engine->gt))
217221
continue; /* ignore incomplete engines */
218222

219-
/*
220-
* We don't want to expose the GSC engine to the users, but we
221-
* still rename it so it is easier to identify in the debug logs
222-
*/
223-
if (engine->id == GSC0) {
224-
engine_rename(engine, "gsc", 0);
225-
continue;
226-
}
227-
228223
GEM_BUG_ON(engine->class >= ARRAY_SIZE(uabi_classes));
229224
engine->uabi_class = uabi_classes[engine->class];
225+
if (engine->uabi_class == I915_NO_UABI_CLASS) {
226+
name_instance = other_instance++;
227+
} else {
228+
GEM_BUG_ON(engine->uabi_class >=
229+
ARRAY_SIZE(i915->engine_uabi_class_count));
230+
name_instance =
231+
i915->engine_uabi_class_count[engine->uabi_class]++;
232+
}
233+
engine->uabi_instance = name_instance;
230234

231-
GEM_BUG_ON(engine->uabi_class >=
232-
ARRAY_SIZE(i915->engine_uabi_class_count));
233-
engine->uabi_instance =
234-
i915->engine_uabi_class_count[engine->uabi_class]++;
235-
236-
/* Replace the internal name with the final user facing name */
235+
/*
236+
* Replace the internal name with the final user and log facing
237+
* name.
238+
*/
237239
engine_rename(engine,
238240
intel_engine_class_repr(engine->class),
239-
engine->uabi_instance);
241+
name_instance);
242+
243+
if (engine->uabi_class == I915_NO_UABI_CLASS)
244+
continue;
240245

241246
rb_link_node(&engine->uabi_node, prev, p);
242247
rb_insert_color(&engine->uabi_node, &i915->uabi_engines);

0 commit comments

Comments
 (0)