linux-2.6-microblaze.git
13 months agodrm/amdgpu/vkms: fix a possible null pointer dereference
Ma Ke [Fri, 13 Oct 2023 01:53:43 +0000 (09:53 +0800)]
drm/amdgpu/vkms: fix a possible null pointer dereference

In amdgpu_vkms_conn_get_modes(), the return value of drm_cvt_mode()
is assigned to mode, which will lead to a NULL pointer dereference
on failure of drm_cvt_mode(). Add a check to avoid null pointer
dereference.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/swsmu: update smu v14_0_0 header files and metrics table
Li Ma [Wed, 11 Oct 2023 14:51:50 +0000 (22:51 +0800)]
drm/amd/swsmu: update smu v14_0_0 header files and metrics table

Update driver if, pmfw and ppsmc header files.
Add new gpu_metrics_v3_0 for metrics table updated in driver if
and reserve legacy metrics table to maintain backward compatibility.
---
v1:
Update header files and add gpu_metrics_v3_0.
v2:
Update smu_types.h, smu headers and drop smu_cmn_get_smc_version in smu v14_0_0.

Signed-off-by: Li Ma <li.ma@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add RAS error info support for umc_v12_0
Yang Wang [Wed, 27 Sep 2023 03:31:16 +0000 (11:31 +0800)]
drm/amdgpu: add RAS error info support for umc_v12_0

add RAS error info support for umc_v12_0.

Signed-off-by: Yang Wang <kevinyang.wang@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>
13 months agodrm/amdgpu: add RAS error info support for mmhub_v1_8
Yang Wang [Wed, 27 Sep 2023 04:21:12 +0000 (12:21 +0800)]
drm/amdgpu: add RAS error info support for mmhub_v1_8

add RAS error info support for mmhub_v1_8.

Signed-off-by: Yang Wang <kevinyang.wang@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>
13 months agodrm/amdgpu: add RAS error info support for gfx_v9_4_3
Yang Wang [Wed, 27 Sep 2023 04:02:28 +0000 (12:02 +0800)]
drm/amdgpu: add RAS error info support for gfx_v9_4_3

add RAS error info support for gfx_v9_4_3.

Signed-off-by: Yang Wang <kevinyang.wang@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>
13 months agodrm/amdgpu: add RAS error info support for sdma_v4_4_2.
Yang Wang [Wed, 27 Sep 2023 03:39:30 +0000 (11:39 +0800)]
drm/amdgpu: add RAS error info support for sdma_v4_4_2.

add RAS error info support for sdma_v4_4_2.

Signed-off-by: Yang Wang <kevinyang.wang@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>
13 months agodrm/amdgpu: add ras_err_info to identify RAS error source
Yang Wang [Mon, 25 Sep 2023 11:30:26 +0000 (19:30 +0800)]
drm/amdgpu: add ras_err_info to identify RAS error source

introduced "ras_err_info" to better identify a RAS ERROR source.

NOTE:
For legacy chips, keep the original RAS error print format.

v1:
RAS errors may come from different dies during a RAS error query,
therefore, need a new data structure to identify the source of RAS ERROR.

v2:
- use new data structure 'amdgpu_smuio_mcm_config_info' instead of
  ras_err_id (in v1 patch)
- refine ras error dump function name
- refine ras error dump log format

Signed-off-by: Yang Wang <kevinyang.wang@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>
13 months agodrm/amdgpu: flush the correct vmid tlb for specific pasid
Yifan Zhang [Thu, 12 Oct 2023 07:27:39 +0000 (15:27 +0800)]
drm/amdgpu: flush the correct vmid tlb for specific pasid

flush the correct vmid tlb for specific pasid on gmc 11.

Fixes: 041a5743883d ("drm/amdgpu: fix and cleanup gmc_v11_0_flush_gpu_tlb_pasid")
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>
13 months agodrm/amdgpu: make err_data structure built-in for ras_manager
Yang Wang [Wed, 11 Oct 2023 06:09:20 +0000 (14:09 +0800)]
drm/amdgpu: make err_data structure built-in for ras_manager

(No effect outside the ras_mgr data structure)

Since a new member was added to the ras_err_data data structure,
it becomes unreasonable for the ras_mgr instance to contain this data,
because ras mgr only uses the 2 member information of ue_count/ce_count in err_data.

This patch changes the code err_data into built-in structure members,
making the code directly compatible.

Signed-off-by: Yang Wang <kevinyang.wang@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>
13 months agodrm/amdgpu: disable GFXOFF and PG during compute for GFX9
Jesse Zhang [Fri, 13 Oct 2023 01:28:44 +0000 (09:28 +0800)]
drm/amdgpu: disable GFXOFF and PG during compute for GFX9

Temporary workaround to fix issues observed in some compute
applications when GFXOFF is enabled on GFX9.

Signed-off-by: Jesse Zhang <Jesse.Zhang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/umsch: fix missing stuff during rebase
Lang Yu [Wed, 11 Oct 2023 09:08:34 +0000 (17:08 +0800)]
drm/amdgpu/umsch: fix missing stuff during rebase

