linux-2.6-block.git
5 years agodrm/amdgpu: Use heavy weight for tlb invalidation on xgmi configuration
shaoyunl [Thu, 25 Oct 2018 19:40:51 +0000 (15:40 -0400)]
drm/amdgpu: Use heavy weight for tlb invalidation on xgmi configuration

There is a bug found in vml2 xgmi logic:
mtype is always sent as NC on the VMC to TC interface for a page walk,
regardless of whether the request is being sent to local or remote GPU.
NC means non-coherent and will cause the VMC return data to be cached
in the TCC (versus UC – uncached will not cache the data). Since the
page table updates are being done by SDMA/HDP, then TCC will never be
updated and the GC VML2 will continue to hit on the TCC and never get
the updated page tables and result in a fault.
Heave weigh tlb invalidation does a WB/INVAL of the L1/L2 GL data
caches so TCC will not be hit on next request

Signed-off-by: shaoyunl <Shaoyun.Liu@amd.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/amdkfd: Preserve ttmp[4:5] instead of ttmp[14:15]
Jay Cornwall [Tue, 2 Apr 2019 16:43:30 +0000 (11:43 -0500)]
drm/amdkfd: Preserve ttmp[4:5] instead of ttmp[14:15]

ttmp[4:5] is initialized by the SPI with SPI_GDBG_TRAP_DATA* values.
These values are more useful to the debugger than ttmp[14:15], which
carries dispatch_scratch_base*. There are too few registers to
preserve both.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.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/amdkfd: Fix gfx9 XNACK state save/restore
Jay Cornwall [Tue, 19 Feb 2019 20:51:56 +0000 (14:51 -0600)]
drm/amdkfd: Fix gfx9 XNACK state save/restore

SQ_WAVE_IB_STS.RCNT grew from 4 bits to 5 in gfx9. Do not truncate
when saving in the high bits of TTMP1.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.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/amdkfd: Preserve wave state after instruction fetch MEM_VIOL
Jay Cornwall [Thu, 31 Jan 2019 17:38:18 +0000 (11:38 -0600)]
drm/amdkfd: Preserve wave state after instruction fetch MEM_VIOL

If instruction fetch fails the wave cannot be halted and returned to
the shader without raising MEM_VIOL again. Currently the wave is
terminated if this occurs, but this loses information about the cause
of the fault. The debugger would prefer the faulting wave state to be
context-saved.

Poll inside the trap handler until TRAPSTS.SAVECTX indicates context
save is ready. Exit the poll loop and complete the remainder of the
exception handler, then return to the shader. The next instruction
fetch will be from the trap handler and not the faulting PC. Context
save will then deschedule the wave and save its state.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.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/amdkfd: Fix gfx8 MEM_VIOL exception handler
Jay Cornwall [Thu, 15 Nov 2018 04:23:25 +0000 (22:23 -0600)]
drm/amdkfd: Fix gfx8 MEM_VIOL exception handler

When MEM_VIOL is asserted the context save handler rewinds the
program counter. This is incorrect for any source of the exception.
MEM_VIOL may be raised in normal operation by out-of-bounds access
to LDS or GDS and does not require special handling.

Remove PC adjustment when MEM_VIOL has been raised.

Signed-off-by: Jay Cornwall <Jay.Cornwall@amd.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/amdkfd: Fix compute profile switching
Harish Kasiviswanathan [Fri, 25 Jan 2019 21:35:35 +0000 (16:35 -0500)]
drm/amdkfd: Fix compute profile switching

Fix compute profile switching on process termination.

Add a dedicated reference counter to keep track of entry/exit to/from
compute profile. This enables switching compute profiles for other
reasons than process creation or termination.

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Eric Huang <JinhuiEric.Huang@amd.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/amdkfd: Shift sdma_engine_id and sdma_queue_id in mqd
Oak Zeng [Tue, 4 Dec 2018 22:08:33 +0000 (16:08 -0600)]
drm/amdkfd: Shift sdma_engine_id and sdma_queue_id in mqd

FW of some new ASICs requires sdma mqd size to be not more than
128 dwords. Repurpose the last 2 reserved fields of sdma mqd for
driver internal use, so the total mqd size is no bigger than 128
dwords

Signed-off-by: Oak Zeng <ozeng@amd.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/amdkfd: Differentiate b/t sdma_id and sdma_queue_id
Oak Zeng [Mon, 3 Dec 2018 15:20:20 +0000 (09:20 -0600)]
drm/amdkfd: Differentiate b/t sdma_id and sdma_queue_id

sdma_queue_id is sdma queue index inside one sdma engine.
sdma_id is sdma queue index among all sdma engines. Use
those two names properly.

Signed-off-by: Oak Zeng <ozeng@amd.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/amdkfd: Add sdma allocation debug message
Oak Zeng [Thu, 8 Nov 2018 15:40:41 +0000 (10:40 -0500)]
drm/amdkfd: Add sdma allocation debug message

