intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org, akash.goel@intel.com
Subject: Re: [PATCH 01/12] drm/i915: Add support for mapping an object page by page
Date: Tue, 24 May 2016 13:47:53 +0530	[thread overview]
Message-ID: <1464077873.23549.6.camel@ankitprasad-desktop> (raw)
In-Reply-To: <20160420120448.GB13412@nuc-i3427.alporthouse.com>

On Wed, 2016-04-20 at 13:04 +0100, Chris Wilson wrote:
> On Wed, Apr 20, 2016 at 04:47:28PM +0530, ankitprasad.r.sharma@intel.com wrote:
> > From: Chris Wilson <chris@chris-wilson.co.uk>
> > 
> > Introduced a new vm specfic callback insert_page() to program a single pte in
> > ggtt or ppgtt. This allows us to map a single page in to the mappable aperture
> > space. This can be iterated over to access the whole object by using space as
> > meagre as page size.
> > 
> > v2: Added low level rpm assertions to insert_page routines (Chris)
> > 
> > v3: Added POSTING_READ post register write (Tvrtko)
> > 
> > v4: Rebase (Ankit)
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Signed-off-by: Ankitprasad Sharma <ankitprasad.r.sharma@intel.com>
> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> > ---
> >  drivers/char/agp/intel-gtt.c        |  9 +++++
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 67 +++++++++++++++++++++++++++++++++++++
> >  drivers/gpu/drm/i915/i915_gem_gtt.h |  5 +++
> >  include/drm/intel-gtt.h             |  3 ++
> >  4 files changed, 84 insertions(+)
> > 
> > diff --git a/drivers/char/agp/intel-gtt.c b/drivers/char/agp/intel-gtt.c
> > index aef87fd..cea0ae3 100644
> > --- a/drivers/char/agp/intel-gtt.c
> > +++ b/drivers/char/agp/intel-gtt.c
> > @@ -840,6 +840,15 @@ static bool i830_check_flags(unsigned int flags)
> >  	return false;
> >  }
> >  
> > +void intel_gtt_insert_page(dma_addr_t addr,
> > +			   unsigned int pg,
> > +			   unsigned int flags)
> > +{
> > +	intel_private.driver->write_entry(addr, pg, flags);
> > +	wmb();
> > +}
> > +EXPORT_SYMBOL(intel_gtt_insert_page);
> > +
> >  void intel_gtt_insert_sg_entries(struct sg_table *st,
> >  				 unsigned int pg_start,
> >  				 unsigned int flags)
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 9f165fe..da1819d 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -2353,6 +2353,29 @@ static void gen8_set_pte(void __iomem *addr, gen8_pte_t pte)
> >  #endif
> >  }
> >  
> > +static void gen8_ggtt_insert_page(struct i915_address_space *vm,
> > +				  dma_addr_t addr,
> > +				  uint64_t offset,
> > +				  enum i915_cache_level level,
> > +				  u32 unused)
> > +{
> > +	struct drm_i915_private *dev_priv = to_i915(vm->dev);
> > +	gen8_pte_t __iomem *pte =
> > +		(gen8_pte_t __iomem *)dev_priv->ggtt.gsm +
> > +		(offset >> PAGE_SHIFT);
> > +	int rpm_atomic_seq;
> > +
> > +	rpm_atomic_seq = assert_rpm_atomic_begin(dev_priv);
> > +
> > +	gen8_set_pte(pte, gen8_pte_encode(addr, level, true));
> > +	wmb();
> > +
> > +	I915_WRITE(GFX_FLSH_CNTL_GEN6, GFX_FLSH_CNTL_EN);
> > +	POSTING_READ(GFX_FLSH_CNTL_GEN6);
> 
> Actually, we don't need these at all for the insert-page API (current
> users in pread/pwrite/reloc/gpu-error-capture) as they go through the
> GTT and not the GPU TLB. I would much rather we punt these to the caller
> with a vm->flush() which we can add later. When I say later, we already
> have the GUC pretending to be the GGTT and adding code where it doesn't
> belong...

I was trying to test the stolen memory patches on SKL with the removed
FLSH_CNTL write. Apparently, the insert_page routine does not seem to be
working. As I was verifying if the stolen-backed object is zeroed out
(using i915_gem_object_clear, which makes use of insert_page) on
creation but it failed (I was getting a garbage value instead of zeros).
And on adding this write it works as expected.

