Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>,
	<intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH v10 06/10] drm/xe/sriov: Add helper for VF GGTT provisioning alignment
Date: Mon, 21 Sep 2026 15:26:55 +0200	[thread overview]
Message-ID: <ca165f68-b84e-4a78-af7d-03c32185ffe7@intel.com> (raw)
In-Reply-To: <20260921092101.1243989-18-satyanarayana.k.v.p@intel.com>



On 9/21/2026 11:21 AM, Satyanarayana K V P wrote:
> The alignment of a GGTT range provisioned to a VF is part of the PF/VF
> contract: the PF must allocate the range with it, and the VF must be
> able to verify that the range it was assigned respects it. Since PF and
> VF run on the same hardware, both can derive the value independently.
> 
> Move it to xe_sriov_ggtt_alignment() so both sides share a single
> definition.
> 
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> V9 -> V10:
> - Created a new helper to get the GGTT allocation (Sashiko).
> 
> V8 -> V9:
> - Update PF GGTT alignment to XE_PAGE_SIZE (Sashiko).
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c |  4 +---
>  drivers/gpu/drm/xe/xe_sriov.c              | 11 +++++++++++
>  drivers/gpu/drm/xe/xe_sriov.h              |  1 +
>  3 files changed, 13 insertions(+), 3 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 6947aeed458e..04ee0fc08804 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_pf_config.c
> @@ -441,9 +441,7 @@ static int pf_refresh_vf_cfg(struct xe_gt *gt, unsigned int vfid)
>  
>  static u64 pf_get_ggtt_alignment(struct xe_gt *gt)
>  {
> -	struct xe_device *xe = gt_to_xe(gt);
> -
> -	return IS_DGFX(xe) && xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K ? SZ_64K : SZ_4K;
> +	return xe_sriov_ggtt_alignment(gt_to_xe(gt));

hmm, while looking at __xe_ggtt_insert_bo_at()

	if (xe_bo_is_vram(bo) && ggtt->flags & XE_GGTT_FLAGS_64K)
		alignment = SZ_64K;

where 64K alignment is enforced only for VRAM objects, maybe current
implementation of pf_get_ggtt_alignment() does too much and is too
restrictive by forcing a GGTT provisioning to 64K alignment, as it is
still a VF responsibility to use GGTT wisely, and can use 4K alignment
for system memory

>  }
>  
>  static u64 pf_get_min_spare_ggtt(struct xe_gt *gt)
> diff --git a/drivers/gpu/drm/xe/xe_sriov.c b/drivers/gpu/drm/xe/xe_sriov.c
> index f3835867fce5..d7704d226554 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.c
> +++ b/drivers/gpu/drm/xe/xe_sriov.c
> @@ -174,3 +174,14 @@ int xe_sriov_init_late(struct xe_device *xe)
>  
>  	return 0;
>  }
> +
> +/**
> + * xe_sriov_ggtt_alignment() - Alignment of the GGTT range provisioned to a VF.
> + * @xe: the &xe_device
> + *
> + * Return: Alignment in bytes.
> + */
> +u64 xe_sriov_ggtt_alignment(struct xe_device *xe)

hmm, it doesn't look like a SR-IOV specific function

maybe it should be introduced earlier in the series in xe_ggtt.h as:

	u64 xe_ggtt_alignment(struct xe_ggtt *ggtt);

but given the comment above, maybe there is no such thing as "GGTT
alignment" at all, or it is always 4K and we don't need this function?

> +{
> +	return xe_vram_alignment(xe);
> +}
> diff --git a/drivers/gpu/drm/xe/xe_sriov.h b/drivers/gpu/drm/xe/xe_sriov.h
> index 72e55543c30e..ee770afca00b 100644
> --- a/drivers/gpu/drm/xe/xe_sriov.h
> +++ b/drivers/gpu/drm/xe/xe_sriov.h
> @@ -19,6 +19,7 @@ void xe_sriov_probe_early(struct xe_device *xe);
>  void xe_sriov_print_info(struct xe_device *xe, struct drm_printer *p);
>  int xe_sriov_init(struct xe_device *xe);
>  int xe_sriov_init_late(struct xe_device *xe);
> +u64 xe_sriov_ggtt_alignment(struct xe_device *xe);
>  
>  static inline enum xe_sriov_mode xe_device_sriov_mode(const struct xe_device *xe)
>  {


  reply	other threads:[~2026-09-21 13:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-21  9:20 [PATCH v10 00/10] KUnit test for VF provisioning error handling Satyanarayana K V P
2026-09-21  9:21 ` [PATCH v10 01/10] drm/xe/guc: Allow to replace xe_guc_mmio_send_recv() with KUNIT stub Satyanarayana K V P
2026-09-21  9:21 ` [PATCH v10 02/10] drm/xe/vf: Split submission config query helpers Satyanarayana K V P
2026-09-21  9:21 ` [PATCH v10 03/10] drm/xe/vf: Add bounds checking for queried context and doorbell counts Satyanarayana K V P
2026-09-21  9:21 ` [PATCH v10 04/10] drm/xe: Introduce helpers for VRAM alignment Satyanarayana K V P
2026-09-21  9:21 ` [PATCH v10 05/10] drm/xe/ggtt: Avoid integer overflow when validating VF GGTT range Satyanarayana K V P
2026-09-21 14:03   ` Michal Wajdeczko
2026-09-21  9:21 ` [PATCH v10 06/10] drm/xe/sriov: Add helper for VF GGTT provisioning alignment Satyanarayana K V P
2026-09-21 13:26   ` Michal Wajdeczko [this message]
2026-09-21  9:21 ` [PATCH v10 07/10] drm/xe/vf: Add bounds checking for queried GGTT base and size Satyanarayana K V P
2026-09-21 14:36   ` Michal Wajdeczko
2026-09-21  9:21 ` [PATCH v10 08/10] drm/xe/vf: Add alignment check for queried VRAM size Satyanarayana K V P
2026-09-21  9:21 ` [PATCH v10 09/10] drm/xe/ggtt: Add KUnit stub for xe_ggtt_shift_nodes() Satyanarayana K V P
2026-09-21 14:45   ` Michal Wajdeczko
2026-09-21  9:21 ` [PATCH v10 10/10] drm/xe/tests: Add KUnit tests for VF provisioning error handling Satyanarayana K V P
2026-09-21 16:47   ` Michal Wajdeczko
2026-09-21  9:49 ` ✗ CI.checkpatch: warning for KUnit test for VF provisioning error handling (rev10) Patchwork
2026-09-21  9:51 ` ✓ CI.KUnit: success " Patchwork
2026-09-21 11:32 ` ✗ Xe.CI.BAT: failure " Patchwork
2026-09-21 14:10 ` ✗ Xe.CI.FULL: " 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=ca165f68-b84e-4a78-af7d-03c32185ffe7@intel.com \
    --to=michal.wajdeczko@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=satyanarayana.k.v.p@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