platform/kernel/linux-rpi.git
6 years agodrm/amdgpu: Basic emulation support
Shaoyun Liu [Thu, 1 Feb 2018 22:37:50 +0000 (17:37 -0500)]
drm/amdgpu: Basic emulation support

Add amdgpu_emu_mode module parameter to control the emulation mode
Avoid vbios operation on emulation since there is no vbios post duirng emulation,
use the common hw_init to simulate the post

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Acked-By: Alex Deucher <alexander.deucher@amd.com>
Acked-By: Christian Konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add new device to use atpx quirk
Kai-Heng Feng [Thu, 8 Feb 2018 09:46:01 +0000 (17:46 +0800)]
drm/amdgpu: add new device to use atpx quirk

The affected system (0x0813) is pretty similar to another one (0x0812),
it also needs to use ATPX power control.

Signed-off-by: Kai-Heng Feng <kai.heng.feng@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/pp: Restore power profile mode in auto dpm level on Vega10
Rex Zhu [Fri, 2 Feb 2018 09:13:02 +0000 (17:13 +0800)]
drm/amd/pp: Restore power profile mode in auto dpm level on Vega10

As auto power profile mode still not support on vega10, so
just restore default profile mode in auto dpm level.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Get/set dgpu power cap via hwmon API
Rex Zhu [Mon, 29 Jan 2018 10:07:01 +0000 (18:07 +0800)]
drm/amdgpu: Get/set dgpu power cap via hwmon API

v2: change power unit to microWatt

Adust power limit through power1_cap
Get min/max power limit through power1_cap_min/power1_cap_max

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Expose set/get_power_limit for DGPU
Rex Zhu [Mon, 29 Jan 2018 10:04:18 +0000 (18:04 +0800)]
drm/amd/pp: Expose set/get_power_limit for DGPU

User can change power limit between
[0, 1] * max power limit.

Set power limit to 0, restore to max power limit.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoamdgpu/dc: Fix enum mismatch in calls to program_color_matrix()
Matthias Kaehlcke [Wed, 7 Feb 2018 21:43:52 +0000 (13:43 -0800)]
amdgpu/dc: Fix enum mismatch in calls to program_color_matrix()

The driver passes GRAPHICS_CSC_ADJUST_TYPE_SW of type enum
graphics_csc_adjust_type to program_color_matrix(), however the function
expects a parameter of type enum grph_color_adjust_option. Supposedly
the intention was to pass GRPH_COLOR_MATRIX_SW, which has the same value
as GRAPHICS_CSC_ADJUST_TYPE_SW, so the mismatch didn't cause any trouble.

Pass GRPH_COLOR_MATRIX_SW to program_color_matrix() instead of
GRAPHICS_CSC_ADJUST_TYPE_SW, this also fixes the following warning when
building the kernel with clang:

drivers/gpu/drm/amd/amdgpu/../display/dc/dce/dce_transform.c:1129:24:
  error: implicit conversion from enumeration type
  'enum graphics_csc_adjust_type' to different enumeration type
  'enum grph_color_adjust_option' [-Werror,-Wenum-conversion]
    xfm_dce, tbl_entry, GRAPHICS_CSC_ADJUST_TYPE_SW);

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove extra pairs of parentheses in dce_calcs.c
Matthias Kaehlcke [Wed, 7 Feb 2018 19:49:28 +0000 (11:49 -0800)]
drm/amd/display: Remove extra pairs of parentheses in dce_calcs.c

The double parentheses are not needed. Removing them fixes multiple
warnings like this when building with clang:

