linux-block.git
12 months agodrm/amd/display: fix replay_mode kernel-doc warning
Randy Dunlap [Sun, 10 Sep 2023 23:44:50 +0000 (16:44 -0700)]
drm/amd/display: fix replay_mode kernel-doc warning

Fix the typo in the kernel-doc for @replay_mode to prevent
kernel-doc warnings:

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:623: warning: Incorrect use of kernel-doc format:          * @replay mode: Replay supported
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h:626: warning: Function parameter or member 'replay_mode' not described in 'amdgpu_hdmi_vsdb_info'

Fixes: ec8e59cb4e0c ("drm/amd/display: Get replay info from VSDB")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Reported-by: kernel test robot <lkp@intel.com>
Cc: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: clean up some inconsistent indenting
Jiapeng Chong [Fri, 8 Sep 2023 07:54:45 +0000 (15:54 +0800)]
drm/amd/display: clean up some inconsistent indenting

No functional modification involved.

drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dpms.c:2476 link_set_dpms_on() warn: if statement not indented.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6502
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: add skip_implict_edp_power_control flag for dcn32
Ian Chen [Tue, 29 Aug 2023 05:17:32 +0000 (13:17 +0800)]
drm/amd/display: add skip_implict_edp_power_control flag for dcn32

Add flag skip_implict_edp_power_control check in function
dcn32_disable_link_output to fix DCN35 issue.

Reviewed-by: Robin Chen <robin.chen@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Ian Chen <ian.chen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: minior logging improvements
Wenjing Liu [Thu, 24 Aug 2023 19:39:13 +0000 (15:39 -0400)]
drm/amd/display: minior logging improvements

[how]
- Add minimial transition log with reason and base state.
- Do not log set dpms interfaces for virtual signal in stream.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: do not skip ODM minimal transition based on new state
Wenjing Liu [Thu, 24 Aug 2023 18:21:11 +0000 (14:21 -0400)]
drm/amd/display: do not skip ODM minimal transition based on new state

[why]
During 8k video plane resizing we could transition from MPC combine mode
back to ODM combine 2:1 + 8k video plane. In this transition minimal
transition state is based on new state with ODM combine enabled.
We are skipping this and it causes corruption because we have to reassign
a current DPP pipe to a different MPC blending tree which is not supported
seamlessly.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: move odm power optimization decision after subvp optimization
Wenjing Liu [Thu, 24 Aug 2023 23:50:16 +0000 (19:50 -0400)]
drm/amd/display: move odm power optimization decision after subvp optimization

[why]
ODM power optimization excludes subvp power optimization but subvp
optimization can override ODM power optimization even if subvp optimization
configuration is not found. This happens with 4k144hz + 1 5k desktop plane.
We could have applied ODM power optimization however this is overridden by
subvp but subvp ends up deciding not apply its optimization.

[how]
Move ODM power optimization decision after subvp so it will try ODM power
optimization after subvp optimization is not possible.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: add seamless pipe topology transition check
Wenjing Liu [Thu, 24 Aug 2023 21:08:48 +0000 (17:08 -0400)]
drm/amd/display: add seamless pipe topology transition check

[why]
We have a few cases where we need to perform update topology update
in dc update interface. However some of the updates are not seamless
This could cause user noticible glitches. To enforce seamless transition
we are adding a checking condition and error logging so the corruption
as result of non seamless transition can be easily spotted.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: 3.2.250
Aric Cyr [Sun, 27 Aug 2023 19:07:35 +0000 (15:07 -0400)]
drm/amd/display: 3.2.250

Acked-by: Stylon Wang <stylon.wang@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 MST recognizes connected displays as one
Muhammad Ahmed [Wed, 23 Aug 2023 23:25:25 +0000 (19:25 -0400)]
drm/amd/display: Fix MST recognizes connected displays as one

[What]
MST now recognizes both connected displays

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Muhammad Ahmed <ahmed.ahmed@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 some non-initialized register mask and setting
Charlene Liu [Fri, 25 Aug 2023 19:04:46 +0000 (15:04 -0400)]
drm/amd/display: fix some non-initialized register mask and setting

[why]
fix some non-initialized register mask and update golden setting

Reviewed-by: Duncan Ma <duncan.ma@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Charlene Liu <charlene.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: Add check for vrr_active_fixed
Austin Zheng [Fri, 25 Aug 2023 14:51:49 +0000 (10:51 -0400)]
drm/amd/display: Add check for vrr_active_fixed

Why:
vrr_active_fixed should also be checked when
determining if DRR is in use

How:
Add check for vrr_active_fixed when allow_freesync
and vrr_active_variable are also checked

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Austin Zheng <austin.zheng@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: dc cleanup for tests
Sridevi Arvindekar [Thu, 24 Aug 2023 23:20:30 +0000 (19:20 -0400)]
drm/amd/display: dc cleanup for tests

[WHY&HOW]
Code cleanup found in internal tests

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Sridevi Arvindekar <Sridevi.Arvindekar@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add type conversion for gc info
Yifan Zhang [Wed, 6 Sep 2023 09:34:16 +0000 (17:34 +0800)]
drm/amdgpu: add type conversion for gc info

gc info usage misses type conversion.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Drop unused registers
Qingqing Zhuo [Wed, 2 Aug 2023 01:49:32 +0000 (21:49 -0400)]
drm/amd/display: Drop unused registers

[Why & How]
Some registers are never used in the driver
but defined. Remove them.

Reviewed-by: Roman Li <roman.li@amd.com>
Acked-by: Stylon Wang <stylon.wang@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>
12 months agodrm/amd/display: add dp dto programming function to dccg
Dillon Varone [Thu, 24 Aug 2023 16:19:21 +0000 (12:19 -0400)]
drm/amd/display: add dp dto programming function to dccg