These are missed during rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/umsch: correct IP version format
Lang Yu [Thu, 12 Oct 2023 04:27:01 +0000 (12:27 +0800)]
drm/amdgpu/umsch: correct IP version format

FW uses IP_VERSION_MAJ_MIN_REV format.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: don't use legacy invalidation on MMHUB v3.3
Lang Yu [Wed, 11 Oct 2023 05:03:46 +0000 (13:03 +0800)]
drm/amdgpu: don't use legacy invalidation on MMHUB v3.3

Legacy invalidation is not supported.
This is missed during rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: correct NBIO v7.11 programing
Lang Yu [Thu, 12 Oct 2023 06:30:40 +0000 (14:30 +0800)]
drm/amdgpu: correct NBIO v7.11 programing

Use v7.7 before, switch to v7.11 now.
Fix incorrect programing.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/radeon: fix a possible null pointer dereference
Ma Ke [Wed, 11 Oct 2023 01:21:43 +0000 (09:21 +0800)]
drm/radeon: fix a possible null pointer dereference

In radeon_tv_get_modes(), the return value of drm_cvt_mode()
is assigned to mode, which will lead to a NULL pointer
dereference on failure of drm_cvt_mode(). Add a check to
avoid null point dereference.

Signed-off-by: Ma Ke <make_ruc2021@163.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Correctly use bo_va->ref_count in compute VMs
Xiaogang Chen [Thu, 12 Oct 2023 20:48:06 +0000 (15:48 -0500)]
drm/amdgpu: Correctly use bo_va->ref_count in compute VMs

This is needed to correctly handle BOs imported into compute VM from gfx.
Both kfd and gfx should use same bo_va and set bo_va->ref_count correctly
when map the Bos into same VM, otherwise we may trigger kernel general
protection when iterate mappings over bo_va's valids or invalids list.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Xiaogang Chen <Xiaogang.Chen@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Ramesh Errabolu <Ramesh.Errabolu@amd.com>
Tested-by: Xiaogang Chen <Xiaogang.Chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Add P2S tables for SMU v13.0.6
Lijo Lazar [Wed, 11 Oct 2023 14:27:38 +0000 (19:57 +0530)]
drm/amd/pm: Add P2S tables for SMU v13.0.6

Add P2S table load support on SMU v13.0.6 ASICs.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Add support to load P2S tables
Lijo Lazar [Wed, 11 Oct 2023 14:26:21 +0000 (19:56 +0530)]
drm/amdgpu: Add support to load P2S tables

Add support to load P2S tables through PSP.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Update PSP interface header
Lijo Lazar [Wed, 11 Oct 2023 14:13:56 +0000 (19:43 +0530)]
drm/amdgpu: Update PSP interface header

Adds FW id for P2S table.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Avoid FRU EEPROM access on APU
Lijo Lazar [Thu, 12 Oct 2023 07:33:22 +0000 (13:03 +0530)]
drm/amdgpu: Avoid FRU EEPROM access on APU

FRU EEPROM access is not valid for APU devices.

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>
13 months agodrm/amdgpu: save VCN instances init info before jpeg init
Lin.Cao [Tue, 10 Oct 2023 08:58:31 +0000 (16:58 +0800)]
drm/amdgpu: save VCN instances init info before jpeg init

JPEG init header will overwirte vcn init header info which will loss
some debug information

Signed-off-by: Lin.Cao <lincao12@amd.com>
Reviewed-by: Jingwen Chen <Jingwen.Chen2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Skip entire amdgpu_dm build if !CONFIG_DRM_AMD_DC"
Alex Hung [Wed, 11 Oct 2023 19:24:00 +0000 (13:24 -0600)]
Revert "drm/amd/display: Skip entire amdgpu_dm build if !CONFIG_DRM_AMD_DC"

This reverts commit 1b097bcd224e76807b66ef32cee76a3e87271a2b.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Create one virtual connector in DC"
Alex Hung [Wed, 11 Oct 2023 19:23:07 +0000 (13:23 -0600)]
Revert "drm/amd/display: Create one virtual connector in DC"

This reverts commit 554340133e4f596fc40fd75a58f9cf18b6b8dbbc.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Disable virtual links"
Alex Hung [Wed, 11 Oct 2023 19:23:05 +0000 (13:23 -0600)]
Revert "drm/amd/display: Disable virtual links"

This reverts commit b22c336268e477e3e8fc21e7d6b18fa8c4cd1f9a.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Initialize writeback connector"
Alex Hung [Wed, 11 Oct 2023 19:21:50 +0000 (13:21 -0600)]
Revert "drm/amd/display: Initialize writeback connector"

This reverts commit a2830b9e852f4007f7ee53f2c5765ab07ddb55e2.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Skip writeback connector when we get amdgpu_dm_connector"
Alex Hung [Wed, 11 Oct 2023 19:21:49 +0000 (13:21 -0600)]
Revert "drm/amd/display: Skip writeback connector when we get amdgpu_dm_connector"

