From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>,
Michal Wajdeczko <michal.wajdeczko@intel.com>
Subject: [PATCH v8 5/5] drm/xe: Remove xe_ggtt_node_allocated
Date: Fri, 6 Feb 2026 12:21:14 +0100 [thread overview]
Message-ID: <20260206112108.1453809-12-dev@lankhorst.se> (raw)
In-Reply-To: <20260206112108.1453809-7-dev@lankhorst.se>
With the intermediate state gone, no longer useful. Just check against
NULL where needed.
After looking carefully, the check for allocated in xe_fb_pin.c is
unneeded. vma->node is never NULL. The check is specifically only
to check if vma->node == the bo's root tile ggtt_obj.
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
Changelog:
- Update commit message to explain the change in xe_fb_pin.c
---
drivers/gpu/drm/xe/display/xe_fb_pin.c | 3 +--
drivers/gpu/drm/xe/xe_ggtt.c | 17 -----------------
drivers/gpu/drm/xe/xe_ggtt.h | 1 -
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 12 ++++++------
4 files changed, 7 insertions(+), 26 deletions(-)
diff --git a/drivers/gpu/drm/xe/display/xe_fb_pin.c b/drivers/gpu/drm/xe/display/xe_fb_pin.c
index 5ff583699325c..e1d29b6ba043e 100644
--- a/drivers/gpu/drm/xe/display/xe_fb_pin.c
+++ b/drivers/gpu/drm/xe/display/xe_fb_pin.c
@@ -352,8 +352,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 d2d00ba2aae6a..d162f617ca4c6 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.c
+++ b/drivers/gpu/drm/xe/xe_ggtt.c
@@ -665,20 +665,6 @@ struct xe_ggtt_node *xe_ggtt_insert_node(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_node_pt_size() - Get the size of page table entries needed to map a GGTT node.
* @node: the &xe_ggtt_node
@@ -971,9 +957,6 @@ static void xe_ggtt_assign_locked(const struct xe_ggtt_node *node, u16 vfid)
lockdep_assert_held(&ggtt->lock);
- if (!xe_ggtt_node_allocated(node))
- return;
-
while (start < end) {
ggtt->pt_ops->ggtt_set_pte(ggtt, start, pte);
start += XE_PAGE_SIZE;
diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
index 9e6210c6f44ea..c864cc975a695 100644
--- a/drivers/gpu/drm/xe/xe_ggtt.h
+++ b/drivers/gpu/drm/xe/xe_ggtt.h
@@ -30,7 +30,6 @@ xe_ggtt_insert_node_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);
size_t xe_ggtt_node_pt_size(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);
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 3fe664cd3b88c..888193e1d2c50 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -279,7 +279,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), xe_ggtt_node_size(node), details);
@@ -503,7 +503,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;
@@ -514,7 +514,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;
@@ -544,7 +544,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) ? xe_ggtt_node_size(node) : 0;
+ return node ? xe_ggtt_node_size(node) : 0;
}
/**
@@ -2558,7 +2558,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);
}
@@ -3017,7 +3017,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 = >->sriov.pf.vfs[n].config;
- if (!xe_ggtt_node_allocated(config->ggtt_region))
+ if (!config->ggtt_region)
continue;
string_get_size(xe_ggtt_node_size(config->ggtt_region), 1, STRING_UNITS_2,
--
2.51.0
next prev parent reply other threads:[~2026-02-06 11:21 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-06 11:21 [PATCH v8 0/5] drm/xe: Privatize struct xe_ggtt Maarten Lankhorst
2026-02-06 11:21 ` [PATCH v8 1/5] drm/xe: Make xe_ggtt_node offset relative to starting offset Maarten Lankhorst
2026-02-06 11:21 ` [PATCH v8 2/5] drm/xe: Rewrite GGTT VF initialization Maarten Lankhorst
2026-02-06 11:36 ` [PATCH v8.1] " Maarten Lankhorst
2026-02-06 11:21 ` [PATCH v8 3/5] drm/xe: Move struct xe_ggtt to xe_ggtt.c Maarten Lankhorst
2026-02-06 11:21 ` [PATCH v8 4/5] drm/xe: Make xe_ggtt_node_insert return a node Maarten Lankhorst
2026-02-06 11:21 ` Maarten Lankhorst [this message]
2026-02-06 11:41 ` ✗ CI.checkpatch: warning for drm/xe: Privatize struct xe_ggtt. (rev7) Patchwork
2026-02-06 11:42 ` ✓ CI.KUnit: success " Patchwork
2026-02-06 12:16 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-07 13:22 ` ✗ 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=20260206112108.1453809-12-dev@lankhorst.se \
--to=dev@lankhorst.se \
--cc=intel-xe@lists.freedesktop.org \
--cc=michal.wajdeczko@intel.com \
/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