linux-block.git
12 months agodrm/amd/display: Introduce overlay cursor mode
Leo Li [Thu, 18 Jan 2024 21:29:49 +0000 (16:29 -0500)]
drm/amd/display: Introduce overlay cursor mode

[Why]

DCN is the display hardware for amdgpu. DRM planes are backed by DCN
hardware pipes, which carry pixel data from one end (memory), to the
other (output encoder).

Each DCN pipe has the ability to blend in a cursor early on in the
pipeline. In other words, there are no dedicated cursor planes in DCN,
which makes cursor behavior somewhat unintuitive for compositors.

For example, if the cursor is in RGB format, but the top-most DRM plane
is in YUV format, DCN will not be able to blend them. Because of this,
amdgpu_dm rejects all configurations where a cursor needs to be enabled
on top of a YUV formatted plane.

From a compositor's perspective, when computing an allocation for
hardware plane offloading, this cursor-on-yuv configuration result in an
atomic test failure. Since the failure reason is not obvious at all,
compositors will likely fall back to full rendering, which is not ideal.

Instead, amdgpu_dm can try to accommodate the cursor-on-yuv
configuration by opportunistically reserving a separate DCN pipe just
for the cursor. We can refer to this as "overlay cursor mode". It is
contrasted with "native cursor mode", where the native DCN per-pipe
cursor is used.

[How]

On each crtc, compute whether the cursor plane should be enabled in
overlay mode. If it is, mark the CRTC as requesting overlay cursor mode.

Overlay cursor should be enabled whenever there exists a underlying
plane that has YUV format, or is scaled differently than the cursor. It
should also be enabled if there is no underlying plane, or if underlying
planes do not cover the entire CRTC.

During DC validation, attempt to enable a separate DCN pipe for the
cursor if it's in overlay mode. If that fails, or if no overlay mode is
requested, then fallback to native mode.

v2:
* Update commit message for when overlay cursor should be enabled
* Also consider scale and no-underlying-plane case (cursor on crtc bg)
* Consider all underlying planes when determinig overlay/native, not
  just the plane immediately beneath the cursor, as it may not cover the
  entire CRTC.
* Fix typo s/decending/descending/
* Force native cursor on pre-DCN hardware

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Leo Li <sunpeng.li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Pekka Paalanen <pekka.paalanen@collabora.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: define abm debug interface
Josip Pavic [Fri, 10 May 2024 14:57:48 +0000 (10:57 -0400)]
drm/amd/display: define abm debug interface

[Why & How]
Define debug interface to dmub for reading back abm data.

Reviewed-by: Anthony Koo <anthony.koo@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Josip Pavic <josip.pavic@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Refactor function dm_dp_mst_is_port_support_mode()
Wayne Lin [Mon, 20 May 2024 08:37:01 +0000 (16:37 +0800)]
drm/amd/display: Refactor function dm_dp_mst_is_port_support_mode()

[Why]
dm_dp_mst_is_port_support_mode() is a bit not following the original design rule and cause
light up issue with multiple 4k monitors after mst dsc hub.

[How]
Refactor function dm_dp_mst_is_port_support_mode() a bit to solve the light up issue.

Reviewed-by: Jerry Zuo <jerry.zuo@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Don't refer to dc_sink in is_dsc_need_re_compute
Wayne Lin [Tue, 21 May 2024 03:54:26 +0000 (11:54 +0800)]
drm/amd/display: Don't refer to dc_sink in is_dsc_need_re_compute

[Why]
When unplug one of monitors connected after mst hub, encounter null pointer dereference.

It's due to dc_sink get released immediately in early_unregister() or detect_ctx(). When
commit new state which directly referring to info stored in dc_sink will cause null pointer
dereference.

[how]
Remove redundant checking condition. Relevant condition should already be covered by checking
if dsc_aux is null or not. Also reset dsc_aux to NULL when the connector is disconnected.

Reviewed-by: Jerry Zuo <jerry.zuo@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: change dram_clock_latency to 34us for dcn35
Paul Hsieh [Tue, 28 May 2024 06:36:00 +0000 (14:36 +0800)]
drm/amd/display: change dram_clock_latency to 34us for dcn35

[Why & How]
Current DRAM setting would cause underflow on customer platform.
Modify dram_clock_change_latency_us from 11.72 to 34.0 us as per recommendation from HW team

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Paul Hsieh <paul.hsieh@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Change dram_clock_latency to 34us for dcn351
Daniel Miess [Tue, 28 May 2024 20:17:17 +0000 (16:17 -0400)]
drm/amd/display: Change dram_clock_latency to 34us for dcn351

[Why]
Intermittent underflow observed when using 4k144 display on
dcn351

[How]
Update dram_clock_change_latency_us from 11.72us to 34us

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Daniel Miess <daniel.miess@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Correct the defined value for AMDGPU_DMUB_NOTIFICATION_MAX
Wayne Lin [Mon, 27 May 2024 07:33:48 +0000 (15:33 +0800)]
drm/amd/display: Correct the defined value for AMDGPU_DMUB_NOTIFICATION_MAX

[Why & How]
It actually exposes '6' types in enum dmub_notification_type. Not 5. Using smaller
number to create array dmub_callback & dmub_thread_offload has potential to access
item out of array bound. Fix it.

Reviewed-by: Jerry Zuo <jerry.zuo@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Defer the setting of link hpd status for usb4/tbt
Wayne Lin [Mon, 27 May 2024 07:17:26 +0000 (15:17 +0800)]
drm/amd/display: Defer the setting of link hpd status for usb4/tbt

[Why & How]
Link hpd status is set during link detection process via dpia_query_hpd_status(),
doesn't need to explicitly set it during outbox irq. Remove it.

Reviewed-by: Jerry Zuo <jerry.zuo@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Adjust debug msg for usb4/tbt
Wayne Lin [Mon, 27 May 2024 07:04:31 +0000 (15:04 +0800)]
drm/amd/display: Adjust debug msg for usb4/tbt

[Why & How]
Debug msg for usb4/tbt now is a bit confusing. Adjust it for better reading.

Reviewed-by: Jerry Zuo <jerry.zuo@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Avoid programming DTO if Refclk is 0
Chris Park [Tue, 28 May 2024 19:56:22 +0000 (15:56 -0400)]
drm/amd/display: Avoid programming DTO if Refclk is 0

[Why]
Reference clock, either DPREFCLK or DTBCLK can be a value of 0
which then will encounter division by 0.

[How]
Avoid further calculation and programming if refclk is not
populated.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Chris Park <chris.park@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Disable boot optimization for DCN401
Joshua Aberback [Mon, 27 May 2024 22:24:00 +0000 (18:24 -0400)]
drm/amd/display: Disable boot optimization for DCN401

