Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nirmoy Das <nirmoy.das@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Nirmoy Das <nirmoy.das@intel.com>
Subject: [PATCH 2/3] drm/xe: Add function to check if BO has single placement
Date: Wed, 10 Apr 2024 19:03:07 +0200	[thread overview]
Message-ID: <20240410170308.409-3-nirmoy.das@intel.com> (raw)
In-Reply-To: <20240410170308.409-1-nirmoy.das@intel.com>

A new helper function xe_bo_has_single_placement() to check
if a BO has single placement.

Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
---
 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 fdeb3691d3f6..281126667ba7 100644
--- a/drivers/gpu/drm/xe/xe_bo.c
+++ b/drivers/gpu/drm/xe/xe_bo.c
@@ -94,6 +94,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


  parent reply	other threads:[~2024-04-10 17:17 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10 17:03 [PATCH 0/3] Enable device atomics with a VM bind flag Nirmoy Das
2024-04-10 17:03 ` [PATCH 1/3] drm/xe: Consolidate setting PTE_AE into one place Nirmoy Das
2024-04-11 23:22   ` Matt Roper
2024-04-12  9:34     ` Nirmoy Das
2024-04-12 11:33       ` Nirmoy Das
2024-04-10 17:03 ` Nirmoy Das [this message]
2024-04-10 17:03 ` [PATCH 3/3] drm/xe/uapi: Introduce VMA bind flag for device atomics Nirmoy Das
2024-04-10 17:35   ` Matthew Brost
2024-04-11  9:22     ` Nirmoy Das
2024-04-11 14:00     ` Nirmoy Das
2024-04-11 13:14   ` Lionel Landwerlin
2024-04-11 13:32     ` Lionel Landwerlin
2024-04-11 13:42     ` Nirmoy Das
2024-04-11 14:00       ` Lionel Landwerlin
2024-04-11 14:07         ` Souza, Jose
2024-04-11 14:32           ` Nirmoy Das
2024-04-11 14:40             ` Souza, Jose
2024-04-11 14:54               ` Nirmoy Das
2024-04-11 23:44   ` Matt Roper
2024-04-12  8:06     ` Nirmoy Das
2024-04-10 18:04 ` ✓ CI.Patch_applied: success for Enable device atomics with a VM bind flag Patchwork
2024-04-10 18:04 ` ✓ CI.checkpatch: " Patchwork
2024-04-10 18:04 ` ✗ CI.KUnit: failure " Patchwork
2024-04-11 16:22 ` [PATCH 0/3] " Zeng, Oak
2024-04-11 17:00   ` Nirmoy Das
2024-04-11 17:23     ` Zeng, Oak
2024-04-12  5:06       ` Mrozek, Michal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240410170308.409-3-nirmoy.das@intel.com \
    --to=nirmoy.das@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox