Skip to content

Commit bda438b

Browse files
committed
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 <[email protected]> Signed-off-by: Michal Wajdeczko <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 9e56d02 commit bda438b

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

drivers/gpu/drm/xe/xe_ttm_vram_mgr.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,3 +478,15 @@ void xe_ttm_vram_get_used(struct ttm_resource_manager *man,
478478
*used_visible = mgr->visible_size - mgr->visible_avail;
479479
mutex_unlock(&mgr->lock);
480480
}
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+
}

drivers/gpu/drm/xe/xe_ttm_vram_mgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ int xe_ttm_vram_mgr_alloc_sgt(struct xe_device *xe,
2525
void xe_ttm_vram_mgr_free_sgt(struct device *dev, enum dma_data_direction dir,
2626
struct sg_table *sgt);
2727

28+
u64 xe_ttm_vram_get_avail(struct ttm_resource_manager *man);
2829
u64 xe_ttm_vram_get_cpu_visible_size(struct ttm_resource_manager *man);
2930
void xe_ttm_vram_get_used(struct ttm_resource_manager *man,
3031
u64 *used, u64 *used_visible);

0 commit comments

Comments
 (0)