linux-2.6-microblaze.git
6 years agodrm/amd/display: update infoframe after dig fe is turned on
Eric Yang [Wed, 21 Feb 2018 21:37:16 +0000 (16:37 -0500)]
drm/amd/display: update infoframe after dig fe is turned on

Before dig fe is enabled, infoframe can't be programmed. So in
suspend resume case our infoframe programmming was not going through.

This change changes the sequence so that infoframe is programmed
after.

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 dcn1 dppclk when min dispclk patch applies
Dmytro Laktyushkin [Wed, 21 Feb 2018 20:10:02 +0000 (15:10 -0500)]
drm/amd/display: fix dcn1 dppclk when min dispclk patch applies

Applying min dispclk patch would result in incorrect dppclk divider
without this change

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: define DC_LOGGER for logger
Bhawanpreet Lakha [Tue, 20 Feb 2018 22:42:50 +0000 (17:42 -0500)]
drm/amd/display: define DC_LOGGER for logger

Created a DC_LOGGER define. This is used to
pass the logger into the macros.

Anywhere we need to use the logger we need to define
DC_LOGGER

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@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: Use MACROS instead of dm_logger
Bhawanpreet Lakha [Fri, 16 Feb 2018 18:57:42 +0000 (13:57 -0500)]
drm/amd/display: Use MACROS instead of dm_logger

Created MACROS for all log levels. Also Replaced
usage of dm_logger_write to the defined MACROS

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@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: Handle HDR use cases.
Vitaly Prosyak [Tue, 13 Feb 2018 19:18:43 +0000 (13:18 -0600)]
drm/amd/display: Handle HDR use cases.

Implementation of de-gamma, blnd-gamma, shaper and
3d lut's.
Removed memory allocations in transfer functions.
Refactor color module.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Reviewed-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: Fix DAL surface change test
Eric Bernstein [Fri, 16 Feb 2018 22:46:54 +0000 (17:46 -0500)]
drm/amd/display: Fix DAL surface change test

Signed-off-by: Eric Bernstein <eric.bernstein@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.36
Tony Cheng [Sat, 17 Feb 2018 06:34:42 +0000 (01:34 -0500)]
drm/amd/display: dal 3.1.36

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 diags clock programming
Dmytro Laktyushkin [Tue, 13 Feb 2018 19:41:51 +0000 (14:41 -0500)]
drm/amd/display: add diags clock programming

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: add per pipe dppclk
Dmytro Laktyushkin [Mon, 12 Feb 2018 20:19:20 +0000 (15:19 -0500)]
drm/amd/display: add per pipe dppclk

v2: Fix commit title

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>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Update DCN OPTC registers
Dmytro Laktyushkin [Wed, 17 Jan 2018 22:40:16 +0000 (17:40 -0500)]
drm/amd/display: Update DCN OPTC registers

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: allocate fbc buffer in AMDGPU_GEM_DOMAIN_GTT
Shirish S [Tue, 20 Feb 2018 09:04:16 +0000 (14:34 +0530)]
drm/amd/display: allocate fbc buffer in AMDGPU_GEM_DOMAIN_GTT

Currently the FBC buffer is allocated in VRAM, since VRAM usage is
dedicatedly for scanouts, by allocating FBC back buffer in GTT
shall help in conserving VRAM for other purposes.

Signed-off-by: Shirish S <shirish.s@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: Add regamma lut write mask to SOC base
Leo (Sunpeng) Li [Tue, 20 Feb 2018 18:30:47 +0000 (13:30 -0500)]
drm/amd/display: Add regamma lut write mask to SOC base

Mask and shift values for DCP0_REGAMMA_LUT_WRITE_EN_MASK were missing
from XFM_COMMON_MASK_SH_LIST_SOC_BASE. Add it.

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: Update Link Training Fallback logic
Wenjing Liu [Fri, 16 Feb 2018 19:04:16 +0000 (14:04 -0500)]
drm/amd/display: Update Link Training Fallback logic

[Description]
When CR fails to minimum link rate,
we should reduce lane count to the number lowest cr_done lanes.

[Code Review]
Jun Lei

Signed-off-by: Wenjing Liu <Wenjing.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: add psr_version to stream
Xingyue Tao [Fri, 16 Feb 2018 21:29:13 +0000 (16:29 -0500)]
drm/amd/display: add psr_version to stream

Brightness could not be changed for some panels whose DPCD_version is below 1.2
Now psr_version is added into stream, and it copies from the displayTarget's psr_version.
It checks if the stream's psr_versio is non-zero and sets the vsc info packet revision now.

Signed-off-by: Xingyue Tao <xingyue.tao@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: Clear dmps off for eDP when resume.
Yongqiang Sun [Wed, 14 Feb 2018 22:12:39 +0000 (17:12 -0500)]
drm/amd/display: Clear dmps off for eDP when resume.

This patch fixed secondary screen only S4 resume, eDP is unintentionally
light up due to incorrect dpms off flag.

When entering S4, dpms off flags are set to true via
set power state. During resume, eDP is light up by vbios, so the flags
should be changed to false to match the real state.
By change the flag properly, eDP is able to be turned off properly as per
OS request.

This change may affect S3/S4 Shut down resume IOIC, need to verify
those cases.

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 missing az disable in reset backend
Eric Yang [Thu, 15 Feb 2018 20:55:31 +0000 (15:55 -0500)]
drm/amd/display: fix missing az disable in reset backend

Optimization in reset backend skips disable stream if it is
already done in dc_stream_set_dpms. However that path does
not disable az in order to prevent audio from toggling
between internal and external displays. This still need to
be done.

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: dal 3.1.35
Tony Cheng [Fri, 2 Feb 2018 06:17:34 +0000 (01:17 -0500)]
drm/amd/display: dal 3.1.35

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: Check DCN PState ASSERT failure
Hersen Wu [Tue, 13 Feb 2018 21:23:12 +0000 (16:23 -0500)]
drm/amd/display: Check DCN PState ASSERT failure

[Description] ASIC change debug register definition

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: update cur_clock correctly within set bandwidth
Yue Hin Lau [Mon, 12 Feb 2018 22:43:19 +0000 (17:43 -0500)]
drm/amd/display: update cur_clock correctly within set bandwidth

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: Use 4096 lut entries
Leo (Sunpeng) Li [Mon, 12 Feb 2018 18:20:56 +0000 (13:20 -0500)]
drm/amd/display: Use 4096 lut entries

Points in the DRM LUT are spaced linearly. Points in hardware are spaced
exponentially, with greater density towards 0. To maintain low-end
accuracy in hardware when sampling the DRM LUT, more points are needed.

However, X doesn't seem to play with legacy LUTs of such size.
Therefore, check for legacy lut when updating DC states, and update
accordingly.

v2: Use a macro for the maximum drm LUT value.

v3: Update commit to reflect that this does not map 1-1 to HW

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: Add passive dongle support for HPD Rearch
John Barberiz [Fri, 9 Feb 2018 22:48:18 +0000 (17:48 -0500)]
drm/amd/display: Add passive dongle support for HPD Rearch

Add HPD delay timer support to
1. Single/dual link DVI.
2. DP to HDMI passive dongle
3. DP to DVI passive dongle.

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: Fix active dongle hotplug
Roman Li [Fri, 9 Feb 2018 21:57:38 +0000 (16:57 -0500)]
drm/amd/display: Fix active dongle hotplug

Clean fake sink flag after detecting link on downstream port.
Fixing display light-up after  "hot-unplug&plug again" downstream
of an active dongle.

Signed-off-by: Roman Li <Roman.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: move MST branch initialize to before link training
Hersen Wu [Fri, 9 Feb 2018 21:35:14 +0000 (16:35 -0500)]
drm/amd/display: move MST branch initialize to before link training

some MST capable scaler doesn't like recieving CLEAR_PAYLOAD_ID_TABLE after
link training.  move branch initialize to before link training

Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
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/radeon/mkregtable: Delete unused list functions and macros
Matthias Kaehlcke [Wed, 28 Feb 2018 22:17:03 +0000 (14:17 -0800)]
drm/radeon/mkregtable: Delete unused list functions and macros

The util mkregtable includes a copy of the kernel API for linked lists,
only a small subset of it is used. Delete the unused functions and macros.

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: used cached pcie gen info for SI (v2)
Alex Deucher [Mon, 26 Feb 2018 16:05:10 +0000 (11:05 -0500)]
drm/amdgpu: used cached pcie gen info for SI (v2)

Rather than querying it every time we need it.
Also fixes a crash in VM pass through if there is no
root bridge because the cached value fetch already checks
this properly.

v2: fix includes

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=105244
Acked-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu<rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/amdgpu: Mask rptr as well in ring debugfs
Tom St Denis [Thu, 1 Mar 2018 14:39:57 +0000 (09:39 -0500)]
drm/amd/amdgpu: Mask rptr as well in ring debugfs

The read/write pointers on sdma4 devices increment
beyond the ring size and should be masked.  Tested
on my Ryzen 2400G.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: try again kiq access if not in IRQ(v4)
Monk Liu [Mon, 25 Dec 2017 07:59:30 +0000 (15:59 +0800)]
drm/amdgpu: try again kiq access if not in IRQ(v4)

