linux-2.6-block.git
11 months agoRevert "drm/amd/display: Enable Replay for static screen use cases"
Ivan Lipski [Mon, 2 Oct 2023 17:47:54 +0000 (13:47 -0400)]
Revert "drm/amd/display: Enable Replay for static screen use cases"

This reverts commit 44e60b14d5a72f91fd0bdeae8da59ae37a3ca8e5.

Since, it causes a regression in which eDP displays with PSR support,
but no Replay support (Sink support <= 0x03), fail to enable PSR and
consequently all IGT amd_psr tests fail. So, revert this until a more
suitable fix can be found.

Cc: stable@vger.kernel.org
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: cache gpuvm fault information for gmc7+
Alex Deucher [Thu, 29 Sep 2022 15:57:12 +0000 (11:57 -0400)]
drm/amdgpu: cache gpuvm fault information for gmc7+

Cache the current fault info in the vm struct.  This can be queried
by userspace later to help debug UMDs.

Cc: samuel.pitoiset@gmail.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: add cached GPU fault structure to vm struct
Alex Deucher [Tue, 6 Oct 2020 14:54:38 +0000 (10:54 -0400)]
drm/amdgpu: add cached GPU fault structure to vm struct

When we get a GPU page fault, cache the fault for later
analysis.

Cc: samuel.pitoiset@gmail.com
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Refactor dm_get_plane_scale helper
Michel Dänzer [Mon, 2 Oct 2023 14:16:48 +0000 (16:16 +0200)]
drm/amd/display: Refactor dm_get_plane_scale helper

Cleanup, no functional change intended.

Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Use ttm_pages_limit to override vram reporting
Rajneesh Bhardwaj [Mon, 2 Oct 2023 19:27:01 +0000 (15:27 -0400)]
drm/amdgpu: Use ttm_pages_limit to override vram reporting

On GFXIP9.4.3 APU, allow the memory reporting as per the ttm pages
limit in NPS1 mode.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Rework KFD memory max limits
Rajneesh Bhardwaj [Thu, 14 Sep 2023 19:26:10 +0000 (15:26 -0400)]
drm/amdgpu: Rework KFD memory max limits

To allow bigger allocations specially on systems such as GFXIP 9.4.3
that use GTT memory for VRAM allocations, relax the limits to
maximize ROCm allocations.

Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/gmc11: set gart placement GC11
Alex Deucher [Thu, 14 Sep 2023 20:23:02 +0000 (16:23 -0400)]
drm/amdgpu/gmc11: set gart placement GC11

Needed to avoid a hardware issue.

v2: force high for all GC11 parts for consistency (Alex)
v3: rebase

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/gmc: add a way to force a particular placement for GART
Alex Deucher [Thu, 14 Sep 2023 20:23:01 +0000 (16:23 -0400)]
drm/amdgpu/gmc: add a way to force a particular placement for GART

We normally place GART based on the location of VRAM and the
available address space around that, but provide an option
to force a particular location for hardware that needs it.

v2: Switch to passing the placement via parameter

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: fix problems in power_helper
Wayne Lin [Fri, 22 Sep 2023 04:04:39 +0000 (12:04 +0800)]
drm/amd/display: fix problems in power_helper

[Why & How]
Fix following problems:
- In abm config, forget to initialize config.ambient_thresholds_lux.
- Adjust the coding style problem
- Restrict to call psr_su_set_dsc_slice_height() under edp only

Reviewed-by: Robin Chen <robin.chen@amd.com>
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: correct gpu clock counter query on cyan skilfish
Lang Yu [Thu, 21 Sep 2023 04:29:52 +0000 (12:29 +0800)]
drm/amdgpu: correct gpu clock counter query on cyan skilfish

Cayn skilfish uses SMUIO v11.0.8 offset.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: <stable@vger.kernel.org> # v5.15+
11 months agodrm/amd: Fix detection of _PR3 on the PCIe root port
Mario Limonciello [Tue, 26 Sep 2023 22:59:53 +0000 (17:59 -0500)]
drm/amd: Fix detection of _PR3 on the PCIe root port

On some systems with Navi3x dGPU will attempt to use BACO for runtime
PM but fails to resume properly.  This is because on these systems
the root port goes into D3cold which is incompatible with BACO.

This happens because in this case dGPU is connected to a bridge between
root port which causes BOCO detection logic to fail.  Fix the intent of
the logic by looking at root port, not the immediate upstream bridge for
_PR3.

Cc: stable@vger.kernel.org
Suggested-by: Jun Ma <Jun.Ma2@amd.com>
Tested-by: David Perry <David.Perry@amd.com>
Fixes: b10c1c5b3a4e ("drm/amdgpu: add check for ACPI power resources")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Fix logic error in sienna_cichlid_update_pcie_parameters()
Mario Limonciello [Wed, 27 Sep 2023 02:07:43 +0000 (21:07 -0500)]
drm/amd: Fix logic error in sienna_cichlid_update_pcie_parameters()

While aligning SMU11 with SMU13 implementation an assumption was made that
`dpm_context->dpm_tables.pcie_table` was populated in dpm table initialization
like in SMU13 but it isn't.

So restore some of the original logic and instead just check for
amdgpu_device_pcie_dynamic_switching_supported() to decide whether to hardcode
values; erring on the side of performance.

Cc: stable@vger.kernel.org # 6.1+
Reported-and-tested-by: Umio Yasuno <coelacanth_dream@protonmail.com>
Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/1447#note_2101382
Fixes: e701156ccc6c ("drm/amd: Align SMU11 SMU_MSG_OverridePcieParameters implementation with SMU13")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Disable DWB frame capture to emulate oneshot
Alex Hung [Fri, 23 Jun 2023 15:40:39 +0000 (09:40 -0600)]
drm/amd/display: Disable DWB frame capture to emulate oneshot

