platform/kernel/linux-rpi.git
5 years agodrm/amdkfd: Use better name for sdma queue non HWS path
Yong Zhao [Sat, 21 Sep 2019 21:46:03 +0000 (17:46 -0400)]
drm/amdkfd: Use better name for sdma queue non HWS path

The old name is prone to confusion. The register offset is for a RLC queue
rather than a SDMA engine. The value is not a base address, but a
register offset.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Delete useless SDMA register setting on non HWS path
Yong Zhao [Sun, 22 Sep 2019 00:02:57 +0000 (20:02 -0400)]
drm/amdkfd: Delete useless SDMA register setting on non HWS path

HW folks have confirm that we should not touch RESUME_CTX of
SDMA*_GFX_CONTEXT_CNTL when manipulating RLC queues.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: prevent memory leak
Navid Emamdoost [Wed, 25 Sep 2019 04:23:56 +0000 (23:23 -0500)]
drm/amd/display: prevent memory leak

In dcn*_create_resource_pool the allocated memory should be released if
construct pool fails.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Add NAVI12 support from kfd side
shaoyunl [Tue, 24 Sep 2019 22:11:12 +0000 (18:11 -0400)]
drm/amdkfd: Add NAVI12 support from kfd side

Add device info for both navi12 PF and VF

Signed-off-by: shaoyunl <shaoyun.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: restrict hotplug error message
Christian König [Thu, 19 Sep 2019 13:16:49 +0000 (15:16 +0200)]
drm/amdgpu: restrict hotplug error message

We should print the error only when we are hotplugged and crash
basically all userspace applications.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: once more fix amdgpu_bo_create_kernel_at
Christian König [Tue, 24 Sep 2019 11:29:27 +0000 (13:29 +0200)]
drm/amdgpu: once more fix amdgpu_bo_create_kernel_at

When CPU access is needed we should tell that to
amdgpu_bo_create_reserved() or otherwise the access is denied later on.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update arcturus smu-driver interaction header
Evan Quan [Tue, 24 Sep 2019 04:43:51 +0000 (12:43 +0800)]
drm/amd/powerplay: update arcturus smu-driver interaction header

To pair the latest SMU firmware.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add comments in ras interrupt callback
Tao Zhou [Mon, 23 Sep 2019 11:10:19 +0000 (19:10 +0800)]
drm/amdgpu: add comments in ras interrupt callback

add comments to clarify why checking GFX IP BLOCK for each ras interrupt callback

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: implement common gmc_ras_late_init
Tao Zhou [Wed, 18 Sep 2019 10:31:07 +0000 (18:31 +0800)]
drm/amdgpu: implement common gmc_ras_late_init

common gmc_ecc_late_init can be shared among all generations of gmc

v2: rename gmc_ecc_late_init to gmc_ras_late_init

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move xgmi ras fini to xgmi block
Tao Zhou [Wed, 18 Sep 2019 09:58:14 +0000 (17:58 +0800)]
drm/amdgpu: move xgmi ras fini to xgmi block

it's more suitable to put xgmi ras fini in xgmi block

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move mmhub ras fini to mmhub block
Tao Zhou [Wed, 18 Sep 2019 09:51:20 +0000 (17:51 +0800)]
drm/amdgpu: move mmhub ras fini to mmhub block

it's more suitable to put mmhub ras fini in mmhub block

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move umc ras fini to umc block
Tao Zhou [Wed, 18 Sep 2019 09:46:42 +0000 (17:46 +0800)]
drm/amdgpu: move umc ras fini to umc block

it's more suitable to put umc ras fini in umc block

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add ras fini for xgmi
Tao Zhou [Wed, 18 Sep 2019 09:40:06 +0000 (17:40 +0800)]
drm/amdgpu: add ras fini for xgmi

add ras fini for xgmi to cleanup xgmi ras framework

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add ras fini for nbio
Tao Zhou [Wed, 18 Sep 2019 09:30:50 +0000 (17:30 +0800)]
drm/amdgpu: add ras fini for nbio

add a common nbio ras fini implementation to cleanup nbio ras framework

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: simplify the access to eeprom_control struct
Tao Zhou [Wed, 18 Sep 2019 07:26:23 +0000 (15:26 +0800)]
drm/amdgpu: simplify the access to eeprom_control struct