sometimes GPU is switched to other VFs and won't swich
back soon, so the kiq reg access will not signal within
a short period, instead of busy waiting a long time(MAX_KEQ_REG_WAIT)
and returning TMO we can istead sleep 5ms and try again
later (non irq context)

And since the waiting in kiq_r/weg is busy wait, so MAX_KIQ_REG_WAIT
shouldn't set to a long time, set it to 10ms is more appropriate.

if gpu already in reset state, don't retry the KIQ reg access
otherwise it would always hang because KIQ was already die usually.

v2:
replace schedule() with msleep() for the wait

v3:
use while loop for the wait repeating
use macros for the sleep period
more description for it

v4:
drop unused variable

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com
Reviewed-by: Pixel Ding <Pixel.Ding@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: cleanups for vram lost handling
Monk Liu [Mon, 25 Dec 2017 03:59:27 +0000 (11:59 +0800)]
drm/amdgpu: cleanups for vram lost handling

1)create a routine "handle_vram_lost" to do the vram
recovery, and put it into amdgpu_device_reset/reset_sriov,
this way no need of the extra paramter to hold the
VRAM LOST information and the related macros can be removed.

3)show vram_recover failure if time out, and set TMO equal to
lockup_timeout if vram_recover is under SRIOV runtime mode.

4)report error if any ip reset failed for SR-IOV

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: stop all rings before doing gpu recover
Monk Liu [Mon, 25 Dec 2017 07:14:58 +0000 (15:14 +0800)]
drm/amdgpu: stop all rings before doing gpu recover

found recover_vram_from_shadow sometimes get executed
in paralle with SDMA scheduler, should stop all
schedulers before doing gpu reset/recover

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix module parameter descriptions
Alex Deucher [Tue, 27 Feb 2018 16:44:31 +0000 (11:44 -0500)]
drm/amdgpu: fix module parameter descriptions

Some were missing the close parens around options.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Map all visible VRAM at startup
Amber Lin [Tue, 27 Feb 2018 15:01:59 +0000 (10:01 -0500)]
drm/amdgpu: Map all visible VRAM at startup

When using CPU to update page table, we need to kmap all the PDs/PTs after
they are allocated and that requires a TLB shot down on each CPU, which is
quite heavy.

Instead, we map the whole visible VRAM to a kernel address at once. Pages
can be obtained from the offset.

v2: move the mapping base from gmc to amdgpu_mman structure, and the
    implementation in amdgpu_ttm_* functions

Signed-off-by: Amber Lin <Amber.Lin@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: check for ipp before calling cursor operations
Shirish S [Wed, 21 Feb 2018 10:40:33 +0000 (16:10 +0530)]
drm/amd/display: check for ipp before calling cursor operations

Currently all cursor related functions are made to all
pipes that are attached to a particular stream.
This is not applicable to pipes that do not have cursor plane
initialised like underlay.
Hence this patch allows cursor related operations on a pipe
only if ipp in available on that particular pipe.

The check is added to set_cursor_position & set_cursor_attribute.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/display: make dm_dp_aux_transfer return payload bytes instead of size
Shirish S [Fri, 23 Feb 2018 10:40:13 +0000 (16:10 +0530)]
drm/amd/display: make dm_dp_aux_transfer return payload bytes instead of size

The drm layer expects aux->transfer() to return the payload bytes read.
Currently dm_dp_aux_transfer() returns the payload size which does not
gets updated during the read, hence not giving the right data for the
drm layer to pars edid. This leads to the drm layer to conclude as the
edid is BAD and hence some monitors/devices dont get detected properly.

This patch changes the return type of dm_dp_aux_transfer() to actual
bytes read during DP_AUX_NATIVE_READ & DP_AUX_I2C_READ.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: disable GFX ring and disable PQ wptr in hw_fini
Monk Liu [Mon, 29 Jan 2018 11:24:32 +0000 (19:24 +0800)]
drm/amdgpu: disable GFX ring and disable PQ wptr in hw_fini

otherwise there will be DMAR reading error comes out from CP since
GFX is still alive and CPC's WPTR_POLL is still enabled, which would
lead to DMAR read error.

fix:
we can hault CPG after hw_fini, but cannot halt CPC becaues KIQ
stil need to be alive to let RLCV invoke, but its WPTR_POLL could
be disabled.

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: cleanup SA inti and fini(v2)
Monk Liu [Fri, 26 Jan 2018 08:57:25 +0000 (16:57 +0800)]
drm/amdgpu: cleanup SA inti and fini(v2)

should use bo_create_kernel instead of split to two
function that create and pin the SA bo

issue:
before this patch, there are DMAR read error in host
side when running SRIOV test, the DMAR address dropped
in the range of SA bo.

