From: Maarten Lankhorst <dev@lankhorst.se>
To: intel-xe@lists.freedesktop.org
Cc: Maarten Lankhorst <dev@lankhorst.se>
Subject: [PATCH v6 06/12] drm/xe: Improve xe_gt_sriov_pf_config GGTT handling
Date: Tue, 14 Oct 2025 23:20:03 +0200 [thread overview]
Message-ID: <20251014211956.1607561-20-dev@lankhorst.se> (raw)
In-Reply-To: <20251014211956.1607561-14-dev@lankhorst.se>
Do not directly dereference xe_ggtt_node, and add
a member to store the GGTT size.
Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
---
drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 15 ++++++++-------
drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h | 8 ++++++--
2 files changed, 14 insertions(+), 9 deletions(-)
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 2289756761636..c0dfffd5c553b 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
@@ -264,7 +264,7 @@ static u32 encode_config_ggtt(u32 *cfg, const struct xe_gt_sriov_config *config,
if (!xe_ggtt_node_allocated(node))
return 0;
- return encode_ggtt(cfg, node->base.start, node->base.size, details);
+ return encode_ggtt(cfg, xe_ggtt_node_addr(node), config->ggtt_size, details);
}
/* Return: number of configuration dwords written */
@@ -495,13 +495,14 @@ static int pf_provision_vf_ggtt(struct xe_gt *gt, unsigned int vfid, u64 size)
xe_ggtt_assign(node, vfid);
xe_gt_sriov_dbg_verbose(gt, "VF%u assigned GGTT %llx-%llx\n",
- vfid, node->base.start, node->base.start + node->base.size - 1);
+ vfid, xe_ggtt_node_addr(node), xe_ggtt_node_addr(node) + size - 1);
- err = pf_distribute_config_ggtt(gt->tile, vfid, node->base.start, node->base.size);
+ err = pf_distribute_config_ggtt(gt->tile, vfid, xe_ggtt_node_addr(node), size);
if (unlikely(err))
goto err;
config->ggtt_region = node;
+ config->ggtt_size = size;
return 0;
err:
pf_release_ggtt(tile, node);
@@ -514,7 +515,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) ? node->base.size : 0;
+ return xe_ggtt_node_allocated(node) ? config->ggtt_size : 0;
}
/**
@@ -2516,11 +2517,11 @@ int xe_gt_sriov_pf_config_print_ggtt(struct xe_gt *gt, struct drm_printer *p)
if (!xe_ggtt_node_allocated(config->ggtt_region))
continue;
- string_get_size(config->ggtt_region->base.size, 1, STRING_UNITS_2,
+ string_get_size(config->ggtt_size, 1, STRING_UNITS_2,
buf, sizeof(buf));
drm_printf(p, "VF%u:\t%#0llx-%#llx\t(%s)\n",
- n, config->ggtt_region->base.start,
- config->ggtt_region->base.start + config->ggtt_region->base.size - 1,
+ n, xe_ggtt_node_addr(config->ggtt_region),
+ xe_ggtt_node_addr(config->ggtt_region) + config->ggtt_size - 1,
buf);
}
diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h
index 686c7b3b6d7a5..9a8e66c8b539f 100644
--- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h
+++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config_types.h
@@ -17,10 +17,14 @@ struct xe_bo;
* Used by the PF driver to maintain per-VF provisioning data.
*/
struct xe_gt_sriov_config {
- /** @ggtt_region: GGTT region assigned to the VF. */
- struct xe_ggtt_node *ggtt_region;
/** @lmem_obj: LMEM allocation for use by the VF. */
struct xe_bo *lmem_obj;
+
+ /** @ggtt_region: GGTT region assigned to the VF. */
+ struct xe_ggtt_node *ggtt_region;
+ /** @ggtt_size: Size of GGTT region */
+ u64 ggtt_size;
+
/** @num_ctxs: number of GuC contexts IDs. */
u16 num_ctxs;
/** @begin_ctx: start index of GuC context ID range. */
--
2.51.0
next prev parent reply other threads:[~2025-10-14 21:20 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 21:19 [PATCH v6 00/12] drm/xe: Make all xe_ggtt structs private Maarten Lankhorst
2025-10-14 21:19 ` [PATCH v6 01/12] drm/xe: Start using ggtt->start in preparation of balloon removal Maarten Lankhorst
2025-10-14 21:19 ` [PATCH v6 02/12] drm/xe: Convert xe_fb_pin to use a callback for insertion into GGTT Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 03/12] drm/xe: Add xe_ggtt_node_addr() to avoid dereferencing xe_ggtt_node Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 04/12] drm/xe/display: Avoid " Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 05/12] drm/xe: Do not dereference ggtt_node in xe_bo.c Maarten Lankhorst
2025-10-14 21:20 ` Maarten Lankhorst [this message]
2025-10-15 18:53 ` [PATCH v6 06/12] drm/xe: Improve xe_gt_sriov_pf_config GGTT handling Michal Wajdeczko
2025-10-14 21:20 ` [PATCH v6 07/12] drm/xe: Privatize xe_ggtt_node Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 08/12] drm/xe: Make xe_ggtt_node offset relative to starting offset Maarten Lankhorst
2025-10-15 19:37 ` Michal Wajdeczko
2025-10-14 21:20 ` [PATCH v6 09/12] drm/xe: Rewrite GGTT VF initialisation Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 10/12] drm/xe: Move struct xe_ggtt to xe_ggtt.c Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 11/12] drm/xe: Make xe_ggtt_node_insert return a node Maarten Lankhorst
2025-10-14 21:20 ` [PATCH v6 12/12] drm/xe: Remove xe_ggtt_node_allocated Maarten Lankhorst
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=20251014211956.1607561-20-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