]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/nouveau/nvif: replace pushbuf with vm in fermi/kepler gpfifo class args
authorBen Skeggs <bskeggs@redhat.com>
Thu, 20 Aug 2015 04:54:16 +0000 (14:54 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 28 Aug 2015 02:40:33 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/class.h
drivers/gpu/drm/nouveau/nouveau_chan.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/base.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/g84.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gf100.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/gk104.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv04.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv10.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv17.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv40.c
drivers/gpu/drm/nouveau/nvkm/engine/fifo/nv50.c

index 9c25272b4b793f91a09f14dabc7eb5a6cec9ed35..e11b5acb35e7856292cb6f4a834db05d355f370e 100644 (file)
@@ -354,9 +354,18 @@ struct nvif_control_pstate_user_v0 {
  ******************************************************************************/
 
 struct nv03_channel_dma_v0 {
+       __u8  version;
+       __u8  chid;
+       __u8  pad02[2];
+       __u32 offset;
+       __u64 pushbuf;
+};
+
+struct nv50_channel_dma_v0 {
        __u8  version;
        __u8  chid;
        __u8  pad02[6];
+       __u64 vm;
        __u64 pushbuf;
        __u64 offset;
 };
@@ -374,6 +383,16 @@ struct nv50_channel_gpfifo_v0 {
        __u32 ilength;
        __u64 ioffset;
        __u64 pushbuf;
+       __u64 vm;
+};
+
+struct fermi_channel_gpfifo_v0 {
+       __u8  version;
+       __u8  chid;
+       __u8  pad02[2];
+       __u32 ilength;
+       __u64 ioffset;
+       __u64 vm;
 };
 
 struct kepler_channel_gpfifo_a_v0 {
@@ -389,7 +408,7 @@ struct kepler_channel_gpfifo_a_v0 {
        __u16 chid;
        __u32 ilength;
        __u64 ioffset;
-       __u64 pushbuf;
+       __u64 vm;
 };
 
 /*******************************************************************************
index 65a144f8d3a7e97a389347a409d5c3cf16cf1205..7f3e821e235deef2c0926c42a05548094985ffcf 100644 (file)
@@ -193,6 +193,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
        const u16 *oclass = oclasses;
        union {
                struct nv50_channel_gpfifo_v0 nv50;
+               struct fermi_channel_gpfifo_v0 fermi;
                struct kepler_channel_gpfifo_a_v0 kepler;
        } args;
        struct nouveau_channel *chan;
@@ -210,15 +211,23 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
                if (oclass[0] >= KEPLER_CHANNEL_GPFIFO_A) {
                        args.kepler.version = 0;
                        args.kepler.engine  = engine;
-                       args.kepler.pushbuf = nvif_handle(&chan->push.ctxdma);
                        args.kepler.ilength = 0x02000;
                        args.kepler.ioffset = 0x10000 + chan->push.vma.offset;
+                       args.kepler.vm = 0;
                        size = sizeof(args.kepler);
+               } else
+               if (oclass[0] >= FERMI_CHANNEL_GPFIFO) {
+                       args.fermi.version = 0;
+                       args.fermi.ilength = 0x02000;
+                       args.fermi.ioffset = 0x10000 + chan->push.vma.offset;
+                       args.fermi.vm = 0;
+                       size = sizeof(args.fermi);
                } else {
                        args.nv50.version = 0;
-                       args.nv50.pushbuf = nvif_handle(&chan->push.ctxdma);
                        args.nv50.ilength = 0x02000;
                        args.nv50.ioffset = 0x10000 + chan->push.vma.offset;
+                       args.nv50.pushbuf = nvif_handle(&chan->push.ctxdma);
+                       args.nv50.vm = 0;
                        size = sizeof(args.nv50);
                }
 
@@ -227,6 +236,9 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
                if (ret == 0) {
                        if (chan->user.oclass >= KEPLER_CHANNEL_GPFIFO_A)
                                chan->chid = args.kepler.chid;
+                       else
+                       if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO)
+                               chan->chid = args.fermi.chid;
                        else
                                chan->chid = args.nv50.chid;
                        return ret;
index 73b8ab4c222ebd26dd4a646bf59d0f13a3b911b6..f937d705d6687ff4f2aa38a2f0a954ade49cf2b3 100644 (file)
@@ -76,23 +76,25 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
                return ret;
 
        /* validate dma object representing push buffer */
-       handle = nvkm_client_search(client, pushbuf);
-       if (!handle)
-               return -ENOENT;
-       dmaobj = (void *)handle->object;
-
-       dmaeng = (void *)dmaobj->base.engine;
-       switch (dmaobj->base.oclass->handle) {
-       case NV_DMA_FROM_MEMORY:
-       case NV_DMA_IN_MEMORY:
-               break;
-       default:
-               return -EINVAL;
-       }
+       if (pushbuf) {
+               handle = nvkm_client_search(client, pushbuf);
+               if (!handle)
+                       return -ENOENT;
+               dmaobj = (void *)handle->object;
+
+               dmaeng = (void *)dmaobj->base.engine;
+               switch (dmaobj->base.oclass->handle) {
+               case NV_DMA_FROM_MEMORY:
+               case NV_DMA_IN_MEMORY:
+                       break;
+               default:
+                       return -EINVAL;
+               }
 
-       ret = dmaeng->bind(dmaobj, parent, &chan->pushgpu);
-       if (ret)
-               return ret;
+               ret = dmaeng->bind(dmaobj, parent, &chan->pushgpu);
+               if (ret)
+                       return ret;
+       }
 
        /* find a free fifo channel */
        spin_lock_irqsave(&fifo->lock, flags);
index 575329d3f2bb42c439436b18b7aa2f73efaa959d..64523d7eea589a16577a83266e612f0945e84505 100644 (file)
@@ -173,7 +173,7 @@ g84_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine,
                       struct nvkm_object **pobject)
 {
        union {
-               struct nv03_channel_dma_v0 v0;
+               struct nv50_channel_dma_v0 v0;
        } *args = data;
        struct nvkm_bar *bar = nvkm_bar(parent);
        struct nv50_fifo_base *base = (void *)parent;
@@ -185,6 +185,8 @@ g84_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine,
                nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
                                   "offset %016llx\n", args->v0.version,
                           args->v0.pushbuf, args->v0.offset);
+               if (args->v0.vm)
+                       return -ENOENT;
        } else
                return ret;
 
@@ -262,6 +264,8 @@ g84_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine,
                                   "ioffset %016llx ilength %08x\n",
                           args->v0.version, args->v0.pushbuf, args->v0.ioffset,
                           args->v0.ilength);