[Why]
DCN401 currently has an issue re-enabling when pipe splitting is enabled,
while the root cause is being investigated we can make sure everything is
being reset as a workaround, by disabling boot optimization.

[How]
 - use enable_accelerated_mode instead of init_pipes to fully reset asic

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Joshua Aberback <joshua.aberback@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Prevent overflow on DTO calculation
Chris Park [Tue, 28 May 2024 01:21:30 +0000 (21:21 -0400)]
drm/amd/display: Prevent overflow on DTO calculation

[Why]
uint32_t is implicitly converted to uint64_t while multiplication
still happens on uint32_t side.  This creates digit overflow
for large pixel clock which is meant to be retained in uint64_t.

[How]
Calculate multiplication of units in uint64_t domain instead of
uint32_t in DTO parameter clock caculation.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Chris Park <chris.park@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: DCN401 cusor code update
Sridevi Arvindekar [Mon, 27 May 2024 15:26:58 +0000 (11:26 -0400)]
drm/amd/display: DCN401 cusor code update

Scaling and rotation changes for cursor.

Reviewed-by: Ariel Bernstein <eric.bernstein@amd.com>
Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Sridevi Arvindekar <sarvinde@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Use the SPDX license identifier for dmub_replay files
Rodrigo Siqueira [Mon, 27 May 2024 19:57:52 +0000 (13:57 -0600)]
drm/amd/display: Use the SPDX license identifier for dmub_replay files

Use the SPDX format for dmub_replay.c|.h files.

Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Remove duplicate 'update_idle_uclk' in dcn401 clk_mgr code
Ivan Lipski [Mon, 27 May 2024 17:28:44 +0000 (13:28 -0400)]
drm/amd/display: Remove duplicate 'update_idle_uclk' in dcn401 clk_mgr code

[WHY]
The coverity analysis flagged this if expression as it contains a
'CONSTANT_EXPRESSION_RESULT': 'update_idle_uclk' is 'ORd' with itself.

[HOW]
Removed the duplicate 'update_idle_uclk'.

Reviewed-by: Alex Hung <alex.hung@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Ignore UHBR13.5 cable ID cap for passive cable max link rate
George Shen [Thu, 23 May 2024 20:01:21 +0000 (16:01 -0400)]
drm/amd/display: Ignore UHBR13.5 cable ID cap for passive cable max link rate

[Why]
Passive DP40 cables were updated in the latest DP spec to support
UHBR13.5 link rate. Current max link rate logic checks against the
cable ID DPCD even for passive cables.

[How]
Ignore UHBR13.5 cable ID DPCD cap in get_max_link_rate logic.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add config support entry to replay caps debugfs
Roman Li [Thu, 23 May 2024 21:48:27 +0000 (17:48 -0400)]
drm/amd/display: Add config support entry to replay caps debugfs

[Why]
replay_capability debugfs tells whether sink and driver support
replay feature. However replay enablement also depends on
whether it is enabled/disabled via amdgpu module params.

[How]
Add 'Config support' entry to output current replay config.

Reviewed-by: ChiaHsuan Chung <chiahsuan.chung@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Roman Li <roman.li@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine gfx7 firmware loading
Yang Wang [Fri, 31 May 2024 06:10:58 +0000 (14:10 +0800)]
drm/amdgpu: refine gfx7 firmware loading

refine gfx7 firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: added NULL check at start of dc_validate_stream
winstang [Mon, 27 May 2024 12:51:19 +0000 (08:51 -0400)]
drm/amd/display: added NULL check at start of dc_validate_stream

[Why]
prevent invalid memory access

[How]
check if dc and stream are NULL

Co-authored-by: winstang <winstang@amd.com>
Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: winstang <winstang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdkfd: Extend gfx12 trap handler fix to gfx10/11
Jay Cornwall [Wed, 5 Jun 2024 19:27:49 +0000 (14:27 -0500)]
drm/amdkfd: Extend gfx12 trap handler fix to gfx10/11

In commit fda812ebe3d9 ("drm/amdkfd: gfx12 context save/restore trap handler fixes")
the following fix was introduced but incorrectly restricted to gfx12.
The same issue and a corresponding fix apply to gfx10 and gfx11.

Do not overwrite TRAPSTS.{SAVECTX,HOST_TRAP} when restoring this
register. Both of these fields can assert while the wavefront is
running the trap handler.

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Reviewed-by: Lancelot Six <lancelot.six@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: [FW Promotion] Release 0.0.220.0
Anthony Koo [Sat, 25 May 2024 19:24:59 +0000 (15:24 -0400)]
drm/amd/display: [FW Promotion] Release 0.0.220.0

 - Change ordering of structs to put enums together
 - Add new define DMUB_TRACE_ENTRY_DEFINED to guard
   the trace code enum

Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Anthony Koo <anthony.koo@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add sequential ONO sequencing for DCN35
Nicholas Kazlauskas [Thu, 23 May 2024 15:53:27 +0000 (11:53 -0400)]
drm/amd/display: Add sequential ONO sequencing for DCN35

[Why]
Adds support for performing the sequential ONO changes from DCN351
into DCN35 ASIC based on revision.

[How]
Check the revision and run the DCN351 sequences on applicable revisions.

Reviewed-by: Sung joon Kim <sungjoon.kim@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Ignore phantom DTBCLK requirement
Alvin Lee [Wed, 22 May 2024 15:10:58 +0000 (11:10 -0400)]
drm/amd/display: Ignore phantom DTBCLK requirement

[Description]
Phantom DTBCLK can be calculated different from main because phantom
has no DSC and thus will have a different output BPP. Ignore phantom
DTBCLK requirement and only consider non-phantom DTBCLK requirements.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Add fallback defaults for invalid LTTPR DPCD caps
Michael Strauss [Tue, 21 May 2024 18:52:37 +0000 (14:52 -0400)]
drm/amd/display: Add fallback defaults for invalid LTTPR DPCD caps

[WHY]
Some sinks are observed to return invalid LTTPR revision and/or invalid
LTTPR link rate capabilities.

[HOW]
Assume any LTTPR which reports invalid max link rate supports HBR3.
Don't validate LTTPR DPCD revision in dp_is_lttpr_present check.

Reviewed-by: George Shen <george.shen@amd.com>
Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Update FIXED_VS retimer training pattern delay
Michael Strauss [Thu, 9 May 2024 19:38:05 +0000 (15:38 -0400)]
drm/amd/display: Update FIXED_VS retimer training pattern delay

