From 961826fbcd79133033bc6a90bcf7cb1bb907a250 Mon Sep 17 00:00:00 2001 From: Michal Wajdeczko Date: Wed, 8 Jul 2026 00:08:04 +0200 Subject: [PATCH] drm/xe/guc: Prepare to print group KLVs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some future KLVs will be encoded as a group of nested KLVs. Prepare our KLV printer function to handle such KLVs. List of known group keys will be updated later, for now just prepare it for testing. Signed-off-by: Michal Wajdeczko Reviewed-by: MichaƂ Winiarski Link: https://patch.msgid.link/20260707220816.677-3-michal.wajdeczko@intel.com --- drivers/gpu/drm/xe/xe_guc_klv_helpers.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_guc_klv_helpers.c b/drivers/gpu/drm/xe/xe_guc_klv_helpers.c index 073b35957790..d0663c226e87 100644 --- a/drivers/gpu/drm/xe/xe_guc_klv_helpers.c +++ b/drivers/gpu/drm/xe/xe_guc_klv_helpers.c @@ -4,6 +4,7 @@ */ #include +#include #include #include "abi/guc_klvs_abi.h" @@ -12,6 +13,12 @@ #define make_u64(hi, lo) ((u64)((u64)(u32)(hi) << 32 | (u32)(lo))) +static bool is_group_key(u16 key) +{ + KUNIT_STATIC_STUB_REDIRECT(is_group_key, key); + return false; +} + /** * xe_guc_klv_key_to_string - Convert KLV key into friendly name. * @key: the `GuC KLV`_ key @@ -91,6 +98,17 @@ void xe_guc_klv_print_one(u16 key, u16 len, const u32 *value, struct drm_printer { const char *name = xe_guc_klv_key_to_string(key); + if (is_group_key(key)) { + struct drm_printer gp = drm_line_printer(p, name, 0); + + drm_printf(p, "{ key %#06x : group %u dwords } # %s\n", + key, len, name); + + /* print group recursively */ + xe_guc_klv_print(value, len, &gp); + return; + } + switch (len) { case 0: drm_printf(p, "{ key %#06x : no value } # %s\n", key, name);