openwrt/staging/blogic.git
7 years agodrm/amdgpu/sriov:fix memory leak after gpu reset
Monk Liu [Fri, 15 Sep 2017 06:35:09 +0000 (14:35 +0800)]
drm/amdgpu/sriov:fix memory leak after gpu reset

GPU reset will require all hw doing hw_init thus
ucode_init_bo will be invoked again, which lead to
memory leak

skip the fw_buf allocation during sriov gpu reset to avoid
memory leak.

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>
7 years agodrm/amdgpu:make ctx_add_fence interruptible(v2)
Monk Liu [Fri, 15 Sep 2017 05:40:31 +0000 (13:40 +0800)]
drm/amdgpu:make ctx_add_fence interruptible(v2)

otherwise a gpu hang will make application couldn't be killed
under timedout=0 mode

v2:
Fix memoryleak job/job->s_fence issue
unlock mn
remove the ERROR msg after waiting being interrupted

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>
7 years agodrm/amdgpu/sriov:init csb for gfxv9
Monk Liu [Fri, 15 Sep 2017 08:58:08 +0000 (16:58 +0800)]
drm/amdgpu/sriov:init csb for gfxv9

RLC need CSB registers initiated under SRIOV during world switch
otherwise the clear state buffer behav will not be recovered to
current VF scheme after switch back

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/sriov:increate mailbox polling timeout
Horace Chen [Wed, 28 Jun 2017 09:51:50 +0000 (17:51 +0800)]
drm/amdgpu/sriov:increate mailbox polling timeout

increase timeout to 12 seconds,because there may have multiple
FLR waiting for done, the waiting time of events may be long,
increase to 12s to reduce timeout failure.

Signed-off-by: Horace Chen <horace.chen@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/sriov:fix page fault issue of driver unload
Monk Liu [Fri, 15 Sep 2017 07:34:52 +0000 (15:34 +0800)]
drm/amdgpu/sriov:fix page fault issue of driver unload

bo_free on csa is too late to put in amdgpu_fini because that
time ttm is already finished,
Move it earlier to avoid the page fault.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Signed-off-by: Horace Chen <horace.chen@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:use formal register to trigger hdp invalidate
Monk Liu [Tue, 4 Jul 2017 07:43:38 +0000 (15:43 +0800)]
drm/amdgpu:use formal register to trigger hdp invalidate

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>
7 years agodrm/amdgpu:hdp flush should be put it initialized
Monk Liu [Fri, 15 Sep 2017 07:03:24 +0000 (15:03 +0800)]
drm/amdgpu:hdp flush should be put it initialized

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu:insert TMZ_BEGIN
Monk Liu [Fri, 9 Jun 2017 07:04:49 +0000 (15:04 +0800)]
drm/amdgpu:insert TMZ_BEGIN

FRAME_CONTROL(begin) is needed for vega10 due to ucode logic change,
it can fix some CTS random fail under gfx preemption enabled mode.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/sriov:don't load psp fw during gpu reset
Monk Liu [Fri, 15 Sep 2017 10:42:12 +0000 (18:42 +0800)]
drm/amdgpu/sriov:don't load psp fw during gpu reset

At least for SRIOV we found reload PSP fw during
gpu reset cause PSP hang.

Signed-off-by: Monk Liu <Monk.Liu@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/sriov:move in_reset to adev and rename
Monk Liu [Fri, 15 Sep 2017 10:57:12 +0000 (18:57 +0800)]
drm/amdgpu/sriov:move in_reset to adev and rename

currently in_reset is only used in sriov gpu reset, and it
will be used for other non-gfx hw component later, like
PSP, so move it from gfx to adev and rename to in_sriov_reset
make more sense.

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>
7 years agodrm/amdgpu:no kiq in IH
Monk Liu [Thu, 14 Sep 2017 11:45:33 +0000 (19:45 +0800)]
drm/amdgpu:no kiq in IH

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>
7 years agodrm/amdgpu/sriov:fix missing error handling
Monk Liu [Tue, 12 Sep 2017 06:33:29 +0000 (14:33 +0800)]
drm/amdgpu/sriov:fix missing error handling

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>
7 years agodrm/amdgpu: Add GPU reset functionality for Vega10
Ken Wang [Thu, 14 Sep 2017 08:25:19 +0000 (16:25 +0800)]
drm/amdgpu: Add GPU reset functionality for Vega10