[WHY&HOW]
Add support for programming dp dto via dccg.

Reviewed-by: Jun Lei <jun.lei@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: only allow ODM power optimization if surface is within guaranteed...
Wenjing Liu [Wed, 23 Aug 2023 17:26:35 +0000 (13:26 -0400)]
drm/amd/display: only allow ODM power optimization if surface is within guaranteed viewport size

[why]
Current dc update design has limitation to support transition from
ODM combine to minimum transition to MPC combine state seamlessly
at the capability boundary when MPO plane is resizing. This will
require dc update high level refactor in order to remove the design
limitation. The decision is to block such use case for existing products
by limiting ODM power optimization support for only those surfaces
within guaranteed viewport size. This will prevent us from transitioning
to MPC combine state when ODM power optimization is enabled.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: do not attempt ODM power optimization if minimal transition doesn...
Wenjing Liu [Wed, 23 Aug 2023 17:19:27 +0000 (13:19 -0400)]
drm/amd/display: do not attempt ODM power optimization if minimal transition doesn't exist

[why]
In some cases such as 8k desktop surface with 144Hz timing, we decide to
enable ODM power optimization but this surface doesn't have a minimum
transition state. Therefore we cannot switch off ODM power optimization seamlessly
This creates path depedency on ODM power optimization decision. i.e
whether or not we should switch off ODM power optimization is dependent
on if the transition to switch off ODM power optimization from current state
is seamless. We don't desire a path dependent power optimization policy
as it is too dynamic and difficult to maintain.

[how]
Attempt ODM power optimization only after we can validate new state without
using pipe combine.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: remove a function that does complex calculation in every frame but...
Wenjing Liu [Wed, 23 Aug 2023 17:09:23 +0000 (13:09 -0400)]
drm/amd/display: remove a function that does complex calculation in every frame but not used

[why]
The result of predict_pipe_split calculation is no longer used but the
function is not removed. This will cause unnecessary calculation
of pipe split prediction in every frame update.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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/amdkfd: Checkpoint and restore queues on GFX11
David Francis [Tue, 22 Nov 2022 20:14:32 +0000 (15:14 -0500)]
drm/amdkfd: Checkpoint and restore queues on GFX11

The code in kfd_mqd_manager_v11.c to support criu dump and
restore of queue state was missing.

Added it; should be equivalent to kfd_mqd_manager_v10.c.

CC: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: David Francis <David.Francis@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add DCHUBBUB callback to report MALL status
Aurabindo Pillai [Wed, 23 Aug 2023 22:15:51 +0000 (18:15 -0400)]
drm/amd/display: Add DCHUBBUB callback to report MALL status

[Why&How]
For enabling automated testing, add a hook to DCHUBBUB interface so that
mall status can be queried by userspace through debugfs. This removes
dependence on requiring a userspace tool like UMR for querying status
for MALL static screen IGT test.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@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 new logs for AutoDPMTest
Ethan Bitnun [Thu, 24 Aug 2023 16:01:44 +0000 (12:01 -0400)]
drm/amd/display: Add new logs for AutoDPMTest

[Description]
 - Add new logs to be used by the AutoDPMTest
 - Enclose AutoDPMTest logs in settings
 - Add logging definition

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Ethan Bitnun <etbitnun@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: support main link off before specific vertical line
Paul Hsieh [Tue, 22 Aug 2023 14:55:13 +0000 (22:55 +0800)]
drm/amd/display: support main link off before specific vertical line

[Why]
Some panels request main link off before specific vertical line.
If source turn off main link after specific vertical line then
panel defect will be exposed.

[How]
Add interface to support turn off main link before specific
vertical line

Reviewed-by: Robin Chen <robin.chen@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: Adjust the MST resume flow
Wayne Lin [Tue, 22 Aug 2023 08:03:17 +0000 (16:03 +0800)]
drm/amd/display: Adjust the MST resume flow

[Why]
In drm_dp_mst_topology_mgr_resume() today, it will resume the
mst branch to be ready handling mst mode and also consecutively do
the mst topology probing. Which will cause the dirver have chance
to fire hotplug event before restoring the old state. Then Userspace
will react to the hotplug event based on a wrong state.

[How]
Adjust the mst resume flow as:
1. set dpcd to resume mst branch status
2. restore source old state
3. Do mst resume topology probing

For drm_dp_mst_topology_mgr_resume(), it's better to adjust it to
pull out topology probing work into a 2nd part procedure of the mst
resume. Will have a follow up patch in drm.

Reviewed-by: Chao-kai Wang <stylon.wang@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Acked-by: Stylon Wang <stylon.wang@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: Fix 2nd DPIA encoder Assignment
Mustapha Ghaddar [Tue, 22 Aug 2023 20:18:03 +0000 (16:18 -0400)]
drm/amd/display: Fix 2nd DPIA encoder Assignment

[HOW & Why]
There seems to be an issue with 2nd DPIA acquiring link encoder for tiled displays.
Solution is to remove check for eng_id before we get first dynamic encoder for it

Reviewed-by: Cruise Hung <cruise.hung@amd.com>
Reviewed-by: Meenakshikumar Somasundaram <meenakshikumar.somasundaram@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Mustapha Ghaddar <mghaddar@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Rename KGD_MAX_QUEUES to AMDGPU_MAX_QUEUES
Mukul Joshi [Wed, 6 Sep 2023 15:01:55 +0000 (11:01 -0400)]
drm/amdgpu: Rename KGD_MAX_QUEUES to AMDGPU_MAX_QUEUES

Rename KGD_MAX_QUEUES to AMDGPU_MAX_QUEUES to conform with
the naming convention followed in amdgpu_gfx.h. No functional
change.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: do not block ODM + OPM on one side of the screen
Wenjing Liu [Tue, 22 Aug 2023 23:42:04 +0000 (19:42 -0400)]
drm/amd/display: do not block ODM + OPM on one side of the screen

[why]
build scaling param is overriding validation policy regarding small viewport
support. Even if ODM + windowed MPO is not supported. The decision has
to be made at the time of validation. When building scaling params, we might
be building an initial dc state as an input to DML validation. The initial state
is not supposed to be always valid and we rely on DML to modify the initial
dc state and determine the final validation result. This check is pre judging
validation result when building the initial dc state.

This causes an issue where we are transitioning from desktop only ODM
combine 2:1 to ODM bypass with 2 planes. In this case we are building
an initial state with with ODM 2:1 combine + 2 planes. This is indeed not
supported but DML is about to modify the state so it no longer uses ODM
combine. Before it reaches DML, dc resource already fails validation because
it checks that the initial state is not supported by our policy. This overrides
the ODM decision to validate this state with ODM combine disabled. Therefore
causes an unexpected validation failure when the secondary plane is added
on one side of the screen.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Acked-by: Stylon Wang <stylon.wang@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 DML calculation errors
Nicholas Susanto [Fri, 21 Jul 2023 18:45:34 +0000 (14:45 -0400)]
drm/amd/display: Fix DML calculation errors

[Why]
DML calculations differ with DCN3.1 spreadsheet values due to
translations errors from the visual basic code

[How]
Add missing calculations that set the value for DSCDelay

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Jun Lei <jun.lei@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Nicholas Susanto <nicholas.susanto@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: print more address info of UMC bad page
Tao Zhou [Wed, 6 Sep 2023 07:49:41 +0000 (15:49 +0800)]
drm/amdgpu: print more address info of UMC bad page

Print out row, column and bank value of UMC error address for UMC v12.

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>
12 months agodrm/amdgpu: fallback to old RAS error message for aqua_vanjaram
Hawking Zhang [Fri, 8 Sep 2023 13:21:55 +0000 (21:21 +0800)]
drm/amdgpu: fallback to old RAS error message for aqua_vanjaram

So driver doesn't generate incorrect message until
the new format is settled down for aqua_vanjaram

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu/nbio4.3: set proper rmmio_remap.reg_offset for SR-IOV
Alex Deucher [Thu, 7 Sep 2023 19:44:54 +0000 (15:44 -0400)]
drm/amdgpu/nbio4.3: set proper rmmio_remap.reg_offset for SR-IOV

Needed for HDP flush to work correctly.

Reviewed-by: Timmy Tsai <timmtsai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu/soc21: don't remap HDP registers for SR-IOV
Alex Deucher [Wed, 6 Sep 2023 15:35:04 +0000 (11:35 -0400)]
drm/amdgpu/soc21: don't remap HDP registers for SR-IOV

This matches the behavior for soc15 and nv.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Timmy Tsai <timmtsai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: [FW Promotion] Release 0.0.181.0
Anthony Koo [Sat, 19 Aug 2023 16:02:25 +0000 (12:02 -0400)]
drm/amd/display: [FW Promotion] Release 0.0.181.0

 - Add new params to dmub_feature_caps for checking replay
   support in FW

Acked-by: Stylon Wang <stylon.wang@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: Don't check registers, if using AUX BL control
Swapnil Patel [Thu, 17 Aug 2023 18:04:26 +0000 (14:04 -0400)]
drm/amd/display: Don't check registers, if using AUX BL control

[Why]
Currently the driver looks DCN registers to access if BL is on or not.
This check is not valid if we are using AUX based brightness control.
This causes driver to not send out "backlight off" command during power off
sequence as it already thinks it is off.

[How]
Only check DCN registers if we aren't using AUX based brightness control.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Swapnil Patel <swapnil.patel@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix retry loop test
Dan Carpenter [Wed, 6 Sep 2023 10:54:38 +0000 (13:54 +0300)]
drm/amdgpu: fix retry loop test

This loop will exit with "retry" set to -1 if it fails but the code
checks for if "retry" is zero.  Fix this by changing post-op to a
pre-op.  --retry vs retry--.

Fixes: e01eeffc3f86 ("drm/amd/pm: avoid driver getting empty metrics table for the first time")
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Add dirty rect support for Replay
Bhawanpreet Lakha [Tue, 22 Aug 2023 14:02:46 +0000 (10:02 -0400)]
drm/amd/display: Add dirty rect support for Replay

Dirty rect can be used with replay, so enable them to allow for more
powersaving.

Reviewed-by: Sun peng Li <sunpeng.li@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Bhawanpreet Lakha <bhawanpreet.lakha@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: set default return value for ODM Combine debugfs
Aurabindo Pillai [Fri, 18 Aug 2023 17:36:06 +0000 (13:36 -0400)]
drm/amd/display: set default return value for ODM Combine debugfs

[Why&How]
Set a default return value of -ENOTSUPP to indicate that the hardware
does not support querying ODM Combine mode.

Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@amd.com>
Acked-by: Stylon Wang <stylon.wang@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoRevert "drm/amd: Disable S/G for APUs when 64GB or more host memory"
Hamza Mahfooz [Fri, 8 Sep 2023 14:36:44 +0000 (10:36 -0400)]
Revert "drm/amd: Disable S/G for APUs when 64GB or more host memory"

This reverts commit 70e64c4d522b732e31c6475a3be2349de337d321.

Since, we now have an actual fix for this issue, we can get rid of this
workaround as it can cause pin failures if enough VRAM isn't carved out
by the BIOS.

