fea456d82c
drm/ttm: fix eviction valuable range check.
...
This was adding size to start, but pfn and start are in pages,
so it should be using num_pages.
Not sure this fixes anything in the real world, just noticed it
during refactoring.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20201019222257.1684769-2-airlied@gmail.com
2020-10-21 06:59:07 +10:00
92fdb97d64
drm/ttm: update kernel-doc line comments
...
Update kernel-doc line comments to fix warnings reported by make W=1.
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'glob' not described in 'ttm_shrink'
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'from_wq' not described in 'ttm_shrink'
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'extra' not described in 'ttm_shrink'
drivers/gpu/drm/ttm/ttm_memory.c:271: warning: Function parameter or
member 'ctx' not described in 'ttm_shrink'
Signed-off-by: Tian Tao <tiantao6@hisilicon.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Acked-by: Huang Rui <ray.huang@amd.com >
Link: https://patchwork.freedesktop.org/patch/391317/
Signed-off-by: Christian König <christian.koenig@amd.com >
2020-09-21 11:20:13 +02:00
4856e5aa0e
drm/ttm: drop evicted from ttm_bo.
...
This was unused.
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-3-airlied@gmail.com
2020-09-18 06:23:38 +10:00
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
92afce9095
drm/ttm: make common function for wait/free node path.
...
The pipeline and accel cleansups has similiar paths here.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-8-airlied@gmail.com
2020-09-18 06:21:29 +10:00
13a8f46d80
drm/ttm: move ghost object creation to a common function
...
Both accel cleanup and pipeline move had the same code, make
a single function for it.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-7-airlied@gmail.com
2020-09-18 06:21:25 +10:00
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
cae515f4a5
drm/ttm/drivers: call the bind function directly.
...
Now the bind functions have all the protection explicitly the
drivers can just call them directly, and the api can be unexported
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-5-airlied@gmail.com
2020-09-18 06:16:03 +10:00
37bff6542c
drm/ttm: move unbind into the tt destroy.
...
This moves unbind into the driver side on destroy paths.
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-4-airlied@gmail.com
2020-09-18 06:15:24 +10:00
7626168fd1
drm/ttm: flip tt destroy ordering.
...
Call the driver first and have it call the common code cleanup.
This is useful later to fix unbind.
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-3-airlied@gmail.com
2020-09-18 06:14:41 +10:00
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
36183150e0
drm/ttm: some cleanups
...
Unexport ttm_check_under_lowerlimit.
Make ttm_bo_acc_size static and unexport it.
Remove ttm_get_kernel_zone_memory_size.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/390515/
2020-09-17 11:44:04 +02:00
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
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
2040ec970e
drm/ttm: split populate out from binding.
...
Drivers have to call populate themselves now before binding.
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-5-airlied@gmail.com
2020-09-16 09:34:54 +10:00
395a73f8ba
drm/ttm: tt destroy move null check to outer function.
...
This just makes things easier later.
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-4-airlied@gmail.com
2020-09-16 09:34:33 +10:00
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
7eec915138
drm/ttm/tt: add wrappers to set tt state.
...
This adds 2 getters and 4 setters, however unbound and populated
are currently the same thing, this will change, it also drops
a BUG_ON that seems not that useful.
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-2-airlied@gmail.com
2020-09-16 09:33:24 +10:00
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
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
00af6729b5
Merge drm/drm-next into drm-misc-next
...
Paul Cercueil needs some patches in -rc5 to apply new patches for ingenic
properly.
Signed-off-by: Maxime Ripard <maxime@cerno.tech >
2020-09-14 18:11:40 +02:00
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
04e89ff364
drm/ttm: drop the tt backend function paths.
...
These are now driver side.
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-14-airlied@gmail.com
2020-09-09 08:30:54 +10:00
48efa57e4f
drm/ttm/agp: remove bdev from agp helpers
...
Since the agp bind/unbind/destroy are now getting called from drivers
rather than via the func table, drop the bdev parameter.
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-13-airlied@gmail.com
2020-09-09 08:30:49 +10:00
434825546e
drm/ttm: get rid of agp specific populate/unpopulate paths.
...
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-12-airlied@gmail.com
2020-09-09 08:30:42 +10:00
0e59e772e3
drm/ttm/agp: drop back end bindings from agp
...
These aren't used anymore.
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-11-airlied@gmail.com
2020-09-09 08:30:36 +10:00
738edc0adb
drm/ttm/agp: export bind/unbind/destroy for drivers to use.
...
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-5-airlied@gmail.com
2020-09-09 08:30:01 +10:00
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
54d04ea8cd
drm/ttm: merge offset and base in ttm_bus_placement
...
This is used by TTM to communicate the physical address
which should be used with ioremap(), ioremap_wc(). We don't
need to separate the base and offset in any way here.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/389457/
2020-09-08 10:43:30 +02:00
ce5c207c6b
Merge tag 'v5.9-rc4' into drm-next
...
Backmerge 5.9-rc4 as there is a nasty qxl conflict
that needs to be resolved.
Signed-off-by: Dave Airlie <airlied@redhat.com >
2020-09-08 14:41:40 +10:00
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
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
d575ee1131
drm/ttm: make sure that we always zero init mem.bus v2
...
We are trying to remove the io_lru handling and depend
on zero init base, offset and addr here.
v2: init addr as well
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Ben Skeggs <bskeggs@redhat.com >
Link: https://patchwork.freedesktop.org/patch/388642/
2020-09-03 11:40:32 +02:00
ebb21aa188
drm/ttm: drop bus.size from bus placement.
...
This is always calculated the same, and only used in a couple of places.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200811074658.58309-2-airlied@gmail.com
2020-08-24 17:06:08 +10:00
098754fe3c
drm/ttm: init mem->bus in common code.
...
The drivers all do the same thing here.
Reviewed-by: Christian König <christian.koenig@amd.com > for both.
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200811074658.58309-1-airlied@gmail.com
2020-08-24 17:00:48 +10:00
df561f6688
treewide: Use fallthrough pseudo-keyword
...
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.
[1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through
Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org >
2020-08-23 17:36:59 -05:00
0b06286579
drm/ttm: fix broken merge between drm-next and drm-misc-next
...
drm-next reverted the changes to ttm_tt_create() to do the
NULL check inside the function, but drm-misc-next adds new
users of this approach.
Re-apply the NULL check change inside the function to fix this.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/386628/
2020-08-20 14:03:10 +02:00
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
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
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
62975d27d6
drm/ttm: revert "drm/ttm: make TT creation purely optional v3"
...
This reverts commit 2ddef17678
.
As it turned out VMWGFX needs a much wider audit to fix this.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200811092400.188124-1-christian.koenig@amd.com
2020-08-12 13:26:28 +10:00
15f9d8b8cf
Merge tag 'drm-misc-fixes-2020-08-04' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
...
* backmerge from drm-fixes at v5.8-rc7
* add orientation quirk for ASUS T103HAF
* drm/omap: force runtime PM suspend on system suspend
* drm/tidss: fix modeset init for DPI panels
* re-added docs for drm_gem_flink_ioctl()
* ttm: fix page-offset calculation within TTM
Signed-off-by: Dave Airlie <airlied@redhat.com >
From: Thomas Zimmermann <tzimmermann@suse.de >
Link: https://patchwork.freedesktop.org/patch/msgid/20200804125510.GA29670@linux-uq9g
2020-08-11 12:00:30 +10:00
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
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
80938c28ee
drm/ttm: rename bo manager to range manager.
...
The generic manager is called the range manager now, rename
the file and some internals.
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-58-airlied@gmail.com
2020-08-06 13:12:40 +10:00
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
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
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
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
3a1fc38eda
drm/ttm: move range manager to subclassed driver allocation
...
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-48-airlied@gmail.com
2020-08-06 13:12:39 +10:00