This reverts commit 30a24318cc8f4947c6567c78997c8deb546e7a0b.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Return drm_connector from find_first_crtc_matching_connector"
Alex Hung [Wed, 11 Oct 2023 19:21:48 +0000 (13:21 -0600)]
Revert "drm/amd/display: Return drm_connector from find_first_crtc_matching_connector"

This reverts commit ca2b37a1c249d05f21eeb7522489036efbc6c7f8.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Use drm_connector in create_stream_for_sink"
Alex Hung [Wed, 11 Oct 2023 19:21:47 +0000 (13:21 -0600)]
Revert "drm/amd/display: Use drm_connector in create_stream_for_sink"

This reverts commit 5d91801870ba0ba23d90885edf0821634ecd405d.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: drop most smu_cmn_get_smc_version in smu
Yifan Zhang [Tue, 10 Oct 2023 13:43:40 +0000 (21:43 +0800)]
drm/amd/pm: drop most smu_cmn_get_smc_version in smu

smu_check_fw_version is called in smu hw init, thus smu if version
and version are garenteed to be stored in smu context. No need to
call smu_cmn_get_smc_version again after system boot up.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Add reset option for fan_ctrl on smu 13.0.7
Ma Jun [Wed, 13 Sep 2023 08:54:58 +0000 (16:54 +0800)]
drm/amd/pm: Add reset option for fan_ctrl on smu 13.0.7

Add reset option for fan_ctrl interfaces on the smu v13.0.7
User can use command "echo r > interface_name" to reset the
interface to boot value

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Add reset option for fan_ctrl interfaces
Ma Jun [Wed, 13 Sep 2023 06:25:38 +0000 (14:25 +0800)]
drm/amd/pm: Add reset option for fan_ctrl interfaces

Add reset option for fan_ctrl interfaces.

For example:
User can use the "echo r > acoustic_limit_rpm_threshold" command
to reset acoustic_limit_rpm_threshold to boot value

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Create amdgpu_dm_wb_connector"
Alex Hung [Wed, 11 Oct 2023 19:18:48 +0000 (13:18 -0600)]
Revert "drm/amd/display: Create amdgpu_dm_wb_connector"

This reverts commit a5f9523c9ca352d6454e81ff9e9a4419f457210a.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Create fake sink and stream for writeback connector"
Alex Hung [Wed, 11 Oct 2023 19:18:47 +0000 (13:18 -0600)]
Revert "drm/amd/display: Create fake sink and stream for writeback connector"

This reverts commit 01aaeb8c23301194ee063d89c06eae41599698af.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Hande writeback request from userspace"
Alex Hung [Wed, 11 Oct 2023 19:18:46 +0000 (13:18 -0600)]
Revert "drm/amd/display: Hande writeback request from userspace"

This reverts commit cd1a4bc22821eea9a98f1beddd1a8d789989a720.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Add writeback enable/disable in dc"
Alex Hung [Wed, 11 Oct 2023 19:18:45 +0000 (13:18 -0600)]
Revert "drm/amd/display: Add writeback enable/disable in dc"

This reverts commit c6d3c7b6309726fbe93cf595d6de326fb8295a64.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Fix writeback_info never got updated"
Alex Hung [Wed, 11 Oct 2023 19:18:44 +0000 (13:18 -0600)]
Revert "drm/amd/display: Fix writeback_info never got updated"

This reverts commit 8a307777c36e15f38c9f23778babcd368144c7d8.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Validate hw_points_num before using it"
Alex Hung [Wed, 11 Oct 2023 19:18:38 +0000 (13:18 -0600)]
Revert "drm/amd/display: Validate hw_points_num before using it"

This reverts commit 58c3b3341cea4f75dc8c003b89f8a6dd8ec55e50.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Fix writeback_info is not removed"
Alex Hung [Wed, 11 Oct 2023 19:18:36 +0000 (13:18 -0600)]
Revert "drm/amd/display: Fix writeback_info is not removed"

This reverts commit 5b89d2ccc8466e0445a4994cb288fc009b565de5.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Add writeback enable field (wb_enabled)"
Alex Hung [Wed, 11 Oct 2023 19:18:34 +0000 (13:18 -0600)]
Revert "drm/amd/display: Add writeback enable field (wb_enabled)"

This reverts commit f6893fcb10c7b24526454e465f6ec2563ef044cc.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Setup for mmhubbub3_warmup_mcif with big buffer"
Alex Hung [Wed, 11 Oct 2023 19:18:33 +0000 (13:18 -0600)]
Revert "drm/amd/display: Setup for mmhubbub3_warmup_mcif with big buffer"

This reverts commit 428542d9177286c01ef7a3dbd026eb00567e06b1.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Add new set_fc_enable to struct dwbc_funcs"
Alex Hung [Wed, 11 Oct 2023 19:18:31 +0000 (13:18 -0600)]
Revert "drm/amd/display: Add new set_fc_enable to struct dwbc_funcs"

This reverts commit b79a00a4d4f8fc827ca0fc19e259913a81252f6b.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoRevert "drm/amd/display: Disable DWB frame capture to emulate oneshot"
Alex Hung [Wed, 11 Oct 2023 19:18:24 +0000 (13:18 -0600)]
Revert "drm/amd/display: Disable DWB frame capture to emulate oneshot"