Cc: stable@vger.kernel.org # 6.1+
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: fix the white screen issue when >= 64GB DRAM
Yifan Zhang [Fri, 8 Sep 2023 08:46:39 +0000 (16:46 +0800)]
drm/amd/display: fix the white screen issue when >= 64GB DRAM

Dropping bit 31:4 of page table base is wrong, it makes page table
base points to wrong address if phys addr is beyond 64GB; dropping
page_table_start/end bit 31:4 is unnecessary since dcn20_vmid_setup
will do that. Also, while we are at it, cleanup the assignments using
upper_32_bits()/lower_32_bits() and AMDGPU_GPU_PAGE_SHIFT.

Cc: stable@vger.kernel.org
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2354
Fixes: 81d0bcf99009 ("drm/amdgpu: make display pinning more flexible (v2)")
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Co-developed-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Don't lock phantom pipe on disabling
Alvin Lee [Wed, 23 Aug 2023 14:18:36 +0000 (10:18 -0400)]
drm/amd/display: Don't lock phantom pipe on disabling

[Description]
- When disabling a phantom pipe, we first enable the phantom
  OTG so the double buffer update can successfully take place
- However, want to avoid locking the phantom otherwise setting
  DPG_EN=1 for the phantom pipe is blocked (without this we could
  hit underflow due to phantom HUBP being blanked by default)

Reviewed-by: Samson Tam <samson.tam@amd.com>
Acked-by: Stylon Wang <stylon.wang@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: Blank phantom OTG before enabling
Alvin Lee [Tue, 8 Aug 2023 17:21:58 +0000 (13:21 -0400)]
drm/amd/display: Blank phantom OTG before enabling

[Description]
Before enabling the phantom OTG for an update we
must enable DPG to avoid underflow.

Reviewed-by: Samson Tam <samson.tam@amd.com>
Acked-by: Stylon Wang <stylon.wang@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/amdkfd: Update CU masking for GFX 9.4.3
Mukul Joshi [Tue, 22 Aug 2023 15:35:25 +0000 (11:35 -0400)]
drm/amdkfd: Update CU masking for GFX 9.4.3

The CU mask passed from user-space will change based on
different spatial partitioning mode. As a result, update
CU masking code for GFX9.4.3 to work for all partitioning
modes.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdkfd: Update cache info reporting for GFX v9.4.3
Mukul Joshi [Fri, 25 Aug 2023 16:18:06 +0000 (12:18 -0400)]
drm/amdkfd: Update cache info reporting for GFX v9.4.3

Update cache info reporting in sysfs to report the correct
number of CUs and associated cache information based on
different spatial partitioning modes.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add channel index table for UMC v12
Tao Zhou [Wed, 26 Jul 2023 07:42:26 +0000 (15:42 +0800)]
drm/amdgpu: add channel index table for UMC v12

Get UMC phyical channel index according to node id, umc instance and
channel instance.

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>
12 months agodrm/amd/pm: enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled
Yang Wang [Fri, 8 Sep 2023 03:26:42 +0000 (11:26 +0800)]
drm/amd/pm: enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled

v1:
enable smu_v13_0_6 mca debug mode when UMC RAS feature is enabled.

v2:
use amdgpu_ras_is_supported() helper function instead bitmask check.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/pm: update smu_v13_0_6 smu header
Yang Wang [Fri, 8 Sep 2023 03:26:22 +0000 (11:26 +0800)]
drm/amd/pm: update smu_v13_0_6 smu header

update smu firmware header to support smu mca debug feature.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add address conversion for UMC v12
Tao Zhou [Wed, 17 May 2023 06:20:46 +0000 (14:20 +0800)]
drm/amdgpu: add address conversion for UMC v12

Convert MCA error address to physical address and find out all pages in
one physical row.

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>
12 months agodrm/amdgpu: Use default reset method handler
Lijo Lazar [Wed, 6 Sep 2023 11:18:38 +0000 (16:48 +0530)]
drm/amdgpu: Use default reset method handler

When reset method is not passed in reset context, look for the handler
for default reset method. On Aldebaran, default reset method for SOCs
connected to CPU over XGMI is MODE2.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Tested-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Store CU info from all XCCs for GFX v9.4.3
Mukul Joshi [Fri, 25 Aug 2023 15:59:09 +0000 (11:59 -0400)]
drm/amdgpu: Store CU info from all XCCs for GFX v9.4.3

Currently, we store CU info only for a single XCC assuming
that it is the same for all XCCs. However, that may not be
true. As a result, store CU info for all XCCs. This info is
later used for CU masking.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd: Fix the flag setting code for interrupt request
Ma Jun [Wed, 30 Aug 2023 06:11:30 +0000 (14:11 +0800)]
drm/amd: Fix the flag setting code for interrupt request

[1] Remove the irq flags setting code since pci_alloc_irq_vectors()
handles these flags.
[2] Free the msi vectors in case of error.

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix unsigned error codes
Lang Yu [Wed, 6 Sep 2023 11:15:45 +0000 (19:15 +0800)]
drm/amdgpu: fix unsigned error codes

Fixes: 5d5eac7e8303 ("drm/amdgpu: add selftest framework for UMSCH")
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/all/ZPhddADtKmOuVyDq@lang-desktop
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdkfd: Fix unaligned 64-bit doorbell warning
Mukul Joshi [Tue, 29 Aug 2023 16:06:09 +0000 (12:06 -0400)]
drm/amdkfd: Fix unaligned 64-bit doorbell warning

