linux-2.6-microblaze.git
6 years agodrm/amd/display: DP Compliance 400.1.1 failure
abdoulaye berthe [Thu, 19 Jul 2018 19:39:55 +0000 (15:39 -0400)]
drm/amd/display: DP Compliance 400.1.1 failure

[Why]
400.1.1 is failing because we are not performing link training when
we get an HPD pulse for the same display. This is breaking DP
compliance

[How]
Always perform link training after HPD pulse if the detection
reason is not  DETECT_REASON_HPDRX.

Signed-off-by: abdoulaye berthe <abdoulaye.berthe@amd.com>
Reviewed-by: Wenjing Liu <Wenjing.Liu@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Use requested HDMI aspect ratio
Leo (Sunpeng) Li [Thu, 19 Jul 2018 12:22:16 +0000 (08:22 -0400)]
drm/amd/display: Use requested HDMI aspect ratio

[Why]
The DRM mode's HDMI picture aspect ratio field was never saved in
dc_stream's timing struct. This causes us to mistake a new stream to
have the same timings as the old, even though the user has requested a
different aspect ratio.

[How]
Save DRM's aspect ratio field within dc_stream's timing struct.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107153
Signed-off-by: Leo (Sunpeng) Li <sunpeng.li@amd.com>
Reviewed-by: Mikita Lipski <Mikita.Lipski@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/display: Only require EDID read for HDMI and DVI
Harry Wentland [Thu, 2 Aug 2018 19:32:01 +0000 (15:32 -0400)]
drm/amd/display: Only require EDID read for HDMI and DVI

[Why]
VGA sometimes has trouble retrieving the EDID on very long cables, KVM
switches, or old displays.

[How]
Only require EDID read for HDMI and DVI and exempt other types (DP,
VGA). We currently don't support VGA but if anyone adds support in the
future this might get overlooked.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Suggested-by: Michel Dänzer <michel@daenzer.net>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Report non-DP display as disconnected without EDID
Harry Wentland [Wed, 1 Aug 2018 14:48:23 +0000 (10:48 -0400)]
drm/amd/display: Report non-DP display as disconnected without EDID

[Why]
Some boards seem to have a problem where HPD is high on HDMI even though
no display is connected. We don't want to report these as connected. DP
spec still requires us to report DP displays as connected when HPD is
high but we can't read the EDID in order to go to fail-safe mode.

[How]
If connector_signal is not DP abort detection if we can't retrieve the
EDID.

v2: Add Bugzilla and stable

Bugzilla: https://bugs.freedesktop.org/107390
Bugzilla: https://bugs.freedesktop.org/106846
Cc: stable@vger.kernel.org
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: clean up non-x86 definitions on ttm_tt
Huang Rui [Wed, 1 Aug 2018 05:49:33 +0000 (13:49 +0800)]
drm/ttm: clean up non-x86 definitions on ttm_tt

All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_tt.c.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Add ttm_set_pages_wc and ttm_set_pages_uc helper
Huang Rui [Wed, 1 Aug 2018 05:49:32 +0000 (13:49 +0800)]
drm/ttm: Add ttm_set_pages_wc and ttm_set_pages_uc helper

These two helpers will be used on set page caching.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: fix missed conversion of set_pages_array_uc
Huang Rui [Wed, 1 Aug 2018 05:49:31 +0000 (13:49 +0800)]
drm/ttm: fix missed conversion of set_pages_array_uc

This patch fixed the error when do not configure CONFIG_X86, otherwise, below
error will be encountered.

All errors (new ones prefixed by >>):

   drivers/gpu/drm/ttm/ttm_page_alloc_dma.c: In function 'ttm_set_pages_caching':
>> drivers/gpu/drm/ttm/ttm_page_alloc_dma.c:272:7: error: implicit declaration of function 'set_pages_array_uc'; did you mean
+'ttm_set_pages_array_uc'? [-Werror=implicit-function-declaration]
      r = set_pages_array_uc(pages, cpages);
          ^~~~~~~~~~~~~~~~~~
          ttm_set_pages_array_uc
   cc1: some warnings being treated as errors

Reported-by: kbuild test robot <lkp@intel.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/pm: Fix potential Spectre v1
Gustavo A. R. Silva [Mon, 23 Jul 2018 16:32:32 +0000 (11:32 -0500)]
drm/amdgpu/pm: Fix potential Spectre v1

idx can be indirectly controlled by user-space, hence leading to a
potential exploitation of the Spectre variant 1 vulnerability.

This issue was detected with the help of Smatch:

drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c:408 amdgpu_set_pp_force_state()
warn: potential spectre issue 'data.states'

Fix this by sanitizing idx before using it to index data.states

Notice that given that speculation windows are large, the policy is
to kill the speculation on the first load and not worry if it can be
completed with a dependent load/store [1].

[1] https://marc.info/?l=linux-kernel&m=152449131114778&w=2

Cc: stable@vger.kernel.org
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: add missing void parameter to dc_create_transfer_func
Colin Ian King [Tue, 31 Jul 2018 10:42:54 +0000 (11:42 +0100)]
drm/amd/display: add missing void parameter to dc_create_transfer_func

Add a missing void parameter to function dc_create_transfer_func, fixes
sparse warning:

warning: non-ANSI function declaration of function 'dc_create_transfer_func'

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/radeon: Replace ttm_bo_unref with ttm_bo_put
Thomas Zimmermann [Tue, 31 Jul 2018 06:16:59 +0000 (08:16 +0200)]
drm/radeon: Replace ttm_bo_unref with ttm_bo_put

The function ttm_bo_put releases a reference to a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
clears the pointer's value to NULL. This is not necessary in most cases and
sometimes even worked around by the calling code. A call to ttm_bo_put only
releases the reference without clearing the pointer.