This reverts commit 77a66faaccc0455fe30e326e9a997aec8d0abed4.

[WHY & HOW]
The writeback series cause a regression in thunderbolt display.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Revert "drm/amd/display: Use drm_connector in create_validate_stream...
Alex Hung [Tue, 10 Oct 2023 22:39:32 +0000 (16:39 -0600)]
drm/amd/display: Revert "drm/amd/display: Use drm_connector in create_validate_stream_for_sink"

This reverts commit c4c182b5488e8d4a48be3327aab14d778cdfe5e7.

After this was commit PCON and USB4 issues were observed. A new fix will
be submitted instead.

Signed-off-by: Alex Hung <alex.hung@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Expose ras version & schema info
Asad Kamal [Mon, 2 Oct 2023 06:41:00 +0000 (14:41 +0800)]
drm/amdgpu: Expose ras version & schema info

Expose ras table version & schema info to sysfs

v2: Updated schema to get poison support info
from ras context, removed asic specific checks

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Read PSPv13 OS version from register
Lijo Lazar [Tue, 10 Oct 2023 07:19:25 +0000 (12:49 +0530)]
drm/amdgpu: Read PSPv13 OS version from register

PSP OS updates the version information in register. On APUs with PSPv13,
PSP OS will already be loaded with SBIOS. Hence use the version register
instead of using information in driver binary header.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: add missing NULL check for DML2
Bob Zhou [Tue, 10 Oct 2023 03:02:44 +0000 (11:02 +0800)]
drm/amd/display: add missing NULL check for DML2

Recently, the driver introduce DML2 for future ASIC support.
But, some ASIC's hubbub pointer is null before calling.
It cause the below null pointer issue, so add null check to fix it.

BUG: kernel NULL pointer dereference, address: 0000000000000000
RIP: 0010:dc_create_resource_pool+0xc1/0x2c0 [amdgpu] Call Trace:
 <TASK>
 ? show_regs.cold+0x1a/0x1f
 ? __die_body+0x20/0x70
 ? __die+0x2b/0x37
 ? page_fault_oops+0x136/0x2c0
 ? do_user_addr_fault+0x303/0x660
 ? exc_page_fault+0x77/0x170
 ? asm_exc_page_fault+0x27/0x30
 ? dc_create_resource_pool+0xc1/0x2c0 [amdgpu]  ? dc_create_resource_pool+0x243/0x2c0 [amdgpu]
 dc_create+0x23f/0x6b0 [amdgpu]
 ? dmi_matches+0xa3/0x200
 amdgpu_dm_init+0x2bd/0x22a0 [amdgpu]

Fixes: 7966f319c66d ("drm/amd/display: Introduce DML2")
Signed-off-by: Bob Zhou <bob.zhou@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/umsch: enable doorbell for umsch
Lang Yu [Sun, 1 Oct 2023 16:10:42 +0000 (00:10 +0800)]
drm/amdgpu/umsch: enable doorbell for umsch

Program vcn_doorbell_range with vcn_ring0_1.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: make dc_set_power_state() return type `void` again
Mario Limonciello [Fri, 6 Oct 2023 18:50:26 +0000 (13:50 -0500)]
drm/amd/display: make dc_set_power_state() return type `void` again

As dc_set_power_state() no longer allocates memory, it's not necessary
to have return types and check return code as it can't fail anymore.

Change it back to `void`.

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>
13 months agodrm/amd/display: Destroy DC context while keeping DML and DML2
Mario Limonciello [Fri, 6 Oct 2023 18:50:25 +0000 (13:50 -0500)]
drm/amd/display: Destroy DC context while keeping DML and DML2

If there is memory pressure at suspend time then dynamically
allocating a large structure as part of DC suspend code will
fail.

Instead re-use the same structures and clear all members except
those that should be maintained.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Catch errors from drm_atomic_helper_suspend()
Mario Limonciello [Fri, 6 Oct 2023 18:50:24 +0000 (13:50 -0500)]
drm/amd/display: Catch errors from drm_atomic_helper_suspend()

drm_atomic_helper_suspend() can return PTR_ERR(), in which case the
error gets stored into `dm->cached_state`.  This can cause failures
during resume.  Catch the error during suspend and fail the suspend
instead.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd: Split up UVD suspend into prepare and suspend steps
Mario Limonciello [Fri, 6 Oct 2023 18:50:22 +0000 (13:50 -0500)]
drm/amd: Split up UVD suspend into prepare and suspend steps

amdgpu_uvd_suspend() allocates memory and copies objects into that
allocated memory.  This fails under memory pressure.  Instead move
majority of this code into a prepare step when swap can still be
allocated.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd: Add concept of running prepare_suspend() sequence for IP blocks
Mario Limonciello [Fri, 6 Oct 2023 18:50:21 +0000 (13:50 -0500)]
drm/amd: Add concept of running prepare_suspend() sequence for IP blocks

