Dave Airlie
f45fbbb6d5
Backmerge tag 'v5.13-rc7' into drm-next
...
Backmerge Linux 5.13-rc7 to make some pulls from later bases apply,
and to bake in the conflicts so far.
2021-06-23 10:07:48 +10:00
Christian König
2d2ddb589d
drm/ttm: fix deref of bo->ttm without holding the lock v2
...
We need to grab the resv lock first before doing that check.
v2 (chk): simplify the change for -fixes
Signed-off-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210528130041.1683-1-christian.koenig@amd.com
2021-06-08 13:24:15 +02:00
xinhui pan
35f819d218
drm/ttm: Skip swapout if ttm object is not populated
...
Swapping a ttm object which has no backend pages makes no sense.
Suggested-by: Christian König <christian.koenig@amd.com >
Signed-off-by: xinhui pan <xinhui.pan@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210521083112.33176-1-xinhui.pan@amd.com
CC: stable@kernel.org
Signed-off-by: Christian König <christian.koenig@amd.com >
2021-05-26 15:02:47 +02:00
Christian König
b072b9cd54
drm/ttm: add ttm_sys_manager v3
...
Add a separate manager for the system domain and make function tables
mandatory.
v2: debug is still optional
v3: return void during init
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Matthew Auld <matthew.auld@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210430092508.60710-1-christian.koenig@amd.com
2021-05-03 12:50:41 +02:00
Shiwu Zhang
2a269ba888
drm/ttm: fix error handling if no BO can be swapped out v4
...
In case that all pre-allocated BOs are busy, just continue to populate
BOs since likely half of system memory in total is still free.
v4 (chk): fix code moved to VMWGFX as well
Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210422115757.3946-1-christian.koenig@amd.com
2021-04-23 14:20:38 +02:00
Shiwu Zhang
13ea9aa1e7
drm/ttm: fix error handling if no BO can be swapped out v4
...
In case that all pre-allocated BOs are busy, just continue to populate
BOs since likely half of system memory in total is still free.
v4 (chk): fix code moved to VMWGFX as well
Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210422115757.3946-1-christian.koenig@amd.com
2021-04-23 14:08:04 +02:00
Lee Jones
178bdba84c
drm/ttm/ttm_device: Demote kernel-doc abuses
...
Fixes the following W=1 kernel build warning(s):
drivers/gpu/drm/ttm/ttm_device.c:42: warning: Function parameter or member 'ttm_global_mutex' not described in 'DEFINE_MUTEX'
drivers/gpu/drm/ttm/ttm_device.c:42: warning: expecting prototype for ttm_global_mutex(). Prototype was for DEFINE_MUTEX() instead
drivers/gpu/drm/ttm/ttm_device.c:112: warning: Function parameter or member 'ctx' not described in 'ttm_global_swapout'
drivers/gpu/drm/ttm/ttm_device.c:112: warning: Function parameter or member 'gfp_flags' not described in 'ttm_global_swapout'
drivers/gpu/drm/ttm/ttm_device.c:112: warning: expecting prototype for A buffer object shrink method that tries to swap out the first(). Prototype was for ttm_global_swapout() instead
Cc: Christian Koenig <christian.koenig@amd.com >
Cc: Huang Rui <ray.huang@amd.com >
Cc: David Airlie <airlied@linux.ie >
Cc: Daniel Vetter <daniel@ffwll.ch >
Cc: dri-devel@lists.freedesktop.org
Signed-off-by: Lee Jones <lee.jones@linaro.org >
Link: https://patchwork.freedesktop.org/patch/msgid/20210416143725.2769053-28-lee.jones@linaro.org
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Christian König <christian.koenig@amd.com >
2021-04-22 14:06:42 +02:00
Christian König
d4e6823609
drm/ttm: make global mutex and use count static
...
Only needed during device hot plug and remove and not exported.
Signed-off-by: Christian König <christian.koenig@amd.com >
Suggested-by: Bernard <bernard@vivo.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20210409110730.2958-1-christian.koenig@amd.com
2021-04-09 15:26:27 +02:00
Christian König
680dcede27
drm/ttm: switch back to static allocation limits for now
...
The shrinker based approach still has some flaws. Especially that we need
temporary pages to free up the pages allocated to the driver is problematic
in a shrinker.
Signed-off-by: Christian König <christian.koenig@amd.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20210324134845.2338-1-christian.koenig@amd.com
2021-03-29 11:05:36 +02:00
Christian König
a1f091f8ef
drm/ttm: switch to per device LRU lock
...
Instead of having a global lock for potentially less contention.
Signed-off-by: Christian König <christian.koenig@amd.com >
Tested-by: Nirmoy Das <nirmoy.das@amd.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Matthew Auld <matthew.auld@intel.com >
Link: https://patchwork.freedesktop.org/patch/424010/
2021-03-24 17:05:25 +01:00
Christian König
f9e2a03e11
drm/ttm: remove swap LRU v3
...
Instead evict round robin from each devices SYSTEM and TT domain.
v2: reorder num_pages access reported by Dan's script
v3: fix rebase fallout, num_pages should be 32bit
Signed-off-by: Christian König <christian.koenig@amd.com >
Tested-by: Nirmoy Das <nirmoy.das@amd.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Matthew Auld <matthew.auld@intel.com >
Link: https://patchwork.freedesktop.org/patch/424009/
2021-03-24 17:05:14 +01:00
Christian König
ebd59851c7
drm/ttm: move swapout logic around v3
...
Move the iteration of the global lru into the new function
ttm_global_swapout() and use that instead in drivers.
v2: consistently return int
v3: fix build fail
Signed-off-by: Christian König <christian.koenig@amd.com >
Tested-by: Nirmoy Das <nirmoy.das@amd.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Reviewed-by: Matthew Auld <matthew.auld@intel.com >
Link: https://patchwork.freedesktop.org/patch/424008/
2021-03-24 17:05:07 +01:00
Christian König
f07069da6b
drm/ttm: move memory accounting into vmwgfx v4
...
This is just another feature which is only used by VMWGFX, so move
it into the driver instead.
I've tried to add the accounting sysfs file to the kobject of the drm
minor, but I'm not 100% sure if this works as expected.
v2: fix typo in KFD and avoid 64bit divide
v3: fix init order in VMWGFX
v4: use pdev sysfs reference instead of drm
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Zack Rusin <zackr@vmware.com > (v3)
Tested-by: Nirmoy Das <nirmoy.das@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210208133226.36955-2-christian.koenig@amd.com
2021-02-09 17:27:33 +01:00
Christian König
8a945edd18
drm/ttm: fix removal of bo_count sysfs file
...
Only a zombie leftover from rebasing.
Signed-off-by: Christian König <christian.koenig@amd.com >
Fixes: 3763d635de ("drm/ttm: add debugfs directory v2")
Reported-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/msgid/20210209131756.24650-1-christian.koenig@amd.com
2021-02-09 16:34:43 +01:00
Christian König
8af8a109b3
drm/ttm: device naming cleanup
...
Rename ttm_bo_device to ttm_device.
Rename ttm_bo_driver to ttm_device_funcs.
Rename ttm_bo_global to ttm_global.
Move global and device related functions to ttm_device.[ch].
No functional change.
Signed-off-by: Christian König <christian.koenig@amd.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/415222/
2021-01-21 14:51:45 +01:00