[WHY]
drm_writeback requires to capture exact one frame in each writeback
call.

[HOW]
frame_capture is disabled after each writeback is completed.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Add new set_fc_enable to struct dwbc_funcs
Alex Hung [Fri, 23 Jun 2023 15:39:46 +0000 (09:39 -0600)]
drm/amd/display: Add new set_fc_enable to struct dwbc_funcs

[WHAT]
Add a function to enable and disable DWB's frame captures.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Setup for mmhubbub3_warmup_mcif with big buffer
Alex Hung [Fri, 2 Jun 2023 00:22:32 +0000 (18:22 -0600)]
drm/amd/display: Setup for mmhubbub3_warmup_mcif with big buffer

[WHY]
Hardware may require different warmup approaches - big buffer or
individual buffers.

[HOW]
Setup warmup for big buffer when it is required by specific hardware.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Add writeback enable field (wb_enabled)
Alex Hung [Wed, 24 May 2023 04:07:46 +0000 (22:07 -0600)]
drm/amd/display: Add writeback enable field (wb_enabled)

[WHAT]
Add a new field to keep track whether a crtc is previously
writeback-enabled.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Fix writeback_info is not removed
Alex Hung [Fri, 19 May 2023 23:14:30 +0000 (17:14 -0600)]
drm/amd/display: Fix writeback_info is not removed

[WHY]
Counter j was not updated to present the num of writeback_info when
writeback pipes are removed.

[HOW]
update j (num of writeback info) under the correct condition.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Validate hw_points_num before using it
Alex Hung [Tue, 11 Jul 2023 00:23:58 +0000 (18:23 -0600)]
drm/amd/display: Validate hw_points_num before using it

[WHAT]
hw_points_num is 0 before ogam LUT is programmed; however, function
"dwb3_program_ogam_pwl" assumes hw_points_num is always greater than 0,
i.e. substracting it by 1 as an array index.

[HOW]
Check hw_points_num is not equal to 0 before using it.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Fix writeback_info never got updated
Alex Hung [Fri, 5 May 2023 20:14:38 +0000 (14:14 -0600)]
drm/amd/display: Fix writeback_info never got updated

[WHY]
wb_enabled field is set to false before it is used, and the following
code will never be executed.

[HOW]
Setting wb_enable to false after all removal work is completed.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Add writeback enable/disable in dc
Alex Hung [Thu, 2 Feb 2023 01:54:51 +0000 (18:54 -0700)]
drm/amd/display: Add writeback enable/disable in dc

[WHAT]
The enable and disable writeback calls need to be included in the
coressponding functions in dc_stream.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Hande writeback request from userspace
Alex Hung [Tue, 4 Jul 2023 00:17:32 +0000 (18:17 -0600)]
drm/amd/display: Hande writeback request from userspace

[WHAT]
Handle writeback requests and fill in the required information for DWB
programming and setup.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Create fake sink and stream for writeback connector
Harry Wentland [Wed, 2 Nov 2022 20:06:30 +0000 (16:06 -0400)]
drm/amd/display: Create fake sink and stream for writeback connector

[WHAT]
Writeback connectors don't have a physical sink but DC still
needs a sink to function. Create a fake sink and stream for
writeback connectors

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Create amdgpu_dm_wb_connector
Harry Wentland [Wed, 2 Nov 2022 19:54:52 +0000 (15:54 -0400)]
drm/amd/display: Create amdgpu_dm_wb_connector

[WHY]
We need to track the dc_link and it would get confusing if
re-using the amdgpu_dm_connector.

[HOW]
Creating new amdgpu_dm_wb_connector.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Use drm_connector in create_validate_stream_for_sink
Harry Wentland [Wed, 2 Nov 2022 20:28:02 +0000 (16:28 -0400)]
drm/amd/display: Use drm_connector in create_validate_stream_for_sink

[WHAT]
Again, we need to use this function for writeback connectors,
which are not of type amdgpu_dm_connector. Use the common base
drm_connector instead.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Address 'srf_updates' not described in 'could_mpcc_tree_change_for_a...
Srinivasan Shanmugam [Mon, 25 Sep 2023 06:12:33 +0000 (11:42 +0530)]
drm/amd/display: Address 'srf_updates' not described in 'could_mpcc_tree_change_for_active_pipes'

Fixes the following:

drivers/gpu/drm/amd/amdgpu/../display/dc/core/dc.c:3928: warning: Function parameter or member 'srf_updates' not described in 'could_mpcc_tree_change_for_active_pipes'

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: Aurabindo Pillai <aurabindo.pillai@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: delete dead code
Dan Carpenter [Wed, 27 Sep 2023 12:37:51 +0000 (15:37 +0300)]
drm/amd/pm: delete dead code

"ret" was checked earlier inside the loop, so we know it is zero here.
No need to check a second time.

Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Use drm_connector in create_stream_for_sink
Harry Wentland [Wed, 2 Nov 2022 19:15:32 +0000 (15:15 -0400)]
drm/amd/display: Use drm_connector in create_stream_for_sink

[WHAT]
We need to use this function for both amdgpu_dm_connectors
and drm_writeback_connectors. Modify it to operate on
a drm_connector as a common base.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: drop struct kfd_cu_info
Alex Deucher [Tue, 26 Sep 2023 16:00:23 +0000 (12:00 -0400)]
drm/amdkfd: drop struct kfd_cu_info

I think this was an abstraction back from when
kfd supported both radeon and amdgpu.  Since we just
support amdgpu now, there is no more need for this and
we can use the amdgpu structures directly.

This also avoids having the kfd_cu_info structures on
the stack when inlining which can blow up the stack.

