platform/kernel/linux-rpi3.git
6 years agodrm/amdgpu:show error message if fail on event4
Monk Liu [Tue, 14 Nov 2017 08:56:55 +0000 (16:56 +0800)]
drm/amdgpu:show error message if fail on event4

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu:cleanup firmware.fw_buf alloc/free
Monk Liu [Tue, 14 Nov 2017 08:53:51 +0000 (16:53 +0800)]
drm/amdgpu:cleanup firmware.fw_buf alloc/free

use bo_create/free_kernel instead of manually doing it

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>
6 years agodrm/amdgpu:free CSA in unified place
Monk Liu [Tue, 14 Nov 2017 08:52:14 +0000 (16:52 +0800)]
drm/amdgpu:free CSA in unified place

instead of doing it in each GFX ip's sw_fini

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>
6 years agodrm/amdgpu:cleanup unused stack var
Monk Liu [Tue, 14 Nov 2017 08:50:31 +0000 (16:50 +0800)]
drm/amdgpu:cleanup unused stack var

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>
6 years agodrm/amdgpu:fix NULL pointer access during drv remove
Monk Liu [Tue, 14 Nov 2017 03:55:50 +0000 (11:55 +0800)]
drm/amdgpu:fix NULL pointer access during drv remove

NULL pointer is because original logic will step into
set_pde_pte() even after the gart.ptr is freed due to
there are twice gart_unbind() on all gart area.

also, there are other minor fixes:
1,since gart_init only create dummy page, the corresponding
gart_fini shouldn't do more like unbinding all GART, this is
unnecessary because in driver fini stage all GART unbinding
had already been done during each IP's SW_FINI (GMC's
SW_FINI is the last one called), so remove the step
for the GART unbinding in gart_fini().

2,gart_fini() is already invoked during each GMC IP's gart_fini
routine,e.g. gmc_vx_0_gart_fini(), so no need to manually
call it during ttm_fini().

3,amdgpu_gem_force_release() should be put ahead of
amdgpu_vm_manager_fini()

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>
6 years agodrm/amdgpu:cleanup GMC & gart garbage function
Monk Liu [Tue, 14 Nov 2017 03:52:35 +0000 (11:52 +0800)]
drm/amdgpu:cleanup GMC & gart garbage function

for gart_ram_alloc/free, they are never used in driver thus
ripe them out totally.

for gart_vram_pin/unpin, they are not needed becuase we can
use bo_creat_kernel/free to replace the original manual way
in the gart_vram_alloc/free, thus gart_vram_pin/unpin can
also be riped out.

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>
6 years agodrm/amdgpu:cleanup stolen vga memory finish
Monk Liu [Mon, 13 Nov 2017 12:41:56 +0000 (20:41 +0800)]
drm/amdgpu:cleanup stolen vga memory finish

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>
6 years agoamdgpu: Don't use DRM_ERROR when failing to allocate a BO
Michel Dänzer [Wed, 15 Nov 2017 10:37:23 +0000 (11:37 +0100)]
amdgpu: Don't use DRM_ERROR when failing to allocate a BO

This can be triggered by userspace, e.g. trying to allocate too large a
BO, so it shouldn't log anything by default.

Callers need to handle failure anyway.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
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>
6 years agodrm/amd/amdgpu: not allow gtt size exceed 75%*system memory size
Roger He [Fri, 10 Nov 2017 11:05:13 +0000 (19:05 +0800)]
drm/amd/amdgpu: not allow gtt size exceed 75%*system memory size

keep consistency with threshold of swapout

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add ability to determine and report if board supports ECC.
David Panariti [Fri, 15 Sep 2017 20:30:08 +0000 (16:30 -0400)]
drm/amdgpu: Add ability to determine and report if board supports ECC.

Make initialization code check the ECC related registers, which are initialized
by the VBIOS, to see if ECC is present and initialized and DRM_INFO() the
result.

Signed-off-by: David Panariti <David.Panariti@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: New header for fields needed to determine state of ECC.
David Panariti [Fri, 15 Sep 2017 17:25:38 +0000 (13:25 -0400)]
drm/amdgpu: New header for fields needed to determine state of ECC.

Add header files with ECC related definitions
(MASKs, SHIFTs, DEFAULTs and OFFSETS).