fix:
after this cleanups of SA init and fini, above DMAR
eror gone.

v2:
keep sa_bo's fini instead of suspend, to keep
reporting error

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: Correct sdma_v4 get_wptr(v2)
Emily Deng [Wed, 7 Feb 2018 08:17:16 +0000 (16:17 +0800)]
drm/amdgpu: Correct sdma_v4 get_wptr(v2)

the original method will change the wptr value in wb.
v2:
furthur cleanup

Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: adjust timeout for ib_ring_tests(v2)
Monk Liu [Tue, 23 Jan 2018 10:26:20 +0000 (18:26 +0800)]
drm/amdgpu: adjust timeout for ib_ring_tests(v2)

issue:
sometime GFX/MM ib test hit timeout under SRIOV env, root cause
is that engine doesn't come back soon enough so the current
IB test considered as timed out.

fix:
for SRIOV GFX IB test wait time need to be expanded a lot during
SRIOV runtimei mode since it couldn't really begin before GFX engine
come back.

for SRIOV MM IB test it always need more time since MM scheduling
is not go together with GFX engine, it is controled by h/w MM
scheduler so no matter runtime or exclusive mode MM IB test
always need more time.

v2:
use ring type instead of idx to judge

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: don't use MM idle_work for SRIOV(v2)
Monk Liu [Fri, 19 Jan 2018 12:29:17 +0000 (20:29 +0800)]
drm/amdgpu: don't use MM idle_work for SRIOV(v2)

SRIOV doesn't give VF cg/pg feature so the MM's idle_work
is skipped for SR-IOV

v2:
remove superfluous changes
since idle_work is not scheduled for SR-IOV so the condition
check for SR-IOV inside idle_work also can be dropped

v3:
drop the SRIOV check in amdgpu_vce/uvd_suspend

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/amd/pp: Print more smu failed info on Vega10
Rex Zhu [Sat, 24 Feb 2018 06:29:12 +0000 (14:29 +0800)]
drm/amd/pp: Print more smu failed info on Vega10

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/powerplay: fix power over limit on Fiji
Eric Huang [Mon, 26 Feb 2018 22:36:19 +0000 (17:36 -0500)]
drm/amd/powerplay: fix power over limit on Fiji

power containment disabled only on Fiji and compute
power profile. It violates PCIe spec and may cause power
supply failed. Enabling it will fix the issue, even the
fix will drop performance of some compute tests.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amdgpu:Fixed wrong emit frame size for enc
James Zhu [Tue, 27 Feb 2018 14:55:17 +0000 (09:55 -0500)]
drm/amdgpu:Fixed wrong emit frame size for enc

Emit frame size should match with corresponding function,
uvd_v6_0_enc_ring_emit_vm_flush has 5 amdgpu_ring_write

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: increase gart size to 512MB
Monk Liu [Tue, 23 Jan 2018 11:17:56 +0000 (19:17 +0800)]
drm/amdgpu: increase gart size to 512MB

256MB is too small consider PTE/PDE shadow and TTM
eviction activity

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: move WB_FREE to correct place
Monk Liu [Wed, 24 Jan 2018 04:20:32 +0000 (12:20 +0800)]
drm/amdgpu: move WB_FREE to correct place

WB_FREE should be put after all engines's hw_fini
done, otherwise the invalid wptr/rptr_addr would still
be used by engines which trigger abnormal bugs.

This fixes couple DMAR reading error in host side for SRIOV
after guest kmd is unloaded.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: change gfx9 ib test to use WB
Monk Liu [Tue, 23 Jan 2018 10:29:22 +0000 (18:29 +0800)]
drm/amdgpu: change gfx9 ib test to use WB

two reasons to switch SCRATCH reg method to WB method:

1)Because when doing IB test we don't want to involve KIQ health
status affect, and since SCRATCH register access is go through
KIQ that way GFX IB test would failed due to KIQ fail.

2)acccessing SCRATCH register cost much more time than WB method
because SCRATCH register access runs through KIQ which at least could
begin after GPU world switch back to current Guest VF

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: cond_exec only for schedule with a job
Monk Liu [Fri, 19 Jan 2018 11:06:31 +0000 (19:06 +0800)]
drm/amdgpu: cond_exec only for schedule with a job

issue:
under SR-IOV sometimes the iB test will fail on
gfx ring

fix:
with cond_exec inserted in RB the gfx engine would
skip part packets if RLCV issue PREEMPT on gfx engine
if gfx engine is prior to COND_EXEC packet, this is
okay for regular command from UMD, but for the ib test
since the whole dma format doesn't support PREEMPT
so must remove the COND_EXEC from 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: only flush hotplug work without DC
Monk Liu [Fri, 19 Jan 2018 11:02:16 +0000 (19:02 +0800)]
drm/amdgpu: only flush hotplug work without DC

since hotplug_work is initialized under the case of
no dc support

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: skip ECC for SRIOV in gmc late_init
Monk Liu [Thu, 18 Jan 2018 08:58:04 +0000 (16:58 +0800)]
drm/amdgpu: skip ECC for SRIOV in gmc late_init

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: fix&cleanups for wb_clear
Monk Liu [Fri, 29 Dec 2017 09:06:41 +0000 (17:06 +0800)]
drm/amdgpu: fix&cleanups for wb_clear

fix:
should do right shift on wb before clearing

cleanups:
1,should memset all wb buffer
2,set max wb number to 128 (total 4KB) is big enough

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/powerplay/smu7: use proper dep table for mclk
Alex Deucher [Mon, 26 Feb 2018 18:34:13 +0000 (13:34 -0500)]
drm/amdgpu/powerplay/smu7: use proper dep table for mclk

For mclk od, use the vdd dependency on mclk table.  Looks
like a cut and paste typo.

Reviewed-by: Rex Zhu<rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/amdgpu: Correct VRAM width for APUs with GMC9
Tom St Denis [Mon, 26 Feb 2018 14:09:26 +0000 (09:09 -0500)]
drm/amd/amdgpu: Correct VRAM width for APUs with GMC9

DDR4 has a 64-bit width not 128-bits.  It was reporting
twice the width.  Tested with my Ryzen 2400G.

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/ttm: cleanup ttm_tt_create
Christian König [Thu, 22 Feb 2018 07:54:57 +0000 (08:54 +0100)]
drm/ttm: cleanup ttm_tt_create

Cleanup ttm_tt_create a bit.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: move ttm_tt_create into ttm_tt.c v2
Christian König [Thu, 22 Feb 2018 07:54:57 +0000 (08:54 +0100)]
drm/ttm: move ttm_tt_create into ttm_tt.c v2

Rename ttm_bo_add_ttm to ttm_tt_create and move it into ttm_tt.c.

v2: separate the cleanup.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: check if free mem space is under the lower limit
Roger He [Mon, 5 Feb 2018 09:57:07 +0000 (17:57 +0800)]
drm/ttm: check if free mem space is under the lower limit

the free mem space and the lower limit both include two parts:
system memory and swap space.

For the OOM triggered by TTM, that is the case as below:
first swap space is full of swapped out pages and soon
system memory also is filled up with ttm pages. and then
any memory allocation request will run into OOM.

to cover two cases:
a. if no swap disk at all or free swap space is under swap mem
   limit but available system mem is bigger than sys mem limit,
   allow TTM allocation;

b. if the available system mem is less than sys mem limit but
   free swap space is bigger than swap mem limit, allow TTM
   allocation.

v2: merge two memory limit(swap and system) into one
v3: keep original behavior except ttm_opt_ctx->flags with
    TTM_OPT_FLAG_FORCE_ALLOC
v4: always set force_alloc as tx->flags & TTM_OPT_FLAG_FORCE_ALLOC
v5: add an attribute for lower_mem_limit
v6: set lower_mem_limit as 0 to keep original behavior

Signed-off-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: drop persistent_swap_storage from ttm_bo_init and co
Christian König [Thu, 22 Feb 2018 14:52:31 +0000 (15:52 +0100)]
drm/ttm: drop persistent_swap_storage from ttm_bo_init and co

Never used as parameter, the only driver actually using this is nouveau
and there it is initialized after the BO is initialized.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: drop ttm->dummy_read_page
Christian König [Wed, 21 Feb 2018 19:34:13 +0000 (20:34 +0100)]
drm/ttm: drop ttm->dummy_read_page

Only used by the AGP backend and there it can be easily accessed using
ttm->bdev->glob.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: drop ttm->glob
Christian König [Wed, 21 Feb 2018 18:02:06 +0000 (19:02 +0100)]
drm/ttm: drop ttm->glob

The pointer is available as ttm->bdev->glob as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: drop bo->glob
Christian König [Wed, 21 Feb 2018 16:26:45 +0000 (17:26 +0100)]
drm/ttm: drop bo->glob

