Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Allow freeing of a managed bo

If a bo is created via xe_managed_bo_create_pin_map() then it cannot be
freed by the driver using xe_bo_unpin_map_no_vm(), or indeed any other
existing function. The DRM layer will still have a pointer stashed
away for later freeing, causing a invalid memory access on driver
unload. So add a helper for releasing the DRM action as well.

v2: Drop 'xe' parameter (review feedbak from Michal W)

Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://lore.kernel.org/r/20250910210237.603576-4-John.C.Harrison@Intel.com

+6
+5
drivers/gpu/drm/xe/xe_bo.c
··· 2629 2629 return bo; 2630 2630 } 2631 2631 2632 + void xe_managed_bo_unpin_map_no_vm(struct xe_bo *bo) 2633 + { 2634 + devm_release_action(xe_bo_device(bo)->drm.dev, __xe_bo_unpin_map_no_vm, bo); 2635 + } 2636 + 2632 2637 struct xe_bo *xe_managed_bo_create_from_data(struct xe_device *xe, struct xe_tile *tile, 2633 2638 const void *data, size_t size, u32 flags) 2634 2639 {
+1
drivers/gpu/drm/xe/xe_bo.h
··· 116 116 u32 flags, u64 alignment, bool intr); 117 117 struct xe_bo *xe_managed_bo_create_pin_map(struct xe_device *xe, struct xe_tile *tile, 118 118 size_t size, u32 flags); 119 + void xe_managed_bo_unpin_map_no_vm(struct xe_bo *bo); 119 120 struct xe_bo *xe_managed_bo_create_from_data(struct xe_device *xe, struct xe_tile *tile, 120 121 const void *data, size_t size, u32 flags); 121 122 int xe_managed_bo_reinit_in_vram(struct xe_device *xe, struct xe_tile *tile, struct xe_bo **src);