[WHY]
Needed for PHY patterns as well to perform electrical compliance.
Also need to increase wait time from 30ms to 50ms to resolve very
intermittent UHBR20 link training failures.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Michael Strauss <michael.strauss@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: reduce ODM slice count to initial new dc state only when needed
Wenjing Liu [Tue, 21 May 2024 21:05:41 +0000 (17:05 -0400)]
drm/amd/display: reduce ODM slice count to initial new dc state only when needed

[why]
We need to decrease ODM slice when adding or removing planes because MPO
support takes precedence over dynamic ODM combine. However there is a case where
we remove ODM combine even for ODM combine required timing in the initial new
dc state. This is normally okay because ODM will be added back after we pass DML
bandwidth validation. However since we remove ODM combine in the initial new
state, the previous ODM pipe allocation is lost. This may cause the new plane to
take away the original secondary OPP head pipe that is still required in the new
state.

For a timing that requires ODM 2:1 but optimized with ODM 4:1, if we add an MPO
plane, we will not have enough pipe to preserve ODM 4:1. In this case we should
reduce ODM slice count then try to add the MPO plane again. By reducing, we are
gradually remove 1 ODM slice from right most side one at a time until we have
enough free pipes for the new plane. If we remove ODM combine entirely, we could
use the pipe at ODM slice index 1 as a DPP pipe for the new plane. But ODM slice
1 is still needed as the timing requires ODM 2:1. This transition is not
seamless and user will see corruption on the screen.

[how]
Remove single ODM slice one at time until we have enough pipes for a new plane.
Remove previous logic to always remove ODM combine entirely.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Fix multiple cursors when using 4 displays on a contiguous large...
Nevenko Stupar [Wed, 22 May 2024 22:13:51 +0000 (18:13 -0400)]
drm/amd/display: Fix multiple cursors when using 4 displays on a contiguous large surface

[Why & How]
Remove some cursor offset calculations for rotated cursor for fixing a bug where multiple cursors are seen.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Nevenko Stupar <nevenko.stupar@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Return after Init
Daniel Sa [Thu, 23 May 2024 12:58:31 +0000 (08:58 -0400)]
drm/amd/display: Return after Init

why:
DML21 being overwritten after init.

how:
After initializing, early return.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Daniel Sa <daniel.sa@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Change AVI Info Frame version to 4 for OVT
Chris Park [Wed, 22 May 2024 16:20:29 +0000 (12:20 -0400)]
drm/amd/display: Change AVI Info Frame version to 4 for OVT

[Why]
Official Release CTA specification reverted the change and
no longer uses version 5 to indicate OVT timing.

[How]
Change the version used for AVI info Frame for OVT to 4.

Reviewed-by: Leo Ma <hanghong.ma@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Chris Park <chris.park@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove NULL assignment for stream_status
Alvin Lee [Wed, 22 May 2024 19:59:45 +0000 (15:59 -0400)]
drm/amd/display: Remove NULL assignment for stream_status

[Description]
No need to assign stream_status NULL because it is always
re-assigned before usage. This change is to fix coverity
errors.

Reviewed-by: Nicholas Choi <nicholas.choi@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Remove dcn32_smu13 duplicate header
Zaeem Mohamed [Tue, 28 May 2024 23:09:01 +0000 (19:09 -0400)]
drm/amd/display: Remove dcn32_smu13 duplicate header

[WHY]
Duplicate headers requiring unecessary maintenance of both headers

[HOW]
Removal of smu13_driver_if header and all referneces to it changed to dcn32_smu13_driver

Signed-off-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove redundant ternary operation
Ivan Lipski [Fri, 31 May 2024 20:05:27 +0000 (16:05 -0400)]
drm/amd/display: Remove redundant ternary operation

[WHY]
Coverity analysis flagged this ternary operation as
DEADCODE.

Since 'total_y_free_entry' is initialized as 0x200 and
'total_c_free_entry' is initialized as 0x140, and they
never change values before the ternary operator, so
'total_y_free_entry' is always greater 'total_c_free_entry',
'so small_free_entry' is always set to 'total_c_free_entry'.

[HOW]
Replace the ternary operator with the variable declaration.

Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove unreachable check
Ivan Lipski [Fri, 31 May 2024 20:31:02 +0000 (16:31 -0400)]
drm/amd/display: Remove unreachable check

[WHY]
Coverity analysis flagged this code as DEADCODE
since the condition and return in the outer loop
are never reached.

All operations with the 'dwb_pipe' variable happen
in the inner loop, that already contains the same
check with the 'MAX_DWB_PIPES'. The later
check condition cannot occur before the check
condition in the inner loop, thus the later
condition is unreacable.

[HOW]
Remove the unreachable condition.

Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove redundant if conditions
Ivan Lipski [Fri, 31 May 2024 18:48:41 +0000 (14:48 -0400)]
drm/amd/display: Remove redundant if conditions

[WHY]
Coverity analysis flagged the two if conditions in
dcn30_dpp.c and dcn401_dpp.c as DEADCODE since they
are never true, since the variable
'program_prealpha_dealpha' is initialized at 0 and
never chagnes.

[HOW]
Removed the variable 'program_prealpha_dealpha' and
the if conditions.

Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: add odm_slice_rect parameter in spl_in
Wenjing Liu [Thu, 25 Apr 2024 16:01:34 +0000 (12:01 -0400)]
drm/amd/display: add odm_slice_rect parameter in spl_in

[why]
OPP input rect aka odm slice rect is a hardware dependent parameter that
can't be determined by SPL software logic. Therefore we need to
explicitly pass odm slice rect in. So ODM slice rect calculation is
moved out of SPL.

[how]
add odm_slice_rect parameter in spl_in

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@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>
12 months agodrm/amd/display: use even ODM slice width for two pixels per container
Wenjing Liu [Wed, 17 Apr 2024 19:23:08 +0000 (15:23 -0400)]
drm/amd/display: use even ODM slice width for two pixels per container

[why]
When optc uses two pixel per container, each ODM slice width must be an
even number.

[how]
If ODM slice width is odd number increase it by 1.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@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>
12 months agodrm/amd/display: Fix Replay Desync Error Test
Dennis Chan [Tue, 2 Apr 2024 02:58:01 +0000 (10:58 +0800)]
drm/amd/display: Fix Replay Desync Error Test

When PHY power off, the DP_SEC_CNTL cannot be configured and cause
disable Adaptive sync SDP failed. Regarding the issue, the driver will
disabled AS-SDP in replay state machine.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dennis Chan <dennis.chan@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Replay + IPS + ABM in Full Screen VPB
ChunTao Tso [Mon, 8 Jan 2024 05:46:59 +0000 (13:46 +0800)]
drm/amd/display: Replay + IPS + ABM in Full Screen VPB