If any IP blocks allocate memory during their hw_fini() sequence
this can cause the suspend to fail under memory pressure.  Introduce
a new phase that IP blocks can use to allocate memory before suspend
starts so that it can potentially be evicted into swap instead.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd: Evict resources during PM ops prepare() callback
Mario Limonciello [Fri, 6 Oct 2023 18:50:20 +0000 (13:50 -0500)]
drm/amd: Evict resources during PM ops prepare() callback

Linux PM core has a prepare() callback run before suspend.

If the system is under high memory pressure, the resources may need
to be evicted into swap instead.  If the storage backing for swap
is offlined during the suspend() step then such a call may fail.

So move this step into prepare() to move evict majority of
resources and update all non-pmops callers to call the same callback.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2362
Reviewed-by: Christian König <christian.koenig@amd.com>
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>
13 months agodrm/amdgpu: enable GFX IP v11.5.0 CG and PG support
Li Ma [Wed, 2 Aug 2023 08:39:51 +0000 (16:39 +0800)]
drm/amdgpu: enable GFX IP v11.5.0 CG and PG support

Add CG support for GFX/MC/HDP/ATHUB/IH/BIF.
Add PG support for GFX.

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add support to power up/down UMSCH by SMU
Lang Yu [Fri, 2 Jun 2023 00:39:36 +0000 (08:39 +0800)]
drm/amdgpu: add support to power up/down UMSCH by SMU

Power up/down UMSCH by SMU.

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>
13 months agodrm/amdgpu: add power up/down UMSCH ppt callback
Lang Yu [Fri, 2 Jun 2023 00:36:28 +0000 (08:36 +0800)]
drm/amdgpu: add power up/down UMSCH ppt callback

Add ppt callback to power up/down UMSCH.

v2: squash in updates (Alex)

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add support to powerup VPE by SMU
Lang Yu [Wed, 17 May 2023 06:55:46 +0000 (14:55 +0800)]
drm/amdgpu: add support to powerup VPE by SMU

Powerup VPE by SMU.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/discovery: add SMU 14 support
Li Ma [Fri, 28 Apr 2023 06:08:14 +0000 (14:08 +0800)]
drm/amdgpu/discovery: add SMU 14 support

add smu 14 into the IP discovery list.

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/swsmu: add smu14 ip support
Kenneth Feng [Wed, 26 Apr 2023 06:02:25 +0000 (14:02 +0800)]
drm/amd/swsmu: add smu14 ip support

Add initial swSMU support for smu 14 series ASIC.

v2: squash in build fixes and updates (Li Ma)
    fix warnings (Alex)
v3: squash in updates (Alex)
v4: squash in updates (Alex)
v5: squash in avg/current power updates (Alex)

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Kenneth Feng <kenneth.feng@amd.com>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/swsmu: add smu v14_0_0 pmfw if file
Li Ma [Fri, 28 Apr 2023 05:52:04 +0000 (13:52 +0800)]
drm/amd/swsmu: add smu v14_0_0 pmfw if file

Add initial smu v14_0_0 pmfw if file

v2: squash in updates (Alex)

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/swsmu: add smu v14_0_0 ppsmc file
Li Ma [Fri, 28 Apr 2023 05:22:06 +0000 (13:22 +0800)]
drm/amd/swsmu: add smu v14_0_0 ppsmc file

Add initial smu v14_0_0 ppsmc file

v2: squash in updates (Alex)
v3: squash in updates (Alex)

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/swsmu: add smu v14_0_0 driver if file
Li Ma [Fri, 28 Apr 2023 07:33:12 +0000 (15:33 +0800)]
drm/amdgpu/swsmu: add smu v14_0_0 driver if file

Add initial smu v14_0_0 driver if file

v2: squash in updates (Alex)
v3: update interface (Alex)

Signed-off-by: Li Ma <li.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/umsch: power on/off UMSCH by DLDO
Lang Yu [Sat, 30 Sep 2023 06:39:26 +0000 (14:39 +0800)]
drm/amdgpu/umsch: power on/off UMSCH by DLDO

VCN 4.0.5 uses DLDO.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/umsch: fix psp frontdoor loading
Lang Yu [Sat, 7 Oct 2023 04:43:13 +0000 (12:43 +0800)]
drm/amdgpu/umsch: fix psp frontdoor loading

These changes are missed in rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Veerabadhran Gopalakrishnan <Veerabadhran.Gopalakrishnan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Increase IP discovery region size
Lijo Lazar [Fri, 6 Oct 2023 04:57:20 +0000 (10:27 +0530)]
drm/amdgpu: Increase IP discovery region size

IP discovery region has increased to > 8K on some SOCs.Maximum reserve
size is upto 12K, but not used. For now increase to 10K.

Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Use gpu_metrics_v1_4 for SMUv13.0.6
Asad Kamal [Wed, 27 Sep 2023 13:08:13 +0000 (21:08 +0800)]
drm/amd/pm: Use gpu_metrics_v1_4 for SMUv13.0.6

Use gpu_metrics_v1_4 for SMUv13.0.6 to fill
gpu metric info

v3: Removed filling gpu metric instantaneous
pcie bw

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Add gpu_metrics_v1_4
Asad Kamal [Wed, 27 Sep 2023 13:05:37 +0000 (21:05 +0800)]
drm/amd/pm: Add gpu_metrics_v1_4

