linux-2.6-block.git
5 months agodrm/amd/pm: add tool log support on smu v14.0.2/3
Kenneth Feng [Fri, 26 Apr 2024 08:02:16 +0000 (16:02 +0800)]
drm/amd/pm: add tool log support on smu v14.0.2/3

add tool log support on smu v14.0.2/3

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Jack Gui <Jack.Gui@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/pm: enable mode1 reset on smu v14.0.2/v14.0.3
Kenneth Feng [Mon, 5 Feb 2024 08:49:29 +0000 (16:49 +0800)]
drm/amd/pm: enable mode1 reset on smu v14.0.2/v14.0.3

enable mode1 reset on smu v14.0.2/v14.0.3

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/pm: support mode1 reset on smu_v14_0_3
Kenneth Feng [Wed, 31 Jan 2024 07:36:12 +0000 (15:36 +0800)]
drm/amd/pm: support mode1 reset on smu_v14_0_3

support mode1 reset on smu_v14_0_3

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: Use a separate fence per transaction
Alex Deucher [Mon, 29 Apr 2024 15:53:02 +0000 (11:53 -0400)]
drm/amdgpu/mes12: Use a separate fence per transaction

We can't use a shared fence location because each transaction
should be considered independently.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: increase mes submission timeout
Alex Deucher [Mon, 29 Apr 2024 15:40:26 +0000 (11:40 -0400)]
drm/amdgpu/mes12: increase mes submission timeout

MES internally has a timeout allowance of 2 seconds.
Increase driver timeout to 3 seconds to be safe.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: print MES opcodes rather than numbers
Alex Deucher [Mon, 29 Apr 2024 15:38:47 +0000 (11:38 -0400)]
drm/amdgpu/mes12: print MES opcodes rather than numbers

Makes it easier to review the logs when there are MES
errors.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable mmhub and athub cg on gc 12.0.1
Kenneth Feng [Wed, 3 Apr 2024 05:29:31 +0000 (13:29 +0800)]
drm/amd/amdgpu: enable mmhub and athub cg on gc 12.0.1

enable mmhub and athub cg on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable gfxoff on gc 12.0.1
Kenneth Feng [Mon, 11 Mar 2024 06:11:39 +0000 (14:11 +0800)]
drm/amd/amdgpu: enable gfxoff on gc 12.0.1

Enable gfxoff on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Jack Gui <Jack.Gui@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: support cg state get for gfx v12
Likun Gao [Sat, 6 Apr 2024 21:44:54 +0000 (05:44 +0800)]
drm/amdgpu: support cg state get for gfx v12

Support to get clockgating state for gfx v12.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable sram fgcg on gc 12.0.1
Kenneth Feng [Fri, 1 Mar 2024 09:36:42 +0000 (17:36 +0800)]
drm/amd/amdgpu: enable sram fgcg on gc 12.0.1

enable sram fgcg on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg
Kenneth Feng [Fri, 1 Mar 2024 08:21:08 +0000 (16:21 +0800)]
drm/amd/amdgpu: enable perfcounter mgcg and repeater fgcg

enable perfcounter mgcg and repeater fgcg on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable 3D cgcg and 3D cgls
Kenneth Feng [Fri, 1 Mar 2024 06:48:51 +0000 (14:48 +0800)]
drm/amd/amdgpu: enable 3D cgcg and 3D cgls

enable 3D cgcg and 3D cgls on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable mgcg on gfx 12.0.1
Kenneth Feng [Fri, 1 Mar 2024 06:14:43 +0000 (14:14 +0800)]
drm/amd/amdgpu: enable mgcg on gfx 12.0.1

enable mgcg on gfx 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: enable cgcg and cgls
Kenneth Feng [Fri, 1 Mar 2024 03:09:22 +0000 (11:09 +0800)]
drm/amd/amdgpu: enable cgcg and cgls

enable cgcg and cgls on gc 12.0.1

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/vcn5: Add VCN5 capabilities
David (Ming Qiang) Wu [Mon, 8 Jan 2024 16:37:08 +0000 (11:37 -0500)]
drm/amdgpu/vcn5: Add VCN5 capabilities

Add VCN5 encode and decode capabilities support

Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/vcn5: enable DPG mode support
Sonny Jiang [Tue, 31 Oct 2023 15:21:24 +0000 (11:21 -0400)]
drm/amdgpu/vcn5: enable DPG mode support

Enable DPG mode

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/jpeg5: enable power gating
Sonny Jiang [Mon, 16 Oct 2023 20:49:53 +0000 (16:49 -0400)]
drm/amdgpu/jpeg5: enable power gating

