From mboxrd@z Thu Jan 1 00:00:00 1970 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 6CAA0C04FFE for ; Fri, 26 Apr 2024 09:35:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B10F10F2A6; Fri, 26 Apr 2024 09:35:51 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="XU4bvOwA"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F45B10F293 for ; Fri, 26 Apr 2024 09:35:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1714124142; x=1745660142; h=from:to:subject:date:message-id:in-reply-to:references: mime-version:content-transfer-encoding; bh=/UcH6J1Q077kdfltwPG03zdFaHuLWpJKTNH7rTy079U=; b=XU4bvOwAcplVG7D7Yn7gyhsRkFfp7JWinSixZ3jXu5jumE0z9CWpzSVJ g1rAD2J0xPg2y1TXCiH9bAf96SNfyOGRHWUHR85T+wq9HNpTpHilhRSXh katH4bJflmAquAnZNlWAOQPCTP6UrwU4Es/JaxGaLwjHTO6/hYtCl/os6 sZftt/OT75Go0vwM/eq1ueSxl5+WtnxLt72BFiWSfgwHtvda+UmFUZUPk 6Wn03MXbFQ9nZgpa8+aGAHywIKu3R32FJ+BkV1AYhUkxy/C/ngvhDCn6t DOmLVLPxez/ULjldvy3V9o9dKkVyeBVClAiyWN4gAOvRb/p4aq2ybf/29 w==; X-CSE-ConnectionGUID: XvQT+vcxRI2LdzFSGaGmkw== X-CSE-MsgGUID: s+3u4vmrR9aOqJ1DLuGtiQ== X-IronPort-AV: E=McAfee;i="6600,9927,11055"; a="20467105" X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="20467105" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 02:35:42 -0700 X-CSE-ConnectionGUID: mUNwW/lbQhKyKYBgazyGCg== X-CSE-MsgGUID: f+OyTGboTSyErYJpQnrcQg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.07,232,1708416000"; d="scan'208";a="25373017" Received: from nirmoyda-desk.igk.intel.com ([10.102.138.190]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Apr 2024 02:35:42 -0700 From: Nirmoy Das To: intel-xe@lists.freedesktop.org Subject: [CI 4/5] drm/xe: Add function to check if BO has single placement Date: Fri, 26 Apr 2024 11:20:52 +0200 Message-ID: <20240426092053.2863-4-nirmoy.das@intel.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20240426092053.2863-1-nirmoy.das@intel.com> References: <20240426092053.2863-1-nirmoy.das@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Organization: Intel Deutschland GmbH, Registered Address: Am Campeon 10, 85579 Neubiberg, Germany, Commercial Register: Amtsgericht Muenchen HRB 186928 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" A new helper function xe_bo_has_single_placement() to check if a BO has single placement. Signed-off-by: Nirmoy Das Reviewed-by: José Roberto de Souza --- drivers/gpu/drm/xe/xe_bo.c | 14 ++++++++++++++ drivers/gpu/drm/xe/xe_bo.h | 1 + 2 files changed, 15 insertions(+) diff --git a/drivers/gpu/drm/xe/xe_bo.c b/drivers/gpu/drm/xe/xe_bo.c index bc1f794e3e61..37df8c5aa707 100644 --- a/drivers/gpu/drm/xe/xe_bo.c +++ b/drivers/gpu/drm/xe/xe_bo.c @@ -95,6 +95,20 @@ bool xe_bo_is_stolen(struct xe_bo *bo) return bo->ttm.resource->mem_type == XE_PL_STOLEN; } +/** + * xe_bo_has_single_placement - check if BO is placed only in one memory location + * @bo: The BO + * + * This function checks whether a given BO is placed in only one memory location. + * + * Returns: true if the BO is placed in a single memory location, false otherwise. + * + */ +bool xe_bo_has_single_placement(struct xe_bo *bo) +{ + return bo->placement.num_placement == 1; +} + /** * xe_bo_is_stolen_devmem - check if BO is of stolen type accessed via PCI BAR * @bo: The BO diff --git a/drivers/gpu/drm/xe/xe_bo.h b/drivers/gpu/drm/xe/xe_bo.h index a885b14bf595..6de894c728f5 100644 --- a/drivers/gpu/drm/xe/xe_bo.h +++ b/drivers/gpu/drm/xe/xe_bo.h @@ -206,6 +206,7 @@ bool mem_type_is_vram(u32 mem_type); bool xe_bo_is_vram(struct xe_bo *bo); bool xe_bo_is_stolen(struct xe_bo *bo); bool xe_bo_is_stolen_devmem(struct xe_bo *bo); +bool xe_bo_has_single_placement(struct xe_bo *bo); uint64_t vram_region_gpu_offset(struct ttm_resource *res); bool xe_bo_can_migrate(struct xe_bo *bo, u32 mem_type); -- 2.42.0