platform/kernel/linux-rpi.git
6 years agodrm/amdgpu: Update kgd2kfd_shared_resources for dGPU support
Felix Kuehling [Wed, 7 Feb 2018 01:32:36 +0000 (20:32 -0500)]
drm/amdgpu: Update kgd2kfd_shared_resources for dGPU support

Add GPUVM size and DRM render node. Also add function to query the
VMID mask to avoid hard-coding it in multiple places later.

v2: cut off GPUVM size at the VA hole

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Add KFD eviction fence
Felix Kuehling [Wed, 7 Feb 2018 01:32:35 +0000 (20:32 -0500)]
drm/amdgpu: Add KFD eviction fence

This fence is used by KFD to keep memory resident while user mode
queues are enabled. Trying to evict memory will trigger the
enable_signaling callback, which starts a KFD eviction, which
involves preempting user mode queues before signaling the fence.
There is one such fence per process.

v2:
* Grab a reference to mm_struct
* Dereference fence after NULL check
* Simplify fence release, no need to signal without anyone waiting
* Added signed-off-by Harish, who is the original author of this code

v3:
* update MAINTAINERS file
* change amd_kfd_ prefix to amdkfd_
* remove useless initialization of variable to NULL

v4:
* set amdkfd_fence_ops to be static
* Suggested by: Fengguang Wu <fengguang.wu@intel.com>

Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Remove unused kfd2kgd interface
Felix Kuehling [Wed, 7 Feb 2018 01:32:34 +0000 (20:32 -0500)]
drm/amdgpu: Remove unused kfd2kgd interface

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Fix wrong mask in get_atc_vmid_pasid_mapping_pasid
Felix Kuehling [Wed, 7 Feb 2018 01:32:33 +0000 (20:32 -0500)]
drm/amdgpu: Fix wrong mask in get_atc_vmid_pasid_mapping_pasid

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Fix header file dependencies
Felix Kuehling [Wed, 7 Feb 2018 01:32:32 +0000 (20:32 -0500)]
drm/amdgpu: Fix header file dependencies

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Replace kgd_mem with amdgpu_bo for kernel pinned gtt mem
Yong Zhao [Wed, 7 Feb 2018 01:32:31 +0000 (20:32 -0500)]
drm/amdgpu: Replace kgd_mem with amdgpu_bo for kernel pinned gtt mem

The extra fields in struct kgd_mem aren't actually needed. This struct
will be used for GPUVM allocations later.

Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: remove useless BUG_ONs
Felix Kuehling [Wed, 7 Feb 2018 01:32:30 +0000 (20:32 -0500)]
drm/amdgpu: remove useless BUG_ONs

Dereferencing NULL pointers will cause a BUG anyway. No need to do
an explicit check.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdgpu: Enable KFD initialization on dGPUs
Felix Kuehling [Thu, 4 Jan 2018 22:17:48 +0000 (17:17 -0500)]
drm/amdgpu: Enable KFD initialization on dGPUs

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add dGPU device IDs and device info
Felix Kuehling [Thu, 4 Jan 2018 22:17:47 +0000 (17:17 -0500)]
drm/amdkfd: Add dGPU device IDs and device info

v2: remove needs_iommu field as it doesn't exists

CC: linux-pci@vger.kernel.org
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add dGPU support to kernel_queue_init
Felix Kuehling [Thu, 4 Jan 2018 22:17:46 +0000 (17:17 -0500)]
drm/amdkfd: Add dGPU support to kernel_queue_init

Recognize dGPU ASIC families.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add dGPU support to the MQD manager
Felix Kuehling [Thu, 4 Jan 2018 22:17:45 +0000 (17:17 -0500)]
drm/amdkfd: Add dGPU support to the MQD manager

On dGPUs don't set ATC addressing bits and use MTYPE_UC for coherent
memory.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Add dGPU support to the device queue manager
Felix Kuehling [Thu, 4 Jan 2018 22:17:44 +0000 (17:17 -0500)]
drm/amdkfd: Add dGPU support to the device queue manager

GFXv7 and v8 dGPUs use a different addressing mode for KFD compared
to APUs (GPUVM64 vs HSA64). And dGPUs don't support MTYPE_CC. They
use MTYPE_UC instead for memory that requires coherency.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Make sched_policy a per-device setting
Felix Kuehling [Thu, 4 Jan 2018 22:17:43 +0000 (17:17 -0500)]
drm/amdkfd: Make sched_policy a per-device setting

Some dGPUs don't support HWS. Allow them to use a per-device
sched_policy that may be different from the global default.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Conditionally enable PCIe atomics
Felix Kuehling [Thu, 4 Jan 2018 22:17:41 +0000 (17:17 -0500)]
drm/amdkfd: Conditionally enable PCIe atomics