V2

Signed-off-by: Ken Wang <Ken.Wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: Remove TTM dma tracepoint since it's not required anymore
Tom St Denis [Mon, 18 Sep 2017 12:13:28 +0000 (08:13 -0400)]
drm/ttm: Remove TTM dma tracepoint since it's not required anymore

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: remove usage of ttm trace
Tom St Denis [Mon, 18 Sep 2017 12:10:00 +0000 (08:10 -0400)]
drm/amd/amdgpu: remove usage of ttm trace

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v5)
Tom St Denis [Mon, 18 Sep 2017 11:28:14 +0000 (07:28 -0400)]
drm/amd/amdgpu: add support for iova_to_phys to replace TTM trace (v5)

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(v2): Add domain to iova debugfs
(v3): Add true read/write methods to access system memory of pages
      mapped to the device
(v4): Move get_domain call out of loop and return on error
(v5): Just use kmap/kunmap

7 years agodrm/amd/amdgpu: Fold TTM debugfs entries into array (v2)
Tom St Denis [Mon, 18 Sep 2017 11:14:56 +0000 (07:14 -0400)]
drm/amd/amdgpu: Fold TTM debugfs entries into array (v2)

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(v2): add domains and avoid strcmp

7 years agodrm/amdgpu: fix checkpatch.pl warning to amdgpu_drv.c
Rex Zhu [Tue, 19 Sep 2017 06:36:08 +0000 (14:36 +0800)]
drm/amdgpu: fix checkpatch.pl warning to amdgpu_drv.c

fix checkpatch.pl WARNING:
Prefer 'unsigned int' to bare use of 'unsigned'

Reviewed-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>
7 years agodrm/amdgpu: remove the clearance of vce 4.0 interrupt mask
Leo Liu [Fri, 3 Mar 2017 16:54:37 +0000 (11:54 -0500)]
drm/amdgpu: remove the clearance of vce 4.0 interrupt mask

Requested by SRIOV, the clearance of the bit moved into firmware

Signed-off-by: Leo Liu <leo.liu@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/sdma3: set wptr shadow atomically
Xiangliang.Yu [Wed, 13 Sep 2017 02:58:19 +0000 (10:58 +0800)]
drm/amdgpu/sdma3: set wptr shadow atomically

Port it from sdma4 for wptr polling usage.

Signed-off-by: Xiangliang.Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/sdma3: Enable sdma wptr polling for SRIOV
Xiangliang.Yu [Tue, 12 Sep 2017 09:31:46 +0000 (17:31 +0800)]
drm/amdgpu/sdma3: Enable sdma wptr polling for SRIOV

When hypervisor triggering FLR for one of VFs, need to enable sdma
wptr polling to avoid missing wptr update if enabling doorbell.

Signed-off-by: Xiangliang.Yu <Xiangliang.Yu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: cleanup ttm_page_alloc_dma.c
Christian König [Mon, 3 Jul 2017 17:49:55 +0000 (19:49 +0200)]
drm/ttm: cleanup ttm_page_alloc_dma.c

Remove unused defines and variables. Also stop computing the
gfp_flags when they aren't used.

No intended 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>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Track pending retry faults in IH and VM (v2)
Felix Kuehling [Sat, 26 Aug 2017 06:43:06 +0000 (02:43 -0400)]
drm/amdgpu: Track pending retry faults in IH and VM (v2)

IH tracks pending retry faults in a hash table for fast lookup in
interrupt context. Each VM has a short FIFO of pending VM faults for
processing in a bottom half.

The IH prescreening stage adds retry faults and filters out repeated
retry interrupts to minimize the impact of interrupt storms.

It's the VM's responsibility remove pending faults once they are
handled. For now this is only done when the VM is destroyed.