simplify the code of accessing to eeprom_control struct

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove ih_info parameter of gfx_ras_late_init
Tao Zhou [Thu, 19 Sep 2019 03:46:11 +0000 (11:46 +0800)]
drm/amdgpu: remove ih_info parameter of gfx_ras_late_init

gfx_ras_late_init can get the info by itself

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove ih_info parameter of umc_ras_late_init
Tao Zhou [Thu, 12 Sep 2019 10:54:33 +0000 (18:54 +0800)]
drm/amdgpu: remove ih_info parameter of umc_ras_late_init

umc_ras_late_init can get the info by itself

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add common sdma_ras_fini function
Tao Zhou [Thu, 12 Sep 2019 10:19:02 +0000 (18:19 +0800)]
drm/amdgpu: add common sdma_ras_fini function

sdma_ras_fini can be shared among all generations of sdma

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add common gfx_ras_fini function
Tao Zhou [Thu, 12 Sep 2019 09:44:49 +0000 (17:44 +0800)]
drm/amdgpu: add common gfx_ras_fini function

gfx_ras_fini can be shared among all generations of gfx

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add common gmc_ras_fini function
Tao Zhou [Thu, 12 Sep 2019 09:39:47 +0000 (17:39 +0800)]
drm/amdgpu: add common gmc_ras_fini function

gmc_ras_fini can be shared among all generations of gmc

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move mmhub_ras_if from gmc to mmhub block
Tao Zhou [Thu, 12 Sep 2019 09:21:46 +0000 (17:21 +0800)]
drm/amdgpu: move mmhub_ras_if from gmc to mmhub block

mmhub_ras_if is relevant to mmhub

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: replace mmhub_funcs with mmhub.funcs
Tao Zhou [Thu, 12 Sep 2019 09:12:21 +0000 (17:12 +0800)]
drm/amdgpu: replace mmhub_funcs with mmhub.funcs

remove mmhub_funcs in adev

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add common mmhub member for adev
Tao Zhou [Thu, 12 Sep 2019 09:03:14 +0000 (17:03 +0800)]
drm/amdgpu: add common mmhub member for adev

put mmhub_funcs and ras_if pointer into mmhub struct

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move umc_ras_if from gmc to umc block
Tao Zhou [Thu, 12 Sep 2019 08:34:08 +0000 (16:34 +0800)]
drm/amdgpu: move umc_ras_if from gmc to umc block

umc_ras_if is relevant to umc

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: refine sdma4 ras_data_cb
Tao Zhou [Tue, 17 Sep 2019 11:01:38 +0000 (19:01 +0800)]
drm/amdgpu: refine sdma4 ras_data_cb

simplify code logic and refine return value

v2: remove unused error source code

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move sdma ecc functions to generic sdma file
Tao Zhou [Thu, 12 Sep 2019 06:28:18 +0000 (14:28 +0800)]
drm/amdgpu: move sdma ecc functions to generic sdma file

sdma ras ecc functions can be reused among all sdma generations

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move gfx ecc functions to generic gfx file
Tao Zhou [Thu, 12 Sep 2019 06:06:35 +0000 (14:06 +0800)]
drm/amdgpu: move gfx ecc functions to generic gfx file

gfx ras ecc common functions could be reused among all gfx generations

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move umc ras irq functions to umc block
Tao Zhou [Thu, 12 Sep 2019 03:11:25 +0000 (11:11 +0800)]
drm/amdgpu: move umc ras irq functions to umc block

move umc ras irq functions from gmc v9 to generic umc block, these
functions are relevant to umc and they can be shared among all
generations of umc

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: update parameter of ras_ih_cb
Tao Zhou [Thu, 12 Sep 2019 05:38:44 +0000 (13:38 +0800)]
drm/amdgpu: update parameter of ras_ih_cb

change struct ras_err_data *err_data to void *err_data, align with
umc code and the callback's declaration in each ras block could
pay no attention to the structure type

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix an UMC hw arbitrator bug(v3)
Monk Liu [Tue, 24 Sep 2019 08:08:00 +0000 (16:08 +0800)]
drm/amdgpu: fix an UMC hw arbitrator bug(v3)

issue:
the UMC6 h/w bug is that when MCLK is doing the switch
in the middle of a page access being preempted by high
priority client (e.g. DISPLAY) then UMC and the mclk switch
would stuck there due to deadlock

how:
fixed by disabling auto PreChg for UMC to avoid high
priority client preempting other client's access on
the same page, thus the deadlock could be avoided