Cc: Arnd Bergmann <arnd@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Return drm_connector from find_first_crtc_matching_connector
Harry Wentland [Wed, 2 Nov 2022 18:10:41 +0000 (14:10 -0400)]
drm/amd/display: Return drm_connector from find_first_crtc_matching_connector

[WHY]
We will be dealing with two types of connector: amdgpu_dm_connector
and drm_writeback_connector.

[HOW]
We want to find both and then cast to the appriopriate type afterwards.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: reduce stack size in kfd_topology_add_device()
Alex Deucher [Thu, 21 Sep 2023 14:32:09 +0000 (10:32 -0400)]
drm/amdkfd: reduce stack size in kfd_topology_add_device()

kfd_topology.c:2082:1: warning: the frame size of 1440 bytes is larger than 1024 bytes

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2866
Cc: Arnd Bergmann <arnd@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: update retry times for psp vmbx wait
Tao Zhou [Wed, 27 Sep 2023 10:02:29 +0000 (18:02 +0800)]
drm/amdgpu: update retry times for psp vmbx wait

Increase the retry loops and replace the constant number with macro.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Skip writeback connector when we get amdgpu_dm_connector
Harry Wentland [Thu, 27 Oct 2022 18:17:48 +0000 (14:17 -0400)]
drm/amd/display: Skip writeback connector when we get amdgpu_dm_connector

[WHY]
Writeback connectors are based on a different object:
drm_writeback_connector, and are therefore different from
amdgpu_dm_connector. We need to be careful to ensure code
designed for amdgpu_dm_connector doesn't inadvertently try
to operate on a drm_writeback_connector.

[HOW]
Skip them when connector type is DRM_MODE_CONNECTOR_WRITEBACK.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: exit directly if gpu reset fails
Tao Zhou [Wed, 27 Sep 2023 09:59:59 +0000 (17:59 +0800)]
drm/amdgpu: exit directly if gpu reset fails

No need to perform the full reset operation in case of gpu reset
failure.

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Disallow managing power profiles on SRIOV for gc11.0.3
Victor Zhao [Mon, 25 Sep 2023 06:28:25 +0000 (14:28 +0800)]
drm/amd/pm: Disallow managing power profiles on SRIOV for gc11.0.3

disable pp_power_profile_mode for sriov on gc11.0.3 as not supported
by smu

Signed-off-by: Victor Zhao <Victor.Zhao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: Fix a race condition of vram buffer unref in svm code
Xiaogang Chen [Wed, 27 Sep 2023 16:20:28 +0000 (11:20 -0500)]
drm/amdkfd: Fix a race condition of vram buffer unref in svm code

prange->svm_bo unref can happen in both mmu callback and a callback after
migrate to system ram. Both are async call in different tasks. Sync svm_bo
unref operation to avoid random "use-after-free".

Signed-off-by: Xiaogang Chen <xiaogang.chen@amd.com>
Reviewed-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Jesse Zhang <Jesse.Zhang@amd.com>
Tested-by: Jesse Zhang <Jesse.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Check all enabled planes in dm_check_crtc_cursor
Michel Dänzer [Tue, 12 Sep 2023 10:22:24 +0000 (12:22 +0200)]
drm/amd/display: Check all enabled planes in dm_check_crtc_cursor

It was only checking planes which had any state changes in the same
commit. However, it also needs to check other enabled planes.

Not doing this meant that a commit might spuriously "succeed", resulting
in the cursor plane displaying with incorrect scaling. See
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3177#note_1824263
for an example.

Fixes: d1bfbe8a3202 ("amd/display: check cursor plane matches underlying plane")
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <mdaenzer@redhat.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Initialize writeback connector
Alex Hung [Wed, 2 Nov 2022 15:44:08 +0000 (11:44 -0400)]
drm/amd/display: Initialize writeback connector

[WHAT]
Create a drm_writeback_connector when connector signal equals
SIGNAL_TYPE_VIRTUAL.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init from sw_init to early_init for CIK SDMA
Mario Limonciello [Mon, 25 Sep 2023 19:02:22 +0000 (14:02 -0500)]
drm/amd: Move microcode init from sw_init to early_init for CIK SDMA

As part of IP discovery early_init is run for all HW IP blocks.
During this phase all firmware is supposed to be identified that may
be missing so that the driver can avoid releasing resources used by
the EFI framebuffer or simpledrm until the last possible moment.

Move microcode loading from sw_init to early_init.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init from sw_init to early_init for SDMA v2.4
Mario Limonciello [Mon, 25 Sep 2023 19:02:10 +0000 (14:02 -0500)]
drm/amd: Move microcode init from sw_init to early_init for SDMA v2.4

As part of IP discovery early_init is run for all HW IP blocks.
During this phase all firmware is supposed to be identified that may
be missing so that the driver can avoid releasing resources used by
the EFI framebuffer or simpledrm until the last possible moment.

Move microcode loading from sw_init to early_init.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init from sw_init to early_init for SDMA v3.0
Mario Limonciello [Mon, 25 Sep 2023 19:02:02 +0000 (14:02 -0500)]
drm/amd: Move microcode init from sw_init to early_init for SDMA v3.0

As part of IP discovery early_init is run for all HW IP blocks.
During this phase all firmware is supposed to be identified that may
be missing so that the driver can avoid releasing resources used by
the EFI framebuffer or simpledrm until the last possible moment.

Move microcode loading from sw_init to early_init.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init from sw_init to early_init for SDMA v5.2
Mario Limonciello [Mon, 25 Sep 2023 19:01:50 +0000 (14:01 -0500)]
drm/amd: Move microcode init from sw_init to early_init for SDMA v5.2

