1. 27 Mar, 2024 1 commit
  2. 22 Mar, 2024 38 commits
    • Mario Limonciello's avatar
      drm/amd: Flush GFXOFF requests in prepare stage · 0355b24b
      Mario Limonciello authored
      If the system hasn't entered GFXOFF when suspend starts it can cause
      hangs accessing GC and RLC during the suspend stage.
      
      Cc: <stable@vger.kernel.org> # 6.1.y: 5095d541 ("drm/amd: Evict resources during PM ops prepare() callback")
      Cc: <stable@vger.kernel.org> # 6.1.y: cb11ca32 ("drm/amd: Add concept of running prepare_suspend() sequence for IP blocks")
      Cc: <stable@vger.kernel.org> # 6.1.y: 2ceec37b ("drm/amd: Add missing kernel doc for prepare_suspend()")
      Cc: <stable@vger.kernel.org> # 6.1.y: 3a9626c8 ("drm/amd: Stop evicting resources on APUs in suspend")
      Cc: <stable@vger.kernel.org> # 6.6.y: 5095d541 ("drm/amd: Evict resources during PM ops prepare() callback")
      Cc: <stable@vger.kernel.org> # 6.6.y: cb11ca32 ("drm/amd: Add concept of running prepare_suspend() sequence for IP blocks")
      Cc: <stable@vger.kernel.org> # 6.6.y: 2ceec37b ("drm/amd: Add missing kernel doc for prepare_suspend()")
      Cc: <stable@vger.kernel.org> # 6.6.y: 3a9626c8 ("drm/amd: Stop evicting resources on APUs in suspend")
      Cc: <stable@vger.kernel.org> # 6.1+
      Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3132
      Fixes: ab475033 ("drm/amdgpu/sdma5.2: add begin/end_use ring callbacks")
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      0355b24b
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix truncations in gfx_v11_0_init_microcode() · eb4f6eca
      Srinivasan Shanmugam authored
      Reducing the size of ucode_prefix to 25 in the gfx_v11_0_init_microcode
      function. This would ensure that the total number of characters being
      written into fw_name does not exceed its size of 40.
      
      Fixes the below with gcc W=1:
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c: In function ‘gfx_v11_0_early_init’:
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:523:54: warning: ‘_pfp.bin’ directive output may be truncated writing 8 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
        523 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix);
            |                                                      ^~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:523:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 40
        523 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", ucode_prefix);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:540:54: warning: ‘_me.bin’ directive output may be truncated writing 7 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
        540 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix);
            |                                                      ^~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:540:9: note: ‘snprintf’ output between 15 and 44 bytes into a destination of size 40
        540 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", ucode_prefix);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:557:70: warning: ‘_rlc.bin’ directive output may be truncated writing 8 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
        557 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
            |                                                                      ^~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:557:25: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 40
        557 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:569:54: warning: ‘_mec.bin’ directive output may be truncated writing 8 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
        569 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix);
            |                                                      ^~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v11_0.c:569:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 40
        569 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", ucode_prefix);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        CC [M]  drivers/gpu/drm/amd/amdgpu/../pm/powerplay/hwmgr/smu7_clockpowergating.o
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      eb4f6eca
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix truncation in smu_v11_0_init_microcode · 730dd50f
      Srinivasan Shanmugam authored
      Reducing the size of ucode_prefix to 25 in the smu_v11_0_init_microcode
      function. we ensure that fw_name can accommodate the maximum possible
      string size
      
      Fixes the below with gcc W=1:
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/smu_v11_0.c: In function ‘smu_v11_0_init_microcode’:
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/smu_v11_0.c:110:54: warning: ‘.bin’ directive output may be truncated writing 4 bytes into a region of size between 0 and 29 [-Wformat-truncation=]
        110 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
            |                                                      ^~~~
      drivers/gpu/drm/amd/amdgpu/../pm/swsmu/smu11/smu_v11_0.c:110:9: note: ‘snprintf’ output between 12 and 41 bytes into a destination of size 36
        110 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      730dd50f
    • Tao Zhou's avatar
      drm/amdgpu: simplify convert_error_address interface for UMC v12 · 8e4617c2
      Tao Zhou authored
      Replace separate parameters with struct ta_ras_query_address_input.
      Signed-off-by: default avatarTao Zhou <tao.zhou1@amd.com>
      Reviewed-by: default avatarStanley.Yang <Stanley.Yang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      8e4617c2
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix truncation issues in gfx_v9_0.c · 539ff12e
      Srinivasan Shanmugam authored
      The size of fw_name is increased to ensure that it can accommodate
      the maximum possible size of the string being written into it.
      
      Fixes the below with gcc W=1:
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c: In function ‘gfx_v9_0_early_init’:
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1255:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1255 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
            |                                                    ^~
      ......
       1393 |                 r = gfx_v9_0_init_cp_gfx_microcode(adev, ucode_prefix);
            |                                                          ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1255:9: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
       1255 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp.bin", chip_name);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1261:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1261 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
            |                                                    ^~
      ......
       1393 |                 r = gfx_v9_0_init_cp_gfx_microcode(adev, ucode_prefix);
            |                                                          ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1261:9: note: ‘snprintf’ output between 15 and 44 bytes into a destination of size 30
       1261 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me.bin", chip_name);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1267:52: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1267 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
            |                                                    ^~
      ......
       1393 |                 r = gfx_v9_0_init_cp_gfx_microcode(adev, ucode_prefix);
            |                                                          ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1267:9: note: ‘snprintf’ output between 15 and 44 bytes into a destination of size 30
       1267 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce.bin", chip_name);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1303:60: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1303 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc_am4.bin", chip_name);
            |                                                            ^~
      ......
       1398 |         r = gfx_v9_0_init_rlc_microcode(adev, ucode_prefix);
            |                                               ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1303:17: note: ‘snprintf’ output between 20 and 49 bytes into a destination of size 30
       1303 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc_am4.bin", chip_name);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1309:60: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1309 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_kicker_rlc.bin", chip_name);
            |                                                            ^~
      ......
       1398 |         r = gfx_v9_0_init_rlc_microcode(adev, ucode_prefix);
            |                                               ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1309:17: note: ‘snprintf’ output between 23 and 52 bytes into a destination of size 30
       1309 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_kicker_rlc.bin", chip_name);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1311:60: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1311 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
            |                                                            ^~
      ......
       1398 |         r = gfx_v9_0_init_rlc_microcode(adev, ucode_prefix);
            |                                               ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1311:17: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
       1311 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", chip_name);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1344:60: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1344 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sjt_mec.bin", chip_name);
            |                                                            ^~
      ......
       1402 |         r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
            |                                                      ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1344:17: note: ‘snprintf’ output between 20 and 49 bytes into a destination of size 30
       1344 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sjt_mec.bin", chip_name);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1346:60: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1346 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
            |                                                            ^~
      ......
       1402 |         r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
            |                                                      ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1346:17: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 30
       1346 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec.bin", chip_name);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1356:68: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1356 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sjt_mec2.bin", chip_name);
            |                                                                    ^~
      ......
       1402 |         r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
            |                                                      ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1356:25: note: ‘snprintf’ output between 21 and 50 bytes into a destination of size 30
       1356 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_sjt_mec2.bin", chip_name);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1358:68: warning: ‘%s’ directive output may be truncated writing up to 29 bytes into a region of size 23 [-Wformat-truncation=]
       1358 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
            |                                                                    ^~
      ......
       1402 |         r = gfx_v9_0_init_cp_compute_microcode(adev, ucode_prefix);
            |                                                      ~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v9_0.c:1358:25: note: ‘snprintf’ output between 17 and 46 bytes into a destination of size 30
       1358 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2.bin", chip_name);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      539ff12e
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix truncation in gfx_v10_0_init_microcode · 927a8a80
      Srinivasan Shanmugam authored
      The total size of the fw_name buffer is 8 (for "amdgpu/") + 30 (for
      ucode_prefix) + 5 (for "_pfp") + 5 (for "_wks") + 5 (for ".bin") = 53
      characters.
      
      Fixes the below with gcc W=1:
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c: In function ‘gfx_v10_0_early_init’:
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3982:58: warning: ‘%s’ directive output may be truncated writing up to 4 bytes into a region of size between 0 and 29 [-Wformat-truncation=]
       3982 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
            |                                                          ^~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3982:9: note: ‘snprintf’ output between 16 and 49 bytes into a destination of size 40
       3982 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_pfp%s.bin", ucode_prefix, wks);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3988:57: warning: ‘%s’ directive output may be truncated writing up to 4 bytes into a region of size between 1 and 30 [-Wformat-truncation=]
       3988 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", ucode_prefix, wks);
            |                                                         ^~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3988:9: note: ‘snprintf’ output between 15 and 48 bytes into a destination of size 40
       3988 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_me%s.bin", ucode_prefix, wks);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3994:57: warning: ‘%s’ directive output may be truncated writing up to 4 bytes into a region of size between 1 and 30 [-Wformat-truncation=]
       3994 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
            |                                                         ^~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:3994:9: note: ‘snprintf’ output between 15 and 48 bytes into a destination of size 40
       3994 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_ce%s.bin", ucode_prefix, wks);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4001:62: warning: ‘_rlc.bin’ directive output may be truncated writing 8 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
       4001 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
            |                                                              ^~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4001:17: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 40
       4001 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_rlc.bin", ucode_prefix);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4017:58: warning: ‘%s’ directive output may be truncated writing up to 4 bytes into a region of size between 0 and 29 [-Wformat-truncation=]
       4017 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
            |                                                          ^~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4017:9: note: ‘snprintf’ output between 16 and 49 bytes into a destination of size 40
       4017 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec%s.bin", ucode_prefix, wks);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4024:54: warning: ‘_mec2’ directive output may be truncated writing 5 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
       4024 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
            |                                                      ^~~~~
      drivers/gpu/drm/amd/amdgpu/gfx_v10_0.c:4024:9: note: ‘snprintf’ output between 17 and 50 bytes into a destination of size 40
       4024 |         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mec2%s.bin", ucode_prefix, wks);
            |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      927a8a80
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix 'fw_name' buffer size to prevent truncations in amdgpu_mes_init_microcode · 20fd1446
      Srinivasan Shanmugam authored
      The snprintf function is used to write a formatted string into fw_name.
      The format of the string is "amdgpu/%s_mes%s.bin", where %s is replaced
      by the string in ucode_prefix and the second %s is replaced by either
      "_2" or "1" depending on the condition pipe == AMDGPU_MES_SCHED_PIPE.
      
      The length of the string "amdgpu/%s_mes%s.bin" is 16 characters plus the
      length of ucode_prefix and the length of the string "_2" or "1". The
      size of ucode_prefix is 30, so the maximum length of ucode_prefix is 29
      characters (since one character is needed for the null terminator).
      Therefore, the maximum possible length of the string written into
      fw_name is 16 + 29 + 2 = 47 characters.
      
      The size of fw_name is 40, so if the length of the string written into
      fw_name is more than 39 characters (since one character is needed for
      the null terminator), it will be truncated by the snprintf function, and
      thus warnings will be seen.
      
      By increasing the size of fw_name to 50, we ensure that fw_name is
      large enough to hold the maximum possible length of the string, so the
      snprintf function will not truncate the output.
      
      Fixes the below with gcc W=1:
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c: In function ‘amdgpu_mes_init_microcode’:
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1482:66: warning: ‘%s’ directive output may be truncated writing up to 1 bytes into a region of size between 0 and 29 [-Wformat-truncation=]
       1482 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
            |                                                                  ^~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1482:17: note: ‘snprintf’ output between 16 and 46 bytes into a destination of size 40
       1482 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       1483 |                          ucode_prefix,
            |                          ~~~~~~~~~~~~~
       1484 |                          pipe == AMDGPU_MES_SCHED_PIPE ? "" : "1");
            |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1477:66: warning: ‘%s’ directive output may be truncated writing 1 byte into a region of size between 0 and 29 [-Wformat-truncation=]
       1477 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
            |                                                                  ^~
       1478 |                          ucode_prefix,
       1479 |                          pipe == AMDGPU_MES_SCHED_PIPE ? "_2" : "1");
            |                                                                 ~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1477:17: note: ‘snprintf’ output between 17 and 46 bytes into a destination of size 40
       1477 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       1478 |                          ucode_prefix,
            |                          ~~~~~~~~~~~~~
       1479 |                          pipe == AMDGPU_MES_SCHED_PIPE ? "_2" : "1");
            |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1477:66: warning: ‘%s’ directive output may be truncated writing 2 bytes into a region of size between 0 and 29 [-Wformat-truncation=]
       1477 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
            |                                                                  ^~
       1478 |                          ucode_prefix,
       1479 |                          pipe == AMDGPU_MES_SCHED_PIPE ? "_2" : "1");
            |                                                          ~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1477:17: note: ‘snprintf’ output between 18 and 47 bytes into a destination of size 40
       1477 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes%s.bin",
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       1478 |                          ucode_prefix,
            |                          ~~~~~~~~~~~~~
       1479 |                          pipe == AMDGPU_MES_SCHED_PIPE ? "_2" : "1");
            |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1489:62: warning: ‘_mes.bin’ directive output may be truncated writing 8 bytes into a region of size between 4 and 33 [-Wformat-truncation=]
       1489 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin",
            |                                                              ^~~~~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_mes.c:1489:17: note: ‘snprintf’ output between 16 and 45 bytes into a destination of size 40
       1489 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_mes.bin",
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       1490 |                          ucode_prefix);
            |                          ~~~~~~~~~~~~~
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      20fd1446
    • Srinivasan Shanmugam's avatar
      drm/amdgpu: Fix format character cut-off issues in amdgpu_vcn_early_init() · 7c2bc34a
      Srinivasan Shanmugam authored
      Reducing the size of ucode_prefix to 25 in the amdgpu_vcn_early_init
      function. This would ensure that the total number of characters being
      written into fw_name does not exceed its size of 40.
      
      Fixes the below with gcc W=1:
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c: In function ‘amdgpu_vcn_early_init’:
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:102:66: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
        102 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
            |                                                                  ^
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:102:17: note: ‘snprintf’ output between 12 and 41 bytes into a destination of size 40
        102 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:102:66: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]
        102 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
            |                                                                  ^
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:102:17: note: ‘snprintf’ output between 12 and 41 bytes into a destination of size 40
        102 |                 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s.bin", ucode_prefix);
            |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:105:73: warning: ‘.bin’ directive output may be truncated writing 4 bytes into a region of size between 2 and 31 [-Wformat-truncation=]
        105 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_%d.bin", ucode_prefix, i);
            |                                                                         ^~~~
      drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c:105:25: note: ‘snprintf’ output between 14 and 43 bytes into a destination of size 40
        105 |                         snprintf(fw_name, sizeof(fw_name), "amdgpu/%s_%d.bin", ucode_prefix, i);
            |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Christian König <christian.koenig@amd.com>
      Suggested-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarSrinivasan Shanmugam <srinivasan.shanmugam@amd.com>
      Reviewed-by: default avatarLijo Lazar <lijo.lazar@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      7c2bc34a
    • Tao Zhou's avatar
      drm/amdgpu: add socket id parameter for psp query address cmd · 8b3495ea
      Tao Zhou authored
      And set the socket id.
      Signed-off-by: default avatarTao Zhou <tao.zhou1@amd.com>
      Reviewed-by: default avatarStanley.Yang <Stanley.Yang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      8b3495ea
    • Mukul Joshi's avatar
      drm/amdkfd: Cleanup workqueue during module unload · 417f78a2
      Mukul Joshi authored
      Destroy the high priority workqueue that handles interrupts
      during KFD node cleanup.
      Signed-off-by: default avatarMukul Joshi <mukul.joshi@amd.com>
      Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      417f78a2
    • Jonathan Kim's avatar
      drm/amdkfd: range check cp bad op exception interrupts · fb880635
      Jonathan Kim authored
      Due to a CP interrupt bug, bad packet garbage exception codes are raised.
      Do a range check so that the debugger and runtime do not receive garbage
      codes.
      Update the user api to guard exception code type checking as well.
      Signed-off-by: default avatarJonathan Kim <jonathan.kim@amd.com>
      Tested-by: default avatarJesse Zhang <jesse.zhang@amd.com>
      Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      fb880635
    • Harry Wentland's avatar
      Revert "drm/amd/display: Fix sending VSC (+ colorimetry) packets for DP/eDP displays without PSR" · 5daa2947
      Harry Wentland authored
      This causes flicker on a bunch of eDP panels. The info_packet code
      also caused regressions on other OSes that we haven't' seen on Linux
      yet, but that is likely due to the fact that we haven't had a chance
      to test those environments on Linux.
      
      We'll need to revisit this.
      
      This reverts commit 202260f6.
      
      Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3207
      Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3151Signed-off-by: default avatarHarry Wentland <harry.wentland@amd.com>
      Reviewed-by: default avatarRodrigo Siqueira <Rodrigo.Siqueira@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      5daa2947
    • Shashank Sharma's avatar
      drm/amdgpu: Add a NULL check for freeing root PT · f88a7dd0
      Shashank Sharma authored
      This patch adds a NULL check to fix this crash reported during the
      freeing of root PT entry:
      
       BUG: unable to handle page fault for address: ffffc9002d637aa0
       #PF: supervisor write access in kernel mode
       #PF: error_code(0x0002) - not-present page
       RIP: 0010:amdgpu_vm_pt_free+0x66/0xe0 [amdgpu]
       PKRU: 55555554
       Call Trace:
       <TASK>
        amdgpu_vm_pt_free_root+0x60/0xa0 [amdgpu]
        amdgpu_vm_fini+0x2cb/0x5d0 [amdgpu]
        ? amdgpu_ctx_mgr_entity_fini+0x53/0x1c0 [amdgpu]
        amdgpu_driver_postclose_kms+0x191/0x2d0 [amdgpu]
        drm_file_free.part.0+0x1e5/0x260 [drm]
      
      Cc: Christian König <Christian.Koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Felix Kuehling <felix.kuehling@amd.com>
      Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
      Acked-by: default avatarChristian König <Christian.Koenig@amd.com>
      Signed-off-by: default avatarShashank Sharma <shashank.sharma@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f88a7dd0
    • Eric Huang's avatar
      drm/amdkfd: fix TLB flush after unmap for GFX9.4.2 · acf760c8
      Eric Huang authored
      TLB flush after unmap accidentially was removed on
      gfx9.4.2. It is to add it back.
      Signed-off-by: default avatarEric Huang <jinhuieric.huang@amd.com>
      Reviewed-by: default avatarHarish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      acf760c8
    • Sunil Khatri's avatar
      drm/amdgpu: refactor code to split devcoredump code · 9022f01b
      Sunil Khatri authored
      Refractor devcoredump code into new files since its
      functionality is expanded further and better to slit
      and devcoredump to have its own file.
      
      v2: Fix the build failure caught by arm compiler
      of implicit function declaration with #ifdef
      
      v3: squash in fix for implicit declaration error
      
      Cc: Ivan Lipski <ivan.lipski@amd.com>
      Acked-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarSunil Khatri <sunil.khatri@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      9022f01b
    • Aric Cyr's avatar
      drm/amd/display: 3.2.277 · b1edfb91
      Aric Cyr authored
      This version brings along following fixes:
      - Fix few problems for DCN35
      - Fix a bug which dereferences freed memory
      - Enable new interface design for alternate scrambling
      - Enhance IPS handshake
      - Increase Z8 watermark times
      - Fix DML2 problem
      - Revert patch which cause regression
      - Fix problems for dmub idle power optimization
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarAric Cyr <aric.cyr@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      b1edfb91
    • Chaitanya Dhere's avatar
      drm/amd/display: Add TB_BORROWED_MAX definition · aae9734b
      Chaitanya Dhere authored
      [Why & How]
      For DML2 to decouple it from other DML versions.
      Reviewed-by: default avatarDillon Varone <dillon.varone@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarChaitanya Dhere <chaitanya.dhere@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      aae9734b
    • Wenjing Liu's avatar
      drm/amd/display: fix a bug to dereference already freed old current state memory · 621cf07a
      Wenjing Liu authored
      [why]
      During minimal transition commit, the base state could be freed if it is current state.
      This is because after committing minimal transition state, the current state will be
      swapped to the minimal transition state and the old current state will be released.
      the release could cause the old current state's memory to be freed. However dc
      will derefernce this memory when release minimal transition state. Therefore, we
      need to retain the old current state until we release minimal transition state.
      
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarJosip Pavic <josip.pavic@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarWenjing Liu <wenjing.liu@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      621cf07a
    • Peyton Lee's avatar
      drm/amdgpu/vpe: power on vpe when hw_init · 9ddafd1d
      Peyton Lee authored
      To fix mode2 reset failure.
      Should power on VPE when hw_init.
      Signed-off-by: default avatarPeyton Lee <peytolee@amd.com>
      Reviewed-by: default avatarLang Yu <lang.yu@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      9ddafd1d
    • Lin.Cao's avatar
      drm/amd/pm set pp_dpm_*clk as read only for SRIOV one VF mode · 734ae8ef
      Lin.Cao authored
      pp_dpm_*clk should be set as read only for SRIOV one VF mode, remove
      S_IWUGO flag and _store function of these debugfs in one VF mode.
      Signed-off-by: default avatarLin.Cao <lincao12@amd.com>
      Acked-by: default avatarJingwen Chen <Jingwen.Chen2@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      734ae8ef
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Enable reallow for idle on DCN35 · 3be6a63e
      Nicholas Kazlauskas authored
      [Why]
      It was previously disabled for stability purposes, but command
      submission causes residency issues in IPS video playback.
      
      [How]
      Enable the disallow/reallow pattern back. There's additional checks
      now in DMCUB that should make this safer stability wise.
      Reviewed-by: default avatarDuncan Ma <duncan.ma@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      3be6a63e
    • Sung Joon Kim's avatar
      drm/amd/display: Enable new interface design for alternate scrambling · e42e9636
      Sung Joon Kim authored
      [why & how]
      To enable a new interface so alternate scrambling can be done via
      security module.
      Reviewed-by: default avatarWenjing Liu <wenjing.liu@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarSung Joon Kim <sungjoon.kim@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      e42e9636
    • Xi Liu's avatar
      drm/amd/display: Remove unnecessary hard coded DPM states · 4cad092b
      Xi Liu authored
      [Why]
      
      The hard coded DPM states are only used to fix mismatch states numbers from FW.
      
      [How]
      
      Remove when not needed.
      Reviewed-by: default avatarSung joon Kim <sungjoon.kim@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarXi Liu <xi.liu@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      4cad092b
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Add optional optimization for IPS handshake · 8803bfff
      Nicholas Kazlauskas authored
      [Why]
      It's possible to skip parts of the eval and exit sequencing if we know
      whether DCN is in IPS2 already or if it's committed to going to idle
      and not in IPS2.
      
      [How]
      Skip IPS2 entry/exit if DMCUB is idle but the IPS2 commit is not set.
      
      Skip the eval delay if DMCUB is already in IPS2 since we know we need
      to exit.
      
      These are turned off by default.
      Reviewed-by: default avatarDuncan Ma <duncan.ma@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      8803bfff
    • Nicholas Kazlauskas's avatar
      drm/amd/display: Detect and disallow idle reallow during reentrancy · 93ddf00f
      Nicholas Kazlauskas authored
      [Why]
      Cursor updates can be preempted by queued flips in some DMs.
      
      The synchronization model causes this to occur within the same thread
      at an intermediate level when we insert logs into the OS queue.
      
      Since this occurs on the same thread and we're still holding the lock
      (recursively) the cache is coherent.
      
      The exit sequence will run twice since we technically haven't finished
      the exit the first time, so we need a way to detect and avoid the
      reallow in the middle of this call to prevent the hang on the cursor
      update that was preempted.
      
      [How]
      Keep a counter that tracks the depth of the exit calls. Do not reallow
      until the counter is zero.
      Reviewed-by: default avatarDuncan Ma <duncan.ma@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      93ddf00f
    • Xi Liu's avatar
      drm/amd/display: increase bb clock for DCN351 · 398a16e1
      Xi Liu authored
      [Why and how]
      
      Bounding box clocks for DCN351 should be increased as per request
      Reviewed-by: default avatarSwapnil Patel <swapnil.patel@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarXi Liu <xi.liu@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      398a16e1
    • Chris Park's avatar
      drm/amd/display: Prevent crash when disable stream · f2afc8d4
      Chris Park authored
      [Why]
      Disabling stream encoder invokes a function that no longer exists.
      
      [How]
      Check if the function declaration is NULL in disable stream encoder.
      
      Cc: Mario Limonciello <mario.limonciello@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: default avatarCharlene Liu <charlene.liu@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarChris Park <chris.park@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f2afc8d4
    • Natanel Roizenman's avatar
      drm/amd/display: Increase Z8 watermark times. · 414998f2
      Natanel Roizenman authored
      Increase Z8 watermark times from 210->250us and 320->350us.
      Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarNatanel Roizenman <natanel.roizenman@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      414998f2
    • Charlene Liu's avatar
      drm/amd/display: change aux_init to apu version · 6a3c243f
      Charlene Liu authored
      [why]
      APU has different refclk as dGPU which is used for AUX_DPHY setup
      Reviewed-by: default avatarChris Park <chris.park@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarCharlene Liu <charlene.liu@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      6a3c243f
    • Yang Wang's avatar
      drm/amdgpu: add ras event id support for ACA · 31fd330b
      Yang Wang authored
      add ras event id support for ACA.
      Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Reviewed-by: default avatarTao Zhou <tao.zhou1@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      31fd330b
    • Yang Wang's avatar
      drm/amdgpu: avoid update aca bank multi times during ras isr · bd15bf74
      Yang Wang authored
      Because the UE Valid MCA count will only be cleared after reset,
      in order to avoid repeated counting of the error count,
      the aca bank is only updated once during ras isr.
      Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      bd15bf74
    • Yang Wang's avatar
      drm/amdgpu: retrieve umc odecc error count for aca umc v12.0 · f7bcfb7a
      Yang Wang authored
      retrieve umc odecc error count for aca umc v12.0
      Signed-off-by: default avatarYang Wang <kevinyang.wang@amd.com>
      Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      f7bcfb7a
    • Mukul Joshi's avatar
      drm/amdkfd: Check cgroup when returning DMABuf info · e2680ee2
      Mukul Joshi authored
      Check cgroup permissions when returning DMA-buf info and
      based on cgroup info return the GPU id of the GPU that have
      access to the BO.
      Signed-off-by: default avatarMukul Joshi <mukul.joshi@amd.com>
      Reviewed-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      e2680ee2
    • Natanel Roizenman's avatar
      drm/amd/display: Added debug prints for zstate_support and StutterPeriod · 6619168f
      Natanel Roizenman authored
      Added debug prints for zstate_support and StutterPeriod in
      dcn35_decide_zstate_support for testing.
      Reviewed-by: default avatarNicholas Kazlauskas <nicholas.kazlauskas@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarNatanel Roizenman <natanel.roizenman@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      6619168f
    • Dillon Varone's avatar
      drm/amd/display: Power on VPG memory unconditionally if off · 7cc91966
      Dillon Varone authored
      [WHY&HOW]
      Even if memory lower power feature policy states that it is disabled,
      VPG memory should still be poweerd on if it is currently disabled when
      requested.
      Reviewed-by: default avatarChris Park <chris.park@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarDillon Varone <dillon.varone@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      7cc91966
    • Charlene Liu's avatar
      drm/amd/display: fix debug key not working on dml2 · 052af44f
      Charlene Liu authored
      [why]
      need to apply the debug key check for max displayclk.
      Reviewed-by: default avatarChris Park <chris.park@amd.com>
      Acked-by: default avatarWayne Lin <wayne.lin@amd.com>
      Signed-off-by: default avatarCharlene Liu <charlene.liu@amd.com>
      Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      052af44f
    • Xiaojian Du's avatar
      drm/amdgpu: add VCN sensor value for SMU 14.0.0 · 02d37731
      Xiaojian Du authored
      This will add VCN sensor value for SMU 14.0.0.
      Signed-off-by: default avatarXiaojian Du <Xiaojian.Du@amd.com>
      Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      02d37731
    • Shashank Sharma's avatar
      drm/amdgpu: sync page table freeing with tlb flush · b6c4f90b
      Shashank Sharma authored
      The idea behind this patch is to delay the freeing of PT entry objects
      until the TLB flush is done.
      
      This patch:
      - Adds a tlb_flush_waitlist in amdgpu_vm_update_params which will keep the
        objects that need to be freed after tlb_flush.
      - Adds PT entries in this list in amdgpu_vm_ptes_update after finding
        the PT entry.
      - Changes functionality of amdgpu_vm_pt_free_dfs from (df_search + free)
        to simply freeing of the BOs, also renames it to
        amdgpu_vm_pt_free_list to reflect this same.
      - Exports function amdgpu_vm_pt_free_list to be called directly.
      - Calls amdgpu_vm_pt_free_list directly from amdgpu_vm_update_range.
      
      V2: rebase
      V4: Addressed review comments from Christian
          - add only locked PTEs entries in TLB flush waitlist.
          - do not create a separate function for list flush.
          - do not create a new lock for TLB flush.
          - there is no need to wait on tlb_flush_fence exclusively.
      
      V5: Addressed review comments from Christian
          - change the amdgpu_vm_pt_free_dfs's functionality to simple freeing
            of the objects and rename it.
          - add all the PTE objects in params->tlb_flush_waitlist
          - let amdgpu_vm_pt_free_root handle the freeing of BOs independently
          - call amdgpu_vm_pt_free_list directly
      
      V6: Rebase
      V7: Rebase
      V8: Added a NULL check to fix this backtrace issue:
      [  415.351447] BUG: kernel NULL pointer dereference, address: 0000000000000008
      [  415.359245] #PF: supervisor write access in kernel mode
      [  415.365081] #PF: error_code(0x0002) - not-present page
      [  415.370817] PGD 101259067 P4D 101259067 PUD 10125a067 PMD 0
      [  415.377140] Oops: 0002 [#1] PREEMPT SMP NOPTI
      [  415.382004] CPU: 0 PID: 25481 Comm: test_with_MPI.e Tainted: G           OE     5.18.2-mi300-build-140423-ubuntu-22.04+ #24
      [  415.394437] Hardware name: AMD Corporation Sh51p/Sh51p, BIOS RMO1001AS 02/21/2024
      [  415.402797] RIP: 0010:amdgpu_vm_ptes_update+0x6fd/0xa10 [amdgpu]
      [  415.409648] Code: 4c 89 ff 4d 8d 66 30 e8 f1 ed ff ff 48 85 db 74 42 48 39 5d a0 74 40 48 8b 53 20 48 8b 4b 18 48 8d 43 18 48 8d 75 b0 4c 89 ff <48
      > 89 51 08 48 89 0a 49 8b 56 30 48 89 42 08 48 89 53 18 4c 89 63
      [  415.430621] RSP: 0018:ffffc9000401f990 EFLAGS: 00010287
      [  415.436456] RAX: ffff888147bb82f0 RBX: ffff888147bb82d8 RCX: 0000000000000000
      [  415.444426] RDX: 0000000000000000 RSI: ffffc9000401fa30 RDI: ffff888161f80000
      [  415.452397] RBP: ffffc9000401fa80 R08: 0000000000000000 R09: ffffc9000401fa00
      [  415.460368] R10: 00000007f0cc0000 R11: 00000007f0c85000 R12: ffffc9000401fb20
      [  415.468340] R13: 00000007f0d00000 R14: ffffc9000401faf0 R15: ffff888161f80000
      [  415.476312] FS:  00007f132ff89840(0000) GS:ffff889f87c00000(0000) knlGS:0000000000000000
      [  415.485350] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [  415.491767] CR2: 0000000000000008 CR3: 0000000161d46003 CR4: 0000000000770ef0
      [  415.499738] PKRU: 55555554
      [  415.502750] Call Trace:
      [  415.505482]  <TASK>
      [  415.507825]  amdgpu_vm_update_range+0x32a/0x880 [amdgpu]
      [  415.513869]  amdgpu_vm_clear_freed+0x117/0x250 [amdgpu]
      [  415.519814]  amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x18c/0x250 [amdgpu]
      [  415.527729]  kfd_ioctl_unmap_memory_from_gpu+0xed/0x340 [amdgpu]
      [  415.534551]  kfd_ioctl+0x3b6/0x510 [amdgpu]
      
      V9: Addressed review comments from Christian
          - No NULL check reqd for root PT freeing
          - Free PT list regardless of needs_flush
          - Move adding BOs in list in a separate function
      
      V10: Added Christian's RB
      V11: squash in list fix
      
      Cc: Christian König <Christian.Koenig@amd.com>
      Cc: Alex Deucher <alexander.deucher@amd.com>
      Cc: Felix Kuehling <felix.kuehling@amd.com>
      Cc: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
      Acked-by: default avatarFelix Kuehling <felix.kuehling@amd.com>
      Acked-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
      Reviewed-by: default avatarChristian König <Christian.Koenig@amd.com>
      Tested-by: default avatarRajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
      Signed-off-by: default avatarShashank Sharma <shashank.sharma@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      b6c4f90b
  3. 20 Mar, 2024 1 commit