Add debug messages during SDMA queue allocation.

Signed-off-by: Oak Zeng <Oak.Zeng@amd.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/amdkfd: Use 64 bit sdma_bitmap
Oak Zeng [Thu, 1 Nov 2018 15:06:25 +0000 (11:06 -0400)]
drm/amdkfd: Use 64 bit sdma_bitmap

Maximumly support 64 sdma queues

Signed-off-by: Oak Zeng <Oak.Zeng@amd.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/amd/powerplay: enable ppfeaturemask module parameter support on Vega20
Evan Quan [Mon, 29 Apr 2019 03:35:42 +0000 (11:35 +0800)]
drm/amd/powerplay: enable ppfeaturemask module parameter support on Vega20

Support DPM/DS/ULV related bitmasks of ppfeaturemask module parameter.

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/amdgpu: use pcie_bandwidth_available rather than open coding it
Alex Deucher [Thu, 11 Apr 2019 13:58:22 +0000 (08:58 -0500)]
drm/amdgpu: use pcie_bandwidth_available rather than open coding it

It does the same thing we were doing already.  I though it needed
work for gen3/4 speeds, but that seems to be covered already.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agogpu: fix typos in code comments
Weitao Hou [Sat, 18 May 2019 13:41:41 +0000 (21:41 +0800)]
gpu: fix typos in code comments

fix eror to error

Signed-off-by: Weitao Hou <houweitaoo@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: fix sw SMU wrong UVD/VCE powergate setting
Evan Quan [Fri, 17 May 2019 05:39:36 +0000 (13:39 +0800)]
drm/amd/powerplay: fix sw SMU wrong UVD/VCE powergate setting

The UVD/VCE bits are set wrongly. This causes the UVD/VCE clocks
are not brought back correctly on needed.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: use div64_ul for 32-bit compatibility v1
Slava Abramov [Thu, 16 May 2019 20:17:53 +0000 (16:17 -0400)]
drm/amdgpu: use div64_ul for 32-bit compatibility v1

v1: replace casting to unsigned long with div64_ul

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Slava Abramov <slava.abramov@amd.com>
Tested-by: Slava Abramov <slava.abramov@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Enable "disable dpm" feature to support swSMU debug (v2)
Chengming Gui [Wed, 8 May 2019 06:38:55 +0000 (14:38 +0800)]
drm/amd/powerplay: Enable "disable dpm" feature to support swSMU debug (v2)

add pm_enabled to control the dpm off/on.
v2: Directly return 0 to replace return ret and merge some check code.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Hawking Zhang <hawking.zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Fix maybe-uninitialized in get_ppfeature_status
Bhawanpreet Lakha [Wed, 15 May 2019 20:17:05 +0000 (16:17 -0400)]
drm/amd/powerplay: Fix maybe-uninitialized in get_ppfeature_status

This fixes the warning below

error: ‘feature_mask’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  *features_enabled = ((((uint64_t)feature_mask[0] << SMU_FEATURES_LOW_SHIFT) & SMU_FEATURES_LOW_MASK) |
                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
    (((uint64_t)feature_mask[1] << SMU_FEATURES_HIGH_SHIFT) & SMU_FEATURES_HIGH_MASK));
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: fix spelling mistake "retrived" -> "retrieved"
Colin Ian King [Fri, 10 May 2019 07:07:34 +0000 (08:07 +0100)]
drm/amdgpu: fix spelling mistake "retrived" -> "retrieved"

There is a spelling mistake in a DRM_ERROR error message. Fix this.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/vega20: use mode1 reset for RAS and XGMI
Alex Deucher [Wed, 15 May 2019 18:53:14 +0000 (13:53 -0500)]
drm/amdgpu/vega20: use mode1 reset for RAS and XGMI

If RAS or XGMI are enabled, you have to use mode1 reset rather
than BACO.

Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.31
Aric Cyr [Mon, 6 May 2019 14:16:12 +0000 (10:16 -0400)]
drm/amd/display: 3.2.31

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Disable ABM before destroy ABM struct
Paul Hsieh [Fri, 3 May 2019 15:50:10 +0000 (23:50 +0800)]
drm/amd/display: Disable ABM before destroy ABM struct

[Why]
When disable driver, OS will set backlight optimization
then do stop device.  But this flag will cause driver to
enable ABM when driver disabled.

[How]
Send ABM disable command before destroy ABM construct

Signed-off-by: Paul Hsieh <paul.hsieh@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: dont set otg offset
Jun Lei [Tue, 30 Apr 2019 20:22:38 +0000 (16:22 -0400)]
drm/amd/display: dont set  otg offset

move the update of otg instance outside of hw programming logic,
since this is sw state, it should always be updated and should
never be optimized away.

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Eric Yang <eric.yang2@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Explicitly specify update type per plane info change
Nicholas Kazlauskas [Thu, 2 May 2019 17:21:48 +0000 (13:21 -0400)]
drm/amd/display: Explicitly specify update type per plane info change

[Why]
The bit for flip addr is being set causing the determination for
FAST vs MEDIUM to always return MEDIUM when plane info is provided
as a surface update. This causes extreme stuttering for the typical
atomic update path on Linux.

[How]
Don't use update_flags->raw for determining FAST vs MEDIUM. It's too
fragile to changes like this.

Explicitly specify the update type per update flag instead. It's not
as clever as checking the bits itself but at least it's correct.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Eryk Brol <Eryk.Brol@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Rename EDID_BLOCK_SIZE to DC_EDID_BLOCK_SIZE
Joshua Aberback [Thu, 2 May 2019 21:32:14 +0000 (17:32 -0400)]
drm/amd/display: Rename EDID_BLOCK_SIZE to DC_EDID_BLOCK_SIZE

Signed-off-by: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Abdoulaye Berthe <Abdoulaye.Berthe@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Use VCP for extended colorimetry
Aric Cyr [Wed, 1 May 2019 21:05:05 +0000 (17:05 -0400)]
drm/amd/display: Use VCP for extended colorimetry

DPRX should send the VCP extended colorimetry packet if the
sink supports DPCD rev1.4 and reports the extended colorimetry
bit.

Signed-off-by: Aric Cyr <aric.cyr@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: Use DCN functions instead of DCE
Wesley Chalmers [Wed, 24 Apr 2019 19:29:06 +0000 (15:29 -0400)]
drm/amd/display: Use DCN functions instead of DCE

[WHY]
DCN code should make as few references to DCE as possible

[HOW]
Copy DCE110 implementation of find_first_free_match_stream_enc_for_link
into DCN10

Signed-off-by: Wesley Chalmers <Wesley.Chalmers@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: Engine-specific encoder allocation
Wesley Chalmers [Wed, 24 Apr 2019 19:25:41 +0000 (15:25 -0400)]
drm/amd/display: Engine-specific encoder allocation

[WHY]
From DCE110 onward, we have the ability to assign DIG BE and FE
separately for any display connector type; before, we could only do this
for DP.

Signed-off-by: Wesley Chalmers <Wesley.Chalmers@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: enabling stream after HPD low to high happened
Charlene Liu [Mon, 29 Apr 2019 18:35:01 +0000 (14:35 -0400)]
drm/amd/display: enabling stream after HPD low to high happened

[Why]
1. No real HPD plug in/out but HPD happens,
 the driver notifies OS connection changed.
2. No display in target.

When HPD goes low to high,
the driver should regard as HPD and enter setmode flow.

[How]
In this case, even stream didn't change but still retrain.

Signed-off-by: Chiawen Huang <chiawen.huang@amd.com>
Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-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: Program VTG params after programming Global Sync
Joshua Aberback [Mon, 29 Apr 2019 21:21:19 +0000 (17:21 -0400)]
drm/amd/display: Program VTG params after programming Global Sync

[Why]
VTG has a parameter FP2, which is defined as:
    if VSTARTUP is before VSYNC:
        FP2 = number of lines in between VSTARTUP and VSYNC
    else
        FP2 = 0
Currently, FP2 is only programmed during "program_timing". However, the
position of VSTARTUP is affected by the prefetching requirements on all pipes,
so the position might change when we do memory request control on another pipe, so we need
to make sure that FP2 stays up-to-date whenever we adjust VSTARTUP.

[How]
 - refactor VTG_CONTROL programming into a new function "set_vtg_params"
 - call it after calling "program_global_sync"
   - make sure it's called after because it relies on the cached dlg params

Signed-off-by: Joshua Aberback <joshua.aberback@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Jun Lei <Jun.Lei@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: add null checks and set update flags
Dmytro Laktyushkin [Mon, 8 Apr 2019 18:56:29 +0000 (14:56 -0400)]
drm/amd/display: add null checks and set update flags

* add plane state null checks
* add and set update surface flags

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.30
Aric Cyr [Sat, 27 Apr 2019 22:50:43 +0000 (18:50 -0400)]
drm/amd/display: 3.2.30

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Reuse MPC OGRAM for 1D blender
Vitaly Prosyak [Thu, 18 Apr 2019 14:51:12 +0000 (09:51 -0500)]
drm/amd/display: Reuse MPC OGRAM for 1D blender

[Why & How]
Reuse existent code path and in order to do that apply de gamma
in 1D blender LUT and re use MPC OGAM.
Follow up is required.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Vitaly Prosyak <Vitaly.Prosyak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Remove DPMS state dependency for fast boot
SivapiriyanKumarasamy [Wed, 24 Apr 2019 14:20:15 +0000 (10:20 -0400)]
drm/amd/display: Remove DPMS state dependency for fast boot

[Why]
The DPMS state of a display should not impact whether we want to enable fast boot.
Currently fast boot is not enabled when resuming from S4 because of this.

[How]
Remove check for DPMS state when determining if fast boot
can be applied.

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: Hook up CRC capture support for dce120
Nicholas Kazlauskas [Thu, 25 Apr 2019 16:11:08 +0000 (12:11 -0400)]
drm/amd/display: Hook up CRC capture support for dce120

[Why]
Many IGT tests require CRC capture in order to confirm that the output
is visually correct.

These skip on dce120 because configure_crc and get_crc aren't set.

[How]
Hook up is_tg_enabled, configure_crc and get_crc functions on dce120's
timing generator.

The logic should be the same as DCE and DCN with some minor register
naming differences.

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: David Francis <David.Francis@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 v_total_min and max parameters
Charlene Liu [Fri, 26 Apr 2019 04:29:13 +0000 (00:29 -0400)]
drm/amd/display: define v_total_min and max parameters

add these parameters for future use

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: support sw smu hotspot and memory temperature retrieval
Evan Quan [Tue, 14 May 2019 03:46:27 +0000 (11:46 +0800)]
drm/amd/powerplay: support sw smu hotspot and memory temperature retrieval

Support hotspot and memory temperature retrieval on sw smu routine.

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 uclk activity retrieve on sw smu routine
Evan Quan [Tue, 14 May 2019 02:38:42 +0000 (10:38 +0800)]
drm/amd/powerplay: support uclk activity retrieve on sw smu routine

Support realtime uclk activity report.

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: honor hw limit on fetching metrics data
Evan Quan [Mon, 13 May 2019 09:31:03 +0000 (17:31 +0800)]
drm/amd/powerplay: honor hw limit on fetching metrics data

Request too frequently may get corrupt data.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Feifei Xu <Feifei.Xu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: support ppfeatures sysfs interface on sw smu routine
Evan Quan [Mon, 13 May 2019 07:32:21 +0000 (15:32 +0800)]
drm/amd/powerplay: support ppfeatures sysfs interface on sw smu routine

Support ppfeatures sysfs interface on Vega20 sw smu routine.

Signed-off-by: Evan Quan <evan.quan@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/amd/powerplay: drop redundant smu call
Evan Quan [Mon, 13 May 2019 03:16:27 +0000 (11:16 +0800)]
drm/amd/powerplay: drop redundant smu call

smu_get_clk_info_from_vbios() was called repeatedly. It
seems a merge error.

Signed-off-by: Evan Quan <evan.quan@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/amd/powerplay: drop unnecessary sw smu check
Evan Quan [Fri, 10 May 2019 08:56:27 +0000 (16:56 +0800)]
drm/amd/powerplay: drop unnecessary sw smu check

There is already sw smu check on IP block adding.

Signed-off-by: Evan Quan <evan.quan@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/amd/display: Drop DCN1_01 guards
Harry Wentland [Tue, 14 May 2019 13:12:45 +0000 (09:12 -0400)]
drm/amd/display: Drop DCN1_01 guards

[WHY]
These were only needed for bringup. They're not needed anymore.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Don't load DMCU for Raven 1 (v2)
Harry Wentland [Mon, 29 Apr 2019 13:39:15 +0000 (09:39 -0400)]
drm/amd/display: Don't load DMCU for Raven 1 (v2)

[WHY]
Some early Raven boards had a bad SBIOS that doesn't play nicely with
the DMCU FW. We thought the issues were fixed by ignoring errors on DMCU
load but that doesn't seem to be the case. We've still seen reports of
users unable to boot their systems at all.

[HOW]
Disable DMCU load on Raven 1. Only load it for Raven 2 and Picasso.

v2: Fix ifdef (Alex)

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Add ASICREV_IS_PICASSO
Harry Wentland [Tue, 14 May 2019 13:05:37 +0000 (09:05 -0400)]
drm/amd/display: Add ASICREV_IS_PICASSO

[WHY]
We only want to load DMCU FW on Picasso and Raven 2, not on Raven 1.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
5 years agodrm/amdgpu: Report firmware versions with sysfs v2
Ori Messinger [Mon, 22 Apr 2019 17:52:52 +0000 (13:52 -0400)]
drm/amdgpu: Report firmware versions with sysfs v2

Firmware versions can be found as separate sysfs files at:
/sys/class/drm/cardX/device/fw_version (where X is the card number)
The firmware versions are displayed in hexadecimal.
v2: Moved sysfs files to subfolder

Signed-off-by: Ori Messinger <ori.messinger@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: make VCN DPG pause mode detached from general VCN
Leo Liu [Mon, 13 May 2019 16:41:54 +0000 (12:41 -0400)]
drm/amdgpu: make VCN DPG pause mode detached from general VCN

