1. May 20, 2021
  2. May 12, 2021
  3. May 11, 2021
    • Alex Deucher's avatar
      drm/amdgpu/display: remove an old DCN3 guard · effbf6ca
      Alex Deucher authored
      
      
      The DCN3 guards were dropped a while ago, this one must have
      snuck in in a merge or something.
      
      Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      effbf6ca
    • Zhen Lei's avatar
      drm/amdgpu: Delete two unneeded bool conversions · 0bb6d3db
      Zhen Lei authored
      
      
      The result of an expression consisting of a single relational operator is
      already of the bool type and does not need to be evaluated explicitly.
      
      No functional change.
      
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      0bb6d3db
    • Zhen Lei's avatar
      drm/amd/display: Delete several unneeded bool conversions · ea23ff02
      Zhen Lei authored
      
      
      The result of an expression consisting of a single relational operator is
      already of the bool type and does not need to be evaluated explicitly.
      
      No functional change.
      
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      ea23ff02
    • David Ward's avatar
      drm/amd/display: Initialize attribute for hdcp_srm sysfs file · 29b25b70
      David Ward authored
      It is stored in dynamically allocated memory, so sysfs_bin_attr_init() must
      be called to initialize it. (Note: "initialization" only sets the .attr.key
      member in this struct; it does not change the value of any other members.)
      
      Otherwise, when CONFIG_DEBUG_LOCK_ALLOC=y this message appears during boot:
      
          BUG: key ffff9248900cd148 has not been registered!
      
      Fixes: 9037246b ("drm/amd/display: Add sysfs interface for set/get srm")
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1586
      
      
      Reported-by: default avatarMikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
      Signed-off-by: default avatarDavid Ward <david.ward@gatech.edu>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      29b25b70
    • Gustavo A. R. Silva's avatar
      drm/amd/pm: Fix out-of-bounds bug · 564ac172
      Gustavo A. R. Silva authored
      Create new structure SISLANDS_SMC_SWSTATE_SINGLE, as initialState.levels
      and ACPIState.levels are never actually used as flexible arrays. Those
      arrays can be used as simple objects of type
      SISLANDS_SMC_HW_PERFORMANCE_LEVEL, instead.
      
      Currently, the code fails because flexible array _levels_ in
      struct SISLANDS_SMC_SWSTATE doesn't allow for code that accesses
      the first element of initialState.levels and ACPIState.levels
      arrays:
      
      drivers/gpu/drm/amd/pm/powerplay/si_dpm.c:
      4820: table->initialState.levels[0].mclk.vDLL_CNTL =
      4821:         cpu_to_be32(si_pi->clock_registers.dll_cntl);
      ...
      5021: table->ACPIState.levels[0].mclk.vDLL_CNTL =
      5022:         cpu_to_be32(dll_cntl);
      
      because such element cannot be accessed without previously allocating
      enough dynamic memory for it to exist (which never actually happens).
      So, there is an out-of-bounds bug in this case.
      
      That's why struct SISLANDS_SMC_SWSTATE should only be used as type
      for object driverState and new struct SISLANDS_SMC_SWSTATE_SINGLE is
      created as type for objects initialState, ACPIState and ULVState.
      
      Also, with the change from one-element array to flexible-array member
      in commit 0e1aa13c ("drm/amd/pm: Replace one-element array with
      flexible-array in struct SISLANDS_SMC_SWSTATE"), the size of
      dpmLevels in struct SISLANDS_SMC_STATETABLE should be fixed to be
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE instead of
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1.
      
      Fixes: 0e1aa13c
      
       ("drm/amd/pm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE")
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      564ac172
    • Gustavo A. R. Silva's avatar
      drm/radeon/si_dpm: Fix SMU power state load · cc1a54d8
      Gustavo A. R. Silva authored
      Create new structure SISLANDS_SMC_SWSTATE_SINGLE, as initialState.levels
      and ACPIState.levels are never actually used as flexible arrays. Those
      arrays can be used as simple objects of type
      SISLANDS_SMC_HW_PERFORMANCE_LEVEL, instead.
      
      Currently, the code fails because flexible array _levels_ in
      struct SISLANDS_SMC_SWSTATE doesn't allow for code that access
      the first element of initialState.levels and ACPIState.levels
      arrays:
      
      4353         table->initialState.levels[0].mclk.vDLL_CNTL =
      4354                 cpu_to_be32(si_pi->clock_registers.dll_cntl);
      ...
      4555         table->ACPIState.levels[0].mclk.vDLL_CNTL =
      4556                 cpu_to_be32(dll_cntl);
      
      because such element cannot exist without previously allocating
      any dynamic memory for it (which never actually happens).
      
      That's why struct SISLANDS_SMC_SWSTATE should only be used as type
      for object driverState and new struct SISLANDS_SMC_SWSTATE_SINGLE is
      created as type for objects initialState, ACPIState and ULVState.
      
      Also, with the change from one-element array to flexible-array member
      in commit 96e27e8d ("drm/radeon/si_dpm: Replace one-element array
      with flexible-array in struct SISLANDS_SMC_SWSTATE"), the size of
      dpmLevels in struct SISLANDS_SMC_STATETABLE should be fixed to be
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE instead of
      SISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1.
      
      Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/1583
      Fixes: 96e27e8d
      
       ("drm/radeon/si_dpm: Replace one-element array with flexible-array in struct SISLANDS_SMC_SWSTATE")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Tested-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      cc1a54d8
    • Gustavo A. R. Silva's avatar
      drm/radeon/ni_dpm: Fix booting bug · 29377441
      Gustavo A. R. Silva authored
      Create new structure NISLANDS_SMC_SWSTATE_SINGLE, as initialState.levels
      and ACPIState.levels are never actually used as flexible arrays. Those
      arrays can be used as simple objects of type
      NISLANDS_SMC_HW_PERFORMANCE_LEVEL, instead.
      
      Currently, the code fails because flexible array _levels_ in
      struct NISLANDS_SMC_SWSTATE doesn't allow for code that access
      the first element of initialState.levels and ACPIState.levels
      arrays:
      
      drivers/gpu/drm/radeon/ni_dpm.c:
      1690         table->initialState.levels[0].mclk.vMPLL_AD_FUNC_CNTL =
      1691                 cpu_to_be32(ni_pi->clock_registers.mpll_ad_func_cntl);
      ...
      1903:   table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL = cpu_to_be32(mpll_ad_func_cntl);
      1904:   table->ACPIState.levels[0].mclk.vMPLL_AD_FUNC_CNTL_2 = cpu_to_be32(mpll_ad_func_cntl_2);
      
      because such element cannot exist without previously allocating
      any dynamic memory for it (which never actually happens).
      
      That's why struct NISLANDS_SMC_SWSTATE should only be used as type
      for object driverState and new struct SISLANDS_SMC_SWSTATE_SINGLE is
      created as type for objects initialState, ACPIState and ULVState.
      
      Also, with the change from one-element array to flexible-array member
      in commit 434fb1e7 ("drm/radeon/nislands_smc.h: Replace one-element
      array with flexible-array member in struct NISLANDS_SMC_SWSTATE"), the
      size of dpmLevels in struct NISLANDS_SMC_STATETABLE should be fixed to
      be NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE instead of
      NISLANDS_MAX_SMC_PERFORMANCE_LEVELS_PER_SWSTATE - 1.
      
      Bug: https://lore.kernel.org/dri-devel/3eedbe78-1fbd-4763-a7f3-ac5665e76a4a@xenosoft.de/
      Fixes: 434fb1e7
      
       ("drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in struct NISLANDS_SMC_SWSTATE")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
      Tested-by: default avatarChristian Zigotzky <chzigotzky@xenosoft.de>
      Link: https://lore.kernel.org/dri-devel/9bb5fcbd-daf5-1669-b3e7-b8624b3c36f9@xenosoft.de/
      
      
      Signed-off-by: default avatarGustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      29377441