This will be needed for most dGPUs.

CC: linux-pci@vger.kernel.org
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodrm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry
Gustavo A. R. Silva [Fri, 19 Jan 2018 00:39:55 +0000 (18:39 -0600)]
drm/amdkfd: Use ARRAY_SIZE macro in kfd_build_sysfs_node_entry

Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element.

This issue was detected with the help of Coccinelle.

Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
Reviewed-by: Felix Kuehling<Felix.Kuehling@amd.com>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agodma-fence: add comment for WARN_ON in dma_fence_release()
Oded Gabbay [Mon, 29 Jan 2018 15:31:40 +0000 (17:31 +0200)]
dma-fence: add comment for WARN_ON in dma_fence_release()

In dma_fence_release() there is a WARN_ON which could be triggered by
several cases of wrong dma-fence usage. This patch adds a comment to
explain two use-cases to help driver developers that use dma-fence
and trigger that WARN_ON to better understand the reasons for it.

v2: change to a more generic, one-liner comment

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Oded Gabbay <oded.gabbay@gmail.com>
6 years agoMerge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm...
Dave Airlie [Fri, 9 Mar 2018 00:50:45 +0000 (10:50 +1000)]
Merge branch 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux into drm-next

More stuff for 4.17. Highlights:
- More fixes for "wattman" like functionality (fine grained clk/voltage control)
- Add more power profile infrastucture (context based dpm)
- SR-IOV fixes
- Add iomem debugging interface for use with umr
- Powerplay and cgs cleanups
- DC fixes and cleanups
- ttm improvements
- Misc cleanups all over

* 'drm-next-4.17' of git://people.freedesktop.org/~agd5f/linux: (143 commits)
  drm/amdgpu:Always save uvd vcpu_bo in VM Mode
  drm/amdgpu:Correct max uvd handles
  drm/amdgpu: replace iova debugfs file with iomem (v3)
  drm/amd/display: validate plane format on primary plane
  drm/amdgpu: Clean sdma wptr register when only enable wptr polling
  drm/amd/amdgpu: re-add missing GC 9.1 and SDMA0 4.1 sh_mask header files
  drm/amdgpu: give warning before sleep in kiq_r/wreg
  drm/amdgpu: further mitigate workaround for i915
  drm/amdgpu: drop gtt->adev
  drm/amdgpu: add amdgpu_evict_gtt debugfs entry
  drm/amd/pp: Add #ifdef checks for CONFIG_ACPI
  drm/amd/pp: fix "Delete the wrapper layer of smu_allocate/free_memory"
  drm/amd/pp: Drop wrapper functions for upper/lower_32_bits
  drm/amdgpu: Delete cgs wrapper functions for gpu memory manager
  drm/amd/pp: Delete the wrapper layer of smu_allocate/free_memory
  drm/amd/pp: Remove cgs wrapper function for temperature update
  Revert "drm/amd/pp: Add a pp feature mask bit for AutoWattman feature"
  drm/amd/pp: Add auto power profilng switch based on workloads (v2)
  drm/amd/pp: Revert gfx/compute profile switch sysfs
  drm/amd/pp: Fix sclk in highest two levels when compute on smu7
  ...

6 years agoMerge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next
Dave Airlie [Fri, 9 Mar 2018 00:22:30 +0000 (10:22 +1000)]
Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next

- Convert LVDS support to a drm_bridge driver
- Add DT bindings for the R8A77995 SoC
- Add DT bindings and driver support for the R8A77970 SoC

Note that the LVDS conversion depends on a patch series from Frank Rowand that
will make it upstream through Rob Herring's tree. Frank has provided a stable
branch based on v4.16-rc1 with the patches, and both Rob and I have merged it
into our trees. This should thus generate no conflict when reaching -next.

* 'drm/next/du' of git://linuxtv.org/pinchartl/media:
  dt-bindings: display: renesas: lvds: Document r8a77995 bindings
  dt-bindings: display: renesas: du: Document r8a77995 bindings
  drm: rcar-du: lvds: Add R8A77970 support
  drm: rcar-du: Add R8A77970 support
  dt-bindings: display: renesas: lvds: Document R8A77970 bindings
  dt-bindings: display: renesas: du: Document R8A77970 bindings
  drm: rcar-du: Convert LVDS encoder code to bridge driver
  drm: rcar-du: Fix legacy DT to create LVDS encoder nodes
  dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
  dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
  of: improve reporting invalid overlay target path
  of: convert unittest overlay devicetree source to sugar syntax
  of: Documentation: of_overlay_apply() replaced by of_overlay_fdt_apply()
  of: change overlay apply input data from unflattened to FDT
  x86: devicetree: fix config option around x86_flattree_get_config()

