Christian König
4148f28f98
drm/ttm: make ttm_bo_unpin more defensive
...
commit 6c5403173a13a08ff61dbdafa4c0ed4a9dedbfe0 upstream.
We seem to have some more driver bugs than thought.
Signed-off-by: Christian König <christian.koenig@amd.com >
Fixes: deb0814b43f3 ("drm/ttm: add ttm_bo_pin()/ttm_bo_unpin() v2")
Acked-by: Matthew Auld <matthew.auld@intel.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20210312093810.2202-1-christian.koenig@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2023-08-11 11:57:44 +02:00
Christian König
5f6d5b58c5
drm/ttm: add ttm_bo_pin()/ttm_bo_unpin() v2
...
[ Upstream commit deb0814b43f370a448a498409d949e38c9d8f02e ]
As an alternative to the placement flag add a
pin count to the ttm buffer object.
v2: add dma_resv_assert_help() calls
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Link: https://patchwork.freedesktop.org/patch/391596/?series=81973&rev=1
Stable-dep-of: a2848d08742c ("drm/ttm: never consider pinned BOs for eviction&swap")
Signed-off-by: Sasha Levin <sashal@kernel.org >
2023-08-11 11:57:33 +02:00
Dave Airlie
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
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
Christian König
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
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
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
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
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
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
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
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
ec731e516a
drm/ttm: ttm_bo_swapout_all doesn't use it's argument.
...
Just drop the argument from this.
This does ask the question if this is the function vmwgfx
should be using or should it be doing an evict all like
the other drivers.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Zack Rusin <zackr@vmware.com >
Signed-off-by: Dave Airlie <airlied@redhat.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20200728034254.20114-1-airlied@gmail.com
2020-07-29 10:01:23 +10:00
Maarten Lankhorst
60e9eabf41
Backmerge remote-tracking branch 'drm/drm-next' into drm-misc-next
...
Some conflicts with ttm_bo->offset removal, but drm-misc-next needs updating to v5.8.
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com >
2020-06-29 12:16:26 +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
Ira Weiny
915ecc22d5
drm: remove drm specific kmap_atomic code
...
kmap_atomic_prot() is now exported by all architectures. Use this
function rather than open coding a driver specific kmap_atomic.
[arnd@arndb.de: include linux/highmem.h]
Link: http://lkml.kernel.org/r/20200508220150.649044-1-arnd@arndb.de
Signed-off-by: Ira Weiny <ira.weiny@intel.com >
Signed-off-by: Arnd Bergmann <arnd@arndb.de >
Signed-off-by: Andrew Morton <akpm@linux-foundation.org >
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Christoph Hellwig <hch@lst.de >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Cc: Al Viro <viro@zeniv.linux.org.uk >
Cc: Andy Lutomirski <luto@kernel.org >
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org >
Cc: Borislav Petkov <bp@alien8.de >
Cc: Chris Zankel <chris@zankel.net >
Cc: Dan Williams <dan.j.williams@intel.com >
Cc: Dave Hansen <dave.hansen@linux.intel.com >
Cc: "David S. Miller" <davem@davemloft.net >
Cc: Helge Deller <deller@gmx.de >
Cc: "H. Peter Anvin" <hpa@zytor.com >
Cc: Ingo Molnar <mingo@redhat.com >
Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com >
Cc: Max Filippov <jcmvbkbc@gmail.com >
Cc: Paul Mackerras <paulus@samba.org >
Cc: Peter Zijlstra <peterz@infradead.org >
Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de >
Cc: Thomas Gleixner <tglx@linutronix.de >
Link: http://lkml.kernel.org/r/20200507150004.1423069-12-ira.weiny@intel.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org >
2020-06-04 19:06:22 -07:00
Thomas Hellstrom (VMware)
314b6580ad
drm/ttm, drm/vmwgfx: Support huge TTM pagefaults
...
Support huge (PMD-size and PUD-size) page-table entries by providing a
huge_fault() callback.
We still support private mappings and write-notify by splitting the huge
page-table entries on write-access.
Note that for huge page-faults to occur, either the kernel needs to be
compiled with trans-huge-pages always enabled, or the kernel needs to be
compiled with trans-huge-pages enabled using madvise, and the user-space
app needs to call madvise() to enable trans-huge pages on a per-mapping
basis.
Furthermore huge page-faults will not succeed unless buffer objects and
user-space addresses are aligned on huge page size boundaries.
Cc: Andrew Morton <akpm@linux-foundation.org >
Cc: Michal Hocko <mhocko@suse.com >
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org >
Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com >
Cc: Ralph Campbell <rcampbell@nvidia.com >
Cc: "Jérôme Glisse" <jglisse@redhat.com >
Cc: "Christian König" <christian.koenig@amd.com >
Cc: Dan Williams <dan.j.williams@intel.com >
Signed-off-by: Thomas Hellstrom (VMware) <thomas_os@shipmail.org >
Reviewed-by: Roland Scheidegger <sroland@vmware.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
2020-03-24 18:48:33 +01:00
Christian König
1ec39923ef
drm/ttm: rework BO delayed delete. v2
...
This patch reworks the whole delayed deletion of BOs which aren't idle.
Instead of having two counters for the BO structure we resurrect the BO
when we find that a deleted BO is not idle yet.
This has many advantages, especially that we don't need to
increment/decrement the BOs reference counter any more when it
moves on the LRUs.
v2: remove duplicate ttm_tt_destroy, fix holde lock for LRU move
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: xinhui pan <xinhui.pan@amd.com >
Link: https://patchwork.freedesktop.org/patch/352912/
2020-02-12 13:03:27 +01:00
Christian König
20c012b243
drm/ttm: also export ttm_bo_vm_fault v2
...
That is needed by at least a cleanup in radeon.
v2: also export ttm_bo_vm_access
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Huang Rui <ray.huang@amd.com >
Acked-by: Alex Deucher <alexander.deucher@amd.com >
Link: https://patchwork.freedesktop.org/patch/339353/
2019-11-08 11:33:32 +01:00
Daniel Vetter
6b1ce0a200
drm/ttm: remove ttm_bo_wait_unreserved
...
With nouveau fixed all ttm-using drives have the correct nesting of
mmap_sem vs dma_resv, and we can just lock the buffer.
Assuming I didn't screw up anything with my audit of course.
v2:
- Dont forget wu_mutex (Christian König)
- Keep the mmap_sem-less wait optimization (Thomas)
- Use _lock_interruptible to be good citizens (Thomas)
v3: Rebase over fault handler helperification.
Reviewed-by: Christian König <christian.koenig@amd.com > (v2)
Reviewed-by: Thomas Hellström <thellstrom@vmware.com > (v2)
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com >
Cc: Christian Koenig <christian.koenig@amd.com >
Cc: Huang Rui <ray.huang@amd.com >
Cc: Gerd Hoffmann <kraxel@redhat.com >
Cc: "VMware Graphics" <linux-graphics-maintainer@vmware.com >
Cc: Thomas Hellstrom <thellstrom@vmware.com >
Link: https://patchwork.freedesktop.org/patch/msgid/20191104173801.2972-3-daniel.vetter@ffwll.ch
2019-11-06 11:24:14 +01:00
Thomas Hellstrom
caa478af48
drm/ttm: Convert vm callbacks to helpers
...
The default TTM fault handler may not be completely sufficient
(vmwgfx needs to do some bookkeeping, control the write protectionand also
needs to restrict the number of prefaults).
Also make it possible replicate ttm_bo_vm_reserve() functionality for,
for example, mkwrite handlers.
So turn the TTM vm code into helpers: ttm_bo_vm_fault_reserved(),
ttm_bo_vm_open(), ttm_bo_vm_close() and ttm_bo_vm_reserve(). Also provide
a default TTM fault handler for other drivers to use.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/332900/?series=67217&rev=1
Signed-off-by: Christian König <christian.koenig@amd.com >
2019-11-04 13:02:30 +01: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
Christian König
7fb03cc3e0
drm/ttm, drm/vmwgfx: move cpu_writers handling into vmwgfx
...
This feature is only used by vmwgfx and superfluous for everybody else.
Signed-off-by: Christian König <christian.koenig@amd.com >
Co-developed-by: Thomas Hellstrom <thellstrom@vmware.com >
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com >
Tested-by: Thomas Hellstrom <thellstrom@vmware.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: https://patchwork.freedesktop.org/patch/333650/
2019-10-25 11:40:28 +02:00
Gerd Hoffmann
12067e0e89
drm/ttm: rename ttm_fbdev_mmap
...
Rename ttm_fbdev_mmap to ttm_bo_mmap_obj. Move the vm_pgoff sanity
check to amdgpu_bo_fbdev_mmap (only ttm_fbdev_mmap user in tree).
The ttm_bo_mmap_obj function can now be used to map any buffer object.
This allows to implement &drm_gem_object_funcs.mmap in gem ttm helpers.
v3: patch added to series
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Acked-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-by: Christian König <christian.koenig@amd.com >
Acked-by: Daniel Vetter <daniel.vetter@ffwll.ch >
Link: http://patchwork.freedesktop.org/patch/msgid/20191016115203.20095-8-kraxel@redhat.com
2019-10-17 13:59:16 +02:00
Christian König
52791eeec1
dma-buf: rename reservation_object to dma_resv
...
Be more consistent with the naming of the other DMA-buf objects.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk >
Link: https://patchwork.freedesktop.org/patch/323401/
2019-08-13 09:09:30 +02:00
Gerd Hoffmann
e7f0141a21
drm/ttm: drop ttm_buffer_object->resv
...
All users moved to ttm_buffer_object->base.resv
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20190805140119.7337-18-kraxel@redhat.com
2019-08-06 08:21:54 +02:00
Gerd Hoffmann
b96f3e7c80
drm/ttm: use gem vma_node
...
Drop vma_node from ttm_buffer_object, use the gem struct
(base.vma_node) instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20190805140119.7337-9-kraxel@redhat.com
2019-08-06 08:21:54 +02:00
Gerd Hoffmann
1e053b10ba
drm/ttm: use gem reservation object
...
Drop ttm_resv from ttm_buffer_object, use the gem reservation object
(base._resv) instead.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20190805140119.7337-8-kraxel@redhat.com
2019-08-06 08:21:54 +02:00
Gerd Hoffmann
8eb8833e7e
drm/ttm: add gem base object
...
Add drm_gem_object struct to ttm_buffer_object, so ttm objects are a gdm
object superclass. Add a function to check whenever a given bo actually
uses the embedded drm_gem_object.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Link: http://patchwork.freedesktop.org/patch/msgid/20190805140119.7337-2-kraxel@redhat.com
2019-08-06 08:21:53 +02:00
Thomas Zimmermann
cbce5f0a9f
drm/ttm: Remove ttm_bo_reference and ttm_bo_unref
...
Both functions are obsolete and all calls have been replaced by
ttm_bo_get and ttm_bo_put.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de >
Reviewed-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 >
2019-01-28 11:43:38 -05:00
Thomas Hellstrom
24dc64c1ba
drm/ttm: Export ttm_bo_get_unless_zero()
...
Export ttm_bo_get_unless_zero() to be used when looking up buffer
objects that are removed from the lookup structure in the destructor.
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com >
Reviewed-by: Sinclair Yeh <syeh@vmware.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
2018-09-28 08:55:10 +02:00
Huang Rui
7748e2dcda
drm/ttm: add bulk move function on LRU
...
This function allow us to bulk move a group of BOs to the tail of their LRU.
The positions of group of BOs are stored on the (first, last) bulk_move_pos
structure.
Signed-off-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Huang Rui <ray.huang@amd.com >
Tested-by: Mike Lothian <mike@fireburn.co.uk >
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de >
Acked-by: Chunming Zhou <david1.zhou@amd.com >
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-08-27 11:11:21 -05:00
Christian König
9a2779528e
drm/ttm: revise ttm_bo_move_to_lru_tail to support bulk moves
...
When move a BO to the end of LRU, it need remember the BO positions.
Make sure all moved bo in between "first" and "last". And they will be bulk
moving together.
Signed-off-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Huang Rui <ray.huang@amd.com >
Tested-by: Mike Lothian <mike@fireburn.co.uk >
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de >
Acked-by: Chunming Zhou <david1.zhou@amd.com >
Reviewed-by: Junwei Zhang <Jerry.Zhang@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-08-27 11:11:21 -05:00
Thomas Zimmermann
89c815ef07
drm/ttm: Introduce ttm_bo_get() and ttm_bo_put() for ref counting
...
The TTM buffer-object interface provides ttm_bo_reference() and
ttm_bo_unref() for managing reference counts. Replacing them with
ttm_bo_get() and ttm_bo_put() aligns the API with conventions used
throughout the Linux kernel.
The implementation of ttm_bo_unref() clears the supplied pointer
to NULL. This leads to workarounds where the caller saves the
pointer's value before de-referencing the BO. ttm_bo_put() does
not clear the supplied pointer.
Signed-off-by: Thomas Zimmermann <contact@tzimmermann.org >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-07-10 14:18:15 -05:00
Thomas Hellstrom
9c11fcf1a7
drm/ttm: Export the ttm_k[un]map_atomic_prot API.
...
It will be used by vmwgfx cpu blit.
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Brian Paul <brianp@vmware.com >
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com >
2018-03-22 11:10:06 +01:00
Christian König
724daa4fd6
drm/ttm: drop persistent_swap_storage from ttm_bo_init and co
...
Never used as parameter, the only driver actually using this is nouveau
and there it is initialized after the BO is initialized.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-02-26 23:09:45 -05:00
Christian König
3839263362
drm/ttm: drop bo->glob
...
The pointer is available as bo->bdev->glob as well.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-02-26 23:09:44 -05:00
Roger He
aa7662b67b
drm/ttm: add bit flag TTM_OPT_FLAG_FORCE_ALLOC
...
set TTM_OPT_FLAG_FORCE_ALLOC when we are servicing for page
fault routine.
for ttm_mem_global_reserve if in page fault routine, allow the gtt
pages reservation always. because page fault routing already grabbed
system memory and the allowance of this exception is harmless.
Otherwise, it will trigger OOM killer.
will be used later.
v2: set the FORCE_ALLOC always
v3: minor refine
Signed-off-by: Roger He <Hongbo.He@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-02-26 23:09:34 -05:00
Roger He
d330fca115
drm/ttm: use bit flag to replace allow_reserved_eviction in ttm_operation_ctx
...
for saving memory and more bit flag can be used in future
Signed-off-by: Roger He <Hongbo.He@amd.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-02-26 23:09:34 -05:00
Tan Xiaojun
e83bf4adf5
drm/ttm: remove ttm_bo_default_io_mem_pfn
...
No one will use this function except ttm_bo_io_mem_pfn() now, so move
the calculation of ttm_bo_default_io_mem_pfn() into ttm_bo_io_mem_pfn()
and do some cleanup.
Signed-off-by: Tan Xiaojun <tanxiaojun@huawei.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2018-01-10 15:44:51 -05:00
Roger He
dc947770cf
drm/ttm: enable swapout for reserved BOs during allocation
...
if the bo shares same reservation object then not lock it again
at swapout time to make it possible to swap out.
v2: refine the commmit message
Reviewed-by: Thomas Hellström <thellstrom@vmware.com >
Reviewed-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Chuming Zhou <david1.zhou@amd.com >
Signed-off-by: Roger He <Hongbo.He@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-28 09:48:20 -05:00
Roger He
a6c26af8a4
drm/ttm: call ttm_bo_swapout directly when ttm shrink
...
remove the extra indirection because we have only one implementation anyway
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Roger He <Hongbo.He@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-27 11:38:11 -05:00
Roger He
8836e4b8d3
drm/ttm: add allow_reserved_eviction and resv into ttm_operation_ctx
...
allow_reserved_eviction: Allow eviction of reserved BOs
resv: Reservation object to allow reserved evictions with
Reviewed-by: Christian König <christian.koenig@amd.com >
Signed-off-by: Roger He <Hongbo.He@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-15 17:09:17 -05:00
Christian König
6cd2e71e89
drm/ttm: add number of bytes moved to the operation context
...
Add some statistics how many bytes we have moved.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de >
Tested-by: Michel Dänzer <michel.daenzer@amd.com >
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-06 12:48:03 -05:00
Christian König
6fead44a4c
drm/ttm: use an operation ctx for ttm_bo_init_reserved
...
Instead of specifying if sleeping should be interruptible.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de >
Tested-by: Michel Dänzer <michel.daenzer@amd.com >
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-06 12:48:02 -05:00
Christian König
19be557010
drm/ttm: add operation ctx to ttm_bo_validate v2
...
Give moving a BO into place an operation context to work with.
v2: rebased
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com >
Reviewed-by: Chunming Zhou <david1.zhou@amd.com >
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de >
Tested-by: Michel Dänzer <michel.daenzer@amd.com >
Acked-by: Felix Kuehling <Felix.Kuehling@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-06 12:48:01 -05:00
Christian König
01f83e0663
drm/ttm: remove cur_placement
...
Not used any more.
Signed-off-by: Christian König <christian.koenig@amd.com >
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com >
Signed-off-by: Alex Deucher <alexander.deucher@amd.com >
2017-12-06 12:47:55 -05:00