0d2bd2ae04
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 >
2017-09-13 12:10:14 -04:00
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
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
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
e97f12f359
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 >
2017-09-13 12:10:12 -04:00
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
c9232d9ee8
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 >
2017-09-13 12:10:11 -04:00
9f8ccae9d6
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 >
2017-09-13 12:10:10 -04:00
0120ad13ac
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 >
2017-09-13 12:10:09 -04:00
a10ad69c83
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 >
2017-09-13 12:10:09 -04:00
30f111fca0
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 >
2017-09-13 12:10:08 -04:00
3efabd5eda
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 >
2017-09-13 12:10:08 -04:00
8b39f031b7
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 >
2017-09-13 12:10:07 -04:00
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
4a00f21db8
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 >
2017-09-12 14:32:55 -04:00
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
298e87c95f
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 >
2017-09-12 14:32:36 -04:00
23db59e48a
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 >
2017-09-12 14:32:29 -04:00
657b1f4697
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 >
2017-09-12 14:32:22 -04:00
1f9ba3bec6
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 >
2017-09-12 14:32:14 -04:00
0dba3739a7
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 >
2017-09-12 14:32:07 -04:00
0c69dd0a55
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 >
2017-09-12 14:31:59 -04:00
893c3880e4
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 >
2017-09-12 14:31:53 -04:00
8c755d9abc
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 >
2017-09-12 14:31:46 -04:00
f85a49bdb6
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 >
2017-09-12 14:31:39 -04:00
0f26b7b03c
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 >
2017-09-12 14:31:32 -04:00
dd5a6fe2af
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 >
2017-09-12 14:31:25 -04:00
583a888a77
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 >
2017-09-12 14:31:17 -04:00
7246187abf
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 >
2017-09-12 14:31:09 -04:00
38e40d9cc4
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 >
2017-09-12 14:31:02 -04:00
06474d5665
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 >
2017-09-12 14:30:56 -04:00
9a5487ef56
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 >
2017-09-12 14:30:48 -04:00
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
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
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
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
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
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
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
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
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
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
f5683f8b37
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 >
2017-09-12 14:27:01 -04:00
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
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
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
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
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
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
378e2d5b50
drm/ttm: fix ttm_bo_cleanup_refs_or_queue once more
...
With shared reservation objects __ttm_bo_reserve() can easily fail even on
destroyed BOs. This prevents correct handling when we need to individualize
the reservation object.
Fix this by individualizing the object before even trying to reserve it.
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 >
2017-09-12 14:23:41 -04:00