Skip to content

Commit b4789aa

Browse files
akhilpo-qcomRob Clark
authored andcommitted
drm/msm/a6xx: Fix GMU firmware parser
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: c6ed04f ("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>
1 parent 830d68f commit b4789aa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/gpu/drm/msm/adreno/a6xx_gmu.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,9 @@ static bool fw_block_mem(struct a6xx_gmu_bo *bo, const struct block_header *blk)
780780
return true;
781781
}
782782

783+
#define NEXT_BLK(blk) \
784+
((const struct block_header *)((const char *)(blk) + sizeof(*(blk)) + (blk)->size))
785+
783786
static int a6xx_gmu_fw_load(struct a6xx_gmu *gmu)
784787
{
785788
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)
811814

812815
for (blk = (const struct block_header *) fw_image->data;
813816
(const u8*) blk < fw_image->data + fw_image->size;
814-
blk = (const struct block_header *) &blk->data[blk->size >> 2]) {
817+
blk = NEXT_BLK(blk)) {
815818
if (blk->size == 0)
816819
continue;
817820

0 commit comments

Comments
 (0)