The pointer is available as bo->bdev->glob as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agostaging: vboxvideo: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 13:53:42 +0000 (14:53 +0100)]
staging: vboxvideo: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/bochs: remove the default ttm_tt_populate callbacks
Christian König [Thu, 22 Feb 2018 11:12:41 +0000 (12:12 +0100)]
drm/bochs: remove the default ttm_tt_populate callbacks

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/cirrus: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 11:11:25 +0000 (12:11 +0100)]
drm/cirrus: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/qxl: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 11:06:59 +0000 (12:06 +0100)]
drm/qxl: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ast: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 11:05:09 +0000 (12:05 +0100)]
drm/ast: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/hisilicon: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 11:03:58 +0000 (12:03 +0100)]
drm/hisilicon: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/mgag200: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 11:02:36 +0000 (12:02 +0100)]
drm/mgag200: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/virtio: remove ttm_pool_* wrappers
Christian König [Thu, 22 Feb 2018 11:01:38 +0000 (12:01 +0100)]
drm/virtio: remove ttm_pool_* wrappers

TTM calls the default implementation now.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: add default implementations for ttm_tt_(un)populate
Christian König [Thu, 22 Feb 2018 11:00:05 +0000 (12:00 +0100)]
drm/ttm: add default implementations for ttm_tt_(un)populate

Use ttm_pool_populate/ttm_pool_unpopulate if the driver doesn't provide
a function.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Move common dpm check functions to hardwaremanager.c
Rex Zhu [Thu, 22 Feb 2018 12:46:49 +0000 (20:46 +0800)]
drm/amd/pp: Move common dpm check functions to hardwaremanager.c

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Cleaning up vega10_enable_dpm_tasks function
Rex Zhu [Fri, 23 Feb 2018 05:13:13 +0000 (13:13 +0800)]
drm/amd/pp: Cleaning up vega10_enable_dpm_tasks function

1. move display num initialize out of dpm enable tasks.
2. do not set/restore smc telemetry if dpm is runing.

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 code in powerplay for Cz/Vega10
Rex Zhu [Thu, 22 Feb 2018 12:27:07 +0000 (20:27 +0800)]
drm/amd/pp: Refine code in powerplay for Cz/Vega10

Add dpm check functions on CZ/Vega10 to smu backend
function table.

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: Remove dead error checking code on Vega10
Rex Zhu [Thu, 22 Feb 2018 09:20:53 +0000 (17:20 +0800)]
drm/amd/pp: Remove dead error checking code on Vega10

when smu failed, print out the error info immediately
for debug. smum_send_msg_to_smu always return true,
so no need to check return value.

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: Add debug info when smu failed on Vega10
Rex Zhu [Thu, 22 Feb 2018 08:50:57 +0000 (16:50 +0800)]
drm/amd/pp: Add debug info when smu failed on Vega10

When smu msssage failed, print out return value in dmesg.

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: Remove duplicated vega10_is_smc_ram_running calls
Rex Zhu [Thu, 22 Feb 2018 08:33:05 +0000 (16:33 +0800)]
drm/amd/pp: Remove duplicated vega10_is_smc_ram_running calls

Avoid conflicts in reading the same register mmPCIE_INDEX2
with other clients

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: Remove inclusion of non-existing include directories
Corentin Labbe [Thu, 22 Feb 2018 08:21:49 +0000 (08:21 +0000)]
drm/amd: Remove inclusion of non-existing include directories

This patch fix the following build warnings:
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.o
cc1: warning: ../display/: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../display/include: No such file or directory [-Wmissing-include-dirs]
  CC [M]  drivers/gpu/drm/amd/amdgpu/amdgpu_device.o
cc1: warning: ../display/: No such file or directory [-Wmissing-include-dirs]
cc1: warning: ../display/include: No such file or directory [-Wmissing-include-dirs]
[...]
This warning is shown for each file in amdgpu directory, so it spams a lot.

Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd: remove inclusion of non-existing scheduler directory
Corentin Labbe [Thu, 22 Feb 2018 08:21:48 +0000 (08:21 +0000)]
drm/amd: remove inclusion of non-existing scheduler directory

The scheduler directory was removed via commit 1b1f42d8fde4 ("drm: move amd_gpu_scheduler into common location")
Remove it from include path.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/radeon: insist on 32-bit DMA for Cedar on PPC64/PPC64LE
Ben Crocker [Thu, 22 Feb 2018 22:52:19 +0000 (17:52 -0500)]
drm/radeon: insist on 32-bit DMA for Cedar on PPC64/PPC64LE

In radeon_device_init, set the need_dma32 flag for Cedar chips
(e.g. FirePro 2270).  This fixes, or at least works around, a bug
on PowerPC exposed by last year's commits

8e3f1b1d8255105f31556aacf8aeb6071b00d469 (Russell Currey)

and

253fd51e2f533552ae35a0c661705da6c4842c1b (Alistair Popple)

which enabled the 64-bit DMA iommu bypass.

This caused the device to freeze, in some cases unrecoverably, and is
the subject of several bug reports internal to Red Hat.

Signed-off-by: Ben Crocker <bcrocker@redhat.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amdgpu: Remove duplicate setting of ->need_swiotlb
Thierry Reding [Tue, 20 Feb 2018 10:44:50 +0000 (11:44 +0100)]
drm/amdgpu: Remove duplicate setting of ->need_swiotlb

There's no need to set this before the number of DMA bits has been
properly determined.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add a pp feature mask bit for AutoWattman feature
Rex Zhu [Thu, 22 Feb 2018 09:45:11 +0000 (17:45 +0800)]
drm/amd/pp: Add a pp feature mask bit for AutoWattman feature

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: Change default value of module parameter amdgpu_pp_feature_mask
Rex Zhu [Thu, 22 Feb 2018 09:39:22 +0000 (17:39 +0800)]
drm/amdgpu: Change default value of module parameter amdgpu_pp_feature_mask

Currently all pp features are enabled by default except
OVERDRIVE

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/powerplay: fix thermal interrupts on vega10
Eric Huang [Thu, 22 Feb 2018 17:00:35 +0000 (12:00 -0500)]
drm/amd/powerplay: fix thermal interrupts on vega10

a bug in programming thermal interrupt register masks out
interrupts and driver cannot receive interrupts. Setting
0 to mask bits will fix it.

Signed-off-by: Eric Huang <JinHuiEric.Huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Add query vram width in CGS query system info
Rex Zhu [Thu, 8 Feb 2018 07:57:10 +0000 (15:57 +0800)]
drm/amdgpu: Add query vram width in CGS query system info

powerplay need vram width to set default mclk optimization
settings(uphyst/downhyst/activity threshold)

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: use the TTM dummy page instead of allocating one
Christian König [Thu, 22 Feb 2018 07:35:11 +0000 (08:35 +0100)]
drm/amdgpu: use the TTM dummy page instead of allocating one

We have a global dummy page in TTM, use that one instead of allocating a
new one.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix bug that dpm level was not really locked
Rex Zhu [Fri, 9 Feb 2018 08:47:53 +0000 (16:47 +0800)]
drm/amd/pp: Fix bug that dpm level was not really locked

Lock the dpm levels when we use SW method to modify
the dpm tables directly to avoid a possible race
with the smu.

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: Fix error handling when smu return failed on Vega10.
Rex Zhu [Sun, 11 Feb 2018 04:38:58 +0000 (12:38 +0800)]
drm/amd/pp: Fix error handling when smu return failed on Vega10.

Clamp the clock index to a valid range when reading it back

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/ttm: set TTM_OPT_FLAG_FORCE_ALLOC in ttm_bo_force_list_clean
Roger He [Tue, 6 Feb 2018 07:00:06 +0000 (15:00 +0800)]
drm/ttm: set TTM_OPT_FLAG_FORCE_ALLOC in ttm_bo_force_list_clean

Because ttm_bo_force_list_clean() is only called on two occasions:
1. By ttm_bo_evict_mm() during suspend.
2. By ttm_bo_clean_mm() when the driver unloads.
On both cases we absolutely don't want any memory allocation failure.

Signed-off-by: Roger He <Hongbo.He@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 bit flag TTM_OPT_FLAG_FORCE_ALLOC
Roger He [Wed, 17 Jan 2018 07:07:23 +0000 (15:07 +0800)]
drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC

set TTM_OPT_FLAG_FORCE_ALLOC when we are servicing for page
fault routine.

for ttm_mem_global_reserve if in page fault routine, allow the gtt
pages reservation always. because page fault routing already grabbed
system memory and the allowance of this exception is harmless.
Otherwise, it will trigger OOM killer.

will be used later.

v2: set the FORCE_ALLOC always
v3: minor refine

Signed-off-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx
Roger He [Tue, 6 Feb 2018 03:22:57 +0000 (11:22 +0800)]
drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx

for saving memory and more bit flag can be used in future

Signed-off-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoradeon: hide pointless #warning when compile testing
Arnd Bergmann [Fri, 16 Feb 2018 15:26:57 +0000 (16:26 +0100)]
radeon: hide pointless #warning when compile testing

In randconfig testing, we sometimes get this warning:

drivers/gpu/drm/radeon/radeon_object.c: In function 'radeon_bo_create':
drivers/gpu/drm/radeon/radeon_object.c:242:2: error: #warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance thanks to write-combining [-Werror=cpp]
 #warning Please enable CONFIG_MTRR and CONFIG_X86_PAT for better performance \

