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 v6 5/7] drm/xe/vf: Add bounds checking for queried GGTT base and size
Date: Fri, 21 Aug 2026 12:27:07 +0200	[thread overview]
Message-ID: <5b6312c9-7bd6-4a36-bb64-cd5d63298499@intel.com> (raw)
In-Reply-To: <20260812124313.1377582-14-satyanarayana.k.v.p@intel.com>



On 8/12/2026 2:43 PM, Satyanarayana K V P wrote:
> Add explicit bounds checks for GGTT base and size which can detect
> and reject invalid configuration data from a misconfigured or
> malfunctioning PF, preventing protocol violations and protecting VF
> initialization.
> 
> Signed-off-by: Satyanarayana K V P <satyanarayana.k.v.p@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> ---
> V5 -> V6:
> - Updated error codes for unaligned GGTT base and size (Michal W).
> - Fixed review comments (Michal W).
> 
> V4 -> V5:
> - New commit.
> ---
>  drivers/gpu/drm/xe/xe_gt_sriov_vf.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> index 81d68fe5ad7c..d805c064377c 100644
> --- a/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> +++ b/drivers/gpu/drm/xe/xe_gt_sriov_vf.c
> @@ -488,6 +488,7 @@ u32 xe_gt_sriov_vf_gmdid(struct xe_gt *gt)
>  
>  static int vf_get_ggtt_info(struct xe_gt *gt)
>  {
> +	u64 alignment = xe_vram_alignment(gt_to_xe(gt));
>  	struct xe_tile *tile = gt_to_tile(gt);
>  	struct xe_guc *guc = &gt->uc.guc;
>  	u64 start, size, ggtt_size;
> @@ -526,6 +527,18 @@ static int vf_get_ggtt_info(struct xe_gt *gt)
>  		return -EREMCHG;
>  	}
>  
> +	if (!IS_ALIGNED(start, alignment)) {
> +		xe_gt_sriov_err(gt, "Unaligned GGTT base: %llu, expected %llu\n",
> +				start, ALIGN(start, alignment));
> +		return -EINVAL;
> +	}
> +
> +	if (!IS_ALIGNED(size, alignment)) {
> +		xe_gt_sriov_err(gt, "Unaligned GGTT size %llu, expected %llu\n",
> +				size, ALIGN(size, alignment));
> +		return -EINVAL;
> +	}
> +

as Sashiko pointed out, likely from

commit e904c56ba6e0d4eff5f48a70356fd5d764c2a966
    drm/xe: Rewrite GGTT VF initialization

we are doing some checks too late, including these new one

can you fix the existing check first, then add new ones?

>  	xe_gt_sriov_dbg_verbose(gt, "GGTT %#llx-%#llx = %lluK\n",
>  				start, start + size - 1, size / SZ_1K);
>  


  parent reply	other threads:[~2026-08-21 10:27 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-12 12:43 [PATCH v6 0/7] KUnit test for VF provisioning error handling Satyanarayana K V P
2026-08-12 12:43 ` [PATCH v6 1/7] drm/xe/guc: Allow to replace xe_guc_mmio_send_recv() with KUNIT stub Satyanarayana K V P
2026-08-12 12:43 ` [PATCH v6 2/7] drm/xe/vf: Split submission config query helpers Satyanarayana K V P
2026-08-12 12:43 ` [PATCH v6 3/7] drm/xe/vf: Add bounds checking for queried context and doorbell counts Satyanarayana K V P
2026-08-12 12:43 ` [PATCH v6 4/7] drm/xe: Introduce helpers for xe_vram size Satyanarayana K V P
2026-08-12 12:55   ` sashiko-bot
2026-08-21 10:04   ` Michal Wajdeczko
2026-08-12 12:43 ` [PATCH v6 5/7] drm/xe/vf: Add bounds checking for queried GGTT base and size Satyanarayana K V P
2026-08-12 12:55   ` sashiko-bot
2026-08-21 10:27   ` Michal Wajdeczko [this message]
2026-08-12 12:43 ` [PATCH v6 6/7] drm/xe/vf: Add bounds checking for queried VRAM size Satyanarayana K V P
2026-08-12 13:02   ` sashiko-bot
2026-08-21 10:31   ` Michal Wajdeczko
2026-08-12 12:43 ` [PATCH v6 7/7] drm/xe/tests: Add KUnit tests for VF provisioning error handling Satyanarayana K V P
2026-08-12 13:00   ` sashiko-bot
2026-08-21 11:01   ` Michal Wajdeczko
2026-08-12 13:18 ` ✗ CI.checkpatch: warning for KUnit test for VF provisioning error handling (rev6) Patchwork
2026-08-12 13:19 ` ✓ CI.KUnit: success " Patchwork
2026-08-12 14:20 ` ✓ Xe.CI.BAT: " Patchwork
2026-08-12 18:27 ` ✓ 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=5b6312c9-7bd6-4a36-bb64-cd5d63298499@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