Rex Zhu
cfa289fd49
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 >
2017-09-18 23:30:34 -04:00
Tom St Denis
97bae49c44
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 >
2017-09-18 23:30:31 -04:00
Alex Deucher
cf661ec1ff
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 >
2017-09-18 23:30:29 -04:00
Allen Pais
376b6a1f4f
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 >
2017-09-13 14:56:29 -04:00
Tom St Denis
c30572814d
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 >
2017-09-13 14:56:12 -04:00
Christian König
c09312a653
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 >
2017-09-13 12:10:14 -04:00
Christian König
88531913a8
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 >
2017-09-13 12:10:13 -04:00
Christian König
9f0ed7aab6
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 >
2017-09-13 12:10:12 -04:00
Michel Dänzer
a072c5f896
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 >
2017-09-13 12:10:11 -04:00
Christian König
4e55eb3879
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 >
2017-09-13 12:10:06 -04:00
Alex Deucher
29c3035fe3
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 >
2017-09-12 14:32:43 -04:00
Christian König
d5884513a3
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 >
2017-09-12 14:30:39 -04:00
Evan Quan
50811c71fa
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 >
2017-09-12 14:30:30 -04:00
Evan Quan
bcd6eab837
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 >
2017-09-12 14:30:21 -04:00
Evan Quan
4ef7245331
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 >
2017-09-12 14:30:11 -04:00
Evan Quan
f1ac0fc2f2
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 >
2017-09-12 14:29:48 -04:00
Christian König
9a18999640
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 >
2017-09-12 14:29:37 -04:00
Christian König
711becf0e6
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 >
2017-09-12 14:28:06 -04:00
Christian König
1ed3d2567c
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 >
2017-09-12 14:27:56 -04:00
Christian König
aebc5e6f50
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 >
2017-09-12 14:27:48 -04:00
Christian König
9cca0b8e5d
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 >
2017-09-12 14:27:22 -04:00
Christian König
3fe89771cb
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 >
2017-09-12 14:26:37 -04:00
Christian König
60de1c1740
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 >
2017-09-12 14:24:27 -04:00
Christian König
1b0c0f9dc5
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 >
2017-09-12 14:24:18 -04:00
Christian König
ca666a3c29
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 >
2017-09-12 14:24:09 -04:00
Christian König
b72cf4fca2
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 >
2017-09-12 14:24:00 -04:00
Bas Nieuwenhuizen
862095237c
drm/amdgpu: Account for shadow PTs in mapping update IB size.
...
When amdgpu_vm_frag_ptes calls amdgpu_vm_update_ptes and the pt
has a shadow PT we mirror all the write to the shadow PT too, which
results in twice the commands.
Signed-off-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-12 14:23:52 -04:00
Christian König
aa4ec7ce7e
drm/amdgpu: revert "fix deadlock of reservation between cs and gpu reset v2"
...
This reverts commit 10e709cb29
.
The patch doesn't work at all:
1. The CS can still be blocked because of amdgpu_ctx_add_fence().
2. The order of submission isn't correct any more.
3. We could end up using freed up memory because we now drop the
ctx reference to early.
This needs to be fixed cleanly by doing the context handling after the BO
handling, but this is a larger task just avoid the obvious crashes for now.
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 >
2017-09-12 14:23:30 -04:00
Christian König
a216ab0995
drm/amdgpu: fix userptr put_page handling
...
Move calling put_page into the unpopulate callback. Otherwise we mess up the pages
reference count when it is unbound multiple times.
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 >
2017-09-12 14:23:10 -04:00
Monk Liu
a2138eaf97
drm/amdgpu: fix wait_any_fence
...
first is incorrect if hit NULL/signaled fence
Signed-off-by: Monk Liu <monk.liu@amd.com >
Reviewed-by: Chunming Zhou <David1.Zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-12 14:22:43 -04:00
Rex Zhu
df1e639420
drm/amd/powerplay: delete eventmgr layer in poweprlay
...
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 >
2017-09-12 14:21:50 -04:00
Thierry Reding
1430f73beb
drm/amdgpu: Use correct path to trace include
...
The header comment in include/trace/define_trace.h specifies that the
TRACE_INCLUDE_PATH needs to be relative to the define_trace.h header
rather than the trace file including it. Most instances get that wrong
and work around it by adding the $(src) directory to the include path.
While this works, it is preferable to refer to the correct path to the
trace file in the first place and avoid any workaround.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Thierry Reding <treding@nvidia.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 15:01:20 -04:00
Tom St Denis
f053cd478e
drm/amd/amdgpu: Cleanup gmc_v9_0_suspend()
...
Even though fini returns 0 always it could theoretically
fail in the future. Might as well return it instead of 0.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:51:24 -04:00
Tom St Denis
4d9c333a46
drm/amd/amdgpu: Tidy up gmc_v9_0_hw_init()
...
Signed-off-by: Tom St Denis <tom.stdenis@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:51:16 -04:00
Tom St Denis
846347c9f5
drm/amd/amdgpu: Tidy up gmc_v9_0_gart_enable()
...
Signed-off-by: Tom St Denis <tom.stdenis@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:51:09 -04:00
Tom St Denis
ae6d1416fa
drm/amd/amdgpu: Simplify gmc_v9_0_vm_fault_interrupt_state()
...
Signed-off-by: Tom St Denis <tom.stdenis@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:51:01 -04:00
Tom St Denis
f6886c4726
drm/amd/amdgpu: Support full range of GFX ring names
...
Right now there's only one but the rest of the code is being
setup to support more so might as well fix this up too.
Signed-off-by: Tom St Denis <tom.stdenis@amd.com >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:50:53 -04:00
Christian König
70a9c6b901
drm/amdgpu: fix placement flags in amdgpu_ttm_bind
...
Otherwise we lose the NO_EVICT flag and can try to evict pinned BOs.
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 >
2017-09-01 12:50:45 -04:00
Christian König
481c2e9489
drm/amdgpu: fix moved list handling in the VM
...
Only move BOs to the moved/relocated list when they aren't already on a list.
This prevents accidential removal from the evicted list.
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 >
2017-09-01 12:50:35 -04:00
Evan Quan
f583046596
drm/amdgpu: declare the new firmware files needed by polaris asics
...
Signed-off-by: Evan Quan <evan.quan@amd.com >
Reviewed-by: Flora Cui <Flora.Cui@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:50:03 -04:00
Roger He
6849d47cab
drm/amdgpu: handle all fragment sizes v4
...
This can improve performance for some cases.
v2 (chk): handle all sizes, simplify the patch quite a bit
v3 (chk): adjust dw estimation as well
v4 (chk): use single loop, make end mask 64bit
Signed-off-by: Roger He <Hongbo.He@amd.com >
Signed-off-by: Christian König <christian.koenig@amd.com >
Tested-by: Roger He <Hongbo.He@amd.com >
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-09-01 12:49:32 -04:00
Tom St Denis
2b9bdfa70f
drm/amd/amdgpu: Simplify gfx_v9_0_wait_for_idle()
...
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 >
2017-08-31 15:01:06 -04:00
Tom St Denis
78888cff5c
drm/amd/amdgpu: Fix indentation in gfx_v9_0_mqd_init()
...
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 >
2017-08-31 15:01:05 -04:00
Tom St Denis
b08796cee1
drm/amd/amdgpu: Tidy up gfx_v9_0_rlc_stop()
...
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 >
2017-08-31 15:01:05 -04:00
Tom St Denis
e567fa69f2
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_dynamic_mg_power_gating()
...
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 >
2017-08-31 15:01:04 -04:00
Tom St Denis
7915c8fd7e
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_static_mg_power_gating()
...
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 >
2017-08-31 15:01:03 -04:00
Tom St Denis
513f81332a
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_pipeline_powergating()
...
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 >
2017-08-31 15:01:03 -04:00
Tom St Denis
f55ee212ee
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_cg_power_gating()
...
Make it consistent in style with the other CG/PG enable functions...
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 >
2017-08-31 15:01:02 -04:00
Tom St Denis
54cfe0fc54
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_cp_power_gating()
...
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 >
2017-08-31 15:01:02 -04:00
Tom St Denis
b926fe8efc
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_sck_slow_down_on_power_down()
...
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 >
2017-08-31 15:01:01 -04:00