platform/kernel/linux-starfive.git
18 months agoDocumentation/gpu: update dGPU asic info table
Alex Deucher [Wed, 18 Jan 2023 21:07:10 +0000 (16:07 -0500)]
Documentation/gpu: update dGPU asic info table

Update to the latest launched dGPUs.

Link: https://www.amd.com/en/graphics/radeon-rx-graphics
Link: https://www.amd.com/en/graphics/amd-radeon-rx-laptops
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: remove duplicate included header files
ye xingchen [Wed, 18 Jan 2023 07:39:00 +0000 (15:39 +0800)]
drm/amd/display: remove duplicate included header files

resource.h is included more than once.

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: return the PCIe gen and lanes from the INFO ioctl
Marek Olšák [Sat, 24 Dec 2022 22:44:26 +0000 (17:44 -0500)]
drm/amdgpu: return the PCIe gen and lanes from the INFO ioctl

For computing PCIe bandwidth in userspace and troubleshooting PCIe
bandwidth issues. Note that this intentionally fills holes and padding
in drm_amdgpu_info_device.

Mesa MR: https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20790

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: print bo inode number instead of ptr
Pierre-Eric Pelloux-Prayer [Thu, 12 Jan 2023 16:53:35 +0000 (17:53 +0100)]
drm/amdgpu: print bo inode number instead of ptr

This allows to correlate the infos printed by
/sys/kernel/debug/dri/n/amdgpu_gem_info to the ones found
in /proc/.../fdinfo and /sys/kernel/debug/dma_buf/bufinfo.

Signed-off-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: retire unused get_umc_v6_7_channel_index
Tao Zhou [Thu, 19 Jan 2023 03:07:40 +0000 (11:07 +0800)]
drm/amdgpu: retire unused get_umc_v6_7_channel_index

Fix the following compile warning:

drivers/gpu/drm/amd/amdgpu/umc_v6_7.c:53:24: warning: unused function 'get_umc_v6_7_channel_index' [-Wunused-function]
static inline uint32_t get_umc_v6_7_channel_index(struct amdgpu_device *adev,
                          ^
1 warning generated.

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>
18 months agodrm/amdgpu: Optimize sdma ras block initialization code for sdma v4_0
YiPeng Chai [Tue, 17 Jan 2023 08:06:49 +0000 (16:06 +0800)]
drm/amdgpu: Optimize sdma ras block initialization code for sdma v4_0

Optimize sdma ras block initialization code for sdma v4_0.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix hdmi_encoded_link_bw definition
Arnd Bergmann [Wed, 18 Jan 2023 16:06:27 +0000 (17:06 +0100)]
drm/amd/display: fix hdmi_encoded_link_bw definition

Some of the data structures are hidden when CONFIG_DRM_AMD_DC_DCN is
disabled, which leads to a link failure:

drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c:234:21: error: 'union hdmi_encoded_link_bw' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
  234 |         const union hdmi_encoded_link_bw hdmi_encoded_link_bw)
      |                     ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c:234:42: error: parameter 2 ('hdmi_encoded_link_bw') has incomplete type
  234 |         const union hdmi_encoded_link_bw hdmi_encoded_link_bw)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c:232:17: error: function declaration isn't a prototype [-Werror=strict-prototypes]
  232 | static uint32_t intersect_frl_link_bw_support(
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c: In function 'get_active_converter_info':
drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c:1126:76: error: storage size of 'hdmi_encoded_link_bw' isn't known
 1126 |                                                 union hdmi_encoded_link_bw hdmi_encoded_link_bw;
      |                                                                            ^~~~~~~~~~~~~~~~~~~~
drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c:1130:101: error: 'struct <anonymous>' has no member named 'MAX_ENCODED_LINK_BW_SUPPORT'
 1130 |                                                                                 hdmi_color_caps.bits.MAX_ENCODED_LINK_BW_SUPPORT);

There is probably no need to hide the data structure, and removing
the #ifdef makes it build cleanly.

Fixes: d5a43956b73b ("drm/amd/display: move dp capability related logic to link_dp_capability")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix dp_retrieve_lttpr_cap() return value
Arnd Bergmann [Wed, 18 Jan 2023 09:29:56 +0000 (10:29 +0100)]
drm/amd/display: fix dp_retrieve_lttpr_cap() return value

gcc-13 notices a mismatch between the return type of dp_retrieve_lttpr_cap()
and the returned value:

drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c: In function 'dp_retrieve_lttpr_cap':
drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dp_capability.c:1465:24: error: implicit conversion from 'enum <anonymous>' to 'enum dc_status' [-Werror=enum-conversion]
 1465 |                 return false;
      |                        ^~~~~

Change the value to an actual dc_status code and remove the bogus
initialization that was apparently meant to get returned here.

Fixes: b473bd5fc333 ("drm/amd/display: refine wake up aux in retrieve link caps")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Add sdma ras function on sdma v6_0_3
YiPeng Chai [Tue, 17 Jan 2023 07:44:25 +0000 (15:44 +0800)]
drm/amdgpu: Add sdma ras function on sdma v6_0_3

Add sdma ras function on sdma v6_0_3.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: disable S/G display on DCN 3.1.4
Alex Deucher [Wed, 18 Jan 2023 14:21:22 +0000 (09:21 -0500)]
drm/amd/display: disable S/G display on DCN 3.1.4

Causes flickering or white screens in some configurations.
Disable it for now until we can fix the issue.

Cc: roman.li@amd.com
Cc: yifan1.zhang@amd.com
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: disable S/G display on DCN 3.1.5
Alex Deucher [Wed, 18 Jan 2023 14:19:21 +0000 (09:19 -0500)]
drm/amd/display: disable S/G display on DCN 3.1.5

Causes flickering or white screens in some configurations.
Disable it for now until we can fix the issue.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2354
Cc: roman.li@amd.com
Cc: yifan1.zhang@amd.com
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd: decrease message about missing PSP runtime database to debug
Mario Limonciello [Wed, 18 Jan 2023 22:47:11 +0000 (16:47 -0600)]
drm/amd: decrease message about missing PSP runtime database to debug

Laptops with APUs from a variety of manufacturers and generations
show a warning about a missing PSP runtime database.

As it's not required for PSP to dump this database into framebuffer,
decrease messages about it missing to debug.