Add new gpu_metrics_v1_4 to acquire XGMI data transfer,
pcie bandwidth & Clock lock status

v2:
Add pcie error counter to gpu metric table v1_4

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: Update metric table for smu v13_0_6
Asad Kamal [Wed, 4 Oct 2023 06:04:57 +0000 (14:04 +0800)]
drm/amd/pm: Update metric table for smu v13_0_6

Update pmfw metric table to include xgmi transfer
data and pci instantaneous bandwidth for smu v13_0_6

v2:
Updated metric table version

v3: Removed inst pcie bw with alignment to metrics table
version 8

Signed-off-by: Asad Kamal <asad.kamal@amd.com>
Reviewed-by: Lijo Lazar <lijo.lazar@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Return -EINVAL when MMSCH init status incorrect
Lin.Cao [Sun, 8 Oct 2023 09:36:40 +0000 (17:36 +0800)]
drm/amdgpu: Return -EINVAL when MMSCH init status incorrect

Return -EINVAL when MMSCH init fail which can be handle by function
amdgpu_device_reset_sriov correctly.

Signed-off-by: Lin.Cao <lincao12@amd.com>
Reviewed-by: Jingwen Chen <Jingwen.Chen2@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/pm: wait for completion of the EnableGfxImu command
Tim Huang [Mon, 9 Oct 2023 08:23:27 +0000 (16:23 +0800)]
drm/amd/pm: wait for completion of the EnableGfxImu command

Wait for completion of sending the EnableGfxImu message
when using the PSP FW loading.

Signed-off-by: Tim Huang <Tim.Huang@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/vpe: fix insert_nop ops
Lang Yu [Sat, 7 Oct 2023 02:13:49 +0000 (10:13 +0800)]
drm/amdgpu/vpe: fix insert_nop ops

Avoid infinite loop when count is 0.
This is missed in rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Address member 'gart_placement' not described in 'amdgpu_gmc_gart_location'
Srinivasan Shanmugam [Mon, 9 Oct 2023 14:53:32 +0000 (20:23 +0530)]
drm/amdgpu: Address member 'gart_placement' not described in 'amdgpu_gmc_gart_location'

Fixes the below:
drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c:274: warning: Function parameter or member 'gart_placement' not described in 'amdgpu_gmc_gart_location'

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: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/vpe: align with mcbp changes
Lang Yu [Sat, 7 Oct 2023 02:10:50 +0000 (10:10 +0800)]
drm/amdgpu/vpe: align with mcbp changes

MCBP is decided by adev->gfx.mcbp now.
This is missed in rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/vpe: remove IB end boundary requirement
Lang Yu [Fri, 6 Oct 2023 12:24:45 +0000 (20:24 +0800)]
drm/amdgpu/vpe: remove IB end boundary requirement

Remove IB end boundary requirement,
VPE has no such limitions, use existing
amdgpu_ring_generic_pad_ib() instead.
This is missed in rebase.

Signed-off-by: Lang Yu <Lang.Yu@amd.com>
Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Improve MES responsiveness during oversubscription
Jay Cornwall [Wed, 4 Oct 2023 15:53:26 +0000 (10:53 -0500)]
drm/amdgpu: Improve MES responsiveness during oversubscription

When MES is oversubscribed it may not frequently check for new
command submissions from driver if the scheduling load is high.
Response latency as high as 5 seconds has been observed.

Enable a flag which adds a check for new commands between
scheduling quantums.

Signed-off-by: Jay Cornwall <jay.cornwall@amd.com>
Cc: Alexandru Tudor <alexandru.tudor@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: fix SI failure due to doorbells allocation
Icenowy Zheng [Sun, 8 Oct 2023 06:46:49 +0000 (14:46 +0800)]
drm/amdgpu: fix SI failure due to doorbells allocation

SI hardware does not have doorbells at all, however currently the code
will try to do the allocation and thus fail, makes SI AMDGPU not usable.

Fix this failure by skipping doorbells allocation when doorbells count
is zero.

Fixes: 54c30d2a8def ("drm/amdgpu: create kernel doorbell pages")
Reviewed-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Icenowy Zheng <uwu@icenowy.me>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu/discovery: enable DCN 3.5.0 support
Aaron Liu [Thu, 25 May 2023 08:08:55 +0000 (16:08 +0800)]
drm/amdgpu/discovery: enable DCN 3.5.0 support

Enable DCN 3.5.0 support.

Signed-off-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdkfd: get doorbell's absolute offset based on the db_size
Arvind Yadav [Mon, 9 Oct 2023 17:13:16 +0000 (22:43 +0530)]
drm/amdkfd: get doorbell's absolute offset based on the db_size

Here, Adding db_size in byte to find the doorbell's
absolute offset for both 32-bit and 64-bit doorbell sizes.
So that doorbell offset will be aligned based on the doorbell
size.

v2:
- Addressed the review comment from Felix.
v3:
- Adding doorbell_size as parameter to get db absolute offset.
v4:
  Squash the two patches into one.

