All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhenyu Wang <zhenyuw.linux@gmail.com>
To: Jonathan Cavitt <jonathan.cavitt@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: saurabhg.gupta@intel.com, alex.zuo@intel.com, jonathan.cavitt@intel.com
Subject: Re: [PATCH] drm/i915/gvt: Cast u64 array to u32 array
Date: Fri, 13 Feb 2026 18:42:14 +0800	[thread overview]
Message-ID: <87o6lsylfd.fsf@dell-wzy> (raw)
In-Reply-To: <20260212194131.64708-2-jonathan.cavitt@intel.com>

Jonathan Cavitt <jonathan.cavitt@intel.com> writes:

> Static analysis issue:
>
> The u64 array workload->shadow_mm->ppgtt_mm.shadow_pdps is cast to a
> void pointer and passed as a u32 array to set_context_pdp_root_pointer
> as a part of update_shadow_pdps.  This isn't wrong, per se, but we
> should properly cast it to an appropriately-sized u32 array before
> submission.
>
> Signed-off-by: Jonathan Cavitt <jonathan.cavitt@intel.com>
> ---
>  drivers/gpu/drm/i915/gvt/scheduler.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gvt/scheduler.c b/drivers/gpu/drm/i915/gvt/scheduler.c
> index 15fdd514ca83..1a95c9f76faa 100644
> --- a/drivers/gpu/drm/i915/gvt/scheduler.c
> +++ b/drivers/gpu/drm/i915/gvt/scheduler.c
> @@ -72,6 +72,7 @@ static void update_shadow_pdps(struct intel_vgpu_workload *workload)
>  {
>  	struct execlist_ring_context *shadow_ring_context;
>  	struct intel_context *ctx = workload->req->context;
> +	u32 pdp[8];
>  
>  	if (WARN_ON(!workload->shadow_mm))
>  		return;
> @@ -79,9 +80,10 @@ static void update_shadow_pdps(struct intel_vgpu_workload *workload)
>  	if (WARN_ON(!atomic_read(&workload->shadow_mm->pincount)))
>  		return;
>  
> +	memcpy(pdp, workload->shadow_mm->ppgtt_mm.shadow_pdps,
> +	       sizeof(u64) * ARRAY_SIZE(workload->shadow_mm->ppgtt_mm.shadow_pdps));
>  	shadow_ring_context = (struct execlist_ring_context *)ctx->lrc_reg_state;
> -	set_context_pdp_root_pointer(shadow_ring_context,
> -			(void *)workload->shadow_mm->ppgtt_mm.shadow_pdps);
> +	set_context_pdp_root_pointer(shadow_ring_context, pdp);
>  }
>  

I think we'd better just cast the type instead of extra copy.

  parent reply	other threads:[~2026-02-13 10:42 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-12 19:41 [PATCH] drm/i915/gvt: Cast u64 array to u32 array Jonathan Cavitt
2026-02-12 21:05 ` ✓ i915.CI.BAT: success for " Patchwork
2026-02-12 23:48 ` ✗ i915.CI.Full: failure " Patchwork
2026-02-13 10:42 ` Zhenyu Wang [this message]
2026-02-13 16:27   ` [PATCH] " Cavitt, Jonathan
2026-02-19 20:43     ` Cavitt, Jonathan
2026-02-24  7:29       ` Krzysztof Karas
2026-02-20 14:40     ` Zhenyu Wang
2026-02-20 16:03       ` Cavitt, Jonathan
2026-02-21 15:34         ` Zhenyu Wang

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=87o6lsylfd.fsf@dell-wzy \
    --to=zhenyuw.linux@gmail.com \
    --cc=alex.zuo@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jonathan.cavitt@intel.com \
    --cc=saurabhg.gupta@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.