• Home
  • Raw
  • Download

Lines Matching refs:job

38 	struct host1x_job *job = NULL;  in host1x_job_alloc()  local
54 mem = job = kzalloc(total, GFP_KERNEL); in host1x_job_alloc()
55 if (!job) in host1x_job_alloc()
58 kref_init(&job->ref); in host1x_job_alloc()
59 job->channel = ch; in host1x_job_alloc()
63 job->relocarray = num_relocs ? mem : NULL; in host1x_job_alloc()
65 job->unpins = num_unpins ? mem : NULL; in host1x_job_alloc()
67 job->waitchk = num_waitchks ? mem : NULL; in host1x_job_alloc()
69 job->gathers = num_cmdbufs ? mem : NULL; in host1x_job_alloc()
71 job->addr_phys = num_unpins ? mem : NULL; in host1x_job_alloc()
73 job->reloc_addr_phys = job->addr_phys; in host1x_job_alloc()
74 job->gather_addr_phys = &job->addr_phys[num_relocs]; in host1x_job_alloc()
76 return job; in host1x_job_alloc()
80 struct host1x_job *host1x_job_get(struct host1x_job *job) in host1x_job_get() argument
82 kref_get(&job->ref); in host1x_job_get()
83 return job; in host1x_job_get()
89 struct host1x_job *job = container_of(ref, struct host1x_job, ref); in job_free() local
91 kfree(job); in job_free()
94 void host1x_job_put(struct host1x_job *job) in host1x_job_put() argument
96 kref_put(&job->ref, job_free); in host1x_job_put()
100 void host1x_job_add_gather(struct host1x_job *job, struct host1x_bo *bo, in host1x_job_add_gather() argument
103 struct host1x_job_gather *cur_gather = &job->gathers[job->num_gathers]; in host1x_job_add_gather()
108 job->num_gathers++; in host1x_job_add_gather()
139 static int do_waitchks(struct host1x_job *job, struct host1x *host, in do_waitchks() argument
145 for (i = 0; i < job->num_waitchk; i++) { in do_waitchks()
146 struct host1x_waitchk *wait = &job->waitchk[i]; in do_waitchks()
177 static unsigned int pin_job(struct host1x_job *job) in pin_job() argument
181 job->num_unpins = 0; in pin_job()
183 for (i = 0; i < job->num_relocs; i++) { in pin_job()
184 struct host1x_reloc *reloc = &job->relocarray[i]; in pin_job()
196 job->addr_phys[job->num_unpins] = phys_addr; in pin_job()
197 job->unpins[job->num_unpins].bo = reloc->target.bo; in pin_job()
198 job->unpins[job->num_unpins].sgt = sgt; in pin_job()
199 job->num_unpins++; in pin_job()
202 for (i = 0; i < job->num_gathers; i++) { in pin_job()
203 struct host1x_job_gather *g = &job->gathers[i]; in pin_job()
215 job->addr_phys[job->num_unpins] = phys_addr; in pin_job()
216 job->unpins[job->num_unpins].bo = g->bo; in pin_job()
217 job->unpins[job->num_unpins].sgt = sgt; in pin_job()
218 job->num_unpins++; in pin_job()
221 return job->num_unpins; in pin_job()
224 host1x_job_unpin(job); in pin_job()
228 static unsigned int do_relocs(struct host1x_job *job, struct host1x_bo *cmdbuf) in do_relocs() argument
235 for (i = 0; i < job->num_relocs; i++) { in do_relocs()
236 struct host1x_reloc *reloc = &job->relocarray[i]; in do_relocs()
237 u32 reloc_addr = (job->reloc_addr_phys[i] + in do_relocs()
282 struct host1x_job *job; member
300 if (fw->job->is_addr_reg(fw->dev, fw->class, offset)) { in check_register()
385 u32 *cmdbuf_base = (u32 *)fw->job->gather_copy_mapped + in validate()
389 if (!fw->job->is_addr_reg) in validate()
452 static inline int copy_gathers(struct host1x_job *job, struct device *dev) in copy_gathers() argument
459 fw.job = job; in copy_gathers()
461 fw.reloc = job->relocarray; in copy_gathers()
462 fw.num_relocs = job->num_relocs; in copy_gathers()
465 for (i = 0; i < job->num_gathers; i++) { in copy_gathers()
466 struct host1x_job_gather *g = &job->gathers[i]; in copy_gathers()
470 job->gather_copy_mapped = dma_alloc_writecombine(dev, size, in copy_gathers()
471 &job->gather_copy, in copy_gathers()
473 if (!job->gather_copy_mapped) { in copy_gathers()
474 job->gather_copy_mapped = NULL; in copy_gathers()
478 job->gather_copy_size = size; in copy_gathers()
480 for (i = 0; i < job->num_gathers; i++) { in copy_gathers()
481 struct host1x_job_gather *g = &job->gathers[i]; in copy_gathers()
486 memcpy(job->gather_copy_mapped + offset, gather + g->offset, in copy_gathers()
491 g->base = job->gather_copy; in copy_gathers()
508 int host1x_job_pin(struct host1x_job *job, struct device *dev) in host1x_job_pin() argument
516 for (i = 0; i < job->num_waitchk; i++) { in host1x_job_pin()
517 u32 syncpt_id = job->waitchk[i].syncpt_id; in host1x_job_pin()
527 err = pin_job(job); in host1x_job_pin()
532 for (i = 0; i < job->num_gathers; i++) { in host1x_job_pin()
533 struct host1x_job_gather *g = &job->gathers[i]; in host1x_job_pin()
539 g->base = job->gather_addr_phys[i]; in host1x_job_pin()
541 for (j = i + 1; j < job->num_gathers; j++) in host1x_job_pin()
542 if (job->gathers[j].bo == g->bo) in host1x_job_pin()
543 job->gathers[j].handled = true; in host1x_job_pin()
545 err = do_relocs(job, g->bo); in host1x_job_pin()
549 err = do_waitchks(job, host, g->bo); in host1x_job_pin()
555 err = copy_gathers(job, dev); in host1x_job_pin()
557 host1x_job_unpin(job); in host1x_job_pin()
569 void host1x_job_unpin(struct host1x_job *job) in host1x_job_unpin() argument
573 for (i = 0; i < job->num_unpins; i++) { in host1x_job_unpin()
574 struct host1x_job_unpin_data *unpin = &job->unpins[i]; in host1x_job_unpin()
578 job->num_unpins = 0; in host1x_job_unpin()
580 if (job->gather_copy_size) in host1x_job_unpin()
581 dma_free_writecombine(job->channel->dev, job->gather_copy_size, in host1x_job_unpin()
582 job->gather_copy_mapped, in host1x_job_unpin()
583 job->gather_copy); in host1x_job_unpin()
590 void host1x_job_dump(struct device *dev, struct host1x_job *job) in host1x_job_dump() argument
592 dev_dbg(dev, " SYNCPT_ID %d\n", job->syncpt_id); in host1x_job_dump()
593 dev_dbg(dev, " SYNCPT_VAL %d\n", job->syncpt_end); in host1x_job_dump()
594 dev_dbg(dev, " FIRST_GET 0x%x\n", job->first_get); in host1x_job_dump()
595 dev_dbg(dev, " TIMEOUT %d\n", job->timeout); in host1x_job_dump()
596 dev_dbg(dev, " NUM_SLOTS %d\n", job->num_slots); in host1x_job_dump()
597 dev_dbg(dev, " NUM_HANDLES %d\n", job->num_unpins); in host1x_job_dump()