6 years agodrm/amdgpu:Always save uvd vcpu_bo in VM Mode
James Zhu [Tue, 6 Mar 2018 19:52:35 +0000 (14:52 -0500)]
drm/amdgpu:Always save uvd vcpu_bo in VM Mode

When UVD is in VM mode, there is not uvd handle exchanged,
uvd.handles are always 0. So vcpu_bo always need save,
Otherwise amdgpu driver will fail during suspend/resume.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105021
Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amdgpu:Correct max uvd handles
James Zhu [Tue, 6 Mar 2018 19:43:50 +0000 (14:43 -0500)]
drm/amdgpu:Correct max uvd handles

Max uvd handles should use adev->uvd.max_handles instead of
AMDGPU_MAX_UVD_HANDLES here.

Signed-off-by: James Zhu <James.Zhu@amd.com>
Reviewed-by: Leo Liu <leo.liu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amdgpu: replace iova debugfs file with iomem (v3)
Tom St Denis [Fri, 23 Feb 2018 14:46:23 +0000 (09:46 -0500)]
drm/amdgpu: replace iova debugfs file with iomem (v3)

This allows access to pages allocated through the driver with optional
IOMMU mapping.

v2: Fix number of bytes copied and add write method
v3: drop check for kmap return

Original-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: validate plane format on primary plane
Shirish S [Wed, 7 Mar 2018 07:06:11 +0000 (12:36 +0530)]
drm/amd/display: validate plane format on primary plane

In dce110, the plane configuration is such that plane 0
or the primary plane should be rendered with only RGB data.

This patch adds the validation to ensure that no video data
is rendered on plane 0.

Signed-off-by: Shirish S <shirish.s@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: Clean sdma wptr register when only enable wptr polling
Emily Deng [Wed, 7 Mar 2018 01:47:43 +0000 (09:47 +0800)]
drm/amdgpu: Clean sdma wptr register when only enable wptr polling

The sdma wptr polling memory is not fast enough, then the sdma
wptr register will be random, and not equal to sdma rptr, which
will cause sdma engine hang when load driver, so clean up the sdma
wptr directly to fix this issue.

v2:add comment above the code and correct coding style

Reviewed-by: Xiangliang Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Emily Deng <Emily.Deng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/amdgpu: re-add missing GC 9.1 and SDMA0 4.1 sh_mask header files
Tom St Denis [Tue, 6 Mar 2018 15:52:41 +0000 (10:52 -0500)]
drm/amd/amdgpu: re-add missing GC 9.1 and SDMA0 4.1 sh_mask header files

These are required by umr to properly parse bitfield offsets.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: give warning before sleep in kiq_r/wreg
Monk Liu [Mon, 5 Mar 2018 11:26:36 +0000 (19:26 +0800)]
drm/amdgpu: give warning before sleep in kiq_r/wreg

to catch error that may schedule in atomic context early on

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: further mitigate workaround for i915
Christian König [Tue, 20 Feb 2018 18:51:02 +0000 (19:51 +0100)]
drm/amdgpu: further mitigate workaround for i915

Disable the workaround on imported BOs as well.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: drop gtt->adev
Christian König [Wed, 28 Feb 2018 08:35:39 +0000 (09:35 +0100)]
drm/amdgpu: drop gtt->adev

We can use ttm->bdev instead.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: add amdgpu_evict_gtt debugfs entry
Christian König [Mon, 19 Feb 2018 13:47:55 +0000 (14:47 +0100)]
drm/amdgpu: add amdgpu_evict_gtt debugfs entry

Allow evicting all BOs from the GTT domain.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Add #ifdef checks for CONFIG_ACPI
Rex Zhu [Tue, 6 Mar 2018 06:42:24 +0000 (14:42 +0800)]
drm/amd/pp: Add #ifdef checks for CONFIG_ACPI

Fix compiling error when CONFIG_ACPI not enabled.

Change-Id: I5f901adbc799c10b30e5ea79f8f44760e749fae1
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
6 years agodrm/amd/pp: fix "Delete the wrapper layer of smu_allocate/free_memory"
Christian König [Tue, 6 Mar 2018 13:56:00 +0000 (14:56 +0100)]
drm/amd/pp: fix "Delete the wrapper layer of smu_allocate/free_memory"