[Why]
Because ABM will wait VStart to start getting histogram data, it will
cause we can't enter IPS while full screnn video playing.

[How]
Modify the panel refresh rate to the maximun multiple of current refresh
rate

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: ChunTao Tso <ChunTao.Tso@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Expand supported Replay residency mode
Leon Huang [Mon, 4 Mar 2024 08:52:25 +0000 (16:52 +0800)]
drm/amd/display: Expand supported Replay residency mode

[Why]
Dmub provides several Replay residency calculation methods, but current
interface only supports either ALPM or PHY mode

[How]
Modify the interface for supporting different types of Replay residency
calculation.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Leon Huang <Leon.Huang1@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Replay low hz
ChunTao Tso [Tue, 20 Feb 2024 09:08:39 +0000 (17:08 +0800)]
drm/amd/display: Replay low hz

[Why]
The original coasting vtotal is 2 bytes, and it need to be amended to 4
bytes because low hz case.

[How]
Amend coasting vtotal from 2 bytes to 4 bytes.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: ChunTao Tso <ChunTao.Tso@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Use TPS3 for ALPM on Specific Panel
pochchan [Thu, 1 Dec 2022 05:27:49 +0000 (13:27 +0800)]
drm/amd/display: Use TPS3 for ALPM on Specific Panel

For some specific panel, it need to use TPS3 rather than use TP2 in ALPM
when DSC is enabled.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: pochchan <pochchan@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Wake DMCUB before sending a command for replay feature
Nicholas Kazlauskas [Mon, 4 Dec 2023 21:35:04 +0000 (16:35 -0500)]
drm/amd/display: Wake DMCUB before sending a command for replay feature

[Why]
We can hang in place trying to send commands when the DMCUB isn't
powered on.

[How]
For functions that execute within a DC context or DC lock we can wrap
the direct calls to dm_execute_dmub_cmd/list with code that exits idle
power optimizations and reallows once we're done with the command
submission on success.

For DM direct submissions the DM will need to manage the enter/exit
sequencing manually.

We cannot invoke a DMCUB command directly within the DM execution helper
or we can deadlock.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Don't use fsleep for PSR exit waits on dmub replay
Nicholas Kazlauskas [Wed, 27 Sep 2023 19:06:41 +0000 (15:06 -0400)]
drm/amd/display: Don't use fsleep for PSR exit waits on dmub replay

[Why]
These functions can be called from high IRQ levels and the OS will hang
if it tries to use a usleep_highres or a msleep.

[How]
Replace the flseep with a udelay for dmub_replay_enable.

Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: revert "take runtime pm reference when we attach a buffer" v2
Christian König [Wed, 5 Jun 2024 11:27:20 +0000 (13:27 +0200)]
drm/amdgpu: revert "take runtime pm reference when we attach a buffer" v2

