All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 1/2] drm/i915: Flush the PTEs after updating them before suspend
Date: Wed, 13 Aug 2014 13:32:08 +0200	[thread overview]
Message-ID: <20140813113208.GR10500@phenom.ffwll.local> (raw)
In-Reply-To: <1407927115-16526-1-git-send-email-chris@chris-wilson.co.uk>

On Wed, Aug 13, 2014 at 11:51:54AM +0100, Chris Wilson wrote:
> As we use WC updates of the PTE, we are responsible for notifying the
> hardware when to flush its TLBs. Do so after we zap all the PTEs before
> suspend (and the BIOS tries to read our GTT).
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Imo would make more sense to add them to the clear_range functions.
-Daniel

> ---
>  drivers/gpu/drm/i915/i915_drv.h     |  2 +-
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 14 +++++++++++++-
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index d1513e6ea50d..d0222cb9b7a5 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -2082,7 +2082,7 @@ struct drm_i915_cmd_table {
>  
>  /* Note that the (struct drm_i915_private *) cast is just to shut up gcc. */
>  #define __I915__(p)	((sizeof(*(p)) == sizeof(struct drm_i915_private)) ? \
> -			 (struct drm_i915_private *)(p) : to_i915(p))
> +			 (struct drm_i915_private *)(p) : to_i915((struct drm_device *)p))
>  #define INTEL_INFO(p) 	(&__I915__(p)->info)
>  #define INTEL_DEVID(p)	(INTEL_INFO(p)->device_id)
>  
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index f3fd448505f1..b8d5a5d67a73 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1316,6 +1316,16 @@ void i915_check_and_clear_faults(struct drm_device *dev)
>  	POSTING_READ(RING_FAULT_REG(&dev_priv->ring[RCS]));
>  }
>  
> +static void i915_ggtt_flush(struct drm_i915_private *dev_priv)
> +{
> +	if (INTEL_INFO(dev_priv)->gen < 6) {
> +		intel_gtt_chipset_flush();
> +	} else {
> +		I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN);
> +		POSTING_READ(GFX_FLSH_CNTL_GEN6);
> +	}
> +}
> +
>  void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
>  {
>  	struct drm_i915_private *dev_priv = dev->dev_private;
> @@ -1332,6 +1342,8 @@ void i915_gem_suspend_gtt_mappings(struct drm_device *dev)
>  				       dev_priv->gtt.base.start,
>  				       dev_priv->gtt.base.total,
>  				       true);
> +
> +	i915_ggtt_flush(dev_priv);
>  }
>  
>  void i915_gem_restore_gtt_mappings(struct drm_device *dev)
> @@ -1384,7 +1396,7 @@ void i915_gem_restore_gtt_mappings(struct drm_device *dev)
>  		gen6_write_pdes(container_of(vm, struct i915_hw_ppgtt, base));
>  	}
>  
> -	i915_gem_chipset_flush(dev);
> +	i915_ggtt_flush(dev_priv);
>  }
>  
>  int i915_gem_gtt_prepare_object(struct drm_i915_gem_object *obj)
> -- 
> 2.1.0.rc1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  parent reply	other threads:[~2014-08-13 11:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 10:51 [PATCH 1/2] drm/i915: Flush the PTEs after updating them before suspend Chris Wilson
2014-08-13 10:51 ` [PATCH 2/2] drm/i915: Move i915_gem_chipset_flush to where it belongs Chris Wilson
2014-08-13 11:32   ` Daniel Vetter
2014-08-13 11:45     ` Chris Wilson
2014-08-13 12:23       ` Daniel Vetter
2014-08-13 11:32 ` Daniel Vetter [this message]
2014-08-13 11:46   ` [PATCH 1/2] drm/i915: Flush the PTEs after updating them before suspend Chris Wilson

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=20140813113208.GR10500@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --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 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.