Lines Matching full:pd

37 	struct i915_page_directory *pd;  in __alloc_pd()  local
39 pd = kzalloc(sizeof(*pd), I915_GFP_ALLOW_FAIL); in __alloc_pd()
40 if (unlikely(!pd)) in __alloc_pd()
43 pd->entry = kcalloc(count, sizeof(*pd->entry), I915_GFP_ALLOW_FAIL); in __alloc_pd()
44 if (unlikely(!pd->entry)) { in __alloc_pd()
45 kfree(pd); in __alloc_pd()
49 spin_lock_init(&pd->lock); in __alloc_pd()
50 return pd; in __alloc_pd()
55 struct i915_page_directory *pd; in alloc_pd() local
57 pd = __alloc_pd(I915_PDES); in alloc_pd()
58 if (unlikely(!pd)) in alloc_pd()
61 pd->pt.base = vm->alloc_pt_dma(vm, I915_GTT_PAGE_SIZE_4K); in alloc_pd()
62 if (IS_ERR(pd->pt.base)) { in alloc_pd()
63 kfree(pd->entry); in alloc_pd()
64 kfree(pd); in alloc_pd()
68 return pd; in alloc_pd()
76 struct i915_page_directory *pd = in free_px() local
77 container_of(pt, typeof(*pd), pt); in free_px()
78 kfree(pd->entry); in free_px()
99 __set_pd_entry(struct i915_page_directory * const pd, in __set_pd_entry() argument
104 /* Each thread pre-pins the pd, and we may have a thread per pde. */ in __set_pd_entry()
105 GEM_BUG_ON(atomic_read(px_used(pd)) > NALLOC * I915_PDES); in __set_pd_entry()
107 atomic_inc(px_used(pd)); in __set_pd_entry()
108 pd->entry[idx] = to; in __set_pd_entry()
109 write_dma_entry(px_base(pd), idx, encode(px_dma(to), I915_CACHE_LLC)); in __set_pd_entry()
113 clear_pd_entry(struct i915_page_directory * const pd, in clear_pd_entry() argument
117 GEM_BUG_ON(atomic_read(px_used(pd)) == 0); in clear_pd_entry()
119 write_dma_entry(px_base(pd), idx, scratch->encode); in clear_pd_entry()
120 pd->entry[idx] = NULL; in clear_pd_entry()
121 atomic_dec(px_used(pd)); in clear_pd_entry()
125 release_pd_entry(struct i915_page_directory * const pd, in release_pd_entry() argument
135 spin_lock(&pd->lock); in release_pd_entry()
137 clear_pd_entry(pd, idx, scratch); in release_pd_entry()
140 spin_unlock(&pd->lock); in release_pd_entry()
257 shift += ilog2(I915_PDES); /* Each PD holds 512 entries */ in i915_vm_alloc_pt_stash()
260 struct i915_page_directory *pd; in i915_vm_alloc_pt_stash() local
262 pd = alloc_pd(vm); in i915_vm_alloc_pt_stash()
263 if (IS_ERR(pd)) { in i915_vm_alloc_pt_stash()
265 return PTR_ERR(pd); in i915_vm_alloc_pt_stash()
268 pd->pt.stash = stash->pt[1]; in i915_vm_alloc_pt_stash()
269 stash->pt[1] = &pd->pt; in i915_vm_alloc_pt_stash()