OSDN Git Service

uclinux-h8/linux.git
5 years agodrm/amdgpu: cleanup VM handling in the CS a bit
Christian König [Fri, 17 Aug 2018 13:07:13 +0000 (15:07 +0200)]
drm/amdgpu: cleanup VM handling in the CS a bit

Add a helper function for getting the root PD addr and cleanup join the
two VM related functions and cleanup the function name.

No functional change.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: validate the VM root PD from the VM code
Christian König [Wed, 15 Aug 2018 17:10:40 +0000 (19:10 +0200)]
drm/amdgpu: validate the VM root PD from the VM code

Preparation for following changes. This validates the root PD twice,
but the overhead of that should be minimal.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: cleanup GPU recovery check a bit (v2)
Christian König [Tue, 21 Aug 2018 08:45:29 +0000 (10:45 +0200)]
drm/amdgpu: cleanup GPU recovery check a bit (v2)

Check if we should call the function instead of providing the forced
flag.

v2: rebase on KFD changes (Alex)

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: amdgpu_kiq_reg_write_reg_wait() can be static
kbuild test robot [Wed, 22 Aug 2018 02:31:01 +0000 (10:31 +0800)]
drm/amdgpu: amdgpu_kiq_reg_write_reg_wait() can be static

Fixes: d790449835e6 ("drm/amdgpu: use kiq to do invalidate tlb")
Reviewed-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/display: add support for LVDS (v5)
Alex Deucher [Tue, 14 Aug 2018 19:53:52 +0000 (14:53 -0500)]
drm/amdgpu/display: add support for LVDS (v5)

This adds support for LVDS displays.

v2: add support for spread spectrum, sink detect
v3: clean up enable_lvds_output
v4: fix up link_detect
v5: remove assert on 888 format

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=105880
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Don't use kiq in gpu reset
Emily Deng [Wed, 22 Aug 2018 12:32:23 +0000 (20:32 +0800)]
drm/amdgpu: Don't use kiq in gpu reset

When in gpu reset, don't use kiq, it will generate more TDR.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>.
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: avoid redundant shifting of the entity v2
Nayan Deshmukh [Tue, 21 Aug 2018 13:29:08 +0000 (18:59 +0530)]
drm/scheduler: avoid redundant shifting of the entity v2

do not remove entity from the rq if the current rq is from
the least loaded scheduler.

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: indent an if statement
Dan Carpenter [Tue, 14 Aug 2018 09:09:45 +0000 (12:09 +0300)]
drm/amd/display: indent an if statement

The if statement isn't indented and it makes static checkers complain.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix a compile warning
Wen Yang [Fri, 17 Aug 2018 03:09:48 +0000 (11:09 +0800)]
drm/amd/display: fix a compile warning

Fix comile warning like,
  CC [M]  drivers/gpu/drm/i915/gvt/execlist.o
  CC [M]  drivers/gpu/drm/nouveau/nvkm/subdev/instmem/nv50.o
  CC [M]  drivers/gpu/drm/radeon/btc_dpm.o
  CC [M]  drivers/isdn/hisax/avm_a1p.o
  CC [M]  drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_dpp.o
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c: In function ‘dcn10_update_mpcc’:
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c:1903:9: warning: missing braces around initializer [-Wmissing-braces]
  struct mpcc_blnd_cfg blnd_cfg = {0};
         ^
drivers/gpu/drm/amd/amdgpu/../display/dc/dcn10/dcn10_hw_sequencer.c:1903:9: warning: (near initialization for ‘blnd_cfg.black_color’) [-Wmissing-braces]

Acked-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Wen Yang <wen.yang99@zte.com.cn>
Reviewed-by: Jiang Biao <jiang.biao2@zte.com.cn>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/sriov: Only sriov runtime support use kiq
Emily Deng [Tue, 21 Aug 2018 10:51:38 +0000 (18:51 +0800)]
drm/amdgpu/sriov: Only sriov runtime support use kiq

For sriov, don't use kiq in exclusive mode, as don't know how long time
it will take, some times it will occur exclusive timeout.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix sdma doorbell range setting
Evan Quan [Tue, 21 Aug 2018 06:51:53 +0000 (14:51 +0800)]
drm/amdgpu: fix sdma doorbell range setting

