1. 24 Mar, 2021 13 commits
  2. 10 Mar, 2021 23 commits
  3. 05 Mar, 2021 4 commits
    • Holger Hoffstätte's avatar
      drm/amdgpu/display: use GFP_ATOMIC in dcn21_validate_bandwidth_fp() · 37ba52c6
      Holger Hoffstätte authored
      After fixing nested FPU contexts caused by 41401ac6 we're still seeing
      complaints about spurious kernel_fpu_end(). As it turns out this was
      already fixed for dcn20 in commit f41ed88c ("drm/amdgpu/display:
      use GFP_ATOMIC in dcn20_validate_bandwidth_internal") but never moved
      forward to dcn21.
      Signed-off-by: default avatarHolger Hoffstätte <holger@applied-asynchrony.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      37ba52c6
    • Holger Hoffstätte's avatar
      drm/amd/display: Fix nested FPU context in dcn21_validate_bandwidth() · b42c68fa
      Holger Hoffstätte authored
      Commit 41401ac6 added FPU wrappers to dcn21_validate_bandwidth(),
      which was correct. Unfortunately a nested function alredy contained
      DC_FP_START()/DC_FP_END() calls, which results in nested FPU context
      enter/exit and complaints by kernel_fpu_begin_mask().
      This can be observed e.g. with 5.10.20, which backported 41401ac6
      and now emits the following warning on boot:
      
      WARNING: CPU: 6 PID: 858 at arch/x86/kernel/fpu/core.c:129 kernel_fpu_begin_mask+0xa5/0xc0
      Call Trace:
       dcn21_calculate_wm+0x47/0xa90 [amdgpu]
       dcn21_validate_bandwidth_fp+0x15d/0x2b0 [amdgpu]
       dcn21_validate_bandwidth+0x29/0x40 [amdgpu]
       dc_validate_global_state+0x3c7/0x4c0 [amdgpu]
      
      The warning is emitted due to the additional DC_FP_START/END calls in
      patch_bounding_box(), which is inlined into dcn21_calculate_wm(),
      its only caller. Removing the calls brings the code in line with
      dcn20 and makes the warning disappear.
      
      Fixes: 41401ac6 ("drm/amd/display: Add FPU wrappers to dcn21_validate_bandwidth()")
      Signed-off-by: default avatarHolger Hoffstätte <holger@applied-asynchrony.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      b42c68fa
    • Gustavo A. R. Silva's avatar
      drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE · 96e27e8d
      Gustavo A. R. Silva authored
      There is a regular need in the kernel to provide a way to declare having
      a dynamically sized set of trailing elements in a structure. Kernel code
      should always use “flexible array members”[1] for these cases. The older
      style of one-element or zero-length arrays should no longer be used[2].
      
      Refactor the code according to the use of a flexible-array member in
      struct SISLANDS_SMC_SWSTATE, instead of a one-element array, and use
      the struct_size() helper to calculate the size for the allocation.
      
      Also, this helps with the ongoing efforts to enable -Warray-bounds by
      fixing the following warnings:
      
      drivers/gpu/drm/radeon/si_dpm.c: In function ‘si_convert_power_state_to_smc’:
      drivers/gpu/drm/radeon/si_dpm.c:2350:20: warning: array subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
       2350 |   smc_state->levels[i].dpm2.MaxPS = (u8)((SISLANDS_DPM2_MAX_PULSE_SKIP * (max_sclk - min_sclk)) / max_sclk);
            |   ~~~~~~~~~~~~~~~~~^~~
      drivers/gpu/drm/radeon/si_dpm.c:2351:20: warning: array subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
       2351 |   smc_state->levels[i].dpm2.NearTDPDec = SISLANDS_DPM2_NEAR_TDP_DEC;
            |   ~~~~~~~~~~~~~~~~~^~~
      drivers/gpu/drm/radeon/si_dpm.c:2352:20: warning: array subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
       2352 |   smc_state->levels[i].dpm2.AboveSafeInc = SISLANDS_DPM2_ABOVE_SAFE_INC;
            |   ~~~~~~~~~~~~~~~~~^~~
      drivers/gpu/drm/radeon/si_dpm.c:2353:20: warning: array subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
       2353 |   smc_state->levels[i].dpm2.BelowSafeInc = SISLANDS_DPM2_BELOW_SAFE_INC;
            |   ~~~~~~~~~~~~~~~~~^~~
      drivers/gpu/drm/radeon/si_dpm.c:2354:20: warning: array subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
       2354 |   smc_state->levels[i].dpm2.PwrEfficiencyRatio = cpu_to_be16(pwr_efficiency_ratio);
            |   ~~~~~~~~~~~~~~~~~^~~
      drivers/gpu/drm/radeon/si_dpm.c:5105:20: warning: array subscript 1 is above array bounds of ‘SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’ {aka ‘struct SISLANDS_SMC_HW_PERFORMANCE_LEVEL[1]’} [-Warray-bounds]
       5105 |   smc_state->levels[i + 1].aT = cpu_to_be32(a_t);
            |   ~~~~~~~~~~~~~~~~~^~~~~~~
      
      [1] https://en.wikipedia.org/wiki/Flexible_array_member
      [2] https://www.kernel.org/doc/html/v5.9/process/deprecated.html#zero-length-and-one-element-arrays
      
      Link: https://github.com/KSPP/linux/issues/79
      Link: https://github.com/KSPP/linux/issues/109Build-tested-by: default avatarkernel test robot <lkp@intel.com>
      Link: https://lore.kernel.org/lkml/603f9a8f.aDLrpMFzzSApzVYQ%25lkp@intel.com/Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      96e27e8d
    • Colin Ian King's avatar
      drm/amdgpu/display: remove redundant continue statement · 08f3dddb
      Colin Ian King authored
      The continue statement in a for-loop is redudant and can be removed.
      Clean up the code to address this.
      
      Addresses-Coverity: ("Continue as no effect")
      Fixes: b6f91fc1 ("drm/amdgpu/display: buffer INTERRUPT_LOW_IRQ_CONTEXT interrupt work")
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      08f3dddb