[PATCH 2/5] drm/xe/oa: Print hwe to OA unit mapping

Umesh Nerlige Ramappa umesh.nerlige.ramappa at intel.com
Wed Jun 4 23:49:11 UTC 2025


On Tue, Jun 03, 2025 at 01:21:30PM -0700, Ashutosh Dixit wrote:
>Print hwe to OA unit mapping to dmesg, to help debug for current and new
>platforms.
>
>Signed-off-by: Ashutosh Dixit <ashutosh.dixit at intel.com>
>---
> drivers/gpu/drm/xe/xe_oa.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>
>diff --git a/drivers/gpu/drm/xe/xe_oa.c b/drivers/gpu/drm/xe/xe_oa.c
>index 0de0d5a18df74..94faa4ed2012f 100644
>--- a/drivers/gpu/drm/xe/xe_oa.c
>+++ b/drivers/gpu/drm/xe/xe_oa.c
>@@ -2603,6 +2603,31 @@ static int xe_oa_init_gt(struct xe_gt *gt)
> 	return 0;
> }
>
>+static void xe_oa_print_oa_units(struct xe_oa *oa)
>+{
>+	enum xe_hw_engine_id hwe_id;
>+	struct xe_hw_engine *hwe;
>+	struct xe_oa_unit *u;
>+	struct xe_gt *gt;
>+	int gt_id, i, n;
>+	char buf[256];
>+
>+	for_each_gt(gt, oa->xe, gt_id) {
>+		for (i = 0; i < gt->oa.num_oa_units; i++) {
>+			u = &gt->oa.oa_unit[i];
>+			buf[0] = '\0';
>+			n = 0;
>+
>+			for_each_hw_engine(hwe, gt, hwe_id)
>+				if (xe_oa_unit_id(hwe) == u->oa_unit_id)
>+					n += scnprintf(buf + n, sizeof(buf) - n, "%s ", hwe->name);
>+
>+			xe_gt_dbg(gt, "oa_unit %d, type %d, Engines: %s\n",
>+				  u->oa_unit_id, u->type, buf);
>+		}
>+	}
>+}
>+

nit: I would at least move one of the inner for loops outside to a 
separate helper.

otherwise, LGTM

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>

Thanks,
Umesh

> static int xe_oa_init_oa_units(struct xe_oa *oa)
> {
> 	struct xe_gt *gt;
>@@ -2619,6 +2644,8 @@ static int xe_oa_init_oa_units(struct xe_oa *oa)
> 			return ret;
> 	}
>
>+	xe_oa_print_oa_units(oa);
>+
> 	return 0;
> }
>
>-- 
>2.48.1
>


More information about the Intel-xe mailing list