drivers/gpu/drm/amd/amdgpu/../display/dc/calcs/dce_calcs.c:617:42:
  error: equality comparison with extraneous parentheses
    [-Werror,-Wparentheses-equality]
  if ((data->graphics_micro_tile_mode == bw_def_rotated_micro_tiling)) {

Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Enable ip block bit mask print out info by default
Shaoyun Liu [Thu, 1 Feb 2018 21:45:26 +0000 (16:45 -0500)]
drm/amdgpu: Enable ip block bit mask print out info by default

Signed-off-by: Shaoyun Liu <Shaoyun.Liu@amd.com>
Reviewed-by: Christian Konig <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Remove extra pair of parentheses
Matthias Kaehlcke [Wed, 7 Feb 2018 19:10:17 +0000 (11:10 -0800)]
drm/amd/powerplay: Remove extra pair of parentheses

The double parentheses are not needed. Removing them fixes the following
warning when building with clang:

drivers/gpu/drm/amd/powerplay/smumgr/tonga_smumgr.c:419:29:
  error: equality comparison with extraneous parentheses
    [-Werror,-Wparentheses-equality]
  if ((data->vdd_gfx_control == SMU7_VOLTAGE_CONTROL_BY_SVID2)) {

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Fix enum mismatch
Matthias Kaehlcke [Wed, 7 Feb 2018 18:58:43 +0000 (10:58 -0800)]
drm/amd/powerplay: Fix enum mismatch

In several locations the driver uses AMD_CG_STATE_UNGATE (type enum
amd_clockgating_state) instead of AMD_PG_STATE_UNGATE (type enum
amd_powergating_stat) and vice versa. Both constants have the same
value, so this doesn't cause any problems, but we still want to pass
the correct type.

Fixing the mismatch resolves multiple warnings like this when building
with clang:

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/cz_clockpowergating.c:169:7:
  error: implicit conversion from enumeration type 'enum
  amd_powergating_state' to different enumeration type 'enum
  amd_clockgating_state' [-Werror,-Wenum-conversion]
    AMD_PG_STATE_UNGATE);

Reviewed-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Matthias Kaehlcke <mka@chromium.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add mmhub powergating set by smu
Eric Huang [Tue, 6 Feb 2018 21:21:05 +0000 (16:21 -0500)]
drm/amdgpu: add mmhub powergating set by smu

PSP will disable legacy mmhub PG setting that is programming
registers, and drive will use SMC message to
set it up.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: add mmhub powergating by smu in powerplay
Eric Huang [Tue, 6 Feb 2018 19:38:38 +0000 (14:38 -0500)]
drm/amd/powerplay: add mmhub powergating by smu in powerplay

new generic interface is added in powerplay.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven
Eric Huang [Tue, 6 Feb 2018 19:42:04 +0000 (14:42 -0500)]
drm/amd/powerplay: implement set_mmhub_powergating_by_smu for Raven

mmhub PG is enabled by SMU FW only for Raven.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add an interface of amdgpu_dpm_set_mmhub_powergating_by_smu
Eric Huang [Tue, 6 Feb 2018 21:19:24 +0000 (16:19 -0500)]
drm/amdgpu: add an interface of amdgpu_dpm_set_mmhub_powergating_by_smu

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: delete some dead code
Dan Carpenter [Tue, 6 Feb 2018 12:35:00 +0000 (15:35 +0300)]
drm/amd/powerplay: delete some dead code

We deleted some code in e154162ef75d ("drm/amd/powerplay: refine pp code
for raven") but there were a few related bits that were missed.  Let's
delete them as well.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: Zero out power data in AMDGPU_PP_SENSOR_GPU_POWER readout
Tom St Denis [Tue, 6 Feb 2018 19:00:01 +0000 (14:00 -0500)]
drm/amd/powerplay:  Zero out power data in AMDGPU_PP_SENSOR_GPU_POWER readout

Since 12 of the 16 bytes are not initialized with anything let's ensure they're
sensibly zeroed out otherwise debugfs callers will read back garbage
(because they assume debugfs wrote sensible data back...)

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Add primary tmz_c and meta tmz tmz_c.
Yongqiang Sun [Tue, 23 Jan 2018 22:21:43 +0000 (17:21 -0500)]
drm/amd/display: Add primary tmz_c and meta tmz tmz_c.

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: enable #PME code path for RV.
Charlene Liu [Mon, 29 Jan 2018 17:44:33 +0000 (12:44 -0500)]
drm/amd/display: enable #PME code path for RV.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Yongqiang Sun <yongqiang.sun@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.32
Tony Cheng [Thu, 25 Jan 2018 06:06:31 +0000 (01:06 -0500)]
drm/amd/display: dal 3.1.32

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: Optimize regamma calculations
Krunoslav Kovac [Fri, 19 Jan 2018 22:55:26 +0000 (17:55 -0500)]
drm/amd/display: Optimize regamma calculations

There are several optimizations:
1) Use predefined SRGB, don't calculate. This is the most common case.
2) Precompute HW X points at boot since they're fixed in ColModule
3) Precompute PQ - it never changes and is very CPU intensive in fixed pt.
4) Reduce number of points in ColModule to 512 (32x16) from 1024. This also
requires reducing some regions for legacy DCEs to 16 pts at most.

Performance
1) is super-fast, build_output_tf is 1-2us, down from 25000-30000.
Programming also fast since only one reg write.
2)+3) gives build_output_tf for PQ in ~100us range, down from ~80000-110000
2) + 4) results in slightly over 50% improvement. It gives an idea of the
savings when we can't use SRGB or PQ table (e.g. sdr white level > 80).

There's also a bit of refactoring: renaming some stuff that was misleading
and removing a lot of magic numbers that novices might not be able to
understand where they come from and what they mean.

