drm/nouveau/fifo/gm204: initial support
authorBen Skeggs <bskeggs@redhat.com>
Wed, 11 Mar 2015 02:21:15 +0000 (12:21 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 14 Apr 2015 07:00:55 +0000 (17:00 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/class.h
drivers/gpu/drm/nouveau/include/nvkm/engine/fifo.h
drivers/gpu/drm/nouveau/nvkm/engine/device/gm100.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/Kbuild
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.h
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm204.c [new file with mode: 0644]

index 67f1d9bd3403902e99646754465df2e2845d6a38..0fdbcffaa54d5f293c4ff315043e9c90390b08be 100644 (file)
@@ -32,6 +32,7 @@
 #define G82_CHANNEL_GPFIFO                                           0x0000826f
 #define FERMI_CHANNEL_GPFIFO                                         0x0000906f
 #define KEPLER_CHANNEL_GPFIFO_A                                      0x0000a06f
+#define MAXWELL_CHANNEL_GPFIFO_A                                     0x0000b06f
 
 #define NV50_DISP                                                    0x00005070
 #define G82_DISP                                                     0x00008270
index 05321ce7ab15a27c9f2154b0fbfe7a1b790f8a52..97cdeab8e44c2463c4eda905937fb721dca0d1a9 100644 (file)
@@ -116,6 +116,7 @@ extern struct nvkm_oclass *gf100_fifo_oclass;
 extern struct nvkm_oclass *gk104_fifo_oclass;
 extern struct nvkm_oclass *gk20a_fifo_oclass;
 extern struct nvkm_oclass *gk208_fifo_oclass;
+extern struct nvkm_oclass *gm204_fifo_oclass;
 
 int  nvkm_fifo_uevent_ctor(struct nvkm_object *, void *, u32,
                           struct nvkm_notify *);
index 108d048da7643f0b97255edf06e205a72d672a48..7f424827191594dfe36713a798cafcdb0d23823a 100644 (file)
@@ -127,9 +127,9 @@ gm100_identify(struct nvkm_device *device)
                device->oclass[NVDEV_SUBDEV_VOLT   ] = &nv40_volt_oclass;
 #endif
                device->oclass[NVDEV_ENGINE_DMAOBJ ] =  gf110_dmaeng_oclass;
-#if 0
-               device->oclass[NVDEV_ENGINE_FIFO   ] =  gk208_fifo_oclass;
+               device->oclass[NVDEV_ENGINE_FIFO   ] =  gm204_fifo_oclass;
                device->oclass[NVDEV_ENGINE_SW     ] =  gf100_sw_oclass;
+#if 0
                device->oclass[NVDEV_ENGINE_GR     ] =  gm107_gr_oclass;
 #endif
                device->oclass[NVDEV_ENGINE_DISP   ] =  gm204_disp_oclass;
index c5a2d8718c5bdfdefc91e414e14d14c8d65edc79..42891cb71ea3404c211e88905d91f424f53b9d8b 100644 (file)
@@ -9,3 +9,4 @@ nvkm-y += nvkm/engine/fifo/gf100.o
 nvkm-y += nvkm/engine/fifo/gk104.o
 nvkm-y += nvkm/engine/fifo/gk20a.o
 nvkm-y += nvkm/engine/fifo/gk208.o
+nvkm-y += nvkm/engine/fifo/gm204.o
index 9585539e59f2e305b5d3d3be80d10c5fa7db38b5..e10f9644140f5d9fcd6e73446c74634d2b13906a 100644 (file)
@@ -323,8 +323,8 @@ gk104_fifo_chan_fini(struct nvkm_object *object, bool suspend)
        return nvkm_fifo_channel_fini(&chan->base, suspend);
 }
 
-static struct nvkm_ofuncs
-gk104_fifo_ofuncs = {
+struct nvkm_ofuncs
+gk104_fifo_chan_ofuncs = {
        .ctor = gk104_fifo_chan_ctor,
        .dtor = _nvkm_fifo_channel_dtor,
        .init = gk104_fifo_chan_init,
@@ -337,7 +337,7 @@ gk104_fifo_ofuncs = {
 
 static struct nvkm_oclass
 gk104_fifo_sclass[] = {
-       { KEPLER_CHANNEL_GPFIFO_A, &gk104_fifo_ofuncs },
+       { KEPLER_CHANNEL_GPFIFO_A, &gk104_fifo_chan_ofuncs },
        {}
 };
 
@@ -774,6 +774,7 @@ gk104_fifo_intr_fault(struct gk104_fifo_priv *priv, int unit)
        while (object) {
                switch (nv_mclass(object)) {
                case KEPLER_CHANNEL_GPFIFO_A:
+               case MAXWELL_CHANNEL_GPFIFO_A:
                        gk104_fifo_recover(priv, engine, (void *)object);
                        break;
                }
index 3046e00ed6ba1c41573b3e6ff415c0590043546e..318d30d6ee1aea7a8e60091e85a7667080ca99fb 100644 (file)
@@ -13,4 +13,6 @@ struct gk104_fifo_impl {
        struct nvkm_oclass base;
        u32 channels;
 };
+
+extern struct nvkm_ofuncs gk104_fifo_chan_ofuncs;
 #endif
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm204.c b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/gm204.c
new file mode 100644 (file)
index 0000000..749d525
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2015 Red Hat Inc.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * Authors: Ben Skeggs
+ */
+#include "gk104.h"
+
+#include <nvif/class.h>
+
+static struct nvkm_oclass
+gm204_fifo_sclass[] = {
+       { MAXWELL_CHANNEL_GPFIFO_A, &gk104_fifo_chan_ofuncs },
+       {}
+};
+
+static int
+gm204_fifo_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
+               struct nvkm_oclass *oclass, void *data, u32 size,
+               struct nvkm_object **pobject)
+{
+       int ret = gk104_fifo_ctor(parent, engine, oclass, data, size, pobject);
+       if (ret == 0) {
+               struct gk104_fifo_priv *priv = (void *)*pobject;
+               nv_engine(priv)->sclass = gm204_fifo_sclass;
+       }
+       return ret;
+}
+
+struct nvkm_oclass *
+gm204_fifo_oclass = &(struct gk104_fifo_impl) {
+       .base.handle = NV_ENGINE(FIFO, 0x24),
+       .base.ofuncs = &(struct nvkm_ofuncs) {
+               .ctor = gm204_fifo_ctor,
+               .dtor = gk104_fifo_dtor,
+               .init = gk104_fifo_init,
+               .fini = _nvkm_fifo_fini,
+       },
+       .channels = 4096,
+}.base;