The current behaviour of cleaning the pointer is kept in the calling code,
but should be removed if not required in a later patch.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/radeon: Replace ttm_bo_reference with ttm_bo_get
Thomas Zimmermann [Tue, 31 Jul 2018 06:16:58 +0000 (08:16 +0200)]
drm/radeon: Replace ttm_bo_reference with ttm_bo_get

The function ttm_bo_get acquires a reference on a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Replace ttm_bo_unref with ttm_bo_put
Thomas Zimmermann [Tue, 31 Jul 2018 07:12:36 +0000 (09:12 +0200)]
drm/amdgpu: Replace ttm_bo_unref with ttm_bo_put

The function ttm_bo_put releases a reference to a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

A call to ttm_bo_unref takes the address of the TTM BO object's pointer and
clears the pointer's value to NULL. This is not necessary in most cases and
sometimes even worked around by the calling code. A call to ttm_bo_put only
releases the reference without clearing the pointer.

The current behaviour of cleaning the pointer is kept in the calling code,
but should be removed if not required in a later patch.

v2:
 * set prefix to drm/amdgpu

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Replace ttm_bo_reference with ttm_bo_get
Thomas Zimmermann [Tue, 31 Jul 2018 07:12:35 +0000 (09:12 +0200)]
drm/amdgpu: Replace ttm_bo_reference with ttm_bo_get

The function ttm_bo_get acquires a reference on a TTM buffer object. The
function's name is more aligned to the Linux kernel convention of naming
ref-counting function _get and _put.

v2:
 * changed prefix to drm/amdgpu

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/scheduler: stop setting rq to NULL
Christian König [Mon, 30 Jul 2018 09:40:06 +0000 (11:40 +0200)]
drm/scheduler: stop setting rq to NULL

We removed the redundancy of having an extra scheduler field, so we
can't set the rq to NULL any more or otherwise won't know which
scheduler to use for the cleanup.

Just remove the entity from the scheduling list instead.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107367
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/scheduler: only kill entity if last user is killed v2
Christian König [Thu, 26 Jul 2018 11:43:49 +0000 (13:43 +0200)]
drm/scheduler: only kill entity if last user is killed v2

Note which task is using the entity and only kill it if the last user of
the entity is killed. This should prevent problems when entities are leaked to
child processes.

v2: add missing kernel doc

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: create an empty bo_list if no handle is provided
Christian König [Mon, 30 Jul 2018 14:44:14 +0000 (16:44 +0200)]
drm/amdgpu: create an empty bo_list if no handle is provided

Instead of having extra handling just create an empty bo_list when no
handle is provided.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: allocate the bo_list array after the list
Christian König [Mon, 30 Jul 2018 14:16:01 +0000 (16:16 +0200)]
drm/amdgpu: allocate the bo_list array after the list

This avoids multiple allocations for the head and the array.

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: add bo_list iterators
Christian König [Mon, 30 Jul 2018 13:37:46 +0000 (15:37 +0200)]
drm/amdgpu: add bo_list iterators

Add helpers to iterate over all entries in a bo_list.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: nuke amdgpu_bo_list_free
Christian König [Mon, 30 Jul 2018 12:17:41 +0000 (14:17 +0200)]
drm/amdgpu: nuke amdgpu_bo_list_free

The RCU grace period is harmless and avoiding it is not worth the effort
of doubling the implementation.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: always recreate bo_list
Christian König [Mon, 30 Jul 2018 11:46:04 +0000 (13:46 +0200)]
drm/amdgpu: always recreate bo_list

The bo_list handle is allocated by OP_CREATE, so in OP_UPDATE here we just
re-create the bo_list object and replace the handle. This way we don't
need locking to protect the bo_list because it's always re-created when
changed.

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: move bo_list defines to amdgpu_bo_list.h
Christian König [Mon, 30 Jul 2018 11:27:09 +0000 (13:27 +0200)]
drm/amdgpu: move bo_list defines to amdgpu_bo_list.h

Further demangle amdgpu.h

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add new amdgpu_vm_bo_trace_cs() function v2
Christian König [Fri, 27 Jul 2018 14:56:34 +0000 (16:56 +0200)]
drm/amdgpu: add new amdgpu_vm_bo_trace_cs() function v2

This allows us to trace all VM ranges which should be valid inside a CS.

v2: dump mappings without BO as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-and-tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> (v1)
Reviewed-by: Huang Rui <ray.huang@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: return error if both BOs and bo_list handle is given
Christian König [Mon, 30 Jul 2018 14:18:54 +0000 (16:18 +0200)]
drm/amdgpu: return error if both BOs and bo_list handle is given

Return -EINVAL when both the BOs as well as a list handle is provided in
the IOCTL.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix total size calculation
Christian König [Mon, 30 Jul 2018 13:33:34 +0000 (15:33 +0200)]
drm/amdgpu: fix total size calculation

long might only be 32bit in size and we can easily use more than 4GB
here.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Acked-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/sched: remove unneeded -Iinclude/drm compiler flag
Masahiro Yamada [Fri, 6 Jul 2018 05:12:11 +0000 (14:12 +0900)]
drm/sched: remove unneeded -Iinclude/drm compiler flag

I refactored the include directives under include/drm/ some time ago.
This flag is unneeded.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Acked-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add proper error handling to amdgpu_bo_list_get
Christian König [Fri, 27 Jul 2018 13:32:04 +0000 (15:32 +0200)]
drm/amdgpu: add proper error handling to amdgpu_bo_list_get

Otherwise we silently don't use a BO list when the handle is invalid.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix a reversed condition
Rex Zhu [Wed, 25 Jul 2018 03:51:46 +0000 (11:51 +0800)]
drm/amdgpu: fix a reversed condition

This test was reversed so it would end up leading to vddnb value
can't be read via hwmon on APU.

