diff mbox series

[03/10] drm/i915/gtt: Introduce init_pd_with_page

Message ID 20190614164350.30415-3-mika.kuoppala@linux.intel.com (mailing list archive)
State New, archived
Headers show
Series [01/10] drm/i915/gtt: No need to zero the table for page dirs | expand

Commit Message

Mika Kuoppala June 14, 2019, 4:43 p.m. UTC
We set the page directory entries to point into a page table.
There is no gen specifics in here so make it simple and
obvious.

Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Comments

Chris Wilson June 14, 2019, 5:10 p.m. UTC | #1
Quoting Mika Kuoppala (2019-06-14 17:43:43)
> We set the page directory entries to point into a page table.
> There is no gen specifics in here so make it simple and
> obvious.
> 
> Signed-off-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index ef3fa6b5ef10..a2ab0b7bb234 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -726,12 +726,12 @@ static void free_pd(struct i915_address_space *vm,
>         kfree(pd);
>  }
>  
> -static void gen8_initialize_pd(struct i915_address_space *vm,
> -                              struct i915_page_directory *pd)
> +static void init_pd_with_page(struct i915_address_space *vm,
> +                             struct i915_page_directory * const pd,
> +                             struct i915_page_table *pt)
>  {
> -       fill_px(vm, pd,
> -               gen8_pde_encode(px_dma(vm->scratch_pt), I915_CACHE_LLC));
> -       memset_p(pd->entry, vm->scratch_pt, I915_PDES);
> +       fill_px(vm, pd, gen8_pde_encode(px_dma(pt), I915_CACHE_LLC));
> +       memset_p(pd->entry, pt, 512);

Looks good,
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index ef3fa6b5ef10..a2ab0b7bb234 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -726,12 +726,12 @@  static void free_pd(struct i915_address_space *vm,
 	kfree(pd);
 }
 
-static void gen8_initialize_pd(struct i915_address_space *vm,
-			       struct i915_page_directory *pd)
+static void init_pd_with_page(struct i915_address_space *vm,
+			      struct i915_page_directory * const pd,
+			      struct i915_page_table *pt)
 {
-	fill_px(vm, pd,
-		gen8_pde_encode(px_dma(vm->scratch_pt), I915_CACHE_LLC));
-	memset_p(pd->entry, vm->scratch_pt, I915_PDES);
+	fill_px(vm, pd, gen8_pde_encode(px_dma(pt), I915_CACHE_LLC));
+	memset_p(pd->entry, pt, 512);
 }
 
 static struct i915_page_directory *alloc_pdp(struct i915_address_space *vm)
@@ -1264,7 +1264,7 @@  static int gen8_init_scratch(struct i915_address_space *vm)
 	}
 
 	gen8_initialize_pt(vm, vm->scratch_pt);
-	gen8_initialize_pd(vm, vm->scratch_pd);
+	init_pd_with_page(vm, vm->scratch_pd, vm->scratch_pt);
 	if (i915_vm_is_4lvl(vm))
 		gen8_initialize_4lvl_pdp(vm, vm->scratch_pdp);
 
@@ -1441,7 +1441,7 @@  static int gen8_ppgtt_alloc_pdp(struct i915_address_space *vm,
 			if (IS_ERR(pd))
 				goto unwind;
 
-			gen8_initialize_pd(vm, pd);
+			init_pd_with_page(vm, pd, vm->scratch_pt);
 
 			old = cmpxchg(&pdp->entry[pdpe], vm->scratch_pd, pd);
 			if (old == vm->scratch_pd) {
@@ -1563,7 +1563,7 @@  static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt)
 		if (IS_ERR(pd))
 			goto unwind;
 
-		gen8_initialize_pd(vm, pd);
+		init_pd_with_page(vm, pd, vm->scratch_pt);
 		gen8_ppgtt_set_pdpe(vm, pdp, pd, pdpe);
 
 		atomic_inc(&pdp->used);