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 <[email protected]>
---
 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 0cd8ae1b4f5c..3f96b10b5f61 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.h
@@ -111,7 +111,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 7bec4e509d2c..c0b9661131e8 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 4f5dbf46132b..09b6bc464b47 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_hfi.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_hfi.c
@@ -1062,8 +1062,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
@@ -1082,12 +1082,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

Reply via email to