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 struct iommu_fwspec *spec = dev_iommu_fwspec_get(channel->dev->parent); in host1x_channel_set_streamid()
186 sid = spec->ids[0] & 0xffff; in host1x_channel_set_streamid()
196 struct host1x *host = dev_get_drvdata(ch->dev->parent); in host1x_enable_gather_filter()
199 if (!host->hv_regs) in host1x_enable_gather_filter()
203 host, HOST1X_HV_CH_KERNEL_FILTER_GBUFFER(ch->id / 32)); in host1x_enable_gather_filter()
204 val |= BIT(ch->id % 32); in host1x_enable_gather_filter()
206 host, val, HOST1X_HV_CH_KERNEL_FILTER_GBUFFER(ch->id / 32)); in host1x_enable_gather_filter()
216 struct host1x_cdma *cdma = &job->channel->cdma; in channel_program_cdma()
217 struct host1x_syncpt *sp = job->syncpt; in channel_program_cdma()
222 /* Enter engine class with invalid stream ID. */ in channel_program_cdma()
224 host1x_opcode_acquire_mlock(job->class), in channel_program_cdma()
225 host1x_opcode_setclass(job->class, 0, 0), in channel_program_cdma()
227 host1x_opcode_setstreamid(job->engine_streamid_offset / 4)); in channel_program_cdma()
231 host1x_cdma_push(&job->channel->cdma, in channel_program_cdma()
233 HOST1X_UCLASS_INCR_SYNCPT_INDX_F(job->syncpt->id) | in channel_program_cdma()
235 submit_wait(job, job->syncpt->id, fence, job->class); in channel_program_cdma()
238 job->syncpt_end = host1x_syncpt_incr_max(sp, job->syncpt_incrs); in channel_program_cdma()
239 submit_gathers(job, job->syncpt_end - job->syncpt_incrs); in channel_program_cdma()
243 host1x_cdma_push(&job->channel->cdma, in channel_program_cdma()
245 HOST1X_UCLASS_INCR_SYNCPT_INDX_F(job->syncpt->id) | in channel_program_cdma()
247 submit_wait(job, job->syncpt->id, fence, job->class); in channel_program_cdma()
251 HOST1X_OPCODE_NOP, host1x_opcode_release_mlock(job->class)); in channel_program_cdma()
253 if (job->serialize) { in channel_program_cdma()
261 host1x_class_host_wait_syncpt(job->syncpt->id, in channel_program_cdma()
266 if (sp->base) in channel_program_cdma()
270 if (job->class) in channel_program_cdma()
272 host1x_opcode_setclass(job->class, 0, 0), in channel_program_cdma()
275 job->syncpt_end = host1x_syncpt_incr_max(sp, job->syncpt_incrs); in channel_program_cdma()
277 submit_gathers(job, job->syncpt_end - job->syncpt_incrs); in channel_program_cdma()
283 struct host1x_channel *ch = job->channel; in channel_submit()
284 struct host1x_syncpt *sp = job->syncpt; in channel_submit()
289 struct host1x *host = dev_get_drvdata(ch->dev->parent); in channel_submit()
291 trace_host1x_channel_submit(dev_name(ch->dev), in channel_submit()
292 job->num_cmds, job->num_relocs, in channel_submit()
293 job->syncpt->id, job->syncpt_incrs); in channel_submit()
296 prev_max = job->syncpt_end = host1x_syncpt_read_max(sp); in channel_submit()
299 err = mutex_lock_interruptible(&ch->submitlock); in channel_submit()
305 mutex_unlock(&ch->submitlock); in channel_submit()
306 err = -ENOMEM; in channel_submit()
315 err = host1x_cdma_begin(&ch->cdma, job); in channel_submit()
317 mutex_unlock(&ch->submitlock); in channel_submit()
325 host1x_cdma_end(&ch->cdma, job); in channel_submit()
327 trace_host1x_channel_submitted(dev_name(ch->dev), prev_max, syncval); in channel_submit()
332 completed_waiter, &job->waiter); in channel_submit()
336 mutex_unlock(&ch->submitlock); in channel_submit()
345 static int host1x_channel_init(struct host1x_channel *ch, struct host1x *dev, in host1x_channel_init()
349 ch->regs = dev->regs + index * 0x4000; in host1x_channel_init()
351 ch->regs = dev->regs + index * 0x100; in host1x_channel_init()