v2:
put the patch in callback of UMC6
v3:
rename the callback to "init_registers"

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <hawking.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove gfx9 NGG
Marek Olšák [Fri, 20 Sep 2019 02:04:43 +0000 (22:04 -0400)]
drm/amdgpu: remove gfx9 NGG

Never used.

Signed-off-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/atomfirmware: simplify the interface to get vram info
Alex Deucher [Mon, 23 Sep 2019 20:12:46 +0000 (15:12 -0500)]
drm/amdgpu/atomfirmware: simplify the interface to get vram info

fetch both the vram type and width in one function call.  This
avoids having to parse the same data table twice to get the two
pieces of data.

Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/atomfirmware: use proper index for querying vram type (v3)
Alex Deucher [Fri, 20 Sep 2019 19:43:44 +0000 (14:43 -0500)]
drm/amdgpu/atomfirmware: use proper index for querying vram type (v3)

The index is stored in scratch register 4 after asic init.  Use
that index.  No functional change since all asics in a family
use the same type of vram (G5, G6, HBM) and that is all we use
at the monent, but if we ever need to query other info, we will
now have the proper index.

v2: module array is variable sized, handle that.
v3: fix off by one in array handling

Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/display: include slab.h in dcn21_resource.c
Alex Deucher [Mon, 23 Sep 2019 20:56:25 +0000 (15:56 -0500)]
drm/amdgpu/display: include slab.h in dcn21_resource.c

It's apparently needed in some configurations.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: silence response status warning
Shirish S [Tue, 24 Sep 2019 09:15:54 +0000 (14:45 +0530)]
drm/amdgpu/psp: silence response status warning

log the response status related error to the driver's
debug log since  psp response status is not 0 even though
there was no problem while the command was submitted.

This warning misleads, hence this change.

Signed-off-by: Shirish S <shirish.s@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: remove duplicate macro of smu_get_uclk_dpm_states
Kevin Wang [Mon, 23 Sep 2019 07:36:11 +0000 (15:36 +0800)]
drm/amd/powerplay: remove duplicate macro of smu_get_uclk_dpm_states

remove duplicate macro of smu_get_uclk_dpm_states

fix commit:
drm/amd/powerplay: add the interface for getting ultimate frequency v3

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Kenneth Feng <kenneth.feng@amd.com>
Reviewed-by: Prike Liang <Prike.Liang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/amdgpu:Fix compute ring unable to detect hang.
Jesse Zhang [Tue, 30 Jul 2019 11:15:42 +0000 (19:15 +0800)]
drm/amd/amdgpu:Fix compute ring unable to detect hang.

When compute fence did not signal, compute ring cannot detect hardware hang
because its timeout value is set to be infinite by default.

In SR-IOV and passthrough mode, if user does not declare custome timeout
value for compute ring, then use gfx ring timeout value as default. So
that when there is a ture hardware hang, compute ring can detect it.

Signed-off-by: Jesse Zhang <zhexi.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Use mode2 mode to perform GPU RESET for Renoir
chen gong [Thu, 19 Sep 2019 07:02:40 +0000 (15:02 +0800)]
drm/amdgpu: Use mode2 mode to perform GPU RESET for Renoir

Renoir need to use mode2 mode to implement GPU RESET

Signed-off-by: chen gong <curry.gong@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: A workaround to GPU RESET on APU
chen gong [Mon, 23 Sep 2019 07:02:56 +0000 (15:02 +0800)]
drm/amd/powerplay: A workaround to GPU RESET on APU

Changes to function "smu_suspend" in amdgpu_smu.c is a workaround.

We should get real information about if baco is enabled or not, while we
always consider APU SMU feature as enabled in current code.

I know APU do not support baco mode for GPU reset, so I use
"adev->flags" to skip function "smu_feature_is_enabled".

Signed-off-by: chen gong <curry.gong@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Add mode2 mode for GPU RESET in SMU
chen gong [Mon, 23 Sep 2019 06:56:43 +0000 (14:56 +0800)]
drm/amd/powerplay: Add mode2 mode for GPU RESET in SMU

Renoir need to use mode2 mode to implement GPU RESET

Signed-off-by: chen gong <curry.gong@amd.com>
Reviewed-by: Aaron Liu <aaron.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Sync gfx10 kfd2kgd_calls function pointers
Yong Zhao [Mon, 23 Sep 2019 19:53:13 +0000 (15:53 -0400)]
drm/amdkfd: Sync gfx10 kfd2kgd_calls function pointers

