Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: fix num_ways overflow error

[Why]
Helper function calculates num_ways using 32-bit. But is
returned as 8-bit. If num_ways exceeds 8-bit, then it
reports back the incorrect num_ways and erroneously
uses MALL when it should not

[How]
Make returned value 32-bit and convert after it checks
against caps.cache_num_ways, which is under 8-bit

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Roman Li <roman.li@amd.com>
Signed-off-by: Samson Tam <samson.tam@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Samson Tam and committed by
Alex Deucher
79f3f1b6 c4066d8b

+4 -3
+4 -3
drivers/gpu/drm/amd/display/dc/hwss/dcn32/dcn32_hwseq.c
··· 217 217 static uint32_t dcn32_calculate_cab_allocation(struct dc *dc, struct dc_state *ctx) 218 218 { 219 219 int i; 220 - uint8_t num_ways = 0; 220 + uint32_t num_ways = 0; 221 221 uint32_t mall_ss_size_bytes = 0; 222 222 223 223 mall_ss_size_bytes = ctx->bw_ctx.bw.dcn.mall_ss_size_bytes; ··· 247 247 bool dcn32_apply_idle_power_optimizations(struct dc *dc, bool enable) 248 248 { 249 249 union dmub_rb_cmd cmd; 250 - uint8_t ways, i; 250 + uint8_t i; 251 + uint32_t ways; 251 252 int j; 252 253 bool mall_ss_unsupported = false; 253 254 struct dc_plane_state *plane = NULL; ··· 308 307 cmd.cab.header.type = DMUB_CMD__CAB_FOR_SS; 309 308 cmd.cab.header.sub_type = DMUB_CMD__CAB_DCN_SS_FIT_IN_CAB; 310 309 cmd.cab.header.payload_bytes = sizeof(cmd.cab) - sizeof(cmd.cab.header); 311 - cmd.cab.cab_alloc_ways = ways; 310 + cmd.cab.cab_alloc_ways = (uint8_t)ways; 312 311 313 312 dm_execute_dmub_cmd(dc->ctx, &cmd, DM_DMUB_WAIT_TYPE_NO_WAIT); 314 313