Reviewed-by: Evan Quan <evan.quan@amd.com>
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>
Cc: stable@vger.kernel.org
6 years agodrm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST
Rex Zhu [Wed, 25 Jul 2018 03:45:03 +0000 (11:45 +0800)]
drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST

the voltage showed in debugfs and hwmon should be in mV

Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/pp: Delete unused temp variables
Rex Zhu [Fri, 20 Jul 2018 10:19:00 +0000 (18:19 +0800)]
drm/amd/pp: Delete unused temp variables

Only delete the dead temp variables in Polaris.

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/Polaris12: Fix a chunk of registers missed to program
Rex Zhu [Fri, 20 Jul 2018 08:26:46 +0000 (16:26 +0800)]
drm/amd/pp/Polaris12: Fix a chunk of registers missed to program

DIDTConfig_Polaris12[] table missed a big chunk of data.

Pointed by aidan.fabius <aidan.fabius@coreavi.com>

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>
Cc: stable@vger.kernel.org
6 years agodrm/amdgpu: clean up the superfluous space and align the comment text for amdgpu_ttm
Huang Rui [Thu, 26 Jul 2018 06:08:03 +0000 (14:08 +0800)]
drm/amdgpu: clean up the superfluous space and align the comment text for amdgpu_ttm

This patch cleans up spaces and align the text to refine the comment for
amdgpu_ttm.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: correct evict flag for bo move
Junwei Zhang [Thu, 26 Jul 2018 10:00:13 +0000 (18:00 +0800)]
drm/amdgpu: correct evict flag for bo move

pass the evict flag instead of hard code

Signed-off-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)
Bas Nieuwenhuizen [Wed, 25 Jul 2018 20:29:50 +0000 (22:29 +0200)]
drm/ttm: Merge hugepage attr changes in ttm_dma_page_put. (v2)

Every set_pages_array_wb call resulted in cross-core
interrupts and TLB flushes. Merge more of them for
less overhead.

This reduces the time needed to free a 1.6 GiB GTT WC
buffer as part of Vulkan CTS from  ~2 sec to < 0.25 sec.
(Allocation still takes more than 2 sec though)

(v2): use set_pages_wb instead of set_memory_wb.

Signed-off-by: Bas Nieuwenhuizen <basni@chromium.org>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: clean up non-x86 definitions on ttm_page_alloc
Huang Rui [Thu, 26 Jul 2018 08:49:36 +0000 (16:49 +0800)]
drm/ttm: clean up non-x86 definitions on ttm_page_alloc

All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_page_alloc.c.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma
Huang Rui [Thu, 26 Jul 2018 08:48:54 +0000 (16:48 +0800)]
drm/ttm: clean up non-x86 definitions on ttm_page_alloc_dma

All non-x86 definitions are moved to ttm_set_memory header, so remove it from
ttm_page_alloc_dma.c.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/ttm: add ttm_set_memory header (v2)
Huang Rui [Thu, 26 Jul 2018 08:32:08 +0000 (16:32 +0800)]
drm/ttm: add ttm_set_memory header (v2)

This patch moves all non-x86 abstraction to the ttm_set_memory header.
It is to make function calling more clearly.

(v2): add ttm_ prefix.

Suggested-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Bas Nieuwenhuizen <basni@chromium.org>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: implement harvesting support for UVD 7.2 (v3)
Alex Deucher [Wed, 25 Jul 2018 20:11:34 +0000 (15:11 -0500)]
drm/amdgpu: implement harvesting support for UVD 7.2 (v3)

Properly handle cases where one or more instance of the IP
block may be harvested.

v2: make sure ip_num_rings is initialized amdgpu_queue_mgr.c
v3: rebase on Christian's UVD changes, drop unused var

Reviewed-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd: Add missing fields in atom_integrated_system_info_v1_11
Harry Wentland [Wed, 25 Jul 2018 13:45:47 +0000 (09:45 -0400)]
drm/amd: Add missing fields in atom_integrated_system_info_v1_11

This structure needs to align with structure in atomfirmware table.
Update it.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Dmytro Laktyushkin <dmytro.laktyushkin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: DC 3.1.59
Harry Wentland [Mon, 9 Jul 2018 21:26:34 +0000 (17:26 -0400)]
drm/amd/display: DC 3.1.59

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Prevent PSR from being enabled if initialization fails
Anthony Koo [Tue, 17 Jul 2018 13:43:44 +0000 (09:43 -0400)]
drm/amd/display: Prevent PSR from being enabled if initialization fails

[Why]
PSR_SET command is sent to the microcontroller in order to initialize
parameters needed for PSR feature, such as telling the microcontroller
which pipe is driving the PSR supported panel. When this command is
skipped or fails, the microcontroller may program the wrong thing if
driver tries to enable PSR.

[How]
If PSR_SET fails, do not set psr_enable flag to indicate the feature is
not yet initialized.

Signed-off-by: Anthony Koo <Anthony.Koo@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Fix Vega10 black screen after mode change
Jerry (Fangzhi) Zuo [Tue, 17 Jul 2018 15:53:54 +0000 (11:53 -0400)]
drm/amd/display: Fix Vega10 black screen after mode change

[Why]
The sequence is slightly changed when bring .set_bandwidth out
from the end of programming backend to the end of programming
surface. Vega10 doesn't like to get clocks updated if
stream_count is zero in the current context (Atomic Reset).

[How]
Do not update clocks if no stream is showing up in the context.

Fixes 1b2b130192 "dc: Remove 300Mhz minimum disp clk limit."

Signed-off-by: Jerry (Fangzhi) Zuo <Jerry.Zuo@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: flatten aux_engine and engine
Bhawanpreet Lakha [Thu, 28 Jun 2018 21:50:05 +0000 (17:50 -0400)]
drm/amd/display: flatten aux_engine and engine