For amdgpu_bo_create_kernel to work the handle must be NULL initialized,
otherwise we only try to pin and map the BO.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Rex Zhu <rezhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Drop wrapper functions for upper/lower_32_bits
Rex Zhu [Tue, 6 Mar 2018 05:31:13 +0000 (13:31 +0800)]
drm/amd/pp: Drop wrapper functions for upper/lower_32_bits

replace smu_upper_32_bits/smu_lower_32_bits with
the standard kernel macros

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: Delete cgs wrapper functions for gpu memory manager
Rex Zhu [Mon, 5 Mar 2018 10:36:47 +0000 (18:36 +0800)]
drm/amdgpu: Delete cgs wrapper functions for gpu memory manager

delete those cgs interfaces:
amdgpu_cgs_alloc_gpu_mem
amdgpu_cgs_free_gpu_mem
amdgpu_cgs_gmap_gpu_mem
amdgpu_cgs_gunmap_gpu_mem
amdgpu_cgs_kmap_gpu_mem
amdgpu_cgs_kunmap_gpu_mem

Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Delete the wrapper layer of smu_allocate/free_memory
Rex Zhu [Tue, 6 Mar 2018 05:13:21 +0000 (13:13 +0800)]
drm/amd/pp: Delete the wrapper layer of smu_allocate/free_memory

use amdgpu_bo_create/free_kernel instand.

Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Acked-by: Christian König <christian.koenig@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 cgs wrapper function for temperature update
Rex Zhu [Mon, 5 Mar 2018 08:07:22 +0000 (16:07 +0800)]
drm/amd/pp: Remove cgs wrapper function for temperature update

Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agoRevert "drm/amd/pp: Add a pp feature mask bit for AutoWattman feature"
Rex Zhu [Mon, 5 Mar 2018 06:42:56 +0000 (14:42 +0800)]
Revert "drm/amd/pp: Add a pp feature mask bit for AutoWattman feature"

This reverts commit e429ea87b2939c4cce1b439baf6d76535a0767f2.

Implement Workload Aware Dynamic power management instand of
AutoWattman feature in linux.

Reviewed-by: Alex Deucher <alexdeucher@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 auto power profilng switch based on workloads (v2)
Rex Zhu [Fri, 2 Mar 2018 12:09:11 +0000 (20:09 +0800)]
drm/amd/pp: Add auto power profilng switch based on workloads (v2)

Add power profiling mode dynamic switch based on the workloads.
Currently, support Cumpute, VR, Video, 3D,power saving with Cumpute
have highest prority, power saving have lowest prority.

in manual dpm mode, driver will stop auto switch, just save the client's
requests. user can set power profiling mode through sysfs.

when exit manual dpm mode, driver will response the client's requests.
switch based on the client's prority.

v2: squash in fixes from Rex

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodt-bindings: display: renesas: lvds: Document r8a77995 bindings
Kieran Bingham [Thu, 15 Feb 2018 08:38:18 +0000 (08:38 +0000)]
dt-bindings: display: renesas: lvds: Document r8a77995 bindings

The D3 (r8a77995) supports two LVDS channels. Extend the binding to
support them.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
[Fixed compatible string]
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
6 years agodt-bindings: display: renesas: du: Document r8a77995 bindings
Kieran Bingham [Thu, 15 Feb 2018 08:38:17 +0000 (08:38 +0000)]
dt-bindings: display: renesas: du: Document r8a77995 bindings

Document the D3 (r8a77995) SoC in the R-Car DU bindings.

Signed-off-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
6 years agodrm: rcar-du: lvds: Add R8A77970 support
Sergei Shtylyov [Thu, 1 Mar 2018 18:10:16 +0000 (21:10 +0300)]
drm: rcar-du: lvds: Add R8A77970 support

Add support for the R-Car V3M (R8A77970) SoC to the LVDS encoder driver.
Note that there are some differences with the other R-Car gen3 SoCs, e.g.
LVDPLLCR has the same layout as in the R-Car gen2 SoCs.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
6 years agodrm: rcar-du: Add R8A77970 support
Sergei Shtylyov [Thu, 18 Jan 2018 21:05:59 +0000 (00:05 +0300)]
drm: rcar-du: Add R8A77970 support

Add support for the R-Car V3M (R8A77970) SoC to the R-Car DU driver.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
6 years agodt-bindings: display: renesas: lvds: Document R8A77970 bindings
Sergei Shtylyov [Fri, 19 Jan 2018 18:29:20 +0000 (21:29 +0300)]
dt-bindings: display: renesas: lvds: Document R8A77970 bindings

Document the R-Car V3M (R8A77970) SoC in the R-Car LVDS bindings.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
6 years agodt-bindings: display: renesas: du: Document R8A77970 bindings
Sergei Shtylyov [Thu, 18 Jan 2018 21:05:58 +0000 (00:05 +0300)]
dt-bindings: display: renesas: du: Document R8A77970 bindings