Cc: Christian Koenig <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Shashank Sharma <shashank.sharma@amd.com>
Signed-off-by: Arvind Yadav <Arvind.Yadav@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add missing NULL check
Christian König [Fri, 6 Oct 2023 12:04:04 +0000 (14:04 +0200)]
drm/amdgpu: add missing NULL check

bo->tbo.resource can easily be NULL here.

Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2902
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
CC: stable@vger.kernel.org
13 months agodrm/amd/display: 3.2.255
Aric Cyr [Mon, 2 Oct 2023 00:40:08 +0000 (20:40 -0400)]
drm/amd/display: 3.2.255

This version brings along following fixes:
- Refactor DPG test pattern logic for ODM cases
- Refactor HWSS into component folder
- Revert "drm/amd/display: Add a check for idle power optimization"
- Revert "drm/amd/display: remove duplicated edp relink to fastboot
- Update cursor limits based on SW cursor fallback limits
- Update stream mask
- Update pmfw_driver_if new structure
- Modify SMU message logs
- Don't set dpms_off for seamless boot

Known issue:
DWB (Writeback functionality) is broken.
Fix will be available in DC 3.2.256

Acked-by: Tom Chung <chiahsuan.chung@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>
13 months agodrm/amd/display: Disable virtual links
Stylon Wang [Thu, 5 Oct 2023 12:25:10 +0000 (20:25 +0800)]
drm/amd/display: Disable virtual links

[Why]
This could work around the issue with DP tunneling producing
a NULL pointer dereference.

[How]
Disable the virtual links.

Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Stylon Wang <stylon.wang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Disable SubVP if test pattern is enabled
George Shen [Fri, 22 Sep 2023 18:38:31 +0000 (14:38 -0400)]
drm/amd/display: Disable SubVP if test pattern is enabled

[Why]
Enabling DPG causes HUBP to stay in blank constantly. If DPG is enabled
while an MCLK switch is taking place with SubVP, it will cause the MCLK
to never complete. This is because SubVP MCLK switch relies a HUBP
VLine interrupt, which will never occur when HUBP is constantly in
blank.

[How]
Disable SubVP when test pattern is enabled.

Reviewed-by: Alvin Lee <alvin.lee2@amd.com>
Reviewed-by: Nevenko Stupar <nevenko.stupar@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Refactor DPG test pattern logic for ODM cases
George Shen [Fri, 22 Sep 2023 18:26:39 +0000 (14:26 -0400)]
drm/amd/display: Refactor DPG test pattern logic for ODM cases

[Why]
Current DPG test pattern logic does not account for ODM configuration
changes after test pattern has already been programmed. For example, if
ODM2:1 is enabled after test pattern is already being output, the second
pipe is not programmed to output test pattern, causing half the screen
to be black.

[How]
Move DPG test pattern parameter calculations into separate function.
Whenever ODM pipe configuration changes, re-calculate DPG test pattern
parameters and program DPG if test pattern is currently enabled.

Reviewed-by: Wenjing Liu <wenjing.liu@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: George Shen <george.shen@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Don't set dpms_off for seamless boot
Daniel Miess [Fri, 29 Sep 2023 17:04:33 +0000 (13:04 -0400)]
drm/amd/display: Don't set dpms_off for seamless boot

[Why]
eDPs fail to light up with seamless boot enabled

[How]
When seamless boot is enabled don't configure dpms_off
in disable_vbios_mode_if_required.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Daniel Miess <daniel.miess@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Refactor HWSS into component folder
Mounika Adhuri [Fri, 22 Sep 2023 12:53:28 +0000 (18:23 +0530)]
drm/amd/display: Refactor HWSS into component folder

[why]
Rename hw_sequencer to hwseq.
Move all hwseq files to unique
folder hwss.

[how]
creating hwss repo in dc, and moved the dcnxx_hwseq.c
and .h files into corresponding new folders inside the hwss
and cleared the linkage errors by adding relative paths
in the Makefile.template.

Reviewed-by: Martin Leung <martin.leung@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Mounika Adhuri <moadhuri@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Revert "drm/amd/display: Add a check for idle power optimization"
Sung Joon Kim [Thu, 28 Sep 2023 15:20:13 +0000 (11:20 -0400)]
drm/amd/display: Revert "drm/amd/display: Add a check for idle power optimization"

Revert commit 434cf7af492f ("drm/amd/display: Add a check for idle power optimization")
Because it cause Freesync and S4 regression

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Sung Joon Kim <sungkim@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: add hub->ctx_distance in setup_vmid_config
Yifan Zhang [Thu, 28 Sep 2023 06:02:02 +0000 (14:02 +0800)]
drm/amdgpu: add hub->ctx_distance in setup_vmid_config

add hub->ctx_distance when read CONTEXT1_CNTL, align w/
write back operation.

v2: fix coding style errors reported by checkpatch.pl (Christian)

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Lang Yu <lang.yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Don't use fsleep for PSR exit waits
Nicholas Kazlauskas [Wed, 27 Sep 2023 19:06:41 +0000 (15:06 -0400)]
drm/amd/display: Don't use fsleep for PSR exit waits

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