[Why]
engine and aux_engine are unnecessary layers we want to remove this
layer.

[How]
flatten engine and aux engine structs into one struct called
aux_engine and remove all references to the engine struct.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Retry link training again
Bhawanpreet Lakha [Fri, 13 Jul 2018 22:00:06 +0000 (18:00 -0400)]
drm/amd/display: Retry link training again

[Why]
Some receivers seem to fail the first link training but are good on
subsequent tries. We want to retry link training again. This fixes
HTC vive pro not lighting up after being disabled.

[How]
Check if the link training passed without fall back if this is not
the case then we retry link training.

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: patch the IBs for the second UVD instance v2
Christian König [Wed, 18 Jul 2018 12:52:42 +0000 (14:52 +0200)]
drm/amdgpu: patch the IBs for the second UVD instance v2

Patch the IBs for the second UVD instance so that userspace don't need
to care about the instance they submit to.

v2: use direct IB patching

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-and-tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add support for inplace IB patching for MM engines v2
Christian König [Mon, 23 Jul 2018 14:01:39 +0000 (16:01 +0200)]
drm/amdgpu: add support for inplace IB patching for MM engines v2

We are going to need that for the second UVD instance on Vega20.

v2: rename to patch_cs_in_place

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-tested-by: James Zhu <James.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoMerge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 27 Jul 2018 02:31:07 +0000 (12:31 +1000)]
Merge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux into drm-next

Updates for 4.19.  Mostly bug fixes and cleanups.  Highlights:
- Internal API cleanup in GPU scheduler
- Decouple i2c and aux abstractions in DC
- Update maintainers
- Misc cleanups
- Misc bug fixes

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180725215326.2709-1-alexander.deucher@amd.com
6 years agoMerge tag 'exynos-drm-next-for-v4.19' of git://git.kernel.org/pub/scm/linux/kernel...
Dave Airlie [Fri, 27 Jul 2018 02:26:33 +0000 (12:26 +1000)]
Merge tag 'exynos-drm-next-for-v4.19' of git://git./linux/kernel/git/daeinki/drm-exynos into drm-next

Cleanups
- Change g2d driver to component based driver
  . g2d driver was last customed sub driver so this patch series
    changes it to component based driver, which also makes gem handling
    to be more simplify.
- Cleanup of Exynos DRM suspend/resume
  . Register exynos drm core suspend/resume functions
    to prepare/complete callbacks of dev_pm_ops instead of suspend/resume
    callbacks to ensure exynos_drm_suspend() is called before any suspend
    callback from the real devices to avoid some issues on boards with
    complex pipelines.
  . Also Add pm_runtime_furce_suspend/resume as SYSTEM_SLEEP_PM_OPS
    to ensure that resources of each devices will be released
    for the system PM suspend/resume cycle.
- Remove local value not used.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1532505748-10025-1-git-send-email-inki.dae@samsung.com
6 years agoMerge branch 'for-upstream/malidp-fixes' of git://linux-arm.org/linux-ld into drm...
Dave Airlie [Fri, 27 Jul 2018 02:20:43 +0000 (12:20 +1000)]
Merge branch 'for-upstream/malidp-fixes' of git://linux-arm.org/linux-ld into drm-next

I have a couple of small patches for malidp to be applied in drm-next.
They have arisen from the decision to switch the writeback connectors to
always connected.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180723145302.GA28052@e110455-lin.cambridge.arm.com
6 years agoMerge tag 'imx-drm-next-2018-07-20' of git://git.pengutronix.de/git/pza/linux into...
Dave Airlie [Fri, 27 Jul 2018 02:20:04 +0000 (12:20 +1000)]
Merge tag 'imx-drm-next-2018-07-20' of git://git.pengutronix.de/git/pza/linux into drm-next

drm/imx: cleanup and csi improvements

- Remove the unused struct imx_drm_crtc and the unused pipes field
  from imx_drm_device and replace drm_dev_unref with drm_dev_put.
- Extend CSI configuration to support RGB888 and BGR888 capture,
  as well as 16-bit RGB565 capture via a parallel bus.
- Add CPMEM support for negative interlace offsets, which is
  necessary to support writing captured bottom-top interlaced
  fields to memory with interleaved lines.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1532100583.3438.9.camel@pengutronix.de
6 years agogpu: drm: amdgpu: Replace mdelay with msleep in cik_pcie_gen3_enable()
Jia-Ju Bai [Mon, 23 Jul 2018 14:29:56 +0000 (22:29 +0800)]
gpu: drm: amdgpu: Replace mdelay with msleep in cik_pcie_gen3_enable()

cik_pcie_gen3_enable() is only called by cik_common_hw_init(), which is
never called in atomic context.
cik_pcie_gen3_enable() calls mdelay() to busily wait, which is not
necessary.
mdelay() can be replaced with msleep().

This is found by a static analysis tool named DCNS written by myself.

Signed-off-by: Jia-Ju Bai <baijiaju1990@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/gmc9: clarify GPUVM fault error message
Alex Deucher [Tue, 24 Jul 2018 16:52:58 +0000 (11:52 -0500)]
drm/amdgpu/gmc9: clarify GPUVM fault error message

The address printed is the actual address, not the page.

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/scheduler: remove sched field from the entity
Nayan Deshmukh [Fri, 20 Jul 2018 12:21:06 +0000 (17:51 +0530)]
drm/scheduler: remove sched field from the entity

The scheduler of the entity is decided by the run queue on which
it is queued. This patch avoids us the effort required to maintain
a sync between rq and sched field when we start shifting entites
among different rqs.

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/scheduler: modify API to avoid redundancy
Nayan Deshmukh [Fri, 20 Jul 2018 12:21:05 +0000 (17:51 +0530)]
drm/scheduler: modify API to avoid redundancy