get_hive_id was not set. Also, adjust the function setting sequence.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Fix NULL pointer dereference for set_scratch_backing_va()
Yong Zhao [Wed, 18 Sep 2019 22:17:57 +0000 (18:17 -0400)]
drm/amdkfd: Fix NULL pointer dereference for set_scratch_backing_va()

Currently this function pointer is missing for GFX10. Considering it is
a void function since GFX9, fix it by checking the function pointer
before dereferencing it.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Remove unnecessary pm_init() for non HWS mode
Yong Zhao [Wed, 23 Jan 2019 01:09:17 +0000 (20:09 -0500)]
drm/amdkfd: Remove unnecessary pm_init() for non HWS mode

The packet manager is not needed for non HWS mode except Hawaii, so only
initialize it for Hawaii under non HWS mode. This will simplify debugging
under non HWS mode for all new asics, because it eliminates one variable
out of the equation in non HWS mode

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Remove excessive print when reserving doorbells
Yong Zhao [Sat, 21 Sep 2019 06:01:50 +0000 (02:01 -0400)]
drm/amdkfd: Remove excessive print when reserving doorbells

The dozens of printing messages are compressed into 2 lines.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Add an error print if SDMA RLC is not idle
Yong Zhao [Thu, 19 Sep 2019 16:42:34 +0000 (12:42 -0400)]
drm/amdkfd: Add an error print if SDMA RLC is not idle

The message will be useful when troubleshooting the issues.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/display: fix 64 bit divide
Alex Deucher [Fri, 20 Sep 2019 20:13:24 +0000 (15:13 -0500)]
drm/amdgpu/display: fix 64 bit divide

Use proper helper for 32 bit.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: correct condition check for psp rlc autoload
Le Ma [Mon, 23 Sep 2019 13:09:38 +0000 (21:09 +0800)]
drm/amdgpu: correct condition check for psp rlc autoload

Otherwise non-autoload case will go into the wrong routine and fail.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Le Ma <le.ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add command id in psp response failure message
Hawking Zhang [Mon, 23 Sep 2019 12:41:04 +0000 (20:41 +0800)]
drm/amdgpu: add command id in psp response failure message

For better clarification of issue.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Le Ma <Le.Ma@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable psp front door loading by default on Arcturus
Le Ma [Mon, 23 Sep 2019 06:10:55 +0000 (14:10 +0800)]
drm/amdgpu: enable psp front door loading by default on Arcturus

Front door firmware loading is done via the psp rather than the
driver.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: disable vcn ip block for front door loading on Arcturus
Le Ma [Mon, 23 Sep 2019 04:25:03 +0000 (12:25 +0800)]
drm/amdgpu: disable vcn ip block for front door loading on Arcturus

Needs more work to enable via front door loading.

Signed-off-by: Le Ma <le.ma@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/gfx10: add support for wks firmware loading
Tianci.Yin [Thu, 12 Sep 2019 09:40:22 +0000 (17:40 +0800)]
drm/amdgpu/gfx10: add support for wks firmware loading

load different cp firmware according to the DID and RID

Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: fix a potential NULL pointer dereference (v2)
Allen Pais [Wed, 18 Sep 2019 16:30:31 +0000 (22:00 +0530)]
drm/amdkfd: fix a potential NULL pointer dereference (v2)

alloc_workqueue is not checked for errors and as a result,
a potential NULL dereference could occur.

v2 (Felix Kuehling):
* Fix compile error (kfifo_free instead of fifo_free)
* Return proper error code

Signed-off-by: Allen Pais <allen.pais@oracle.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/ras: fix and update the documentation for RAS
Alex Deucher [Thu, 19 Sep 2019 20:09:56 +0000 (15:09 -0500)]
drm/amdgpu/ras: fix and update the documentation for RAS

Add new sections to amdgpu.rst, fix up formatting issues,
add additional documentation to each section.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix documentation for amdgpu_pm.c
Alex Deucher [Thu, 19 Sep 2019 20:03:27 +0000 (15:03 -0500)]
drm/amdgpu: fix documentation for amdgpu_pm.c

Fix DOC link name, clean up formatting in pp_dpm_* section.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/ih: fix documentation in amdgpu_irq_dispatch
Alex Deucher [Thu, 19 Sep 2019 19:40:57 +0000 (14:40 -0500)]
drm/amdgpu/ih: fix documentation in amdgpu_irq_dispatch