This reverts commit b8c415e3bf98 ("drm/amdgpu: take runtime pm reference
when we attach a buffer") and commit 425285d39afd ("drm/amdgpu: add amdgpu
runpm usage trace for separate funcs").

Taking a runtime pm reference for DMA-buf is actually completely
unnecessary and even dangerous.

The problem is that calling pm_runtime_get_sync() from the DMA-buf
callbacks is illegal because we have the reservation locked here
which is also taken during resume. So this would deadlock.

When the buffer is in GTT it is still accessible even when the GPU
is powered down and when it is in VRAM the buffer gets migrated to
GTT before powering down.

The only use case which would make it mandatory to keep the runtime
pm reference would be if we pin the buffer into VRAM, and that's not
something we currently do.

v2: improve the commit message

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
12 months agodrm/amd/display: Use dc wake for get the replay state
Rodrigo Siqueira [Tue, 28 May 2024 17:10:55 +0000 (11:10 -0600)]
drm/amd/display: Use dc wake for get the replay state

Use dc_wake_and_execute_gpint with DM_DMUB_WAIT_TYPE_WAIT_WITH_REPLY to
get the replay state.

Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine imu firmware loading
Yang Wang [Thu, 30 May 2024 15:15:01 +0000 (23:15 +0800)]
drm/amdgpu: refine imu firmware loading

refine imu firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine pmfw/smu firmware loading
Yang Wang [Thu, 30 May 2024 15:21:51 +0000 (23:21 +0800)]
drm/amdgpu: refine pmfw/smu firmware loading

refine pmfw/smu firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine gmc firmware loading
Yang Wang [Thu, 30 May 2024 15:28:35 +0000 (23:28 +0800)]
drm/amdgpu: refine gmc firmware loading

refine gmc firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine vpe firmware loading
Yang Wang [Thu, 30 May 2024 15:34:26 +0000 (23:34 +0800)]
drm/amdgpu: refine vpe firmware loading

refine vpe firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine vcn firmware loading
Yang Wang [Thu, 30 May 2024 15:33:27 +0000 (23:33 +0800)]
drm/amdgpu: refine vcn firmware loading

refine vcn firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: move aca/mca init functions into ras_init() stage
Yang Wang [Tue, 4 Jun 2024 08:30:41 +0000 (16:30 +0800)]
drm/amdgpu: move aca/mca init functions into ras_init() stage

adjust the function position to better match aca/mca fini code in ras_fini().

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix overflowed constant warning in mmhub_set_clockgating()
Bob Zhou [Fri, 7 Jun 2024 08:33:35 +0000 (16:33 +0800)]
drm/amdgpu: fix overflowed constant warning in mmhub_set_clockgating()

To fix potential overflowed constant warning, modify the variables to u32
for getting the return value of RREG32_SOC15().

Signed-off-by: Bob Zhou <bob.zhou@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Indicate CU havest info to CP
Harish Kasiviswanathan [Wed, 5 Jun 2024 13:30:50 +0000 (09:30 -0400)]
drm/amdgpu: Indicate CU havest info to CP

To achieve full occupancy CP hardware needs to know if CUs in SE are
symmetrically or asymmetrically harvested

v2: Reset is_symmetric_cus for each loop

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Skip coredump during resets for debug
Lijo Lazar [Fri, 31 May 2024 12:28:54 +0000 (17:58 +0530)]
drm/amdgpu: Skip coredump during resets for debug

Skip scheduling coredump when gpu reset is intentionally triggered
through debugfs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine sdma firmware loading
Yang Wang [Thu, 30 May 2024 15:09:42 +0000 (23:09 +0800)]
drm/amdgpu: refine sdma firmware loading

refine sdma firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine psp firmware loading
Yang Wang [Thu, 30 May 2024 14:56:16 +0000 (22:56 +0800)]
drm/amdgpu: refine psp firmware loading

refine psp firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add lock in kfd_process_dequeue_from_device
Yunxiang Li [Mon, 3 Jun 2024 16:29:30 +0000 (12:29 -0400)]
drm/amdgpu: add lock in kfd_process_dequeue_from_device

We need to take the reset domain lock before talking to MES. While in
this case we can take the lock inside the mes helper. We can't do so for
most other mes helpers since they are used during reset. So for
consistency sake we add the lock here.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine mes firmware loading
Yang Wang [Thu, 30 May 2024 14:51:03 +0000 (22:51 +0800)]
drm/amdgpu: refine mes firmware loading

v1:
refine mes firmware loading

v2:
use dev_info instead of DRM_INFO

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Add missing locking for MES API calls
Mukul Joshi [Wed, 5 Jun 2024 22:48:55 +0000 (18:48 -0400)]
drm/amdgpu: Add missing locking for MES API calls

Add missing locking at a few places when calling MES APIs to ensure
exclusive access to MES queue.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Kent Russell <kent.russell@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Set default brightness according to ACPI
Mario Limonciello [Fri, 7 Jun 2024 06:02:28 +0000 (01:02 -0500)]
drm/amd/display: Set default brightness according to ACPI

Currently, amdgpu will always set up the brightness at 100% when it
loads.  However this is jarring when the BIOS has it previously
programmed to a much lower value.

The ACPI ATIF method includes two members for "ac_level" and "dc_level".
These represent the default values that should be used if the system is
brought up in AC and DC respectively.

Use these values to set up the default brightness when the backlight
device is registered.

v2: squash in ACPI fix

Reviewed-by: Leo Li <sunpeng.li@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: drop some kernel messages in VCN code
David (Ming Qiang) Wu [Thu, 30 May 2024 14:50:59 +0000 (10:50 -0400)]
drm/amdgpu: drop some kernel messages in VCN code

Similar to commit 813e7d4cd05e where some kernel log
messages are dropped. With this commit, more log
messages in older version of VCN/JPEG code are dropped.

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>
12 months agoRevert "drm/amd/display: Add NULL check for 'afb' before dereferencing in amdgpu_dm_p...
Ivan Lipski [Fri, 7 Jun 2024 16:33:59 +0000 (12:33 -0400)]
Revert "drm/amd/display: Add NULL check for 'afb' before dereferencing in amdgpu_dm_plane_handle_cursor_update"

[WHY]
This patch is a dupplicate implementation of 14bcf29b, which we
are reverting due to a regression with kms_plane_cursor IGT tests.

This reverts commit 38e6f715b02b572f74677eb2f29d3b4bc6f1ddff.

Reviewed-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Tested-by: George Zhang <George.zhang@amd.com>
Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoRevert "drm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor"
Ivan Lipski [Fri, 7 Jun 2024 16:33:58 +0000 (12:33 -0400)]
Revert "drm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor"

[WHY]
This commit introduced a regression with kms_plane_cursor IGT
tests, causing AMD Asics to fail these tests.

This reverts commit ce66ffd9813c8bd73e21b96d6476e5fb32b727c7.

Reviewed-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Tested-by: George Zhang <George.zhang@amd.com>
Signed-off-by: Ivan Lipski <ivlipski@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: refine gpu_info firmware loading
Yang Wang [Thu, 30 May 2024 14:47:19 +0000 (22:47 +0800)]
drm/amdgpu: refine gpu_info firmware loading

refine gpu_info firmware loading

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: prevent register access while in IPS
Hamza Mahfooz [Mon, 3 Jun 2024 14:16:45 +0000 (10:16 -0400)]
drm/amd/display: prevent register access while in IPS

We can't read/write to DCN registers while in IPS. Since, that can cause
the system to hang. So, before proceeding with the access in that
scenario, force the system out of IPS.

Cc: stable@vger.kernel.org # 6.6+
Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: enhance amdgpu_ucode_request() function flexibility
Yang Wang [Thu, 30 May 2024 14:11:01 +0000 (22:11 +0800)]
drm/amdgpu: enhance amdgpu_ucode_request() function flexibility

v1:
Adding formatting string feature to improve function flexibility.

v2:
modify macro name to ADMGPU_UCODE_MAX_NAME.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix the overflowed constant warning for RREG32_SOC15()
Bob Zhou [Tue, 4 Jun 2024 07:08:29 +0000 (15:08 +0800)]
drm/amdgpu: fix the overflowed constant warning for RREG32_SOC15()

To fix potential overflowed constant warning reported by Coverity,
modify the variables to uint32_t.

Signed-off-by: Bob Zhou <bob.zhou@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add lock in amdgpu_gart_invalidate_tlb
Yunxiang Li [Fri, 24 May 2024 21:11:30 +0000 (17:11 -0400)]
drm/amdgpu: add lock in amdgpu_gart_invalidate_tlb

We need to take the reset domain lock before flush hdp. We can't put the
lock inside amdgpu_device_flush_hdp itself because it is used during
reset where we already take the write side lock.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix locking scope when flushing tlb
Yunxiang Li [Thu, 23 May 2024 11:48:19 +0000 (07:48 -0400)]
drm/amdgpu: fix locking scope when flushing tlb

Which method is used to flush tlb does not depend on whether a reset is
in progress or not. We should skip flush altogether if the GPU will get
reset. So put both path under reset_domain read lock.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
12 months agodrm/amdgpu: call flush_gpu_tlb directly in gfxhub enable
Yunxiang Li [Tue, 4 Jun 2024 16:56:56 +0000 (12:56 -0400)]
drm/amdgpu: call flush_gpu_tlb directly in gfxhub enable

Here since we are in reset and takes the reset_domain write side lock
already. We can't use the flush tlb helper which tries to take the read
side.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: use helper in amdgpu_gart_unbind
Yunxiang Li [Fri, 17 May 2024 16:53:30 +0000 (12:53 -0400)]
drm/amdgpu: use helper in amdgpu_gart_unbind

When amdgpu_gart_invalidate_tlb helper is introduced this part was left
out of the conversion. Avoid the code duplication here.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover
Yunxiang Li [Wed, 22 May 2024 15:00:08 +0000 (11:00 -0400)]
drm/amdgpu: remove tlb flush in amdgpu_gtt_mgr_recover

At this point the gart is not set up, there's no point to invalidate tlb
here and it could even be harmful.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu/kfd: remove is_hws_hang and is_resetting
Yunxiang Li [Fri, 24 May 2024 17:46:50 +0000 (13:46 -0400)]
drm/amdgpu/kfd: remove is_hws_hang and is_resetting

is_hws_hang and is_resetting serves pretty much the same purpose and
they all duplicates the work of the reset_domain lock, just check that
directly instead. This also eliminate a few bugs listed below and get
rid of dqm->ops.pre_reset.

kfd_hws_hang did not need to avoid scheduling another reset. If the
on-going reset decided to skip GPU reset we have a bad time, otherwise
the extra reset will get cancelled anyway.

remove_queue_mes forgot to check is_resetting flag compared to the
pre-MES path unmap_queue_cpsch, so it did not block hw access during
reset correctly.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix sriov host flr handler
Yunxiang Li [Fri, 24 May 2024 20:22:28 +0000 (16:22 -0400)]
drm/amdgpu: fix sriov host flr handler

We send back the ready to reset message before we stop anything. This is
wrong. Move it to when we are actually ready for the FLR to happen.

In the current state since we take tens of seconds to stop everything,
it is very likely that host would give up waiting and reset the GPU
before we send ready, so it would be the same as before. But this gets
rid of the hack with reset_domain locking and also let us tell how slow
ready to reset actually is from the host. The ready to reset speed can
be improved later.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add skip_hw_access checks for sriov
Yunxiang Li [Fri, 24 May 2024 20:14:55 +0000 (16:14 -0400)]
drm/amdgpu: add skip_hw_access checks for sriov

Accessing registers via host is missing the check for skip_hw_access and
the lockdep check that comes with it.

Signed-off-by: Yunxiang Li <Yunxiang.Li@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add reset source in various cases
Eric Huang [Tue, 4 Jun 2024 15:46:56 +0000 (11:46 -0400)]
drm/amdgpu: add reset source in various cases

To fullfill the reset event description.

Suggested-by: Lijo Lazar <Lijo.Lazar@amd.com>
Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix NULL pointer in amdgpu_reset_get_desc
Eric Huang [Thu, 6 Jun 2024 15:37:20 +0000 (11:37 -0400)]
drm/amdgpu: fix NULL pointer in amdgpu_reset_get_desc

amdgpu_job_ring may return NULL, which causes kernel NULL
pointer error, using another way to print ring name instead
of ring->name.

Suggested-by: Lijo Lazar <Lijo.Lazar@amd.com>
Signed-off-by: Eric Huang <jinhuieric.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: dc 3.2.287
Aric Cyr [Sun, 26 May 2024 22:59:15 +0000 (18:59 -0400)]
drm/amd/display: dc 3.2.287

This version brings the following changes:
- Add sequential ONO sequencing for DCN35
- Add new GPINT command definitions
- reduce ODM slice count to initial new dc state only when needed
- Enable copying of bounding box data from VBIOS DMUB
- Guard reading 3DLUT registers for dcn32/dcn35

Reviewed-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Fix DSC slice and delay calculations
Sung Joon Kim [Fri, 10 May 2024 16:18:31 +0000 (12:18 -0400)]
drm/amd/display: Fix DSC slice and delay calculations

[why]
There are other factors that determine the number
of DSC slices. The slices should not be determined
in DML but retrieve the value calculated from driver.

[how]
Update the logic to determine DSC slice.
Make DSCDelay per display pipe.

Reviewed-by: Jun Lei <jun.lei@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Sung Joon Kim <sungjoon.kim@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Increase MAX_LINKS by 2
Alex Hung [Wed, 15 May 2024 16:04:24 +0000 (10:04 -0600)]
drm/amd/display: Increase MAX_LINKS by 2

Two additional virtual links are created and thus increasing size
for dc->links by two.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: Guard reading 3DLUT registers for dcn32/dcn35
Nicholas Kazlauskas [Tue, 21 May 2024 14:41:52 +0000 (10:41 -0400)]
drm/amd/display: Guard reading 3DLUT registers for dcn32/dcn35

[Why]
3DLUT is not part of the DPP on DCN32/DCN35 ASIC and these registers
now exist in MCM state.

[How]
Add guards when reading DPP state based on whether the register has a
valid offset.

Reviewed-by: Sung joon Kim <sungjoon.kim@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Various DML2 fixes for FAMS2
Dillon Varone [Mon, 20 May 2024 15:12:07 +0000 (11:12 -0400)]
drm/amd/display: Various DML2 fixes for FAMS2

- Ensure SubVP stream settings match ODM policy
- Fix MALL size calculations when DCC is enabled
- Fail if any stream fails DRR policy check

Reviewed-by: Chaitanya Dhere <chaitanya.dhere@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Program DIG FE source select for DVI before PHY en
Alvin Lee [Mon, 20 May 2024 16:52:31 +0000 (12:52 -0400)]
drm/amd/display: Program DIG FE source select for DVI before PHY en

[Description]
In newer DCN's the programming of SYMCLK_FE_SRC_SEL depends on
the value of DIG_FE_SOURCE_SELECT. If DIG_FE_SOURCE_SELECT is not
already programmed at the time of PHY / DIG enable then the FW
sequence will program an incorrect SYMCLK source. Ensure that we
program DIG_FE_SOURCE_SELECT for all DIO scenarios (DVI in this
particular case) before going through the PHY / DIG enable sequence.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/pm: remove dead code in navi10_emit_clk_levels and navi10_print_clk_levels
Jesse Zhang [Mon, 3 Jun 2024 05:16:36 +0000 (13:16 +0800)]
drm/amd/pm: remove dead code in navi10_emit_clk_levels and navi10_print_clk_levels

Since the range of the varibable i is 0 - 3.
So execution cannot reach this statement: default.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: remove dead code in atom_get_src_int
Jesse Zhang [Wed, 5 Jun 2024 07:44:38 +0000 (15:44 +0800)]
drm/amdgpu: remove dead code in atom_get_src_int

Since the range of align is 0~7, the expression is: align = (attr >> 3) & 7.
In the case of ATOM_ARG_IMM, the code cannot reach the default case.
So there is no need for "break".

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Suggested-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Introduce deferred Replay coasting vtotal update
ChunTao Tso [Mon, 13 May 2024 05:48:19 +0000 (13:48 +0800)]
drm/amd/display: Introduce deferred Replay coasting vtotal update

Add functions to defer updating of coasting vtotal after source refresh rate update.

Reviewed-by: Robin Chen <robin.chen@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: ChunTao Tso <chuntao.tso@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add NULL check for 'afb' before dereferencing in amdgpu_dm_plane_han...
Srinivasan Shanmugam [Wed, 5 Jun 2024 15:43:40 +0000 (21:13 +0530)]
drm/amd/display: Add NULL check for 'afb' before dereferencing in amdgpu_dm_plane_handle_cursor_update

This commit adds a null check for the 'afb' variable in the
amdgpu_dm_plane_handle_cursor_update function. Previously, 'afb' was
assumed to be null, but was used later in the code without a null check.
This could potentially lead to a null pointer dereference.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm_plane.c:1298 amdgpu_dm_plane_handle_cursor_update() error: we previously assumed 'afb' could be null (see line 1252)

Cc: Tom Chung <chiahsuan.chung@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>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor
Srinivasan Shanmugam [Wed, 5 Jun 2024 11:12:48 +0000 (16:42 +0530)]
drm/amd/display: Add null check for 'afb' in amdgpu_dm_update_cursor

This commit adds a null check for the 'afb' variable in the
amdgpu_dm_update_cursor function. Previously, 'afb' was assumed to be
null at line 8388, but was used later in the code without a null check.
This could potentially lead to a null pointer dereference.

Fixes the below:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:8433 amdgpu_dm_update_cursor()
error: we previously assumed 'afb' could be null (see line 8388)

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c
    8379 static void amdgpu_dm_update_cursor(struct drm_plane *plane,
    8380                                     struct drm_plane_state *old_plane_state,
    8381                                     struct dc_stream_update *update)
    8382 {
    8383         struct amdgpu_device *adev = drm_to_adev(plane->dev);
    8384         struct amdgpu_framebuffer *afb = to_amdgpu_framebuffer(plane->state->fb);
    8385         struct drm_crtc *crtc = afb ? plane->state->crtc : old_plane_state->crtc;
                                         ^^^^^

    8386         struct dm_crtc_state *crtc_state = crtc ? to_dm_crtc_state(crtc->state) : NULL;
    8387         struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc);
    8388         uint64_t address = afb ? afb->address : 0;
                                    ^^^^^ Checks for NULL

    8389         struct dc_cursor_position position = {0};
    8390         struct dc_cursor_attributes attributes;
    8391         int ret;
    8392
    8393         if (!plane->state->fb && !old_plane_state->fb)
    8394                 return;
    8395
    8396         drm_dbg_atomic(plane->dev, "crtc_id=%d with size %d to %d\n",
    8397                        amdgpu_crtc->crtc_id, plane->state->crtc_w,
    8398                        plane->state->crtc_h);
    8399
    8400         ret = amdgpu_dm_plane_get_cursor_position(plane, crtc, &position);
    8401         if (ret)
    8402                 return;
    8403
    8404         if (!position.enable) {
    8405                 /* turn off cursor */
    8406                 if (crtc_state && crtc_state->stream) {
    8407                         dc_stream_set_cursor_position(crtc_state->stream,
    8408                                                       &position);
    8409                         update->cursor_position = &crtc_state->stream->cursor_position;
    8410                 }
    8411                 return;
    8412         }
    8413
    8414         amdgpu_crtc->cursor_width = plane->state->crtc_w;
    8415         amdgpu_crtc->cursor_height = plane->state->crtc_h;
    8416
    8417         memset(&attributes, 0, sizeof(attributes));
    8418         attributes.address.high_part = upper_32_bits(address);
    8419         attributes.address.low_part  = lower_32_bits(address);
    8420         attributes.width             = plane->state->crtc_w;
    8421         attributes.height            = plane->state->crtc_h;
    8422         attributes.color_format      = CURSOR_MODE_COLOR_PRE_MULTIPLIED_ALPHA;
    8423         attributes.rotation_angle    = 0;
    8424         attributes.attribute_flags.value = 0;
    8425
    8426         /* Enable cursor degamma ROM on DCN3+ for implicit sRGB degamma in DRM
    8427          * legacy gamma setup.
    8428          */
    8429         if (crtc_state->cm_is_degamma_srgb &&
    8430             adev->dm.dc->caps.color.dpp.gamma_corr)
    8431                 attributes.attribute_flags.bits.ENABLE_CURSOR_DEGAMMA = 1;
    8432
--> 8433         attributes.pitch = afb->base.pitches[0] / afb->base.format->cpp[0];
                                    ^^^^^                  ^^^^^
Unchecked dereferences

    8434
    8435         if (crtc_state->stream) {
    8436                 if (!dc_stream_set_cursor_attributes(crtc_state->stream,
    8437                                                      &attributes))
    8438                         DRM_ERROR("DC failed to set cursor attributes\n");
    8439
    8440                 update->cursor_attributes = &crtc_state->stream->cursor_attributes;
    8441
    8442                 if (!dc_stream_set_cursor_position(crtc_state->stream,
    8443                                                    &position))
    8444                         DRM_ERROR("DC failed to set cursor position\n");
    8445
    8446                 update->cursor_position = &crtc_state->stream->cursor_position;
    8447         }
    8448 }