As part of IP discovery early_init is run for all HW IP blocks.
During this phase all firmware is supposed to be identified that may
be missing so that the driver can avoid releasing resources used by
the EFI framebuffer or simpledrm until the last possible moment.

Move microcode loading from sw_init to early_init.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init from sw_init to early_init for SDMA v6.0
Mario Limonciello [Mon, 25 Sep 2023 19:01:35 +0000 (14:01 -0500)]
drm/amd: Move microcode init from sw_init to early_init for SDMA v6.0

As part of IP discovery early_init is run for all HW IP blocks.
During this phase all firmware is supposed to be identified that may
be missing so that the driver can avoid releasing resources used by
the EFI framebuffer or simpledrm until the last possible moment.

Move microcode loading from sw_init to early_init.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Move microcode init from sw_init to early_init for SDMA v5.0
Mario Limonciello [Mon, 25 Sep 2023 18:56:16 +0000 (13:56 -0500)]
drm/amd: Move microcode init from sw_init to early_init for SDMA v5.0

As part of IP discovery early_init is run for all HW IP blocks.
During this phase all firmware is supposed to be identified that may
be missing so that the driver can avoid releasing resources used by
the EFI framebuffer or simpledrm until the last possible moment.

Move microcode loading from sw_init to early_init.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Fix null pointer dereference in error message
Cong Liu [Tue, 26 Sep 2023 05:56:17 +0000 (13:56 +0800)]
drm/amd/display: Fix null pointer dereference in error message

This patch fixes a null pointer dereference in the error message that is
printed when the Display Core (DC) fails to initialize. The original
message includes the DC version number, which is undefined if the DC is
not initialized.

Fixes: 9788d087caff ("drm/amd/display: improve the message printed when loading DC")
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Create one virtual connector in DC
Harry Wentland [Wed, 2 Nov 2022 15:10:12 +0000 (11:10 -0400)]
drm/amd/display: Create one virtual connector in DC

[WHAT]
Prepare a virtual connector for writeback.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Drop error message about failing to load SDMA firmware
Mario Limonciello [Mon, 25 Sep 2023 18:48:05 +0000 (13:48 -0500)]
drm/amd: Drop error message about failing to load SDMA firmware

The error path for SDMA firmware loading is unnecessarily noisy.
When a firmware is missing 3 errors show up:
```
amdgpu 0000:07:00.0: Direct firmware load for amdgpu/green_sardine_sdma.bin failed with error -2
[drm:sdma_v4_0_early_init [amdgpu]] *ERROR* Failed to load sdma firmware!
[drm:amdgpu_device_init [amdgpu]] *ERROR* early_init of IP block <sdma_v4_0> failed -19
```

The error code for the device init is bubbled up already, remove the
second one.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6
Le Ma [Tue, 26 Sep 2023 10:56:50 +0000 (18:56 +0800)]
drm/amd/pm: fix the print_clk_levels issue for SMU v13.0.6

Pass the correct size to smu_v13_0_6_print_clks, otherwise
the same place in buf will be re-written.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: deprecate allow_xgmi_power_down interface
Le Ma [Wed, 20 Sep 2023 07:17:12 +0000 (15:17 +0800)]
drm/amd/pm: deprecate allow_xgmi_power_down interface

Replace with set_plpd_mode uniformly for places to use.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: integrate plpd allow/disallow into select_xgmi_plpd_policy in ppt level
Le Ma [Wed, 20 Sep 2023 07:10:48 +0000 (15:10 +0800)]
drm/amd/pm: integrate plpd allow/disallow into select_xgmi_plpd_policy in ppt level

The allow_xgmi_power_down(true/false) will be generally replaced by:
  - allow: select_xgmi_plpd_policy(XGMI_PLPD_DEFAULT)
  - disallow: select_xgmi_plpd_policy(XGMI_PLPD_DISALLOW)

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: init plpd_mode properly for different asics
Le Ma [Wed, 20 Sep 2023 03:16:39 +0000 (11:16 +0800)]
drm/amd/pm: init plpd_mode properly for different asics

Assign DEFAULT mode if it supports plpd, otherwise keeps NONE

v2: reduce ip version checks

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Remove unused DPCD declarations
Stylon Wang [Wed, 20 Sep 2023 10:13:35 +0000 (18:13 +0800)]
drm/amd/display: Remove unused DPCD declarations

[Why & How]
These DPCD addresses are either declared in other header files
where it makes more sense or simply not used by any DC code.
Remove them to reduce redundancies and potential confusion.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Skip entire amdgpu_dm build if !CONFIG_DRM_AMD_DC
Harry Wentland [Wed, 26 Oct 2022 18:08:31 +0000 (14:08 -0400)]
drm/amd/display: Skip entire amdgpu_dm build if !CONFIG_DRM_AMD_DC

[WHY]
Previously this only excluded build for a few amdgpu_dm
binaries which makes no sense.

[HOW]
Wrap the entire Makefile in "ifneq ($(CONFIG_DRM_AMD_DC),)"

Reviewed-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Limit seamless boot by default to APUs
Mario Limonciello [Tue, 26 Sep 2023 01:31:06 +0000 (20:31 -0500)]
drm/amd: Limit seamless boot by default to APUs

A hang is reported on DCN 3.2 with seamless boot enabled.
As the benefits come from an eDP setup, limit it to only enabled
by default with APUs.

Suggested-by: Alexander.Deucher@amd.com
Reported-by: feifei.xu@amd.com
Closes: https://lore.kernel.org/amd-gfx/85b427f6-11ec-4249-bf6f-eadf9c375f88@amd.com/T/#m2887e919d7c01b2a4860d2261b366d22e070f309
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Drop error message about failing to load DMUB firmware
Mario Limonciello [Mon, 25 Sep 2023 19:51:23 +0000 (14:51 -0500)]
drm/amd: Drop error message about failing to load DMUB firmware

