Dave Airlie
e46f468fef
drm/ttm: drop special pipeline accel cleanup function.
...
The two accel cleanup paths were mostly the same once refactored.
Just pass a bool to say if the evictions are to be pipelined.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200917064132.148521-2-airlied@gmail.com
2020-09-18 06:23:06 +10:00
Dave Airlie
2ee476f77f
drm/ttm: add a simple assign mem to bo wrapper
...
This pattern is called in a few places, just clean it up.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-6-airlied@gmail.com
2020-09-18 06:16:39 +10:00
Dave Airlie
0b988ca1c7
drm/ttm: protect against reentrant bind in the drivers
...
This moves the generic tracking into the drivers and protects
against reentrancy in the drivers. It fixes up radeon and agp
to be able to query the bound status as that is required.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-2-airlied@gmail.com
2020-09-18 06:14:00 +10:00
Dave Airlie
3a4ab168a5
drm/ttm: split bound/populated flags.
...
Move bound up into the bo object, and keep populated with the tt
object.
The ghost object handling needs to follow the flags at the bo
level now instead of it being part of the ttm tt object.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-7-airlied@gmail.com
2020-09-16 09:35:47 +10:00
Dave Airlie
9e9a153bdf
drm/ttm: move ttm binding/unbinding out of ttm_tt paths.
...
Move these up to the bo level, moving ttm_tt to just being
backing store. Next step is to move the bound flag out.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-6-airlied@gmail.com
2020-09-16 09:35:30 +10:00
Dave Airlie
2ff6e69c04
drm/ttm: wrap tt destroy. (v2)
...
All places this was called was using bo->ttm either direct
or indirectly.
v2: move to ttm_bo
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200915024007.67163-3-airlied@gmail.com
2020-09-16 09:33:53 +10:00
Christian König
9c3006a4cc
drm/ttm: remove available_caching
...
Instead of letting TTM make an educated guess based on
some mask all drivers should just specify what caching
they want for their CPU mappings.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/390207/
2020-09-15 16:05:19 +02:00
Christian König
0fe438cec9
drm/ttm: remove default caching
...
As far as I can tell this was never used either and we just
always fallback to the order cached > wc > uncached anyway.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/390142/
2020-09-15 16:03:44 +02:00
Christian König
48e07c23cb
drm/ttm: nuke memory type flags
...
It's not supported to specify more than one of those flags.
So it never made sense to make this a flag in the first place.
Nuke the flags and specify directly which memory type to use.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/389826/?series=81551&rev=1
2020-09-11 13:31:23 +02:00
Dave Airlie
86008a7553
drm/ttm: add optional bind/unbind via driver.
...
I want to remove the backend funcs
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200907204630.1406528-3-airlied@gmail.com
2020-09-09 08:29:43 +10:00
Dave Airlie
ecfe6953fa
drm/ttm: introduce ttm_bo_move_null
...
This pattern is cut-n-pasted across 4 drivers, switch it to
a WARN_ON instead, as BUG_ON is considered a bad idea usually.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200907204630.1406528-2-airlied@gmail.com
2020-09-09 08:28:53 +10:00
Dave Airlie
0a667b5007
drm/ttm: remove bdev from ttm_tt
...
I want to split this structure up and use it differently,
step one remove bdev pointer from it and pass it explicitly.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200826014428.828392-4-airlied@gmail.com
2020-09-08 06:39:21 +10:00
Christian König
fe662d846c
drm/ttm: remove io_reserve_lru handling v3
...
That is not used any more.
v2: keep the NULL checks in TTM.
v3: remove unused variable
Signed-off-by: Christian König <christian.koenig@amd.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Link: https://patchwork.freedesktop.org/patch/388646/
2020-09-03 11:41:11 +02:00
Thomas Zimmermann
534b1f9071
Merge drm/drm-next into drm-misc-next
...
Backmerging drm-next into drm-misc-next for nouveau and panel updates.
Resolves a conflict between ttm and nouveau, where struct ttm_mem_res got
renamed to struct ttm_resource.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
2020-08-12 20:42:08 +02:00
Christian König
b2458726b3
drm/ttm: give resource functions their own [ch] files
...
This is a separate object we work within TTM.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/384338/?series=80346&rev=1
2020-08-12 15:51:03 +02:00
Christian König
e92ae67d6e
drm/ttm: rename ttm_resource_manager_func callbacks
...
The names get/put are associated with reference counting
in the Linux kernel, use alloc/free instead.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/384340/?series=80346&rev=1
2020-08-12 15:50:51 +02:00
Dave Airlie
2966141ad2
drm/ttm: rename ttm_mem_reg to ttm_resource.
...
This name better reflects what the object does. I didn't rename
all the pointers it seemed too messy.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-60-airlied@gmail.com
2020-08-06 13:19:21 +10:00
Dave Airlie
9de59bc201
drm/ttm: rename ttm_mem_type_manager -> ttm_resource_manager.
...
This name makes a lot more sense, since these are about managing
driver resources rather than just memory ranges.
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-59-airlied@gmail.com
2020-08-06 13:12:40 +10:00
Dave Airlie
3f48f938ad
drm/ttm: add a wrapper for checking if manager is in use
...
This converts vmwgfx over to using an interface to set the
in use and check the in use flag.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-57-airlied@gmail.com
2020-08-06 13:12:40 +10:00
Dave Airlie
90a0489a71
drm/ttm: drop type manager has_type
...
under driver control, this flag isn't needed anymore,
remove the API that used to access it, and consoldiate
with the used api.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-56-airlied@gmail.com
2020-08-06 13:12:40 +10:00
Dave Airlie
a751612d4c
drm/ttm: drop list of memory managers from device. (v2)
...
The driver now controls these, the core just controls the system
memory one.
v2: init sysman explicitly and assign it as a driver manager
to simplify the lookup sequence.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-55-airlied@gmail.com
2020-08-06 13:12:40 +10:00
Dave Airlie
7541ce1a6f
drm/ttm: drop man->bdev link.
...
This link isn't needed anymore, drop it from the init interface.
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-54-airlied@gmail.com
2020-08-06 13:12:40 +10:00
Dave Airlie
7ee6c95e05
drm/ttm: drop priv pointer in memory manager
...
This isn't needed anymore by any drivers.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-52-airlied@gmail.com
2020-08-06 13:12:40 +10:00
Dave Airlie
37205891d8
drm/ttm: make ttm_range_man_init/takedown take type + args
...
This makes it easier to move these to a driver allocated system
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-47-airlied@gmail.com
2020-08-06 13:12:39 +10:00
Dave Airlie
d398811ebf
drm/ttm: allow drivers to provide their own manager subclasses
...
This will get removed eventually and all drivers will use this.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-45-airlied@gmail.com
2020-08-06 13:12:21 +10:00
Dave Airlie
01057278bc
drm/ttm: rename manager variable to make sure wrapper is used.
...
Other users of this should notice this change and switch to wrapper.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-44-airlied@gmail.com
2020-08-06 13:12:21 +10:00
Dave Airlie
9eca33f4a1
drm/ttm: add wrapper to get manager from bdev.
...
This will allow different abstractions later.
Acked-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-37-airlied@gmail.com
2020-08-06 12:32:03 +10:00
Dave Airlie
0cf0a79842
drm/ttm: make TTM responsible for cleaning system only.
...
Drivers should all be cleaning up their memory managers
themselves now, so let the core just clean the system one up.
Remove the legacy cleaning interface.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-36-airlied@gmail.com
2020-08-06 12:32:03 +10:00
Dave Airlie
56ee8b1c71
drm/ttm: start allowing drivers to use new takedown path (v2)
...
Allow the takedown path callback to be optional as well.
v2: use fini for range manager
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-27-airlied@gmail.com
2020-08-06 12:32:03 +10:00
Dave Airlie
4265accbfc
drm/ttm: make some inline helper functions for cleanup paths. (v2)
...
The disable path is just temporary for now, it will be dropped once has_type
is gone in a later patch.
v2: add docs.
rename to ttm_mem_type_manager namespace
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-26-airlied@gmail.com
2020-08-06 12:32:03 +10:00
Dave Airlie
98399abd52
drm/ttm: purge old manager init path.
...
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-24-airlied@gmail.com
2020-08-06 12:32:02 +10:00
Dave Airlie
3c90424bd7
drm/ttm: provide a driver-led init path for range mm manager. (v2)
...
This lets the generic range mm manager be initialised by the driver.
v2: add docs.
rename api to range_man_init for now.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-15-airlied@gmail.com
2020-08-06 12:31:36 +10:00
Dave Airlie
747074bb04
drm/ttm: split the mm manager init code (v2)
...
This will allow the driver to control the ordering here better.
Eventually the old path will be removed.
v2: add docs for new APIs.
rename new path to ttm_mem_type_manager_init/set_used(for now)
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-14-airlied@gmail.com
2020-08-06 12:31:29 +10:00
Dave Airlie
a2ff1e81d0
drm/ttm: export memory type debug entrypoint.
...
As suggested on review, just export the memory type debug for
drivers to use, while also making the debug callback optional
(don't need to test for system as it won't init it).
rename it to be more consistent with object name for now.
(we may rename all the objects later.)
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-9-airlied@gmail.com
2020-08-06 12:16:39 +10:00
Dave Airlie
20784cdf4b
drm/ttm: use a helper for unlocked moves to the lru tail
...
The pattern was repeated a few times, just make an inline for it.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-7-airlied@gmail.com
2020-08-06 12:16:33 +10:00
Dave Airlie
46bca88bbd
drm/ttm/amdgpu: consolidate ttm reserve paths
...
Drop the WARN_ON and consolidate the two paths into one.
Use the consolidate slowpath in the execbuf utils code.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804025632.3868079-6-airlied@gmail.com
2020-08-06 12:16:31 +10:00
Christian König
1a3fb59085
drm/ttm: remove the init_mem_type callback
...
It is a very strange concept to call a function which just
calls back the caller for the functions parameters.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Link: https://patchwork.freedesktop.org/patch/382085/
2020-07-31 17:14:37 +02:00
Christian König
be1213a341
drm/ttm: remove TTM_MEMTYPE_FLAG_FIXED v2
...
Instead use a boolean field in the memory manager structure.
Also invert the meaning of the field since the use of a TT
structure is the special case here.
v2: cleanup zero init.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Reviewed-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Alex Deucher <alexander.deucher@amd.com >
Link: https://patchwork.freedesktop.org/patch/382079/
2020-07-31 17:13:09 +02:00
Dave Airlie
9d66a3ee25
drm/ttm: drop unusued function declaration
...
This was removed in
f5a9a9383f
("drm/ttm: remove TTM_MEMTYPE_FLAG_CMA")
but the the declaration was left dangling.
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200728045129.21065-1-airlied@gmail.com
2020-07-29 09:43:09 +10:00
Christian König
9fadd6d1e2
drm/ttm: remove TTM_MEMTYPE_FLAG_MAPPABLE
...
Not used any more. And it is bad design to use a TTM flag
to do a check inside a driver.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/378245/
2020-07-22 15:13:10 +02:00
Christian König
f5a9a9383f
drm/ttm: remove TTM_MEMTYPE_FLAG_CMA
...
The original intention was to avoid CPU page table unmaps
when BOs move between the GTT and SYSTEM domain.
The problem is that this never correctly handled changes
in the caching attributes or backing pages.
Just drop this for now and simply unmap the CPU page
tables in all cases.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/378240/
2020-07-21 16:21:43 +02:00
Christian König
ce74773305
drm/ttm: remove io_reserve_fastpath flag
...
Just use the use_io_reserve_lru flag. It doesn't make much
sense to have two flags.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: https://patchwork.freedesktop.org/patch/378238/
2020-07-21 16:19:50 +02:00
Christian König
e04be2310b
drm/ttm: further cleanup ttm_mem_reg handling
...
Stop touching the backend private pointer alltogether and
make sure we never put the same mem twice by.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Madhav Chauhan <madhav.chauhan@amd.com >
Link: https://patchwork.freedesktop.org/patch/375613/
2020-07-13 14:29:40 +02:00
Nirmoy Das
6407d666c5
drm/ttm: do not keep GPU dependent addresses
...
GPU address handling is device specific and should be handle by its device
driver.
Signed-off-by: Nirmoy Das <nirmoy.das@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/372937/
Signed-off-by: Christian König <christian.koenig@amd.com >
2020-06-26 14:41:24 +02:00
Maya Rashish
b7301fd812
drm/ttm: Remove reference to the mem_glob member
...
It was removed in:
Author: Christian König <christian.koenig@amd.com >
Date: Wed Sep 25 11:38:50 2019 +0200
drm/ttm: remove pointers to globals
Signed-off-by: Maya Rashish <coypu@sdf.org >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/360750/
Signed-off-by: Christian König <christian.koenig@amd.com >
2020-05-05 13:36:09 +02:00
Christian König
5e791166d3
drm/ttm: nuke invalidate_caches callback
...
Another completely unused feature.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Link: https://patchwork.freedesktop.org/patch/348265/
2020-01-16 16:35:07 +01:00
Christian König
97588b5b9a
drm/ttm: remove pointers to globals
...
As the name says global memory and bo accounting is global. So it doesn't
make to much sense having pointers to global structures all around the code.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Thomas Hellström <thellstrom@vmware.com >
Link: https://patchwork.freedesktop.org/patch/332879/
2019-10-25 11:40:51 +02:00
Christian König
9165fb879f
drm/ttm: always keep BOs on the LRU
...
This allows blocking for BOs to become available
in the memory management.
Amdgpu is doing this for quite a while now during CS. Now
apply the new behavior to all drivers using TTM.
Signed-off-by: Christian König <christian.koenig@amd.com >
Acked-by: Thomas Hellstrom <thellstrom@vmware.com >
Link: https://patchwork.freedesktop.org/patch/332878/
2019-10-25 11:40:50 +02:00
Maxime Ripard
4092de1ba3
Merge drm/drm-next into drm-misc-next
...
We haven't done any backmerge for a while due to the merge window, and it
starts to become an issue for komeda. Let's bring 5.4-rc1 in.
Signed-off-by: Maxime Ripard <mripard@kernel.org >
2019-10-03 16:38:50 +02:00
Gerd Hoffmann
07583467c2
drm/ttm: remove embedded vma_offset_manager
...
No users left. Drivers either setup vma_offset_manager themself
(vmwgfx) or pass the gem vma_offset_manager to ttm_bo_device_init
(all other drivers).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20190905070509.22407-9-kraxel@redhat.com
2019-09-11 08:03:25 +02:00