Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Subject: [PATCH v7 12/12] drm/xe: Remove xe_ggtt_node_allocated
Date: Wed, 15 Oct 2025 09:47:21 +0200	[thread overview]
Message-ID: <20251015074708.1654014-26-dev@lankhorst.se> (raw)
In-Reply-To: <20251015074708.1654014-14-dev@lankhorst.se>

With the intermediate state gone, no longer useful. Just check against
NULL.

Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
 drivers/gpu/drm/xe/display/xe_fb_pin.c     |  3 +--
 drivers/gpu/drm/xe/xe_ggtt.c               | 14 --------------
 drivers/gpu/drm/xe/xe_ggtt.h               |  1 -
 drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 12 ++++++------
 4 files changed, 7 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index 784d2db5fd0db..6592b000950ff 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -350,8 +350,7 @@ static void __xe_unpin_fb_vma(struct i915_vma *vma)
 
 	if (vma->dpt)
 		xe_bo_unpin_map_no_vm(vma->dpt);
-	else if (!xe_ggtt_node_allocated(vma->bo->ggtt_node[tile_id]) ||
-		 vma->bo->ggtt_node[tile_id] != vma->node)
+	else if (vma->bo->ggtt_node[tile_id] != vma->node)
 		xe_ggtt_node_remove(vma->node, false);
 
 	ttm_bo_reserve(&vma->bo->ttm, false, false, NULL);
diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
index e4e8be114786a..e9ab8d9415412 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -656,20 +656,6 @@ struct xe_ggtt_node *xe_ggtt_node_insert(struct xe_ggtt *ggtt, u32 size, u32 ali
 	return node;
 }
 