Reviewed-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>
18 months agodrm/amd/display: Decrease messaging about DP alt mode state to debug
Mario Limonciello [Wed, 18 Jan 2023 22:47:09 +0000 (16:47 -0600)]
drm/amd/display: Decrease messaging about DP alt mode state to debug

Currently plugging in a USB-C device that issues an HPD will emit
a warning level message `DP Alt mode state on HPD: %d`.

This is needlessly noisy for most people, decrease it to debug so
that it can be turned on by dynamic debug as needed.

Reviewed-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>
18 months agodrm/amdgpu/vcn4: fail to schedule IB for AV1 if VCN0 is harvested
Alex Deucher [Fri, 13 Jan 2023 15:56:58 +0000 (10:56 -0500)]
drm/amdgpu/vcn4: fail to schedule IB for AV1 if VCN0 is harvested

Only VCN0 supports AV1.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu/soc21: don't expose AV1 if VCN0 is harvested
Alex Deucher [Fri, 13 Jan 2023 15:45:59 +0000 (10:45 -0500)]
drm/amdgpu/soc21: don't expose AV1 if VCN0 is harvested

Only VCN0 supports AV1.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu/vcn3: fail to schedule IB for AV1 if VCN0 is harvested
Alex Deucher [Fri, 13 Jan 2023 15:55:41 +0000 (10:55 -0500)]
drm/amdgpu/vcn3: fail to schedule IB for AV1 if VCN0 is harvested

Only VCN0 supports AV1.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu/nv: don't expose AV1 if VCN0 is harvested
Alex Deucher [Fri, 13 Jan 2023 15:40:42 +0000 (10:40 -0500)]
drm/amdgpu/nv: don't expose AV1 if VCN0 is harvested

Only VCN0 supports AV1.

Reviewed-by: Leo Liu <leo.liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agoDocumentation/gpu: Add Raphael to apu-asic-info-table
Mario Limonciello [Wed, 18 Jan 2023 13:40:57 +0000 (07:40 -0600)]
Documentation/gpu: Add Raphael to apu-asic-info-table

Raphael launched in 2022 but was missed to add to this table.

Reviewed-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>
18 months agoDocumentation/gpu: Add Mendocino to apu-asic-info-table
Mario Limonciello [Wed, 18 Jan 2023 13:34:09 +0000 (07:34 -0600)]
Documentation/gpu: Add Mendocino to apu-asic-info-table

Mendocino launched in 2023 and uses the new naming scheme for APU
processors.

Link: https://community.amd.com/t5/corporate/announcing-new-model-numbers-for-2023-mobile-processors/ba-p/543985
Reviewed-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>
18 months agoDocumentation/gpu: Update lines for GREEN_SARDINE and YELLOW_CARP
Mario Limonciello [Wed, 18 Jan 2023 13:31:13 +0000 (07:31 -0600)]
Documentation/gpu: Update lines for GREEN_SARDINE and YELLOW_CARP

These products have launched, so add matching codenames.

Also AMD has announced that both of these products have new refresh
variants that launch in 2023 using the new naming scheme, so add
that information.

Link: https://community.amd.com/t5/corporate/announcing-new-model-numbers-for-2023-mobile-processors/ba-p/543985
Reviewed-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>
18 months agoDocumentation/gpu: Add MP0 version to apu-asic-info-table
Mario Limonciello [Wed, 18 Jan 2023 13:27:02 +0000 (07:27 -0600)]
Documentation/gpu: Add MP0 version to apu-asic-info-table

MP0 version is useful to know to figure out which firmware is intended
for a platform.  Add a column for all supported APUs.

v2: squash in column fix (Mario)

Reviewed-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>
18 months agodrm/amdgpu: allow multipipe policy on ASICs with one MEC
Lang Yu [Wed, 11 Jan 2023 01:32:15 +0000 (09:32 +0800)]
drm/amdgpu: allow multipipe policy on ASICs with one MEC

Always enable multipipe policy on ASICs with GC VERSION > 9.0.0
instead of MEC number > 1.

This will allow multipipe policy on ASICs with one MEC,
e.g., gfx11 APUs.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: correct MEC number for gfx11 APUs
Lang Yu [Wed, 11 Jan 2023 01:52:11 +0000 (09:52 +0800)]
drm/amdgpu: correct MEC number for gfx11 APUs

There is only one MEC on these APUs.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix issues with driver unload
Hamza Mahfooz [Tue, 17 Jan 2023 20:12:49 +0000 (15:12 -0500)]
drm/amd/display: fix issues with driver unload

Currently, we run into a number of WARN()s when attempting to unload the
amdgpu driver (e.g. using "modprobe -r amdgpu"). These all stem from
calling drm_encoder_cleanup() too early. So, to fix this we can stop
calling drm_encoder_cleanup() from amdgpu_dm_fini() and instead have it
be called from amdgpu_dm_encoder_destroy(). Also, we don't need to free
in amdgpu_dm_encoder_destroy() since mst_encoders[] isn't explicitly
allocated by the slab allocator.

Fixes: f74367e492ba ("drm/amdgpu/display: create fake mst encoders ahead of time (v4)")
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>
18 months agodrm/amdgpu/vcn: Remove redundant indirect SRAM HW model check
Guilherme G. Piccoli [Tue, 17 Jan 2023 18:15:24 +0000 (15:15 -0300)]
drm/amdgpu/vcn: Remove redundant indirect SRAM HW model check

The HW model validation that guards the indirect SRAM checking in the
VCN code path is redundant - there's no model that's not included in the
switch, making it useless in practice [0].

So, let's remove this switch statement for good.

[0] lore.kernel.org/amd-gfx/MN0PR12MB61013D20B8A2263B22AE1BCFE2C19@MN0PR12MB6101.namprd12.prod.outlook.com

Suggested-by: Alex Deucher <Alexander.Deucher@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Cc: James Zhu <James.Zhu@amd.com>
Cc: Lazar Lijo <Lijo.Lazar@amd.com>
Cc: Leo Liu <leo.liu@amd.com>
Cc: Sonny Jiang <sonny.jiang@amd.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu/vcn: Adjust firmware names indentation
Guilherme G. Piccoli [Tue, 17 Jan 2023 18:15:23 +0000 (15:15 -0300)]
drm/amdgpu/vcn: Adjust firmware names indentation

