intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: "Piorkowski, Piotr" <piotr.piorkowski@intel.com>,
	intel-gfx@lists.freedesktop.org
Cc: Michal Winiarski <michal.winiarski@intel.com>,
	Matthew Auld <matthew.auld@intel.com>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Verify dma_addr in gen8_ggtt_pte_encode
Date: Tue, 02 Mar 2021 11:52:47 +0000	[thread overview]
Message-ID: <161468596756.13469.2479317373307898338@build.alporthouse.com> (raw)
In-Reply-To: <20210224152925.1969970-1-piotr.piorkowski@intel.com>

Quoting Piorkowski, Piotr (2021-02-24 15:29:25)
> From: Piotr Piórkowski <piotr.piorkowski@intel.com>
> 
> Until now, the gen8_ggtt_pte_encode function, responsible for the preparation
> of GGTT PTE, has not verified in any way whether the address given as the
> parameter is correct.
> By adding a GGTT address mask, we can easily verify that dma_addr will not fit
> in the PTE field.
> While around, cleanup a place where we hold all GEN12 GGTT PTE masks,
> and the addition of the PTE description.
> 
> Bspec: 45015
> 
> Signed-off-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
> Cc: Matthew Auld <matthew.auld@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Michal Winiarski <michal.winiarski@intel.com>
> ---
>  drivers/gpu/drm/i915/gt/intel_ggtt.c |  2 ++
>  drivers/gpu/drm/i915/gt/intel_gtt.h  | 13 ++++++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gt/intel_ggtt.c b/drivers/gpu/drm/i915/gt/intel_ggtt.c
> index b0b8ded834f0..52b2428da431 100644
> --- a/drivers/gpu/drm/i915/gt/intel_ggtt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_ggtt.c
> @@ -193,6 +193,8 @@ static u64 gen8_ggtt_pte_encode(dma_addr_t addr,
>  {
>         gen8_pte_t pte = addr | _PAGE_PRESENT;
>  
> +       GEM_BUG_ON(addr & ~GEN12_GGTT_PTE_ADDR_MASK);

You can also check the dma_get_mask() doesn't exceed the addr mask.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

      parent reply	other threads:[~2021-03-02 11:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 15:29 [Intel-gfx] [PATCH] drm/i915: Verify dma_addr in gen8_ggtt_pte_encode Piorkowski, Piotr
2021-02-24 19:30 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2021-02-24 19:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-02-24 21:31 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-03-02 11:52 ` Chris Wilson [this message]

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=161468596756.13469.2479317373307898338@build.alporthouse.com \
    --to=chris@chris-wilson.co.uk \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=matthew.auld@intel.com \
    --cc=michal.winiarski@intel.com \
    --cc=piotr.piorkowski@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;
as well as URLs for NNTP newsgroup(s).