Lines Matching +full:host1x +full:- +full:class

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Tegra host1x Channel
5 * Copyright (c) 2010-2013, NVIDIA Corporation.
8 #include <linux/host1x.h>
12 #include <trace/events/host1x.h>
24 struct device *dev = cdma_to_channel(cdma)->dev; in trace_write_gather()
37 u32 num_words = min(words - i, TRACE_MAX_LENGTH); in trace_write_gather()
53 struct host1x_cdma *cdma = &job->channel->cdma; in submit_wait()
63 if (job->memory_context) in submit_wait()
64 stream_id = job->memory_context->stream_id; in submit_wait()
66 stream_id = job->engine_fallback_streamid; in submit_wait()
79 host1x_cdma_push_wide(&job->channel->cdma, in submit_wait()
80 host1x_opcode_setclass(job->class, 0, 0), in submit_wait()
82 host1x_opcode_setstreamid(job->engine_streamid_offset / 4), in submit_wait()
115 struct host1x_cdma *cdma = &job->channel->cdma; in submit_gathers()
117 struct device *dev = job->channel->dev; in submit_gathers()
122 for (i = 0; i < job->num_cmds; i++) { in submit_gathers()
123 struct host1x_job_cmd *cmd = &job->cmds[i]; in submit_gathers()
125 if (cmd->is_wait) { in submit_gathers()
126 if (cmd->wait.relative) in submit_gathers()
127 threshold = job_syncpt_base + cmd->wait.threshold; in submit_gathers()
129 threshold = cmd->wait.threshold; in submit_gathers()
131 submit_wait(job, cmd->wait.id, threshold, cmd->wait.next_class); in submit_gathers()
133 struct host1x_job_gather *g = &cmd->gather; in submit_gathers()
135 dma_addr_t addr = g->base + g->offset; in submit_gathers()
141 trace_write_gather(cdma, g->bo, g->offset, g->words); in submit_gathers()
145 u32 op1 = host1x_opcode_gather_wide(g->words); in submit_gathers()
155 u32 op1 = host1x_opcode_gather(g->words); in submit_gathers()
165 struct host1x_syncpt *sp = job->syncpt; in synchronize_syncpt_base()
170 id = sp->base->id; in synchronize_syncpt_base()
172 host1x_cdma_push(&job->channel->cdma, in synchronize_syncpt_base()
184 if (!tegra_dev_iommu_get_stream_id(channel->dev->parent, &stream_id)) in host1x_channel_set_streamid()
194 struct host1x *host = dev_get_drvdata(ch->dev->parent); in host1x_enable_gather_filter()
197 if (!host->hv_regs) in host1x_enable_gather_filter()
201 host, HOST1X_HV_CH_KERNEL_FILTER_GBUFFER(ch->id / 32)); in host1x_enable_gather_filter()
202 val |= BIT(ch->id % 32); in host1x_enable_gather_filter()
204 host, val, HOST1X_HV_CH_KERNEL_FILTER_GBUFFER(ch->id / 32)); in host1x_enable_gather_filter()
214 struct host1x_cdma *cdma = &job->channel->cdma; in channel_program_cdma()
215 struct host1x_syncpt *sp = job->syncpt; in channel_program_cdma()
220 /* Enter engine class with invalid stream ID. */ in channel_program_cdma()
222 host1x_opcode_acquire_mlock(job->class), in channel_program_cdma()
223 host1x_opcode_setclass(job->class, 0, 0), in channel_program_cdma()
225 host1x_opcode_setstreamid(job->engine_streamid_offset / 4)); in channel_program_cdma()
229 host1x_cdma_push(&job->channel->cdma, in channel_program_cdma()
231 HOST1X_UCLASS_INCR_SYNCPT_INDX_F(job->syncpt->id) | in channel_program_cdma()
233 submit_wait(job, job->syncpt->id, fence, job->class); in channel_program_cdma()
236 job->syncpt_end = host1x_syncpt_incr_max(sp, job->syncpt_incrs); in channel_program_cdma()
237 submit_gathers(job, job->syncpt_end - job->syncpt_incrs); in channel_program_cdma()
241 host1x_cdma_push(&job->channel->cdma, in channel_program_cdma()
243 HOST1X_UCLASS_INCR_SYNCPT_INDX_F(job->syncpt->id) | in channel_program_cdma()
245 submit_wait(job, job->syncpt->id, fence, job->class); in channel_program_cdma()
249 HOST1X_OPCODE_NOP, host1x_opcode_release_mlock(job->class)); in channel_program_cdma()
251 if (job->serialize) { in channel_program_cdma()
259 host1x_class_host_wait_syncpt(job->syncpt->id, in channel_program_cdma()
264 if (sp->base) in channel_program_cdma()
268 if (job->class) in channel_program_cdma()
270 host1x_opcode_setclass(job->class, 0, 0), in channel_program_cdma()
273 job->syncpt_end = host1x_syncpt_incr_max(sp, job->syncpt_incrs); in channel_program_cdma()
275 submit_gathers(job, job->syncpt_end - job->syncpt_incrs); in channel_program_cdma()
284 host1x_cdma_update(&job->channel->cdma); in job_complete_callback()
289 struct host1x_channel *ch = job->channel; in channel_submit()
290 struct host1x_syncpt *sp = job->syncpt; in channel_submit()
294 struct host1x *host = dev_get_drvdata(ch->dev->parent); in channel_submit()
296 trace_host1x_channel_submit(dev_name(ch->dev), in channel_submit()
297 job->num_cmds, job->num_relocs, in channel_submit()
298 job->syncpt->id, job->syncpt_incrs); in channel_submit()
301 prev_max = job->syncpt_end = host1x_syncpt_read_max(sp); in channel_submit()
304 err = mutex_lock_interruptible(&ch->submitlock); in channel_submit()
313 err = host1x_cdma_begin(&ch->cdma, job); in channel_submit()
315 mutex_unlock(&ch->submitlock); in channel_submit()
326 job->fence = host1x_fence_create(sp, syncval, true); in channel_submit()
327 if (WARN(IS_ERR(job->fence), "Failed to create submit complete fence")) { in channel_submit()
328 job->fence = NULL; in channel_submit()
330 err = dma_fence_add_callback(job->fence, &job->fence_cb, in channel_submit()
335 host1x_cdma_end(&ch->cdma, job); in channel_submit()
337 trace_host1x_channel_submitted(dev_name(ch->dev), prev_max, syncval); in channel_submit()
339 mutex_unlock(&ch->submitlock); in channel_submit()
341 if (err == -ENOENT) in channel_submit()
342 host1x_cdma_update(&ch->cdma); in channel_submit()
349 static int host1x_channel_init(struct host1x_channel *ch, struct host1x *dev, in host1x_channel_init()
353 ch->regs = dev->regs + index * 0x4000; in host1x_channel_init()
355 ch->regs = dev->regs + index * 0x100; in host1x_channel_init()