This is an incredibly trivial fix, just for the sake of
"aesthetical" organization of the defines. Some were space based,
most were tab based and there was a lack of "alignment", now it's
all the same and aligned.

Cc: James Zhu <James.Zhu@amd.com>
Cc: Lazar Lijo <Lijo.Lazar@amd.com>
Cc: Leo Liu <leo.liu@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Sonny Jiang <sonny.jiang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Use the sched from entity for amdgpu_cs trace
Leo Liu [Mon, 16 Jan 2023 14:55:57 +0000 (09:55 -0500)]
drm/amdgpu: Use the sched from entity for amdgpu_cs trace

The problem is that base sched hasn't been assigned yet at this moment,
causing something like "ring=0" all the time from trace.

mpv:cs0-3473    [002] ..... 129.047431: amdgpu_cs: ring=0, dw=48, fences=0
mpv:cs0-3473    [002] ..... 129.089125: amdgpu_cs: ring=0, dw=48, fences=0
mpv:cs0-3473    [002] ..... 129.130987: amdgpu_cs: ring=0, dw=48, fences=0
mpv:cs0-3473    [002] ..... 129.172478: amdgpu_cs: ring=0, dw=48, fences=0

Fixes: 4624459c84d7 ("drm/amdgpu: add gang submit frontend v6")
Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: correct query xgmi3x16 pcs error status
Stanley.Yang [Mon, 16 Jan 2023 07:42:36 +0000 (15:42 +0800)]
drm/amdgpu: correct query xgmi3x16 pcs error status

There is xgmi3x16 pcs error status for aldebaran, driver should
check xgmi3x16 pcs error status field instead of gopx16 pcs error
status field.

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: support check xgmi/walf error mask bit for aldebaran
Stanley.Yang [Thu, 12 Jan 2023 06:27:26 +0000 (14:27 +0800)]
drm/amdgpu: support check xgmi/walf error mask bit for aldebaran

The pcs error count should be determined by PCS ERROR status and
PCS ERROR MASK registers, only PCS ERROR status register can not
refect error counts accurately.

Changed from V1:
remove clean noncorrectable mask registers
optimize query pcs error status

Changed from V2:
remove check mask_value bits
correct set value corresponding bit

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: fix amdgpu_job_free_resources v2
Christian König [Thu, 12 Jan 2023 13:46:00 +0000 (14:46 +0100)]
drm/amdgpu: fix amdgpu_job_free_resources v2

It can be that neither fence were initialized when we run out of UVD
streams for example.

v2: fix typo breaking compile

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2324
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>
18 months agodrm/amdgpu: Optimize gfx ras block initialization code for gfx v9_0
YiPeng Chai [Wed, 11 Jan 2023 02:40:14 +0000 (10:40 +0800)]
drm/amdgpu: Optimize gfx ras block initialization code for gfx v9_0

  Use gfx ras common initialization interface to
initialize gfx ras block.

V2:
  Update function call due to amdgpu_gfx_ras_sw_init
interface changes.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Fix coding style
Thomas Zimmermann [Mon, 16 Jan 2023 13:12:14 +0000 (14:12 +0100)]
drm/amdgpu: Fix coding style

Align a closing brace and remove trailing whitespaces. No functional
changes.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix
Joshua Ashton [Tue, 10 Jan 2023 22:50:42 +0000 (22:50 +0000)]
drm/amd/display: Fix COLOR_SPACE_YCBCR2020_TYPE matrix

The YCC conversion matrix for RGB -> COLOR_SPACE_YCBCR2020_TYPE is
missing the values for the fourth column of the matrix.

The fourth column of the matrix is essentially just a value that is
added given that the color is 3 components in size.
These values are needed to bias the chroma from the [-1, 1] -> [0, 1]
range.

This fixes color being very green when using Gamescope HDR on HDMI
output which prefers YCC 4:4:4.

Fixes: 40df2f809e8f ("drm/amd/display: color space ycbcr709 support")
Reviewed-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Calculate output_color_space after pixel encoding adjustment
Joshua Ashton [Tue, 10 Jan 2023 20:12:21 +0000 (20:12 +0000)]
drm/amd/display: Calculate output_color_space after pixel encoding adjustment

Code in get_output_color_space depends on knowing the pixel encoding to
determine whether to pick between eg. COLOR_SPACE_SRGB or
COLOR_SPACE_YCBCR709 for transparent RGB -> YCbCr 4:4:4 in the driver.

v2: Fixed patch being accidentally based on a personal feature branch, oops!

Fixes: ea117312ea9f ("drm/amd/display: Reduce HDMI pixel encoding if max clock is exceeded")
Reviewed-by: Melissa Wen <mwen@igalia.com>
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: use swap() helper macro in bios_parser
Deepak R Varma [Sun, 15 Jan 2023 09:26:14 +0000 (14:56 +0530)]
drm/amd/display: use swap() helper macro in bios_parser

Use swap() helper macro instead of open coded swap instructions. The
change also facilitates code cleanup and realignment for improved
readability.  Issue identified using swap.cocci Coccinelle semantic
patch script.

Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/pm/powerplay/smumgr/ci: use bitwise or for bitmasks addition
Deepak R Varma [Sun, 15 Jan 2023 07:17:37 +0000 (12:47 +0530)]
drm/amd/pm/powerplay/smumgr/ci: use bitwise or for bitmasks addition

For bit mask addition, it is recommended to use or operator "|" instead
of numerical addition as the former is quicker and cleaner. Change
suggested by orplus.cocci Coccinelle semantic patch.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/pm/powerplay/hwmgr: use bitwise or for bitmasks addition
Deepak R Varma [Sun, 15 Jan 2023 07:17:11 +0000 (12:47 +0530)]
drm/amd/pm/powerplay/hwmgr: use bitwise or for bitmasks addition

For bit mask addition, it is recommended to use or operator "|" instead
of numerical addition as the former is quicker and cleaner. Change
suggested by orplus.cocci Coccinelle semantic patch.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/pm/powerplay/smumgr: use bitwise or for addition
Deepak R Varma [Sun, 15 Jan 2023 07:16:43 +0000 (12:46 +0530)]
drm/amd/pm/powerplay/smumgr: use bitwise or for addition

For bit mask addition, it is recommended to use or operator "|" instead
of numerical addition as the former is quicker and cleaner. Change
suggested by orplus.cocci Coccinelle semantic patch.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu/pm: update hwmon power documentation
Alex Deucher [Thu, 12 Jan 2023 16:18:52 +0000 (11:18 -0500)]
drm/amdgpu/pm: update hwmon power documentation

Power reporting is socket power.  On APUs this includes
the CPU.  Update the documentation to clarify this.

Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdkfd: Support process XNACK mode dynamic change
Philip Yang [Thu, 12 Jan 2023 19:08:36 +0000 (14:08 -0500)]
drm/amdkfd: Support process XNACK mode dynamic change

Update queue qpd is done for the first queue creation of the process,
if the device support XNACK mode per process, update qpd setup
sh_mem_config based on the process XNACK mode, to support the process
destroy all queues, change XNACK mode, and then create queues.

Add helper macro KFD_SUPPORT_XNACK_PER_PROCESS to remove duplicate code
and add new ASICs support in future.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd: Evaluate early init for all IP blocks even if one fails
Mario Limonciello [Sun, 15 Jan 2023 19:05:31 +0000 (13:05 -0600)]
drm/amd: Evaluate early init for all IP blocks even if one fails

If early init fails for a single IP block, then no further IP blocks
are evaluated.  This means that if a user was missing more than one
firmware binary they would have to keep adding binaries and re-probing
until they discovered the ones missing.

To make this easier, run early init for each IP block and report a single
failure if not all passed.

Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd: Remove needless break for legacy IP discovery MP0 9.0.0
Mario Limonciello [Sun, 15 Jan 2023 19:01:56 +0000 (13:01 -0600)]
drm/amd: Remove needless break for legacy IP discovery MP0 9.0.0

There is already a "default" case in the switch block, so there is
no need to have a break after the switch block.

Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: fix cleaning up reserved VMID on release
Christian König [Fri, 13 Jan 2023 16:32:45 +0000 (17:32 +0100)]
drm/amdgpu: fix cleaning up reserved VMID on release

We need to reset this or otherwise run into list corruption later on.

Fixes: e44a0fe630c5 ("drm/amdgpu: rework reserved VMID handling")
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Candice Li <candice.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Adjust ras support check condition for special asic
YiPeng Chai [Fri, 6 Jan 2023 12:16:53 +0000 (20:16 +0800)]
drm/amdgpu: Adjust ras support check condition for special asic

[Why]:
     Amdgpu ras uses amdgpu_ras_is_supported to check whether
  the ras block supports the ras function. amdgpu_ras_is_supported
  uses .ras_enabled to determine whether the ras function of the
  block is enabled.
     But for special asic with mem ecc enabled but sram ecc not
  enabled, some ras blocks support poison mode but their ras function
  is not enabled on .ras_enabled, these ras blocks will run abnormally.

[How]:
    If the ras block is not supported on .ras_enabled but the asic
  supports poison mode and the ras block has ras configuration, it
  can be considered that the ras block supports ras function.

Signed-off-by: YiPeng Chai <YiPeng.Chai@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>
18 months agodrm/amdgpu: Remove unnecessary ras block support check
YiPeng Chai [Fri, 6 Jan 2023 12:54:05 +0000 (20:54 +0800)]
drm/amdgpu: Remove unnecessary ras block support check

[Why]:
   For special asic with mem ecc enabled but sram ecc
not enabled, some ras blocks can register their ras
configuration to ras list, but these ras blocks are not
enabled on .ras_enabled, so it can not get ras block
object using amdgpu_ras_get_ras_block.

[How]:
   Remove ras block support check. Even if the ras block
checked is not in the ras list, it will return a null
pointer and will have no effect.

Signed-off-by: YiPeng Chai <YiPeng.Chai@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>
18 months agodrm/amdgpu: Perform gpu reset after gfx finishes processing ras poison consumption...
YiPeng Chai [Wed, 4 Jan 2023 05:13:21 +0000 (13:13 +0800)]
drm/amdgpu: Perform gpu reset after gfx finishes processing ras poison consumption on gfx_v11_0_3

Perform gpu reset after gfx finishes processing
ras poison consumption on gfx_v11_0_3.

V2:
 Move gfx poison consumption handler from hw_ops to ip
 function level.

V3:
 Adjust the calling position of amdgpu_gfx_poison_consumation_handler.

V4:
   Since gfx v11_0_3 does not have .hw_ops instance, the .hw_ops null
 pointer check in amdgpu_ras_interrupt_poison_consumption_handler
 needs to be adjusted.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Add gfx cp ecc error irq handling on gfx v11_0_3
YiPeng Chai [Thu, 12 Jan 2023 02:43:47 +0000 (10:43 +0800)]
drm/amdgpu: Add gfx cp ecc error irq handling on gfx v11_0_3

V2:
  Optimize gfx_v11_0_set_cp_ecc_error_state function.

V3:
  Define macro constant for me pipe instance address interval.

V5:
  Register and handle gfx cp ecc error irq on gfx v11_0_3.

V6:
  Remove invalid intermediate function call.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Add gfx ras poison consumption irq handling on gfx v11_0_3
YiPeng Chai [Thu, 5 Jan 2023 06:53:59 +0000 (14:53 +0800)]
drm/amdgpu: Add gfx ras poison consumption irq handling on gfx v11_0_3

Add gfx ras poison consumption irq handling on gfx v11_0_3.

V2:
  Move ras poison consumption irq handling code of gfx
     v11_0_3 to gfx_v11_0_3.c.
V5:
  Create dedicated irq handler for RLC_GC_FED_INTERRUPT.

V6:
  Remove invalid function call.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agoamd/amdgpu: Add RLC_RLCS_FED_STATUS_* to gc v11_0_3 ip headers
YiPeng Chai [Thu, 5 Jan 2023 06:52:51 +0000 (14:52 +0800)]
amd/amdgpu: Add RLC_RLCS_FED_STATUS_* to gc v11_0_3 ip headers

V2:
   Add RLC_RLCS_FED_STATUS_0 and RLC_RLCS_FED_STATUS_1 register
   offset and shift masks.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Add gfx ras function on gfx v11_0_3
YiPeng Chai [Wed, 2 Nov 2022 06:07:35 +0000 (14:07 +0800)]
drm/amdgpu: Add gfx ras function on gfx v11_0_3

Add gfx ras function on gfx v11_0_3.

V2:
 1. Add separate source files for gfx v11_0_3.
 2. Create a common function to initialize gfx ras block.

V3:
 1. Rename amdgpu_gfx_ras_block_init to amdgpu_gfx_ras_sw_init.
 2. Adjust the calling position of amdgpu_gfx_ras_sw_init.
 3. Remove gfx_v11_0_3_ras_ops.

V4:
 Revert changes in amdgpu_ras_interrupt_poison_consumption_handler.

V5:
 1. Remove invalid include file in gfx_v11_0_3.c.
 2. Reduce the number of parameters of amdgpu_gfx_ras_sw_init.

Signed-off-by: YiPeng Chai <YiPeng.Chai@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd: Fix renoir/green sardine MP0 IP version detection
Mario Limonciello [Sat, 14 Jan 2023 03:01:48 +0000 (21:01 -0600)]
drm/amd: Fix renoir/green sardine MP0 IP version detection

The existing codebase never had a case for detecting MP0 version on
Renoir and instead relied upon hardcoded chip name.  This was missed as
part of the changes to migrate all IP blocks to build filenames from
`amdgpu_ucode.c`.

Consequently, Renoir tries to fetch a binary with 11_0_3 in the filename
and since it's supposed to have "renoir" in the filename fails to probe.
The fbdev still works though so the series worked.

Add a case for Renoir into the legacy table to ensure the right ASD and
TA firmware load again.

Reported-by: Ekene Akuneme <Ekene.Akuneme@amd.com>
Reported-by: Nicholas Choi <Nicholas.Choi@amd.com>
Cc: Alex Hung <Alex.Hung@amd.com>
Fixes: 994a97447e38 ("drm/amd: Parse both v1 and v2 TA microcode headers using same function")
Fixes: 54a3e032340e ("drm/amd: Add a legacy mapping to "amdgpu_ucode_ip_version_decode"")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: 3.2.218
Aric Cyr [Tue, 3 Jan 2023 15:23:28 +0000 (10:23 -0500)]
drm/amd/display: 3.2.218

This version brings along following fixes:

- Revert patches that caused regressions associated with audio and an
  old change that checks the DCN version.
- Refactor DDC and HDP.
- Move DPIA and DPCD logic to new files.
- Updates to DMUB.
- Optimization and bug fixes for SUBVP/DRR.
- Drop legacy code.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: hdcp not enabled on connector 0
hersen wu [Fri, 23 Dec 2022 15:01:12 +0000 (10:01 -0500)]
drm/amd/display: hdcp not enabled on connector 0

[Why]
incorrect skip when drm_connector.index = 0 within
event_property_validate and update

[How] handle hdcp validate and update for connector 0

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: hersen wu <hersenxs.wu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: phase2 enable mst hdcp multiple displays
hersen wu [Mon, 14 Nov 2022 19:29:56 +0000 (14:29 -0500)]
drm/amd/display: phase2 enable mst hdcp multiple displays

[why]
For MST topology with 1 physical link and multiple connectors (>=2),
e.g. daisy cahined MST + SST, or 1-to-multi MST hub, if userspace
set to enable the HDCP simultaneously on all connected outputs, the
commit tail iteratively call the hdcp_update_display() for each
display (connector). However, the hdcp workqueue data structure for
each link has only one DM connector and encryption status members,
which means the work queue of property_validate/update() would only
be triggered for the last connector within this physical link, and
therefore the HDCP property value of other connectors would stay on
DESIRED instead of switching to ENABLED, which is NOT as expected.

[how]
Use array of AMDGPU_DM_MAX_DISPLAY_INDEX for both aconnector and
encryption status in hdcp workqueue data structure for each physical
link. For property validate/update work queue, we iterates over the
array and do similar operation/check for each connected display.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Signed-off-by: hersen wu <hersenxs.wu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Account for MPO planes in dcn32 mall alloc calculations
Dillon Varone [Thu, 22 Dec 2022 01:28:56 +0000 (20:28 -0500)]
drm/amd/display: Account for MPO planes in dcn32 mall alloc calculations

[WHY?]
Cannot only consider the MALL required from top pipes because of the MPO
case.

[HOW?]
Only count a pipe if it fits the following criteria:
1) does not have a top pipe (is the topmost pipe for that plane)
2) it does have a top pipe, but that pipe is associated with a different
   plane

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Nevenko Stupar <Nevenko.Stupar@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Allow subvp on vactive pipes that are 2560x1440@60
Alvin Lee [Wed, 14 Dec 2022 15:12:55 +0000 (10:12 -0500)]
drm/amd/display: Allow subvp on vactive pipes that are 2560x1440@60

Enable subvp on specifically 1440p@60hz displays even though it can
switch in vactive.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Request min clocks after disabling pipes on init
Alvin Lee [Wed, 14 Dec 2022 20:43:55 +0000 (15:43 -0500)]
drm/amd/display: Request min clocks after disabling pipes on init

[Description]
- Request min clocks after disabling pipes on init
- This optimizes for power savings during init sequence
- Also handles the case where we boot up with no display connected

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alvin Lee <Alvin.Lee2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix mapping to non-allocated address
Brandon Syu [Thu, 22 Dec 2022 08:43:37 +0000 (16:43 +0800)]
drm/amd/display: fix mapping to non-allocated address

[Why]
There is an issue mapping non-allocated location of memory.
It would allocate gpio registers from an array out of bounds.

[How]
Patch correct numbers of bounds for using.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Martin Leung <Martin.Leung@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Brandon Syu <Brandon.Syu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Skip backlight control delay on external powered links
Tony Tascioglu [Mon, 12 Dec 2022 15:20:33 +0000 (10:20 -0500)]
drm/amd/display: Skip backlight control delay on external powered links

[Why]
When an eDP panel is powered externally from a different GPU, we can avoid
waiting for hardware sequencing delays when switching the backlight on/off
as the display backlight is no longer powered by the original source.

[How]
This commit extends the 'link_powered_externally' variable to allow
bypassing hardware delays for additional backlight commands and force the
backlight on/off when a link is powered by another GPU.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Felipe Clark <felipe.clark@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Tony Tascioglu <tony.tascioglu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: contional remove disable dig_fifo when blank
Charlene Liu [Wed, 21 Dec 2022 00:46:45 +0000 (19:46 -0500)]
drm/amd/display: contional remove disable dig_fifo when blank

keep dig_fifo enable for test pattern generation.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Chris Park <Chris.Park@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Remove DISPCLK dentist programming for dcn32
Dillon Varone [Tue, 20 Dec 2022 20:45:48 +0000 (15:45 -0500)]
drm/amd/display: Remove DISPCLK dentist programming for dcn32

[WHY?]
For dcn32, SMU handles DISPCLK dentist programming.

[HOW?]
Only use calls to SMU to set DISPCLK.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Add extra mblk for DCC
Saaem Rizvi [Thu, 15 Dec 2022 15:38:16 +0000 (10:38 -0500)]
drm/amd/display: Add extra mblk for DCC

[Why]
DCC meta was found to be detached from usable pixel data. Due to this
DCC meta and the end of the fetched part of the frame will be on not
be on the same mblk. Furthermore if the meta is not aligned to the mblk
size, then we require an extra mblk in MALL to account for this.

[How]
Always add an additional mblk when DCC is enabled for detachment and
misalignment.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Dillon Varone <Dillon.Varone@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Saaem Rizvi <SyedSaaem.Rizvi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: set active bit for desktop with VSDBv3
Dillon Varone [Tue, 20 Dec 2022 19:18:01 +0000 (14:18 -0500)]
drm/amd/display: set active bit for desktop with VSDBv3

When using freesync on desktop, need to set freesync active bit for AMD
VSDBv3 infopacket.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Martin Leung <Martin.Leung@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Remove unused code
Rodrigo Siqueira [Tue, 3 Jan 2023 21:13:14 +0000 (16:13 -0500)]
drm/amd/display: Remove unused code

Remove some code that is never used from freesync file.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Optimize link power-down when link powered externally
Tony Tascioglu [Fri, 25 Nov 2022 22:31:44 +0000 (17:31 -0500)]
drm/amd/display: Optimize link power-down when link powered externally

[Why]
When an eDP panel is powered externally by a different GPU, we don't need
to wait for hardware sequencing delays when powering down a link, as the
display is not dependent on the GPU being powered down.

[How]
This commit adds a variable 'link_powered_externally' to indicate when a
link is being powered by another GPU.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Felipe Clark <felipe.clark@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Tony Tascioglu <tony.tascioglu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix an error check condition for synced pipes
Aurabindo Pillai [Thu, 15 Dec 2022 22:07:55 +0000 (17:07 -0500)]
drm/amd/display: fix an error check condition for synced pipes

Checking for disabled master pipe on a timing synchronized pipe is
incorrect in the case of ODM combine. This case is acceptable as long as
the disabled master pipe is part of the ODM tree. Skip printing error
message if this condition holds true.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Dillon Varone <Dillon.Varone@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agoRevert "drm/amd/display: Demote Error Level When ODM Transition Supported"
Aurabindo Pillai [Thu, 15 Dec 2022 22:02:14 +0000 (17:02 -0500)]
Revert "drm/amd/display: Demote Error Level When ODM Transition Supported"

This reverts commit e81b6a4427f3ca37859f5b9fdb6a66683bb84e2e.

Reverting to put in a better solution which does not involve checking
DCN version.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Dillon Varone <Dillon.Varone@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Aurabindo Pillai <aurabindo.pillai@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: move dp capability related logic to link_dp_capability
Wenjing Liu [Thu, 15 Dec 2022 22:28:28 +0000 (17:28 -0500)]
drm/amd/display: move dp capability related logic to link_dp_capability

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: move dp phy related logic to link_dp_phy
Wenjing Liu [Thu, 15 Dec 2022 19:24:56 +0000 (14:24 -0500)]
drm/amd/display: move dp phy related logic to link_dp_phy

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: move dp link training logic to link_dp_training
Wenjing Liu [Wed, 14 Dec 2022 19:26:46 +0000 (14:26 -0500)]
drm/amd/display: move dp link training logic to link_dp_training

[why]
Extract dp link training logic out to their own files.
link_dp_training - high level training sequence and helper functions.
link_dp_training_8b_10b - dp1.x training
link_dp_training_auxless - aux-less training
link_dp_traininig_dpia - dpia training
link_dp_training_fixed_vs_pe_retimer - fixed vs pe retimer training
link_dp_training_128b_132b - dp2.1 training

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Wesley Chalmers <Wesley.Chalmers@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Remove SubVp support if src/dst rect does not equal stream timing
Saaem Rizvi [Thu, 15 Dec 2022 21:38:08 +0000 (16:38 -0500)]
drm/amd/display: Remove SubVp support if src/dst rect does not equal stream timing

Current implementation of SubVP does not support cases where stream
timing matched neither the destination rect nor the source rect.

Will need to further debug to see how we can support these cases.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Saaem Rizvi <SyedSaaem.Rizvi@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Change i2c speed for hdcp
Bhawanpreet Lakha [Tue, 11 Oct 2022 14:08:14 +0000 (10:08 -0400)]
drm/amd/display: Change i2c speed for hdcp

[why]
HDCP 1.4 failed on SL8800 SW w/a test driver use.

[how]
slower down the HW i2c speed when used by HW i2c.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Aurabindo Pillai <Aurabindo.Pillai@amd.com>
Reviewed-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: cleanup function args in dml
Dillon Varone [Thu, 8 Dec 2022 21:31:20 +0000 (16:31 -0500)]
drm/amd/display: cleanup function args in dml

Remove array size on array passed to CalculateDETSwathFillLatencyHiding.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Use DML for MALL SS and Subvp allocation calculations
Dillon Varone [Thu, 8 Dec 2022 21:16:46 +0000 (16:16 -0500)]
drm/amd/display: Use DML for MALL SS and Subvp allocation calculations

MALL SS and Subvp use the same calculations for determining the size of
the required allocation for a given surface, which is already done in
DML. Add an interface to extract this information from VBA variables and
use in their respective helper functions. Also refactor existing code to
remove stale workarounds.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Account for Subvp Phantoms in DML MALL surface calculations
Dillon Varone [Thu, 8 Dec 2022 18:55:13 +0000 (13:55 -0500)]
drm/amd/display: Account for Subvp Phantoms in DML MALL surface calculations

DML does not explicitly consider support for space in MALL required for
subvp phantom pipes. This adds a check to make sure portion of phantom
surface can fit in MALL.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Account for DCC Meta pitch in DML MALL surface calculations
Dillon Varone [Thu, 8 Dec 2022 18:46:47 +0000 (13:46 -0500)]
drm/amd/display: Account for DCC Meta pitch in DML MALL surface calculations

DML incorrectly uses surface width for determining DCC meta size in MALL
allocation calculations.  Meta pitch should be used instead.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Optimize subvp and drr validation
Dillon Varone [Fri, 9 Dec 2022 22:59:21 +0000 (17:59 -0500)]
drm/amd/display: Optimize subvp and drr validation

Two issues existed:
1) Configs that support DRR, but have it disabled will fail subvp+vblank
validation incorrectly. Use subvp+vblank path for this case.
2) Configs that support DRR and have it enabled can use higher voltage level
than required if they also support subvp+vblank. Use lowest supported voltage
level for this case.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Add a missing tab
Dan Carpenter [Fri, 13 Jan 2023 10:07:42 +0000 (13:07 +0300)]
drm/amdgpu: Add a missing tab

This tab was deleted accidentally and triggers a Smatch warning:

    drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c:1006 gfx_v8_0_init_microcode()
    warn: inconsistent indenting

Add it back.

Fixes: 0aaafb7359d2 ("drm/amd: Use `amdgpu_ucode_*` helpers for GFX8")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: add hubbub_init related
Charlene Liu [Wed, 14 Dec 2022 00:15:01 +0000 (19:15 -0500)]
drm/amd/display: add hubbub_init related

Required by display init, also update get_dig_mode

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Hansen Dsouza <hansen.dsouza@amd.com>
Reviewed-by: Duncan Ma <duncan.ma@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Charlene Liu <Charlene.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Update dmub header to match DMUB
Mustapha Ghaddar [Mon, 12 Dec 2022 19:30:52 +0000 (14:30 -0500)]
drm/amd/display: Update dmub header to match DMUB

[WHY]
Last PR missed name of a struct to match in DMUB

[HOW]
Update the logic in dmub_cmh.h header

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Meenakshikumar Somasundaram <Meenakshikumar.Somasundaram@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Mustapha Ghaddar <mghaddar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Skip specific mmhub and sdma registers accessing under sriov
Yifan Zha [Wed, 11 Jan 2023 06:59:39 +0000 (14:59 +0800)]
drm/amdgpu: Skip specific mmhub and sdma registers accessing under sriov

[Why]
SDMA0_CNTL and MMHUB system aperture related registers are blocked by L1 Policy.
Therefore, they cannot be accessed by VF and loged in violation.

[How]
For MMHUB registers, they will be programmed by PF. So VF will skip to program them in mmhubv3_0.
For SDMA0_CNTL which is a PF_only register, VF don't need to program it in sdma_v6_0.

Signed-off-by: Yifan Zha <Yifan.Zha@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/pm: Support RAS fatal error mode1 reset on smu v13_0_0 and v13_0_10
Candice Li [Mon, 9 Jan 2023 13:55:22 +0000 (21:55 +0800)]
drm/amd/pm: Support RAS fatal error mode1 reset on smu v13_0_0 and v13_0_10

Support RAS fatal error mode1 reset on smu v13_0_0 and v13_0_10.

Signed-off-by: Candice Li <candice.li@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdgpu: Correct the power calcultion for Renior/Cezanne.
jie1zhan [Fri, 13 Jan 2023 02:39:13 +0000 (10:39 +0800)]
drm/amdgpu: Correct the power calcultion for Renior/Cezanne.

From smu firmware,the value of power is transferred  in units of watts.

Bug: https://gitlab.freedesktop.org/drm/amd/-/issues/2321
Fixes: 137aac26a2ed ("drm/amdgpu/smu12: fix power reporting on renoir")

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd: fix some dead code in `gfx_v9_0_init_cp_compute_microcode`
Mario Limonciello [Thu, 12 Jan 2023 22:37:01 +0000 (16:37 -0600)]
drm/amd: fix some dead code in `gfx_v9_0_init_cp_compute_microcode`

Some dead code was introduced as part of utilizing the `amdgpu_ucode_*`
helpers. Adjust the control flow to make sure that firmware is released
in the appropriate error flows.

Reported-by: coverity-bot <keescook+coverity-bot@chromium.org>
Addresses-Coverity-ID: 1530548 ("Control flow issues")
Fixes: ec787deb2ddf ("drm/amd: Use `amdgpu_ucode_*` helpers for GFX9")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: move dc_link_dpia logic to link_dp_dpia
Wenjing Liu [Tue, 13 Dec 2022 23:13:18 +0000 (18:13 -0500)]
drm/amd/display: move dc_link_dpia logic to link_dp_dpia

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: George Shen <George.Shen@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: move dpcd logic from dc_link_dpcd to link_dpcd
Wenjing Liu [Tue, 13 Dec 2022 22:26:13 +0000 (17:26 -0500)]
drm/amd/display: move dpcd logic from dc_link_dpcd to link_dpcd

[why]
Moving dpcd logic from dc_link_dpcd to link_dpcd as part of link file
restructure

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: George Shen <George.Shen@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: refactor ddc logic from dc_link_ddc to link_ddc
Wenjing Liu [Mon, 12 Dec 2022 18:52:57 +0000 (13:52 -0500)]
drm/amd/display: refactor ddc logic from dc_link_ddc to link_ddc

[why]
1. Move dd_link_ddc functions to link_ddc.
2. Move link ddc functions declaration exposed in dc to link.h
3. Move link ddc functions declaration exposed in dm to dc_link.h
4. Remove i2caux_interface.h file

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: refactor hpd logic from dc_link to link_hpd
Wenjing Liu [Sat, 10 Dec 2022 16:40:18 +0000 (11:40 -0500)]
drm/amd/display: refactor hpd logic from dc_link to link_hpd

[why]
Factor out hpd handling logic from generic dc link file.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Wenjing Liu <wenjing.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Implement FIFO enable sequence on DCN32
Dillon Varone [Mon, 12 Dec 2022 18:23:00 +0000 (13:23 -0500)]
drm/amd/display: Implement FIFO enable sequence on DCN32

[WHY?]
FIFO enable sequence is incomplete as it is currently implemented in FW,
and requires reset to prevent the FIFO to be enabled in an invalid
state. This cannot be done until DIG FE is connected to the BE.

