diff mbox

drm/i915: correct the calculation of first_pd_entry_in_global_pt

Message ID 8082FF9BCB2B054996454E47167FF4EC0165CC32@SHSMSX102.ccr.corp.intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Zhang, Xiong Y April 27, 2013, 9:53 a.m. UTC
When ppgtt is enabled, dev_priv->gtt.total has excluded the gtt space occupied by ppgtt table in i915_gem_init_global_gtt() function. So the calculation of first_pd_entry_in_global_pt doesn't need to subtract I915_PPGTT_PD_ENTRIES again. Or else PPGTT directory table will be destroyed by global gtt allocation.

Signed-off-by: Xiong Zhang<xiong.y.zhang@intel.com>

Comments

Daniel Vetter April 27, 2013, 11:40 a.m. UTC | #1
On Sat, Apr 27, 2013 at 09:53:33AM +0000, Zhang, Xiong Y wrote:
> When ppgtt is enabled, dev_priv->gtt.total has excluded the gtt space occupied by ppgtt table in i915_gem_init_global_gtt() function. So the calculation of first_pd_entry_in_global_pt doesn't need to subtract I915_PPGTT_PD_ENTRIES again. Or else PPGTT directory table will be destroyed by global gtt allocation.
> 
> Signed-off-by: Xiong Zhang<xiong.y.zhang@intel.com>

Nice catch, patch applied to -fixes. I've also amended the commit message
with a note for the commit which introduced this regression and a cc:
stable tag.

Aside: The patch was whitespace-mangled and the commit meesage not
line-broken to 72 chars. I've fixed both things up. Please check your mail
setup. If all else fails please simply attach a git patch created with
git format-patch.

Thanks, Daniel

> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index ce024bd..3cd48e2 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -258,8 +258,7 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
>         /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024
>          * entries. For aliasing ppgtt support we just steal them at the end for
>          * now. */
> -       first_pd_entry_in_global_pt =
> -               gtt_total_entries(dev_priv->gtt) - I915_PPGTT_PD_ENTRIES;
> +       first_pd_entry_in_global_pt = gtt_total_entries(dev_priv->gtt);
> 
>         if (IS_HASWELL(dev)) {
>                 ppgtt->pte_encode = hsw_pte_encode;
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Ben Widawsky April 27, 2013, 2:53 p.m. UTC | #2
On Sat, Apr 27, 2013 at 01:40:57PM +0200, Daniel Vetter wrote:
> On Sat, Apr 27, 2013 at 09:53:33AM +0000, Zhang, Xiong Y wrote:
> > When ppgtt is enabled, dev_priv->gtt.total has excluded the gtt space occupied by ppgtt table in i915_gem_init_global_gtt() function. So the calculation of first_pd_entry_in_global_pt doesn't need to subtract I915_PPGTT_PD_ENTRIES again. Or else PPGTT directory table will be destroyed by global gtt allocation.
> > 
> > Signed-off-by: Xiong Zhang<xiong.y.zhang@intel.com>
> 
> Nice catch, patch applied to -fixes. I've also amended the commit message
> with a note for the commit which introduced this regression and a cc:
> stable tag.
> 
> Aside: The patch was whitespace-mangled and the commit meesage not
> line-broken to 72 chars. I've fixed both things up. Please check your mail
> setup. If all else fails please simply attach a git patch created with
> git format-patch.
> 
> Thanks, Daniel

As a small note, this should also have been fixed the ppgtt prep patches
I submitted.

More rebasing for me, I guess :/

> 
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index ce024bd..3cd48e2 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -258,8 +258,7 @@ static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
> >         /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024
> >          * entries. For aliasing ppgtt support we just steal them at the end for
> >          * now. */
> > -       first_pd_entry_in_global_pt =
> > -               gtt_total_entries(dev_priv->gtt) - I915_PPGTT_PD_ENTRIES;
> > +       first_pd_entry_in_global_pt = gtt_total_entries(dev_priv->gtt);
> > 
> >         if (IS_HASWELL(dev)) {
> >                 ppgtt->pte_encode = hsw_pte_encode;
> > _______________________________________________
> > 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
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index ce024bd..3cd48e2 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -258,8 +258,7 @@  static int gen6_ppgtt_init(struct i915_hw_ppgtt *ppgtt)
        /* ppgtt PDEs reside in the global gtt pagetable, which has 512*1024
         * entries. For aliasing ppgtt support we just steal them at the end for
         * now. */
-       first_pd_entry_in_global_pt =
-               gtt_total_entries(dev_priv->gtt) - I915_PPGTT_PD_ENTRIES;
+       first_pd_entry_in_global_pt = gtt_total_entries(dev_priv->gtt);

        if (IS_HASWELL(dev)) {
                ppgtt->pte_encode = hsw_pte_encode;