Fix parameters.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/vm: fix up documentation in amdgpu_vm.c
Alex Deucher [Thu, 19 Sep 2019 19:39:08 +0000 (14:39 -0500)]
drm/amdgpu/vm: fix up documentation in amdgpu_vm.c

Missing parameters, wrong comment type, etc.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/mn: fix documentation for amdgpu_mn_read_lock
Alex Deucher [Thu, 19 Sep 2019 19:24:11 +0000 (14:24 -0500)]
drm/amdgpu/mn: fix documentation for amdgpu_mn_read_lock

Document the new parameter.

Fixes: 93065ac753e4 ("mm, oom: distinguish blockable mode for mmu notifiers")
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix documentation for amdgpu_gem_prime_export
Alex Deucher [Thu, 19 Sep 2019 19:18:10 +0000 (14:18 -0500)]
drm/amdgpu: fix documentation for amdgpu_gem_prime_export

Drop extra function parameter.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display; Fix kernel doc warnings
Harry Wentland [Wed, 18 Sep 2019 15:42:59 +0000 (11:42 -0400)]
drm/amd/display; Fix kernel doc warnings

We had a couple of missing definitions and formatting errors.

v2: Fix 'notifying' type

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove excess function parameter description
yu kuai [Thu, 19 Sep 2019 14:09:09 +0000 (22:09 +0800)]
drm/amdgpu: remove excess function parameter description

Fixes gcc warning:

drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c:431: warning: Excess function
parameter 'sw' description in 'vcn_v2_5_disable_clock_gating'
drivers/gpu/drm/amd/amdgpu/vcn_v2_5.c:550: warning: Excess function
parameter 'sw' description in 'vcn_v2_5_enable_clock_gating'

Fixes: cbead2bdfcf1 ("drm/amdgpu: add VCN2.5 VCPU start and stop")
Signed-off-by: yu kuai <yukuai3@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: hide an unused variable
Arnd Bergmann [Wed, 18 Sep 2019 19:53:58 +0000 (21:53 +0200)]
drm/amd/display: hide an unused variable

Without CONFIG_DEBUG_FS, we get a warning for an unused
variable:

drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:6020:33: error: unused variable 'source' [-Werror,-Wunused-variable]

Hide the variable in an #ifdef like its only users.

Fixes: 14b2584636c6 ("drm/amd/display: add functionality to grab DPRX CRC entries.")
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable full ras by default
Guchun Chen [Thu, 19 Sep 2019 03:08:58 +0000 (11:08 +0800)]
drm/amdgpu: enable full ras by default

Enable full ras by default, user does not need to enable it by
boot parameter.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/SRIOV: add navi12 pci id for SRIOV (v2)
Jiange Zhao [Thu, 19 Sep 2019 18:22:59 +0000 (13:22 -0500)]
drm/amdgpu/SRIOV: add navi12 pci id for SRIOV (v2)

Add Navi12 PCI id support.

v2: flag as experimental for now (Alex)

Signed-off-by: Jiange Zhao <Jiange.Zhao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/gfx10: update gfx golden settings for navi14
Tianci.Yin [Thu, 22 Aug 2019 07:09:29 +0000 (15:09 +0800)]
drm/amdgpu/gfx10: update gfx golden settings for navi14

update registers: mmUTCL1_CTRL

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/gfx10: update gfx golden settings
Tianci.Yin [Thu, 22 Aug 2019 07:00:08 +0000 (15:00 +0800)]
drm/amdgpu/gfx10: update gfx golden settings

update registers: mmUTCL1_CTRL

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: flag navi12 and 14 as experimental for 5.4
Alex Deucher [Tue, 17 Sep 2019 19:49:53 +0000 (14:49 -0500)]
drm/amdgpu: flag navi12 and 14 as experimental for 5.4

We can remove this later as things get closer to launch.

Reviewed-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: invalidate the hdp read cache before reading the psp response
Alex Deucher [Tue, 17 Sep 2019 20:17:41 +0000 (15:17 -0500)]
drm/amdgpu/psp: invalidate the hdp read cache before reading the psp response

Otherwise we may get stale data.

Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: flush HDP write fifo after submitting cmds to the psp
Alex Deucher [Tue, 17 Sep 2019 20:12:18 +0000 (15:12 -0500)]
drm/amdgpu/psp: flush HDP write fifo after submitting cmds to the psp