Use the old doorbell range setting until the driver is
able to support more sdma queues.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Fix compile warning
Rex Zhu [Mon, 20 Aug 2018 12:19:18 +0000 (20:19 +0800)]
drm/amdgpu: Fix compile warning

In function ‘gfx_v9_0_check_fw_write_wait’:
warning: enumeration value ‘CHIP_TAHITI’ not handled in switch [-Wswitch]

Always add default case in case there is no match

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: rework ctx entity creation
Christian König [Wed, 1 Aug 2018 14:00:52 +0000 (16:00 +0200)]
drm/amdgpu: rework ctx entity creation

Use a fixed number of entities for each hardware IP.

The number of compute entities is reduced to four, SDMA keeps it two
entities and all other engines just expose one entity.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: cleanup HW_IP query
Christian König [Wed, 1 Aug 2018 11:52:25 +0000 (13:52 +0200)]
drm/amdgpu: cleanup HW_IP query

Move the code into a separate function.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: Add stopped flag to drm_sched_entity
Andrey Grodzovsky [Fri, 17 Aug 2018 14:32:50 +0000 (10:32 -0400)]
drm/scheduler: Add stopped flag to drm_sched_entity

The flag will prevent another thread from same process to
reinsert the entity queue into scheduler's rq after it was already
removewd from there by another thread during drm_sched_entity_flush.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove fulll access for suspend phase1
Yintian Tao [Thu, 16 Aug 2018 08:17:57 +0000 (16:17 +0800)]
drm/amdgpu: remove fulll access for suspend phase1

There is no need for gpu full access for suspend phase1
because under virtualization there is no hw register access
for dce block.

Signed-off-by: Yintian Tao <yttao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use kiq to do invalidate tlb
Emily Deng [Fri, 17 Aug 2018 10:25:36 +0000 (18:25 +0800)]
drm/amdgpu: use kiq to do invalidate tlb

To avoid the tlb flush not interrupted by world switch, use kiq and one
command to do tlb invalidate.

v2:
Refine the invalidate lock position.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Reviewed-and-Tested-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Remove the sriov checking and add firmware checking
Emily Deng [Fri, 17 Aug 2018 10:26:41 +0000 (18:26 +0800)]
drm/amdgpu: Remove the sriov checking and add firmware checking

Unify bare metal and sriov, and add firmware checking for
reg write and reg wait unify command.

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: implement DPMS DTN test v2
Jun Lei [Wed, 8 Aug 2018 15:53:39 +0000 (11:53 -0400)]
drm/amd/display: implement DPMS DTN test v2

[why]
Existing DTN infrastructure in driver is hacky.  It uses implicit log
names, and also incorrect escape ID.

[how]
- Implement using generic DTN escape ID.
- Move file logging functionality from driver to to script; driver now outputs to string/buffer
- Move HWSS debug functionality to separate c file
- Add debug functionalty for per-block logging as CSV
- Add pretty print in python

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: move edp fast boot optimization flag to stream
Anthony Koo [Tue, 21 Aug 2018 19:28:05 +0000 (14:28 -0500)]
drm/amd/display: move edp fast boot optimization flag to stream

[Why]
During S4/S3 stress test it is possible to resume from S4 without
calling mode set on eDP, meaning high level optimization flag is not
reset. If this is followed by an S3 resume call, driver will see
optimization flag is set and consume it and think backend is powered
on when in fact it is not.

This results in PHY being off in sequence where
S4->Resume->S3->Resume->ApplyOpt->black screen.

[How]
Move optimization flag to stream instead of a DC flag.

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Combine dce80 and dce100 i2c hw functions
David Francis [Thu, 9 Aug 2018 17:15:36 +0000 (13:15 -0400)]
drm/amd/display: Combine dce80 and dce100 i2c hw functions

[Why]
There are two versions of the hw function pointers: one for dce80
and one for all other versions.  These paired functions are
nearly identical.  dce80 and dce100 should not require
different i2c access functions.

[How]
Combine each pair of functions into a single function.  Mostly
the new functions are based on the dce100 versions as those
versions are newer, support more features, and
were more maintained.

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Define registers for dcn10
Nikola Cornij [Fri, 13 Jul 2018 22:19:07 +0000 (18:19 -0400)]
drm/amd/display: Define registers for dcn10

Define register for dcn10 for future changes

Signed-off-by: Nikola Cornij <nikola.cornij@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Program csc matrix as part of stream update
SivapiriyanKumarasamy [Thu, 26 Jul 2018 18:58:35 +0000 (14:58 -0400)]
drm/amd/display: Program csc matrix as part of stream update