Signed-off-by: David Panariti <David.Panariti@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: optimize ttm_mem_evict_first v5
Christian König [Wed, 8 Nov 2017 14:55:44 +0000 (15:55 +0100)]
drm/ttm: optimize ttm_mem_evict_first v5

Deleted BOs with the same reservation object can be reaped even if they
can't be reserved.

v2: rebase and we still need to remove/add the BO from/to the LRU.
v3: fix remove/add one more time, cleanup the logic a bit
v4: we should still check if the eviction is valuable
v5: add comment suggested by Michel

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gfx6: use cached values for raster config in clear state
Alex Deucher [Mon, 13 Nov 2017 20:48:37 +0000 (15:48 -0500)]
drm/amdgpu/gfx6: use cached values for raster config in clear state

Use the cached values rather than hardcoding it.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gfx7: use cached values for raster config in clear state
Alex Deucher [Mon, 13 Nov 2017 20:45:31 +0000 (15:45 -0500)]
drm/amdgpu/gfx7: use cached values for raster config in clear state

Use the cached values rather than hardcoding it.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gfx8: use cached values for raster config in clear state
Alex Deucher [Mon, 13 Nov 2017 20:42:57 +0000 (15:42 -0500)]
drm/amdgpu/gfx8: use cached values for raster config in clear state

Use the cached values rather than hardcoding it.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix use before initialize warning
Leo (Sunpeng) Li [Wed, 8 Nov 2017 20:30:19 +0000 (15:30 -0500)]
drm/amd/display: Fix use before initialize warning

on stream_for_cursor. Initialize to NULL.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix Linux after optimize frontend programming
Harry Wentland [Wed, 8 Nov 2017 21:51:03 +0000 (16:51 -0500)]
drm/amd/display: Fix Linux after optimize frontend programming

We still require the update_plane_addr call in commit_planes_for_stream.

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>
6 years agodrm/amd/display: remove stream_func vtable
Tony Cheng [Wed, 8 Nov 2017 22:58:51 +0000 (17:58 -0500)]
drm/amd/display: remove stream_func vtable

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Sun peng Li <Sunpeng.Li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: make unlocking in ttm_bo_cleanup_refs optional v3
Christian König [Wed, 8 Nov 2017 13:57:45 +0000 (14:57 +0100)]
drm/ttm: make unlocking in ttm_bo_cleanup_refs optional v3

Needed for the next patch.

v2: actually predicate all unlocks
v3: add some cleanups suggested by Michel.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove unnecessary dc_stream vtable
Harry Wentland [Wed, 1 Nov 2017 15:43:36 +0000 (11:43 -0400)]
drm/amd/display: Remove unnecessary dc_stream vtable

There's no need to have this as a vtable. The vtable was initially
used for stream_adjust_vmin_vmax but the condition checked here
(set_drr) is always true, hence we don't need to assign this
dynamically anymore.

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>
6 years agodrm/amd/display: Move dc_link interface to separate header
Harry Wentland [Wed, 8 Nov 2017 19:59:48 +0000 (14:59 -0500)]
drm/amd/display: Move dc_link interface to separate header

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>
6 years agodrm/amd/display: Move dc_stream interface to separate header
Harry Wentland [Wed, 8 Nov 2017 19:34:14 +0000 (14:34 -0500)]
drm/amd/display: Move dc_stream interface to separate header

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>
6 years agodrm/amd/display: Optimize front end programming.
Yongqiang Sun [Wed, 8 Nov 2017 19:50:06 +0000 (14:50 -0500)]
drm/amd/display: Optimize front end programming.

for video scaling changes,
Reduce reg access count from 1044 to 447, duration time
from 4.6ms to 3ms.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: Fix unused variable warning
Leo (Sunpeng) Li [Wed, 8 Nov 2017 17:00:51 +0000 (12:00 -0500)]
drm/amd/display: Fix unused variable warning

'struct mpc *mpc' is not used.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@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>
6 years agodrm/amd/display: Add check update surfaces for stream wrapper
Andrew Jiang [Wed, 8 Nov 2017 17:15:17 +0000 (12:15 -0500)]
drm/amd/display: Add check update surfaces for stream wrapper