I think this write cannot be removed after all.

Thanks,
Ankit
> 
> All we need here is the wmb() to order the PTE write (and flush the WCB)
> with the use afterwards. The caller has to provide the wmb() to order
> its writes before a subsequent PTE change.
> 
> In a few patches time we can also kill the rpm_atomic asserts and the
> dev_priv local.
> -Chris
> 


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

  reply	other threads:[~2016-05-24  8:43 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-20 11:17 [PATCH v19 00/12] Support for creating/using Stolen memory backed objects ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 01/12] drm/i915: Add support for mapping an object page by page ankitprasad.r.sharma
2016-04-20 12:04   ` Chris Wilson
2016-05-24  8:17     ` Ankitprasad Sharma [this message]
2016-04-20 11:17 ` [PATCH 02/12] drm/i915: Introduce i915_gem_object_get_dma_address() ankitprasad.r.sharma
2016-04-20 12:08   ` Chris Wilson
2016-04-20 11:17 ` [PATCH 03/12] drm/i915: Use insert_page for pwrite_fast ankitprasad.r.sharma
2016-04-20 13:01   ` kbuild test robot
2016-04-20 11:17 ` [PATCH 04/12] drm/i915: Clearing buffer objects via CPU/GTT ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 05/12] drm/i915: Support for creating Stolen memory backed objects ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 06/12] drm/i915: Propagating correct error codes to the userspace ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 07/12] drm/i915: Add support for stealing purgable stolen pages ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 08/12] drm/i915: Support for pread/pwrite from/to non shmem backed objects ankitprasad.r.sharma
2016-04-20 12:19   ` Chris Wilson
2016-04-20 11:17 ` [PATCH 09/12] drm/i915: Migrate stolen objects before hibernation ankitprasad.r.sharma
2016-04-20 11:17 ` [PATCH 10/12] drm/i915: Disable use of stolen area by User when Intel RST is present ankitprasad.r.sharma
2016-04-20 23:15   ` Lukas Wunner
2016-04-20 11:17 ` [PATCH 11/12] drm/i915: Extend GET_APERTURE ioctl to report available map space ankitprasad.r.sharma
2016-04-20 13:02   ` [PATCH] drm/i915: fix semicolon.cocci warnings kbuild test robot
2016-04-20 13:02   ` [PATCH 11/12] drm/i915: Extend GET_APERTURE ioctl to report available map space kbuild test robot
2016-04-21 14:04   ` Tvrtko Ursulin
2016-04-21 14:46     ` Chris Wilson
2016-04-21 14:59       ` Tvrtko Ursulin
2016-04-25 10:35         ` Ankitprasad Sharma
2016-04-25 14:51           ` Tvrtko Ursulin
2016-04-26  9:44             ` Chris Wilson
2016-04-28  9:30               ` Tvrtko Ursulin
2016-04-28 10:24                 ` Chris Wilson
2016-04-29 10:06                   ` Tvrtko Ursulin
2016-04-29 10:18                     ` Chris Wilson
2016-04-29 10:26                       ` Tvrtko Ursulin
2016-04-29 10:39                         ` Chris Wilson
2016-04-29 10:56                           ` Tvrtko Ursulin
2016-04-29 11:03                             ` Chris Wilson
2016-04-20 11:17 ` [PATCH 12/12] drm/i915: Extend GET_APERTURE ioctl to report size of the stolen region ankitprasad.r.sharma
2016-04-21 14:17   ` Tvrtko Ursulin
2016-04-21 14:41     ` Chris Wilson
2016-04-21 14:52       ` Tvrtko Ursulin
2016-04-20 16:28 ` ✗ Fi.CI.BAT: failure for Support for creating/using Stolen memory backed objects (rev13) Patchwork
2016-04-28 10:20   ` Tvrtko Ursulin
2016-04-24 14:58 ` ✓ Fi.CI.BAT: success " Patchwork

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=1464077873.23549.6.camel@ankitprasad-desktop \
    --to=ankitprasad.r.sharma@intel.com \
    --cc=akash.goel@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).