drm/nouveau/fifo: add runq
[linux-block.git] / drivers / gpu / drm / nouveau / nvkm / engine / fifo / gm200.c
CommitLineData
89025bd4
BS
1/*
2 * Copyright 2015 Red Hat Inc.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
21 *
22 * Authors: Ben Skeggs
23 */
24#include "gk104.h"
9a65a38c 25#include "changk104.h"
89025bd4 26
f9360c3a
BS
27#include <nvif/class.h>
28
f7cc47e4 29int
1c488ba9 30gm200_fifo_runq_nr(struct nvkm_fifo *fifo)
f7cc47e4 31{
1c488ba9 32 return nvkm_rd32(fifo->engine.subdev.device, 0x002004) & 0x000000ff;
f7cc47e4
BS
33}
34
35const struct gk104_fifo_pbdma_func
36gm200_fifo_pbdma = {
f7cc47e4
BS
37 .init = gk104_fifo_pbdma_init,
38 .init_timeout = gk208_fifo_pbdma_init_timeout,
39};
40
8c18138c
BS
41int
42gm200_fifo_chid_nr(struct nvkm_fifo *fifo)
43{
44 return nvkm_rd32(fifo->engine.subdev.device, 0x002008);
45}
46
9be9c606 47static const struct nvkm_fifo_func
db1eb528 48gm200_fifo = {
9be9c606
BS
49 .dtor = gk104_fifo_dtor,
50 .oneinit = gk104_fifo_oneinit,
8c18138c 51 .chid_nr = gm200_fifo_chid_nr,
800ac1f8 52 .chid_ctor = gk110_fifo_chid_ctor,
1c488ba9 53 .runq_nr = gm200_fifo_runq_nr,
9be9c606
BS
54 .info = gk104_fifo_info,
55 .init = gk104_fifo_init,
56 .fini = gk104_fifo_fini,
57 .intr = gk104_fifo_intr,
58 .intr_mmu_fault_unit = gm107_fifo_intr_mmu_fault_unit,
59 .mmu_fault = &gm107_fifo_mmu_fault,
ddc669e2 60 .fault.access = gk104_fifo_fault_access,
0cdc3fdf 61 .fault.engine = gm107_fifo_fault_engine,
91419acf
BS
62 .fault.reason = gk104_fifo_fault_reason,
63 .fault.hubclient = gk104_fifo_fault_hubclient,
64 .fault.gpcclient = gk104_fifo_fault_gpcclient,
9be9c606
BS
65 .engine_id = gk104_fifo_engine_id,
66 .id_engine = gk104_fifo_id_engine,
67 .uevent_init = gk104_fifo_uevent_init,
68 .uevent_fini = gk104_fifo_uevent_fini,
69 .recover_chan = gk104_fifo_recover_chan,
eda12417 70 .runlist = &gm107_fifo_runlist,
9be9c606 71 .pbdma = &gm200_fifo_pbdma,
1c488ba9 72 .runq = &gk208_runq,
f5e45689
BS
73 .cgrp = {{ 0, 0, KEPLER_CHANNEL_GROUP_A }, &gk110_cgrp },
74 .chan = {{ 0, 0, MAXWELL_CHANNEL_GPFIFO_A }, &gm107_chan, .ctor = &gk104_fifo_gpfifo_new },
8f0649b5
BS
75};
76
3326060a 77int
ab0db2bd
BS
78gm200_fifo_new(struct nvkm_device *device, enum nvkm_subdev_type type, int inst,
79 struct nvkm_fifo **pfifo)
89025bd4 80{
8c18138c 81 return gk104_fifo_new_(&gm200_fifo, device, type, inst, 0, pfifo);
89025bd4 82}