root/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gpfifotu102.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. tu102_fifo_gpfifo_submit_token
  2. tu102_fifo_gpfifo_new

   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 
  31 static u32
  32 tu102_fifo_gpfifo_submit_token(struct nvkm_fifo_chan *base)
  33 {
  34         struct gk104_fifo_chan *chan = gk104_fifo_chan(base);
  35         return (chan->runl << 16) | chan->base.chid;
  36 }
  37 
  38 static const struct nvkm_fifo_chan_func
  39 tu102_fifo_gpfifo = {
  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,
  49 };
  50 
  51 int
  52 tu102_fifo_gpfifo_new(struct gk104_fifo *fifo, const struct nvkm_oclass *oclass,
  53                       void *data, u32 size, struct nvkm_object **pobject)
  54 {
  55         struct nvkm_object *parent = oclass->parent;
  56         union {
  57                 struct volta_channel_gpfifo_a_v0 v0;
  58         } *args = data;
  59         int ret = -ENOSYS;
  60 
  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)
  69                         return -EINVAL;
  70                 return gv100_fifo_gpfifo_new_(&tu102_fifo_gpfifo, fifo,
  71                                               &args->v0.runlist,
  72                                               &args->v0.chid,
  73                                                args->v0.vmm,
  74                                                args->v0.ioffset,
  75                                                args->v0.ilength,
  76                                               &args->v0.inst,
  77                                                args->v0.priv,
  78                                               &args->v0.token,
  79                                               oclass, pobject);
  80         }
  81 
  82         return ret;
  83 }

/* [<][>][^][v][top][bottom][index][help] */