This allows us to properly clear and set the update flags for all cases.

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: Rename pitch_alignment to linear_pitch_alignment
Andrew Jiang [Wed, 8 Nov 2017 14:21:28 +0000 (09:21 -0500)]
drm/amd/display: Rename pitch_alignment to linear_pitch_alignment

Also initialize this to 64 for all ASICs.

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: Added Opp and Diags Interface for P to I
Arun Pandey [Wed, 8 Nov 2017 09:02:55 +0000 (17:02 +0800)]
drm/amd/display: Added Opp and Diags Interface for P to I

Signed-off-by: Arun Pandey <Arun.Pandey@amd.com>
Reviewed-by: Charlene Liu <Charlene.Liu@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix plane update prior to stream enablement
Tony Cheng [Wed, 8 Nov 2017 04:37:49 +0000 (23:37 -0500)]
drm/amd/display: fix plane update prior to stream enablement

plane update prior to stream enablement is there to recombine pipe
in case we need free pipe for new display.  need to pass in new state
or we will just re-applyingwhat we already have

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: Add update flags in to determine surface update type
Andrew Jiang [Mon, 6 Nov 2017 22:00:07 +0000 (17:00 -0500)]
drm/amd/display: Add update flags in to determine surface update type

This way, we can know exactly what triggered the update type we're
looking at, and we can simplify the logic for determining what exactly
needs to be updated in the future.

Also allow a dst rect size increase to go through a medium update,
since that does not require us to increase clock or bandwidth.

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: Remove legacy unused workaround
Andrew Jiang [Tue, 7 Nov 2017 19:54:56 +0000 (14:54 -0500)]
drm/amd/display: Remove legacy unused workaround

We shouldn't be able to get a non-visible plane into DC anymore.

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: Early return on stream programming failure
Leo (Sunpeng) Li [Tue, 7 Nov 2017 20:54:58 +0000 (15:54 -0500)]
drm/amd/display: Early return on stream programming failure

The fail goto is incorrect. It will incorrectly release the dc_states on
stream programming failure.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@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>
6 years agodrm/amd/display: Change frontend/backend programming sequence
Leo (Sunpeng) Li [Tue, 7 Nov 2017 18:51:02 +0000 (13:51 -0500)]
drm/amd/display: Change frontend/backend programming sequence

This is a follow-up to the following change:

Yongqiang Sun: Program front end first when set mode.

Due to pipe-splitting features, how we handle stream enabling and
disabling needs to change.

In the case of pipe split disable, two planes need to be combined back
into the same stream. This needs to be done before any stream
programming happens.

The previous patch addresses this, but breaks cross-platform
compatibility. It's not guaranteed that a dc commit will be called
separately to program planes and streams.

Therefore, we handle the combined commit case by doing plane programming
both before and after stream programming, to handle pipe split disable
and plane enable respectively.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@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>
6 years agodrm/amd/display: Remove dangling planes on dc commit state
Leo (Sunpeng) Li [Tue, 7 Nov 2017 18:21:02 +0000 (13:21 -0500)]
drm/amd/display: Remove dangling planes on dc commit state

When disabling pipe splitting, we need to make sure we disable both
planes used.

This should be done for Linux as well.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@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>
6 years agodrm/amd/display: Optimize programming front end
Yongqiang Sun [Tue, 7 Nov 2017 16:01:34 +0000 (11:01 -0500)]
drm/amd/display: Optimize programming front end

In case of update type is medium, optimize squence,
reduce programing time.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: Fix unbalanced locking in surface apply
Roman Li [Tue, 7 Nov 2017 15:58:40 +0000 (10:58 -0500)]
drm/amd/display: Fix unbalanced locking in surface apply

also simplifying syntax and removing unused variable in
dce110_apply_ctx_for_surface()

Signed-off-by: Roman Li <Roman.Li@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>
6 years agodrm/amd/display: Apply work around for stutter.
Yongqiang Sun [Mon, 6 Nov 2017 19:40:31 +0000 (14:40 -0500)]
drm/amd/display: Apply work around for stutter.

