platform/kernel/linux-rpi3.git
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>
7 years agodrm/amdgpu: Account for shadow PTs in mapping update IB size.
Bas Nieuwenhuizen [Thu, 7 Sep 2017 11:23:21 +0000 (13:23 +0200)]
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>
7 years agodrm/ttm: fix ttm_bo_cleanup_refs_or_queue once more
Christian König [Mon, 4 Sep 2017 18:58:45 +0000 (20:58 +0200)]
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>
7 years agodrm/amdgpu: revert "fix deadlock of reservation between cs and gpu reset v2"
Christian König [Tue, 5 Sep 2017 13:10:50 +0000 (15:10 +0200)]
drm/amdgpu: revert "fix deadlock of reservation between cs and gpu reset v2"

This reverts commit 10e709cb296c98424c03408d23e3addeddcd4088.

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>
7 years agodrm/amd/powerplay: Fix psm_set_user_performance_state()
Tom St Denis [Tue, 5 Sep 2017 11:55:48 +0000 (07:55 -0400)]
drm/amd/powerplay:  Fix psm_set_user_performance_state()

We now pass a pointer to a pointer which seems to be
what they meant in the first place.  The previous version
was modifying a pointer passed by value.

Fixes bug that was introduced by

commit 332798d40c2e91:drm/amd/powerplay: delete eventmgr layer in poweprlay

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 userptr put_page handling
Christian König [Sat, 2 Sep 2017 11:21:31 +0000 (13:21 +0200)]
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>
7 years agodrm/ttm: Fix configuration error around populate_and_map() functions
Tom St Denis [Tue, 5 Sep 2017 11:30:59 +0000 (07:30 -0400)]
drm/ttm: Fix configuration error around populate_and_map() functions

Fixed kbuild errors when IOMMU/SWIOTLB are disabled.

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/amdgpu: fix wait_any_fence
Monk Liu [Fri, 11 Aug 2017 09:49:48 +0000 (17:49 +0800)]
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>
7 years agodrm/amd/powerplay: set uvd/vce/nb/mclk level as UMD P-state required
Rex Zhu [Tue, 29 Aug 2017 09:07:38 +0000 (17:07 +0800)]
drm/amd/powerplay: set uvd/vce/nb/mclk level as UMD P-state required

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 UMD P-state in powerplay.
Rex Zhu [Tue, 29 Aug 2017 08:08:56 +0000 (16:08 +0800)]
drm/amd/powerplay: add UMD P-state in powerplay.

This feature is for UMD to run benchmark in a
power state that is as steady as possible. kmd
need to fix the power state as stable as possible.
now, kmd support four level:
profile_standard,peak,min_sclk,min_mclk

move common related code to amd_powerplay.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: delete eventmgr related files.
Rex Zhu [Fri, 1 Sep 2017 05:48:11 +0000 (13:48 +0800)]
drm/amd/powerplay: delete eventmgr related files.

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 eventmgr layer in poweprlay
Rex Zhu [Fri, 1 Sep 2017 05:46:20 +0000 (13:46 +0800)]
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>
7 years agodrm/amd/powerplay: fix sclk setting for profile mode for CZ/ST
Alex Deucher [Tue, 29 Aug 2017 14:55:05 +0000 (10:55 -0400)]
drm/amd/powerplay: fix sclk setting for profile mode for CZ/ST

Need to select dpm0 to avoid clock fluctuations.

Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/radeon: Use correct path to trace include
Thierry Reding [Fri, 1 Sep 2017 14:49:53 +0000 (16:49 +0200)]
drm/radeon: 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>
7 years agodrm/amdgpu: Use correct path to trace include
Thierry Reding [Fri, 1 Sep 2017 16:54:01 +0000 (12:54 -0400)]
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>
7 years agodrm/ttm: Fix trace include path (v2)
Tom St Denis [Fri, 1 Sep 2017 16:52:38 +0000 (12:52 -0400)]
drm/ttm: Fix trace include path (v2)

Reviewed-by: Thierry Reding <treding@nvidia.com>
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>
(v2): Drop Makefile change too.

7 years agodrm/amd/amdgpu: Cleanup gmc_v9_0_suspend()
Tom St Denis [Fri, 1 Sep 2017 13:55:04 +0000 (09:55 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gmc_v9_0_hw_init()
Tom St Denis [Fri, 1 Sep 2017 13:53:44 +0000 (09:53 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gmc_v9_0_gart_enable()
Tom St Denis [Fri, 1 Sep 2017 13:52:21 +0000 (09:52 -0400)]
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>
7 years agodrm/amd/amdgpu: Simplify gmc_v9_0_vm_fault_interrupt_state()
Tom St Denis [Fri, 1 Sep 2017 13:27:31 +0000 (09:27 -0400)]
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>
7 years agodrm/amd/amdgpu: Support full range of GFX ring names
Tom St Denis [Fri, 1 Sep 2017 13:13:04 +0000 (09:13 -0400)]
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>
7 years agodrm/amdgpu: fix placement flags in amdgpu_ttm_bind
Christian König [Fri, 1 Sep 2017 07:22:56 +0000 (09:22 +0200)]
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>
7 years agodrm/amdgpu: fix moved list handling in the VM
Christian König [Fri, 1 Sep 2017 12:46:19 +0000 (14:46 +0200)]
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>
7 years agodrm/amdgpu: declare the new firmware files needed by polaris asics
Evan Quan [Fri, 1 Sep 2017 07:07:41 +0000 (15:07 +0800)]
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>
7 years agodrm/amdgpu: handle all fragment sizes v4
Roger He [Wed, 30 Aug 2017 05:01:19 +0000 (13:01 +0800)]
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>
7 years agodrm/amd/amdgpu: Simplify gfx_v9_0_wait_for_idle()
Tom St Denis [Thu, 31 Aug 2017 13:48:11 +0000 (09:48 -0400)]
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>
7 years agodrm/amd/amdgpu: Fix indentation in gfx_v9_0_mqd_init()
Tom St Denis [Thu, 31 Aug 2017 13:43:47 +0000 (09:43 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_rlc_stop()
Tom St Denis [Thu, 31 Aug 2017 13:40:38 +0000 (09:40 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_dynamic_mg_power_gating()
Tom St Denis [Thu, 31 Aug 2017 13:31:23 +0000 (09:31 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_static_mg_power_gating()
Tom St Denis [Thu, 31 Aug 2017 13:31:01 +0000 (09:31 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_pipeline_powergating()
Tom St Denis [Thu, 31 Aug 2017 13:27:22 +0000 (09:27 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_gfx_cg_power_gating()
Tom St Denis [Thu, 31 Aug 2017 13:14:41 +0000 (09:14 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_cp_power_gating()
Tom St Denis [Thu, 31 Aug 2017 13:12:47 +0000 (09:12 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_sck_slow_down_on_power_down()
Tom St Denis [Thu, 31 Aug 2017 13:02:33 +0000 (09:02 -0400)]
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>
7 years agodrm/amd/amdgpu: Tidy up gfx_v9_0_enable_sck_slow_down_on_power_up()
Tom St Denis [Thu, 31 Aug 2017 13:01:11 +0000 (09:01 -0400)]
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_sck_slow_down_on_power_up()

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/amdgpu: Tidy up gfx_v9_0_enable_save_restore_machine()
Tom St Denis [Thu, 31 Aug 2017 12:59:00 +0000 (08:59 -0400)]
drm/amd/amdgpu: Tidy up gfx_v9_0_enable_save_restore_machine()

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/amdgpu: Tidy up gfx_v9_0_ngg_en()
Tom St Denis [Thu, 31 Aug 2017 12:50:23 +0000 (08:50 -0400)]
drm/amd/amdgpu: Tidy up gfx_v9_0_ngg_en()

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/amdgpu: Tidy up register list formatting.
Tom St Denis [Thu, 31 Aug 2017 12:41:54 +0000 (08:41 -0400)]
drm/amd/amdgpu: Tidy up register list formatting.

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: bump version for support of local BOs
Christian König [Tue, 29 Aug 2017 14:14:32 +0000 (16:14 +0200)]
drm/amdgpu: bump version for support of local BOs

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: add IOCTL interface for per VM BOs v3
Christian König [Fri, 25 Aug 2017 07:14:43 +0000 (09:14 +0200)]
drm/amdgpu: add IOCTL interface for per VM BOs v3

Add the IOCTL interface so that applications can allocate per VM BOs.

Still WIP since not all corner cases are tested yet, but this reduces average
CS overhead for 10K BOs from 21ms down to 48us.

v2: add some extra checks, remove the WIP tag
v3: rename new flag to AMDGPU_GEM_CREATE_VM_ALWAYS_VALID

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: add support for per VM BOs v2
Christian König [Wed, 16 Aug 2017 09:13:48 +0000 (11:13 +0200)]
drm/amdgpu: add support for per VM BOs v2

Per VM BOs are handled like VM PDs and PTs. They are always valid and don't
need to be specified in the BO lists.

v2: validate PDs/PTs first

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: restrict userptr even more
Christian König [Tue, 29 Aug 2017 14:07:31 +0000 (16:07 +0200)]
drm/amdgpu: restrict userptr even more

Don't allow them to be GEM imported into another process.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Acked-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix new PD update code for Vega10 v2
Christian König [Thu, 31 Aug 2017 08:46:20 +0000 (10:46 +0200)]
drm/amdgpu: fix new PD update code for Vega10 v2

We need to refer to the parent instead of the root BO for multi
level page tables on Vega10. Also don't set the PDE_PTE bit.

v2: Don't set the PDE_PTE bit either.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Roger He <Hongbo.He@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: move hw generation check into amdgpu_doorbell_init v2
Christian König [Thu, 8 Jun 2017 09:15:16 +0000 (11:15 +0200)]
drm/amdgpu: move hw generation check into amdgpu_doorbell_init v2

This way we can safely call it on SI as well.

v2: fix type in commit message

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: cleanup the VM code a bit more
Christian König [Wed, 30 Aug 2017 13:38:45 +0000 (15:38 +0200)]
drm/amdgpu: cleanup the VM code a bit more

The src isn't used any more after GART hack removal.

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Felix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: rework page directory filling v2
Christian König [Wed, 9 Aug 2017 12:15:46 +0000 (14:15 +0200)]
drm/amdgpu: rework page directory filling v2

Keep track off relocated PDs/PTs instead of walking and checking all PDs.

v2: fix root PD handling

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd/powerplay/hwmgr: Remove null check before kfree
Himanshu Jha [Tue, 29 Aug 2017 13:12:27 +0000 (18:42 +0530)]
drm/amd/powerplay/hwmgr: Remove null check before kfree

kfree on NULL pointer is a no-op and therefore checking is redundant.

Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Reviewed-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amd: Remove null check before kfree
Himanshu Jha [Tue, 29 Aug 2017 13:21:27 +0000 (18:51 +0530)]
drm/amd: Remove null check before kfree

Kfree on NULL pointer is a no-op and therefore checking is redundant.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: track evicted page tables v2
Christian König [Thu, 3 Aug 2017 12:02:13 +0000 (14:02 +0200)]
drm/amdgpu: track evicted page tables v2

Instead of validating all page tables when one was evicted,
track which one needs a validation.

v2: simplify amdgpu_vm_ready as well

Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com> (v1)
Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
7 years agodrm/amdgpu: fix comment on amdgpu_bo_va
Christian König [Mon, 28 Aug 2017 12:46:40 +0000 (14:46 +0200)]
drm/amdgpu: fix comment on amdgpu_bo_va

Except for the reference count all other members are protected
by the VM PD being reserved.

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/amdgpu: add bo_va cleared flag again v2
Christian König [Tue, 15 Aug 2017 15:08:12 +0000 (17:08 +0200)]
drm/amdgpu: add bo_va cleared flag again v2

We changed this to use an extra list a while back, but for the next
series I need a separate flag again.

v2: reorder to avoid unlocked list access

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/amdgpu: rework moved handling in the VM v2
Christian König [Wed, 23 Aug 2017 14:13:33 +0000 (16:13 +0200)]
drm/amdgpu: rework moved handling in the VM v2

Instead of using the vm_state use a separate flag to note
that the BO was moved.

v2: reorder patches to avoid temporary lockless access

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>