Lines Matching refs:pb
48 static void host1x_pushbuffer_destroy(struct push_buffer *pb) in host1x_pushbuffer_destroy() argument
50 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_destroy()
53 if (!pb->mapped) in host1x_pushbuffer_destroy()
57 iommu_unmap(host1x->domain, pb->dma, pb->alloc_size); in host1x_pushbuffer_destroy()
58 free_iova(&host1x->iova, iova_pfn(&host1x->iova, pb->dma)); in host1x_pushbuffer_destroy()
61 dma_free_wc(host1x->dev, pb->alloc_size, pb->mapped, pb->phys); in host1x_pushbuffer_destroy()
63 pb->mapped = NULL; in host1x_pushbuffer_destroy()
64 pb->phys = 0; in host1x_pushbuffer_destroy()
70 static int host1x_pushbuffer_init(struct push_buffer *pb) in host1x_pushbuffer_init() argument
72 struct host1x_cdma *cdma = pb_to_cdma(pb); in host1x_pushbuffer_init()
78 pb->mapped = NULL; in host1x_pushbuffer_init()
79 pb->phys = 0; in host1x_pushbuffer_init()
80 pb->size = HOST1X_PUSHBUFFER_SLOTS * 8; in host1x_pushbuffer_init()
82 size = pb->size + 4; in host1x_pushbuffer_init()
85 pb->fence = pb->size - 8; in host1x_pushbuffer_init()
86 pb->pos = 0; in host1x_pushbuffer_init()
93 pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, in host1x_pushbuffer_init()
95 if (!pb->mapped) in host1x_pushbuffer_init()
106 pb->dma = iova_dma_addr(&host1x->iova, alloc); in host1x_pushbuffer_init()
107 err = iommu_map(host1x->domain, pb->dma, pb->phys, size, in host1x_pushbuffer_init()
112 pb->mapped = dma_alloc_wc(host1x->dev, size, &pb->phys, in host1x_pushbuffer_init()
114 if (!pb->mapped) in host1x_pushbuffer_init()
117 pb->dma = pb->phys; in host1x_pushbuffer_init()
120 pb->alloc_size = size; in host1x_pushbuffer_init()
122 host1x_hw_pushbuffer_init(host1x, pb); in host1x_pushbuffer_init()
129 dma_free_wc(host1x->dev, size, pb->mapped, pb->phys); in host1x_pushbuffer_init()
138 static void host1x_pushbuffer_push(struct push_buffer *pb, u32 op1, u32 op2) in host1x_pushbuffer_push() argument
140 u32 *p = (u32 *)((void *)pb->mapped + pb->pos); in host1x_pushbuffer_push()
142 WARN_ON(pb->pos == pb->fence); in host1x_pushbuffer_push()
145 pb->pos += 8; in host1x_pushbuffer_push()
147 if (pb->pos >= pb->size) in host1x_pushbuffer_push()
148 pb->pos -= pb->size; in host1x_pushbuffer_push()
155 static void host1x_pushbuffer_pop(struct push_buffer *pb, unsigned int slots) in host1x_pushbuffer_pop() argument
158 pb->fence += slots * 8; in host1x_pushbuffer_pop()
160 if (pb->fence >= pb->size) in host1x_pushbuffer_pop()
161 pb->fence -= pb->size; in host1x_pushbuffer_pop()
167 static u32 host1x_pushbuffer_space(struct push_buffer *pb) in host1x_pushbuffer_space() argument
169 unsigned int fence = pb->fence; in host1x_pushbuffer_space()
171 if (pb->fence < pb->pos) in host1x_pushbuffer_space()
172 fence += pb->size; in host1x_pushbuffer_space()
174 return (fence - pb->pos) / 8; in host1x_pushbuffer_space()
189 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_locked() local
198 space = host1x_pushbuffer_space(pb); in host1x_cdma_wait_locked()
240 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_wait_pushbuffer_space() local
243 space = host1x_pushbuffer_space(pb); in host1x_cdma_wait_pushbuffer_space()
348 struct push_buffer *pb = &cdma->push_buffer; in update_cdma_locked() local
350 host1x_pushbuffer_pop(pb, job->num_slots); in update_cdma_locked()
474 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_deinit() local
482 host1x_pushbuffer_destroy(pb); in host1x_cdma_deinit()
529 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push() local
544 host1x_pushbuffer_push(pb, op1, op2); in host1x_cdma_push()
561 struct push_buffer *pb = &cdma->push_buffer; in host1x_cdma_push_wide() local
570 if (pb->pos + 16 > pb->size) { in host1x_cdma_push_wide()
571 extra = (pb->size - pb->pos) / 8; in host1x_cdma_push_wide()
576 space = host1x_pushbuffer_space(pb); in host1x_cdma_push_wide()
594 host1x_pushbuffer_push(pb, op4, op4); in host1x_cdma_push_wide()
596 host1x_pushbuffer_push(pb, op1, op2); in host1x_cdma_push_wide()
597 host1x_pushbuffer_push(pb, op3, op4); in host1x_cdma_push_wide()