Power on one plane after disable all the planes, for
a hw bug work around to resolve stutter efficiency issue.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: remove dcn10 wait on tg unlock
Dmytro Laktyushkin [Tue, 31 Oct 2017 21:29:18 +0000 (17:29 -0400)]
drm/amd/display: remove dcn10 wait on tg unlock

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@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>
6 years agodrm/amd/display: Loosen plane_info and scaling_info checks
Andrew Jiang [Mon, 6 Nov 2017 20:53:36 +0000 (15:53 -0500)]
drm/amd/display: Loosen plane_info and scaling_info checks

Make it so that differing dcc and plane size fields don't necessarily
result in a full update, along with upscaling modes. This allows us to
save some unnecessary full updates.

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: Report pitch_alignment for DCN
Andrew Jiang [Mon, 6 Nov 2017 16:56:21 +0000 (11:56 -0500)]
drm/amd/display: Report pitch_alignment for DCN

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: combine output signal and signal
Eric Yang [Fri, 3 Nov 2017 21:58:42 +0000 (17:58 -0400)]
drm/amd/display: combine output signal and signal

output signal used to be a public member to be used by DM to override
the stream signal. Now since there is no longer separation between
public and private part of stream, they are combined. The overriding
was not working properly as well, which is addressed by this change

Signed-off-by: Eric Yang <Eric.Yang2@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>
6 years agodrm/amd/display: A few more color indentation changes
Harry Wentland [Wed, 1 Nov 2017 18:31:58 +0000 (14:31 -0400)]
drm/amd/display: A few more color indentation changes

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Remove unused register read in program_pwl
Harry Wentland [Tue, 31 Oct 2017 19:17:27 +0000 (15:17 -0400)]
drm/amd/display: Remove unused register read in program_pwl

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Bunch more color indentation cleanups
Harry Wentland [Tue, 31 Oct 2017 19:16:56 +0000 (15:16 -0400)]
drm/amd/display: Bunch more color indentation cleanups

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: Remove extra arr_points element
Harry Wentland [Tue, 31 Oct 2017 18:41:41 +0000 (14:41 -0400)]
drm/amd/display: Remove extra arr_points element

arr_points[1] and [2] were duplicated. Remove the extra
one. If we ever need more points we can add them but the
current state of affairs is confusing.

Signed-off-by: Harry Wentland <harry.wentland@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>
6 years agodrm/amd/display: dal 3.1.16
Tony Cheng [Fri, 3 Nov 2017 20:33:14 +0000 (16:33 -0400)]
drm/amd/display: dal 3.1.16

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: always call set output tf
Eric Yang [Fri, 3 Nov 2017 20:21:37 +0000 (16:21 -0400)]
drm/amd/display: always call set output tf

Temporary solution to fix gamma adjustment not
working.

Signed-off-by: Eric Yang <Eric.Yang2@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>
6 years agodrm/amd/display: Fixed not set scaler bug.
Yongqiang Sun [Fri, 3 Nov 2017 20:02:50 +0000 (16:02 -0400)]
drm/amd/display: Fixed not set scaler bug.

New scaler parameter assign to dpp is after early return,
cause next flip scaler not program.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: dal 3.1.15
Tony Cheng [Thu, 2 Nov 2017 22:53:26 +0000 (18:53 -0400)]
drm/amd/display: dal 3.1.15

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: Remove unused OPP functions from interface
Eric Bernstein [Thu, 2 Nov 2017 21:39:48 +0000 (17:39 -0400)]
drm/amd/display: Remove unused OPP functions from interface

Signed-off-by: Eric Bernstein <eric.bernstein@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>
6 years agodrm/amd/display: fix dcn10_hubbub_wm_read_state
Ken Chalmers [Thu, 2 Nov 2017 21:21:35 +0000 (17:21 -0400)]
drm/amd/display: fix dcn10_hubbub_wm_read_state

The ALLOW_SR registers might not always be available.

Signed-off-by: Ken Chalmers <ken.chalmers@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>
6 years agodrm/amd/display: Add transfer function to dc_surface_update
SivapiriyanKumarasamy [Thu, 2 Nov 2017 19:28:32 +0000 (15:28 -0400)]
drm/amd/display: Add transfer function to dc_surface_update