Fixes: 66eba12a5482 ("drm/amd/display: Do cursor programming with rest of pipe")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Tom Chung <chiahsuan.chung@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>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add monitor patch skip disable crtc during psr and ips1
Lewis Huang [Fri, 17 May 2024 09:30:42 +0000 (17:30 +0800)]
drm/amd/display: Add monitor patch skip disable crtc during psr and ips1

[Why]
For some panel, it cannot handle pseudo vblank set by otg resync
when leave psr

[How]
The monitor patch will keep otg_on during enter IPS1.
And then we don't need to do otg resync when wake up.

Reviewed-by: Duncan Ma <duncan.ma@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Lewis Huang <lewis.huang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: add set ips disable
Chiawen Huang [Mon, 20 May 2024 03:17:42 +0000 (11:17 +0800)]
drm/amd/display: add set ips disable

[How&Why]
Once IPS active, all the DCN resources are
not be allowed to access.
It needs to a function for 3rd party to
on/off IPS.

Reviewed-by: Duncan Ma <duncan.ma@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Chiawen Huang <chiawen.huang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add recovery timeout to FAMS2
Dillon Varone [Fri, 17 May 2024 21:45:14 +0000 (17:45 -0400)]
drm/amd/display: Add recovery timeout to FAMS2

[WHY&HOW]
Add 5ms timeout to trigger recovery and force allow P-State in DMUB.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Force max clocks unconditionally when p-state is unsupported
Dillon Varone [Thu, 16 May 2024 02:48:10 +0000 (22:48 -0400)]
drm/amd/display: Force max clocks unconditionally when p-state is unsupported

