All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rodrigo Vivi <rodrigo.vivi@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 5/5] drm/i915/gtt: Refactor common ppgtt initialisation
Date: Thu, 14 Mar 2019 15:53:44 -0700	[thread overview]
Message-ID: <20190314225344.GB11873@intel.com> (raw)
In-Reply-To: <20190314223839.28258-5-chris@chris-wilson.co.uk>

On Thu, Mar 14, 2019 at 10:38:39PM +0000, Chris Wilson wrote:
> The basic setup of the i915_hw_ppgtt is the same between gen6 and gen8,
> so refactor that into a common routine.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Bob Paauwe <bob.j.paauwe@intel.com>
> Cc: Matthew Auld <matthew.william.auld@gmail.com>
> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>

Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 43 +++++++++++++----------------
>  1 file changed, 19 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 83362c8ac110..b8055c8d4e71 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -1513,6 +1513,23 @@ static int gen8_preallocate_top_level_pdp(struct i915_hw_ppgtt *ppgtt)
>  	return -ENOMEM;
>  }
>  
> +static void ppgtt_init(struct drm_i915_private *i915,
> +		       struct i915_hw_ppgtt *ppgtt)
> +{
> +	kref_init(&ppgtt->ref);
> +
> +	ppgtt->vm.i915 = i915;
> +	ppgtt->vm.dma = &i915->drm.pdev->dev;
> +	ppgtt->vm.total = BIT_ULL(INTEL_INFO(i915)->ppgtt_size);
> +
> +	i915_address_space_init(&ppgtt->vm, VM_CLASS_PPGTT);
> +
> +	ppgtt->vm.vma_ops.bind_vma    = ppgtt_bind_vma;
> +	ppgtt->vm.vma_ops.unbind_vma  = ppgtt_unbind_vma;
> +	ppgtt->vm.vma_ops.set_pages   = ppgtt_set_pages;
> +	ppgtt->vm.vma_ops.clear_pages = clear_pages;
> +}
> +
>  /*
>   * GEN8 legacy ppgtt programming is accomplished through a max 4 PDP registers
>   * with a net effect resembling a 2-level page table in normal x86 terms. Each
> @@ -1529,17 +1546,11 @@ static struct i915_hw_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
>  	if (!ppgtt)
>  		return ERR_PTR(-ENOMEM);
>  
> -	kref_init(&ppgtt->ref);
> -
> -	ppgtt->vm.i915 = i915;
> -	ppgtt->vm.dma = &i915->drm.pdev->dev;
> -	ppgtt->vm.total = BIT_ULL(INTEL_INFO(i915)->ppgtt_size);
> +	ppgtt_init(i915, ppgtt);
>  
>  	/* From bdw, there is support for read-only pages in the PPGTT. */
>  	ppgtt->vm.has_read_only = true;
>  
> -	i915_address_space_init(&ppgtt->vm, VM_CLASS_PPGTT);
> -
>  	/* There are only few exceptions for gen >=6. chv and bxt.
>  	 * And we are not sure about the latter so play safe for now.
>  	 */
> @@ -1583,11 +1594,6 @@ static struct i915_hw_ppgtt *gen8_ppgtt_create(struct drm_i915_private *i915)
>  
>  	ppgtt->vm.cleanup = gen8_ppgtt_cleanup;
>  
> -	ppgtt->vm.vma_ops.bind_vma    = ppgtt_bind_vma;
> -	ppgtt->vm.vma_ops.unbind_vma  = ppgtt_unbind_vma;
> -	ppgtt->vm.vma_ops.set_pages   = ppgtt_set_pages;
> -	ppgtt->vm.vma_ops.clear_pages = clear_pages;
> -
>  	return ppgtt;
>  
>  err_scratch:
> @@ -1979,24 +1985,13 @@ static struct i915_hw_ppgtt *gen6_ppgtt_create(struct drm_i915_private *i915)
>  	if (!ppgtt)
>  		return ERR_PTR(-ENOMEM);
>  
> -	kref_init(&ppgtt->base.ref);
> -
> -	ppgtt->base.vm.i915 = i915;
> -	ppgtt->base.vm.dma = &i915->drm.pdev->dev;
> -	ppgtt->base.vm.total = BIT_ULL(INTEL_INFO(i915)->ppgtt_size);
> -
> -	i915_address_space_init(&ppgtt->base.vm, VM_CLASS_PPGTT);
> +	ppgtt_init(i915, &ppgtt->base);
>  
>  	ppgtt->base.vm.allocate_va_range = gen6_alloc_va_range;
>  	ppgtt->base.vm.clear_range = gen6_ppgtt_clear_range;
>  	ppgtt->base.vm.insert_entries = gen6_ppgtt_insert_entries;
>  	ppgtt->base.vm.cleanup = gen6_ppgtt_cleanup;
>  
> -	ppgtt->base.vm.vma_ops.bind_vma    = ppgtt_bind_vma;
> -	ppgtt->base.vm.vma_ops.unbind_vma  = ppgtt_unbind_vma;
> -	ppgtt->base.vm.vma_ops.set_pages   = ppgtt_set_pages;
> -	ppgtt->base.vm.vma_ops.clear_pages = clear_pages;
> -
>  	ppgtt->base.vm.pte_encode = ggtt->vm.pte_encode;
>  
>  	err = gen6_ppgtt_init_scratch(ppgtt);
> -- 
> 2.20.1
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-03-14 22:53 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-14 22:38 [PATCH 1/5] drm/i915: Mark up vGPU support for full-ppgtt Chris Wilson
2019-03-14 22:38 ` [PATCH 2/5] drm/i915: Record platform specific ppGTT size in intel_device_info Chris Wilson
2019-03-14 23:56   ` Rodrigo Vivi
2019-03-14 22:38 ` [PATCH 3/5] drm/i915: Drop address size from ppgtt_type Chris Wilson
2019-03-15  0:03   ` Rodrigo Vivi
2019-03-15  8:32     ` Chris Wilson
2019-03-14 22:38 ` [PATCH 4/5] drm/i915/gtt: Rename i915_vm_is_48b to i915_vm_is_4lvl Chris Wilson
2019-03-14 22:52   ` Rodrigo Vivi
2019-03-14 22:38 ` [PATCH 5/5] drm/i915/gtt: Refactor common ppgtt initialisation Chris Wilson
2019-03-14 22:53   ` Rodrigo Vivi [this message]
2019-03-15  9:09     ` Chris Wilson
2019-03-15 16:55       ` Bob Paauwe
2019-03-15 17:01         ` Rodrigo Vivi
2019-03-15 17:26           ` Bob Paauwe
2019-03-15 17:59             ` Rodrigo Vivi
2019-03-14 22:55 ` [PATCH 1/5] drm/i915: Mark up vGPU support for full-ppgtt Rodrigo Vivi
2019-03-14 23:18 ` ✗ Fi.CI.SPARSE: warning for series starting with [1/5] " Patchwork
2019-03-14 23:36 ` ✓ Fi.CI.BAT: success " Patchwork
2019-03-15  2:15 ` [PATCH 1/5] " Zhenyu Wang

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=20190314225344.GB11873@intel.com \
    --to=rodrigo.vivi@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 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.