entity has a scheduler field and we don't need the sched argument
in any of the functions where entity is provided.

Signed-off-by: Nayan Deshmukh <nayan26deshmukh@gmail.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: reduce the number of placements for a BO
Christian König [Wed, 18 Jul 2018 09:16:35 +0000 (11:16 +0200)]
drm/amdgpu: reduce the number of placements for a BO

Make struct amdgpu_bo a bit smaller.

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: consistenly name amdgpu_bo_ functions
Christian König [Mon, 16 Jul 2018 14:12:24 +0000 (16:12 +0200)]
drm/amdgpu: consistenly name amdgpu_bo_ functions

Just rename functions, no functional change.

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 agoMAINTAINERS: add entry for AMD PP code
Christian König [Thu, 19 Jul 2018 09:39:37 +0000 (11:39 +0200)]
MAINTAINERS: add entry for AMD PP code

Add separate entry for the power managent code on AMD GPUs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <rezhu@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoMAINTAINERS: Add separate section for DC
Christian König [Wed, 18 Jul 2018 11:16:06 +0000 (13:16 +0200)]
MAINTAINERS: Add separate section for DC

Note that Harry and Leo Li are maintainers for that stuff.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoMAINTAINERS: add new TTM maintainers
Christian König [Wed, 18 Jul 2018 11:06:02 +0000 (13:06 +0200)]
MAINTAINERS: add new TTM maintainers

Roger unfortunately doesn't work for AMD any longer. So add Rui and
Jerry as co-maintainer as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: expose only the first UVD instance for now
Christian König [Wed, 18 Jul 2018 12:17:59 +0000 (14:17 +0200)]
drm/amdgpu: expose only the first UVD instance for now

Going to completely rework the context to ring mapping with Nayan's GSoC
work, but for now just stopping to expose the second UVD instance should
do it.

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: clean up coding style a bit
Christian König [Wed, 18 Jul 2018 11:58:16 +0000 (13:58 +0200)]
drm/amdgpu: clean up coding style a bit

No need to bitcast a boolean and even if we should use "!!" instead.

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/display: DC 3.1.58
Harry Wentland [Mon, 9 Jul 2018 21:25:42 +0000 (17:25 -0400)]
drm/amd/display: DC 3.1.58

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Aric Cyr <Aric.Cyr@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: separate dc_debug into dc_debug_options and dc_debug data
Jun Lei [Thu, 12 Jul 2018 14:35:01 +0000 (10:35 -0400)]
drm/amd/display: separate dc_debug into dc_debug_options and dc_debug data

[why]
confusing as to which part of debug is informational, and which part causes behavioral change

Signed-off-by: Jun Lei <Jun.Lei@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Decouple aux from i2c
Bhawanpreet Lakha [Tue, 10 Jul 2018 21:20:17 +0000 (17:20 -0400)]
drm/amd/display: Decouple aux from i2c

[Why]
Aux engine is created from i2caux layer. We want to remove this layer
and use the engine directly.

[How]
Decouple aux engine from i2caux. Move aux engine related code to dce folder and use
dc resource pool to manage the engine. And use the engine functions directly

Signed-off-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: DPP CM ICSC AYCRCB8888 format support
vikrant mhaske [Thu, 12 Jul 2018 08:04:43 +0000 (16:04 +0800)]
drm/amd/display: DPP CM ICSC AYCRCB8888 format support

[why]
Diags has POR to run the video workload using AYCRCB8888 through DCN;
capture it through DWB and send it to VCN hardware to encode

[how]
added the code to support this format so that DPP ICSC will be able to
convert it from YUV444 to internal RGB and DWB OCSC will be able to
convert from internal RGB to YUV420

Signed-off-by: vikrant mhaske <vikrant.mhaske@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: On dce100, set clocks to 0 on suspend
David Francis [Wed, 11 Jul 2018 20:20:13 +0000 (16:20 -0400)]
drm/amd/display: On dce100, set clocks to 0 on suspend

[Why]
When a dce100 asic was suspended, the clocks were not set to 0.
Upon resume, the new clock was compared to the existing clock,
they were found to be the same, and so the clock was not set.
This resulted in a pernicious blackscreen.

[How]
In atomic commit, check to see if there are any active pipes.
If no, set clocks to 0

Signed-off-by: David Francis <David.Francis@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: allow diags to skip initial link training
Tony Cheng [Wed, 11 Jul 2018 19:31:24 +0000 (15:31 -0400)]
drm/amd/display: allow diags to skip initial link training

[why]
diag specify what the full config and is only concerned about pass/fail at the end

having inter-op code like verifiying we can actually train at reported link rate
slows down diag test and add complexity we don't need

[how]
add dc_debug option to skip capability link trianing

also  remove hbr in function name as verify is not specific to hbr

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Ken Chalmers <ken.chalmers@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove unnecessary warning
Mikita Lipski [Wed, 4 Jul 2018 15:19:53 +0000 (11:19 -0400)]
drm/amd/display: Remove unnecessary warning

[why]
The warning message floods the dmesg log on Tonga even
though it is expected to have a pix_clk set to zero,
when the pipe is not active.
[how]
remove the assert

Signed-off-by: Mikita Lipski <mikita.lipski@amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland@amd.com>
Acked-by: Leo Li <sunpeng.li@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move the amdgpu_fbdev_set_suspend() further up
Shirish S [Mon, 23 Jul 2018 09:41:51 +0000 (15:11 +0530)]
drm/amdgpu: move the amdgpu_fbdev_set_suspend() further up

This patch moves amdgpu_fbdev_set_suspend() to the beginning
of suspend sequence.

This is to ensure fbcon does not to write to the VRAM
after GPU is powerd down.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Don't warn on destroying a pinned BO
Michel Dänzer [Thu, 19 Jul 2018 15:38:18 +0000 (17:38 +0200)]
drm/amdgpu: Don't warn on destroying a pinned BO