It should be attached to VCN 1.0

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: move the VCN DPG mode read and write to VCN
Leo Liu [Mon, 13 May 2019 16:15:45 +0000 (12:15 -0400)]
drm/amdgpu: move the VCN DPG mode read and write to VCN

Since this is VCN specific and only used by VCN

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/sriov: Need to initialize the HDP_NONSURFACE_BAStE
Tiecheng Zhou [Tue, 14 May 2019 02:03:35 +0000 (10:03 +0800)]
drm/amdgpu/sriov: Need to initialize the HDP_NONSURFACE_BAStE

it requires to initialize HDP_NONSURFACE_BASE, so as to avoid
using the value left by a previous VM under sriov scenario.

v2: it should not hurt baremetal, generalize it for both sriov
and baremetal

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Tiecheng Zhou <Tiecheng.Zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: suppress repeating tmo report
Monk Liu [Mon, 13 May 2019 05:57:29 +0000 (13:57 +0800)]
drm/amdgpu: suppress repeating tmo report

only report once per TMO job and the timer would
be restarted upon the job finished if it's just slow.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Monk Liu <Monk.Liu@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 static GDS, GWS and OA allocation
Christian König [Fri, 10 May 2019 17:56:30 +0000 (19:56 +0200)]
drm/amdgpu: remove static GDS, GWS and OA allocation

As far as we know this was never used by userspace and so should be removed.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: update Vega10 ACG Avfs Gb parameters
Evan Quan [Wed, 8 May 2019 06:38:22 +0000 (14:38 +0800)]
drm/amd/powerplay: update Vega10 ACG Avfs Gb parameters

Update Vega10 ACG Avfs GB parameters.

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: force to update all clock tables on OD reset
Evan Quan [Wed, 8 May 2019 05:55:21 +0000 (13:55 +0800)]
drm/amd/powerplay: force to update all clock tables on OD reset

On OD reset, the clock tables in SMU need to be reset to default.

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: update Vega10 power state on OD
Evan Quan [Tue, 7 May 2019 04:49:03 +0000 (12:49 +0800)]
drm/amd/powerplay: update Vega10 power state on OD

Update Vega10 top performance level power state accordingly
on OD.

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: avoid repeat AVFS enablement/disablement
Evan Quan [Mon, 6 May 2019 08:45:13 +0000 (16:45 +0800)]
drm/amd/powerplay: avoid repeat AVFS enablement/disablement

No need to enable or disable AVFS if it's already in wanted
state.

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: valid Vega10 DPMTABLE_OD_UPDATE_VDDC settings V2
Evan Quan [Mon, 6 May 2019 08:37:40 +0000 (16:37 +0800)]
drm/amd/powerplay: valid Vega10 DPMTABLE_OD_UPDATE_VDDC settings V2

With user specified voltage(DPMTABLE_OD_UPDATE_VDDC), the AVFS
will be disabled. However, the buggy code makes this actually not
working as expected.

- V2: clear all OD flags excpet DPMTABLE_OD_UPDATE_VDDC

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: fix Vega10 mclk/socclk voltage link setup
Evan Quan [Tue, 30 Apr 2019 08:34:20 +0000 (16:34 +0800)]
drm/amd/powerplay: fix Vega10 mclk/socclk voltage link setup

This may affects the Vega10 MCLK OD functionality.

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/amdgpu: check no_user_fence flag for engines
Leo Liu [Wed, 8 May 2019 15:13:53 +0000 (11:13 -0400)]
drm/amdgpu: check no_user_fence flag for engines

To replace checking ring type and make them generic

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/VCN: set no_user_fence flag to true
Leo Liu [Wed, 8 May 2019 15:10:05 +0000 (11:10 -0400)]
drm/amdgpu/VCN: set no_user_fence flag to true

There is no user fence support for VCN

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/VCE: set no_user_fence flag to true
Leo Liu [Wed, 8 May 2019 15:08:58 +0000 (11:08 -0400)]
drm/amdgpu/VCE: set no_user_fence flag to true

There is no user fence support for VCE

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu/UVD: set no_user_fence flag to true
Leo Liu [Wed, 8 May 2019 15:07:26 +0000 (11:07 -0400)]
drm/amdgpu/UVD: set no_user_fence flag to true

There is no user fence support for UVD

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add no_user_fence flag to ring funcs
Leo Liu [Wed, 8 May 2019 15:05:11 +0000 (11:05 -0400)]
drm/amdgpu: add no_user_fence flag to ring funcs

So we can generalize the no user fence supported engine

Signed-off-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: sdma handle ras resume
xinhui pan [Thu, 9 May 2019 01:00:14 +0000 (09:00 +0800)]
drm/amdgpu: sdma handle ras resume