v2:
- Made the hash table smaller and the FIFO longer. I never want the
  FIFO to fill up, because that would make prescreen take longer.
  128 pending page faults should be enough to keep migrations busy.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Christian König <christian.koenig@amd.com> (v1)
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd: Closed hash table with low overhead (v2)
Felix Kuehling [Thu, 24 Aug 2017 23:22:32 +0000 (19:22 -0400)]
drm/amd: Closed hash table with low overhead (v2)

This adds a statically sized closed hash table implementation with
low memory and CPU overhead. The API is inspired by kfifo.

Storing, retrieving and deleting data does not involve any dynamic
memory management, which makes it ideal for use in interrupt context.
Static memory usage per entry comprises a 32 or 64 bit hash key, two
bits for occupancy tracking and the value size stored in the table.
No list heads or pointers are needed. Therefore this data structure
should be quite cache-friendly, too.

It uses linear probing and lazy deletion. During lookups free space
is reclaimed and entries relocated to speed up future lookups.

v2: squash in do_div and _BITOPS_LONG_SHIFT fixes

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-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>
7 years agodrm/amdgpu: Add prescreening stage in IH processing (v2)
Felix Kuehling [Sat, 26 Aug 2017 06:40:45 +0000 (02:40 -0400)]
drm/amdgpu: Add prescreening stage in IH processing (v2)

To filter out high-frequency interrupts that can be safely ignored.

v2: squash in trivial typo fix for si (Alex)

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdkfd: Use PASID manager from KGD
Felix Kuehling [Sat, 26 Aug 2017 06:10:12 +0000 (02:10 -0400)]
drm/amdkfd: Use PASID manager from KGD

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdkfd: Separate doorbell allocation from PASID
Felix Kuehling [Sat, 26 Aug 2017 06:00:57 +0000 (02:00 -0400)]
drm/amdkfd: Separate doorbell allocation from PASID

PASID management is moving into KGD. Limiting the PASID range to the
number of doorbell pages is no longer practical.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: Add PASID manager for KFD
Felix Kuehling [Sat, 26 Aug 2017 01:30:18 +0000 (21:30 -0400)]
drm/radeon: Add PASID manager for KFD

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Add PASID management
Felix Kuehling [Sat, 26 Aug 2017 00:40:26 +0000 (20:40 -0400)]
drm/amdgpu: Add PASID management

Allows assigning a PASID to a VM for identifying VMs involved in page
faults. The global PASID manager is also exported in the KFD
interface so that AMDGPU and KFD can share the PASID space.

PASIDs of different sizes can be requested. On APUs, the PASID size
is deterined by the capabilities of the IOMMU. So KFD must be able
to allocate PASIDs in a smaller range.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Oded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: Fix error handling in amdgpu_vm_init
Felix Kuehling [Sat, 26 Aug 2017 00:15:04 +0000 (20:15 -0400)]
drm/amdgpu: Fix error handling in amdgpu_vm_init

Make sure vm->root.bo is not left reserved if amdgpu_bo_kmap fails.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Simplify smu7_voting_clients()
Rex Zhu [Fri, 15 Sep 2017 08:30:52 +0000 (16:30 +0800)]
drm/amd/powerplay: Simplify smu7_voting_clients()

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add powerplay support for CI asics
Rex Zhu [Tue, 12 Sep 2017 05:37:40 +0000 (13:37 +0800)]
drm/amdgpu: add powerplay support for CI asics

currently, for CI asics,
use dpm by default, amdgpu.dpm=-1.
when set amdgpu.dpm=1, enable powplay.
when set amdgpu.dpm=0, disable both dpm and powerplay.

when powerplay is stable on CI asics, ci_dpm will
be removed.

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>
7 years agodrm/amd/powerplay: Add support for CI asics to hwmgr
Rex Zhu [Thu, 14 Sep 2017 13:05:18 +0000 (21:05 +0800)]
drm/amd/powerplay: Add support for CI asics to hwmgr

Add support for CI asics (Bonaire, Hawaii) to
the powerplay hwmgr

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>
7 years agodrm/amd/powerplay: Add support functions for CI to ppatomctrl.c
Rex Zhu [Thu, 14 Sep 2017 13:14:59 +0000 (21:14 +0800)]
drm/amd/powerplay: Add support functions for CI to ppatomctrl.c

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: refine dmesg info under powerplay
Rex Zhu [Fri, 15 Sep 2017 03:09:20 +0000 (11:09 +0800)]
drm/amd/powerplay: refine dmesg info under powerplay

Use pr_debug to prevent spamming unimportant dmesg.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: fix set target TDP error on tonga/iceland
Rex Zhu [Thu, 14 Sep 2017 01:10:41 +0000 (09:10 +0800)]
drm/amd/powerplay: fix set target TDP error on tonga/iceland

ConfigurableTDP do not exist from Fiji.
so only use in previous ASIC.

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>
7 years agodrm/amd/powerplay: add CI asics support to smumgr (v3)
Rex Zhu [Fri, 8 Sep 2017 11:34:33 +0000 (19:34 +0800)]
drm/amd/powerplay: add CI asics support to smumgr (v3)

This ports support for CI asics (Bonaire, Hawaii)
to the powerplay smumgr

v2: warning fix (Alex)
v3: squash in fix for thermal (Tom)

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>
7 years agodrm/amd/powerplay: fix pcie max lane define error
Rex Zhu [Tue, 12 Sep 2017 05:18:13 +0000 (13:18 +0800)]
drm/amd/powerplay: fix pcie max lane define error

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: fix spelling typo in function name
Rex Zhu [Fri, 8 Sep 2017 06:31:26 +0000 (14:31 +0800)]
drm/amd/powerplay: fix spelling typo in function name

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: add support for request SI/CI firmware in CGS
Rex Zhu [Fri, 8 Sep 2017 06:05:51 +0000 (14:05 +0800)]
drm/amdgpu: add support for request SI/CI firmware in CGS

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>
7 years agodrm/amdgpu: unify the interface of amd_pm_funcs
Rex Zhu [Wed, 6 Sep 2017 10:43:52 +0000 (18:43 +0800)]
drm/amdgpu: unify the interface of amd_pm_funcs

put amd_pm_funcs table in struct powerplay for all
asics.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: use struct amd_pm_funcs in powerplay
Rex Zhu [Wed, 6 Sep 2017 08:08:03 +0000 (16:08 +0800)]
drm/amd/powerplay: use struct amd_pm_funcs 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>
7 years agodrm/amdgpu: rename amdgpu_dpm_funcs to amd_pm_funcs
Rex Zhu [Wed, 6 Sep 2017 07:27:59 +0000 (15:27 +0800)]
drm/amdgpu: rename amdgpu_dpm_funcs to amd_pm_funcs

renamed amdgpu_dpm_funcs and moved to amd_shared.h
so can shared with 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>
7 years agodrm/amd/powerplay: delete dead code in powerplay
Rex Zhu [Mon, 4 Sep 2017 10:22:02 +0000 (18:22 +0800)]
drm/amd/powerplay: delete dead code in powerplay

delete functiontable related codes

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>
7 years agodrm/amd/powerplay: refine powerplay code for RV
Rex Zhu [Mon, 4 Sep 2017 10:11:52 +0000 (18:11 +0800)]
drm/amd/powerplay: refine powerplay code for RV

use function points instand of function table.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: refine powerplay code for CZ/ST
Rex Zhu [Mon, 4 Sep 2017 09:51:28 +0000 (17:51 +0800)]
drm/amd/powerplay: refine powerplay code for CZ/ST

1. add function points instand of creat function tables
2. implement stop dpm tasks for CZ/ST

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>
7 years agodrm/amd/powerplay: refine code for thermal control in powerplay
Rex Zhu [Mon, 4 Sep 2017 08:25:48 +0000 (16:25 +0800)]
drm/amd/powerplay: refine code for thermal control in powerplay

add function point start_thermal_controller in hwmgr,
delete thermal function table and related functions

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Support VM environments in amdgpu_ttm_access_memory()
Tom St Denis [Thu, 14 Sep 2017 12:57:26 +0000 (08:57 -0400)]
drm/amd/amdgpu: Support VM environments in amdgpu_ttm_access_memory()

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>
7 years agodrm/radeon: properly initialize r600_audio_status() data
Arnd Bergmann [Fri, 15 Sep 2017 20:06:58 +0000 (22:06 +0200)]
drm/radeon: properly initialize r600_audio_status() data

The structure returned from r600_audio_status() is only partially
initialized, and older gcc versions (4.3 and 4.4) warn about this:

drivers/gpu/drm/radeon/r600_hdmi.c: In function 'r600_audio_status':
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.id' is used uninitialized in this function
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.connected' is used uninitialized in this function
drivers/gpu/drm/radeon/r600_hdmi.c:108: error: 'status.offset' is used uninitialized in this function

This is harmless and surprisingly correct in C99, as the caller
only accesses the fields that got initialized, so newer compilers
don't warn about it, but initializing the entire structure feels
like the right thing to do here and avoids the warning.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/psp: declare raven psp firmware
Alex Deucher [Fri, 15 Sep 2017 21:36:19 +0000 (17:36 -0400)]
drm/amdgpu/psp: declare raven psp firmware

So it gets picked up properly by the kernel.

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrivers:gpu:Use ARRAY_SIZE() for the size calculation of the array.
Allen Pais [Wed, 13 Sep 2017 08:01:09 +0000 (13:31 +0530)]
drivers:gpu:Use ARRAY_SIZE() for the size calculation of the array.

Signed-off-by: Allen Pais <allen.lkml@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/amdgpu: Change vram debugfs to NO_KIQ for VM environments
Tom St Denis [Wed, 13 Sep 2017 16:35:15 +0000 (12:35 -0400)]
drm/amd/amdgpu: Change vram debugfs to NO_KIQ for VM environments

Reviewed-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>
7 years agodrm/ttm: fix memory leak while individualizing BOs
Christian König [Wed, 13 Sep 2017 08:43:09 +0000 (10:43 +0200)]
drm/ttm: fix memory leak while individualizing BOs

We need to free the reservation object before we take the BO
from the delayed delete list.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Monk Liu <monk.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix and cleanup amdgpu_bo_create v2
Christian König [Tue, 12 Sep 2017 08:56:17 +0000 (10:56 +0200)]
drm/amdgpu: fix and cleanup amdgpu_bo_create v2

We adjusted the BO flags for USWC handling, but those never took effect
because the placement was passed in instead of generated inside this
function.

v2: better commit message

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>
7 years agodrm/amd: remove min/max addr handling from cgs
Christian König [Mon, 11 Sep 2017 15:10:26 +0000 (17:10 +0200)]
drm/amd: remove min/max addr handling from cgs

Nobody is actually using this and it causes a bunch of unused and buggy code.

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>
7 years agodrm/amdgpu: fix cgs alignment handling
Christian König [Mon, 11 Sep 2017 13:51:30 +0000 (15:51 +0200)]
drm/amdgpu: fix cgs alignment handling

This always allocated on PAGE_SIZE alignment.

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>
7 years agoradeon: Only destroy fbdev framebuffer if it was initialized
Michel Dänzer [Mon, 11 Sep 2017 08:09:17 +0000 (17:09 +0900)]
radeon: Only destroy fbdev framebuffer if it was initialized

Fixes crash when trying to unload the radeon module before the fbdev
framebuffer was initialized, which can happen since the DRM fbdev helper
code supports deferred setup.

Acked-by: Christian König <christian.koenig@amd.com>
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>
7 years agoamdgpu: Only destroy fbdev framebuffer if it was initialized
Michel Dänzer [Mon, 11 Sep 2017 08:04:41 +0000 (17:04 +0900)]
amdgpu: Only destroy fbdev framebuffer if it was initialized

Fixes crash when trying to unload the amdgpu module before the fbdev
framebuffer was initialized, which can happen since the DRM fbdev helper
code supports deferred setup.