The warning turned out to be not so useful, as BO destruction tends to
be deferred to a workqueue.

Also, we should be preventing any damage from this now, so not really
important anymore to fix code doing this.

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Tested-by: Mike Lothian <mike@fireburn.co.uk>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: allow slow switch only if NBPState enabled v2
Evan Quan [Mon, 16 Jul 2018 09:25:30 +0000 (17:25 +0800)]
drm/amd/powerplay: allow slow switch only if NBPState enabled v2

Otherwise there may be potential SMU performance issues.

v2: fix commit description and coding style

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <rex.zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: correct the argument for PPSMC_MSG_SetUclkFastSwitch
Evan Quan [Mon, 16 Jul 2018 09:23:19 +0000 (17:23 +0800)]
drm/amd/powerplay: correct the argument for PPSMC_MSG_SetUclkFastSwitch

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

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <rex.zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/powerplay: slow UCLK switch when multiple displays not in sync
Evan Quan [Fri, 20 Jul 2018 02:13:19 +0000 (10:13 +0800)]
drm/amd/powerplay: slow UCLK switch when multiple displays not in sync

Slow switch for UCLK when there is multiple displays and they are
not in sync.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Rex Zhu <rex.zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix RLC safe mode test in gfx_v9_0_enter_rlc_safe_mode
Michel Dänzer [Thu, 19 Jul 2018 16:33:39 +0000 (18:33 +0200)]
drm/amdgpu: Fix RLC safe mode test in gfx_v9_0_enter_rlc_safe_mode

We were testing the register offset, instead of the value stored in the
register, therefore always timing out the loop.

This reduces suspend time of the system in the bug report below by ~600
ms.

Cc: stable@vger.kernel.org
Bugzilla: https://bugs.freedesktop.org/107277
Tested-by: Paul Menzel <pmenzel@molgen.mpg.de>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/exynos/mixer: Remove unused local variable priv
Krzysztof Kozlowski [Wed, 18 Jul 2018 19:55:20 +0000 (21:55 +0200)]
drm/exynos/mixer: Remove unused local variable priv

Remove local variable 'priv' to fix GCC warning:

    drivers/gpu/drm/exynos/exynos_mixer.c: In function 'mixer_initialize':
    drivers/gpu/drm/exynos/exynos_mixer.c:840:29: warning: variable 'priv' set but not used [-Wunused-but-set-variable]

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agodrm/exynos: Ensure suspended runtime PM state during system suspend
Marek Szyprowski [Mon, 11 Jun 2018 12:25:00 +0000 (14:25 +0200)]
drm/exynos: Ensure suspended runtime PM state during system suspend

Add calls to pm_runtime_force_{suspend,resume} as SYSTEM_SLEEP_PM_OPS for
all drivers for the real Exynos DRM hardware modules. This ensures that
the resources will be released for the system PM suspend/resume cycle.
Exynos DRM core already takes care of suspending the whole display pipeline
before PM callbacks of the real devices are called.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agodrm/exynos: Suspend/resume display pipeline as early/late as possible
Marek Szyprowski [Mon, 11 Jun 2018 12:24:59 +0000 (14:24 +0200)]
drm/exynos: Suspend/resume display pipeline as early/late as possible

In the current code, exynos_drm_suspend() function is called after all
real devices (CRTCs, Encoders, etc) are suspended, because Exynos DRM
virtual platform device is created as last device in the system (as
a part of DRM registration). None of the devices for real hardware
modules has its own system suspend/resume callbacks, so it doesn't
change any order of the executed code, but it has a side-effect:
runtime PM callbacks for real devices are not executed, because those
devices are considered by PM core as already suspended. This might
cause issues on boards with complex pipelines, where something
depends on the runtime PM state of the given device.

To ensure that exynos_drm_suspend() is called before any suspend
callback from the real devices, assign it to .prepare callback. Same
for exynos_drm_resume(), using .complete callback ensures that all
real devices have been resumed when calling it.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agodrm/exynos: Drop useless check from exynos_drm_{suspend,resume}
Marek Szyprowski [Mon, 11 Jun 2018 12:24:58 +0000 (14:24 +0200)]
drm/exynos: Drop useless check from exynos_drm_{suspend,resume}

The virtual Exynos DRM device has no runtime PM enabled, so checking
for its runtime suspended state is useless.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agodrm/exynos: Use common exynos_drm_gem_get()/put() functions for GEM lookup
Marek Szyprowski [Mon, 9 Jul 2018 13:44:32 +0000 (15:44 +0200)]
drm/exynos: Use common exynos_drm_gem_get()/put() functions for GEM lookup

Use recently introduced common helpers to unify GEM handling code.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agodrm/exynos: gem: Simplify access to exynos GEM objects
Marek Szyprowski [Mon, 9 Jul 2018 13:44:31 +0000 (15:44 +0200)]
drm/exynos: gem: Simplify access to exynos GEM objects

Replace all calls to exynos_drm_gem_get_{dma_addr,size}, by a simpler
function exynos_drm_gem_get(). This lets the caller to get access to
exynos_drm_gem object and extract any information about GEM object
without searching object tree for getting each parameter.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agodrm/exynos: g2d: Convert to driver component API
Marek Szyprowski [Mon, 9 Jul 2018 13:44:30 +0000 (15:44 +0200)]
drm/exynos: g2d: Convert to driver component API