This patch fixes the following unaligned 64-bit doorbell
warning seen when submitting packets on HIQ on GFX v9.4.3
by making the HIQ doorbell 64-bit aligned.
The warning is seen when GPU is loaded in any mode other
than SPX mode.

[  +0.000301] ------------[ cut here ]------------
[  +0.000003] Unaligned 64-bit doorbell
[  +0.000030] WARNING: /amdkfd/kfd_doorbell.c:339 write_kernel_doorbell64+0x72/0x80
[  +0.000003] RIP: 0010:write_kernel_doorbell64+0x72/0x80
[  +0.000004] RSP: 0018:ffffc90004287730 EFLAGS: 00010246
[  +0.000005] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000000
[  +0.000003] RDX: 0000000000000001 RSI: ffffffff82837c71 RDI: 00000000ffffffff
[  +0.000003] RBP: ffffc90004287748 R08: 0000000000000003 R09: 0000000000000001
[  +0.000002] R10: 000000000000001a R11: ffff88a034008198 R12: ffffc900013bd004
[  +0.000003] R13: 0000000000000008 R14: ffffc900042877b0 R15: 000000000000007f
[  +0.000003] FS:  00007fa8c7b62000(0000) GS:ffff889f88400000(0000) knlGS:0000000000000000
[  +0.000004] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  +0.000003] CR2: 000056111c45aaf0 CR3: 00000001414f2002 CR4: 0000000000770ee0
[  +0.000003] PKRU: 55555554
[  +0.000002] Call Trace:
[  +0.000004]  <TASK>
[  +0.000006]  kq_submit_packet+0x45/0x50 [amdgpu]
[  +0.000524]  pm_send_set_resources+0x7f/0xc0 [amdgpu]
[  +0.000500]  set_sched_resources+0xe4/0x160 [amdgpu]
[  +0.000503]  start_cpsch+0x1c5/0x2a0 [amdgpu]
[  +0.000497]  kgd2kfd_device_init.cold+0x816/0xb42 [amdgpu]
[  +0.000743]  amdgpu_amdkfd_device_init+0x15f/0x1f0 [amdgpu]
[  +0.000602]  amdgpu_device_init.cold+0x1813/0x2176 [amdgpu]
[  +0.000684]  ? pci_bus_read_config_word+0x4a/0x80
[  +0.000012]  ? do_pci_enable_device+0xdc/0x110
[  +0.000008]  amdgpu_driver_load_kms+0x1a/0x110 [amdgpu]
[  +0.000545]  amdgpu_pci_probe+0x197/0x400 [amdgpu]

Fixes: c31866651086 ("drm/amdgpu: use doorbell mgr for kfd kernel doorbells")
Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdkfd: Fix reg offset for setting CWSR grace period
Mukul Joshi [Mon, 28 Aug 2023 18:18:23 +0000 (14:18 -0400)]
drm/amdkfd: Fix reg offset for setting CWSR grace period

This patch fixes the case where the code currently passes
absolute register address and not the reg offset, which HWS
expects, when sending the PM4 packet to set/update CWSR grace
period. Additionally, cleanup the signature of
build_grace_period_packet_info function as it no longer needs
the inst parameter.

Signed-off-by: Mukul Joshi <mukul.joshi@amd.com>
Reviewed-by: Jonathan Kim <jonathan.kim@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: clean up one inconsistent indenting
Yang Li [Fri, 1 Sep 2023 01:29:24 +0000 (09:29 +0800)]
drm/amd/display: clean up one inconsistent indenting

drivers/gpu/drm/amd/amdgpu/../display/dc/dml/dcn35/dcn35_fpu.c:260 dcn35_update_bw_bounding_box_fpu() warn: inconsistent indenting

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Add umc v12_0 ras functions
Candice Li [Thu, 11 May 2023 01:19:58 +0000 (09:19 +0800)]
drm/amdgpu: Add umc v12_0 ras functions

Add umc v12_0 ras error querying.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Fix refclk reporting for SMU v13.0.6
Lijo Lazar [Wed, 6 Sep 2023 03:51:39 +0000 (09:21 +0530)]
drm/amdgpu: Fix refclk reporting for SMU v13.0.6

SMU v13.0.6 SOCs have 100MHz reference clock.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Correct se_num and reg_inst for gfx v9_4_3 ras counters
Hawking Zhang [Wed, 6 Sep 2023 09:56:20 +0000 (17:56 +0800)]
drm/amdgpu: Correct se_num and reg_inst for gfx v9_4_3 ras counters

gfx_v9_4_3_ue|ce_reg_list is an array per gfx core instance
correct the settings of se_num and reg_inst for some of
gfx ras counters so all the available register instances
can be polled for ras status.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Restrict bootloader wait to SMUv13.0.6
Lijo Lazar [Mon, 4 Sep 2023 12:45:13 +0000 (18:15 +0530)]
drm/amdgpu: Restrict bootloader wait to SMUv13.0.6

Restrict the wait for boot loader steady state only to SMUv13.0.6. For
older SOCs, ASIC init has a longer wait period and that takes care.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Asad Kamal <asad.kamal@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Add only valid firmware version nodes
Lijo Lazar [Fri, 25 Aug 2023 09:06:58 +0000 (14:36 +0530)]
drm/amdgpu: Add only valid firmware version nodes

Show only firmware version attributes that have valid version. Hide
others.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: fix incompatible types in conditional expression
Lang Yu [Mon, 4 Sep 2023 03:59:59 +0000 (11:59 +0800)]
drm/amdgpu: fix incompatible types in conditional expression

Use proper type.

Fixes: 9d4346bdbc64 ("drm/amdgpu: add VPE 6.1.0 support")
Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Solomon Chiu <solomon.chiu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202309020608.FwP8QMht-lkp@intel.com
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Use min_t to replace min
Srinivasan Shanmugam [Sun, 3 Sep 2023 06:52:25 +0000 (12:22 +0530)]
drm/amdgpu: Use min_t to replace min