We need to make sure the fifo is flushed before we ask the psp to
process the commands.

Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove redundant variable definition
Guchun Chen [Wed, 18 Sep 2019 03:33:19 +0000 (11:33 +0800)]
drm/amdgpu: remove redundant variable definition

No need to define the same variables in each loop of the function.

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: avoid null pointer dereference
Guchun Chen [Tue, 17 Sep 2019 09:49:29 +0000 (17:49 +0800)]
drm/amdgpu: avoid null pointer dereference

null ptr should be checked first to avoid null ptr access

Signed-off-by: Guchun Chen <guchun.chen@amd.com>
Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/powerplay: add new mapping for APCC_DFLL feature
Xiaojie Yuan [Wed, 11 Sep 2019 11:09:27 +0000 (19:09 +0800)]
drm/amdgpu/powerplay: add new mapping for APCC_DFLL feature

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: do not init mec2 jt for renoir
Hawking Zhang [Tue, 17 Sep 2019 22:46:54 +0000 (06:46 +0800)]
drm/amdgpu: do not init mec2 jt for renoir

For ASICs like renoir/arct, driver doesn't need to load mec2 jt.
when mec1 jt is loaded, mec2 jt will be loaded automatically
since the write is actaully broadcasted to both.

We need to more time to test other gfx9 asic. but for now we should
be able to draw conclusion that mec2 jt is not needed for renoir and
arct.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add psp ip block for arct
Hawking Zhang [Tue, 17 Sep 2019 20:05:34 +0000 (04:05 +0800)]
drm/amdgpu: add psp ip block for arct

enable psp block for firmware loading and other security
feature setup.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Restore backlight brightness after system resume
Kai-Heng Feng [Mon, 2 Sep 2019 08:33:42 +0000 (16:33 +0800)]
drm/amd/display: Restore backlight brightness after system resume

Laptops with AMD APU doesn't restore display backlight brightness after
system resume.

This issue started when DC was introduced.

Let's use BL_CORE_SUSPENDRESUME so the backlight core calls
update_status callback after system resume to restore the backlight
level.

Tested on Dell Inspiron 3180 (Stoney Ridge) and Dell Latitude 5495
(Raven Ridge).

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/ras: use GPU PAGE_SIZE/SHIFT for reserving pages
Alex Deucher [Tue, 17 Sep 2019 13:11:24 +0000 (08:11 -0500)]
drm/amdgpu/ras: use GPU PAGE_SIZE/SHIFT for reserving pages

We are reserving vram pages so they should be aligned to the
GPU page size.

Reviewed-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/discovery: get gpu info from ip discovery table
Xiaojie Yuan [Wed, 11 Sep 2019 03:41:05 +0000 (11:41 +0800)]
drm/amdgpu/discovery: get gpu info from ip discovery table

except soc_bounding_box which is not integrated in discovery table yet

Signed-off-by: Xiaojie Yuan <xiaojie.yuan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use GPU PAGE SHIFT for umc retired page
Tao Zhou [Tue, 17 Sep 2019 03:36:05 +0000 (11:36 +0800)]
drm/amdgpu: use GPU PAGE SHIFT for umc retired page

umc retired page belongs to vram and it should be aligned to gpu page
size

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement VCN power gating control interface
Prike Liang [Mon, 16 Sep 2019 07:56:52 +0000 (15:56 +0800)]
drm/amd/powerplay: implement VCN power gating control interface

VCN Gate/Ungate by processing the SMU power up/down message, otherwise
S3 will resume failed as JPEG always power off during start VCN stage.

Signed-off-by: Prike Liang <Prike.Liang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add navi12 pci id
Tianci.Yin [Tue, 17 Sep 2019 02:35:34 +0000 (10:35 +0800)]
drm/amdgpu: add navi12 pci id

Add Navi12 PCI id support.

Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Tianci.Yin <tianci.yin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: replace DRM_ERROR with DRM_WARN in ras_reserve_bad_pages
Tao Zhou [Thu, 12 Sep 2019 10:57:23 +0000 (18:57 +0800)]
drm/amdgpu: replace DRM_ERROR with DRM_WARN in ras_reserve_bad_pages

There are two cases of reserve error should be ignored:
1) a ras bad page has been allocated (used by someone);
2) a ras bad page has been reserved (duplicate error injection for one page);

DRM_ERROR is unnecessary for the failure of bad page reserve