[HOW?]
Add FIFO enable sequence in driver for dcn32 with reset after DIG FE is
connected to BE.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Alvin Lee <Alvin.Lee2@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dillon Varone <Dillon.Varone@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Fix DPIA link encoder assignment issue
Cruise Hung [Tue, 13 Dec 2022 01:39:49 +0000 (09:39 +0800)]
drm/amd/display: Fix DPIA link encoder assignment issue

[Why]
The DPIA link encoder (DIG) was not released when a Display XDR 6K
monitor was disconnected. That's because the DPIA link encoder logic
checked the BW when it removed the link encoder for it. And the timing
BW was less than DP link BW.  So, it failed to release the link encoder.
And that caused the DIG was occupied and can't be used.  The reason it
checked the BW is it wants to identify whether this link was using DIG
or HPO. It skips if it's not DIG.

[How]
Not to check the BW when it removes the link encoder because it's
already in the assignment table, it must be the DIG.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Cruise Hung <Cruise.Hung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix multi edp panel instancing
Dmytro Laktyushkin [Mon, 12 Dec 2022 22:42:59 +0000 (17:42 -0500)]
drm/amd/display: fix multi edp panel instancing

A previous fix attempted to correct mismatch between DM display
targets and dc panel instancing by only counting connected panels.
This behaviour breaks a feature, thus this is an alternative solution
that allows mapping display targets to dc links during mod_power_create.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agoRevert "drm/amd/display: Speed up DML fast_validate path"
Martin Leung [Mon, 12 Dec 2022 15:56:39 +0000 (10:56 -0500)]
Revert "drm/amd/display: Speed up DML fast_validate path"

This reverts commit 1b5d0e7e15430aecbf2bb0ac634a44aec971895c.

It caused corruption in some media players.

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Reviewed-by: Nevenko Stupar <Nevenko.Stupar@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Martin Leung <Martin.Leung@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Update BW alloc after new DMUB logic
Mustapha Ghaddar [Wed, 7 Dec 2022 19:01:36 +0000 (14:01 -0500)]
drm/amd/display: Update BW alloc after new DMUB logic

[WHY]
After introducing new DPIA NOTIFICATION we will need
to update the exiting BW allocation logic

[HOW]
Updated the BW alloc source and header files

Tested-by: Daniel Wheeler <Daniel.Wheeler@amd.com>
Reviewed-by: Meenakshikumar Somasundaram <Meenakshikumar.Somasundaram@amd.com>
Acked-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Mustapha Ghaddar <mghaddar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm: amd: display: Fix memory leakage
Konstantin Meskhidze [Wed, 30 Nov 2022 02:50:46 +0000 (10:50 +0800)]
drm: amd: display: Fix memory leakage

This commit fixes memory leakage in dc_construct_ctx() function.

Signed-off-by: Konstantin Meskhidze <konstantin.meskhidze@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Conversion to bool not necessary
Deepak R Varma [Thu, 12 Jan 2023 13:51:30 +0000 (19:21 +0530)]
drm/amd/display: Conversion to bool not necessary

A logical evaluation already results in bool. There is no need for using
a ternary operator based evaluation and bool conversion of the outcome.
Issue identified using boolconv.cocci Coccinelle semantic patch.
This was also reported by the Kernel Test Robot. Hence

Fixes: 473683a03495 ("drm/amd/display: Create a file dedicated for CRTC")

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Deepak R Varma <drv@mailo.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Remove useless else if
Jiapeng Chong [Thu, 12 Jan 2023 03:20:49 +0000 (11:20 +0800)]
drm/amd/display: Remove useless else if

The assignment of the else and if branches is the same, so the if else
here is redundant, so we remove it.

./drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c:1951:2-4: WARNING: possible condition with no effect (if == else).

Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=3719
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd: Avoid ASSERT for some message failures
Mario Limonciello [Wed, 11 Jan 2023 21:52:31 +0000 (15:52 -0600)]
drm/amd: Avoid ASSERT for some message failures

On DCN314 when resuming from s0i3 an ASSERT is shown indicating that
`VBIOSSMC_MSG_SetHardMinDcfclkByFreq` returned `VBIOSSMC_Result_Failed`.

This isn't a driver bug; it's a BIOS/configuration bug. To make this
easier to triage, add an explicit warning when this issue happens.

This matches the behavior utilized for failures with
`VBIOSSMC_MSG_TransferTableDram2Smu` configuration.

Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: Fix set scaling doesn's work
hongao [Tue, 22 Nov 2022 11:20:34 +0000 (19:20 +0800)]
drm/amd/display: Fix set scaling doesn's work

[Why]
Setting scaling does not correctly update CRTC state. As a result
dc stream state's src (composition area) && dest (addressable area)
was not calculated as expected. This causes set scaling doesn's work.

[How]
Correctly update CRTC state when setting scaling property.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Tested-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: hongao <hongao@uniontech.com>
Signed-off-by: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amd/display: fix possible buffer overflow relating to secure display
Hamza Mahfooz [Wed, 11 Jan 2023 17:25:14 +0000 (12:25 -0500)]
drm/amd/display: fix possible buffer overflow relating to secure display

It is possible that adev->dm.dc->caps.max_links is greater than
AMDGPU_MAX_CRTCS. So, to not potentially access unallocated memory use
adev->mode_info.num_crtc to do the bounds check instead of
adev->dm.dc->caps.max_links.

Fixes: 1b11ff764aef ("drm/amd/display: Implement multiple secure display")
Fixes: b8ff7e08bab9 ("drm/amd/display: Fix when disabling secure_display")
Reviewed-by: Alan Liu <HaoPing.Liu@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
18 months agodrm/amdkfd: Page aligned memory reserve size
Philip Yang [Mon, 9 Jan 2023 23:08:17 +0000 (18:08 -0500)]
drm/amdkfd: Page aligned memory reserve size

Use page aligned size to reserve memory usage because page aligned TTM
BO size is used to unreserve memory usage, otherwise no page aligned
size causes memory usage accounting unbalanced.

Change vram_used definition type to int64_t to be able to trigger
WARN_ONCE(adev && adev->kfd.vram_used < 0, "..."), to help debug the
accounting issue with warning and backtrace.

Signed-off-by: Philip Yang <Philip.Yang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>