Add csc_transform struct to dc_stream_update, and program if set when
updating streams

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Create new i2c resource
David Francis [Mon, 23 Jul 2018 18:12:10 +0000 (14:12 -0400)]
drm/amd/display: Create new i2c resource

[Why]
I2C code did not match dc resource model and was generally
unpleasant

[How]
Move code into new svelte dce_i2c files, replacing various i2c
objects with two structs: dce_i2c_sw and dce_i2c_hw.  Fully split
sw and hw code paths.  Remove all redundant declarations.  Use
address lists to distinguish between versions.  Change dce80 code
to newer register access macros.

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/radeon: Do not evict VRAM on APUs with disabled HIBERNATE
Paul Menzel [Tue, 31 Jul 2018 16:48:41 +0000 (18:48 +0200)]
drm/radeon: Do not evict VRAM on APUs with disabled HIBERNATE

Improve commit d796d844 (drm/radeon/kms: make hibernate work on IGPs) to
only migrate VRAM objects if the Linux kernel is actually built with
support for hibernation (suspend to disk).

Link: https://bugs.freedesktop.org/show_bug.cgi?id=100941
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Do not evict VRAM on APUs with disabled HIBERNATE
Paul Menzel [Wed, 25 Jul 2018 10:54:19 +0000 (12:54 +0200)]
drm/amdgpu: Do not evict VRAM on APUs with disabled HIBERNATE

Improve commit d796d844 (drm/radeon/kms: make hibernate work on IGPs) to
only migrate VRAM objects if the Linux kernel is actually built with
support for hibernation (suspend to disk).

The better solution is to get the information, if this is suspend or
hibernate, from `amdgpu_device_suspend()`, but that’s more involved, so
apply the simple solution first.

Link: https://bugs.freedesktop.org/show_bug.cgi?id=107277
Signed-off-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add status checking after fw is loaded
Huang Rui [Sun, 5 Aug 2018 04:45:35 +0000 (12:45 +0800)]
drm/amdgpu: add status checking after fw is loaded

The status field must be 0 after FW is loaded.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/ttm: remove dead codes
Huang Rui [Wed, 15 Aug 2018 07:39:33 +0000 (15:39 +0800)]
drm/ttm: remove dead codes

These codes are not used.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix VM size reporting on Raven
Christian König [Wed, 15 Aug 2018 12:04:47 +0000 (14:04 +0200)]
drm/amdgpu: fix VM size reporting on Raven

Raven doesn't have an VCE block and so also no buggy VCE firmware.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Set clock ungate state when suspend/fini
Rex Zhu [Tue, 14 Aug 2018 09:28:46 +0000 (17:28 +0800)]
drm/amdgpu: Set clock ungate state when suspend/fini

After set power ungate state, set clock ungate state
before when suspend or fini.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Set power ungate state when suspend/fini
Rex Zhu [Tue, 14 Aug 2018 08:54:15 +0000 (16:54 +0800)]
drm/amdgpu: Set power ungate state when suspend/fini

Unify to set power ungate state at the begin of suspend/fini.
Remove the workaround code for gfx off feature in
amdgpu_device.c.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Refine function name and function args
Rex Zhu [Tue, 14 Aug 2018 05:32:30 +0000 (13:32 +0800)]
drm/amdgpu: Refine function name and function args

There are no any logical changes here.

1. change function names:
   amdgpu_device_ip_late_set_pg/cg_state to
   amdgpu_device_set_pg/cg_state.
2. add a function argument cg/pg_state, so
   we can enable/disable cg/pg through those functions

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Program gamut remap as part of stream update
SivapiriyanKumarasamy [Thu, 26 Jul 2018 18:58:35 +0000 (14:58 -0400)]
drm/amd/display: Program gamut remap as part of stream update

Add gamut remap to dc_stream_update struct, and program if set when updating
streams.

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: HDR dynamic meta should be treated as stream update
Krunoslav Kovac [Fri, 20 Jul 2018 19:44:08 +0000 (15:44 -0400)]
drm/amd/display: HDR dynamic meta should be treated as stream update