[WHY&HOW]
UCLK and FCLK are updated together, so an FCLK update can also cause UCLK update
to SMU.  When this happens, the UCLK provided should be max if switching is
unsupported.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Dillon Varone <dillon.varone@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Change the order of setting DP_IS_USB_C flag
Wayne Lin [Tue, 14 May 2024 10:10:16 +0000 (18:10 +0800)]
drm/amd/display: Change the order of setting DP_IS_USB_C flag

[Why]
enc10->base.features.flags.bits.DP_IS_USB_C will be overwritten if we set it
before initializing enc10->base.features

[How]
Determine DP_IS_USB_C after enc10->base.features is initialized. Besides,
bp_cap_info.DP_IS_USB_C will never be set in get_connector_speed_cap_info().
Remove the redudant code.

Reviewed-by: Roman Li <roman.li@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@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>
12 months agodrm/amd/display: bypass ODM before CRTC off
Yihan Zhu [Fri, 17 May 2024 12:55:44 +0000 (08:55 -0400)]
drm/amd/display: bypass ODM before CRTC off

[WHY]
OPPs couldn't disconnect from the ODM that cause the double buffer pending not being latched due to missing VUPDATE.

[HOW]
Moving memory blanking before OTG turn off to make sure double buffer latched correctly.

Reviewed-by: Dmytro Laktyushkin <dmytro.laktyushkin@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Yihan Zhu <yihan.zhu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display/dcn401: use pre-allocated temp structure for bounding box
Alex Deucher [Tue, 4 Jun 2024 18:01:58 +0000 (14:01 -0400)]
drm/amd/display/dcn401: use pre-allocated temp structure for bounding box

