From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Maarten Lankhorst <dev@lankhorst.se>, <intel-xe@lists.freedesktop.org>
Cc: <Matthew.brost@intel.com>
Subject: Re: [PATCH 6/7] drm/xe: Improve xe_gt_sriov_pf_config GGTT handling
Date: Tue, 21 Oct 2025 14:46:33 +0200 [thread overview]
Message-ID: <11ea7192-9f72-419e-a694-3cf4aabf7be5@intel.com> (raw)
In-Reply-To: <20251021121814.2193153-15-dev@lankhorst.se>
On 10/21/2025 2:18 PM, Maarten Lankhorst wrote:
> Do not directly dereference xe_ggtt_node, and add
> a function to retrieve the allocated GGTT size.
>
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
> Reviewed-by: <Matthew.brost@intel.com>
> Signed-off-by: Maarten Lankhorst <dev@lankhorst.se>
double s-o-b
> ---
> drivers/gpu/drm/xe/xe_ggtt.c | 11 +++++++++++
> drivers/gpu/drm/xe/xe_ggtt.h | 1 +
> drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c | 15 ++++++++-------
> 3 files changed, 20 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.c b/drivers/gpu/drm/xe/xe_ggtt.c
> index 05515037e2d6a..81038d94b497d 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.c
> +++ b/drivers/gpu/drm/xe/xe_ggtt.c
> @@ -1090,3 +1090,14 @@ u64 xe_ggtt_node_addr(const struct xe_ggtt_node *node)
> {
> return node->base.start;
> }
> +
> +/**
> + * xe_ggtt_node_size - Get @node allocation size.
> + * @node: &xe_ggtt_node
> + *
> + * Get the allocated node's size.
* Return: ...
> + */
> +u64 xe_ggtt_node_size(const struct xe_ggtt_node *node)
> +{
> + return node->base.size;
> +}
> diff --git a/drivers/gpu/drm/xe/xe_ggtt.h b/drivers/gpu/drm/xe/xe_ggtt.h
> index 4a8ef1b824156..b69f05a6adbf8 100644
> --- a/drivers/gpu/drm/xe/xe_ggtt.h
> +++ b/drivers/gpu/drm/xe/xe_ggtt.h
> @@ -59,5 +59,6 @@ u64 xe_ggtt_encode_pte_flags(struct xe_ggtt *ggtt, struct xe_bo *bo, u16 pat_ind
> u64 xe_ggtt_read_pte(struct xe_ggtt *ggtt, u64 offset);
>
> u64 xe_ggtt_node_addr(const struct xe_ggtt_node *node);
> +u64 xe_ggtt_node_size(const struct xe_ggtt_node *node);
>
> #endif
> 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 f96f96425c2ec..19d1013d0c4c8 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), xe_ggtt_node_size(node), details);
> }
>
> /* Return: number of configuration dwords written */
> @@ -495,9 +495,9 @@ 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;
>
> @@ -514,7 +514,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) ? xe_ggtt_node_size(node) : 0;
> }
>
> /**
> @@ -2517,11 +2517,12 @@ 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(xe_ggtt_node_size(config->ggtt_region), 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) +
> + xe_ggtt_node_size(config->ggtt_region) - 1,
> buf);
> }
>
just nits, so
Reviewed-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
next prev parent reply other threads:[~2025-10-21 12:46 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-21 12:18 [PATCH 0/7] drm/xe: Privatize struct xe_ggtt_node Maarten Lankhorst
2025-10-21 12:18 ` [PATCH 1/7] drm/xe: Start using ggtt->start in preparation of balloon removal Maarten Lankhorst
2025-10-21 12:18 ` [PATCH 2/7] drm/xe: Convert xe_fb_pin to use a callback for insertion into GGTT Maarten Lankhorst
2025-10-21 12:18 ` [PATCH 3/7] drm/xe: Add xe_ggtt_node_addr() to avoid dereferencing xe_ggtt_node Maarten Lankhorst
2025-10-21 13:15 ` Michal Wajdeczko
2025-10-21 13:48 ` Maarten Lankhorst
2025-10-21 12:18 ` [PATCH 4/7] drm/xe/display: Avoid " Maarten Lankhorst
2025-10-21 12:18 ` [PATCH 5/7] drm/xe: Do not dereference ggtt_node in xe_bo.c Maarten Lankhorst
2025-10-21 12:18 ` [PATCH 6/7] drm/xe: Improve xe_gt_sriov_pf_config GGTT handling Maarten Lankhorst
2025-10-21 12:46 ` Michal Wajdeczko [this message]
2025-10-21 12:18 ` [PATCH 7/7] drm/xe: Privatize xe_ggtt_node Maarten Lankhorst
2025-10-21 13:49 ` ✗ CI.checkpatch: warning for drm/xe: Privatize struct xe_ggtt_node Patchwork
2025-10-21 13:50 ` ✗ CI.KUnit: 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=11ea7192-9f72-419e-a694-3cf4aabf7be5@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=Matthew.brost@intel.com \
--cc=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