[Why]
Recently we fixed HDR static meta using AFMT registers to be treated as
fast stream update.
Dynamic meta is still being treated as (full) surface update because it
touches HUBP and it travels with pipe data.
Here we change it to be (fast) stream update.
Note, originally we also wanted to redesign here a bit, but without OS
level support for true dynamic meta, it's left the same. We are simply
using HW that can do dynamic meta to send HDR static meta, I still prefer
keeping it in one static meta type then defining dynamic meta types to
hold the same info. Once we know how OS interfaces look like, we can
do proper design.

[How]
Move dyn meta update from update_hubp_dpp to commit_planes_do_stream_update

Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Handle HDR meta update as fast update
Krunoslav Kovac [Thu, 5 Jul 2018 23:23:17 +0000 (19:23 -0400)]
drm/amd/display: Handle HDR meta update as fast update

[Why]
Vesa DPMS tool sends different HDR meta in OS flips without changing output
parameters. We don't properly update HDR info frame:
- we label HDR meta update as fast update
- when updating HW info frame, we only do it if full update

[How]
It should still be fast update, so when doing HW infoframe update,
do it always no matter the update type.
Also, don't request passive flip for HDR meta update only without output
transfer function or color space changed.

Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Program vsc_infopacket in commit_planes_for_stream
Alvin lee [Fri, 8 Jun 2018 17:58:36 +0000 (13:58 -0400)]
drm/amd/display: Program vsc_infopacket in commit_planes_for_stream

Signed-off-by: Alvin lee <alvin.lee3@amd.com>
Reviewed-by: Jun Lei <Jun.Lei@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Enable Stereo in Dal3
Alvin lee [Mon, 4 Jun 2018 21:31:25 +0000 (17:31 -0400)]
drm/amd/display: Enable Stereo in Dal3

- program infoframe for Stereo
- program stereo flip control registers properly

v2: Add missing license headers

Signed-off-by: Alvin lee <alvin.lee3@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Program vline interrupt on FAST update
SivapiriyanKumarasamy [Fri, 18 May 2018 21:05:52 +0000 (17:05 -0400)]
drm/amd/display: Program vline interrupt on FAST update

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: decouple front and backend pgm using dpms_off as backend enable...
Samson Tam [Tue, 1 May 2018 14:39:26 +0000 (10:39 -0400)]
drm/amd/display: decouple front and backend pgm using dpms_off as backend enable flag

Signed-off-by: Samson Tam <Samson.Tam@amd.com>
Reviewed-by: Anthony Koo <Anthony.Koo@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add config for sending VSIF
Anthony Koo [Tue, 8 May 2018 21:09:49 +0000 (17:09 -0400)]
drm/amd/display: add config for sending VSIF

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Don't force UPDATE_TYPE_FULL if stream_update has hdr_static_metadata
Harry Wentland [Sun, 25 Mar 2018 20:28:33 +0000 (16:28 -0400)]
drm/amd/display: Don't force UPDATE_TYPE_FULL if stream_update has hdr_static_metadata

This was missed when pushing public patch for 3e3a40b03847 (drm/amd/display:
Updated HDR Static Metadata to directly take info packet raw)

This is currently no problem yet since we're not doing HDR on Linux yet.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Correct rounding calcs in mod_freesync_is_valid_range
Anthony Koo [Tue, 17 Apr 2018 15:40:31 +0000 (11:40 -0400)]
drm/amd/display: Correct rounding calcs in mod_freesync_is_valid_range

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: refactor vupdate interrupt registration
Anthony Koo [Fri, 6 Apr 2018 17:55:39 +0000 (13:55 -0400)]
drm/amd/display: refactor vupdate interrupt registration

We only need to register once OS calls the interrupt control.
Also, if we are entering static screen mode, disable after ramping is done.
Disable shall be done via timer of 2 seconds regardless of ramping
complete or not, just to simplify.

Also, ramp to mid instead of min, due to better flicker performance...

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: fix LFC tearing at top of screen
Anthony Koo [Fri, 6 Apr 2018 16:12:06 +0000 (12:12 -0400)]
drm/amd/display: fix LFC tearing at top of screen

Tearing occurred because new VTOTAL MIN/MAX was being programmed
too early.
The flip can happen within the VUPDATE high region, and the new min/max
would take effect immediately. But this means that frame is not variable
anymore, and tearing would occur when the flip actually happens.

