2 * Copyright 2018 Red Hat Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
22 #include "changk104.h"
25 #include <core/client.h>
26 #include <core/gpuobj.h>
28 #include <nvif/clc36f.h>
29 #include <nvif/unpack.h>
32 tu102_fifo_gpfifo_submit_token(struct nvkm_fifo_chan
*base
)
34 struct gk104_fifo_chan
*chan
= gk104_fifo_chan(base
);
35 return (chan
->runl
<< 16) | chan
->base
.chid
;
38 static const struct nvkm_fifo_chan_func
40 .dtor
= gk104_fifo_gpfifo_dtor
,
41 .init
= gk104_fifo_gpfifo_init
,
42 .fini
= gk104_fifo_gpfifo_fini
,
43 .ntfy
= gf100_fifo_chan_ntfy
,
44 .engine_ctor
= gk104_fifo_gpfifo_engine_ctor
,
45 .engine_dtor
= gk104_fifo_gpfifo_engine_dtor
,
46 .engine_init
= gv100_fifo_gpfifo_engine_init
,
47 .engine_fini
= gv100_fifo_gpfifo_engine_fini
,
48 .submit_token
= tu102_fifo_gpfifo_submit_token
,
52 tu102_fifo_gpfifo_new(struct gk104_fifo
*fifo
, const struct nvkm_oclass
*oclass
,
53 void *data
, u32 size
, struct nvkm_object
**pobject
)
55 struct nvkm_object
*parent
= oclass
->parent
;
57 struct volta_channel_gpfifo_a_v0 v0
;
61 nvif_ioctl(parent
, "create channel gpfifo size %d\n", size
);
62 if (!(ret
= nvif_unpack(ret
, &data
, &size
, args
->v0
, 0, 0, false))) {
63 nvif_ioctl(parent
, "create channel gpfifo vers %d vmm %llx "
64 "ioffset %016llx ilength %08x "
65 "runlist %016llx priv %d\n",
66 args
->v0
.version
, args
->v0
.vmm
, args
->v0
.ioffset
,
67 args
->v0
.ilength
, args
->v0
.runlist
, args
->v0
.priv
);
68 if (args
->v0
.priv
&& !oclass
->client
->super
)
70 return gv100_fifo_gpfifo_new_(&tu102_fifo_gpfifo
, fifo
,