| From 5064a5a5da12f395cda17abd5fa598f63eff5443 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Mon, 25 Aug 2025 08:28:41 -0700 |
| Subject: drm/xe: Don't trigger rebind on initial dma-buf validation |
| MIME-Version: 1.0 |
| Content-Type: text/plain; charset=UTF-8 |
| Content-Transfer-Encoding: 8bit |
| |
| From: Matthew Brost <matthew.brost@intel.com> |
| |
| [ Upstream commit 16ca06aa2c2218cb21907c0c45a746958c944def ] |
| |
| On the first validate of an imported dma-buf (initial bind), the device |
| has no GPU mappings, so a rebind is unnecessary. Rebinding here is |
| harmful in multi-GPU setups and for VMs using preempt-fence mode, as it |
| would evict in-flight GPU work. |
| |
| v2: |
| - Drop dma_buf_validated, check for XE_PL_SYSTEM (Thomas) |
| |
| Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") |
| Signed-off-by: Matthew Brost <matthew.brost@intel.com> |
| Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> |
| Link: https://lore.kernel.org/r/20250825152841.3837378-1-matthew.brost@intel.com |
| (cherry picked from commit ffdf968762e4fb3cdae54e811ec3525e67440a60) |
| Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/gpu/drm/xe/xe_bo.c | 3 ++- |
| 1 file changed, 2 insertions(+), 1 deletion(-) |
| |
| diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c |
| index e2c6493cb70d9..74635b444122d 100644 |
| --- a/drivers/gpu/drm/xe/xe_bo.c |
| +++ b/drivers/gpu/drm/xe/xe_bo.c |
| @@ -796,7 +796,8 @@ static int xe_bo_move(struct ttm_buffer_object *ttm_bo, bool evict, |
| } |
| |
| if (ttm_bo->type == ttm_bo_type_sg) { |
| - ret = xe_bo_move_notify(bo, ctx); |
| + if (new_mem->mem_type == XE_PL_SYSTEM) |
| + ret = xe_bo_move_notify(bo, ctx); |
| if (!ret) |
| ret = xe_bo_move_dmabuf(ttm_bo, new_mem); |
| return ret; |
| -- |
| 2.50.1 |
| |