All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Intel-gfx@lists.freedesktop.org,
	Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Subject: Re: [RFC 22/28] drm/i915: Convert i915_gem_flush_ggtt_writes to intel_gt
Date: Thu, 13 Jun 2019 16:28:54 +0100	[thread overview]
Message-ID: <156043973425.17012.348643516412729347@skylake-alporthouse-com> (raw)
In-Reply-To: <20190613151836.16093-1-tvrtko.ursulin@linux.intel.com>

Quoting Tvrtko Ursulin (2019-06-13 16:18:36)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Having introduced struct intel_gt (named the anonymous structure in i915)
> we can start using it to compartmentalize our code better. It makes more
> sense logically to have the code internally like this and it will also
> help with future split between gt and display in i915.
> 
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
>  drivers/gpu/drm/i915/gem/i915_gem_object.c    |  5 +--
>  .../drm/i915/gem/selftests/i915_gem_mman.c    |  3 +-
>  drivers/gpu/drm/i915/gt/intel_gt.c            | 41 +++++++++++++++++++
>  drivers/gpu/drm/i915/gt/intel_gt.h            |  2 +
>  drivers/gpu/drm/i915/i915_drv.h               |  2 -
>  drivers/gpu/drm/i915/i915_gem.c               | 40 ------------------
>  drivers/gpu/drm/i915/i915_vma.c               |  3 +-
>  drivers/gpu/drm/i915/selftests/i915_gem_gtt.c |  2 +-
>  8 files changed, 50 insertions(+), 48 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.c b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> index 36b76c6a0a9d..9ae7743348f2 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.c
> @@ -27,6 +27,7 @@
>  #include "i915_gem_context.h"
>  #include "i915_gem_object.h"
>  #include "i915_globals.h"
> +#include "gt/intel_gt.h"

g before i