Acked-by: Christian König <christian.koenig@amd.com>
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>
7 years agodrm/amd/powerplay: lock grbm_gfx index when changing instance
Tom St Denis [Tue, 12 Sep 2017 16:29:06 +0000 (12:29 -0400)]
drm/amd/powerplay: lock grbm_gfx index when changing instance

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>
7 years agodrm/amd/powerplay: Tidy up smu7_enable_didt()
Tom St Denis [Tue, 12 Sep 2017 14:05:48 +0000 (10:05 -0400)]
drm/amd/powerplay: Tidy up smu7_enable_didt()

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>
7 years agodrm/amd/powerplay: Make use of PP_CAP in smu7_powertune.c
Tom St Denis [Tue, 12 Sep 2017 14:01:34 +0000 (10:01 -0400)]
drm/amd/powerplay: Make use of PP_CAP in smu7_powertune.c

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>
7 years agodrm/amd/powerplay: Remove unneeded return from pp_smu7_thermal_fini()
Tom St Denis [Tue, 12 Sep 2017 13:56:45 +0000 (09:56 -0400)]
drm/amd/powerplay: Remove unneeded return from pp_smu7_thermal_fini()

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>
7 years agodrm/amd/powerplay: Make use of PP_CAP in smu7_thermal.c
Tom St Denis [Tue, 12 Sep 2017 13:53:25 +0000 (09:53 -0400)]
drm/amd/powerplay: Make use of PP_CAP in smu7_thermal.c

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>
7 years agodrm/amd/powerplay: Tidy up smu7_fan_ctrl_get_fan_speed_rpm()
Tom St Denis [Tue, 12 Sep 2017 13:51:36 +0000 (09:51 -0400)]
drm/amd/powerplay: Tidy up smu7_fan_ctrl_get_fan_speed_rpm()

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>
7 years agodrm/amd/powerplay: Tidy up smu7_fan_ctrl_get_fan_speed_info()
Tom St Denis [Tue, 12 Sep 2017 13:46:40 +0000 (09:46 -0400)]
drm/amd/powerplay: Tidy up smu7_fan_ctrl_get_fan_speed_info()

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>
7 years agodrm/amdgpu: fix amdgpu_vm_handle_moved as well v2
Christian König [Mon, 11 Sep 2017 14:54:59 +0000 (16:54 +0200)]
drm/amdgpu: fix amdgpu_vm_handle_moved as well v2

There is no guarantee that the last BO_VA actually needed an update.

Additional to that all command submissions must wait for moved BOs to
be cleared, not just the first one.

v2: Don't overwrite any newer fence.

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>
7 years agodrm/amd/powerplay: remove unnecessary call to memset
Himanshu Jha [Mon, 11 Sep 2017 12:37:26 +0000 (18:07 +0530)]
drm/amd/powerplay: remove unnecessary call to memset

call to memset to assign 0 value immediately after allocating
memory with kzalloc is unnecesaary as kzalloc allocates the memory
filled with 0 value.

Semantic patch used to resolve this issue:

@@
expression e,e2; constant c;
statement S;
@@

  e = kzalloc(e2, c);
  if(e == NULL) S
- memset(e, 0, e2);

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu/gfx9: properly set the hdp flush reg for Raven
Alex Deucher [Sat, 2 Sep 2017 06:16:35 +0000 (02:16 -0400)]
drm/amdgpu/gfx9: properly set the hdp flush reg for Raven