The error path for DMUB firmware loading is unnecessarily noisy.
When a firmware is missing 3 errors show up:
```
amdgpu 0000:07:00.0: Direct firmware load for amdgpu/green_sardine_dmcub.bin failed with error -2
[drm:dm_early_init [amdgpu]] *ERROR* DMUB firmware loading failed: -19
[drm:amdgpu_device_init [amdgpu]] *ERROR* early_init of IP block <dm> failed -19
```

The error code for the device init is bubbled up already, remove the
second one.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: Handle errors from svm validate and map
Philip Yang [Wed, 13 Sep 2023 14:10:23 +0000 (10:10 -0400)]
drm/amdkfd: Handle errors from svm validate and map

If new range is splited to multiple pranges with max_svm_range_pages
alignment and added to update_list, svm validate and map should keep
going after error to make sure prange->mapped_to_gpu flag is up to date
for the whole range.

svm validate and map update set prange->mapped_to_gpu after mapping to
GPUs successfully, otherwise clear prange->mapped_to_gpu flag (for
update mapping case) instead of setting error flag, we can remove
the redundant error flag to simpliy code.

Refactor to remove goto and update prange->mapped_to_gpu flag inside
svm_range_lock, to guarant we always evict queues or unmap from GPUs if
there are invalid ranges.

After svm validate and map return error -EAGIN, the caller retry will
update the mapping for the whole range again.

Fixes: c22b04407097 ("drm/amdkfd: flag added to handle errors from svm validate and map")
Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tested-by: James Zhu <james.zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: add xgmi_plpd_policy sysfs node for user to change plpd policy
Le Ma [Thu, 7 Sep 2023 07:50:14 +0000 (15:50 +0800)]
drm/amd/pm: add xgmi_plpd_policy sysfs node for user to change plpd policy

Add xgmi_plpd_policy sysfs node for users to check and select xgmi
per-link power down policy:
  - arg 0: disallow plpd
  - arg 1: default policy
  - arg 2: optimized policy

v2: split from smu v13.0.6 code and miscellaneous updates
v3: add usage comments around set/get functions

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: add xgmi plpd mode selecting interface for smu v13.0.6
Le Ma [Thu, 7 Sep 2023 07:32:13 +0000 (15:32 +0800)]
drm/amd/pm: add xgmi plpd mode selecting interface for smu v13.0.6

Add the interface to change xgmi per-link power down policy.

v2: split from sysfs interface code and miscellaneous updates
v3: check against XGMI_PLPD_DEFAULT/XGMI_PLPD_OPTIMIZED and
    pass PPSMC param

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: add plpd_mode in smu_context to indicate current mode
Le Ma [Tue, 29 Aug 2023 11:38:48 +0000 (19:38 +0800)]
drm/amd/pm: add plpd_mode in smu_context to indicate current mode

Add enum pp_xgmi_plpd_mode to describe PLPD policies.

v2: move the enum from amdgpu_smu.h to kgd_pp_interface.h

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: update pmfw headers for version 85.73.0
Le Ma [Fri, 15 Sep 2023 08:21:18 +0000 (16:21 +0800)]
drm/amd/pm: update pmfw headers for version 85.73.0

To add message to select PLPD mode.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Add description for AMD_IP_BLOCK_TYPE_VPE
Juntong Deng [Sun, 24 Sep 2023 20:00:26 +0000 (21:00 +0100)]
drm/amdgpu: Add description for AMD_IP_BLOCK_TYPE_VPE

AMD_IP_BLOCK_TYPE_VPE is a new IP BLOCK type for Video Processing Engine,
but currently lacks description.

Fix the documentation warning:
warning: Enum value 'AMD_IP_BLOCK_TYPE_VPE' not described in
enum 'amd_ip_block_type'

Signed-off-by: Juntong Deng <juntong.deng@outlook.com>
Reviewed-by: Lang Yu <lang.yu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Change dc_set_power_state() to bool instead of int
Mario Limonciello [Mon, 25 Sep 2023 17:57:47 +0000 (12:57 -0500)]
drm/amd/display: Change dc_set_power_state() to bool instead of int

DC code is reused by other OSes and so Linux return codes don't
make sense.  Change dc_set_power_state() to boolean and add a wrapper
dm_set_power_state() to return a Linux error code for the memory
allocation failure.

Suggested-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/gmc11: disable AGP on GC 11.5
Alex Deucher [Thu, 21 Sep 2023 13:44:34 +0000 (09:44 -0400)]
drm/amdgpu/gmc11: disable AGP on GC 11.5

AGP aperture is deprecated and no longer functional.

v2: fix typo (Alex)
v3: just skip the agp setup call
v4: revert back to the original model
v5: back to v3

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: not to save bo in the case of RAS err_event_athub
David (Ming Qiang) Wu [Thu, 14 Sep 2023 20:34:08 +0000 (16:34 -0400)]
drm/amdgpu: not to save bo in the case of RAS err_event_athub

err_event_athub will corrupt VCPU buffer and not good to
be restored in amdgpu_vcn_resume() and in this case
the VCPU buffer needs to be cleared for VCN firmware to
work properly.

Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: David (Ming Qiang) Wu <David.Wu3@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: Fix a memory leak
Luben Tuikov [Fri, 22 Sep 2023 21:21:21 +0000 (17:21 -0400)]
drm/amdgpu: Fix a memory leak

Fix a memory leak in amdgpu_fru_get_product_info().