Document the R-Car V3M (R8A77970) SoC in the R-Car DU bindings.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Acked-by: Rob Herring <robh@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
6 years agodrm: rcar-du: Convert LVDS encoder code to bridge driver
Laurent Pinchart [Wed, 10 Jan 2018 03:47:42 +0000 (05:47 +0200)]
drm: rcar-du: Convert LVDS encoder code to bridge driver

The LVDS encoders used to be described in DT as part of the DU. They now
have their own DT node, linked to the DU using the OF graph bindings.
This allows moving internal LVDS encoder support to a separate driver
modelled as a DRM bridge. Backward compatibility is retained as legacy
DT is patched live to move to the new bindings.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
6 years agodrm: rcar-du: Fix legacy DT to create LVDS encoder nodes
Laurent Pinchart [Wed, 10 Jan 2018 00:40:27 +0000 (02:40 +0200)]
drm: rcar-du: Fix legacy DT to create LVDS encoder nodes

The internal LVDS encoders now have their own DT bindings. Before
switching the driver infrastructure to those new bindings, implement
backward-compatibility through live DT patching.

Patching is disabled and will be enabled along with support for the new
DT bindings in the DU driver.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Frank Rowand <frank.rowand@sony.com>
6 years agodt-bindings: display: renesas: Deprecate LVDS support in the DU bindings
Laurent Pinchart [Wed, 10 Jan 2018 14:05:46 +0000 (16:05 +0200)]
dt-bindings: display: renesas: Deprecate LVDS support in the DU bindings

The internal LVDS encoders now have their own DT bindings, representing
them as part of the DU is deprecated.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
6 years agodt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings
Laurent Pinchart [Wed, 10 Jan 2018 14:05:46 +0000 (16:05 +0200)]
dt-bindings: display: renesas: Add R-Car LVDS encoder DT bindings

The Renesas R-Car Gen2 and Gen3 SoCs have internal LVDS encoders. Add
corresponding device tree bindings.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
6 years agoMerge tag 'overlay_apply_fdt_v7-for-4.17' of git://git.kernel.org/pub/scm/linux/kerne...
Laurent Pinchart [Sun, 4 Mar 2018 11:33:50 +0000 (13:33 +0200)]
Merge tag 'overlay_apply_fdt_v7-for-4.17' of git://git./linux/kernel/git/frowand/linux into drm/next/du

- DT overlay applying rework (Frank Rowand)

Move duplicating and unflattening of an overlay flattened devicetree
(FDT) into the overlay application code.  To accomplish this,
of_overlay_apply() is replaced by of_overlay_fdt_apply().

6 years agodrm/amd/pp: Revert gfx/compute profile switch sysfs
Rex Zhu [Sat, 24 Feb 2018 11:53:41 +0000 (19:53 +0800)]
drm/amd/pp: Revert gfx/compute profile switch sysfs

The gfx/compute profiling mode switch is only for internally
test. Not a complete solution and unexpectly upstream.
so revert it.

Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Christian König <christian.koenig@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 sclk in highest two levels when compute on smu7
Rex Zhu [Fri, 23 Feb 2018 09:41:07 +0000 (17:41 +0800)]
drm/amd/pp: Fix sclk in highest two levels when compute on smu7

Compute workload tends to be "bursty", Only tune the behavior of
nature dpm don't work well for most of such workloads. From test
results, Fix sclk in highest two levels can get better performance.
so add min sclk setting into the default cumpute workload policy on
smu7.

user still can change sclk range through sysfs pp_dpm_sclk
for better perf/watt.

Reviewed-by: Evan Quan <evan.quan@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: Implement get/set_power_profile_mode on smu7
Rex Zhu [Wed, 31 Jan 2018 06:48:14 +0000 (14:48 +0800)]
drm/amd/pp: Implement get/set_power_profile_mode on smu7

It show what parameters can be configured to tune
the behavior of natural dpm for perf/watt on smu7.

user can select the mode per workload, but even the default per
workload settings are not bulletproof.

user can configure custom settings per different use case
for better perf or better perf/watt.

cat pp_power_profile_mode
NUM        MODE_NAME     SCLK_UP_HYST   SCLK_DOWN_HYST SCLK_ACTIVE_LEVEL     MCLK_UP_HYST   MCLK_DOWN_HYST MCLK_ACTIVE_LEVEL
  0   3D_FULL_SCREEN:        0              100               30                0              100               10
  1     POWER_SAVING:       10                0               30                -                -                -
  2            VIDEO:        -                -                -               10               16               31
  3               VR:        0               11               50                0              100               10
  4          COMPUTE:        0                5               30                -                -                -
  5           CUSTOM:        0                0                0                0                0                0
  *          CURRENT:        0              100               30                0              100               10

