Commit 4fba8764 authored by Mika Kuoppala's avatar Mika Kuoppala

drm/i915/gtt: Introduce init_pd_with_page

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: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20190614164350.30415-3-mika.kuoppala@linux.intel.com
parent b5b7bef9
...@@ -727,12 +727,12 @@ static void free_pd(struct i915_address_space *vm, ...@@ -727,12 +727,12 @@ static void free_pd(struct i915_address_space *vm,
kfree(pd); kfree(pd);
} }
static void gen8_initialize_pd(struct i915_address_space *vm, static void init_pd_with_page(struct i915_address_space *vm,
struct i915_page_directory *pd) struct i915_page_directory * const pd,
struct i915_page_table *pt)
{ {
fill_px(vm, pd, fill_px(vm, pd, gen8_pde_encode(px_dma(pt), I915_CACHE_LLC));
gen8_pde_encode(px_dma(vm->scratch_pt), I915_CACHE_LLC)); memset_p(pd->entry, pt, 512);
memset_p(pd->entry, vm->scratch_pt, I915_PDES);
} }
static struct i915_page_directory *alloc_pdp(struct i915_address_space *vm) static struct i915_page_directory *alloc_pdp(struct i915_address_space *vm)
...@@ -1265,7 +1265,7 @@ static int gen8_init_scratch(struct i915_address_space *vm) ...@@ -1265,7 +1265,7 @@ static int gen8_init_scratch(struct i915_address_space *vm)
} }
gen8_initialize_pt(vm, vm->scratch_pt); 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)) if (i915_vm_is_4lvl(vm))
gen8_initialize_4lvl_pdp(vm, vm->scratch_pdp); gen8_initialize_4lvl_pdp(vm, vm->scratch_pdp);
...@@ -1442,7 +1442,7 @@ static int gen8_ppgtt_alloc_pdp(struct i915_address_space *vm, ...@@ -1442,7 +1442,7 @@ static int gen8_ppgtt_alloc_pdp(struct i915_address_space *vm,
if (IS_ERR(pd)) if (IS_ERR(pd))
goto unwind; 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); old = cmpxchg(&pdp->entry[pdpe], vm->scratch_pd, pd);
if (old == vm->scratch_pd) { if (old == vm->scratch_pd) {
...@@ -1564,7 +1564,7 @@ static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt) ...@@ -1564,7 +1564,7 @@ static int gen8_preallocate_top_level_pdp(struct i915_ppgtt *ppgtt)
if (IS_ERR(pd)) if (IS_ERR(pd))
goto unwind; goto unwind;
gen8_initialize_pd(vm, pd); init_pd_with_page(vm, pd, vm->scratch_pt);
gen8_ppgtt_set_pdpe(vm, pdp, pd, pdpe); gen8_ppgtt_set_pdpe(vm, pdp, pd, pdpe);
atomic_inc(&pdp->used); atomic_inc(&pdp->used);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment