]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/xe/bo: Add a bo remove callback
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Wed, 26 Mar 2025 08:05:49 +0000 (09:05 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 27 Mar 2025 11:07:57 +0000 (12:07 +0100)
commit3cbb651117ff8a23ab22de595754e9d66b533ab9
treec0297a4abcbafff5c9fdf4f04233477882db6e3f
parentc9db07cab766b665c8fa1184649cef452f448dc8
drm/xe/bo: Add a bo remove callback

On device unbind, migrate exported bos, including pagemap bos to
system. This allows importers to take proper action without
disruption. In particular, SVM clients on remote devices may
continue as if nothing happened, and can chose a different
placement.

The evict_flags() placement is chosen in such a way that bos that
aren't exported are purged.

For pinned bos, we unmap DMA, but their pages are not freed yet
since we can't be 100% sure they are not accessed.

All pinned external bos (not just the VRAM ones) are put on the
pinned.external list with this patch. But this only affects the
xe_bo_pci_dev_remove_pinned() function since !VRAM bos are
ignored by the suspend / resume functionality. As a follow-up we
could look at removing the suspend / resume iteration over
pinned external bos since we currently don't allow pinning
external bos in VRAM, and other external bos don't need any
special treatment at suspend / resume.

v2:
- Address review comments. (Matthew Auld).
v3:
- Don't introduce an external_evicted list (Matthew Auld)
- Add a discussion around suspend / resume behaviour to the
  commit message.
- Formatting fixes.
v4:
- Move dma-unmaps of pinned kernel bos to a dev managed
  callback to give subsystems using these bos a chance to
  clean them up. (Matthew Auld)

Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Link: https://lore.kernel.org/r/20250326080551.40201-4-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/xe/xe_bo.c
drivers/gpu/drm/xe/xe_bo.h
drivers/gpu/drm/xe/xe_bo_evict.c
drivers/gpu/drm/xe/xe_bo_evict.h
drivers/gpu/drm/xe/xe_device.c
drivers/gpu/drm/xe/xe_device_types.h