1. 20 May, 2021 28 commits
  2. 12 May, 2021 2 commits
  3. 11 May, 2021 4 commits
  4. 10 May, 2021 6 commits
    • 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
    • Dwaipayan Ray's avatar
      drm/amd/amdgpu: Fix errors in function documentation · c666bbf0
      Dwaipayan Ray authored
      Fix a couple of syntax errors and removed one excess
      parameter in the function documentations which lead
      to kernel docs build warning.
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarDwaipayan Ray <dwaipayanray1@gmail.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      c666bbf0
    • Rouven Czerwinski's avatar
      drm/amd/display: remove unused function dc_link_perform_link_training · 28ea8752
      Rouven Czerwinski authored
      This function is not used anywhere, remove it. It was added in
      40dd6bd3 ("drm/amd/display: Linux Set/Read link rate and lane count
      through debugfs") and moved in fe798de5 ("drm/amd/display: Move link
      functions from dc to dc_link"), but a user is missing.
      Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarRouven Czerwinski <r.czerwinski@pengutronix.de>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      28ea8752
    • Dennis Li's avatar
      drm/amdgpu: add function to clear MMEA error status for aldebaran · 7780f503
      Dennis Li authored
      For aldebaran, hardware will not clear error status automatically when
      reading error status register, insteadly driver should set clear bit of
      the error status register explicitly to clear error status.
      Signed-off-by: default avatarDennis Li <Dennis.Li@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      7780f503