The fixed insert duration should be programmed on the first VUPDATE
interrupt instead.

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add back code to allow for rounding error
Anthony Koo [Thu, 5 Apr 2018 19:20:15 +0000 (15:20 -0400)]
drm/amd/display: Add back code to allow for rounding error

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Fix bug that causes black screen
Anthony Koo [Thu, 5 Apr 2018 01:04:42 +0000 (21:04 -0400)]
drm/amd/display: Fix bug that causes black screen

Ignore MSA bit on DP display is usually set during SetTimings, but
there was a case where the module thought refresh rate was not valid
and ignore MSA bit was not set.

Later, a valid refresh rate range was requested but since ignore MSA bit
not set, it caused black screen.

Issue if with how the module checked for VRR support. Fix up that logic.
DM should call new valid_range function to determine if timing is supported.

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Fix bug where refresh rate becomes fixed
Anthony Koo [Thu, 5 Apr 2018 01:01:21 +0000 (21:01 -0400)]
drm/amd/display: Fix bug where refresh rate becomes fixed

This issue occurs if refresh rate range is very small and lfc is not used.
When frame spikes occur, refresh rate becomes fixed and will not restore properly

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add method to check for supported range
Anthony Koo [Thu, 5 Apr 2018 00:59:43 +0000 (20:59 -0400)]
drm/amd/display: add method to check for supported range

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Refactor FreeSync module
Anthony Koo [Tue, 21 Aug 2018 19:40:28 +0000 (14:40 -0500)]
drm/amd/display: Refactor FreeSync module

Remove dependency on internal sink map and instead
use existing stream and plane state

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fill in amdgpu_dm_remove_sink_from_freesync_module
Harry Wentland [Wed, 15 Aug 2018 21:49:27 +0000 (16:49 -0500)]
drm/amdgpu: fill in amdgpu_dm_remove_sink_from_freesync_module

Add code to tear down freesync modules when disabled.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu:change VEGA booting with firmware loaded by PSP
Feifei Xu [Tue, 14 Aug 2018 18:53:53 +0000 (14:53 -0400)]
drm/amdgpu:change VEGA booting with firmware loaded by PSP

With PSP firmware loading, TMR mc address is supposed to be used.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: added support 2nd UVD instance
Evan Quan [Tue, 14 Aug 2018 18:53:52 +0000 (14:53 -0400)]
drm/amdgpu: added support 2nd UVD instance

Added psp fw loading support for vega20 2nd UVD instance.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/doc: Adapt GPU scheduler references for renamed C file
Michel Dänzer [Wed, 15 Aug 2018 10:58:13 +0000 (12:58 +0200)]
drm/doc: Adapt GPU scheduler references for renamed C file

Fixes: "drm/scheduler: rename gpu_scheduler.c to sched_main.c"
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use entity instead of ring for CS
Christian König [Thu, 19 Jul 2018 12:22:25 +0000 (14:22 +0200)]
drm/amdgpu: use entity instead of ring for CS

Further demangle ring from entity handling.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move context related stuff to amdgpu_ctx.h
Christian König [Wed, 18 Jul 2018 14:34:49 +0000 (16:34 +0200)]
drm/amdgpu: move context related stuff to amdgpu_ctx.h

Further unmangle amdgpu.h.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove ring lru handling
Christian König [Mon, 16 Jul 2018 13:23:15 +0000 (15:23 +0200)]
drm/amdgpu: remove ring lru handling

Not needed any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove the queue manager
Christian König [Mon, 16 Jul 2018 13:19:20 +0000 (15:19 +0200)]
drm/amdgpu: remove the queue manager

Not needed any more since that is now done by the scheduler.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use scheduler load balancing for compute CS
Christian König [Mon, 16 Jul 2018 12:59:26 +0000 (14:59 +0200)]
drm/amdgpu: use scheduler load balancing for compute CS

Start to use the scheduler load balancing for userspace compute
command submissions.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use scheduler load balancing for SDMA CS
Christian König [Fri, 13 Jul 2018 07:12:44 +0000 (09:12 +0200)]
drm/amdgpu: use scheduler load balancing for SDMA CS

Start to use the scheduler load balancing for userspace SDMA
command submissions.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use new scheduler load balancing for VMs
Christian König [Thu, 12 Jul 2018 13:15:21 +0000 (15:15 +0200)]
drm/amdgpu: use new scheduler load balancing for VMs

Instead of the fixed round robin use let the scheduler balance the load
of page table updates.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Change VCE booting with firmware loaded by PSP
James Zhu [Tue, 14 Aug 2018 18:53:51 +0000 (14:53 -0400)]
drm/amdgpu: Change VCE booting with firmware loaded by PSP