During S3/S4 bootloader will re-init ras state behind us.
Resume might fail or raise a gpu reset.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: gfx handle ras resume
xinhui pan [Thu, 9 May 2019 00:58:56 +0000 (08:58 +0800)]
drm/amdgpu: gfx handle ras resume

During S3/S4 bootloader will re-init ras state behind us.
Resume might fail or raise a gpu reset.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: gmc handle ras resume
xinhui pan [Thu, 9 May 2019 00:26:02 +0000 (08:26 +0800)]
drm/amdgpu: gmc handle ras resume

During S3/S4 bootloader will re-init ras state behind us.
Resume might fail or raise a gpu reset.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: enable ras suspend/resume
xinhui pan [Wed, 8 May 2019 23:32:54 +0000 (07:32 +0800)]
drm/amdgpu: enable ras suspend/resume

suspend/resume will change ras state behind us. Let driver get notified.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: ras support suspend/resume
xinhui pan [Thu, 9 May 2019 00:26:27 +0000 (08:26 +0800)]
drm/amdgpu: ras support suspend/resume

add ras suspend function. rename ras_post_init to amdgpu_ras_resume.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: James Zhu <James.Zhu@amd.com>
Tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add badpages sysfs interafce
xinhui pan [Tue, 7 May 2019 03:53:31 +0000 (11:53 +0800)]
drm/amdgpu: add badpages sysfs interafce

add badpages node.
it will output badpages list in format
gpu pfn : gpu page size : flags

example
0x00000000 : 0x00001000 : R
0x00000001 : 0x00001000 : R
0x00000002 : 0x00001000 : R
0x00000003 : 0x00001000 : R
0x00000004 : 0x00001000 : R
0x00000005 : 0x00001000 : R
0x00000006 : 0x00001000 : R
0x00000007 : 0x00001000 : P
0x00000008 : 0x00001000 : P
0x00000009 : 0x00001000 : P

flags can be one of below characters
R: reserved.
P: pending for reserve.
F: failed to reserve for some reasons.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Fix S3 test issue
James Zhu [Wed, 8 May 2019 20:38:58 +0000 (16:38 -0400)]
drm/amdgpu: Fix S3 test issue

During S3 test, when system wake up and resume, ras interface
is already allocated. Move workaround before ras jumps to resume
step in gfx_v9_0_ecc_late_init, and make sure workaround applied
during resume. Also remove unused mmGB_EDC_MODE clearing.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Make some functions static
Wang Hai [Wed, 8 May 2019 12:55:16 +0000 (20:55 +0800)]
drm/amd/display: Make some functions static

Fix the following sparse warnings:

drivers/gpu/drm/amd/amdgpu/../display/dc/dce120/dce120_resource.c:483:21: warning: symbol 'dce120_clock_source_create' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dce120/dce120_resource.c:506:6: warning: symbol 'dce120_clock_source_destroy' was not declared. Should it be static?
drivers/gpu/drm/amd/amdgpu/../display/dc/dce120/dce120_resource.c:513:6: warning: symbol 'dce120_hw_sequencer_create' was not declared. Should it be static?