Enable PG on JPEG5

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agoamdgpu/vcn: enable AMD_PG_SUPPORT_VCN
David (Ming Qiang) Wu [Wed, 11 Oct 2023 21:03:03 +0000 (17:03 -0400)]
amdgpu/vcn: enable AMD_PG_SUPPORT_VCN

turn on AMD_PG_SUPPORT_VCN flag for power saving

Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Reviewed-by: Sonny Jiang <sonny.jiang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Fix physical address mask
David Belanger [Fri, 19 Apr 2024 14:28:02 +0000 (10:28 -0400)]
drm/amdgpu: Fix physical address mask

Mask should be 44-bit.

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/discovery: add mes v12_0 ip block
Likun Gao [Thu, 9 Mar 2023 07:18:51 +0000 (15:18 +0800)]
drm/amdgpu/discovery: add mes v12_0 ip block

Add mes v12_0 ip block.

v2: squash in update (Alex)
v3: rebase on unified mes changes (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/discovery: add gfx v12_0 ip block
Likun Gao [Thu, 9 Mar 2023 06:57:18 +0000 (14:57 +0800)]
drm/amdgpu/discovery: add gfx v12_0 ip block

Add gfx v12_0 ip block.

v2: Squash in update (Alex)
v3: add exp flag (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: disable logging output
Jack Xiao [Fri, 12 Apr 2024 06:26:18 +0000 (14:26 +0800)]
drm/amdgpu/mes12: disable logging output

Random page fault was oberserved, temporarily disable
mes log buffer output.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: add module parameter 'amdgpu_uni_mes'
Jack Xiao [Fri, 1 Mar 2024 10:01:39 +0000 (18:01 +0800)]
drm/amdgpu: add module parameter 'amdgpu_uni_mes'

Add module parameter 'amdgpu_uni_mes' to enable/disable unified
mes fw support.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: add legacy setting hw resource interface
Jack Xiao [Wed, 10 Apr 2024 06:00:41 +0000 (14:00 +0800)]
drm/amdgpu/mes12: add legacy setting hw resource interface

For unified mes fw, add the legacy interface to set hardware
resources.

v2: remove warning (Alex)

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Disable unmapped doorbell handling basic mode on mes 12
shaoyunl [Mon, 25 Mar 2024 16:02:58 +0000 (12:02 -0400)]
drm/amdgpu: Disable unmapped doorbell handling  basic mode on mes 12

The new mechanism for unmapped doorbell handling requires both driver side and
MES fw side change. The FW side changes are still not released.

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Harish Kasiviswanthan <Harish.Kasiviswanthan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/gfx: enable mes to map legacy queue support
Jack Xiao [Fri, 1 Mar 2024 09:40:30 +0000 (17:40 +0800)]
drm/amdgpu/gfx: enable mes to map legacy queue support

Enable mes to map legacy queue support.

v2: drop unused gfx_v12_0_kiq_enable_kgq() (Alex)

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: add mes mapping legacy queue support
Jack Xiao [Fri, 1 Mar 2024 09:33:30 +0000 (17:33 +0800)]
drm/amdgpu/mes12: add mes mapping legacy queue support

Add mes12 map legacy queue packet submission.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: enable uni_mes fw on mes pipe0
Jack Xiao [Fri, 1 Mar 2024 09:04:47 +0000 (17:04 +0800)]
drm/amdgpu/mes12: enable uni_mes fw on mes pipe0

Enable the unified mes firmware on mes pipe0.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: add uni_mes fw loading support
Jack Xiao [Fri, 1 Mar 2024 08:52:05 +0000 (16:52 +0800)]
drm/amdgpu/mes12: add uni_mes fw loading support

Add the unified mes firmware loading support.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes: add uni_mes fw loading support
Jack Xiao [Fri, 1 Mar 2024 08:51:40 +0000 (16:51 +0800)]
drm/amdgpu/mes: add uni_mes fw loading support

Add the unified mes firmware loading support.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: mark GFX12 system and peer GPU memory mappings as MTYPE_NC
Sreekant Somasekharan [Tue, 26 Mar 2024 20:19:28 +0000 (16:19 -0400)]
drm/amdkfd: mark GFX12 system and peer GPU memory mappings as MTYPE_NC

Due to a HW bug, the system memory mappings and peer GPU mappings
on GFX12 need to be marked as MTYPE_NC.

Cc: Joe Greathouse <joseph.greathouse@amd.com>
Cc: David Belanger <david.belanger@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Sreekant Somasekharan <sreekant.somasekharan@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdkfd: Add GFX12 PTE flag to SVM get PTE function
Sreekant Somasekharan [Fri, 23 Feb 2024 17:44:43 +0000 (12:44 -0500)]
drm/amd/amdkfd: Add GFX12 PTE flag to SVM get PTE function

Add new GFX12 PTE flag AMDGPU_PTE_IS_PTE to svm_range_get_pte_flags
function. This resolves the issues related to SVM enablement in GFX12.

Signed-off-by: Sreekant Somasekharan <sreekant.somasekharan@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Enable atomic support for GFX12
David Belanger [Fri, 1 Mar 2024 23:24:30 +0000 (18:24 -0500)]
drm/amdkfd: Enable atomic support for GFX12

Enable flag in KFD and set the atomic support bit in MQD.

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: fix NULL ptr for debugfs mqds on GFX v12
Eric Huang [Fri, 24 Nov 2023 18:57:02 +0000 (13:57 -0500)]
drm/amdkfd: fix NULL ptr for debugfs mqds on GFX v12

mqd_stride function in gfx v12 is not implemented, that
causes NULL ptr error. Add the generic func to fix it.

Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: enable single alu ops for gfx12
Jonathan Kim [Mon, 21 Aug 2023 15:47:47 +0000 (11:47 -0400)]
drm/amdkfd: enable single alu ops for gfx12

GFX12 debugging requires setting up precise ALU operation for catching
ALU exceptions.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Tested-by: Lancelot Six <lancelot.six@amd.com>
Reviewed-by: Eric Huang <jinhuieric.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: fix support for trap on wave start and end for gfx12
Jonathan Kim [Wed, 25 Oct 2023 13:04:49 +0000 (09:04 -0400)]
drm/amdkfd: fix support for trap on wave start and end for gfx12

Similar to GFX11, GFX12 supports trapping on wave start and end.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: always enable ttmp setup for gfx12
Jonathan Kim [Wed, 25 Oct 2023 13:04:48 +0000 (09:04 -0400)]
drm/amdkfd: always enable ttmp setup for gfx12

Similar to GFX11, always enable the setup of trap temporaries on GFX12.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Enable GFX12 trap handler
David Belanger [Thu, 17 Aug 2023 21:28:38 +0000 (17:28 -0400)]
drm/amdkfd: Enable GFX12 trap handler

Updated switch statement to use GFX12 trap handler.

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: enable missed single-step workaround for gfx12
Laurent Morichetti [Tue, 30 Jan 2024 19:25:00 +0000 (11:25 -0800)]
drm/amdkfd: enable missed single-step workaround for gfx12

When trap_ctrl.trap_after_inst is set, it is possible for a wave to
enter the trap handler, after single-stepping an instruction and a
save_context is raised, with only save_context set in excp_flag_priv.

Because excp_flag_priv.trap_after_inst is not reliably set, we need to
use the missed single-step workaround for gfx12 as well.

Also add wave_start and wave_end as exceptions that should be handled
by the 2nd level trap handler.

Signed-off-by: Laurent Morichetti <laurent.morichetti@amd.com>
Tested-by: Lancelot Six <lancelot.six@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: save and restore barrier state for gfx12
Lancelot SIX [Wed, 3 Jan 2024 12:50:19 +0000 (12:50 +0000)]
drm/amdkfd: save and restore barrier state for gfx12

Add support to save and restore the work group barrier state in gfx12
CWSR trap handler.

There is no support to directly restore the signal count of a barrier
state, so instead this patch repeatedly calls s_barrier_signal to
increment the signal count to the desired value.

In this patch, I have implemented the logic to restore the barrier at
the end of the block restoring the HWREGs.  This process needs to be
done by exactly 1 wave per work group.  To achieve this, the initial
value of s_restore_spi_init_hi (containing a FIRST_WAVE bit) needs to be
saved up until that point.  An alternative could be restore the barrier
earlier in the process (around when LDS is restored, as the same wave
does both).  Doing this would break the pattern that the restore
procedure follows the CWSR area layout.

Before restoring the barrier, this patch checks if the barrier was whose
state was saved has the "valid" bit set, even if I don't think this
barrier can be in an invalid state during context save.  I expect this
test to always be true.

Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Add gfx12 trap handler support
Jay Cornwall [Mon, 7 Aug 2023 19:02:01 +0000 (14:02 -0500)]
drm/amdkfd: Add gfx12 trap handler support

- HWREG changes since gfx11
- Save/restore barrier state
- get_wave_size is now reserved by assembler

v2: rebase (Alex)

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Move trap handler coherence flags to preprocessor
Jay Cornwall [Thu, 3 Aug 2023 21:43:06 +0000 (16:43 -0500)]
drm/amdkfd: Move trap handler coherence flags to preprocessor

No functional change. Preparation for gfx12 support.

v2: drop unrelated change (Alex)

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Added gfx_v12_kfd2kgd interface for GFX12.
David Belanger [Mon, 29 May 2023 17:23:08 +0000 (13:23 -0400)]
drm/amdkfd: Added gfx_v12_kfd2kgd interface for GFX12.

Initial implementation, based on GFX11.

v2: Removed functions not needed by cp scheduler.
v3: Fixed typos.
v4: squash in warning fix (Alex)

Signed-off-by: David Belanger <david.belanger@amd.com>
Acked-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Added device queue manager files for GFX12.
David Belanger [Tue, 16 May 2023 16:27:14 +0000 (12:27 -0400)]
drm/amdkfd: Added device queue manager files for GFX12.

Initial implementation, based on GFX11.

v2: squash in include fix from David (Alex)

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Added MQD manager files for GFX12.
David Belanger [Tue, 16 May 2023 16:25:02 +0000 (12:25 -0400)]
drm/amdkfd: Added MQD manager files for GFX12.

Initial implementation, based on GFX11.

v2: Removed dbg_wa code as not needed on GFX12.
v3: squash in SDMA queue fixes (Alex)
v4: rebase (Alex)

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Added temporary changes for GFX12.
David Belanger [Wed, 10 May 2023 17:16:26 +0000 (13:16 -0400)]
drm/amdkfd: Added temporary changes for GFX12.

Added cases for GFX12 in switch statement, code relying on GFX11
implementation until GFX12 implementation is complete.

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: Basic SDMA and cache info changes for GFX12.
David Belanger [Tue, 9 May 2023 18:57:17 +0000 (14:57 -0400)]
drm/amdkfd: Basic SDMA and cache info changes for GFX12.

Added GFX12 support to a few switch statements.

Signed-off-by: David Belanger <david.belanger@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Enable event log on MES 12
shaoyunl [Mon, 18 Mar 2024 15:19:33 +0000 (11:19 -0400)]
drm/amdgpu: Enable event log on MES 12

Enable event log through the HW specific FW API

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Harish Kasiviswanthan <Harish.Kasiviswanthan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Enable unmapped doorbell handling basic mode on mes 12
shaoyunl [Wed, 22 Nov 2023 19:34:11 +0000 (14:34 -0500)]
drm/amdgpu: Enable unmapped doorbell handling basic mode on mes 12

Enable basic mode handling for doorbell ring on unmapped CP queue.
In this mode, MES can start schedule the queue mapping based on HW
interrupt instead of timer.

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Harish Kasiviswanthan <Harish.Kasiviswanthan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Switch to smuio func to get gpu clk counter
Hawking Zhang [Sun, 17 Mar 2024 11:26:07 +0000 (19:26 +0800)]
drm/amdgpu: Switch to smuio func to get gpu clk counter

Switch to smuio callback to query gpu clock counter

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: init gfxhub setting to align with mmhub
Likun Gao [Thu, 7 Mar 2024 09:20:03 +0000 (17:20 +0800)]
drm/amdgpu: init gfxhub setting to align with mmhub

Align gfxhub settings with mmhub when program rlc ram.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: skip dpm check to init imu fw
Likun Gao [Thu, 29 Feb 2024 13:20:51 +0000 (21:20 +0800)]
drm/amdgpu: skip dpm check to init imu fw

Skip dpm check to init imu firmware for imu v12.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: fix active rb and cu number for gfx12
Likun Gao [Mon, 8 Jan 2024 05:46:40 +0000 (13:46 +0800)]
drm/amdgpu: fix active rb and cu number for gfx12

Correct the algorithm of active CU and RB to bypass
the disabled SA for gfx12.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: use new method to program rlc ram
Likun Gao [Sun, 17 Dec 2023 09:54:35 +0000 (17:54 +0800)]
drm/amdgpu: use new method to program rlc ram

Program rlc ram with golden setting data instead.
The old method (program_imu_rlc_ram_old) should be
retired in the future.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: add cgcg&cgls interface for gfx 12.0
Kenneth Feng [Wed, 6 Sep 2023 03:15:10 +0000 (11:15 +0800)]
drm/amd/amdgpu: add cgcg&cgls interface for gfx 12.0

add cgcg&cgls interface for gfx 12.0

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: update GFX12 wave data registers
Tom St Denis [Thu, 24 Aug 2023 13:23:04 +0000 (09:23 -0400)]
drm/amd/amdgpu: update GFX12 wave data registers

Update the registers for gfx12.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: set different fw data addr for mec pipe
Likun Gao [Wed, 1 Nov 2023 06:28:40 +0000 (14:28 +0800)]
drm/amdgpu: set different fw data addr for mec pipe

For MEC fw data, different pipe should programed into
different address.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: workaround for the imu fw loading
Kenneth Feng [Wed, 6 Sep 2023 06:07:58 +0000 (14:07 +0800)]
drm/amd/amdgpu: workaround for the imu fw loading

workaournd for the imu fw loading on gfx 12.0 without psp

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd: Move fw init from sw_init to early_init for imu v12
Likun Gao [Tue, 14 Nov 2023 07:02:44 +0000 (15:02 +0800)]
drm/amd: Move fw init from sw_init to early_init for imu v12

Move microcode loading from sw_init to early_init to align with
the perious version of imu init sequence.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: support S&R fw load for gfx v12
Likun Gao [Thu, 31 Aug 2023 08:28:33 +0000 (16:28 +0800)]
drm/amdgpu: support S&R fw load for gfx v12

Support Save & Restore related fw load with backdoor RLC
autoload type on gfx v12.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/gfx12: recalculate available compute rings to use
Jack Xiao [Mon, 7 Aug 2023 07:55:25 +0000 (15:55 +0800)]
drm/amdgpu/gfx12: recalculate available compute rings to use

Recalculate the number of compute rings to use based on
the gfx hardware configuration. As needed reserve half of
compute rings for mes, kgd can't use up all compute rings.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: skip imu related function if dpm=0
Likun Gao [Fri, 30 Jun 2023 09:02:43 +0000 (17:02 +0800)]
drm/amdgpu: skip imu related function if dpm=0

Only execute IMU related functions if dpm>0.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdgpu: imu fw loading support
Kenneth Feng [Tue, 20 Jun 2023 07:07:25 +0000 (15:07 +0800)]
drm/amd/amdgpu: imu fw loading support

support imu related function for gfx v12.

Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: set cp fw address set for gfx v12
Likun Gao [Wed, 28 Jun 2023 07:39:19 +0000 (15:39 +0800)]
drm/amdgpu: set cp fw address set for gfx v12

Split PFF/ME/MEC firmware address setting function
from related load microcode funtion, as it's also
needed for rlc autolad.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add gfx v12_0 ip block support (v6)
Likun Gao [Tue, 4 Jul 2023 14:13:42 +0000 (22:13 +0800)]
drm/amdgpu: Add gfx v12_0 ip block support (v6)

Initial support for GFX 12.

v1: Add gfx v12_0 ip block support. (Likun)
v2: Switch to gfx.kiq array.
    Move the vmhub from ring callback to ring. (Hawking)
v3: Update various callback function impl. (Hawking)
v4: Warning fixes (Alex)
v5: squash in imu fix, csb, rlc autoload implementations (Alex)
v6: Rebase (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/mes12: update data cache boundary
Jack Xiao [Thu, 30 Nov 2023 10:22:34 +0000 (18:22 +0800)]
drm/amdgpu/mes12: update data cache boundary

Enlarge the data cache boundary.

v2: use the fix data cache boundary.

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: fix trap enablement for gfx12
Jonathan Kim [Wed, 25 Oct 2023 13:04:47 +0000 (09:04 -0400)]
drm/amdgpu: fix trap enablement for gfx12

Fix request to MES to set SQ_SHADER_TBA_HI.trap_en for GFX12.

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Enable MES to handle doorbell ring on unmapped queue
shaoyunl [Thu, 2 Nov 2023 23:26:39 +0000 (19:26 -0400)]
drm/amdgpu: Enable MES to handle doorbell ring on unmapped queue

On MES12, HW can monitor up to 2048 doorbells that not be
mapped currently and trigger the interrupt to MES when these unmapped
doorbell been ringed.

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: enable mes v12 self test
Jack Xiao [Mon, 7 Aug 2023 07:54:44 +0000 (15:54 +0800)]
drm/amdgpu: enable mes v12 self test

1. fix available compute queue to use
2. enable mes v12 self test

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: set mes fw address for mes v12
Likun Gao [Wed, 28 Jun 2023 07:37:37 +0000 (15:37 +0800)]
drm/amdgpu: set mes fw address for mes v12

Split the function of mes fimrware address setting
from mes firmware load for mes v12, as it's also
needed for rlc autoload.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add mes v12_0 ip block support (v4)
Jack Xiao [Tue, 4 Jul 2023 14:23:34 +0000 (22:23 +0800)]
drm/amdgpu: Add mes v12_0 ip block support (v4)

v1: Add mes v12_0 ip block support. (Jack)
v2: Switch to gfx.kiq array. (Hawking)
v3: Switch to AMDGPU_GFXHUB(0). (Hawking)
v4: Rebase (Alex)

Signed-off-by: Jack Xiao <Jack.Xiao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: init mes ucode name for gfx v12
Likun Gao [Sun, 23 Apr 2023 06:38:53 +0000 (14:38 +0800)]
drm/amdgpu: init mes ucode name for gfx v12

Keep gfx v12 mes fw name to gc_12_x_x_mes.bin
and gc_12_x_x_mes1.bin.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add mes_v12_api_def.h for gfx12
Harish Kasiviswanathan [Tue, 24 Oct 2023 15:25:12 +0000 (11:25 -0400)]
drm/amdgpu: Add mes_v12_api_def.h for gfx12

Add MES_v12 header definition for gfx12

v2: Modify SET_SHADER_DEBUGGER to match mes_v11 definition. This doesn't
change the structure layout

v3: Removed unncessary comment and spaces

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: add rlc TOC header file for soc24
Likun Gao [Wed, 28 Jun 2023 04:23:58 +0000 (12:23 +0800)]
drm/amdgpu: add rlc TOC header file for soc24

Add RLC autoload TOC header file for soc24 ASIC.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: add new TOC structure
Likun Gao [Wed, 28 Jun 2023 04:07:40 +0000 (12:07 +0800)]
drm/amdgpu: add new TOC structure

Add new RLC_TABLE_OF_CONTENT structure definition.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: add gfx12 clearstate header
Likun Gao [Tue, 4 Apr 2023 06:45:45 +0000 (14:45 +0800)]
drm/amdgpu: add gfx12 clearstate header

Add gfx12 clearstate register arrays.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/discovery: Set GC family for GC 12.0 IP
Likun Gao [Mon, 13 Feb 2023 10:35:48 +0000 (18:35 +0800)]
drm/amdgpu/discovery: Set GC family for GC 12.0 IP

Set GC family for GC 12.0 IPs.

v2: squash in updates (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add gfx v12_0_0 family id
Likun Gao [Mon, 13 Feb 2023 10:19:27 +0000 (18:19 +0800)]
drm/amdgpu: Add gfx v12_0_0 family id

Add gfx v12_0_0 family id

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: IB test encode test package change for VCN5
Sonny Jiang [Sat, 13 Apr 2024 16:12:02 +0000 (12:12 -0400)]
drm/amdgpu: IB test encode test package change for VCN5

VCN5 session info package interface changed

Signed-off-by: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add gfx v9_4_4 ip block
Hawking Zhang [Tue, 16 Apr 2024 21:32:46 +0000 (05:32 +0800)]
drm/amdgpu: Add gfx v9_4_4 ip block

Add gfx v9_4_4 ip block support

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add smu v13_0_14 ip block
Hawking Zhang [Tue, 30 Apr 2024 16:12:34 +0000 (00:12 +0800)]
drm/amdgpu: Add smu v13_0_14 ip block

Add smu v13_0_14 ip block support

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add psp v13_0_14 ip block
Hawking Zhang [Tue, 16 Apr 2024 19:00:18 +0000 (03:00 +0800)]
drm/amdgpu: Add psp v13_0_14 ip block

Add psp v13_0_14 ip block support.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add sdma v4_4_5 ip block
Hawking Zhang [Tue, 16 Apr 2024 18:36:44 +0000 (02:36 +0800)]
drm/amdgpu: Add sdma v4_4_5 ip block

Add sdma v4_4_5 ip block support

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd: Override DCN410 IP version
Aurabindo Pillai [Tue, 30 Apr 2024 19:35:36 +0000 (15:35 -0400)]
drm/amd:  Override DCN410 IP version

Override DCN IP version to 4.0.1 from 4.1.0 temporarily until change is
made in DC codebase to use 4.1.0

Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms
Lang Yu [Thu, 11 Apr 2024 09:14:17 +0000 (17:14 +0800)]
drm/amdkfd: handle duplicate BOs in reserve_bo_and_cond_vms

Observed on gfx8 ASIC where KFD_IOC_ALLOC_MEM_FLAGS_AQL_QUEUE_MEM is used.
Two attachments use the same VM, root PD would be locked twice.

[   57.910418] Call Trace:
[   57.793726]  ? reserve_bo_and_cond_vms+0x111/0x1c0 [amdgpu]
[   57.793820]  amdgpu_amdkfd_gpuvm_unmap_memory_from_gpu+0x6c/0x1c0 [amdgpu]
[   57.793923]  ? idr_get_next_ul+0xbe/0x100
[   57.793933]  kfd_process_device_free_bos+0x7e/0xf0 [amdgpu]
[   57.794041]  kfd_process_wq_release+0x2ae/0x3c0 [amdgpu]
[   57.794141]  ? process_scheduled_works+0x29c/0x580
[   57.794147]  process_scheduled_works+0x303/0x580
[   57.794157]  ? __pfx_worker_thread+0x10/0x10
[   57.794160]  worker_thread+0x1a2/0x370
[   57.794165]  ? __pfx_worker_thread+0x10/0x10
[   57.794167]  kthread+0x11b/0x150
[   57.794172]  ? __pfx_kthread+0x10/0x10
[   57.794177]  ret_from_fork+0x3d/0x60
[   57.794181]  ? __pfx_kthread+0x10/0x10
[   57.794184]  ret_from_fork_asm+0x1b/0x30

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Move ras resume into SRIOV function
Yunxiang Li [Fri, 26 Apr 2024 03:15:28 +0000 (23:15 -0400)]
drm/amdgpu: Move ras resume into SRIOV function

This is part of the reset, move it into the reset function.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Zhigang Luo <zhigang.luo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/amdxcp: Use unique name for partition dev
Lijo Lazar [Tue, 30 Apr 2024 11:23:16 +0000 (16:53 +0530)]
drm/amd/amdxcp: Use unique name for partition dev

amdxcp is a platform driver for creating partition devices. libdrm
library identifies a platform device based on 'OF_FULLNAME' or
'MODALIAS'. If two or more devices have the same platform name, drm
library only picks the first device. Platform driver core uses name of
the device to populate 'MODALIAS'. When 'amdgpu_xcp' is used as the base
name, only first partition device gets identified. Assign unique name so
that drm library identifies partition devices separately.

amdxcp doesn't support probe of partitions, it doesn't bother about
modaliases.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu/vpe: fix vpe dpm clk ratio setup failed
Peyton Lee [Tue, 30 Apr 2024 14:09:09 +0000 (22:09 +0800)]
drm/amdgpu/vpe: fix vpe dpm clk ratio setup failed

Some version of BIOS does not enable all clock levels,
resulting in high level clock frequency of 0.
The number of valid CLKs must be confirmed in advance.

Signed-off-by: Peyton Lee <peytolee@amd.com>
Reviewed-by: Lang Yu <lang.yu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/display: Remove redundant NULL check in dcn10_set_input_transfer_func
Srinivasan Shanmugam [Tue, 23 Apr 2024 16:07:21 +0000 (21:37 +0530)]
drm/amd/display: Remove redundant NULL check in dcn10_set_input_transfer_func

This commit removes an unnecessary NULL check in the
`dcn10_set_input_transfer_func` function in the `dcn10_hwseq.c` file.
The variable `tf` is assigned the address of
`plane_state->in_transfer_func` unconditionally, so it can never be
`NULL`. Therefore, the check `if (tf == NULL)` is unnecessary and has
been removed.

Fixes the below smatch warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dcn10/dcn10_hwseq.c:1839 dcn10_set_input_transfer_func() warn: address of 'plane_state->in_transfer_func' is non-NULL

Fixes: 285a7054bf81 ("drm/amd/display: Remove plane and stream pointers from dc scratch")
Cc: Wenjing Liu <wenjing.liu@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Cc: Alvin Lee <alvin.lee2@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Hersen Wu <hersenxs.wu@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/display: Remove redundant NULL check in dce110_set_input_transfer_func
Srinivasan Shanmugam [Tue, 23 Apr 2024 16:19:51 +0000 (21:49 +0530)]
drm/amd/display: Remove redundant NULL check in dce110_set_input_transfer_func

This commit removes a redundant NULL check in the
`dce110_set_input_transfer_func` function in the `dce110_hwseq.c` file.
The variable `tf` is assigned the address of
`plane_state->in_transfer_func` unconditionally, so it can never be
`NULL`. Therefore, the check `if (tf == NULL)` is unnecessary and has
been removed.

Fixes the below smatch warning:
drivers/gpu/drm/amd/amdgpu/../display/dc/hwss/dce110/dce110_hwseq.c:301 dce110_set_input_transfer_func() warn: address of 'plane_state->in_transfer_func' is non-NULL

Fixes: 285a7054bf81 ("drm/amd/display: Remove plane and stream pointers from dc scratch")
Cc: Wenjing Liu <wenjing.liu@amd.com>
Cc: Tom Chung <chiahsuan.chung@amd.com>
Cc: Alvin Lee <alvin.lee2@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Roman Li <roman.li@amd.com>
Cc: Hersen Wu <hersenxs.wu@amd.com>
Cc: Alex Hung <alex.hung@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Fix amdgpu_device_reset_sriov retry logic
Yunxiang Li [Mon, 22 Apr 2024 19:04:52 +0000 (15:04 -0400)]
drm/amdgpu: Fix amdgpu_device_reset_sriov retry logic

The retry loop for SRIOV reset have refcount and memory leak issue.
Depending on which function call fails it can potentially call
amdgpu_amdkfd_pre/post_reset different number of times and causes
kfd_locked count to be wrong. This will block all future attempts at
opening /dev/kfd. The retry loop also leakes resources by calling
amdgpu_virt_init_data_exchange multiple times without calling the
corresponding fini function.

Align with the bare-metal reset path which doesn't have these issues.
This means taking the amdgpu_amdkfd_pre/post_reset functions out of the
reset loop and calling amdgpu_device_pre_asic_reset each retry which
properly free the resources from previous try by calling
amdgpu_virt_fini_data_exchange.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Zhigang Luo <zhigang.luo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd: Enable DCN410 init
Aurabindo Pillai [Tue, 30 Apr 2024 13:40:22 +0000 (09:40 -0400)]
drm/amd: Enable DCN410 init

Enable initializing Display Manager for DCN410 IP

Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Add reset_context flag for host FLR
Yunxiang Li [Mon, 22 Apr 2024 18:44:38 +0000 (14:44 -0400)]
drm/amdgpu: Add reset_context flag for host FLR

There are other reset sources that pass NULL as the job pointer, such as
amdgpu_amdkfd_reset_work. Therefore, using the job pointer to check if
the FLR comes from the host does not work.

Add a flag in reset_context to explicitly mark host triggered reset, and
set this flag when we receive host reset notification.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Zhigang Luo <zhigang.luo@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: Fix two reset triggered in a row
Yunxiang Li [Mon, 22 Apr 2024 18:59:02 +0000 (14:59 -0400)]
drm/amdgpu: Fix two reset triggered in a row

Some times a hang GPU causes multiple reset sources to schedule resets.
The second source will be able to trigger an unnecessary reset if they
schedule after we call amdgpu_device_stop_pending_resets.

Move amdgpu_device_stop_pending_resets to after the reset is done. Since
at this point the GPU is supposedly in a good state, any reset scheduled
after this point would be a legitimate reset.

Remove unnecessary and incorrect checks for amdgpu_in_reset that was
kinda serving this purpose.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: update vf to pf message retry from 2 to 5
Zhigang Luo [Thu, 11 Apr 2024 16:21:31 +0000 (12:21 -0400)]
drm/amdgpu: update vf to pf message retry from 2 to 5

increase retry times to wait host has enough time to complete reset.

Signed-off-by: Zhigang Luo <Zhigang.Luo@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amdgpu: avoid reading vf2pf info size from FB
Zhigang Luo [Tue, 16 Apr 2024 20:35:14 +0000 (16:35 -0400)]
drm/amdgpu: avoid reading vf2pf info size from FB

VF can't access FB when host is doing mode1 reset. Using sizeof to get
vf2pf info size, instead of reading it from vf2pf header stored in FB.

Signed-off-by: Zhigang Luo <Zhigang.Luo@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/display: re-indent dc_power_down_on_boot()
Dan Carpenter [Thu, 25 Apr 2024 11:21:22 +0000 (14:21 +0300)]
drm/amd/display: re-indent dc_power_down_on_boot()

These lines are indented too far.  Clean the whitespace.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/display: Fix spelling various spelling mistakes
Colin Ian King [Wed, 24 Apr 2024 16:28:09 +0000 (17:28 +0100)]
drm/amd/display: Fix spelling various spelling mistakes

There are various spelling mistakes in dml2_printf messages, fix them.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/display: Avoid -Wenum-float-conversion in add_margin_and_round_to_dfs_grainul...
Nathan Chancellor [Wed, 24 Apr 2024 16:14:02 +0000 (09:14 -0700)]
drm/amd/display: Avoid -Wenum-float-conversion in add_margin_and_round_to_dfs_grainularity()

When building with clang 19 or newer (which strengthened some of the
enum conversion warnings for C), there is a warning (or error with
CONFIG_WERROR=y) around doing arithmetic with an enumerated type and a
floating point expression.

  drivers/gpu/drm/amd/amdgpu/../display/dc/dml2/dml21/src/dml2_dpmm/dml2_dpmm_dcn4.c:181:58: error: arithmetic between enumeration type 'enum dentist_divider_range' and floating-point type 'double' [-Werror,-Wenum-float-conversion]
    181 |         divider = (unsigned int)(DFS_DIVIDER_RANGE_SCALE_FACTOR * (vco_freq_khz / clock_khz));
        |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

This conversion is expected due to the nature of the enumerated value
and definition, so silence the warning by casting the enumeration to an
integer explicitly to make it clear to the compiler.

Fixes: 70839da63605 ("drm/amd/display: Add new DCN401 sources")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 months agodrm/amd/display: Disable panel replay by default for now
Mario Limonciello [Tue, 30 Apr 2024 14:53:23 +0000 (09:53 -0500)]
drm/amd/display: Disable panel replay by default for now

Panel replay was enabled by default in commit 5950efe25ee0
("drm/amd/display: Enable Panel Replay for static screen use case"), but
it isn't working properly at least on some BOE and AUO panels.  Instead
of being static the screen is solid black when active.  As it's a new
feature that was just introduced that regressed VRR disable it for now
so that problem can be properly root caused.

Cc: Tom Chung <chiahsuan.chung@amd.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3344
Fixes: 5950efe25ee0 ("drm/amd/display: Enable Panel Replay for static screen use case")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>