Exynos G2D driver is the last client of the custom Exynos 'sub-driver'
framework. In the current state it doesn't really resolve any of the
issues it has been designed for, as Exynos DRM is already built only
as a single kernel module. Remove the custom 'sub-driver' framework and
simply use generic component framework also in G2D driver.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
6 years agoMerge tag 'exynos-drm-fixes-for-v4.18-rc4' of git://git.kernel.org/pub/scm/linux...
Inki Dae [Tue, 24 Jul 2018 06:28:44 +0000 (15:28 +0900)]
Merge tag 'exynos-drm-fixes-for-v4.18-rc4' of git://git./linux/kernel/git/daeinki/drm-exynos into exynos-drm-next

Fixups
- Fix several problems to IPPv2 merged to mainline recentely.
  . An align problem of width size that IPP driver incorrectly
    calculated the real buffer size.
  . Horizontal and vertical flip problem.
  . Per-plane global alpha for XRGB modes.
  . Incorrect variant of the YUV modes.
- Fix plane overlapping problem.
  . The stange order of overlapping planes on XRGB modes
    by setting global alpha value to maximum value.

Cleanup
- Rename a enum type, drm_ipp_size_id, to one specific to Exynos,
  drm_exynos_ipp_limit_type.
- Replace {un/reference} with {put,get} functions.
  . it replaces several reference/unreference functions with Linux
    kernel nameing standard.

6 years agodrm: mali-dp: Set encoder possible_clones
Alexandru Gheorghe [Fri, 13 Jul 2018 15:11:00 +0000 (16:11 +0100)]
drm: mali-dp: Set encoder possible_clones

Set possible_clones field to report that the writeback connector and
the one driving the display could be enabled at the same time.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agodrm: mali-dp: Report writeback connector as connected
Alexandru Gheorghe [Fri, 13 Jul 2018 15:10:59 +0000 (16:10 +0100)]
drm: mali-dp: Report writeback connector as connected

Older version of this patch series reported writeback as disconnected
to avoid confusing userspace not aware of writeback connectors.
However, the version that got merged uses a special cap
(DRM_CLIENT_CAP_WRITEBACK_CONNECTORS) for this purpose.

This helps us avoid some special handling of writeback connector
in drm_helper_probe_single_connector_modes, see [1].

https://lists.freedesktop.org/archives/dri-devel/2018-July/183144.html

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Liviu Dudau <liviu.dudau@arm.com>
6 years agodrm/amdgpu: rework suspend and resume to deal with atomic changes
Alex Deucher [Thu, 19 Jul 2018 18:24:33 +0000 (13:24 -0500)]
drm/amdgpu: rework suspend and resume to deal with atomic changes

Use the newly split ip suspend functions to do suspend displays
first (to deal with atomic so that FBs can be unpinned before
attempting to evict vram), then evict vram, then suspend the
other IPs.  Also move the non-DC pinning code to only be
called in the non-DC cases since atomic should take care of
DC.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=107065
Fixes: e00fb85 drm: Stop updating plane->crtc/fb/old_fb on atomic drivers
Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-and-tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: split ip suspend into 2 phases
Alex Deucher [Thu, 19 Jul 2018 18:10:07 +0000 (13:10 -0500)]
drm/amdgpu: split ip suspend into 2 phases

We need to do some IPs earlier to deal with ordering issues
similar to how resume is split into two phases. Do DCE first
to deal with atomic, then do the rest.

Acked-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-and-tested-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/acpi: skip backlight events for DC
Alex Deucher [Thu, 19 Jul 2018 14:28:23 +0000 (09:28 -0500)]
drm/amdgpu/acpi: skip backlight events for DC

No change in behavior, just bail sooner.

Reviewed-by: Jim Qu <Jim.Qu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/apci: don't call sbios request function if it's not supported
Alex Deucher [Thu, 19 Jul 2018 14:17:02 +0000 (09:17 -0500)]
drm/amdgpu/apci: don't call sbios request function if it's not supported

Check the supported functions mask before calling the bios
requests method.

Reviewed-by: Jim Qu <Jim.Qu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Fix warning in dma_fence_is_later on resume from S3.
Andrey Grodzovsky [Fri, 20 Jul 2018 15:42:24 +0000 (11:42 -0400)]
drm/amdgpu: Fix warning in dma_fence_is_later on resume from S3.

Problem:
amdgpu_ttm_set_buffer_funcs_status destroys adev->mman.entity on suspend
without releasing adev->mman.bdev.man[TTM_PL_VRAM].move fence
so on resume the new drm_sched_entity.fence_context causes
the warning against the old fence context which is different.

Fix:
When destroying sched_entity in amdgpu_ttm_set_buffer_funcs_status
release  man->move and set the pointer to NULL.

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: use drm_fb helper for console_(un)lock
Shirish S [Fri, 20 Jul 2018 11:56:50 +0000 (17:26 +0530)]
drm/amdgpu: use drm_fb helper for console_(un)lock

This patch removes the usage of console_(un)lock
by replacing drm_fb_helper_set_suspend() to
drm_fb_helper_set_suspend_unlocked() which locks and
unlocks the console instead of locking ourselves.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Convert 10kHz clks from PPLib into kHz
Rex Zhu [Tue, 17 Jul 2018 12:18:04 +0000 (20:18 +0800)]
drm/amd/display: Convert 10kHz clks from PPLib into kHz

Except special naming as *_in_khz, The default clock unit in powerplay
is in 10KHz. so need to * 10 as expecting clock frequency in display
is in kHz.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@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: Set Max clock level to display by default
Rex Zhu [Tue, 17 Jul 2018 10:31:50 +0000 (18:31 +0800)]
drm/amd/pp: Set Max clock level to display by default

avoid the error in dmesg:
[drm:dm_pp_get_static_clocks]
*ERROR* DM_PPLIB: invalid powerlevel state: 0!

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@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: Update clk with od setting when set power state
Rex Zhu [Thu, 19 Jul 2018 08:32:05 +0000 (16:32 +0800)]
drm/amd/pp: Update clk with od setting when set power state