Signed-off-by: SivapiriyanKumarasamy <sivapiriyan.kumarasamy@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>
6 years agodrm/amd/display: send display_count msg so SMU can enter S0i2
Hersen Wu [Tue, 31 Oct 2017 19:55:15 +0000 (15:55 -0400)]
drm/amd/display: send display_count msg so SMU can enter S0i2

SMU can future lower voltages in long idle case when all display is off.

If all display output is turned off via DPMS, send display_count = 0
after all output are turned off.

otherwise send display_count msg before turning on display to make sure
SMU exit S0i2 state.  before is not neccessary as we are out of S0i2
when driver execute code, but send message before anyways for correctness.

Signed-off-by: Hersen Wu <hersenxs.wu@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>
6 years agodrm/amd/display: Modified front end initiail in init_hw
Yongqiang Sun [Thu, 2 Nov 2017 17:24:20 +0000 (13:24 -0400)]
drm/amd/display: Modified front end initiail in init_hw

Optimized front end initial sequence, reset MPC module
properly.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: add warning on long reg_wait
Dmytro Laktyushkin [Thu, 2 Nov 2017 18:55:14 +0000 (14:55 -0400)]
drm/amd/display: add warning on long reg_wait

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@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>
6 years agodrm/amd/display: remove unnecessary waits in dcn10
Dmytro Laktyushkin [Tue, 31 Oct 2017 22:05:31 +0000 (18:05 -0400)]
drm/amd/display: remove unnecessary waits in dcn10

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix uninitialized variable warning
Dmytro Laktyushkin [Thu, 2 Nov 2017 19:07:25 +0000 (15:07 -0400)]
drm/amd/display: fix uninitialized variable warning

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix regamma programming
Dmytro Laktyushkin [Thu, 2 Nov 2017 14:52:09 +0000 (10:52 -0400)]
drm/amd/display: fix regamma programming

When new coefficients match cached we would skip setting regamma mode
Also, when doing a stream update we would program regamma for all pipes,
even thos that are not yet powered on. This resulted in never setting
regamma since we would cache before the pipe is powered.

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@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>
6 years agodrm/amd/display: Fix some more color indentations
Harry Wentland [Tue, 31 Oct 2017 20:27:59 +0000 (16:27 -0400)]
drm/amd/display: Fix some more color indentations

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>
6 years agodrm/amd/display: Bunch of indentation cleanups in color stuff
Harry Wentland [Tue, 31 Oct 2017 18:34:13 +0000 (14:34 -0400)]
drm/amd/display: Bunch of indentation cleanups in color stuff

Trying to align with kernel coding style and make it a bit more
readable.

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>
6 years agodrm/amd/display: Refactor disable front end pipes.
Yongqiang Sun [Mon, 30 Oct 2017 21:32:14 +0000 (17:32 -0400)]
drm/amd/display: Refactor disable front end pipes.

There are different code to disable front end, it is
difficult to debug and adding new process.
This refactor makes all disable front end call the same
functions.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: dal 3.1.14
Tony Cheng [Thu, 2 Nov 2017 01:52:21 +0000 (21:52 -0400)]
drm/amd/display: dal 3.1.14

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: renaming dpp function to follow naming convention
Yue Hin Lau [Tue, 31 Oct 2017 19:23:57 +0000 (15:23 -0400)]
drm/amd/display: renaming dpp function to follow naming convention

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Yuehin Lau <Yuehin.Lau@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: dal 3.1.13
Tony Cheng [Tue, 31 Oct 2017 21:55:20 +0000 (17:55 -0400)]
drm/amd/display: dal 3.1.13

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: call set csc_default if enable adjustment is false
Yue Hin Lau [Fri, 27 Oct 2017 19:28:38 +0000 (15:28 -0400)]
drm/amd/display: call set csc_default if enable adjustment is false

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Eric Bernstein <Eric.Bernstein@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add OPP DPG blank function
Eric Bernstein [Tue, 31 Oct 2017 15:52:25 +0000 (11:52 -0400)]
drm/amd/display: Add OPP DPG blank function

Added a function to blank data using OPP DPG.
Clean up code to prepare for pseudocode review with HW.