-/**
- * xe_ggtt_node_allocated - Check if node is allocated in GGTT
- * @node: the &xe_ggtt_node to be inspected
- *
- * Return: True if allocated, False otherwise.
- */
-bool xe_ggtt_node_allocated(const struct xe_ggtt_node *node)
-{
-	if (!node || !node->ggtt)
-		return false;
-
-	return drm_mm_node_allocated(&node->base);
-}
-
 /**
  * xe_ggtt_map_bo - Map the BO into GGTT
  * @ggtt: the &xe_ggtt where node will be mapped
diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
index d0ad541a40baf..e32a14ac63665 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.h
+++ b/drivers/gpu/drm/xe/xe_ggtt.h
@@ -30,7 +30,6 @@ xe_ggtt_node_insert_transform(struct xe_ggtt *ggtt,
 			      u64 size, u32 align,
 			      xe_ggtt_transform_cb transform, void *arg);
 void xe_ggtt_node_remove(struct xe_ggtt_node *node, bool invalidate);
-bool xe_ggtt_node_allocated(const struct xe_ggtt_node *node);
 void xe_ggtt_map_bo_unlocked(struct xe_ggtt *ggtt, struct xe_bo *bo);
 int xe_ggtt_insert_bo(struct xe_ggtt *ggtt, struct xe_bo *bo, struct drm_exec *exec);
 int xe_ggtt_insert_bo_at(struct xe_ggtt *ggtt, struct xe_bo *bo,
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
index d71041a611d35..db47b49e5842c 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -261,7 +261,7 @@ static u32 encode_config_ggtt(u32 *cfg, const struct xe_gt_sriov_config *config,
 {
 	struct xe_ggtt_node *node = config->ggtt_region;
 
-	if (!xe_ggtt_node_allocated(node))
+	if (!node)
 		return 0;
 
 	return encode_ggtt(cfg, xe_ggtt_node_addr(node), config->ggtt_size, details);
@@ -455,7 +455,7 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)
 
 	size = round_up(size, alignment);
 
-	if (xe_ggtt_node_allocated(config->ggtt_region)) {
+	if (config->ggtt_region) {
 		err = pf_distribute_config_ggtt(tile, vfid, 0, 0);
 		if (unlikely(err))
 			return err;
@@ -466,7 +466,7 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)
 		if (unlikely(err))
 			return err;
 	}
-	xe_gt_assert(gt, !xe_ggtt_node_allocated(config->ggtt_region));
+	xe_gt_assert(gt, !config->ggtt_region);
 
 	if (!size)
 		return 0;
@@ -497,7 +497,7 @@ static u64 pf_get_vf_config_ggtt(struct xe_gt *gt, unsigned int vfid)
 	struct xe_ggtt_node *node = config->ggtt_region;
 
 	xe_gt_assert(gt, xe_gt_is_main_type(gt));
-	return xe_ggtt_node_allocated(node) ? config->ggtt_size : 0;
+	return node ? config->ggtt_size : 0;
 }
 
 /**
@@ -2049,7 +2049,7 @@ int xe_gt_sriov_pf_config_release(struct xe_gt *gt, unsigned int vfid, bool forc
 
 static void pf_sanitize_ggtt(struct xe_ggtt_node *ggtt_region, unsigned int vfid)
 {
-	if (xe_ggtt_node_allocated(ggtt_region))
+	if (ggtt_region)
 		xe_ggtt_assign(ggtt_region, vfid);
 }
 
@@ -2496,7 +2496,7 @@ int xe_gt_sriov_pf_config_print_ggtt(struct xe_gt *gt, struct drm_printer *p)
 
 	for (n = 1; n <= total_vfs; n++) {
 		config = &gt->sriov.pf.vfs[n].config;
-		if (!xe_ggtt_node_allocated(config->ggtt_region))
+		if (!config->ggtt_region)
 			continue;
 
 		string_get_size(config->ggtt_size, 1, STRING_UNITS_2,
-- 
2.51.0


  parent reply	other threads:[~2025-10-15  7:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  7:47 [PATCH v7 00/12] drm/xe: Make all xe_ggtt structs private Maarten Lankhorst
2025-10-15  7:47 ` [PATCH v7 01/12] drm/xe: Start using ggtt->start in preparation of balloon removal Maarten Lankhorst
2025-10-15  7:47 ` [PATCH v7 02/12] drm/xe: Convert xe_fb_pin to use a callback for insertion into GGTT Maarten Lankhorst
2025-10-15  7:47 ` [PATCH v7 03/12] drm/xe: Add xe_ggtt_node_addr() to avoid dereferencing xe_ggtt_node Maarten Lankhorst
2025-10-15 21:49   ` Matthew Brost
2025-10-16  6:13     ` Maarten Lankhorst
2025-10-17 20:53       ` Matthew Brost
2025-10-15  7:47 ` [PATCH v7 04/12] drm/xe/display: Avoid " Maarten Lankhorst
2025-10-15 21:53   ` Matthew Brost
2025-10-15  7:47 ` [PATCH v7 05/12] drm/xe: Do not dereference ggtt_node in xe_bo.c Maarten Lankhorst
2025-10-15 21:58   ` Matthew Brost
2025-10-16  6:33     ` Maarten Lankhorst
2025-10-17 20:54       ` Matthew Brost
2025-10-15  7:47 ` [PATCH v7 06/12] drm/xe: Improve xe_gt_sriov_pf_config GGTT handling Maarten Lankhorst
2025-10-15 22:04   ` Matthew Brost
2025-10-16  8:50     ` Michal Wajdeczko
2025-10-16 13:46       ` Maarten Lankhorst
2025-10-16 13:58         ` Michal Wajdeczko
2025-10-15  7:47 ` [PATCH v7 07/12] drm/xe: Privatize xe_ggtt_node Maarten Lankhorst
2025-10-15 22:05   ` Matthew Brost
2025-10-15  7:47 ` [PATCH v7 08/12] drm/xe: Make xe_ggtt_node offset relative to starting offset Maarten Lankhorst
2025-10-15 22:38   ` Matthew Brost
2025-10-16  6:40     ` Maarten Lankhorst
2025-10-15  7:47 ` [PATCH v7 09/12] drm/xe: Rewrite GGTT VF initialisation Maarten Lankhorst
2025-10-16  0:30   ` Matthew Brost
2025-10-15  7:47 ` [PATCH v7 10/12] drm/xe: Move struct xe_ggtt to xe_ggtt.c Maarten Lankhorst
2025-10-15  7:47 ` [PATCH v7 11/12] drm/xe: Make xe_ggtt_node_insert return a node Maarten Lankhorst
2025-10-15 22:44   ` Matthew Brost
2025-10-15  7:47 ` Maarten Lankhorst [this message]
2025-10-15 22:41   ` [PATCH v7 12/12] drm/xe: Remove xe_ggtt_node_allocated Matthew Brost
2025-10-15  9:47 ` ✗ CI.checkpatch: warning for drm/xe: Make all xe_ggtt structs private. (rev2) Patchwork
2025-10-15  9:49 ` ✓ CI.KUnit: success " Patchwork
2025-10-15 11:03 ` ✓ Xe.CI.BAT: " Patchwork
2025-10-15 19:55 ` ✗ Xe.CI.Full: failure " Patchwork

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=20251015074708.1654014-26-dev@lankhorst.se \
    --to=dev@lankhorst.se \
    --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