Signed-off-by: Krunoslav Kovac <Krunoslav.Kovac@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: resume from S3 bypass power down HW block.
Charlene Liu [Wed, 24 Jan 2018 18:18:57 +0000 (13:18 -0500)]
drm/amd/display: resume from S3 bypass power down HW block.

Signed-off-by: Charlene Liu <charlene.liu@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@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 eDP 1.2+ polling for T7
Charlene Liu [Fri, 19 Jan 2018 00:09:06 +0000 (19:09 -0500)]
drm/amd/display: add eDP 1.2+ polling for T7

Signed-off-by: Charlene Liu <charlene.liu@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: dal 3.1.31
Tony Cheng [Wed, 24 Jan 2018 08:22:22 +0000 (03:22 -0500)]
drm/amd/display: dal 3.1.31

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: Fixed if statement parameters to add a delay on disconnect
John Barberiz [Tue, 23 Jan 2018 16:47:15 +0000 (11:47 -0500)]
drm/amd/display: Fixed if statement parameters to add a delay on disconnect

Signed-off-by: John Barberiz <jbarberi@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 return value for detect dp.
Yongqiang Sun [Tue, 23 Jan 2018 16:39:09 +0000 (11:39 -0500)]
drm/amd/display: Add return value for detect dp.

System soft hang when hotplug specific 4K DP panel
due to link caps read error and incorrect link setting
parmas to enable dp.
Add status check for DPCD read and add return value
for detect dp, in case of false, return from caller,
avoid further false operation.

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 boot-up on vega10
Roman Li [Tue, 23 Jan 2018 16:12:27 +0000 (11:12 -0500)]
drm/amd/display: fix boot-up on vega10

Fixing null-deref on Vega10 due to regression after
'fix cursor related Pstate hang' change.
Added null checks in setting cursor position.

Signed-off-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Eric Yang <eric.yang2@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove couple of unused OPTC registers
Nikola Cornij [Thu, 11 Jan 2018 17:51:14 +0000 (12:51 -0500)]
drm/amd/display: Remove couple of unused OPTC registers

Signed-off-by: Nikola Cornij <nikola.cornij@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: turn off cursor when disconnect plane
Eric Yang [Fri, 19 Jan 2018 23:10:00 +0000 (18:10 -0500)]
drm/amd/display: turn off cursor when disconnect plane

As a precaution to prevent cases where cursor is enabled on a pipe
that is disabled, always turn off cursor when disconnecting plane.

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: Expose is_rgb_cspace function in hw_sequencer
Eric Bernstein [Mon, 15 Jan 2018 21:23:59 +0000 (16:23 -0500)]
drm/amd/display: Expose is_rgb_cspace function in hw_sequencer

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: WBSCL filter init calculation fixes
Ken Chalmers [Wed, 17 Jan 2018 19:17:40 +0000 (14:17 -0500)]
drm/amd/display: WBSCL filter init calculation fixes

* Previous code did some calculations with a mix of normal integers and
  integers aligned as U2.24 fixed-point values.
* There were bugs in the conversion of the final result into the
  S4.19 values required for the registers.

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: remove unused function prototypes
Eric Yang [Fri, 19 Jan 2018 00:24:27 +0000 (19:24 -0500)]
drm/amd/display: remove unused function prototypes

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: fix cursor related Pstate hang
Eric Yang [Fri, 19 Jan 2018 00:07:54 +0000 (19:07 -0500)]
drm/amd/display: fix cursor related Pstate hang

Move cursor programming to inside the OTG_MASTER_UPDATE_LOCK

If graphics plane go from 1 pipe to hsplit, the cursor updates
after mpc programming and unlock. Which means there is a window
of time where cursor is enabled on the wrong pipe if it's on
the right side of the screen (i.e. case where cursor need to
move from pipe 0 to pipe 3 post split). This will cause pstate hang.

Solution is to program the cursor while still locked.

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: Set irq state only on existing crtcs
Mikita Lipski [Thu, 18 Jan 2018 19:53:57 +0000 (14:53 -0500)]
drm/amd/display: Set irq state only on existing crtcs

Because AMDGPU_CRTC_IRQ_VLINE1 = 6, it expected 6 more crtcs to be
programed with disabled irq state in amdgpu_irq_disable_all. That caused errors and accessed
the wrong memory location.

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Null check for gamma correction.
Yongqiang Sun [Fri, 19 Jan 2018 16:59:16 +0000 (11:59 -0500)]
drm/amd/display: Null check for gamma correction.

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: Check hubp in pipe_ctx not in res_pool.
Yongqiang Sun [Thu, 18 Jan 2018 19:51:28 +0000 (14:51 -0500)]
drm/amd/display: Check hubp in pipe_ctx not in res_pool.