>  #include "intel_frontbuffer.h"
>  
>  static struct i915_global_object {
> @@ -367,7 +368,6 @@ void
>  i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj,
>                                    unsigned int flush_domains)
>  {
> -       struct drm_i915_private *dev_priv = to_i915(obj->base.dev);
>         struct i915_vma *vma;
>  
>         assert_object_held(obj);
> @@ -377,8 +377,6 @@ i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj,
>  
>         switch (obj->write_domain) {
>         case I915_GEM_DOMAIN_GTT:
> -               i915_gem_flush_ggtt_writes(dev_priv);
> -
>                 intel_fb_obj_flush(obj,
>                                    fb_write_origin(obj, I915_GEM_DOMAIN_GTT));
>  
> @@ -386,6 +384,7 @@ i915_gem_object_flush_write_domain(struct drm_i915_gem_object *obj,
>                         if (vma->iomap)
>                                 continue;
>  
> +                       intel_gt_flush_ggtt_writes(vma->vm->gt);
>                         i915_vma_unset_ggtt_write(vma);
>                 }
>                 break;
> diff --git a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> index b92809418729..b46d57967bfa 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> +++ b/drivers/gpu/drm/i915/gem/selftests/i915_gem_mman.c
> @@ -6,6 +6,7 @@
>  
>  #include <linux/prime_numbers.h>
>  
> +#include "gt/intel_gt.h"
>  #include "gt/intel_gt_pm.h"
>  #include "huge_gem_object.h"
>  #include "i915_selftest.h"
> @@ -143,7 +144,7 @@ static int check_partial_mapping(struct drm_i915_gem_object *obj,
>                 if (offset >= obj->base.size)
>                         continue;
>  
> -               i915_gem_flush_ggtt_writes(to_i915(obj->base.dev));
> +               intel_gt_flush_ggtt_writes(&to_i915(obj->base.dev)->gt);
>  
>                 p = i915_gem_object_get_page(obj, offset >> PAGE_SHIFT);
>                 cpu = kmap(p) + offset_in_page(offset);
> diff --git a/drivers/gpu/drm/i915/gt/intel_gt.c b/drivers/gpu/drm/i915/gt/intel_gt.c
> index c6a67393ee72..7bf01365573a 100644
> --- a/drivers/gpu/drm/i915/gt/intel_gt.c
> +++ b/drivers/gpu/drm/i915/gt/intel_gt.c
> @@ -188,3 +188,44 @@ void intel_gt_init_swizzling(struct intel_gt *gt)
>         else
>                 MISSING_CASE(INTEL_GEN(i915));
>  }
> +
> +void intel_gt_flush_ggtt_writes(struct intel_gt *gt)
> +{
> +       struct drm_i915_private *i915 = gt->i915;
> +       intel_wakeref_t wakeref;
> +
> +       /*
> +        * No actual flushing is required for the GTT write domain for reads
> +        * from the GTT domain. Writes to it "immediately" go to main memory
> +        * as far as we know, so there's no chipset flush. It also doesn't
> +        * land in the GPU render cache.
> +        *
> +        * However, we do have to enforce the order so that all writes through
> +        * the GTT land before any writes to the device, such as updates to
> +        * the GATT itself.
> +        *
> +        * We also have to wait a bit for the writes to land from the GTT.
> +        * An uncached read (i.e. mmio) seems to be ideal for the round-trip
> +        * timing. This issue has only been observed when switching quickly
> +        * between GTT writes and CPU reads from inside the kernel on recent hw,
> +        * and it appears to only affect discrete GTT blocks (i.e. on LLC
> +        * system agents we cannot reproduce this behaviour, until Cannonlake
> +        * that was!).
> +        */
> +
> +       wmb();
> +
> +       if (INTEL_INFO(i915)->has_coherent_ggtt)
> +               return;
> +
> +       i915_gem_chipset_flush(i915);

Another gt candidate iirc. It's a magic page in the chipset to force it
to clear caches and pass a GOP.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-06-13 15:29 UTC|newest]

Thread overview: 77+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-13 13:35 [RFC v3 00/28] Implicit dev_priv removal and GT compartmentalization Tvrtko Ursulin
2019-06-13 13:35 ` [RFC 01/28] drm/i915: Convert intel_vgt_(de)balloon to uncore Tvrtko Ursulin
2019-06-13 13:41   ` Chris Wilson
2019-06-13 13:35 ` [RFC 02/28] drm/i915: Introduce struct intel_gt as replacement for anonymous i915->gt Tvrtko Ursulin
2019-06-13 13:42   ` Chris Wilson
2019-06-13 13:35 ` [RFC 03/28] drm/i915: Move intel_gt initialization to a separate file Tvrtko Ursulin
2019-06-13 13:43   ` Chris Wilson
2019-06-13 13:35 ` [RFC 04/28] drm/i915: Store some backpointers in struct intel_gt Tvrtko Ursulin
2019-06-13 13:44   ` Chris Wilson
2019-06-13 13:35 ` [RFC 05/28] drm/i915: Make i915_check_and_clear_faults take intel_gt Tvrtko Ursulin
2019-06-13 13:45   ` Chris Wilson
2019-06-13 13:35 ` [RFC 06/28] drm/i915: Convert i915_gem_init_swizzling to intel_gt Tvrtko Ursulin
2019-06-13 13:49   ` Chris Wilson
2019-06-14  9:06     ` Tvrtko Ursulin
2019-06-14  9:24       ` Chris Wilson
2019-06-14  9:42         ` Tvrtko Ursulin
2019-06-14  9:59           ` Chris Wilson
2019-06-13 13:35 ` [RFC 07/28] drm/i915: Convert init_unused_rings " Tvrtko Ursulin
2019-06-13 13:49   ` Chris Wilson
2019-06-13 13:35 ` [RFC 08/28] drm/i915: Convert gt workarounds " Tvrtko Ursulin
2019-06-13 13:50   ` Chris Wilson
2019-06-13 13:35 ` [RFC 09/28] drm/i915: Store backpointer to intel_gt in the engine Tvrtko Ursulin
2019-06-13 13:50   ` Chris Wilson
2019-06-13 13:52   ` Chris Wilson
2019-06-13 13:35 ` [RFC 10/28] drm/i915: Convert intel_mocs_init_l3cc_table to intel_gt Tvrtko Ursulin
2019-06-13 13:53   ` Chris Wilson
2019-06-13 13:35 ` [RFC 11/28] drm/i915: Convert i915_ppgtt_init_hw " Tvrtko Ursulin
2019-06-13 13:55   ` Chris Wilson
2019-06-13 13:35 ` [RFC 12/28] drm/i915: Consolidate some open coded mmio rmw Tvrtko Ursulin
2019-06-13 13:35 ` [RFC 13/28] drm/i915: Convert i915_gem_init_hw to intel_gt Tvrtko Ursulin
2019-06-13 13:59   ` Chris Wilson
2019-06-13 16:11     ` Tvrtko Ursulin
2019-06-13 16:30       ` Chris Wilson
2019-06-14  9:34         ` Tvrtko Ursulin
2019-06-14  9:41           ` Chris Wilson
2019-06-14 15:00             ` Tvrtko Ursulin
2019-06-14 15:10               ` Chris Wilson
2019-06-13 13:35 ` [RFC 14/28] drm/i915: Move intel_engines_resume into common init Tvrtko Ursulin
2019-06-13 14:01   ` Chris Wilson
2019-06-13 13:35 ` [RFC 15/28] drm/i915: Stop using I915_READ/WRITE in intel_wopcm_init_hw Tvrtko Ursulin
2019-06-13 13:35 ` [RFC 16/28] drm/i915: Compartmentalize i915_ggtt_probe_hw Tvrtko Ursulin
2019-06-13 14:03   ` Chris Wilson
2019-06-14  9:35     ` Tvrtko Ursulin
2019-06-14 10:23       ` Chris Wilson
2019-06-14 15:01         ` Tvrtko Ursulin
2019-06-13 13:35 ` [RFC 17/28] drm/i915: Compartmentalize i915_ggtt_init_hw Tvrtko Ursulin
2019-06-13 14:05   ` Chris Wilson
2019-06-13 13:35 ` [RFC 18/28] drm/i915: Make ggtt invalidation work on ggtt Tvrtko Ursulin
2019-06-13 14:05   ` Chris Wilson
2019-06-13 13:35 ` [RFC 19/28] drm/i915: Store intel_gt backpointer in vm Tvrtko Ursulin
2019-06-13 13:35 ` [RFC 20/28] drm/i915: Compartmentalize i915_gem_suspend/restore_gtt_mappings Tvrtko Ursulin
2019-06-13 14:08   ` Chris Wilson
2019-06-14  9:51     ` Tvrtko Ursulin
2019-06-14 10:26       ` Chris Wilson
2019-06-13 13:35 ` [RFC 21/28] drm/i915/gtt: Reduce source verbosity by caching repeated dereferences Tvrtko Ursulin
2019-06-13 14:12   ` Chris Wilson
2019-06-13 15:44     ` Tvrtko Ursulin
2019-06-13 15:18 ` [RFC 22/28] drm/i915: Convert i915_gem_flush_ggtt_writes to intel_gt Tvrtko Ursulin
2019-06-13 15:28   ` Chris Wilson [this message]
2019-06-13 15:18 ` [RFC 23/28] drm/i915: Compartmentalize timeline_init/park/fini Tvrtko Ursulin
2019-06-13 15:31   ` Chris Wilson
2019-06-13 15:19 ` [RFC 24/28] drm/i915: Compartmentalize i915_ggtt_cleanup_hw Tvrtko Ursulin
2019-06-13 15:19   ` [RFC 25/28] drm/i915: Compartmentalize i915_gem_init_ggtt Tvrtko Ursulin
2019-06-13 15:38     ` Chris Wilson
2019-06-13 15:48       ` Tvrtko Ursulin
2019-06-13 15:19   ` [RFC 26/28] drm/i915: Store ggtt pointer in intel_gt Tvrtko Ursulin
2019-06-13 15:42     ` Chris Wilson
2019-06-13 15:55       ` Tvrtko Ursulin
2019-06-13 15:19   ` [RFC 27/28] drm/i915: Compartmentalize ring buffer creation Tvrtko Ursulin
2019-06-13 15:46     ` Chris Wilson
2019-06-13 15:56       ` Tvrtko Ursulin
2019-06-13 16:33         ` Chris Wilson
2019-06-13 15:19   ` [RFC 28/28] drm/i915: Make timelines gt centric Tvrtko Ursulin
2019-06-13 15:47     ` Chris Wilson
2019-06-13 21:36       ` Chris Wilson
2019-06-13 15:36   ` [RFC 24/28] drm/i915: Compartmentalize i915_ggtt_cleanup_hw Chris Wilson
2019-06-14 10:28     ` Tvrtko Ursulin

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=156043973425.17012.348643516412729347@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=tvrtko.ursulin@linux.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.