xref: /linux/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk208.c (revision 7ae9fb1b7ecbb5d85d07857943f677fd1a559b18)
105c7145dSBen Skeggs /*
205c7145dSBen Skeggs  * Copyright 2013 Red Hat Inc.
305c7145dSBen Skeggs  *
405c7145dSBen Skeggs  * Permission is hereby granted, free of charge, to any person obtaining a
505c7145dSBen Skeggs  * copy of this software and associated documentation files (the "Software"),
605c7145dSBen Skeggs  * to deal in the Software without restriction, including without limitation
705c7145dSBen Skeggs  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
805c7145dSBen Skeggs  * and/or sell copies of the Software, and to permit persons to whom the
905c7145dSBen Skeggs  * Software is furnished to do so, subject to the following conditions:
1005c7145dSBen Skeggs  *
1105c7145dSBen Skeggs  * The above copyright notice and this permission notice shall be included in
1205c7145dSBen Skeggs  * all copies or substantial portions of the Software.
1305c7145dSBen Skeggs  *
1405c7145dSBen Skeggs  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1505c7145dSBen Skeggs  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605c7145dSBen Skeggs  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
1705c7145dSBen Skeggs  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
1805c7145dSBen Skeggs  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
1905c7145dSBen Skeggs  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
2005c7145dSBen Skeggs  * OTHER DEALINGS IN THE SOFTWARE.
2105c7145dSBen Skeggs  *
2205c7145dSBen Skeggs  * Authors: Ben Skeggs
2305c7145dSBen Skeggs  */
24*06db7fdeSBen Skeggs #include "priv.h"
251c488ba9SBen Skeggs #include "runq.h"
2605c7145dSBen Skeggs 
27f9360c3aSBen Skeggs #include <nvif/class.h>
28f9360c3aSBen Skeggs 
2979bb4b61SBen Skeggs void
gk208_runq_init(struct nvkm_runq * runq)3087c86024SBen Skeggs gk208_runq_init(struct nvkm_runq *runq)
3179bb4b61SBen Skeggs {
3287c86024SBen Skeggs 	gk104_runq_init(runq);
3379bb4b61SBen Skeggs 
3487c86024SBen Skeggs 	nvkm_wr32(runq->fifo->engine.subdev.device, 0x04012c + (runq->id * 0x2000), 0x000f4240);
3579bb4b61SBen Skeggs }
3679bb4b61SBen Skeggs 
371c488ba9SBen Skeggs const struct nvkm_runq_func
381c488ba9SBen Skeggs gk208_runq = {
3987c86024SBen Skeggs 	.init = gk208_runq_init,
40923f1ff5SBen Skeggs 	.intr = gk104_runq_intr,
41923f1ff5SBen Skeggs 	.intr_0_names = gk104_runq_intr_0_names,
424d60100aSBen Skeggs 	.idle = gk104_runq_idle,
431c488ba9SBen Skeggs };
441c488ba9SBen Skeggs 
458c18138cSBen Skeggs static int
gk208_fifo_chid_nr(struct nvkm_fifo * fifo)468c18138cSBen Skeggs gk208_fifo_chid_nr(struct nvkm_fifo *fifo)
478c18138cSBen Skeggs {
488c18138cSBen Skeggs 	return 1024;
498c18138cSBen Skeggs }
508c18138cSBen Skeggs 
519be9c606SBen Skeggs static const struct nvkm_fifo_func
5213de7f46SBen Skeggs gk208_fifo = {
538c18138cSBen Skeggs 	.chid_nr = gk208_fifo_chid_nr,
54800ac1f8SBen Skeggs 	.chid_ctor = gk110_fifo_chid_ctor,
551c488ba9SBen Skeggs 	.runq_nr = gf100_fifo_runq_nr,
56d94470e9SBen Skeggs 	.runl_ctor = gk104_fifo_runl_ctor,
579be9c606SBen Skeggs 	.init = gk104_fifo_init,
58965c41d9SBen Skeggs 	.init_pbdmas = gk104_fifo_init_pbdmas,
599be9c606SBen Skeggs 	.intr = gk104_fifo_intr,
609be9c606SBen Skeggs 	.intr_mmu_fault_unit = gf100_fifo_intr_mmu_fault_unit,
614d60100aSBen Skeggs 	.intr_ctxsw_timeout = gf100_fifo_intr_ctxsw_timeout,
629be9c606SBen Skeggs 	.mmu_fault = &gk104_fifo_mmu_fault,
63d67f3b96SBen Skeggs 	.nonstall = &gf100_fifo_nonstall,
64d94470e9SBen Skeggs 	.runl = &gk110_runl,
651c488ba9SBen Skeggs 	.runq = &gk208_runq,
66d94470e9SBen Skeggs 	.engn = &gk104_engn,
67d94470e9SBen Skeggs 	.engn_ce = &gk104_engn_ce,
68f5e45689SBen Skeggs 	.cgrp = {{ 0, 0, KEPLER_CHANNEL_GROUP_A  }, &gk110_cgrp },
69*06db7fdeSBen Skeggs 	.chan = {{ 0, 0, KEPLER_CHANNEL_GPFIFO_A }, &gk110_chan },
7013de7f46SBen Skeggs };
7113de7f46SBen Skeggs 
7213de7f46SBen Skeggs int
gk208_fifo_new(struct nvkm_device * device,enum nvkm_subdev_type type,int inst,struct nvkm_fifo ** pfifo)73ab0db2bdSBen Skeggs gk208_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
74ab0db2bdSBen Skeggs 	       struct nvkm_fifo **pfifo)
7513de7f46SBen Skeggs {
76*06db7fdeSBen Skeggs 	return nvkm_fifo_new_(&gk208_fifo, device, type, inst, pfifo);
7713de7f46SBen Skeggs }
78