intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Dave Gordon <david.s.gordon@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Codify our assumption that the Global GTT is <= 4GiB
Date: Fri, 15 Jan 2016 11:25:38 +0000	[thread overview]
Message-ID: <5698D732.9090005@intel.com> (raw)
In-Reply-To: <1452853211-23959-1-git-send-email-chris@chris-wilson.co.uk>

On 15/01/16 10:20, Chris Wilson wrote:
> Throughout the code base, we use u32 for offsets into the global GTT. If
> we ever see any hardware with a larger GGTT, then we run the real risk
> of silent corruption. So test for our assumption up front so that we
> have a nice reminder should the time come when it fails.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Cc: Daniel Vetter <daniel@ffwll.ch>
> ---
>   drivers/gpu/drm/i915/i915_gem_gtt.c | 7 +++++++
>   1 file changed, 7 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 2e460b369e82..0d910638972c 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -3143,6 +3143,13 @@ int i915_gem_gtt_init(struct drm_device *dev)
>   	if (ret)
>   		return ret;
>
> +	if ((gtt->base.total - 1) >> 32) {
> +		DRM_ERROR("We never expected a Global GTT with more than 32bits of address space! Found %lldM!\n",
> +			  gtt->base.total >> 20);
> +		gtt->base.total = 1ull << 32;
> +		gtt->mappable_end = min(gtt->mappable_end, gtt->base.total);

Assuming Mika's comment on 'struct i915_address_space' is correct:
...
	u64 start;              /* Start offset always 0 for dri2 */
...
otherwise this calculation would need to be adjusted.

> +
>   	/* GMADR is the PCI mmio aperture into the global GTT. */
>   	DRM_INFO("Memory usable by graphics device = %lluM\n",
>   		 gtt->base.total >> 20);

LGTM.

Reviewed-by: Dave Gordon <david.s.gordon@intel.com>

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-01-15 11:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 10:20 [PATCH] drm/i915: Codify our assumption that the Global GTT is <= 4GiB Chris Wilson
2016-01-15 10:49 ` ✗ Fi.CI.BAT: warning for " Patchwork
2016-01-15 11:25 ` Dave Gordon [this message]
2016-01-15 11:52   ` [PATCH] " Chris Wilson
2016-01-15 11:28 ` Chris Wilson
2016-01-15 12:49   ` Ville Syrjälä

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=5698D732.9090005@intel.com \
    --to=david.s.gordon@intel.com \
    --cc=chris@chris-wilson.co.uk \
    --cc=intel-gfx@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;
as well as URLs for NNTP newsgroup(s).