Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E0DB5C5DF70 for ; Tue, 18 Aug 2026 10:42:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id AB9A110EABC; Tue, 18 Aug 2026 10:42:02 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="J3YFmpsn"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3A40310EABA for ; Tue, 18 Aug 2026 10:42:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1787049721; x=1818585721; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Ma5qrfd2wqlG/4MzK0yrCzwJXnY/76jXnCr6jGx3YAQ=; b=J3YFmpsnRq6LK9BZCsdkJENPaWfqPwJv5nhn24housmIQQY+NSpJ4RjY mO9bbpPQ4qKj5x2PFI1kiITNDvKb+AKFuC6ry8pogdVEUu34LwGPAAJb8 zXV52WlaUhCxw1iBo5SYc5LN1/smkhJIxOfqgQitTnxtNo4Rlwd8XxOro 8vHWA7SjYrTI2mkJZzjGsr3vcZlxpZdg01k2W2uz+mXHb3hYhwV6s9PMj iWoV3Nzn/QdFzMzhp+F+XS3MaYWZB4oNJxGMwj1OS9GHsqXFfW0fNnEAh sj22B1Ue+CsV9ZNOf3MEEhmgicCqaaMJRgu2HjUVD0Sg9Wo/bztB/9VQb g==; X-CSE-ConnectionGUID: CSdOxA57QROX6YrD+Yj+Uw== X-CSE-MsgGUID: sHrUpLH2S6WdwRMSPzAeoA== X-IronPort-AV: E=McAfee;i="6800,10657,11878"; a="98691892" X-IronPort-AV: E=Sophos;i="6.25,230,1779174000"; d="scan'208";a="98691892" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2026 03:42:01 -0700 X-CSE-ConnectionGUID: vaRAhOCjQFS5XKgSGn8GPA== X-CSE-MsgGUID: ZPGmc/3pTBiTAYpCWbuucQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,230,1779174000"; d="scan'208";a="295117555" Received: from tejasupa-desk.iind.intel.com (HELO tejasupa-desk) ([10.190.239.37]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2026 03:41:59 -0700 From: Tejas Upadhyay To: intel-xe@lists.freedesktop.org Cc: himal.prasad.ghimiray@intel.com, Tejas Upadhyay , Arvind Yadav Subject: [PATCH V17 03/12] drm/xe: Extend BO purge to handle vram pages as well Date: Tue, 18 Aug 2026 16:10:58 +0530 Message-ID: <20260818104055.3833974-17-tejas.upadhyay@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260818104055.3833974-14-tejas.upadhyay@intel.com> References: <20260818104055.3833974-14-tejas.upadhyay@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Recent driver update introduce support for purgeable buffer objects (BOs), extending the API to include VRAM pages to better manage memory pressure and enable memory offlining. Reviewed-by: Arvind Yadav Reviewed-by: Himal Prasad Ghimiray Signed-off-by: Tejas Upadhyay --- drivers/gpu/drm/xe/xe_bo.c | 5 +---- drivers/gpu/drm/xe/xe_bo.h | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index dde309821237..52f81e972ada 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -921,7 +921,7 @@ void xe_bo_set_purgeable_state(struct xe_bo *bo, * * Return: 0 on success, negative error code on failure */ -static int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx) +int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx) { struct xe_bo *bo = ttm_to_xe_bo(ttm_bo); struct ttm_placement place = {}; @@ -929,9 +929,6 @@ static int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operatio xe_bo_assert_held(bo); - if (!ttm_bo->ttm) - return 0; - if (!xe_bo_madv_is_dontneed(bo)) return 0; diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h index e8081af5bfc1..90b15fff36c7 100644 --- a/drivers/gpu/drm/xe/xe_bo.h +++ b/drivers/gpu/drm/xe/xe_bo.h @@ -600,6 +600,7 @@ struct xe_bo_shrink_flags { long xe_bo_shrink(struct ttm_operation_ctx *ctx, struct ttm_buffer_object *bo, const struct xe_bo_shrink_flags flags, unsigned long *scanned); +int xe_ttm_bo_purge(struct ttm_buffer_object *ttm_bo, struct ttm_operation_ctx *ctx); /** * xe_bo_is_mem_type - Whether the bo currently resides in the given -- 2.52.0