[PATCH 04/16] drm/msm/a6xx: Add support for Debug HFI Q

Akhil P Oommen
2026-03-23T20:13:03Z

Add the Debug HFI Queue which contains the F2H messages posted from the
GMU firmware. Having this data in coredump is useful to debug firmware
issues.

Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
---
drivers/gpu/drm/msm/adreno/a6xx_gmu.h | 2 +-
drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 2 +-
drivers/gpu/drm/msm/adreno/a6xx_hfi.c | 16 +++++++++++++---
drivers/gpu/drm/msm/adreno/a6xx_hfi.h | 2 ++
4 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
index 2af074c8e8cf..dd0614b19aac 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -110,7 +110,7 @@ struct a6xx_gmu {

unsigned long freq;

- struct a6xx_hfi_queue queues[2];
+ struct a6xx_hfi_queue queues[HFI_MAX_QUEUES];

bool initialized;
bool hung;
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
index d2d6b2fd3cba..018c164ad980 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
@@ -57,7 +57,7 @@ struct a6xx_gpu_state {
struct msm_gpu_state_bo *gmu_hfi;
struct msm_gpu_state_bo *gmu_debug;

- s32 hfi_queue_history[2][HFI_HISTORY_SZ];
+ s32 hfi_queue_history[HFI_MAX_QUEUES][HFI_HISTORY_SZ];

struct list_head objs;

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c b/drivers/gpu/drm/msm/adreno/a6xx_hfi.c
index 53cfdf4e6c34..2daaa340366d 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_hfi.c
@@ -1056,8 +1056,8 @@ void a6xx_hfi_init(struct a6xx_gmu *gmu)
struct a6xx_gmu_bo *hfi = &gmu->hfi;
struct a6xx_hfi_queue_table_header *table = hfi->virt;
struct a6xx_hfi_queue_header *headers = hfi->virt + sizeof(*table);
+ int table_size, idx;
u64 offset;
- int table_size;

/*
* The table size is the size of the table header plus all of the queue
@@ -1076,12 +1076,22 @@ void a6xx_hfi_init(struct a6xx_gmu *gmu)
table->active_queues = ARRAY_SIZE(gmu->queues);

/* Command queue */
+ idx = 0;
offset = SZ_4K;
- a6xx_hfi_queue_init(&gmu->queues[0], &headers[0], hfi->virt + offset,
+ a6xx_hfi_queue_init(&gmu->queues[idx], &headers[idx], hfi->virt + offset,
hfi->iova + offset, 0);

/* GMU response queue */
+ idx++;
offset += SZ_4K;
- a6xx_hfi_queue_init(&gmu->queues[1], &headers[1], hfi->virt + offset,
+ a6xx_hfi_queue_init(&gmu->queues[idx], &headers[idx], hfi->virt + offset,
hfi->iova + offset, gmu->legacy ? 4 : 1);
+
+ /* GMU Debug queue */
+ idx++;
+ offset += SZ_4K;
+ a6xx_hfi_queue_init(&gmu->queues[idx], &headers[idx], hfi->virt + offset,
+ hfi->iova + offset, gmu->legacy ? 5 : 2);
+
+ WARN_ON(idx >= HFI_MAX_QUEUES);
}
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_hfi.h b/drivers/gpu/drm/msm/adreno/a6xx_hfi.h
index 6f9f74a0bc85..19f6eca2c8c9 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_hfi.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_hfi.h
@@ -4,6 +4,8 @@
#ifndef _A6XX_HFI_H_
#define _A6XX_HFI_H_

+#define HFI_MAX_QUEUES 3
+
struct a6xx_hfi_queue_table_header {
u32 version;
u32 size; /* Size of the queue table in dwords */

--
2.51.0