Commit | Line | Data |
---|---|---|
641d0b30 BS |
1 | /* |
2 | * Copyright 2018 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 | #include "changk104.h" | |
23 | #include "cgrp.h" | |
24 | ||
25 | #include <core/client.h> | |
26 | #include <core/gpuobj.h> | |
27 | ||
28 | #include <nvif/clc36f.h> | |
29 | #include <nvif/unpack.h> | |
30 | ||
641d0b30 | 31 | static const struct nvkm_fifo_chan_func |
f10271ff | 32 | tu102_fifo_gpfifo = { |
641d0b30 | 33 | .dtor = gk104_fifo_gpfifo_dtor, |
641d0b30 BS |
34 | .engine_ctor = gk104_fifo_gpfifo_engine_ctor, |
35 | .engine_dtor = gk104_fifo_gpfifo_engine_dtor, | |
36 | .engine_init = gv100_fifo_gpfifo_engine_init, | |
37 | .engine_fini = gv100_fifo_gpfifo_engine_fini, | |
641d0b30 BS |
38 | }; |
39 | ||
40 | int | |
f10271ff | 41 | tu102_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass, |
641d0b30 BS |
42 | void *data, u32 size, struct nvkm_object **pobject) |
43 | { | |
44 | struct nvkm_object *parent = oclass->parent; | |
45 | union { | |
46 | struct volta_channel_gpfifo_a_v0 v0; | |
47 | } *args = data; | |
48 | int ret = -ENOSYS; | |
49 | ||
50 | nvif_ioctl(parent, "create channel gpfifo size %d\n", size); | |
51 | if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) { | |
52 | nvif_ioctl(parent, "create channel gpfifo vers %d vmm %llx " | |
53 | "ioffset %016llx ilength %08x " | |
54 | "runlist %016llx priv %d\n", | |
55 | args->v0.version, args->v0.vmm, args->v0.ioffset, | |
56 | args->v0.ilength, args->v0.runlist, args->v0.priv); | |
f10271ff | 57 | return gv100_fifo_gpfifo_new_(&tu102_fifo_gpfifo, fifo, |
641d0b30 BS |
58 | &args->v0.runlist, |
59 | &args->v0.chid, | |
60 | args->v0.vmm, | |
61 | args->v0.ioffset, | |
62 | args->v0.ilength, | |
63 | &args->v0.inst, | |
64 | args->v0.priv, | |
65 | &args->v0.token, | |
66 | oclass, pobject); | |
67 | } | |
68 | ||
69 | return ret; | |
70 | } |