Cc: Alex Deucher <Alexander.Deucher@amd.com>
Reported-by: Yang Wang <kevinyang.wang@amd.com>
Fixes: 0dbf2c562625 ("drm/amdgpu: Interpret IPMI data for product information (v2)")
Signed-off-by: Luben Tuikov <luben.tuikov@amd.com>
Reviewed-by: Alex Deucher <Alexander.Deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd: Propagate failures in dc_set_power_state()
Mario Limonciello [Thu, 21 Sep 2023 14:50:04 +0000 (09:50 -0500)]
drm/amd: Propagate failures in dc_set_power_state()

During the suspend process dc_set_power_state() will use kzalloc
to allocate memory, but this potentially fails with memory pressure.
If it fails, the suspend should be aborted.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Cc: Harry.Wentland@amd.com
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: set stream gamut remap matrix to MPC for DCN3+
Melissa Wen [Fri, 21 Jul 2023 13:24:31 +0000 (12:24 -0100)]
drm/amd/display: set stream gamut remap matrix to MPC for DCN3+

dc->caps.color.mpc.gamut_remap says there is a post-blending color block
for gamut remap matrix for DCN3 HW family and newer versions. However,
those drivers still follow DCN10 programming that remap stream
gamut_remap_matrix to DPP (pre-blending).

To enable pre-blending and post-blending gamut_remap matrix supports at
the same time, set stream gamut_remap to MPC and plane gamut_remap to
DPP for DCN families that support both.

It was tested using IGT KMS color tests for DRM CRTC CTM property and it
preserves test results.

Signed-off-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/gmc: set a default disable value for AGP
Alex Deucher [Wed, 20 Sep 2023 17:27:58 +0000 (13:27 -0400)]
drm/amdgpu/gmc: set a default disable value for AGP

To disable AGP, the start needs to be set to a higher
value than the end.  Set a default disable value for
the AGP aperture and allow the IP specific GMC code
to enable it selectively be calling amdgpu_gmc_agp_location().

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/gmc6-8: properly disable the AGP aperture
Alex Deucher [Wed, 20 Sep 2023 17:07:00 +0000 (13:07 -0400)]
drm/amdgpu/gmc6-8: properly disable the AGP aperture

The BOT register needs to be larger than the TOP register
for this to be properly disabled.  The lower 22 bits
of the BOT address are always 0 and the lower 22 bits of
the TOP register are always 1 so you need to make
the upper bits of BOT larger than the upper bits of BOT.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu:Expose physical id of device in XGMI hive
Mangesh Gadre [Fri, 22 Sep 2023 05:16:00 +0000 (13:16 +0800)]
drm/amdgpu:Expose physical id of device in XGMI hive

This identifies the physical ordering of devices in the hive

v2: fix compilation issue

Signed-off-by: Mangesh Gadre <Mangesh.Gadre@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Break after finding supported vlevel for repopulate
Alvin Lee [Thu, 14 Sep 2023 15:40:31 +0000 (11:40 -0400)]
drm/amd/display: Break after finding supported vlevel for repopulate

[Description]
After repopulating pipes for a split / merge, we want to find the
lowest vlevel that supports the desired mpc combine level.

Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Alvin Lee <alvin.lee2@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Update OPP counter from new interface
Hong-lu Cheng [Thu, 14 Sep 2023 15:32:56 +0000 (11:32 -0400)]
drm/amd/display: Update OPP counter from new interface

[Description]
Change to new interface for notifying OS of cursor support changes

Reviewed-by: Gang Chu <gang.chu@amd.com>
Reviewed-by: Jaina Han <jaina.han@amd.com>
Reviewed-by: Jun Lei <jun.lei@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Hong-lu Cheng <hong-lu.cheng@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: augment display clock in dc_cap structure
Max Tseng [Fri, 8 Sep 2023 07:31:33 +0000 (15:31 +0800)]
drm/amd/display: augment display clock in dc_cap structure

[Why]
Allow dc report maximum display clock possible at vmin

Reviewed-by: Wayne Lin <wayne.lin@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Max Tseng <max.tseng@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: 3.2.253
Aric Cyr [Mon, 18 Sep 2023 03:50:49 +0000 (23:50 -0400)]
drm/amd/display: 3.2.253

This version brings along the following:

- Fix incorrect odm change detection logic
- Add primary pipe check when building slice table for dcn3x
- Add get primary dpp pipe resource interface
- Add missing function pointer for DCN321 resource
- Rename DisableMinDispClkODM in dc_config
- Break after finding supported vlevel for repopulate
- Update OPP counter from new interface
- Augment display clock in dc_cap structure
- Improve code style on bios_parser2
- Skip audio config for virtual signal
- Block MPO if it prevents pstate support
- Fix DP2.0 timing sync
- Improve x86 and dmub ips handshake
- Remove guaranteed viewports limitation for odm
- Add new windowed mpo odm minimal transition sequence
- Reset stream slice count for new ODM policy
- Determine fast update only before commit minimal transition state
- Remove unused mmhub_reg_offsets

Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: fix incorrect odm change detection logic
Wenjing Liu [Thu, 14 Sep 2023 16:42:50 +0000 (12:42 -0400)]
drm/amd/display: fix incorrect odm change detection logic

[why]
The current ODM change detection only compares first two ODM slices.
If there are 4 ODM slices and the change is within the last two slices, the
logic fails to detect ODM change and cause us to skip ODM programming
unexpectedly.

[how]
Add a is ODM topology changed resource interface to check any ODM
topology changes with a more generic method.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: add primary pipe check when building slice table for dcn3x
Wenjing Liu [Thu, 14 Sep 2023 15:55:02 +0000 (11:55 -0400)]
drm/amd/display: add primary pipe check when building slice table for dcn3x

[why]
There is a corner use case where the same plane pointer can be added into
dc state twice. In addition to plane state pointer check we also need to match
primary pipe before identifying the same plane.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: add get primary dpp pipe resource interface
Wenjing Liu [Mon, 11 Sep 2023 21:28:26 +0000 (17:28 -0400)]
drm/amd/display: add get primary dpp pipe resource interface