Fixes: b8fdfcc6a92c ("drm/amd/display: Add DCE12 core support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wang Hai <wanghai26@huawei.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: RLC to program regs for Vega10 SR-IOV
Trigger Huang [Thu, 2 May 2019 12:33:49 +0000 (20:33 +0800)]
drm/amdgpu: RLC to program regs for Vega10 SR-IOV

Under Vega10 SR-IOV, with new RLC's new feature, VF should call RLC
to program some registers if supported

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add basic func for RLC program reg
Trigger Huang [Fri, 1 Mar 2019 03:56:20 +0000 (11:56 +0800)]
drm/amdgpu: add basic func for RLC program reg

New feature for RLC, some registers can be programmed by
RLC interface under SR-IOV VF:

WREG32_SOC15_RLC_SHADOW:
1, for GRBM_GFX_CNTL, firstly the new register value should be be
programmed to SCRATCH_REG2
1, for GRBM_GFX_INDEX, firstly the new register value should be be
programmed to SCRATCH_REG3

WREG32_RLC:
for registers supported to be programmed by RLC interface, the
following sequence should be used:
1, write the value to SCRATCH_REG0
2, write reg | 0x80000000 to SCRATCH_REG1
3, write 0x1 to RLC_SPARE_INT to notify RLC
4, polling SCRATCH_REG1 to check if finished

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Skip setting some regs under Vega10 VF
Trigger Huang [Mon, 4 Mar 2019 04:30:58 +0000 (12:30 +0800)]
drm/amdgpu: Skip setting some regs under Vega10 VF

For Vega10 SR-IOV VF, skip setting some regs due to:
1, host will program them
2, avoid VF register programming violations

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Support PSP VMR ring for Vega10 VF
Trigger Huang [Mon, 25 Feb 2019 10:41:02 +0000 (18:41 +0800)]
drm/amdgpu: Support PSP VMR ring for Vega10 VF

Add VMR ring support for Vega10 SR-IOV VF if PSP supported

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: call psp to program ih cntl in SR-IOV
Trigger Huang [Sun, 28 Apr 2019 10:03:17 +0000 (18:03 +0800)]
drm/amdgpu: call psp to program ih cntl in SR-IOV

call psp to program ih cntl in SR-IOV if supported

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: implement PSP cmd GFX_CMD_ID_PROG_REG
Trigger Huang [Mon, 6 May 2019 07:27:23 +0000 (15:27 +0800)]
drm/amdgpu: implement PSP cmd GFX_CMD_ID_PROG_REG

Add implementation to program regs by PSP, currently the following
IH registers are supported:
IH_RB_CNTL
IH_RB_CNTL_RING1
IH_RB_CNTL_RING2

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Add new PSP cmd GFX_CMD_ID_PROG_REG
Trigger Huang [Mon, 6 May 2019 07:06:17 +0000 (15:06 +0800)]
drm/amdgpu: Add new PSP cmd GFX_CMD_ID_PROG_REG

Add new PSP command GFX_CMD_ID_PROG_REG definition

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: initialize PSP before IH under SR-IOV
Trigger Huang [Wed, 24 Apr 2019 07:23:41 +0000 (15:23 +0800)]
drm/amdgpu: initialize PSP before IH under SR-IOV

In order to support new PSP feature that PSP may provide interface
to program IH CNTL register, initialize PSP before IH under Vega10
SR-IOV VF

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: init vega10 SR-IOV reg access mode
Trigger Huang [Thu, 9 May 2019 09:32:59 +0000 (17:32 +0800)]
drm/amdgpu: init vega10 SR-IOV reg access mode

Set different register access mode according to the features
provided by firmware

Signed-off-by: Trigger Huang <Trigger.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: gpu reset will run ras post init
xinhui pan [Wed, 8 May 2019 16:13:22 +0000 (00:13 +0800)]
drm/amdgpu: gpu reset will run ras post init

ras need initialize proper state after late init

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: sdma support ras gpu reset
xinhui pan [Wed, 8 May 2019 14:38:37 +0000 (22:38 +0800)]
drm/amdgpu: sdma support ras gpu reset

request a gpu reset if ras return EAGAIN.
we will run late init again so it is ok to do nothing this time.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: gfx support ras gpu reset
xinhui pan [Wed, 8 May 2019 14:36:10 +0000 (22:36 +0800)]
drm/amdgpu: gfx support ras gpu reset

request a gpu reset if ras return EAGAIN.
we will run late init again so it is ok to do nothing this time.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: gmc support ras gpu reset
xinhui pan [Wed, 8 May 2019 14:32:34 +0000 (22:32 +0800)]
drm/amdgpu: gmc support ras gpu reset

request a gpu reset if ras return EAGAIN.
we will run late init again so it is ok to do nothing this time.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: handle ras reset
xinhui pan [Wed, 8 May 2019 11:12:24 +0000 (19:12 +0800)]
drm/amdgpu: handle ras reset

add another flag to allow IP do a gpu reset after device init.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Issue ras TA disable/enable cmd forcely on boot
xinhui pan [Wed, 8 May 2019 08:13:03 +0000 (16:13 +0800)]
drm/amdgpu: Issue ras TA disable/enable cmd forcely on boot

Check ras TA error code and return EAGAIN.
Issue ras enable/disable cmd without checking currect state.
Looks like ras TA will handle current state == target state case.

Now driver might need do a reset to satisfy ras TA.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Revert "drm/amdgpu: skip gpu reset when ras error occured"
xinhui pan [Wed, 8 May 2019 11:31:06 +0000 (19:31 +0800)]
drm/amdgpu: Revert "drm/amdgpu: skip gpu reset when ras error occured"

Enable this now to reset the GPU on RAS errors.

This reverts commit 138352e5752aa3e694951d70c8fe8730219f4edf.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: gpu reset will run late_init
xinhui pan [Wed, 8 May 2019 14:17:57 +0000 (22:17 +0800)]
drm/amdgpu: gpu reset will run late_init

ras need late init to initialize proper state.

Signed-off-by: xinhui pan <xinhui.pan@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add df perfmon regs and funcs for xgmi
Jonathan Kim [Fri, 3 May 2019 00:43:00 +0000 (20:43 -0400)]
drm/amdgpu: add df perfmon regs and funcs for xgmi

v6: Squash in warning fix (Colin Ian King)
v5: Fix warnings (Alex)
v4: fixed mixed delaration and code warnings and minor errors
v3: exposing df funcs in amdgpu_df_funcs in amdgpu.h
v2: moving permonctl/perfmonctr from default to offset

- adding df perfmonctl and perfmonctr registers for df counters
- adding df funcs to set perfmonctl and get perfmonctr for
df and xgmi counters
- exposing df funcs in amdgpu_df_funcs

Signed-off-by: Jonathan Kim <jonathan.kim@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add gfx9 gpr EDC workaround when RAS is enabled
James Zhu [Fri, 5 Apr 2019 19:31:47 +0000 (15:31 -0400)]
drm/amdgpu: add gfx9 gpr EDC workaround when RAS is enabled

When RAS is enabled, initializes the VGPRs/LDS/SGPRs and
resets EDC error counts. This is done in late_init, before
RAS TA GFX enable.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: add EDC counter register
James Zhu [Fri, 5 Apr 2019 19:30:07 +0000 (15:30 -0400)]
drm/amdgpu: add EDC counter register

Add EDC counter register to support gfx9 gpr EDC workaround to
clear all EDC counters.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amdgpu: Reserve shared fence for eviction fence
Felix Kuehling [Wed, 1 May 2019 21:43:10 +0000 (17:43 -0400)]
drm/amdgpu: Reserve shared fence for eviction fence

Need to reserve space for the shared eviction fence when initializing
a KFD VM.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Expose send immediate sdp message interface
Leo (Hanghong) Ma [Tue, 16 Apr 2019 15:07:22 +0000 (11:07 -0400)]
drm/amd/display: Expose send immediate sdp message interface

[Why]
To send sdp message immediately from a single slot.

[How]
Modify the generic SDP message interface, and use GSP4 to send immediate
sdp message.

Signed-off-by: Leo (Hanghong) Ma <hanghong.ma@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: Fill plane attrs only for valid pxl format
Roman Li [Thu, 25 Apr 2019 15:02:30 +0000 (11:02 -0400)]
drm/amd/display: Fill plane attrs only for valid pxl format

[Why]
In fill_plane_buffer_attributes() we calculate chroma/luma
assuming that the surface_pixel_format is always valid.
If it's not the case, there's a risk of divide by zero error.

[How]
Check if format valid before calculating pixel format attributes

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: David Francis <David.Francis@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 back vbios cmd table for set dprefclk
Eric Yang [Wed, 24 Apr 2019 23:18:12 +0000 (19:18 -0400)]
drm/amd/display: move back vbios cmd table for set dprefclk

[Why]
Upon closer inspection, our previous implementation is missing
code for programming de-spread and DP DTO. Porting this logic
into driver is rather involved, as there are a lot of table
look ups. So for now move back to calling vbios cmd table

[How]
Go back to calling vbios cmd table for set dp_refclk

Signed-off-by: Eric Yang <Eric.Yang2@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: fix acquire_first_split_pipe function
Dmytro Laktyushkin [Tue, 16 Apr 2019 17:31:22 +0000 (13:31 -0400)]
drm/amd/display: fix acquire_first_split_pipe function

This function needs to re-calculate the scaling on the pipe
that loses it's half.

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: stop external access to internal optc sync params
Dmytro Laktyushkin [Mon, 8 Apr 2019 19:49:52 +0000 (15:49 -0400)]
drm/amd/display: stop external access to internal optc sync params

These are internal otg params and should be handled as such.
Thich change passes the params as function arguments.

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@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 signal type out of otg dlg params
Dmytro Laktyushkin [Mon, 8 Apr 2019 19:04:43 +0000 (15:04 -0400)]
drm/amd/display: move signal type out of otg dlg params

It makes no logical sense being there

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: reset retimer/redriver below 340Mhz
Charlene Liu [Wed, 24 Apr 2019 01:59:54 +0000 (21:59 -0400)]
drm/amd/display: reset retimer/redriver below 340Mhz

[Description]
This is for HDMI 6Ghz mode before we load the driver, because VBIOS
not support HDMI (6Ghz mode)

Reset to redriver/retimer setting for the setting for below 340Mhz.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: color space ycbcr709 support
Charlene Liu [Wed, 17 Apr 2019 23:15:15 +0000 (19:15 -0400)]
drm/amd/display: color space ycbcr709 support

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Duke Du <Duke.Du@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 Byte 14 on AVI InfoFrame
Chris Park [Wed, 17 Apr 2019 22:11:57 +0000 (18:11 -0400)]
drm/amd/display: Define Byte 14 on AVI InfoFrame

[Why]
Part of HDMI 2.1 requires AVI InfoFrame version update
from current V2 to V4 for new colorimetry.

[How]
Define V4 AVI InfoFrame ACE0-ACE3 bit.

Signed-off-by: Chris Park <Chris.Park@amd.com>
Reviewed-by: Nevenko Stupar <Nevenko.Stupar@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/display: 3.2.29
Aric Cyr [Mon, 22 Apr 2019 14:22:44 +0000 (10:22 -0400)]
drm/amd/display: 3.2.29

Signed-off-by: Aric Cyr <aric.cyr@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>