From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH 01/13] drm/xe/guc: Allow to print single KLV
Date: Tue, 30 Jun 2026 15:26:20 +0200 [thread overview]
Message-ID: <20260630132633.32804-2-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20260630132633.32804-1-michal.wajdeczko@intel.com>
We can decode and print all KLVs from the buffer, but it might be
helpful also to allow printing just single already decoded KLV.
Extract existing code into new function and make it public.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
---
drivers/gpu/drm/xe/xe_guc_klv_helpers.c | 54 ++++++++++++++++---------
drivers/gpu/drm/xe/xe_guc_klv_helpers.h | 1 +
2 files changed, 35 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_guc_klv_helpers.c b/drivers/gpu/drm/xe/xe_guc_klv_helpers.c
index 97600edda837..3169c7f1eebf 100644
--- a/drivers/gpu/drm/xe/xe_guc_klv_helpers.c
+++ b/drivers/gpu/drm/xe/xe_guc_klv_helpers.c
@@ -76,6 +76,39 @@ const char *xe_guc_klv_key_to_string(u16 key)
}
}
+/**
+ * xe_guc_klv_print_one() - Print single `GuC KLV`_.
+ * @key: KLV key
+ * @len: KLV length (in u32 dwords) of the KLV @value
+ * @value: KLV value (as array of @len u32 dwords)
+ * @p: the &drm_printer
+ *
+ * The buffer may contain more than one KLV.
+ */
+void xe_guc_klv_print_one(u16 key, u16 len, const u32 *value, struct drm_printer *p)
+{
+ const char *name = xe_guc_klv_key_to_string(key);
+
+ switch (len) {
+ case 0:
+ drm_printf(p, "{ key %#06x : no value } # %s\n", key, name);
+ break;
+ case 1:
+ drm_printf(p, "{ key %#06x : 32b value %u } # %s\n",
+ key, value[0], name);
+ break;
+ case 2:
+ drm_printf(p, "{ key %#06x : 64b value %#llx } # %s\n",
+ key, make_u64(value[1], value[0]), name);
+ break;
+ default:
+ drm_printf(p, "{ key %#06x : %zu bytes %*ph } # %s\n",
+ key, len * sizeof(u32), (int)(len * sizeof(u32)),
+ value, name);
+ break;
+ }
+}
+
/**
* xe_guc_klv_print - Print content of the buffer with `GuC KLV`_.
* @klvs: the buffer with KLVs
@@ -101,26 +134,7 @@ void xe_guc_klv_print(const u32 *klvs, u32 num_dwords, struct drm_printer *p)
return;
}
- switch (len) {
- case 0:
- drm_printf(p, "{ key %#06x : no value } # %s\n",
- key, xe_guc_klv_key_to_string(key));
- break;
- case 1:
- drm_printf(p, "{ key %#06x : 32b value %u } # %s\n",
- key, klvs[0], xe_guc_klv_key_to_string(key));
- break;
- case 2:
- drm_printf(p, "{ key %#06x : 64b value %#llx } # %s\n",
- key, make_u64(klvs[1], klvs[0]),
- xe_guc_klv_key_to_string(key));
- break;
- default:
- drm_printf(p, "{ key %#06x : %zu bytes %*ph } # %s\n",
- key, len * sizeof(u32), (int)(len * sizeof(u32)),
- klvs, xe_guc_klv_key_to_string(key));
- break;
- }
+ xe_guc_klv_print_one(key, len, klvs, p);
klvs += len;
num_dwords -= len;
diff --git a/drivers/gpu/drm/xe/xe_guc_klv_helpers.h b/drivers/gpu/drm/xe/xe_guc_klv_helpers.h
index c676d21c173b..c7b7e61c1250 100644
--- a/drivers/gpu/drm/xe/xe_guc_klv_helpers.h
+++ b/drivers/gpu/drm/xe/xe_guc_klv_helpers.h
@@ -13,6 +13,7 @@ struct drm_printer;
const char *xe_guc_klv_key_to_string(u16 key);
+void xe_guc_klv_print_one(u16 key, u16 len, const u32 *value, struct drm_printer *p);
void xe_guc_klv_print(const u32 *klvs, u32 num_dwords, struct drm_printer *p);
int xe_guc_klv_count(const u32 *klvs, u32 num_dwords);
--
2.47.1
next prev parent reply other threads:[~2026-06-30 13:26 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 13:26 [PATCH 00/13] drm/xe: Add and use more KLV helpers Michal Wajdeczko
2026-06-30 13:26 ` Michal Wajdeczko [this message]
2026-07-03 11:10 ` [PATCH 01/13] drm/xe/guc: Allow to print single KLV Michał Winiarski
2026-06-30 13:26 ` [PATCH 02/13] drm/xe/guc: Prepare to print group KLVs Michal Wajdeczko
2026-07-03 11:11 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 03/13] drm/xe/guc: Add basic KLV encoding helpers Michal Wajdeczko
2026-07-03 12:58 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 04/13] drm/xe/guc: Add string KLV encoding helper Michal Wajdeczko
2026-07-03 13:29 ` Michał Winiarski
2026-07-06 16:04 ` Michal Wajdeczko
2026-06-30 13:26 ` [PATCH 05/13] drm/xe/guc: Add object " Michal Wajdeczko
2026-07-03 14:33 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 06/13] drm/xe/guc: Add KLV parsing helper Michal Wajdeczko
2026-07-03 14:40 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 07/13] drm/xe/guc: Formalize Reserved KLVs Michal Wajdeczko
2026-07-03 13:31 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 08/13] drm/xe/tests: Add GuC KLV helpers basic tests Michal Wajdeczko
2026-07-03 14:17 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 09/13] drm/xe/tests: Add string encoding helper test Michal Wajdeczko
2026-07-03 20:40 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 10/13] drm/xe/tests: Add object " Michal Wajdeczko
2026-07-03 20:47 ` Michał Winiarski
2026-07-06 16:34 ` Michal Wajdeczko
2026-06-30 13:26 ` [PATCH 11/13] drm/xe/tests: Add GuC KLV printer test Michal Wajdeczko
2026-07-03 20:49 ` Michał Winiarski
2026-06-30 13:26 ` [PATCH 12/13] drm/xe/tests: Add migration packet test Michal Wajdeczko
2026-07-03 13:44 ` Michał Winiarski
2026-07-06 16:42 ` Michal Wajdeczko
2026-06-30 13:26 ` [PATCH 13/13] drm/xe/pf: Handle migration descriptor using KLV helpers Michal Wajdeczko
2026-07-03 20:50 ` Michał Winiarski
2026-06-30 13:47 ` ✗ CI.checkpatch: warning for drm/xe: Add and use more " Patchwork
2026-06-30 13:49 ` ✓ CI.KUnit: success " Patchwork
2026-06-30 14:42 ` ✓ Xe.CI.BAT: " Patchwork
2026-07-01 5:22 ` ✓ Xe.CI.FULL: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260630132633.32804-2-michal.wajdeczko@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.