Signed-off-by: Eric Bernstein <eric.bernstein@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>
6 years agodrm/amd/display: dal 3.1.12
Tony Cheng [Tue, 31 Oct 2017 17:51:40 +0000 (13:51 -0400)]
drm/amd/display: dal 3.1.12

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: cache pwl params and scl_data to avoid extra programming
Dmytro Laktyushkin [Fri, 27 Oct 2017 21:55:03 +0000 (17:55 -0400)]
drm/amd/display: cache pwl params and scl_data to avoid extra programming

This saves us about 5000 reg writes per full update. This translates to about
40000 writes over the course of single eDP bootup.

Signed-off-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@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>
6 years agodrm/amd/display: Don't use dc_link in link_encoder
Andrew Jiang [Tue, 26 Sep 2017 23:45:43 +0000 (19:45 -0400)]
drm/amd/display: Don't use dc_link in link_encoder

dc_link is at a higher level than link_encoder, and we only want
higher-level components to be able to access lower-level ones,
not the other way around.

Signed-off-by: Andrew Jiang <Andrew.Jiang@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>
6 years agodrm/amd/display: Both timing_sync and multisync need stream_count > 1
Harry Wentland [Mon, 30 Oct 2017 19:53:40 +0000 (15:53 -0400)]
drm/amd/display: Both timing_sync and multisync need stream_count > 1

Previous code threw a warning about misleading indentation

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add tg_init interface.
Yongqiang Sun [Mon, 30 Oct 2017 17:35:04 +0000 (13:35 -0400)]
drm/amd/display: Add tg_init interface.

Clear OPTC underflow status when init_hw.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: Enalbe blank data double buffer after mpc disconnected.
Yongqiang Sun [Mon, 23 Oct 2017 19:57:52 +0000 (15:57 -0400)]
drm/amd/display: Enalbe blank data double buffer after mpc disconnected.

Signed-off-by: Yongqiang Sun <yongqiang.sun@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>
6 years agodrm/amd/display: get remote dpcd caps for timing validation
Eric Yang [Mon, 23 Oct 2017 16:06:54 +0000 (12:06 -0400)]
drm/amd/display: get remote dpcd caps for timing validation

Signed-off-by: Eric Yang <Eric.Yang2@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>
6 years agodrm/amd/display: Only update dchub if hubbub is available
Yue Hin Lau [Thu, 26 Oct 2017 20:30:44 +0000 (16:30 -0400)]
drm/amd/display: Only update dchub if hubbub is available

Signed-off-by: Yue Hin Lau <Yuehin.Lau@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>
6 years agodrm/amd/display: Call ipp_program_bias_and_scale only if available
Eric Bernstein [Thu, 26 Oct 2017 22:13:36 +0000 (18:13 -0400)]
drm/amd/display: Call ipp_program_bias_and_scale only if available

Also move some register definitions to common DCN regs.

Signed-off-by: Eric Bernstein <eric.bernstein@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>
6 years agodrm/amd/display: dal 3.1.11
Tony Cheng [Thu, 26 Oct 2017 03:28:38 +0000 (23:28 -0400)]
drm/amd/display: dal 3.1.11

Signed-off-by: Tony Cheng <tony.cheng@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>
6 years agodrm/amd/display: hubbub function flipping true and false
Yue Hin Lau [Thu, 26 Oct 2017 15:29:54 +0000 (11:29 -0400)]
drm/amd/display: hubbub function flipping true and false

no logic change

Signed-off-by: Yue Hin Lau <Yuehin.Lau@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>
6 years agodrm/amd/display: Do post_update_surfaces on new state
Charlene Liu [Thu, 26 Oct 2017 00:30:46 +0000 (20:30 -0400)]
drm/amd/display: Do post_update_surfaces on new state

Signed-off-by: Charlene Liu <charlene.liu@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>
6 years agodrm/amd/display: function renaming for hubbub
Yue Hin Lau [Tue, 24 Oct 2017 19:16:38 +0000 (15:16 -0400)]
drm/amd/display: function renaming for hubbub

following the naming convention with correct prefix

Signed-off-by: Yue Hin Lau <Yuehin.Lau@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>
6 years agodrm/amd/display: create new function prototype update_dchub for dcn
Yue Hin Lau [Tue, 24 Oct 2017 18:13:16 +0000 (14:13 -0400)]
drm/amd/display: create new function prototype update_dchub for dcn