+               if (args->v0.vm)
+                       return -ENOENT;
        } else
                return ret;
 
index cdb25b5cf275242acb22552d08bbaa8682bb7486..1fa38227059f81a05fb1230587f926c10e1eef08 100644 (file)
@@ -199,7 +199,7 @@ gf100_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
                     struct nvkm_object **pobject)
 {
        union {
-               struct nv50_channel_gpfifo_v0 v0;
+               struct fermi_channel_gpfifo_v0 v0;
        } *args = data;
        struct nvkm_bar *bar = nvkm_bar(parent);
        struct gf100_fifo *fifo = (void *)engine;
@@ -211,16 +211,17 @@ gf100_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
 
        nvif_ioctl(parent, "create channel gpfifo size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
-               nvif_ioctl(parent, "create channel gpfifo vers %d pushbuf %llx "
+               nvif_ioctl(parent, "create channel gpfifo vers %d "
                                   "ioffset %016llx ilength %08x\n",
-                          args->v0.version, args->v0.pushbuf, args->v0.ioffset,
+                          args->v0.version, args->v0.ioffset,
                           args->v0.ilength);
+               if (args->v0.vm)
+                       return -ENOENT;
        } else
                return ret;
 
        ret = nvkm_fifo_channel_create(parent, engine, oclass, 1,
-                                      fifo->user.bar.offset, 0x1000,
-                                      args->v0.pushbuf,
+                                      fifo->user.bar.offset, 0x1000, 0,
                                       (1ULL << NVDEV_ENGINE_SW) |
                                       (1ULL << NVDEV_ENGINE_GR) |
                                       (1ULL << NVDEV_ENGINE_CE0) |
index bdd0b00c59c9fdc106d3d03f06879584c8679562..48b526cb8cb5b2c3b846c4d2a1bd047173cd0a60 100644 (file)
@@ -252,10 +252,12 @@ gk104_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
 
        nvif_ioctl(parent, "create channel gpfifo size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
-               nvif_ioctl(parent, "create channel gpfifo vers %d pushbuf %llx "
+               nvif_ioctl(parent, "create channel gpfifo vers %d "
                                   "ioffset %016llx ilength %08x engine %08x\n",
-                          args->v0.version, args->v0.pushbuf, args->v0.ioffset,
+                          args->v0.version, args->v0.ioffset,
                           args->v0.ilength, args->v0.engine);
+               if (args->v0.vm)
+                       return -ENOENT;
        } else
                return ret;
 
@@ -282,8 +284,7 @@ gk104_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
        i = __ffs(engines);
 
        ret = nvkm_fifo_channel_create(parent, engine, oclass, 1,
-                                      fifo->user.bar.offset, 0x200,
-                                      args->v0.pushbuf,
+                                      fifo->user.bar.offset, 0x200, 0,
                                       fifo_engine[i].mask, &chan);
        *pobject = nv_object(chan);
        if (ret)
index 6458fa0dcb950bc46709ba256c091e3cc5616d0b..51b8fce9e0fc14a4b681911aab070dd8de0b6290 100644 (file)
@@ -121,7 +121,7 @@ nv04_fifo_chan_ctor(struct nvkm_object *parent,
        nvif_ioctl(parent, "create channel dma size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
                nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
-                                  "offset %016llx\n", args->v0.version,
+                                  "offset %08x\n", args->v0.version,
                           args->v0.pushbuf, args->v0.offset);
        } else
                return ret;
index c4b5a3002e3ceccf77bda3b8c324e5b74be1680a..046acc2813817fe9d6bb2ae374ec13030a0c2506 100644 (file)
@@ -65,7 +65,7 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent,
        nvif_ioctl(parent, "create channel dma size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
                nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
-                                  "offset %016llx\n", args->v0.version,
+                                  "offset %08x\n", args->v0.version,
                           args->v0.pushbuf, args->v0.offset);
        } else
                return ret;
index ece2715e77ff536059d0810baf016d8c1e447777..7be6fea900100389869b7c29678aa6e93235149e 100644 (file)
@@ -70,7 +70,7 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent,
        nvif_ioctl(parent, "create channel dma size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
                nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
-                                  "offset %016llx\n", args->v0.version,
+                                  "offset %08x\n", args->v0.version,
                           args->v0.pushbuf, args->v0.offset);
        } else
                return ret;
index a42218a961d473c26868fd41b742e9b4bf8c2c01..cad4b4be19387d04511017c15dd167f8f95e9783 100644 (file)
@@ -193,7 +193,7 @@ nv40_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
        nvif_ioctl(parent, "create channel dma size %d\n", size);
        if (nvif_unpack(args->v0, 0, 0, false)) {
                nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
-                                  "offset %016llx\n", args->v0.version,
+                                  "offset %08x\n", args->v0.version,
                           args->v0.pushbuf, args->v0.offset);
        } else
                return ret;
index 1a7ca8e5aecbfc939e7e6c0c050e1347e0005f1a..402639cb4ec9e484d0ac478f37e06f6165a7d392 100644 (file)
@@ -203,7 +203,7 @@ nv50_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine,
                        struct nvkm_object **pobject)
 {
        union {
-               struct nv03_channel_dma_v0 v0;
+               struct nv50_channel_dma_v0 v0;
        } *args = data;
        struct nvkm_bar *bar = nvkm_bar(parent);
        struct nv50_fifo_base *base = (void *)parent;
@@ -215,6 +215,8 @@ nv50_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine,
                nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
                                   "offset %016llx\n", args->v0.version,
                           args->v0.pushbuf, args->v0.offset);
+               if (args->v0.vm)
+                       return -ENOENT;
        } else
                return ret;
 
@@ -280,6 +282,8 @@ nv50_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine,
                                   "ioffset %016llx ilength %08x\n",
                           args->v0.version, args->v0.pushbuf, args->v0.ioffset,
                           args->v0.ilength);
+               if (args->v0.vm)
+                       return -ENOENT;
        } else
                return ret;