Under manual dpm level,

user can echo "0/1/2/3/4">pp_power_profile_mode
to select 3D_FULL_SCREEN/POWER_SAVING/VIDEO/VR/COMPUTE
mode.

echo "5 * * * * * * * *">pp_power_profile_mode
to set custom settings.
"5 * * * * * * * *" mean "CUSTOM enable_sclk SCLK_UP_HYST
SCLK_DOWN_HYST SCLK_ACTIVE_LEVEL enable_mclk MCLK_UP_HYST
MCLK_DOWN_HYST MCLK_ACTIVE_LEVEL"

if the parameter enable_sclk/enable_mclk is true,
driver will update the following parameters to dpm table.
if false, ignore the following parameters.

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: Implement update_dpm_settings on CI
Rex Zhu [Fri, 23 Feb 2018 08:52:41 +0000 (16:52 +0800)]
drm/amd/pp: Implement update_dpm_settings on CI

use SW method to update DPM settings by updating SRAM
directly on CI.

Reviewed-by: Alex Deucher <alexdeucher@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: Implement update_dpm_settings on Tonga
Rex Zhu [Fri, 23 Feb 2018 08:41:20 +0000 (16:41 +0800)]
drm/amd/pp: Implement update_dpm_settings on Tonga

use SW method to update DPM settings by updating SRAM
directly on Tonga.

Reviewed-by: Alex Deucher <alexdeucher@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: Implement update_dpm_settings on Fiji
Rex Zhu [Fri, 23 Feb 2018 08:39:59 +0000 (16:39 +0800)]
drm/amd/pp: Implement update_dpm_settings on Fiji

use SW method to update DPM settings by updating SRAM
directly on Fiji.

Reviewed-by: Alex Deucher <alexdeucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: fix KV harvesting
Alex Deucher [Thu, 1 Mar 2018 16:05:31 +0000 (11:05 -0500)]
drm/amdgpu: fix KV harvesting

Always set the graphics values to the max for the
asic type.  E.g., some 1 RB chips are actually 1 RB chips,
others are actually harvested 2 RB chips.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99353
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/radeon: fix KV harvesting
Alex Deucher [Thu, 1 Mar 2018 16:03:27 +0000 (11:03 -0500)]
drm/radeon: fix KV harvesting

Always set the graphics values to the max for the
asic type.  E.g., some 1 RB chips are actually 1 RB chips,
others are actually harvested 2 RB chips.

Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=99353
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/pp: Implement update_dpm_settings on Polaris
Rex Zhu [Wed, 24 Jan 2018 09:15:37 +0000 (17:15 +0800)]
drm/amd/pp: Implement update_dpm_settings on Polaris

v2: lock dpm level when update pptable by SW method

use SW method to update DPM settings by updating SRAM
directly on 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: Add a helper to set field in u32
Rex Zhu [Fri, 23 Feb 2018 08:32:55 +0000 (16:32 +0800)]
drm/amd/pp: Add a helper to set field in u32

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 common interface in smu for update dpm setting
Rex Zhu [Wed, 24 Jan 2018 06:48:17 +0000 (14:48 +0800)]
drm/amd/pp: Add common interface in smu for update dpm setting

it is used for adjust part of dpm settigs per workloads
to change the natural dpm behavior for better perf or perf/watt.

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 PCC feature support on Vega
Rex Zhu [Fri, 2 Mar 2018 05:50:59 +0000 (13:50 +0800)]
drm/amd/pp: Add PCC feature support on Vega

This features controls vega peak current protection to allow
for a wider compatibility with power supplies.

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: Export new smu message for PCC feature on Vega10
Rex Zhu [Fri, 2 Mar 2018 02:52:25 +0000 (10:52 +0800)]
drm/amd/pp: Export new smu message for PCC feature on Vega10

used to set PccThrottleLevel and PccResidencyThreshold

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 cgs_query_system_info
Rex Zhu [Tue, 27 Feb 2018 11:15:08 +0000 (19:15 +0800)]
drm/amd/pp: Remove cgs_query_system_info

Get gpu info through adev directly in powerplay

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 the wrap functions for acpi in powerplay
Rex Zhu [Tue, 27 Feb 2018 10:28:54 +0000 (18:28 +0800)]
drm/amd/pp: Remove the wrap functions for acpi in powerplay

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: Use amdgpu acpi helper functions in powerplay
Rex Zhu [Tue, 27 Feb 2018 10:27:54 +0000 (18:27 +0800)]
drm/amd/pp: Use amdgpu acpi helper functions in powerplay

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: Notify sbios device ready before send request
Rex Zhu [Tue, 27 Feb 2018 10:20:53 +0000 (18:20 +0800)]
drm/amdgpu: Notify sbios device ready before send request

