]> www.infradead.org Git - users/dwmw2/linux.git/commit
drm/xe: Perform dma_map when moving system buffer objects to TT
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 2 May 2024 18:32:51 +0000 (20:32 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Fri, 3 May 2024 07:46:54 +0000 (09:46 +0200)
commit75521e8b56e8f9dc673b782df7bc3660f51f329a
treec5a27a6de7c5c0710d2ecfd15bc4a12e79c82feb
parent8ad0e1810bf23f22cedb8a2664548b15646570c7
drm/xe: Perform dma_map when moving system buffer objects to TT

Currently we dma_map on ttm_tt population and dma_unmap when
the pages are released in ttm_tt unpopulate.

Strictly, the dma_map is not needed until the bo is moved to the
XE_PL_TT placement, so perform the dma_mapping on such moves
instead, and remove the dma_mappig when moving to XE_PL_SYSTEM.

This is desired for the upcoming shrinker series where shrinking
of a ttm_tt might fail. That would lead to an odd construct where
we first dma_unmap, then shrink and if shrinking fails dma_map
again. If dma_mapping instead is performed on move like this,
shrinking does not need to care at all about dma mapping.

Finally, where a ttm_tt is destroyed while bound to a different
memory type than XE_PL_SYSTEM, we keep the dma_unmap in
unpopulate().

v2:
- Don't accidently unmap the dma-buf's sgtable.

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240502183251.10170-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/xe/xe_bo.c