[why]
Need to have a helper function to find the primary dp pipe of the plane
associated with a dpp pipe

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: add missing function pointer for DCN321 resource
Wenjing Liu [Mon, 11 Sep 2023 21:25:58 +0000 (17:25 -0400)]
drm/amd/display: add missing function pointer for DCN321 resource

[why]
acquire_free_pipe_as_secondary_opp_head function pointer is not
assigned. This causes ODM mode to be disabled after enabling
windowed MPO ODM capability on DCN321.

[how]
assign the correct function to the function pointer.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Rename DisableMinDispClkODM in dc_config
Gabe Teeger [Thu, 14 Sep 2023 20:00:16 +0000 (16:00 -0400)]
drm/amd/display: Rename DisableMinDispClkODM in dc_config

[what and why]
The logic for DisableMinDispClkODM is reversed now that odm is
disabled by default. Renaming to EnableMinDispClkODM.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Gabe Teeger <gabe.teeger@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu/vpe: fix truncation warnings
Lang Yu [Fri, 22 Sep 2023 01:23:14 +0000 (09:23 +0800)]
drm/amdgpu/vpe: fix truncation warnings

Fix truncation warnings.

Fixes: 9d4346bdbc64 ("drm/amdgpu: add VPE 6.1.0 support")
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202309200028.aUVuM8os-lkp@intel.com
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Improve code style on bios_parser2
Rodrigo Siqueira [Tue, 12 Sep 2023 21:18:00 +0000 (15:18 -0600)]
drm/amd/display: Improve code style on bios_parser2

bios_parser2 uses space instead of tabs in multiple areas; this commit
converts those spaces into tabs. It also removes some other small
details.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Remove unwanted drm edid references
Alex Hung [Fri, 25 Aug 2023 19:21:28 +0000 (13:21 -0600)]
drm/amd/display: Remove unwanted drm edid references

[WHY]
edid_override and drm_edid_override_connector_update, according to drm
documentation, should not be referred outside drm_edid.

[HOW]
Remove and replace them accordingly. This can tested by IGT's
kms_hdmi_inject test.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: switch DC over to the new DRM logging macros
Hamza Mahfooz [Wed, 20 Sep 2023 17:38:11 +0000 (13:38 -0400)]
drm/amd/display: switch DC over to the new DRM logging macros

For multi-GPU systems it is difficult to tell which GPU a particular
message is being printed for and that is undesirable because it
complicates debugging efforts. Also, the new macros allow us to enable
logging for particular parts of the codebase more selectively (since we
no longer need to throw everything at DRM_DEBUG_KMS()). So, for the
reasons outlined above we should switch to the new macros.

We can accomplish this by using the existing DC_LOGGER code to pass
around the relevant `struct drm_device` which will be fed to the new
macros in logger_types.h. Also, we must get rid of all instances of the
DC_LOG_.*() functions that are currently in amdgpu_dm since we don't use
the DC logger there and we can simply refer to the macros directly
there instead.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: skip audio config for virtual signal
Alex Hung [Tue, 12 Sep 2023 23:43:02 +0000 (17:43 -0600)]
drm/amd/display: skip audio config for virtual signal

[WHY & HOW]
IGT's kms_hdmi_inject (subtest inject_audio) triggers a warning message
from dce_aud_az_configure. This can be fixed by checking Virtual signal
that does not need to configure AZ audio since it does not have any.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/pm: Add reset option for fan_curve on smu13_0_0
Ma Jun [Thu, 7 Sep 2023 07:33:12 +0000 (15:33 +0800)]
drm/amd/pm: Add reset option for fan_curve on smu13_0_0

Add reset option for fan_curve.
User can use command "echo r > fan_cure" to reset the fan_curve
to boot value

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: block MPO if it prevents pstate support
Dmytro Laktyushkin [Mon, 11 Sep 2023 13:56:45 +0000 (09:56 -0400)]
drm/amd/display: block MPO if it prevents pstate support

This change adds a method to block mpo when it would cause us to
exit pstate support. We should block mpo by default where MPO
causes issues by preventing pstate change.

Reviewed-by: Jun Lei <jun.lei@amd.com>
Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Dmytro Laktyushkin <dmytro.laktyushkin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Fix DP2.0 timing sync
Ilya Bakoulin [Thu, 7 Sep 2023 18:03:15 +0000 (14:03 -0400)]
drm/amd/display: Fix DP2.0 timing sync

[Why]
Triggering OTG sync before all OTG/HPO clock programming is complete
causes timing sync to fail and a subsequent P-state hang.

[How]
Move DTB clock programming earlier in the sequence to
enable_stream_timing.

Reviewed-by: Ariel Bernstein <eric.bernstein@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Ilya Bakoulin <ilya.bakoulin@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: Improve x86 and dmub ips handshake
Duncan Ma [Mon, 28 Aug 2023 19:48:27 +0000 (15:48 -0400)]
drm/amd/display: Improve x86 and dmub ips handshake

[Why]
There is a race condition between x86 and dmcub fw when attempting to exit
IPS2. Scenarios including exiting IPS2 before IPS2 has been entered. This
can cause unexpected hang when DMCUB attempt to exit while PMFW still
tries to enter IPS2.

[How]
A new design has been introduced to remove race conditions and improve the
handshake between x86 and DMCUB. An AON scratch register is borrowed from
PMFW to determine whether DMCUB has committed to IPS entry or not.

