]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/msm/a6xx: Fix GMU firmware parser
authorAkhil P Oommen <akhilpo@oss.qualcomm.com>
Wed, 10 Sep 2025 20:44:05 +0000 (02:14 +0530)
committerRob Clark <robin.clark@oss.qualcomm.com>
Thu, 16 Oct 2025 14:45:29 +0000 (07:45 -0700)
Current parser logic for GMU firmware assumes a dword aligned payload
size for every block. This is not true for all GMU firmwares. So, fix
this by using correct 'size' value in the calculation for the offset
for the next block's header.

Fixes: c6ed04f856a4 ("drm/msm/a6xx: A640/A650 GMU firmware path")
Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Acked-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/674040/
Message-ID: <20250911-assorted-sept-1-v2-2-a8bf1ee20792@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>
drivers/gpu/drm/msm/adreno/a6xx_gmu.c

index fc62fef2fed87f065cb8fa4e997abefe4ff11cd5..4e6dc16e4a4c4846f8a174c663a25452aa433f12 100644 (file)
@@ -780,6 +780,9 @@ static bool fw_block_mem(struct a6xx_gmu_bo *bo, const struct block_header *blk)
        return true;
 }
 
+#define NEXT_BLK(blk) \
+       ((const struct block_header *)((const char *)(blk) + sizeof(*(blk)) + (blk)->size))
+
 static int a6xx_gmu_fw_load(struct a6xx_gmu *gmu)
 {
        struct a6xx_gpu *a6xx_gpu = container_of(gmu, struct a6xx_gpu, gmu);
@@ -811,7 +814,7 @@ static int a6xx_gmu_fw_load(struct a6xx_gmu *gmu)
 
        for (blk = (const struct block_header *) fw_image->data;
             (const u8*) blk < fw_image->data + fw_image->size;
-            blk = (const struct block_header *) &blk->data[blk->size >> 2]) {
+            blk = NEXT_BLK(blk)) {
                if (blk->size == 0)
                        continue;