it is required if a platform supports PCIe root complex
core voltage reduction. After receiving this notification,
SBIOS can apply default PCIe root complex power policy.

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: Refine powerplay instance
Rex Zhu [Tue, 27 Feb 2018 06:09:40 +0000 (14:09 +0800)]
drm/amd/pp: Refine powerplay instance

Include adev in powerplay instance.
so can visit adev directly instand of through cgs interface.

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: Simplify the create of powerplay instance
Rex Zhu [Mon, 26 Feb 2018 11:58:49 +0000 (19:58 +0800)]
drm/amd/pp: Simplify the create of powerplay instance

use adev as input parameter to create powerplay instance
directly. delete cgs wrap layer for power play create.

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/dc: Use forward declaration instand of include header file
Rex Zhu [Mon, 26 Feb 2018 11:47:54 +0000 (19:47 +0800)]
drm/amd/dc: Use forward declaration instand of include header file

avoid build error:

drivers/gpu/drm/amd/amdgpu/../powerplay/inc/smu9_driver_if.h:342:3: error: redeclaration of enumerator ‘WM_COUNT’
   WM_COUNT,
   ^
In file included from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services_types.h:32:0,
                 from drivers/gpu/drm/amd/amdgpu/../display/dc/dm_services.h:35,
                 from drivers/gpu/drm/amd/amdgpu/../display/modules/inc/mod_freesync.h:57,
                 from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu_mode.h:48,
                 from drivers/gpu/drm/amd/amdgpu/../amdgpu/amdgpu.h:55,
                 from drivers/gpu/drm/amd/amdgpu/../powerplay/inc/amd_powerplay.h:33,
                 from drivers/gpu/drm/amd/amdgpu/../powerplay/inc/smumgr.h:26,
                 from drivers/gpu/drm/amd/amdgpu/../powerplay/smumgr/vega10_smumgr.c:24:
drivers/gpu/drm/amd/amdgpu/../display/dc/dm_pp_smu.h:43:2: note: previous definition of ‘WM_COUNT’ was here
  WM_COUNT,

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/display: disable CRTCs with NULL FB on their primary plane (V2)
Shirish S [Wed, 28 Feb 2018 06:44:58 +0000 (12:14 +0530)]
drm/amd/display: disable CRTCs with NULL FB on their primary plane (V2)

The below commit

"drm/atomic: Try to preserve the crtc enabled state in drm_atomic_remove_fb, v2"

introduces a slight behavioral change to rmfb. Instead of disabling a crtc
when the primary plane is disabled, it now preserves it.

This change leads to BUG hit while performing atomic commit on amd driver.

As a fix this patch ensures that we disable the CRTC's with NULL FB by returning
-EINVAL and hence triggering fall back to the old behavior and turning off the
crtc in atomic_remove_fb().

V2: Added error check for plane_state and removed sanity check for crtc.

Signed-off-by: Shirish S <shirish.s@amd.com>
Signed-off-by: Pratik Vishwakarma <Pratik.Vishwakarma@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/pp: Fix incorrect return value in smu7_check_clk_voltage_valid
Rex Zhu [Fri, 2 Mar 2018 10:41:41 +0000 (18:41 +0800)]
drm/amd/pp: Fix incorrect return value in smu7_check_clk_voltage_valid

Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu/dce6: Use DRM_DEBUG instead of DRM_INFO for HPD IRQ info
Michel Dänzer [Fri, 23 Feb 2018 11:29:04 +0000 (12:29 +0100)]
drm/amdgpu/dce6: Use DRM_DEBUG instead of DRM_INFO for HPD IRQ info

For consistency with other DCE generations.

HPD IRQs appear to be working fine.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: use separate status for buffer funcs availability v2
Christian König [Thu, 1 Mar 2018 10:09:15 +0000 (11:09 +0100)]
drm/amdgpu: use separate status for buffer funcs availability v2

The ring status can change during GPU reset, but we still need to be
able to schedule TTM buffer moves in the meantime.

Otherwise we can ran into problems because of aborted move/fill
operations during GPU resets.

v2: still check if ring is available during direct submit.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: ignore changes of buffer function status because of GPU resets
Christian König [Thu, 1 Mar 2018 10:03:27 +0000 (11:03 +0100)]
drm/amdgpu: ignore changes of buffer function status because of GPU resets