In the case when dmcub has committed IPS entry, x86 must poll until an exit
event occurred either from DMCUB(IPS1) or PMFW(IPS2). x86 will wait
upperbound of evaluation and IPS entry time to ensure IPS2 exit event has
been sent to PMFW.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Duncan Ma <duncan.ma@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: remove guaranteed viewports limitation for odm
Wenjing Liu [Thu, 31 Aug 2023 18:11:09 +0000 (14:11 -0400)]
drm/amd/display: remove guaranteed viewports limitation for odm

[why]
With the more generic hw minimal state transition sequence,
this limitation has been overcome.

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: add new windowed mpo odm minimal transition sequence
Wenjing Liu [Thu, 31 Aug 2023 18:09:26 +0000 (14:09 -0400)]
drm/amd/display: add new windowed mpo odm minimal transition sequence

[why]
We do not have a programming sequence to support seamless transition
between MPC combine to ODM combine when plane count remains the same.
This can happen with windowed MPO ODM use cases when plane scaling
is changed over ODM Combine's capability.

[How]
We are adding a programming sequence specifically to handle the transition
between MPC combine and ODM combine during plane scaling change.

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: reset stream slice count for new ODM policy
Wenjing Liu [Mon, 28 Aug 2023 19:43:03 +0000 (15:43 -0400)]
drm/amd/display: reset stream slice count for new ODM policy

[why]
ODM combine could prevent us from supporting more planes
we will reset ODM slice count back to 1 when all planes have
been removed to maximize the amount of planes supported when
new planes are added.

[how]
reset ODM slice count when all planes are removed.

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: determine fast update only before commit minimal transition state
Wenjing Liu [Thu, 7 Sep 2023 16:14:37 +0000 (12:14 -0400)]
drm/amd/display: determine fast update only before commit minimal transition state

[why]
commit minimal transition state would update current
state to new state with surface and stream update
applied. If we determine fast update only after we
have committed the minimal transition state based on
new state, we will skip committing the full new state.

[how]
determine fast update only earlier based on the
actaul currents state. Only skip full commit when
the transition between actual current state and new
state is fast update only.

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amd/display: remove unused mmhub_reg_offsets
Qingqing Zhuo [Mon, 11 Sep 2023 20:34:47 +0000 (16:34 -0400)]
drm/amd/display: remove unused mmhub_reg_offsets

[Why & How]
mmhub_reg_offsets never used in code. Remove it.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Acked-by: Wayne Lin <wayne.lin@amd.com>
Signed-off-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code
Xiaogang Chen [Wed, 20 Sep 2023 16:02:51 +0000 (11:02 -0500)]
drm/amdkfd: fix some race conditions in vram buffer alloc/free of svm code

This patch fixes:
1: ref number of prange's svm_bo got decreased by an async call from hmm. When
wait svm_bo of prange got released we shoul also wait prang->svm_bo become NULL,
otherwise prange->svm_bo may be set to null after allocate new vram buffer.

2: During waiting svm_bo of prange got released in a while loop should reschedule
current task to give other tasks oppotunity to run, specially the the workque
task that handles svm_bo ref release, otherwise we may enter to softlock.

Signed-off-by: Xiaogang.Chen <xiaogang.chen@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdkfd: Move dma unmapping after TLB flush
Philip Yang [Mon, 11 Sep 2023 18:44:22 +0000 (14:44 -0400)]
drm/amdkfd: Move dma unmapping after TLB flush

Otherwise GPU may access the stale mapping and generate IOMMU
IO_PAGE_FAULT.

Move this to inside p->mutex to prevent multiple threads mapping and
unmapping concurrently race condition.

After kfd_mem_dmaunmap_attachment is removed from unmap_bo_from_gpuvm,
kfd_mem_dmaunmap_attachment is called if failed to map to GPUs, and
before free the mem attachment in case failed to unmap from GPUs.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: further move TLB hw workarounds a layer up
Christian König [Mon, 4 Sep 2023 15:41:11 +0000 (17:41 +0200)]
drm/amdgpu: further move TLB hw workarounds a layer up

For the PASID flushing we already handled that at a higher layer, apply
those workarounds to the standard flush as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: rework lock handling for flush_tlb v2
Christian König [Mon, 4 Sep 2023 14:58:45 +0000 (16:58 +0200)]
drm/amdgpu: rework lock handling for flush_tlb v2

Instead of each implementation doing this more or less correctly
move taking the reset lock at a higher level.

v2: fix typo

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: drop error return from flush_gpu_tlb_pasid
Christian König [Mon, 4 Sep 2023 13:50:35 +0000 (15:50 +0200)]
drm/amdgpu: drop error return from flush_gpu_tlb_pasid

That function never fails, drop the error return.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: fix and cleanup gmc_v11_0_flush_gpu_tlb_pasid
Christian König [Mon, 4 Sep 2023 11:54:46 +0000 (13:54 +0200)]
drm/amdgpu: fix and cleanup gmc_v11_0_flush_gpu_tlb_pasid

The same PASID can be used by more than one VMID, reset each of them.

Use the common KIQ handling.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: cleanup gmc_v10_0_flush_gpu_tlb_pasid
Christian König [Mon, 4 Sep 2023 11:24:51 +0000 (13:24 +0200)]
drm/amdgpu: cleanup gmc_v10_0_flush_gpu_tlb_pasid

The same PASID can be used by more than one VMID, reset each of them.

Use the common KIQ handling.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
11 months agodrm/amdgpu: fix and cleanup gmc_v9_0_flush_gpu_tlb_pasid
Christian König [Mon, 4 Sep 2023 11:03:23 +0000 (13:03 +0200)]
drm/amdgpu: fix and cleanup gmc_v9_0_flush_gpu_tlb_pasid

Testing for reset is pointless since the reset can start right after the
test.

The same PASID can be used by more than one VMID, invalidate each of them.

Move the KIQ and all the workaround handling into common GMC code.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>