]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/pm: Limit jpeg rings as per max for jpeg_v_4_0_3
authorAsad Kamal <asad.kamal@amd.com>
Fri, 14 Feb 2025 05:54:01 +0000 (13:54 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 17 Feb 2025 19:09:30 +0000 (14:09 -0500)
Since pmfw supports for smuv13_0_6 is limited to 8 jpeg rings per instance,
which is the max for jpeg_v_4_0_3. Limit it to same to avoid out
of bound access.

Fixes: 568199a5c7a9 ("drm/amd/pm: Limit to 8 jpeg rings per instance")
Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_6_ppt.c

index 3fa671f4981cd81fd0d99f3142dd5a6bf9904bb5..9f2de69f53b286835df46f3ccaa69ffb9b58aa33 100644 (file)
@@ -2644,7 +2644,7 @@ static ssize_t smu_v13_0_6_get_gpu_metrics(struct smu_context *smu, void **table
 
        per_inst = smu_v13_0_6_cap_supported(smu, SMU_CAP(PER_INST_METRICS));
 
-       num_jpeg_rings = max_t(u8, adev->jpeg.num_jpeg_rings, 8);
+       num_jpeg_rings = AMDGPU_MAX_JPEG_RINGS_4_0_3;
        for_each_xcp(adev->xcp_mgr, xcp, i) {
                amdgpu_xcp_get_inst_details(xcp, AMDGPU_XCP_VCN, &inst_mask);
                idx = 0;