Was only being assigned for vega10.

Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_thermal_initialize()
Tom St Denis [Fri, 8 Sep 2017 13:45:34 +0000 (09:45 -0400)]
drm/amd/powerplay: Tidy up vega10_thermal_initialize()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_thermal_set_temperature_range()
Tom St Denis [Thu, 7 Sep 2017 17:08:28 +0000 (13:08 -0400)]
drm/amd/powerplay: Tidy up vega10_thermal_set_temperature_range()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_fan_ctrl_set_fan_speed_rpm()
Tom St Denis [Thu, 7 Sep 2017 16:59:32 +0000 (12:59 -0400)]
drm/amd/powerplay: Tidy up vega10_fan_ctrl_set_fan_speed_rpm()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Fix indentation in vega10_fan_ctrl_reset_fan_speed_to_default()
Tom St Denis [Thu, 7 Sep 2017 16:42:38 +0000 (12:42 -0400)]
drm/amd/powerplay: Fix indentation in vega10_fan_ctrl_reset_fan_speed_to_default()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_fan_ctrl_set_fan_speed_percent()
Tom St Denis [Thu, 7 Sep 2017 16:41:51 +0000 (12:41 -0400)]
drm/amd/powerplay: Tidy up vega10_fan_ctrl_set_fan_speed_percent()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_fan_ctrl_set_default_mode()
Tom St Denis [Thu, 7 Sep 2017 16:26:42 +0000 (12:26 -0400)]
drm/amd/powerplay: Tidy up vega10_fan_ctrl_set_default_mode()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_fan_ctrl_set_static_mode()
Tom St Denis [Thu, 7 Sep 2017 16:20:48 +0000 (12:20 -0400)]
drm/amd/powerplay: Tidy up vega10_fan_ctrl_set_static_mode()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Tidy up vega10_fan_ctrl_get_fan_speed_rpm()
Tom St Denis [Thu, 7 Sep 2017 14:36:40 +0000 (10:36 -0400)]
drm/amd/powerplay: Tidy up vega10_fan_ctrl_get_fan_speed_rpm()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Port vega10_thermal.c over to PP_CAP
Tom St Denis [Thu, 7 Sep 2017 11:48:16 +0000 (07:48 -0400)]
drm/amd/powerplay: Port vega10_thermal.c over to PP_CAP

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Port vega10_powertune.c over to PP_CAP
Tom St Denis [Thu, 7 Sep 2017 11:46:40 +0000 (07:46 -0400)]
drm/amd/powerplay: Port vega10_powertune.c over to PP_CAP

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Port vega10_hwmgr.c over to PP_CAP
Tom St Denis [Thu, 7 Sep 2017 11:44:17 +0000 (07:44 -0400)]
drm/amd/powerplay: Port vega10_hwmgr.c over to PP_CAP

Replace and cleanup lengthy phm_cap_enabled() sequences
with PP_CAP.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Add PP_CAP() macro
Tom St Denis [Thu, 7 Sep 2017 11:43:33 +0000 (07:43 -0400)]
drm/amd/powerplay: Add PP_CAP() macro

To replace common lengthy sequence that would create
really long lines all over.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Port vega10_didt_set_mask() to new macros
Tom St Denis [Wed, 6 Sep 2017 12:04:41 +0000 (08:04 -0400)]
drm/amd/powerplay: Port vega10_didt_set_mask() to new macros

Start using new CGS bitmask macros.

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Introduction of bitmask macros for registers
Tom St Denis [Wed, 6 Sep 2017 12:04:10 +0000 (08:04 -0400)]
drm/amd/powerplay: Introduction of bitmask macros for registers

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Simplify vega10_acg_disable()
Tom St Denis [Tue, 5 Sep 2017 16:33:58 +0000 (12:33 -0400)]
drm/amd/powerplay: Simplify vega10_acg_disable()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay: Simplify vega10_patch_voltage_dependency_tables_with_lookup_table()
Tom St Denis [Tue, 5 Sep 2017 16:02:57 +0000 (12:02 -0400)]
drm/amd/powerplay: Simplify vega10_patch_voltage_dependency_tables_with_lookup_table()

Signed-off-by: Tom St Denis <tom.stdenis@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix VM sync with always valid BOs v2
Christian König [Fri, 8 Sep 2017 12:09:41 +0000 (14:09 +0200)]
drm/amdgpu: fix VM sync with always valid BOs v2

All users of a VM must always wait for updates with always
valid BOs to be completed.

v2: remove debugging leftovers, rename struct member

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Roger He <Hongbo.He@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: enable raven to load firmwares by psp at default (v2)
Evan Quan [Mon, 4 Sep 2017 09:48:27 +0000 (17:48 +0800)]
drm/amdgpu: enable raven to load firmwares by psp at default (v2)

- v2: share code with CHIP_VEGA10 case

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-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>
7 years agodrm/amdgpu: stop psp ring on suspend
Evan Quan [Fri, 8 Sep 2017 05:09:50 +0000 (13:09 +0800)]
drm/amdgpu: stop psp ring on suspend

Otherwise, the ring will fail to create on next resume.

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-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>
7 years agodrm/amdgpu: added api for stopping psp ring (v2)
Evan Quan [Fri, 8 Sep 2017 05:04:52 +0000 (13:04 +0800)]
drm/amdgpu: added api for stopping psp ring (v2)