This can fix the issue resume from S3, the user's OD setting
were reverted to default.

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: Read vbios vddc limit before use them
Rex Zhu [Thu, 19 Jul 2018 08:21:42 +0000 (16:21 +0800)]
drm/amd/pp: Read vbios vddc limit before use them

Use the vddc limit before read them from vbios

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: lock and unlock console only for amdgpu_fbdev_set_suspend [V5]
Shirish S [Wed, 18 Jul 2018 08:06:26 +0000 (13:36 +0530)]
drm/amdgpu: lock and unlock console only for amdgpu_fbdev_set_suspend [V5]

[Why]
While the console_lock is held, console output will be buffered, till
its unlocked it wont be emitted, hence its ideal to unlock sooner to enable
debugging/detecting/fixing of any issue in the remaining sequence of events
in resume path.
The concern here is about consoles other than fbcon on the device,
e.g. a serial console

[How]
This patch restructures the console_lock, console_unlock around
amdgpu_fbdev_set_suspend() and moves this new block appropriately.

V2: Kept amdgpu_fbdev_set_suspend after pci_set_power_state
V3: Updated the commit message to clarify the real concern that this patch
    addresses.
V4: code clean-up.
V5: fixed return value

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Honor pplib stutter mask for all ASICs in DC
Harry Wentland [Tue, 17 Jul 2018 14:51:23 +0000 (10:51 -0400)]
drm/amd/display: Honor pplib stutter mask for all ASICs in DC

[Why]
We were only setting this mask for DCN, but should really use it
universally for all ASICs.

[How]
Move the assignment out of the Raven switch statement for all ASICs
other than Stoney and Carrizo.

v2: Keep stutter always on for Carrizo and Stoney (Alex)

Cc: Rex.Zhu@amd.com
Cc: Feifei.Xu@amd.com
Cc: Kenneth.Feng@amd.com
Cc: Evan.Quan@amd.com
Cc: Bhawanpreet.Lakha@amd.com
Cc: Jordan.Lazare@amd.com
Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Drop unused backlight functions in DM
Harry Wentland [Thu, 19 Jul 2018 18:17:30 +0000 (14:17 -0400)]
drm/amd/display: Drop unused backlight functions in DM

These are only ever called for non-DC code.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix spelling mistake "successed" -> "succeeded"
Colin Ian King [Tue, 17 Jul 2018 09:29:29 +0000 (10:29 +0100)]
drm/amdgpu: fix spelling mistake "successed" -> "succeeded"

Trivial fix to spelling mistake in dev_err error message.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoMerge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 20 Jul 2018 04:30:18 +0000 (14:30 +1000)]
Merge branch 'drm-next-4.19' of git://people.freedesktop.org/~agd5f/linux into drm-next

More features for 4.19:
- Map processes to vmids for debugging GPUVM faults
- Raven gfxoff fixes
- Initial gfxoff support for vega12
- Use defines for interrupt sources rather than magic numbers
- DC aux fixes
- Finish DC logging TODO
- Add more DC debugfs interfaces for conformance testing
- Add CRC support for DCN
- Scheduler rework in preparation for load balancing
- Unify common smu9 code
- Clean up UVD instancing support
- ttm cleanups
- Misc fixes and cleanups

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180719194001.3488-1-alexander.deucher@amd.com
6 years agoMerge tag 'drm-intel-next-2018-07-19' of git://anongit.freedesktop.org/drm/drm-intel...
Dave Airlie [Fri, 20 Jul 2018 02:29:23 +0000 (12:29 +1000)]
Merge tag 'drm-intel-next-2018-07-19' of git://anongit.freedesktop.org/drm/drm-intel into drm-next

On GEM side:

- GuC related fixes (Chris, Michal)
- GTT read-only pages support (Jon, Chris)
- More selftests fixes (Chris)
- More GPU reset improvements (Chris)
- Flush caches after GGTT writes (Chris)
- Handle recursive shrinker for vma->last_active allocation (Chris)
- Other execlists fixes (Chris)

On Display side:

- GLK HDMI fix (Clint)
- Rework and cleanup around HPD pin (Ville)
- Preparation work for Display Stream Compression support coming on ICL (Anusha)
- Nuke LVDS lid notification (Ville)
- Assume eDP is always connected (Ville)
- Kill intel panel detection (Ville)

Signed-off-by: Dave Airlie <airlied@redhat.com>
# gpg: Signature made Fri 20 Jul 2018 01:51:45 AM AEST
# gpg:                using RSA key FA625F640EEB13CA
# gpg: Good signature from "Rodrigo Vivi <rodrigo.vivi@intel.com>"
# gpg:                 aka "Rodrigo Vivi <rodrigo.vivi@gmail.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 6D20 7068 EEDD 6509 1C2C  E2A3 FA62 5F64 0EEB 13CA

# Conflicts:
# drivers/gpu/drm/i915/intel_lrc.c
Link: https://patchwork.freedesktop.org/patch/msgid/20180719171257.GA12199@intel.com
6 years agoMerge tag 'drm-misc-next-2018-07-18' of git://anongit.freedesktop.org/drm/drm-misc...
Dave Airlie [Fri, 20 Jul 2018 00:40:25 +0000 (10:40 +1000)]
Merge tag 'drm-misc-next-2018-07-18' of git://anongit.freedesktop.org/drm/drm-misc into drm-next

drm-misc-next for 4.19:

Core Changes:
- add support for DisplayPort CEC-Tunneling-over-AUX (Hans Verkuil)
- more doc updates (Daniel Vetter)
- fourcc: Add is_yuv field to drm_format_info (Ayan Kumar Halder)
- dma-buf: correctly place BUG_ON (Michel Dänzer)

Driver Changes:
- more vkms support(Rodrigo Siqueira)
- many fixes and small improments to all drivers

Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180718200826.GA20165@juma