dcn version of update_dchub now uses hubbub instead of hwseq

Signed-off-by: Yue Hin Lau <Yuehin.Lau@amd.com>
Reviewed-by: Dmytro Laktyushkin <Dmytro.Laktyushkin@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/virt: remove redundant variable pf2vf_ver
Colin Ian King [Sat, 11 Nov 2017 11:51:10 +0000 (11:51 +0000)]
drm/amdgpu/virt: remove redundant variable pf2vf_ver

Variable pf2vf_ver is assigned but never read, it is redundant and
hence can be removed.

Cleans up clang warning:
drivers/gpu/drm/amd/amdgpu/amdgpu_virt.c:310:3: warning: Value stored
to 'pf2vf_ver' is never read

Reivewed-by: Horace Chen <horace.chen@amd.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/amdgpu: fix UVD mc offsets
Piotr Redlewski [Fri, 10 Nov 2017 18:28:01 +0000 (19:28 +0100)]
drm/amd/amdgpu: fix UVD mc offsets

When UVD bo is created, its size is based on the information from firmware
header (ucode_size_bytes). The same value should be be used when programming
UVD mc controller offsets, otherwise it can happen that
(mmUVD_VCPU_CACHE_OFFSET2 + mmUVD_VCPU_CACHE_SIZE2) will point
AMDGPU_GPU_PAGE_SIZE bytes after the UVD bo end.

Second issue is that when programming the mmUVD_VCPU_CACHE_SIZE0 register,
AMDGPU_UVD_FIRMWARE_OFFSET should be taken into account. If it isn't,
(mmUVD_VCPU_CACHE_OFFSET2 + mmUVD_VCPU_CACHE_SIZE2) will always point
AMDGPU_UVD_FIRMWARE_OFFSET bytes after the UVD bo end.

v2: move firmware size calculation into macro definition
v3: align firmware size to the gpu page size

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Piotr Redlewski <predlewski@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Multi display synchronization logic
Mikita Lipski [Tue, 17 Oct 2017 19:29:22 +0000 (15:29 -0400)]
drm/amd/display: Multi display synchronization logic

This feature synchronizes multiple displays with various timings
to a display with the highest refresh rate
it is enabled if edid caps flag multi_display_sync is set to one

There are limitations on refresh rates allowed
that can be synchronized. That would
prevent from underflow and other potential
corruptions.

Multi display synchronization is using the
same functions as timing_sync in order to minimize
redunduncy and decision to disable synchronization is
based on trigger parametre set in DM

Feature is developed for DCN1 and DCE11

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Implement BO size validation V2
Andrey Grodzovsky [Fri, 10 Nov 2017 23:35:56 +0000 (18:35 -0500)]
drm/amdgpu: Implement BO size validation V2

Validates BO size against each requested domain's total memory.

v2:
Make GTT size check a MUST to allow fall back to GTT.
Rmove redundant NULL check.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: cleanup vm_size handling
Christian König [Sat, 4 Nov 2017 15:51:44 +0000 (16:51 +0100)]
drm/amdgpu: cleanup vm_size handling

It's pointless to have the same value twice, just always use max_pfn.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove nonsense const u32 cast on ARRAY_SIZE result
Christian König [Fri, 3 Nov 2017 14:59:25 +0000 (15:59 +0100)]
drm/amdgpu: remove nonsense const u32 cast on ARRAY_SIZE result

Not sure what that should originally been good for, but it doesn't seem
to make any sense any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use dep_sync for CS dependency/syncobj
Chunming Zhou [Mon, 13 Nov 2017 02:51:57 +0000 (10:51 +0800)]
drm/amdgpu: use dep_sync for CS dependency/syncobj

Otherwise, they could be optimized by scheduled fence.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gfx8: Fix compute ring failure after resetting
Xiangliang.Yu [Fri, 10 Nov 2017 06:23:38 +0000 (14:23 +0800)]
drm/amdgpu/gfx8: Fix compute ring failure after resetting

Do ring clear before ring test, otherwise compute ring test will
fail after gpu resetting. Still can't find the root cause, just
workaround it.