With PSP firmware loading, TMR mc address is supposed to be used.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: rename gpu_scheduler.c to sched_main.c
Christian König [Mon, 6 Aug 2018 13:01:45 +0000 (15:01 +0200)]
drm/scheduler: rename gpu_scheduler.c to sched_main.c

Better match the naming of the other components.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: cleanup entity coding style
Christian König [Mon, 6 Aug 2018 12:58:56 +0000 (14:58 +0200)]
drm/scheduler: cleanup entity coding style

Cleanup coding style in sched_entity.c

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: move entity handling into separate file
Christian König [Mon, 6 Aug 2018 12:25:32 +0000 (14:25 +0200)]
drm/scheduler: move entity handling into separate file

This is complex enough on it's own. Move it into a separate C file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/scheduler: trivial error handling fix
Christian König [Tue, 14 Aug 2018 07:41:12 +0000 (09:41 +0200)]
drm/scheduler: trivial error handling fix

Return -ENOMEM when allocating the rq_list fails.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix integer overflow test in amdgpu_bo_list_create()
Dan Carpenter [Fri, 10 Aug 2018 10:50:32 +0000 (18:50 +0800)]
drm/amdgpu: fix integer overflow test in amdgpu_bo_list_create()

We accidentally left out the size of the amdgpu_bo_list struct.  It
could lead to memory corruption on 32 bit systems.  You'd have to
pick the absolute maximum and set "num_entries == 59652323" then size
would wrap to 16 bytes.

Fixes: 920990cb080a ("drm/amdgpu: allocate the bo_list array after the list")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/pp: OverDrive gfx domain voltage on Tonga
Rex Zhu [Mon, 13 Aug 2018 10:37:39 +0000 (18:37 +0800)]
drm/amd/pp: OverDrive gfx domain voltage on Tonga

Also ajust the gfx domain voltage on Tonga when user overdriver
the voltage.

For Tonga, Driver do not update user's setting to voltage table
in smu, we only pick up a minimum value from voltage table that
not less than the user's setting.

v2: fix a typo

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Cancel the delay work when suspend
Rex Zhu [Tue, 14 Aug 2018 09:31:09 +0000 (17:31 +0800)]
drm/amdgpu: Cancel the delay work when suspend

Cancel the delay work to avoid the corner case that
ib test was not running when suspend

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: remove experimental flag for vega20
Alex Deucher [Tue, 14 Aug 2018 16:44:44 +0000 (11:44 -0500)]
drm/amdgpu: remove experimental flag for vega20

Now that PSP and SMU support is in place.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/psp: Enlarge PSP TMR SIZE from 3M to 4M.
Feifei Xu [Tue, 14 Aug 2018 02:33:25 +0000 (10:33 +0800)]
drm/amdgpu/psp: Enlarge PSP TMR SIZE from 3M to 4M.

Enlarge the PSP TMR SIZE to 4M for dual UVD fw front-door loading.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: update vega20 sdma golden settings
Evan Quan [Wed, 18 Jul 2018 08:00:03 +0000 (16:00 +0800)]
drm/amdgpu: update vega20 sdma golden settings

Updated vega20 SDMA0 and SDMA1 golden settings.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/gfx9: Update gfx9 golden settings.
Feifei Xu [Thu, 26 Jul 2018 04:31:34 +0000 (12:31 +0800)]
drm/amdgpu/gfx9: Update gfx9 golden settings.

Update the goldensettings for vega20.

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: added voltage boot time calibration
Evan Quan [Fri, 10 Aug 2018 06:27:56 +0000 (14:27 +0800)]
drm/amd/powerplay: added voltage boot time calibration

Run AFLL BTC after upload pptable and before enabling
all smu features.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: remove max DCEFCLK limitation
Evan Quan [Mon, 30 Jul 2018 06:01:00 +0000 (14:01 +0800)]
drm/amd/powerplay: remove max DCEFCLK limitation

The latest SMU fw removes the limitation that required
UCLK >= DCEFCLK.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: allow slow switch only if NBPState enabled
Evan Quan [Fri, 20 Jul 2018 02:56:21 +0000 (10:56 +0800)]
drm/amd/powerplay: allow slow switch only if NBPState enabled

