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

drm/xe: Add xe_ttm_vram_get_avail

The PF driver will need to know size of the remaining available
VRAM to estimate fair VRAM allocations that could be used across
all VFs in automatic VFs provisioning mode. Add helper function
for that. We will use it in upcoming patch.

Reviewed-by: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240415173937.1287-4-michal.wajdeczko@intel.com

+13
+12
drivers/gpu/drm/xe/xe_ttm_vram_mgr.c
··· 478 478 *used_visible = mgr->visible_size - mgr->visible_avail; 479 479 mutex_unlock(&mgr->lock); 480 480 } 481 + 482 + u64 xe_ttm_vram_get_avail(struct ttm_resource_manager *man) 483 + { 484 + struct xe_ttm_vram_mgr *mgr = to_xe_ttm_vram_mgr(man); 485 + u64 avail; 486 + 487 + mutex_lock(&mgr->lock); 488 + avail = mgr->mm.avail; 489 + mutex_unlock(&mgr->lock); 490 + 491 + return avail; 492 + }
+1
drivers/gpu/drm/xe/xe_ttm_vram_mgr.h
··· 25 25 void xe_ttm_vram_mgr_free_sgt(struct device *dev, enum dma_data_direction dir, 26 26 struct sg_table *sgt); 27 27 28 + u64 xe_ttm_vram_get_avail(struct ttm_resource_manager *man); 28 29 u64 xe_ttm_vram_get_cpu_visible_size(struct ttm_resource_manager *man); 29 30 void xe_ttm_vram_get_used(struct ttm_resource_manager *man, 30 31 u64 *used, u64 *used_visible);