Signed-off-by: Tao Zhou <tao.zhou1@amd.com>
Reviewed-by: Guchun Chen <guchun.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodocs: drm/amdgpu: Resolve build warnings
Adam Zerella [Sat, 14 Sep 2019 12:56:16 +0000 (22:56 +1000)]
docs: drm/amdgpu: Resolve build warnings

Some of the documentation formatting could be improved
which will resolve some Sphinx amdgpu build warnings e.g

WARNING: Unexpected indentation.
WARNING: Block quote ends without a blank line; unexpected unindent.
WARNING: Inline emphasis start-string without end-string.

Signed-off-by: Adam Zerella <adam.zerella@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/vm: fix documentation for amdgpu_vm_bo_param
Alex Deucher [Mon, 16 Sep 2019 18:21:32 +0000 (13:21 -0500)]
drm/amdgpu/vm: fix documentation for amdgpu_vm_bo_param

Add new parameters.

Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdkfd: Delete unused KFD_IS_* macro
Yong Zhao [Mon, 16 Sep 2019 16:24:38 +0000 (12:24 -0400)]
drm/amdkfd: Delete unused KFD_IS_* macro

These were deleted before, but somehow showed up again. Delete them again.

Signed-off-by: Yong Zhao <Yong.Zhao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add hdcp to Kconfig
Bhawanpreet Lakha [Wed, 7 Aug 2019 15:23:30 +0000 (11:23 -0400)]
drm/amd/display: Add hdcp to Kconfig

[Why]
HDCP is not fully finished, so we need to be able to
build and run the driver without it.

[How]
Add a Kconfig to toggle it

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: only enable HDCP for DCN+
Bhawanpreet Lakha [Mon, 24 Jun 2019 18:54:13 +0000 (14:54 -0400)]
drm/amd/display: only enable HDCP for DCN+

[Why]
We don't support HDCP for pre RAVEN asics

[How]
Check if we are RAVEN+. Use this to attach the content_protection
property, this way usermode can't try to enable HDCP on pre DCN asics.

Also we need to update the module on hpd so guard it aswell

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Update CP property based on HW query
Bhawanpreet Lakha [Mon, 10 Jun 2019 20:06:05 +0000 (16:06 -0400)]
drm/amd/display: Update CP property based on HW query

[Why]
We need to use HW state to set content protection to ENABLED.
This way we know that the link is encrypted from the HW side

[How]
Create a workqueue that queries the HW every ~2seconds, and sets it to
ENABLED or DESIRED based on the result from the hardware

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: handle DP cpirq
Bhawanpreet Lakha [Mon, 10 Jun 2019 20:18:38 +0000 (16:18 -0400)]
drm/amd/display: handle DP cpirq

[Why]
This is needed for DP as DP can send us info using irq.

[How]
Check if irq bit is set on short pulse and call the
function that handles cpirq in amdgpu_dm_hdcp

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Handle Content protection property changes
Bhawanpreet Lakha [Mon, 16 Sep 2019 20:52:58 +0000 (15:52 -0500)]
drm/amd/display: Handle Content protection property changes

[Why]
We need to manage the content protection property changes for
different usecase, once cp is DESIRED we need to maintain the
ENABLED/DESIRED status for different cases.

[How]
1. Attach the content_protection property

2. HDCP enable (UNDESIRED -> DESIRED)
call into the module with the correct parameters to start
hdcp. Set cp to ENABLED

3. HDCP disable (ENABLED -> UNDESIRED)
Call the module to disable hdcp.

3. Handle Special cases (Hotplug, S3, headless S3, DPMS)
If already ENABLED: set to DESIRED on unplug/suspend/dpms,
and disable hdcp

Then on plugin/resume/dpms: enable HDCP

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Initialize HDCP work queue
Bhawanpreet Lakha [Fri, 24 May 2019 19:44:20 +0000 (15:44 -0400)]
drm/amd/display: Initialize HDCP work queue

[Why]
We need this to enable HDCP on linux, as we need events to interact
with the hdcp module

[How]
Add work queue to display manager and handle the creation and destruction
of the queue

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Create dpcd and i2c packing functions
Bhawanpreet Lakha [Thu, 16 May 2019 15:57:52 +0000 (11:57 -0400)]
drm/amd/display: Create dpcd and i2c packing functions

[Why]
We need to read and write specific i2c and dpcd messages.