Use min_t to replace min, min_t is a bit fast because min use
twice typeof.

And using min_t is cleaner here since the min/max macros
do a typecheck while min_t()/max_t() to an explicit type cast.

Fixes the below checkpatch warning:

WARNING: min() should probably be min_t()

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd: Add umc v12_0_0 ip headers
Candice Li [Wed, 10 May 2023 17:13:27 +0000 (01:13 +0800)]
drm/amd: Add umc v12_0_0 ip headers

Add umc v12_0_0 ip headers.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Update amdgpu_device_indirect_r/wreg_ext
Candice Li [Mon, 4 Sep 2023 09:03:34 +0000 (17:03 +0800)]
drm/amdgpu: Update amdgpu_device_indirect_r/wreg_ext

Only calculate pcie_index_hi for register address greater than 32bits.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Add RREG64_PCIE_EXT/WREG64_PCIE_EXT functions
Candice Li [Wed, 17 May 2023 02:48:23 +0000 (10:48 +0800)]
drm/amdgpu: Add RREG64_PCIE_EXT/WREG64_PCIE_EXT functions

Add 64bits register access support on register whose address
is greater than 32bits.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: Declare array with strings as pointers constant
Srinivasan Shanmugam [Sun, 3 Sep 2023 06:05:48 +0000 (11:35 +0530)]
drm/amdgpu: Declare array with strings as pointers constant

This warning is for the declaration of a static array, and it is
recommended to declare it as type "static const char * const" instead of
"static const char *".

an array pointer declared as type "static const char *" can point to a
different character constant because the pointer is mutable. However, if
it is declared as type "static const char * const", the pointer will
point to an immutable character constant, preventing it from being
modified which can better ensure the safety and stability of the
program.

Fixes the below:

WARNING: static const char * array should probably be static const char * const

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoamdgpu/pm: Optimize emit_clock_levels for aldebaran - part 3
Darren Powell [Tue, 4 Apr 2023 04:14:27 +0000 (00:14 -0400)]
amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 3

   split switch statement into two and consolidate the common
   code for printing most of the types of clock speeds

Signed-off-by: Darren Powell <darren.powell@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoamdgpu/pm: Optimize emit_clock_levels for aldebaran - part 2
Darren Powell [Tue, 4 Apr 2023 03:37:50 +0000 (23:37 -0400)]
amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 2

 Use variables to remove ternary expression in print statement
 and improve readability. This will help to optimize the code
 duplication in the switch statement
 Also Changed:
  replaced single_dpm_table->count as iterator in for loops
    with safer clocks_num_levels value
  replaced dpm_table.value usage with local var clocks_mhz

Signed-off-by: Darren Powell <darren.powell@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoamdgpu/pm: Optimize emit_clock_levels for aldebaran - part 1
Darren Powell [Mon, 3 Apr 2023 18:06:47 +0000 (14:06 -0400)]
amdgpu/pm: Optimize emit_clock_levels for aldebaran - part 1

 Use variables to remove the multiple nested ternary expressions
 and improve readability. This will help to optimize the code
 duplication in the switch statement
 Also Changed:
  Modify function aldebaran_get_clk_table to void function as it
    always returns 0
  Use const string "attempt_string" to cut down on repetition

Signed-off-by: Darren Powell <darren.powell@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoamdgpu/pm: Replace print_clock_levels with emit_clock_levels for aldebaran
Darren Powell [Sat, 9 Apr 2022 03:59:36 +0000 (23:59 -0400)]
amdgpu/pm: Replace print_clock_levels with emit_clock_levels for aldebaran

Replace print_clock_levels with emit_clock_levels for aldebaran
  * replace .print_clk_levels with .emit_clk_levels in aldebaran_ppt_funcs
  * added extra parameter int *offset
  * removed var size, uses arg *offset instead
  * removed call to smu_cmn_get_sysfs_buf
  * errors are returned to caller
  * returns 0 on success
additional incidental changes
  * changed type of vars i, now to remove comparing mismatch types
  * renamed var s/now/cur_value/
  * switch statement default now returns -EINVAL
  * RAS Recovery returns -EBUSY

Based on
  commit b06b48d7ddae ("amdgpu/pm: Implement emit_clk_levels for navi10")

Signed-off-by: Darren Powell <darren.powell@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: clean up some inconsistent indentings
Yang Li [Fri, 1 Sep 2023 01:29:23 +0000 (09:29 +0800)]
drm/amd/display: clean up some inconsistent indentings

drivers/gpu/drm/amd/amdgpu/../display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c:288 dcn35_update_clocks() warn: inconsistent indenting

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: clean up some inconsistent indentings
Yang Li [Fri, 1 Sep 2023 01:29:22 +0000 (09:29 +0800)]
drm/amd/display: clean up some inconsistent indentings

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn35/dcn35_hwseq.c:159 dcn35_init_hw() warn: inconsistent indentig

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: clean up one inconsistent indenting
Yang Li [Fri, 1 Sep 2023 01:29:21 +0000 (09:29 +0800)]
drm/amd/display: clean up one inconsistent indenting

drivers/gpu/drm/amd/amdgpu/../display/dc/dcn35/dcn35_resource.c:1877 dcn35_resource_construct() warn: inconsistent indenting

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: clean up one inconsistent indenting
Yang Li [Fri, 1 Sep 2023 01:29:20 +0000 (09:29 +0800)]
drm/amd/display: clean up one inconsistent indenting