This is rather annoying since almost all other code produces no build-time
output unless we have found a real bug. We already fixed this in the
amdgpu driver in commit 31bb90f1cd08 ("drm/amdgpu: shut up #warning for
compile testing") by adding a CONFIG_COMPILE_TEST check last year and
agreed to do the same here, but both Michel and I then forgot about it
until I came across the issue again now.

For stable kernels, as this is one of very few remaining randconfig
warnings in 4.14.

Cc: stable@vger.kernel.org
Link: https://patchwork.kernel.org/patch/9550009/
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: set page mapping during allocation
Christian König [Thu, 1 Feb 2018 13:52:50 +0000 (14:52 +0100)]
drm/ttm: set page mapping during allocation

To aid debugging set the page mapping during allocation instead of
during VM faults.

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 agoRevert "drm/radeon/pm: autoswitch power state when in balanced mode"
Alex Deucher [Thu, 15 Feb 2018 13:40:30 +0000 (08:40 -0500)]
Revert "drm/radeon/pm: autoswitch power state when in balanced mode"

This reverts commit 1c331f75aa6ccbf64ebcc5a019183e617c9d818a.

Breaks resume on some systems.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100759
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/radeon: use drm_gem_private_object_init
Christian König [Fri, 16 Feb 2018 09:08:24 +0000 (10:08 +0100)]
drm/radeon: use drm_gem_private_object_init

We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use drm_gem_private_object_init
Christian König [Fri, 16 Feb 2018 08:52:51 +0000 (09:52 +0100)]
drm/amdgpu: use drm_gem_private_object_init

We use our own backing store and don't need the shmem file.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: mitigate workaround for i915
Christian König [Mon, 19 Feb 2018 10:29:35 +0000 (11:29 +0100)]
drm/amdgpu: mitigate workaround for i915

To be able to use DRI_PRIME with amdgpu and i915 we add all our fences
only as exclusive ones.

Disable that behavior when sharing between amdgpu itself cause it
hinders concurrent execution.

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: implement amdgpu_gem_map_(attach/detach)
Christian König [Fri, 16 Feb 2018 12:16:11 +0000 (13:16 +0100)]
drm/amdgpu: implement amdgpu_gem_map_(attach/detach)

Instead of the pin/unpin callback implement the attach/detach ones.

Functional identical, but allows us access to the attachment.

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/powerplay/smu7: drop refresh rate checks for mclk switching
Alex Deucher [Tue, 13 Feb 2018 19:37:36 +0000 (14:37 -0500)]
drm/amdgpu/powerplay/smu7: drop refresh rate checks for mclk switching

The logic has moved to cgs.  mclk switching with DC at higher refresh
rates should work.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: Harry Wentland <harry.wentland@amd.com>
6 years agodrm/amdgpu/cgs: add refresh rate checking to non-DC display code
Alex Deucher [Tue, 13 Feb 2018 19:33:51 +0000 (14:33 -0500)]
drm/amdgpu/cgs: add refresh rate checking to non-DC display code

Clamp the vblank period to 0 if the refresh rate is larger than
120 hz for non-DC.  This allows us to remove the refresh rate
checks from powerplay for mclk switching.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay/smu7: allow mclk switching with no displays
Alex Deucher [Tue, 13 Feb 2018 19:26:54 +0000 (14:26 -0500)]
drm/amd/powerplay/smu7: allow mclk switching with no displays

If there are no displays attached, there is no reason to disable
mclk switching.

Fixes mclks getting set to high when there are no displays attached.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay/vega10: allow mclk switching with no displays
Alex Deucher [Tue, 13 Feb 2018 19:25:11 +0000 (14:25 -0500)]
drm/amd/powerplay/vega10: allow mclk switching with no displays

If there are no displays attached, there is no reason to disable
mclk switching.

Fixes mclks getting set to high when there are no displays attached.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock
Alex Deucher [Tue, 13 Feb 2018 19:22:46 +0000 (14:22 -0500)]
drm/amd/powerplay: use PP_CAP macro for disable_mclk_switching_for_frame_lock

Rather than open coding it.

Reviewed-by: Eric Huang <JinhuiEric.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: remove unused headers
Corentin Labbe [Wed, 14 Feb 2018 14:46:17 +0000 (14:46 +0000)]
drm/amd/powerplay: remove unused headers

All thoses headers are not used by any source files.
Lets just remove them.

Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm
Gustavo A. R. Silva [Thu, 15 Feb 2018 05:20:00 +0000 (23:20 -0600)]
drm/amdgpu_gem: fix error handling path in amdgpu_gem_va_update_vm

Currently, if amdgpu_vm_bo_update() fails, the returned error
is being ignored.

Fix this by properly checking _r_ after calling amdgpu_vm_bo_update.
Also, remove redundant code just before label _error_.

Addresses-Coverity-ID: 1464280 ("Unused value")
Fixes: 0abc6878fc2d ("drm/amdgpu: update VM PDs after the PTs")
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>