Signed-off-by: Xiangliang.Yu <Xiangliang.Yu@amd.com>
Acked-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: remove ttm_bo_unreserve_ticket
Christian König [Wed, 8 Nov 2017 20:06:03 +0000 (21:06 +0100)]
drm/ttm: remove ttm_bo_unreserve_ticket

Just another alias for ttm_bo_unreserve.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: user reservation object wrappers v2
Christian König [Wed, 8 Nov 2017 20:02:31 +0000 (21:02 +0100)]
drm/ttm: user reservation object wrappers v2

Consistently use the reservation object wrappers instead of accessing
the ww_mutex directly.

Additional to that use the reservation object wrappers directly instead of
calling __ttm_bo_reserve with fixed parameters.

v2: fix typo

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: consistently use reservation_object_unlock
Christian König [Wed, 8 Nov 2017 13:38:34 +0000 (14:38 +0100)]
drm/ttm: consistently use reservation_object_unlock

Instead of having a confusing wrapper or call the underlying ww_mutex
function directly.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: move unlocking out of ttm_bo_cleanup_memtype_use
Christian König [Wed, 8 Nov 2017 11:37:35 +0000 (12:37 +0100)]
drm/ttm: move unlocking out of ttm_bo_cleanup_memtype_use

Needed for the next patch and makes the code quite a bit easier to
understand.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/scheduler: add WARN_ON for s_fence->parent
Chunming Zhou [Tue, 7 Nov 2017 02:27:43 +0000 (10:27 +0800)]
drm/amd/scheduler: add WARN_ON for s_fence->parent

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/scheduler: fix page protection of cb
Chunming Zhou [Tue, 7 Nov 2017 02:40:00 +0000 (10:40 +0800)]
drm/amd/scheduler: fix page protection of cb

We must remove the fence callback.

Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: revise retry init to fully cleanup driver
Pixel Ding [Wed, 8 Nov 2017 03:03:14 +0000 (11:03 +0800)]
drm/amdgpu: revise retry init to fully cleanup driver

Retry at drm_dev_register instead of amdgpu_device_init.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dm: Remove fb_location form fill_plane_attributes
Harry Wentland [Wed, 8 Nov 2017 14:58:59 +0000 (09:58 -0500)]
amdgpu/dm: Remove fb_location form fill_plane_attributes

We no longer set the framebuffer address here so this is now
dead code.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu:fix gpu recover missing skipping(v2)
Monk Liu [Wed, 8 Nov 2017 06:35:04 +0000 (14:35 +0800)]
drm/amdgpu:fix gpu recover missing skipping(v2)

if app close CTX right after IB submit, gpu recover
will fail to find out the entity behind this guilty
job thus lead to no job skipping for this guilty job.

to fix this corner case just move the increasement of
job->karma out of the entity iteration.

v2:
only do karma increasment if bad->s_priority != KERNEL
because we always consider KERNEL job be correct and always
want to recover an unfinished kernel job (sometimes kernel
job is interrupted by VF FLR or other GPU hang event)

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-By: Xiangliang Yu <Xiangliang.Yu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu:read VRAMLOST from gim
Monk Liu [Mon, 30 Oct 2017 12:11:54 +0000 (20:11 +0800)]
drm/amdgpu:read VRAMLOST from gim

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: bypass FB resizing for SRIOV VF
pding [Tue, 7 Nov 2017 03:02:00 +0000 (11:02 +0800)]
drm/amdgpu: bypass FB resizing for SRIOV VF

It introduces 900ms latency in exclusive mode which causes failure
of driver loading. Host can resize the BAR before guest staring,
so the resizing is not necessary here.

Signed-off-by: Pixel Ding <Pixel.Ding@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: release exclusive mode after hw_init
pding [Mon, 6 Nov 2017 03:21:55 +0000 (11:21 +0800)]
drm/amdgpu: release exclusive mode after hw_init

Signed-off-by: pding <Pixel.Ding@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdkfd: initialise kfd inside amdgpu_device_init
pding [Mon, 6 Nov 2017 02:21:26 +0000 (10:21 +0800)]
drm/amdkfd: initialise kfd inside amdgpu_device_init

Also finalize kfd inside amdgpu_device_fini. kfd device_init needs
SRIOV exclusive accessing. Try to gather exclusive accessing to
reduce time consuming.

Signed-off-by: pding <Pixel.Ding@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>