Otherwise there may be potential SMU performance issues.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: correct the argument for PPSMC_MSG_SetUclkFastSwitch
Evan Quan [Fri, 20 Jul 2018 02:53:31 +0000 (10:53 +0800)]
drm/amd/powerplay: correct the argument for PPSMC_MSG_SetUclkFastSwitch

The argument was set wrongly. Fast/slow switch was asked when there is
actually a slow/fast switch needed.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: avoid enabling/disabling uvd/vce dpm twice
Evan Quan [Thu, 19 Jul 2018 10:40:25 +0000 (18:40 +0800)]
drm/amd/powerplay: avoid enabling/disabling uvd/vce dpm twice

For vega20, there are two UVD rings which share one powerplay instance.
Under some case(two rings used parallel), the uvd dpm is disabled twice
which causes the SMC hang.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: remove setting soc floor voltage before sending pptable
Evan Quan [Wed, 18 Jul 2018 02:59:02 +0000 (10:59 +0800)]
drm/amd/powerplay: remove setting soc floor voltage before sending pptable

SOC voltage is not able to switch and forced to low 0.8V when running HEVC.
Thus the test failed.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: enable fclk ss by default
Evan Quan [Tue, 17 Jul 2018 02:22:37 +0000 (10:22 +0800)]
drm/amd/powerplay: enable fclk ss by default

Set fclk ss as enabled on default.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/vg20: Change the load type of vega20 to psp (v2)
Likun Gao [Mon, 9 Jul 2018 18:47:04 +0000 (13:47 -0500)]
drm/amdgpu/vg20: Change the load type of vega20 to psp (v2)

Modified the vega20 load type to psp now that psp
support is implemented.

