VRAM is no longer usable after the device is wedged. Reject observed VRAM allocations with -ENODEV and stop placement fallback.
An allocation racing with the wedge may still complete. The wedged fault path prevents new VRAM CPU mappings, and device teardown releases the resource. v2: - Return -ENODEV to stop placement fallback after a permanent wedge. (Rodrigo) Cc: Matthew Brost <[email protected]> Cc: Thomas Hellström <[email protected]> Cc: Himal Prasad Ghimiray <[email protected]> Cc: Rodrigo Vivi <[email protected]> Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Arvind Yadav <[email protected]> --- drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c index 9a514d983e90..088a690067b9 100644 --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c @@ -105,6 +105,7 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man, const struct ttm_place *place, struct ttm_resource **res) { + struct xe_device *xe = ttm_to_xe_device(tbo->bdev); struct xe_ttm_vram_mgr *mgr = to_xe_ttm_vram_mgr(man); struct xe_ttm_vram_mgr_resource *vres; struct gpu_buddy *mm = &mgr->mm; @@ -112,6 +113,9 @@ static int xe_ttm_vram_mgr_new(struct ttm_resource_manager *man, unsigned long lpfn; int err; + if (xe_device_wedged(xe)) + return -ENODEV; + lpfn = place->lpfn; if (!lpfn || lpfn > man->size >> PAGE_SHIFT) lpfn = man->size >> PAGE_SHIFT; -- 2.43.0