When we reset the GPU we also disable/enable the SDMA, but we don't want
to change TTM idea of the VRAM size in the middle of that.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: change amdgpu_ttm_set_active_vram_size
Christian König [Thu, 1 Mar 2018 10:01:52 +0000 (11:01 +0100)]
drm/amdgpu: change amdgpu_ttm_set_active_vram_size

Instead of setting the active VRAM size directly provide a the info if
we can use the buffer functions or not.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Chunming zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amdgpu: move some functions into amdgpu_ttm.h
Christian König [Thu, 1 Mar 2018 09:41:46 +0000 (10:41 +0100)]
drm/amdgpu: move some functions into amdgpu_ttm.h

Those belong to the TTM handling.

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/amd/display: Default HDMI6G support to true. Log VBIOS table error.
Harry Wentland [Tue, 20 Feb 2018 18:36:23 +0000 (13:36 -0500)]
drm/amd/display: Default HDMI6G support to true. Log VBIOS table error.

There have been many reports of Ellesmere and Baffin systems not being
able to drive HDMI 4k60 due to the fact that we check the HDMI_6GB_EN
bit from VBIOS table. Windows seems to not have this issue.

On some systems we fail to the encoder cap info from VBIOS. In that case
we should default to enabling HDMI6G support.

This was tested by dwagner on
https://bugs.freedesktop.org/show_bug.cgi?id=102820

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
6 years agodrm/amd/display: update plane params before validation
Shirish S [Tue, 13 Feb 2018 08:45:17 +0000 (14:15 +0530)]
drm/amd/display: update plane params before validation

This patch updates the dc's plane state with the parameters set by the
user side.
This is needed to validate the plane capabilities with the parameters
user space wants to set.

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/amd/display: Don't blow up if TG is NULL in dce110_vblank_set
Harry Wentland [Tue, 13 Feb 2018 16:07:43 +0000 (11:07 -0500)]
drm/amd/display: Don't blow up if TG is NULL in dce110_vblank_set

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: validate plane in dce110 for scaling
Shirish S [Tue, 13 Feb 2018 08:41:37 +0000 (14:11 +0530)]
drm/amd/display: validate plane in dce110 for scaling

CZ & ST support uptil a limit 2:1 downscaling, this patch
adds validate_plane hook, that shall be used to validate
the plane attributes sent by the user space based
on dce110 capabilities.

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/amd/display: defer modeset check in dm_update_planes_state
Shirish S [Fri, 16 Feb 2018 06:14:22 +0000 (11:44 +0530)]
drm/amd/display: defer modeset check in dm_update_planes_state

amdgpu_dm_atomic_check() is used to validate the entire configuration of
planes and crtc's that the user space wants to commit.

However amdgpu_dm_atomic_check() depends upon DRM_MODE_ATOMIC_ALLOW_MODESET
flag else its mostly dummy.
Its not mandatory for the user space to set DRM_MODE_ATOMIC_ALLOW_MODESET,
and in general its not set either along with DRM_MODE_ATOMIC_TEST_ONLY.

Considering its importantance, this patch defers the allow_modeset check
in dm_update_planes_state(), so that there shall be scope to validate
the configuration sent from user space, without impacting the population
of dc/dm related data structures.

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/amd/display: Clean up formatting in irq_service_dce110.c
Harry Wentland [Tue, 13 Feb 2018 16:07:07 +0000 (11:07 -0500)]
drm/amd/display: Clean up formatting in irq_service_dce110.c

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Return success when enabling interrupt
Harry Wentland [Tue, 13 Feb 2018 16:03:01 +0000 (11:03 -0500)]
drm/amd/display: Return success when enabling interrupt

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@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 crtc enable/disable_vblank hooks
Harry Wentland [Tue, 13 Feb 2018 15:54:26 +0000 (10:54 -0500)]
drm/amd/display: Use crtc enable/disable_vblank hooks

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: dal 3.1.37
Tony Cheng [Wed, 21 Feb 2018 21:40:50 +0000 (16:40 -0500)]
drm/amd/display: dal 3.1.37

Signed-off-by: Tony Cheng <tony.cheng@amd.com>
Reviewed-by: Tony Cheng <Tony.Cheng@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
6 years agodrm/amd/display: Remove duplicate dm_pp_power_level enum
Harry Wentland [Fri, 9 Feb 2018 21:52:15 +0000 (16:52 -0500)]
drm/amd/display: Remove duplicate dm_pp_power_level enum

This is really just a copy of dm_pp_clocks_state, so just use that one.

Thanks to Matthias Kaehlke for spotting this.

Signed-off-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Roman Li <Roman.Li@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 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>