From: Piotr Piórkowski Date: Fri, 3 Oct 2025 16:26:19 +0000 (+0200) Subject: drm/xe: Combine userspace context check X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8462d16d1b75325cb7220cd2731a47033baff863;p=thirdparty%2Fkernel%2Flinux.git drm/xe: Combine userspace context check Both vm->xef and XE_LRC_CREATE_USER_CTX indicate in xe_lrc_init that the context originates from userspace. However, XE_LRC_CREATE_USER_CTX has a broader scope as it may be set even when no vm->xef is present. The XE_BO_FLAG_PINNED_LATE_RESTORE flag can be extended to both cases, so there is no point in handling the two cases separately. Let's combine vm->xef and XE_LRC_CREATE_USER_CTX checks to detect userspace context. Signed-off-by: Piotr Piórkowski Suggested-by: Matthew Auld Reviewed-by: Matthew Auld Signed-off-by: Michal Wajdeczko Link: https://lore.kernel.org/r/20251003162619.1984236-6-piotr.piorkowski@intel.com --- diff --git a/drivers/gpu/drm/xe/xe_lrc.c b/drivers/gpu/drm/xe/xe_lrc.c index c88e90175f59c..af09f70f6e785 100644 --- a/drivers/gpu/drm/xe/xe_lrc.c +++ b/drivers/gpu/drm/xe/xe_lrc.c @@ -1412,11 +1412,9 @@ static int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe, bo_flags = XE_BO_FLAG_VRAM_IF_DGFX(tile) | XE_BO_FLAG_GGTT | XE_BO_FLAG_GGTT_INVALIDATE; - if (vm && vm->xef) /* userspace */ - bo_flags |= XE_BO_FLAG_PINNED_LATE_RESTORE; - if (init_flags & XE_LRC_CREATE_USER_CTX) - bo_flags |= XE_BO_FLAG_FORCE_USER_VRAM; + if ((vm && vm->xef) || init_flags & XE_LRC_CREATE_USER_CTX) /* userspace */ + bo_flags |= XE_BO_FLAG_PINNED_LATE_RESTORE | XE_BO_FLAG_FORCE_USER_VRAM; lrc->bo = xe_bo_create_pin_map_novm(xe, tile, bo_size,