Lines Matching full:pd

33 	struct i915_page_directory *pd;  in __alloc_pd()  local
35 pd = kzalloc(sizeof(*pd), I915_GFP_ALLOW_FAIL); in __alloc_pd()
36 if (unlikely(!pd)) in __alloc_pd()
39 pd->entry = kcalloc(count, sizeof(*pd->entry), I915_GFP_ALLOW_FAIL); in __alloc_pd()
40 if (unlikely(!pd->entry)) { in __alloc_pd()
41 kfree(pd); in __alloc_pd()
45 spin_lock_init(&pd->lock); in __alloc_pd()
46 return pd; in __alloc_pd()
51 struct i915_page_directory *pd; in alloc_pd() local
53 pd = __alloc_pd(I915_PDES); in alloc_pd()
54 if (unlikely(!pd)) in alloc_pd()
57 pd->pt.base = vm->alloc_pt_dma(vm, I915_GTT_PAGE_SIZE_4K); in alloc_pd()
58 if (IS_ERR(pd->pt.base)) { in alloc_pd()
59 kfree(pd->entry); in alloc_pd()
60 kfree(pd); in alloc_pd()
64 return pd; in alloc_pd()
72 struct i915_page_directory *pd = in free_px() local
73 container_of(pt, typeof(*pd), pt); in free_px()
74 kfree(pd->entry); in free_px()
96 __set_pd_entry(struct i915_page_directory * const pd, in __set_pd_entry() argument
101 /* Each thread pre-pins the pd, and we may have a thread per pde. */ in __set_pd_entry()
102 GEM_BUG_ON(atomic_read(px_used(pd)) > NALLOC * I915_PDES); in __set_pd_entry()
104 atomic_inc(px_used(pd)); in __set_pd_entry()
105 pd->entry[idx] = to; in __set_pd_entry()
106 write_dma_entry(px_base(pd), idx, encode(px_dma(to), I915_CACHE_LLC)); in __set_pd_entry()
110 clear_pd_entry(struct i915_page_directory * const pd, in clear_pd_entry() argument
114 GEM_BUG_ON(atomic_read(px_used(pd)) == 0); in clear_pd_entry()
116 write_dma_entry(px_base(pd), idx, scratch->encode); in clear_pd_entry()
117 pd->entry[idx] = NULL; in clear_pd_entry()
118 atomic_dec(px_used(pd)); in clear_pd_entry()
122 release_pd_entry(struct i915_page_directory * const pd, in release_pd_entry() argument
132 spin_lock(&pd->lock); in release_pd_entry()
134 clear_pd_entry(pd, idx, scratch); in release_pd_entry()
137 spin_unlock(&pd->lock); in release_pd_entry()
238 shift += ilog2(I915_PDES); /* Each PD holds 512 entries */ in i915_vm_alloc_pt_stash()
241 struct i915_page_directory *pd; in i915_vm_alloc_pt_stash() local
243 pd = alloc_pd(vm); in i915_vm_alloc_pt_stash()
244 if (IS_ERR(pd)) { in i915_vm_alloc_pt_stash()
246 return PTR_ERR(pd); in i915_vm_alloc_pt_stash()
249 pd->pt.stash = stash->pt[1]; in i915_vm_alloc_pt_stash()
250 stash->pt[1] = &pd->pt; in i915_vm_alloc_pt_stash()