drivers/gpu/drm/amd/amdgpu/../display/dmub/src/dmub_srv.c:355 dmub_srv_hw_setup() warn: inconsistent indenting

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove duplicated include in dcn35_clk_mgr.c
Yang Li [Fri, 1 Sep 2023 00:52:26 +0000 (08:52 +0800)]
drm/amd/display: Remove duplicated include in dcn35_clk_mgr.c

./drivers/gpu/drm/amd/display/dc/clk_mgr/dcn35/dcn35_clk_mgr.c: dcn35_clk_mgr.h is included more than once.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: prevent potential division by zero errors
Hamza Mahfooz [Tue, 5 Sep 2023 17:27:22 +0000 (13:27 -0400)]
drm/amd/display: prevent potential division by zero errors

There are two places in apply_below_the_range() where it's possible for
a divide by zero error to occur. So, to fix this make sure the divisor
is non-zero before attempting the computation in both cases.

Cc: stable@vger.kernel.org
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2637
Fixes: a463b263032f ("drm/amd/display: Fix frames_to_insert math")
Fixes: ded6119e825a ("drm/amd/display: Reinstate LFC optimization")
Reviewed-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove duplicated include in dcn35_hwseq.c
Yang Li [Fri, 1 Sep 2023 00:52:25 +0000 (08:52 +0800)]
drm/amd/display: Remove duplicated include in dcn35_hwseq.c

./drivers/gpu/drm/amd/display/dc/dcn35/dcn35_hwseq.c: clk_mgr.h is included more than once.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove duplicated include in dcn35_optc.c
Yang Li [Fri, 1 Sep 2023 00:52:24 +0000 (08:52 +0800)]
drm/amd/display: Remove duplicated include in dcn35_optc.c

./drivers/gpu/drm/amd/display/dc/dcn35/dcn35_optc.c: dcn35_optc.h is included more than once.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: Remove duplicated include in dcn35_resource.c
Yang Li [Fri, 1 Sep 2023 00:52:23 +0000 (08:52 +0800)]
drm/amd/display: Remove duplicated include in dcn35_resource.c

./drivers/gpu/drm/amd/display/dc/dcn35/dcn35_resource.c: dcn31/dcn31_dio_link_encoder.h is included more than once.

Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: clean up some inconsistent indenting
Jiapeng Chong [Fri, 1 Sep 2023 07:02:40 +0000 (15:02 +0800)]
drm/amdgpu: clean up some inconsistent indenting

No functional modification involved.

drivers/gpu/drm/amd/amdgpu/nbio_v7_11.c:34 nbio_v7_11_get_rev_id() warn: inconsistent indenting.

v2: drop leftover printk (Alex)

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6316
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: enable cursor degamma for DCN3+ DRM legacy gamma
Melissa Wen [Thu, 31 Aug 2023 16:12:28 +0000 (15:12 -0100)]
drm/amd/display: enable cursor degamma for DCN3+ DRM legacy gamma

For DRM legacy gamma, AMD display manager applies implicit sRGB degamma
using a pre-defined sRGB transfer function. It works fine for DCN2
family where degamma ROM and custom curves go to the same color block.
But, on DCN3+, degamma is split into two blocks: degamma ROM for
pre-defined TFs and `gamma correction` for user/custom curves and
degamma ROM settings doesn't apply to cursor plane. To get DRM legacy
gamma working as expected, enable cursor degamma ROM for implict sRGB
degamma on HW with this configuration.

Cc: stable@vger.kernel.org
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2803
Fixes: 96b020e2163f ("drm/amd/display: check attr flag before set cursor degamma on DCN3+")
Signed-off-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: calling address translation functions to simplify codes
Yifan Zhang [Fri, 25 Aug 2023 03:14:34 +0000 (11:14 +0800)]
drm/amdgpu: calling address translation functions to simplify codes

Use amdgpu_gmc_vram_pa to simplify codes.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/pm: only poweron/off vcn/jpeg when they are valid.
Yifan Zhang [Thu, 31 Aug 2023 03:17:35 +0000 (11:17 +0800)]
drm/amd/pm: only poweron/off vcn/jpeg when they are valid.

If vcn is disabled in kernel parameters, don't touch vcn,
otherwise it may cause vcn hang.

v2: delete unnecessary logs
v3: move "is_vcn_enabled" check to smu_dpm_setvcn/jpeg_enable (Evan)

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: limit the v_startup workaround to ASICs older than DCN3.1
Hamza Mahfooz [Thu, 31 Aug 2023 19:22:35 +0000 (15:22 -0400)]
drm/amd/display: limit the v_startup workaround to ASICs older than DCN3.1

Since, calling dcn20_adjust_freesync_v_startup() on DCN3.1+ ASICs
can cause the display to flicker and underflow to occur, we shouldn't
call it for them. So, ensure that the DCN version is less than
DCN_VERSION_3_1 before calling dcn20_adjust_freesync_v_startup().

Cc: stable@vger.kernel.org
Reviewed-by: Fangzhi Zuo <jerry.zuo@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/display: remove useless check in should_enable_fbc()
Dembskiy Igor [Wed, 30 Aug 2023 14:01:03 +0000 (17:01 +0300)]
drm/amd/display: remove useless check in should_enable_fbc()

It does not make sense to compare a pointer to array element with NULL.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 65d38262b3e8 ("drm/amd/display: fbc state could not reach while enable fbc")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Dembskiy Igor <dii@itb.spb.ru>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoRevert "drm/amd/display: Remove v_startup workaround for dcn3+"
Hamza Mahfooz [Thu, 31 Aug 2023 19:17:14 +0000 (15:17 -0400)]
Revert "drm/amd/display: Remove v_startup workaround for dcn3+"

This reverts commit 3a31e8b89b7240d9a17ace8a1ed050bdcb560f9e.

We still need to call dcn20_adjust_freesync_v_startup() for older DCN3+
ASICs. Otherwise, it can cause DP to HDMI 2.1 PCONs to fail to light up.

Cc: stable@vger.kernel.org
Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2809
Reviewed-by: Fangzhi Zuo <jerry.zuo@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agoRevert "drm/amd/pm: disable the SMU13 OD feature support temporarily"
Evan Quan [Mon, 14 Aug 2023 02:16:27 +0000 (10:16 +0800)]
Revert "drm/amd/pm: disable the SMU13 OD feature support temporarily"

This reverts commit 510d242f498a00f4701b77c6f42df880abacb3bd.

The enablement for the new OD mechanism completed. Also, the support for
fan control related OD feature has been added via this new mechanism.
Thus, it is time to bring back the SMU13 OD support.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/pm: add fan minimum pwm OD setting support for SMU13
Evan Quan [Fri, 11 Aug 2023 11:52:12 +0000 (19:52 +0800)]
drm/amd/pm: add fan minimum pwm OD setting support for SMU13

Add SMU13 fan minimum pwm OD setting support.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/pm: add fan target temperature OD setting support for SMU13
Evan Quan [Fri, 11 Aug 2023 11:33:23 +0000 (19:33 +0800)]
drm/amd/pm: add fan target temperature OD setting support for SMU13

Add SMU13 fan target temperature OD setting support.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amd/pm: add fan acoustic target OD setting support for SMU13
Evan Quan [Fri, 11 Aug 2023 10:09:14 +0000 (18:09 +0800)]
drm/amd/pm: add fan acoustic target OD setting support for SMU13

Add SMU13 fan acoustic target OD setting support.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: update SET_HW_RESOURCES definition for UMSCH
Lang Yu [Mon, 17 Jul 2023 06:30:25 +0000 (14:30 +0800)]
drm/amdgpu: update SET_HW_RESOURCES definition for UMSCH

Align with FW changes.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add amdgpu_umsch_mm module parameter
Lang Yu [Sat, 3 Jun 2023 09:41:20 +0000 (17:41 +0800)]
drm/amdgpu: add amdgpu_umsch_mm module parameter

Enable Multi Media User Mode Scheduler
(0 = disabled (default), 1 = enabled).

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu/discovery: enable UMSCH 4.0 in IP discovery
Lang Yu [Wed, 21 Jun 2023 12:16:46 +0000 (20:16 +0800)]
drm/amdgpu/discovery: enable UMSCH 4.0 in IP discovery

Enable UMSCH to support VPE and VCN user queues.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add PSP loading support for UMSCH
Lang Yu [Mon, 19 Jun 2023 00:58:32 +0000 (08:58 +0800)]
drm/amdgpu: add PSP loading support for UMSCH

Add front door loading support.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: reserve mmhub engine 3 for UMSCH FW
Lang Yu [Wed, 14 Jun 2023 03:50:27 +0000 (11:50 +0800)]
drm/amdgpu: reserve mmhub engine 3 for UMSCH FW

UMSCH FW uses mmhub engine 3 for invalidation.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Acked-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add VPE queue submission test
Lang Yu [Wed, 21 Jun 2023 09:56:24 +0000 (17:56 +0800)]
drm/amdgpu: add VPE queue submission test

Submit a fence command through indirect buffer.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add selftest framework for UMSCH
Lang Yu [Wed, 21 Jun 2023 08:07:52 +0000 (16:07 +0800)]
drm/amdgpu: add selftest framework for UMSCH

Prepare for VPE and VCN queue submission test.

v2: rebase on drm_exec (Alex)

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: enable UMSCH scheduling for VPE
Lang Yu [Wed, 21 Jun 2023 07:49:48 +0000 (15:49 +0800)]
drm/amdgpu: enable UMSCH scheduling for VPE

Add VPE into UMSCH hw resourses,
set vmid mask to 0xf00,
set hqd mask to 0xfe,
then UMSCH can schedule VPE queues.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add initial support for UMSCH
Lang Yu [Wed, 10 May 2023 08:49:45 +0000 (16:49 +0800)]
drm/amdgpu: add initial support for UMSCH

Add basic data structure, dummy ring functions
and ip functions for UMSCH.

Implement sw_init(ring_init and init_microcodede) and
hw_init(load_microcode), UMSCH can boot up now.

Implement hw_init(ring_start) and hw_fini(ring_stop),
UMSCH is ready for command submission now.

Implement set_hw_resources and add/remove_queue,
UMSCH is ready for scheduling now.

Aggregated doorbell is used to notify UMSCH FW that
there is unmapped queue with corresponding priority level
(e.g., AGDB[0] for Real time band, etc.) is updating its job.

v2: squash together initial patches to avoid breaking the
    build (Alex)

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add UMSCH 4.0 api definition
Lang Yu [Wed, 10 May 2023 08:14:44 +0000 (16:14 +0800)]
drm/amdgpu: add UMSCH 4.0 api definition

Add api definition for UMSCH 4.0.

v2: adjust coding style.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add UMSCH firmware header definition
Lang Yu [Wed, 10 May 2023 08:13:26 +0000 (16:13 +0800)]
drm/amdgpu: add UMSCH firmware header definition

Add firmware header definition for UMSCH.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
12 months agodrm/amdgpu: add UMSCH RING TYPE definition
Lang Yu [Wed, 10 May 2023 08:04:17 +0000 (16:04 +0800)]
drm/amdgpu: add UMSCH RING TYPE definition

Add RING TYPE definition for Multi Mdeia User Mode Scheduler.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>