When disable plane, check power gate flag in hubp with pipe_ctx,
not with res_pool.

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/amdgpu: sync the VM PD/PT before clearing it
Christian König [Sun, 4 Feb 2018 18:36:52 +0000 (19:36 +0100)]
drm/amdgpu: sync the VM PD/PT before clearing it

Otherwise we might overwrite stuff which is still in use.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: dal 3.1.30
Tony Cheng [Thu, 18 Jan 2018 19:55:35 +0000 (14:55 -0500)]
drm/amd/display: dal 3.1.30

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: Bypass gamma set if not standard type
John Barberiz [Thu, 18 Jan 2018 17:22:11 +0000 (12:22 -0500)]
drm/amd/display: Bypass gamma set if not standard type

If non-standard gamma type detected set identity matrix flag
so that we can bypass the gamma mode.

Signed-off-by: John Barberiz <jbarberi@amd.com>
Reviewed-by: Krunoslav Kovac <Krunoslav.Kovac@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: wait for T9 after backlight off mainlink blank.
Charlene Liu [Thu, 18 Jan 2018 17:53:04 +0000 (12:53 -0500)]
drm/amd/display: wait for T9 after backlight off mainlink blank.

Signed-off-by: Charlene Liu <charlene.liu@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 multiple definitions of handle_crc_irq
Leo (Sunpeng) Li [Fri, 12 Jan 2018 18:13:11 +0000 (13:13 -0500)]
drm/amd/display: Fix multiple definitions of handle_crc_irq

If CONFIG_DEBUG_FS is disabled, then CRC should also be disabled.
Therefore, amdgpu_dm_crtc_handle_crc_irq was redefined as a no-op
function within amdgpu_dm.h.

However, since amdgpu_dm.h is included in multiple files, this caused
conflicts when linking during compile. Therefore, Use a macro to
define the function as a no-op instead.

Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fixed non-native modes not lighting up
Jerry (Fangzhi) Zuo [Wed, 17 Jan 2018 18:24:28 +0000 (13:24 -0500)]
drm/amd/display: Fixed non-native modes not lighting up

There is no need to call drm_mode_set_crtcinfo() again once
crtc timing is decided. Otherwise non-native/unsupported timing
might get overwritten.

Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove return when no EDID read.
Martin Tsai [Wed, 17 Jan 2018 05:55:26 +0000 (13:55 +0800)]
drm/amd/display: Remove return when no EDID read.

Signed-off-by: Martin Tsai <martin.tsai@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: BL setting save/restore
Charlene Liu [Tue, 16 Jan 2018 04:22:51 +0000 (23:22 -0500)]
drm/amd/display: BL setting save/restore

Signed-off-by: Charlene Liu <charlene.liu@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: Adding missing TMZ sh/mask entries for DCN1 SURFACE_CONTROL
Harry Wentland [Thu, 25 Jan 2018 21:06:41 +0000 (16:06 -0500)]
drm/amd/display: Adding missing TMZ sh/mask entries for DCN1 SURFACE_CONTROL

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <tony.cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: clear the shadow fence as well
Christian König [Fri, 2 Feb 2018 20:05:40 +0000 (21:05 +0100)]
drm/amdgpu: clear the shadow fence as well

It also needs to be initialized.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: release the VM shadow in the error path as well
Christian König [Fri, 2 Feb 2018 20:00:44 +0000 (21:00 +0100)]
drm/amdgpu: release the VM shadow in the error path as well

Without it we run into a memory leak.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove unused display_vblank_wait interface
Alex Deucher [Fri, 2 Feb 2018 17:31:27 +0000 (12:31 -0500)]
drm/amdgpu: remove unused display_vblank_wait interface

No longer used since we changed the MC programming sequence.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/dce: fix mask in dce_v*_0_is_in_vblank
Alex Deucher [Fri, 2 Feb 2018 17:24:23 +0000 (12:24 -0500)]
drm/amdgpu/dce: fix mask in dce_v*_0_is_in_vblank

Using the wrong mask.

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Noticed-by: Hans de Ruiter <hans@keasigmadelta.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: fix incompatible structure layouts
Arnd Bergmann [Fri, 2 Feb 2018 12:31:26 +0000 (13:31 +0100)]
drm/amd/display: fix incompatible structure layouts

Building the amd display driver with link-time optimizations revealed a bug
that caused dal_cmd_tbl_helper_dce80_get_table() and
dal_cmd_tbl_helper_dce110_get_table() get called with an incompatible
return type between the two callers in command_table_helper.c and
command_table_helper2.c:

drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce80/command_table_helper_dce80.h:31: error: type of 'dal_cmd_tbl_helper_dce80_get_table' does not match original declaration [-Werror=lto-type-mismatch]
 const struct command_table_helper *dal_cmd_tbl_helper_dce80_get_table(void);

drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce80/command_table_helper_dce80.c:351: note: 'dal_cmd_tbl_helper_dce80_get_table' was previously declared here
 const struct command_table_helper *dal_cmd_tbl_helper_dce80_get_table(void)

drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce110/command_table_helper_dce110.h:32: error: type of 'dal_cmd_tbl_helper_dce110_get_table' does not match original declaration [-Werror=lto-type-mismatch]
 const struct command_table_helper *dal_cmd_tbl_helper_dce110_get_table(void);

drivers/gpu/drm/amd/amdgpu/../display/dc/bios/dce110/command_table_helper_dce110.c:361: note: 'dal_cmd_tbl_helper_dce110_get_table' was previously declared here
 const struct command_table_helper *dal_cmd_tbl_helper_dce110_get_table(void)

The two versions of the structure are obviously derived from the same
one, but have diverged over time, before they got added to the kernel.

This moves the structure to a new shared header file and uses the superset
of the members, to ensure the interfaces are all compatible.

Fixes: ae79c310b1a6 ("drm/amd/display: Add DCE12 bios parser support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: cache the fence to wait for a VMID
Christian König [Wed, 31 Jan 2018 15:03:19 +0000 (16:03 +0100)]
drm/amdgpu: cache the fence to wait for a VMID

Beneficial when a lot of processes are waiting for VMIDs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: restructure amdgpu_vmid_grab
Christian König [Wed, 31 Jan 2018 13:24:45 +0000 (14:24 +0100)]
drm/amdgpu: restructure amdgpu_vmid_grab

Now that we have the different cases for grabbing a VMID in separate
functions, restructure the top level function to only have one place
where VMIDs are assigned to jobs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move reusing VMIDs into separate function
Christian König [Wed, 31 Jan 2018 12:35:25 +0000 (13:35 +0100)]
drm/amdgpu: move reusing VMIDs into separate function

Let's try this once more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: cleanup and simplify amdgpu_vmid_grab_reserved
Christian König [Wed, 31 Jan 2018 10:56:53 +0000 (11:56 +0100)]
drm/amdgpu: cleanup and simplify amdgpu_vmid_grab_reserved

Drop the "_locked" from the name, cleanup and simplify the logic a bit.
Add missing comments.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: stop checking GPU reset counter during VMID grab
Christian König [Wed, 31 Jan 2018 10:21:23 +0000 (11:21 +0100)]
drm/amdgpu: stop checking GPU reset counter during VMID grab

We do this later on when we flush the VMID anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: make VMID owner none atomic v2
Christian König [Wed, 31 Jan 2018 10:17:56 +0000 (11:17 +0100)]
drm/amdgpu: make VMID owner none atomic v2

The variable is protected by the VMID mutex anyway.

v2: grab the mutex while resetting the VMID as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: split finding idle VMID into separate function
Christian König [Wed, 31 Jan 2018 10:10:19 +0000 (11:10 +0100)]
drm/amdgpu: split finding idle VMID into separate function

No functional change, but makes it easier to maintain the code.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: make VMID assignment more fair v2
Christian König [Wed, 31 Jan 2018 09:16:26 +0000 (10:16 +0100)]
drm/amdgpu: make VMID assignment more fair v2

Similar to finding an idle one before reuse.

This guarantees fairness between processes. Otherwise process with a reserved
VMID have an unfair advantage while scheduling jobs.

v2: improve commit message

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix always_valid bos multiple LRU insertions.
Bas Nieuwenhuizen [Wed, 31 Jan 2018 12:58:55 +0000 (13:58 +0100)]
drm/amdgpu: Fix always_valid bos multiple LRU insertions.

If these bos are evicted and are in the validated list
things blow up, so do not put them in there. Notably,
that tries to add the bo to the LRU twice, which results
in a BUG_ON in ttm_bo.c.

While for the bo_list an alternative would be to not allow
always valid bos in there, that does not work for the user
fence.

v2: Fixed whitespace issue pointed out by checkpatch.pl

Signed-off-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agoRevert "drm/amdgpu/gfx8: Fix compute ring failure after resetting"
Andrey Grodzovsky [Wed, 24 Jan 2018 13:52:26 +0000 (08:52 -0500)]
Revert "drm/amdgpu/gfx8: Fix compute ring failure after resetting"

This reverts commit 75737cb4eb78c7f185e4700b4aa20cf7a3381aca.

Fixes compute rings test failure on bare metal during full GPU reset.

RCA:
the ring buffer has to be filled with valid packets (such as NOPs) first
before submitting MAP_QUEUEs packet into KIQ. Once a compute engine is mapped,
it will immediately execute the ring buffer if the RTPR is not equal to the
WTPR from the MQD. It could lead to engine hang if the ring buffer filled
with random data.

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: move waiting for VM flush into gmc_v9_0_emit_flush_gpu_tlb
Christian König [Fri, 26 Jan 2018 14:00:43 +0000 (15:00 +0100)]
drm/amdgpu: move waiting for VM flush into gmc_v9_0_emit_flush_gpu_tlb

Keep that at a common place instead of spread over all engines.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement vcn_v1_0_(dec|enc)_ring_emit_reg_wait v2
Christian König [Fri, 26 Jan 2018 13:31:07 +0000 (14:31 +0100)]
drm/amdgpu: implement vcn_v1_0_(dec|enc)_ring_emit_reg_wait v2

Add emit_reg_wait implementation for VCN v1.

v2: cleanup the existing code as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement vce_v4_0_emit_reg_wait v2
Christian König [Fri, 26 Jan 2018 13:06:55 +0000 (14:06 +0100)]
drm/amdgpu: implement vce_v4_0_emit_reg_wait v2

Add emit_reg_wait implementation for VCE v4.

v2: call new function directly from existing code

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement uvd_v7_0_(enc_|)ring_emit_reg_wait v2
Christian König [Fri, 26 Jan 2018 12:26:17 +0000 (13:26 +0100)]
drm/amdgpu: implement uvd_v7_0_(enc_|)ring_emit_reg_wait v2

Add emit_reg_wait implementation for UVD v7.

v2: call new function directly from the existing code

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement sdma_v4_0_ring_emit_reg_wait
Christian König [Fri, 26 Jan 2018 12:15:01 +0000 (13:15 +0100)]
drm/amdgpu: implement sdma_v4_0_ring_emit_reg_wait

Add emit_reg_wait implementation for SDMA v4.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement gfx_v9_0_ring_emit_reg_wait
Christian König [Fri, 26 Jan 2018 12:08:18 +0000 (13:08 +0100)]
drm/amdgpu: implement gfx_v9_0_ring_emit_reg_wait

Implement emit_reg_wait for gfx v9.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add new emit_reg_wait callback
Christian König [Fri, 26 Jan 2018 11:45:32 +0000 (12:45 +0100)]
drm/amdgpu: add new emit_reg_wait callback

Allows us to wait for a register value/mask on a ring.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <felix.kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix DW estimation on VI
Christian König [Tue, 30 Jan 2018 15:02:38 +0000 (16:02 +0100)]
drm/amdgpu: fix DW estimation on VI

Forgot to update that during recent changes.

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/amd/pp: Fix sysfs pp_dpm_pcie bug on CI/VI
Rex Zhu [Thu, 25 Jan 2018 10:42:08 +0000 (18:42 +0800)]
drm/amd/pp: Fix sysfs pp_dpm_pcie bug on CI/VI

when echo "01">pp_dpm_pcie
the pcie dpm will fix in highest link speed.
But user should expect auto speed between
level 0 and level1

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Enable pp_set_power_profile_mode under manual mode
Rex Zhu [Tue, 30 Jan 2018 04:55:54 +0000 (12:55 +0800)]
drm/amd/pp: Enable pp_set_power_profile_mode under manual mode

Only user enter manual performance mode, driver allow user
configure the sclk/mclk dpm parameters through sysfs
pp_power_profile_mode.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Refine pp_dpm_force_clock_level functions
Rex Zhu [Tue, 30 Jan 2018 04:48:12 +0000 (12:48 +0800)]
drm/amd/pp: Refine pp_dpm_force_clock_level functions

Only when user set manual performance mode, driver
enable pp_dpm_force_clock_level.
so check the mode in pp_dpm_force_clock_level,
and delete the same logic in callback functions.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Delete debug info when set power_profile_mode
Rex Zhu [Wed, 24 Jan 2018 05:50:48 +0000 (13:50 +0800)]
drm/amd/pp: Delete debug info when set power_profile_mode

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: limit the VM address space with older VCE FW versions
Christian König [Mon, 29 Jan 2018 15:03:50 +0000 (16:03 +0100)]
drm/amdgpu: limit the VM address space with older VCE FW versions

Older VCE FW versions are buggy and can't work with 48bit address
spaces.

RFC: Should we limit the address space or just reject loading the older
VCE firmware?

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: Fix trailing semicolon
Luis de Bethencourt [Wed, 17 Jan 2018 18:22:41 +0000 (18:22 +0000)]
drm: Fix trailing semicolon

The trailing semicolon is an empty statement that does no operation.
Removing it since it doesn't do anything.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm: amd: Fix trailing semicolons
Luis de Bethencourt [Wed, 17 Jan 2018 18:50:20 +0000 (18:50 +0000)]
drm: amd: Fix trailing semicolons

The trailing semicolon is an empty statement that does no operation.
Removing the two instances of them since they don't do anything.

Signed-off-by: Luis de Bethencourt <luisbg@kernel.org>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: set DRIVER_ATOMIC flag early
Alex Deucher [Tue, 23 Jan 2018 22:05:03 +0000 (17:05 -0500)]
drm/amdgpu: set DRIVER_ATOMIC flag early

The atomic debugfs stuff gets created in drm_dev_alloc()
but this gets called before we've enumerated all of our
IPs, so move the DRIVER_ATOMIC flag setting to fix that.

Since DRIVER_ATOMIC is a driver flag it's currently global
to the driver so setting it affects all GPUs driven by the
driver.  Unfortunately, not all GPUs support atomic.  Warn
the user if that is the case.

This is the same as our current behavior, but at least the
atomic debugfs stuff gets created now.

Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: remove DC special casing for KB/ML
Alex Deucher [Thu, 25 Jan 2018 21:53:25 +0000 (16:53 -0500)]
drm/amdgpu: remove DC special casing for KB/ML

It seems to be working now.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=102372
Reviewed-by: Mike Lothian <mike@fireburn.co.uk>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Simplify ttm_dma_page_put()
Tom St Denis [Thu, 25 Jan 2018 18:40:21 +0000 (13:40 -0500)]
drm/ttm: Simplify ttm_dma_page_put()

Remove redundant store of return code.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Fix coding style in ttm_dma_pool_alloc_new_pages()
Tom St Denis [Thu, 25 Jan 2018 18:57:10 +0000 (13:57 -0500)]
drm/ttm: Fix coding style in ttm_dma_pool_alloc_new_pages()

Add missing {} braces.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Fix coding style in ttm_tt_swapout()
Tom St Denis [Thu, 25 Jan 2018 18:29:42 +0000 (13:29 -0500)]
drm/ttm: Fix coding style in ttm_tt_swapout()

Add missing {} braces.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Simplify ttm_eu_reserve_buffers()
Tom St Denis [Fri, 26 Jan 2018 15:13:42 +0000 (10:13 -0500)]
drm/ttm: Simplify ttm_eu_reserve_buffers()

Hoist the comparison of the ret to -EDEADLK above
the two code paths to simplify the function.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Remove unncessary retval from ttm_bo_vm_fault()
Tom St Denis [Fri, 26 Jan 2018 14:22:05 +0000 (09:22 -0500)]
drm/ttm: Remove unncessary retval from ttm_bo_vm_fault()

The dual ret/retval was more complex than need be.  Now
we drop the retval variable and assign the appropriate VM
codes to ret instead.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Fix coding style in ttm_bo_move_memcpy()
Tom St Denis [Fri, 26 Jan 2018 13:55:10 +0000 (08:55 -0500)]
drm/ttm: Fix coding style in ttm_bo_move_memcpy()

Add missing {} braces.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Simplify ttm_dma_find_pool() (v2)
Tom St Denis [Thu, 25 Jan 2018 18:52:30 +0000 (13:52 -0500)]
drm/ttm: Simplify ttm_dma_find_pool() (v2)

Flip the logic of the comparison and remove
the redudant variable for the pool address.

(v2): Remove {} bracing.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Fix coding style in ttm_pool_store()
Tom St Denis [Thu, 25 Jan 2018 18:35:56 +0000 (13:35 -0500)]
drm/ttm: Fix coding style in ttm_pool_store()

Correct missing {} style.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Change ttm_tt page allocations to return errors
Tom St Denis [Thu, 25 Jan 2018 18:24:03 +0000 (13:24 -0500)]
drm/ttm: Change ttm_tt page allocations to return errors

Explicitly return errors in ttm_tt_alloc_page_directory() and
ttm_dma_tt_alloc_page_directory() instead of relying on
further logic to detect errors.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Add a default BO destructor to simplify code (v2)
Tom St Denis [Wed, 24 Jan 2018 19:26:41 +0000 (14:26 -0500)]
drm/ttm: Add a default BO destructor to simplify code (v2)

(v2): Remove stray ; noticed by Felix

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Fix coding style in ttm_bo.c
Tom St Denis [Wed, 24 Jan 2018 19:21:19 +0000 (14:21 -0500)]
drm/ttm: Fix coding style in ttm_bo.c

Correct indentation and {} brace style.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fill only the lower range with ATS entries v2
Christian König [Thu, 25 Jan 2018 17:36:15 +0000 (18:36 +0100)]
drm/amdgpu: fill only the lower range with ATS entries v2

At least on x86-64 the upper range is purely used by the kernel,
avoid creating any ATS mappings there as security precaution and to
allow proper page fault reporting in the upper range.

v2: remove unused variable

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: revert "Add support for filling a buffer with 64 bit value"
Christian König [Wed, 24 Jan 2018 18:58:45 +0000 (19:58 +0100)]
drm/amdgpu: revert "Add support for filling a buffer with 64 bit value"

This reverts commit 7bdc53f925af085ffa0580f10489f82b36cc2f1c and commit
330df03b3abf944f8f5180f2abc61367749984c0.

Neither are needed any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: revert "Add a parameter to amdgpu_bo_create()"
Christian König [Wed, 24 Jan 2018 18:55:32 +0000 (19:55 +0100)]
drm/amdgpu: revert "Add a parameter to amdgpu_bo_create()"

This reverts commit 2046d46db9166bddc84778f0b3477f6d1e9068ea.

Not needed any more.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: drop root shadow sync
Christian König [Fri, 26 Jan 2018 19:21:26 +0000 (20:21 +0100)]
drm/amdgpu: drop root shadow sync

Completely pointless, it is the same reservation object as the root PD
anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: revert "drm/amdgpu: use AMDGPU_GEM_CREATE_VRAM_CLEARED for VM PD/PTs" v2
Christian König [Wed, 24 Jan 2018 16:19:04 +0000 (17:19 +0100)]
drm/amdgpu: revert "drm/amdgpu: use AMDGPU_GEM_CREATE_VRAM_CLEARED for VM PD/PTs" v2

Using the standard clear turned out to be to inflexible.

First of all it is executed on the system queue, together with buffer
moves instead on the per VM queue.

And second we need to fill in the page tables with more than just zero.

We keep the new functionality of initializing the PDEs/PTEs with ATC
routing entries intact.

v2: update commit message.

Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix vcn_v1_0_dec_ring_emit_wreg
Christian König [Fri, 26 Jan 2018 13:20:55 +0000 (14:20 +0100)]
drm/amdgpu: fix vcn_v1_0_dec_ring_emit_wreg

That got mixed up with the encode ring function.

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/pm: rework the hwmon visibility settings
Alex Deucher [Wed, 24 Jan 2018 22:57:19 +0000 (17:57 -0500)]
drm/amdgpu/pm: rework the hwmon visibility settings

Previously we just always exposed everything for asics
supported by powerplay.  Make it a bit more fine grained.
In practice this shouldn't change anything.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/pp: remove the get_temperature API
Alex Deucher [Wed, 24 Jan 2018 22:44:48 +0000 (17:44 -0500)]
drm/amdgpu/pp: remove the get_temperature API

This is also supported with the read_sensor API and there
were no more users of the get_temperature API.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/pm: use read_sensor API to get temperature
Alex Deucher [Wed, 24 Jan 2018 22:27:54 +0000 (17:27 -0500)]
drm/amdgpu/pm: use read_sensor API to get temperature

Rather than using the amdgpu_dpm_get_temperature.  Both
provide access to the temperature.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/pm: report gpu average power via hwmon API
Alex Deucher [Wed, 24 Jan 2018 23:34:26 +0000 (18:34 -0500)]
drm/amdgpu/pm: report gpu average power via hwmon API

Expose power via hwmon.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/pm: report gpu voltages via hwmon API
Alex Deucher [Wed, 24 Jan 2018 22:19:33 +0000 (17:19 -0500)]
drm/amdgpu/pm: report gpu voltages via hwmon API

Expose vddgfx and vddnb via hwmon.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/pm: handle fan properly when card is powered down
Alex Deucher [Wed, 24 Jan 2018 21:41:50 +0000 (16:41 -0500)]
drm/amdgpu/pm: handle fan properly when card is powered down

Return an error if the user tried to check or set the fan
parameters while the card is powered down (e.g., on a PX/HG
system for example).  This makes the fan consistent with the
temperature stuff.

Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move static CSA address to top of address space v2
Christian König [Mon, 22 Jan 2018 10:25:48 +0000 (11:25 +0100)]
drm/amdgpu: move static CSA address to top of address space v2

Move the CSA area to the top of the VA space to avoid clashing with
HMM/ATC in the lower range on GFX9.

v2: wrong sign noticed by Roger, rebase on CSA_VADDR cleanup, handle VA
hole on GFX9 as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>