v2: squash in fixes history (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Add psp 11.0 support for vega20. (v2)
Feifei Xu [Fri, 11 May 2018 06:54:50 +0000 (14:54 +0800)]
drm/amdgpu: Add psp 11.0 support for vega20. (v2)

Add psp 11.0 code for vega20 and enable it.  PSP is the
security processor for the GPU.  It handles firmware
loading and GPU resets among other things.

v2: whitespace fix, enable support, adjust reg includes (Alex)

Signed-off-by: Feifei Xu <Feifei.Xu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable vega20 powerplay support
Evan Quan [Wed, 2 May 2018 07:45:54 +0000 (15:45 +0800)]
drm/amdgpu: enable vega20 powerplay support

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update vega20 clocks threshold settings on power state adjust
Evan Quan [Mon, 21 May 2018 02:43:31 +0000 (10:43 +0800)]
drm/amd/powerplay: update vega20 clocks threshold settings on power state adjust

UVD, VCE and SOC clocks need to be taken into consideration. Also, the
thresholds need be updated correspondingly when stable power state is selected.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: revise vega20 PPSMC_MSG_SetSoftMin/[Max]ByFreq settings
Evan Quan [Mon, 21 May 2018 02:24:57 +0000 (10:24 +0800)]
drm/amd/powerplay: revise vega20 PPSMC_MSG_SetSoftMin/[Max]ByFreq settings

UVD, VCE and Socclk also need to be taken into consideration when
setting PPSMC_MSG_SetSoftMinByFreq and PPSMC_MSG_SetSoftMaxByFreq.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: new interfaces for overdrive vega20 sclk and mclk
Evan Quan [Mon, 21 May 2018 02:19:06 +0000 (10:19 +0800)]
drm/amd/powerplay: new interfaces for overdrive vega20 sclk and mclk

Add support for the new SMU firmware interface for clock adjustment.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: initialize vega20 overdrive settings
Evan Quan [Mon, 21 May 2018 02:16:41 +0000 (10:16 +0800)]
drm/amd/powerplay: initialize vega20 overdrive settings

The initialized overdrive settings are taken from vbios and SMU(
by PPSMC_MSG_TransferTableSmu2Dram).

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: conv the vega20 pstate sclk/mclk into necessary 10KHz unit
Evan Quan [Fri, 11 May 2018 08:10:51 +0000 (16:10 +0800)]
drm/amd/powerplay: conv the vega20 pstate sclk/mclk into necessary 10KHz unit

Powerplay uses 10KHz units.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20 pre_display_config_changed callback
Evan Quan [Wed, 9 May 2018 03:14:06 +0000 (11:14 +0800)]
drm/amd/powerplay: add vega20 pre_display_config_changed callback

fix possible handshake hang and video playback crash

Corner cases:
 - Handshake between SMU and DCE causes hangs when CRTC is not
   enabled
 - System crash occurs when starting 4K playback with Movies and TV
   in an SLS configuration

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: export vega20 stable pstate clocks
Evan Quan [Tue, 8 May 2018 10:23:16 +0000 (18:23 +0800)]
drm/amd/powerplay: export vega20 stable pstate clocks

Needed for querying the stable pstate clocks.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: correct force clock level related settings for vega20 (v2)
Evan Quan [Tue, 8 May 2018 10:27:03 +0000 (18:27 +0800)]
drm/amd/powerplay: correct force clock level related settings for vega20 (v2)

1. The min/max level is determined by soft_min_level/soft_max_level.
2. Vega20 comes with pptable v3 which has no vdd related
table(vdd_dep_on_socclk, vdd_dep_on_mclk) support.
3. Vega20 does not support separate fan feature control(enable or
disable).

v2: squash in fixes:
- bug fix for force dpm level settings
- fix wrong data type

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: init vega20 uvd/vce powergate status on dpm setup
Evan Quan [Fri, 4 May 2018 07:20:15 +0000 (15:20 +0800)]
drm/amd/powerplay: init vega20 uvd/vce powergate status on dpm setup

This is essentially necessary when uvd/vce dpm is not enabled yet.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: support workload profile query and setup for vega20
Evan Quan [Fri, 6 Jul 2018 19:00:37 +0000 (14:00 -0500)]
drm/amd/powerplay: support workload profile query and setup for vega20

Support the power profile API.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add the hw manager for vega20 (v3)
Evan Quan [Thu, 2 Aug 2018 20:55:33 +0000 (15:55 -0500)]
drm/amd/powerplay: add the hw manager for vega20 (v3)

hwmgr is the interface for the driver to setup state
structures which are used by the smu for managing the
power state.

v2: squash in fixes:
- update set_watermarks_for_clocks_ranges to use common code
- drop unsupported apis
- correct MAX_REGULAR_DPM_NUMBER value
- multimonitor fixes
- add check for vbios pptable version
- revise dpm table setup
- init fclk dpm state
- Remove unused definition in vega20_hwmgr
- support power limit setup
- enable vega20 to honour DAL clock limits
- comment out dump_table debugging
v3: switch to SOC15 register access macros

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: new interfaces for ActivityMonitor table with SMU
Evan Quan [Fri, 11 May 2018 02:56:25 +0000 (10:56 +0800)]
drm/amd/powerplay: new interfaces for ActivityMonitor table with SMU

Vega20 has a new activity monitor table that is stored in memory.  Add
API to get and set the new table.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add the smu manager for vega20 (v2)
Evan Quan [Thu, 2 Aug 2018 20:52:41 +0000 (15:52 -0500)]
drm/amd/powerplay: add the smu manager for vega20 (v2)

The SMU manager handles the driver interaction with the SMU
which handles clock and voltage controls.

v2: switch to SOC15 register access macros
    reserve space for ActivityMonitor table
    enable SMU fw loading
    Drop dead code from bringup

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20_pptable.h (v2)
Evan Quan [Wed, 21 Mar 2018 08:36:08 +0000 (16:36 +0800)]
drm/amd/powerplay: add vega20_pptable.h (v2)

v2: squash in table size fixes

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20_ppsmc.h (v2)
Evan Quan [Wed, 21 Mar 2018 08:21:51 +0000 (16:21 +0800)]
drm/amd/powerplay: add vega20_ppsmc.h (v2)

v2: update to latest.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add smu11_driver_if.h (v4)
Evan Quan [Wed, 21 Mar 2018 08:16:41 +0000 (16:16 +0800)]
drm/amd/powerplay: add smu11_driver_if.h (v4)

v2: cleanup
v3: fit the latest 40.6 smc fw
v4: update to latest.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20_inc.h (v2)
Evan Quan [Wed, 21 Mar 2018 06:10:21 +0000 (14:10 +0800)]
drm/amd/powerplay: add vega20_inc.h (v2)

v2: use thm 11.0.2 headers

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: update atomfirmware.h
Evan Quan [Wed, 2 May 2018 07:50:10 +0000 (15:50 +0800)]
drm/amdgpu: update atomfirmware.h

Add struct atom_smc_dpm_info_v4_3

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>