[How]
Created static functions for packing the dpcd and i2c messages for hdcp.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Create amdgpu_dm_hdcp
Bhawanpreet Lakha [Tue, 14 May 2019 17:20:19 +0000 (13:20 -0400)]
drm/amd/display: Create amdgpu_dm_hdcp

[Why]
We need to interact with the hdcp module from the DM, the module
has to be interacted with in terms of events

[How]
Create the files needed for linux hdcp. These files manage the events
needed for the dm to interact with the hdcp module.

We use the kernel work queue to process the events needed for
the module

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Update hdcp display config
Bhawanpreet Lakha [Tue, 6 Aug 2019 21:43:53 +0000 (17:43 -0400)]
drm/amd/display: Update hdcp display config

[Why]
We need to update the hdcp display parameter whenever the link is
updated, so the next time there is an update to hdcp we have the
latest display info

[How]
Create a callback, and use this anytime there is a change in the link. This will
be used later by the dm.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add PSP block to verify hdcp steps
Bhawanpreet Lakha [Tue, 6 Aug 2019 22:04:44 +0000 (18:04 -0400)]
drm/amd/display: add PSP block to verify hdcp steps

[Why]
All the HDCP transactions should be verified using PSP.

[How]
This patch calls psp with the correct inputs to verify the steps
of authentication.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add HDCP module
Bhawanpreet Lakha [Tue, 6 Aug 2019 21:52:01 +0000 (17:52 -0400)]
drm/amd/display: Add HDCP module

This module manages HDCP for amdgpu driver. The module behaves as a
state machine which handles the different authentication states of HDCP

The module is divided into 3 major components
+--------+
| Hdcp.c |
+--------+
Manages the state machine, sends the events to be executed and communicates
with the dm

+-----------+
|Execution.c|
+-----------+
This executes events based on the current state. Also generates
execution results as transition inputs

+------------+
|Transition.c|
+------------+
Decides the next state based on the input and makes requests to
hdcp.c to handle.
                                +-------------+
                        ------> | Execution.c | ------
                        |       +-------------+       |
                        |                             V
+----+              +--------+                 +--------------+
| DM |    ----->    | Hdcp.c |  <------------  | Transition.c |
+----+    <-----    +--------+                 +--------------+

v2: Drop unused function definitions

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Wenjing Liu <Wenjing.Liu@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: psp DTM init
Bhawanpreet Lakha [Wed, 19 Jun 2019 18:40:58 +0000 (14:40 -0400)]
drm/amdgpu: psp DTM init

DTM is the display topology manager. This is needed to communicate with
psp about the display configurations.

This patch adds
    -Loading the firmware
    -The functions and definitions for communication with the firmware

v2: Fix formatting

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: psp HDCP init
Bhawanpreet Lakha [Wed, 19 Jun 2019 18:37:29 +0000 (14:37 -0400)]
drm/amdgpu: psp HDCP init

This patch adds
-Loading the firmware
-The functions and definitions for communication with the firmware

v2: Fix formatting

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Improve LFC behaviour
Aric Cyr [Tue, 3 Sep 2019 22:18:08 +0000 (18:18 -0400)]
drm/amd/display: Improve LFC behaviour

[Why]
There can be some unsynchronized frames when entering/exiting
LFC.  This may cause tearing or stuttering at such transitions.

[How]
Add a enter/exit margin to algorithm to smoothly transition into
and out of LFC without desynchronizing frames.

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Reza Amini <Reza.Amini@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Acked-by: Sivapiriyan Kumarasamy <Sivapiriyan.Kumarasamy@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add detile buffer size for DCN20
Dmytro Laktyushkin [Tue, 3 Sep 2019 18:10:28 +0000 (14:10 -0400)]
drm/amd/display: Add detile buffer size for DCN20

Detile buffer size affects dcc caps and therefore needs to be
corrected for each ip.

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Chris Park <Chris.Park@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix use of uninitialized variable
Martin Leung [Tue, 3 Sep 2019 19:22:30 +0000 (15:22 -0400)]
drm/amd/display: fix use of uninitialized variable

tg_inst may be used uninitialized, so initialize it to 0.

Signed-off-by: Martin Leung <martin.leung@amd.com>
Reviewed-by: Jaehyun Chung <Jaehyun.Chung@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.51.1
Aric Cyr [Tue, 3 Sep 2019 19:54:43 +0000 (15:54 -0400)]
drm/amd/display: 3.2.51.1

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>