This mirrors what the driver does for older DCN generations.

Should fix:
[   26.924055] BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
[   26.924060] in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 1022, name: modprobe
[   26.924063] preempt_count: 2, expected: 0
[   26.924064] RCU nest depth: 0, expected: 0
[   26.924066] Preemption disabled at:
[   26.924067] [<ffffffffc089e5e0>] dc_fpu_begin+0x30/0xd0 [amdgpu]
[   26.924322] CPU: 9 PID: 1022 Comm: modprobe Not tainted 6.8.0+ #20
[   26.924325] Hardware name: System manufacturer System Product Name/CROSSHAIR VI HERO, BIOS 6302 10/23/2018
[   26.924326] Call Trace:
[   26.924327]  <TASK>
[   26.924329]  dump_stack_lvl+0x37/0x50
[   26.924333]  ? dc_fpu_begin+0x30/0xd0 [amdgpu]
[   26.924589]  dump_stack+0x10/0x20
[   26.924592]  __might_resched+0x16a/0x1c0
[   26.924596]  __might_sleep+0x42/0x70
[   26.924598]  __kmalloc_node_track_caller+0x2ad/0x4b0
[   26.924601]  ? dm_helpers_allocate_gpu_mem+0x12/0x20 [amdgpu]
[   26.924855]  ? dcn401_update_bw_bounding_box+0x2a/0xf0 [amdgpu]
[   26.925122]  kmemdup+0x20/0x50
[   26.925124]  ? kernel_fpu_begin_mask+0x6b/0xe0
[   26.925127]  ? kmemdup+0x20/0x50
[   26.925129]  dcn401_update_bw_bounding_box+0x2a/0xf0 [amdgpu]
[   26.925393]  dc_create+0x311/0x670 [amdgpu]
[   26.925649]  amdgpu_dm_init+0x2aa/0x1fa0 [amdgpu]
[   26.925903]  ? irq_work_queue+0x38/0x50
[   26.925907]  ? vprintk_emit+0x1e7/0x270
[   26.925910]  ? dev_printk_emit+0x83/0xb0
[   26.925914]  ? amdgpu_device_rreg+0x17/0x20 [amdgpu]
[   26.926133]  dm_hw_init+0x14/0x30 [amdgpu]

v2: drop extra memcpy

Fixes: 669d6b078ed8 ("drm/amd/display: avoid large on-stack structures")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Suggested-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: George Zhang <george.zhang@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: harry.wentland@amd.com
Cc: sunpeng.li@amd.com
Cc: Rodrigo.Siqueira@amd.com
12 months agodrm/amd/display: use pre-allocated temp structure for bounding box
Alex Deucher [Tue, 4 Jun 2024 15:46:04 +0000 (11:46 -0400)]
drm/amd/display: use pre-allocated temp structure for bounding box

This mirrors what the driver does for older DCN generations.

Should fix:

BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 449, name: kworker/u64:8
preempt_count: 2, expected: 0
RCU nest depth: 0, expected: 0
Preemption disabled at:
ffffffffc0ce1580>] dc_fpu_begin+0x30/0xd0 [amdgpu]
CPU: 5 PID: 449 Comm: kworker/u64:8 Tainted: G        W          6.8.0+ #35
Hardware name: System manufacturer System Product Name/ROG STRIX X570-E GAMING WIFI II, BIOS 4204 02/24/2022
Workqueue: events_unbound async_run_entry_fn

v2: drop extra memcpy

Fixes: 88c61827cedc ("drm/amd/display: dynamically allocate dml2_configuration_options structures")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Tested-by: George Zhang <George.zhang@amd.com> (v1)
Suggested-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: George Zhang <george.zhang@amd.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: harry.wentland@amd.com
Cc: sunpeng.li@amd.com
Cc: Rodrigo.Siqueira@amd.com
12 months agodrm/amdgpu: add sdma 7.0 support for copy dcc buffer
Frank Min [Wed, 10 Apr 2024 13:40:16 +0000 (21:40 +0800)]
drm/amdgpu: add sdma 7.0 support for copy dcc buffer

1. Add dcc buffer flag for copy buffer
2. Add sdma 7.0 support copy dcc buffer

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Frank Min <Frank.Min@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: support for DCC feature
Likun Gao [Thu, 11 Jan 2024 08:44:55 +0000 (16:44 +0800)]
drm/amdgpu: support for DCC feature

Deal with AMDGPU_GEM_CREATE_GFX12_DCC to set DCC bit
when needed.

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>
12 months agodrm/amdgpu: add additional VM bits
Alex Deucher [Tue, 6 Feb 2024 21:03:17 +0000 (16:03 -0500)]
drm/amdgpu: add additional VM bits

Add additional VM PTE bits.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Simplify if conditions
Thorsten Blum [Tue, 4 Jun 2024 10:37:37 +0000 (12:37 +0200)]
drm/amd/display: Simplify if conditions

The if conditions !A || A && B can be simplified to !A || B.

Fixes the following Coccinelle/coccicheck warnings reported by
excluded_middle.cocci:

WARNING !A || A && B is equivalent to !A || B
WARNING !A || A && B is equivalent to !A || B
WARNING !A || A && B is equivalent to !A || B

Compile-tested only.

Signed-off-by: Thorsten Blum <thorsten.blum@toblux.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>