[How]
Replace the fsleep with a udelay.

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Update cursor limits based on SW cursor fallback limits
Alvin Lee [Wed, 27 Sep 2023 22:39:31 +0000 (18:39 -0400)]
drm/amd/display: Update cursor limits based on SW cursor fallback limits

[Why&How]
For determining the cursor size limit, use the same checks that
are used for determining SW cursor fallback instead of only
using SubVP

Reviewed-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@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>
13 months agodrm/amd/display: Update dml ssb from pmfw clock table
Muhammad Ahmed [Tue, 26 Sep 2023 19:46:21 +0000 (15:46 -0400)]
drm/amd/display: Update dml ssb from pmfw clock table

[why]
Need to use real clock table

[How]
Update the clock table

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@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>
13 months agodrm/amd/display: Update stream mask
Duncan Ma [Wed, 27 Sep 2023 19:17:27 +0000 (15:17 -0400)]
drm/amd/display: Update stream mask

[Why]
Whenever stream changes because of new
pipe arrangements such as ODM. The new
stream mask is not reflected in DMCUB.

The mismatch in stream mask is blocking ips
entry in some scenarios.

[How]
Whenever stream arrangement changes,
update stream mask and notify DMCUB.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Duncan Ma <duncan.ma@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Revert "drm/amd/display: remove duplicated edp relink to fastboot"
Aric Cyr [Tue, 26 Sep 2023 20:15:37 +0000 (16:15 -0400)]
drm/amd/display: Revert "drm/amd/display: remove duplicated edp relink to fastboot"

Revert commit 984abb5384b0 ("drm/amd/display: remove duplicated edp relink to fastboot")

Because it cause 4k EDP not light up on boot

Reviewed-by: Tom Chung <chiahsuan.chung@amd.com>
Cc: Mario Limonciello <mario.limonciello@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@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>
13 months agodrm/amd/display: Modify Vmin default value
Max Tseng [Fri, 22 Sep 2023 08:50:53 +0000 (16:50 +0800)]
drm/amd/display: Modify Vmin default value

Fine tune the Vmin clock value

Reviewed-by: Robin Chen <robin.chen@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Max Tseng <max.tseng@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Update pmfw_driver_if new structure
Charlene Liu [Tue, 26 Sep 2023 19:32:59 +0000 (15:32 -0400)]
drm/amd/display: Update pmfw_driver_if new structure

[why]
pmfw header file updated, need align with data structure.

[How]
Update the data structure.

Reviewed-by: Sung joon Kim <sungjoon.kim@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@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>
13 months agodrm/amd/display: VSIF v3 set Max Refresh Rate
Muhammad Ansari [Mon, 25 Sep 2023 16:00:31 +0000 (12:00 -0400)]
drm/amd/display: VSIF v3 set Max Refresh Rate

[WHY]
FreeSync spec requires PB8 and PB12 to be set to nominal
refresh rate regardless of fixed rate or variable

[HOW]
Removed the condition that checks and overwrites max refresh rate
and set PB8/PB12 to be set to max refresh rate always

Reviewed-by: Anthony Koo <anthony.koo@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Muhammad Ansari <muhammad.ansari@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: Modify SMU message logs
Sung Joon Kim [Tue, 19 Sep 2023 21:04:59 +0000 (17:04 -0400)]
drm/amd/display: Modify SMU message logs

[why]
It's important to make sure SMU messages
are logged by default to improve debugging for
power optimization use cases.

[how]
Change logs to warnings when SMU message
returns non-success id.

Reviewed-by: Charlene Liu <charlene.liu@amd.com>
Acked-by: Tom Chung <chiahsuan.chung@amd.com>
Signed-off-by: Sung Joon Kim <sungkim@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amdgpu: Fix potential null pointer derefernce
Stanley.Yang [Wed, 27 Sep 2023 08:22:29 +0000 (16:22 +0800)]
drm/amdgpu: Fix potential null pointer derefernce

The amdgpu_ras_get_context may return NULL if device
not support ras feature, so add check before using.

Signed-off-by: Stanley.Yang <Stanley.Yang@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agodrm/amd/display: enable S/G display for for recent APUs by default
Yifan Zhang [Wed, 27 Sep 2023 04:56:15 +0000 (12:56 +0800)]
drm/amd/display: enable S/G display for for recent APUs by default

With S/G display becomes stable, enable S/G display for recent APUs
by default rather than white list.

v2: explicitly disable sg on pre-CZ chips (Alex)
v3: add parens for every clause (Alex)

Co-authored-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
13 months agoDocumentation/amdgpu: Add FRU attribute details
Lijo Lazar [Wed, 4 Oct 2023 13:16:06 +0000 (18:46 +0530)]
Documentation/amdgpu: Add FRU attribute details

Add documentation for the newly added manufacturer and fru_id attributes
in sysfs.

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>
13 months agodrm/amdgpu: Add more FRU field information
Lijo Lazar [Wed, 4 Oct 2023 13:02:02 +0000 (18:32 +0530)]
drm/amdgpu: Add more FRU field information

Add support to read Manufacturer Name and FRU File Id fields. Also add
sysfs device attributes for external usage.

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>