- v2: reuse the ring stop api in ring destory

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-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>
7 years agodrm/amdgpu: fixed raven psp cmd prepare and submit
Evan Quan [Mon, 4 Sep 2017 09:42:28 +0000 (17:42 +0800)]
drm/amdgpu: fixed raven psp cmd prepare and submit

- fw_size in psp_v10_0_prep_cmd_buf is wrongly set as 0
- fixed the wrong calculation of psp_write_ptr_reg in psp_v10_0_cmd_submit

Signed-off-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com>
Acked-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>
7 years agodrm/amdgpu: move MMU notifier related defines to amdgpu_mn.h
Christian König [Tue, 12 Sep 2017 18:29:07 +0000 (14:29 -0400)]
drm/amdgpu: move MMU notifier related defines to amdgpu_mn.h

Just some cleanup.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: move amdgpu_ttm_tt_* declarations into amdgpu_ttm.h
Christian König [Fri, 8 Sep 2017 15:19:19 +0000 (17:19 +0200)]
drm/amdgpu: move amdgpu_ttm_tt_* declarations into amdgpu_ttm.h

Just some cleanup.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: keep the MMU lock until the update ends v4
Christian König [Tue, 5 Sep 2017 15:30:46 +0000 (17:30 +0200)]
drm/amdgpu: keep the MMU lock until the update ends v4

This is quite controversial because it adds another lock which is held during
page table updates, but I don't see much other option.

v2: allow multiple updates to be in flight at the same time
v3: simplify the patch, take the read side only once
v4: correctly fix rebase conflict

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: rework amdgpu_cs_find_mapping
Christian König [Wed, 6 Sep 2017 14:55:16 +0000 (16:55 +0200)]
drm/amdgpu: rework amdgpu_cs_find_mapping

Use the VM instead of the BO list to find the BO for a virtual address.

This fixes UVD/VCE in physical mode with VM local BOs.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: move amdgpu_cs_sysvm_access_required into find_mapping
Christian König [Wed, 6 Sep 2017 14:15:28 +0000 (16:15 +0200)]
drm/amdgpu: move amdgpu_cs_sysvm_access_required into find_mapping

When we need to find the mapping we need sysvm access anyway.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/ttm: allow mapping BOs while they are still on the swap list
Christian König [Wed, 6 Sep 2017 14:55:55 +0000 (16:55 +0200)]
drm/ttm: allow mapping BOs while they are still on the swap list

With shared reservation objects it is possible that we want to temporary
kmap an BO while it is still on the swap list.

Signed-off-by: Christian König <christian.koenig@amd.com>
Acked-by: Leo Liu <leo.liu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: stop reserving the BO in the MMU callback v3
Christian König [Tue, 12 Sep 2017 18:25:14 +0000 (14:25 -0400)]
drm/amdgpu: stop reserving the BO in the MMU callback v3

Instead take the callback lock during the final parts of CS.

This should solve the last remaining locking order problems with BO reservations.

v2: rebase, make dummy functions static inline
v3: add one more missing inline and comments

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: use a rw_semaphore for MMU notifiers
Christian König [Tue, 5 Sep 2017 12:50:24 +0000 (14:50 +0200)]
drm/amdgpu: use a rw_semaphore for MMU notifiers

Allow at least some parallel processing.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: move userptr BOs to CPU domain during CS v2
Christian König [Tue, 5 Sep 2017 12:36:44 +0000 (14:36 +0200)]
drm/amdgpu: move userptr BOs to CPU domain during CS v2

Instead of moving them in the MMU notifier move them during CS.

v2: still mark pages as accessed/dirty

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com> (v1)
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: stop using BO status for user pages
Christian König [Tue, 5 Sep 2017 12:30:05 +0000 (14:30 +0200)]
drm/amdgpu: stop using BO status for user pages

Instead use a counter to figure out if we need to set new pages or not.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: move taking mmap_sem into get_user_pages v2
Christian König [Sun, 3 Sep 2017 13:22:06 +0000 (15:22 +0200)]
drm/amdgpu: move taking mmap_sem into get_user_pages v2

This didn't helped as intended, just simplify the code.

v2: unlock mmap_sem in the error path as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>