Commit 159045cd authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/nvif: replace pushbuf with vm in fermi/kepler gpfifo class args

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 22827fa4
...@@ -354,9 +354,18 @@ struct nvif_control_pstate_user_v0 { ...@@ -354,9 +354,18 @@ struct nvif_control_pstate_user_v0 {
******************************************************************************/ ******************************************************************************/
struct nv03_channel_dma_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 version;
__u8 chid; __u8 chid;
__u8 pad02[6]; __u8 pad02[6];
__u64 vm;
__u64 pushbuf; __u64 pushbuf;
__u64 offset; __u64 offset;
}; };
...@@ -374,6 +383,16 @@ struct nv50_channel_gpfifo_v0 { ...@@ -374,6 +383,16 @@ struct nv50_channel_gpfifo_v0 {
__u32 ilength; __u32 ilength;
__u64 ioffset; __u64 ioffset;
__u64 pushbuf; __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 { struct kepler_channel_gpfifo_a_v0 {
...@@ -389,7 +408,7 @@ struct kepler_channel_gpfifo_a_v0 { ...@@ -389,7 +408,7 @@ struct kepler_channel_gpfifo_a_v0 {
__u16 chid; __u16 chid;
__u32 ilength; __u32 ilength;
__u64 ioffset; __u64 ioffset;
__u64 pushbuf; __u64 vm;
}; };
/******************************************************************************* /*******************************************************************************
......
...@@ -193,6 +193,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -193,6 +193,7 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
const u16 *oclass = oclasses; const u16 *oclass = oclasses;
union { union {
struct nv50_channel_gpfifo_v0 nv50; struct nv50_channel_gpfifo_v0 nv50;
struct fermi_channel_gpfifo_v0 fermi;
struct kepler_channel_gpfifo_a_v0 kepler; struct kepler_channel_gpfifo_a_v0 kepler;
} args; } args;
struct nouveau_channel *chan; struct nouveau_channel *chan;
...@@ -210,15 +211,23 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -210,15 +211,23 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
if (oclass[0] >= KEPLER_CHANNEL_GPFIFO_A) { if (oclass[0] >= KEPLER_CHANNEL_GPFIFO_A) {
args.kepler.version = 0; args.kepler.version = 0;
args.kepler.engine = engine; args.kepler.engine = engine;
args.kepler.pushbuf = nvif_handle(&chan->push.ctxdma);
args.kepler.ilength = 0x02000; args.kepler.ilength = 0x02000;
args.kepler.ioffset = 0x10000 + chan->push.vma.offset; args.kepler.ioffset = 0x10000 + chan->push.vma.offset;
args.kepler.vm = 0;
size = sizeof(args.kepler); 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 { } else {
args.nv50.version = 0; args.nv50.version = 0;
args.nv50.pushbuf = nvif_handle(&chan->push.ctxdma);
args.nv50.ilength = 0x02000; args.nv50.ilength = 0x02000;
args.nv50.ioffset = 0x10000 + chan->push.vma.offset; args.nv50.ioffset = 0x10000 + chan->push.vma.offset;
args.nv50.pushbuf = nvif_handle(&chan->push.ctxdma);
args.nv50.vm = 0;
size = sizeof(args.nv50); size = sizeof(args.nv50);
} }
...@@ -227,6 +236,9 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device, ...@@ -227,6 +236,9 @@ nouveau_channel_ind(struct nouveau_drm *drm, struct nvif_device *device,
if (ret == 0) { if (ret == 0) {
if (chan->user.oclass >= KEPLER_CHANNEL_GPFIFO_A) if (chan->user.oclass >= KEPLER_CHANNEL_GPFIFO_A)
chan->chid = args.kepler.chid; chan->chid = args.kepler.chid;
else
if (chan->user.oclass >= FERMI_CHANNEL_GPFIFO)
chan->chid = args.fermi.chid;
else else
chan->chid = args.nv50.chid; chan->chid = args.nv50.chid;
return ret; return ret;
......
...@@ -76,23 +76,25 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent, ...@@ -76,23 +76,25 @@ nvkm_fifo_channel_create_(struct nvkm_object *parent,
return ret; return ret;
/* validate dma object representing push buffer */ /* validate dma object representing push buffer */
handle = nvkm_client_search(client, pushbuf); if (pushbuf) {
if (!handle) handle = nvkm_client_search(client, pushbuf);
return -ENOENT; if (!handle)
dmaobj = (void *)handle->object; return -ENOENT;
dmaobj = (void *)handle->object;
dmaeng = (void *)dmaobj->base.engine;
switch (dmaobj->base.oclass->handle) { dmaeng = (void *)dmaobj->base.engine;
case NV_DMA_FROM_MEMORY: switch (dmaobj->base.oclass->handle) {
case NV_DMA_IN_MEMORY: case NV_DMA_FROM_MEMORY:
break; case NV_DMA_IN_MEMORY:
default: break;
return -EINVAL; default:
} return -EINVAL;
}
ret = dmaeng->bind(dmaobj, parent, &chan->pushgpu); ret = dmaeng->bind(dmaobj, parent, &chan->pushgpu);
if (ret) if (ret)
return ret; return ret;
}
/* find a free fifo channel */ /* find a free fifo channel */
spin_lock_irqsave(&fifo->lock, flags); spin_lock_irqsave(&fifo->lock, flags);
......
...@@ -173,7 +173,7 @@ g84_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -173,7 +173,7 @@ g84_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
union { union {
struct nv03_channel_dma_v0 v0; struct nv50_channel_dma_v0 v0;
} *args = data; } *args = data;
struct nvkm_bar *bar = nvkm_bar(parent); struct nvkm_bar *bar = nvkm_bar(parent);
struct nv50_fifo_base *base = (void *)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, ...@@ -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 " nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
"offset %016llx\n", args->v0.version, "offset %016llx\n", args->v0.version,
args->v0.pushbuf, args->v0.offset); args->v0.pushbuf, args->v0.offset);
if (args->v0.vm)
return -ENOENT;
} else } else
return ret; return ret;
...@@ -262,6 +264,8 @@ g84_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -262,6 +264,8 @@ g84_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine,
"ioffset %016llx ilength %08x\n", "ioffset %016llx ilength %08x\n",
args->v0.version, args->v0.pushbuf, args->v0.ioffset, args->v0.version, args->v0.pushbuf, args->v0.ioffset,
args->v0.ilength); args->v0.ilength);
if (args->v0.vm)
return -ENOENT;
} else } else
return ret; return ret;
......
...@@ -199,7 +199,7 @@ gf100_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -199,7 +199,7 @@ gf100_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
union { union {
struct nv50_channel_gpfifo_v0 v0; struct fermi_channel_gpfifo_v0 v0;
} *args = data; } *args = data;
struct nvkm_bar *bar = nvkm_bar(parent); struct nvkm_bar *bar = nvkm_bar(parent);
struct gf100_fifo *fifo = (void *)engine; struct gf100_fifo *fifo = (void *)engine;
...@@ -211,16 +211,17 @@ gf100_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *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); nvif_ioctl(parent, "create channel gpfifo size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, false)) { 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", "ioffset %016llx ilength %08x\n",
args->v0.version, args->v0.pushbuf, args->v0.ioffset, args->v0.version, args->v0.ioffset,
args->v0.ilength); args->v0.ilength);
if (args->v0.vm)
return -ENOENT;
} else } else
return ret; return ret;
ret = nvkm_fifo_channel_create(parent, engine, oclass, 1, ret = nvkm_fifo_channel_create(parent, engine, oclass, 1,
fifo->user.bar.offset, 0x1000, fifo->user.bar.offset, 0x1000, 0,
args->v0.pushbuf,
(1ULL << NVDEV_ENGINE_SW) | (1ULL << NVDEV_ENGINE_SW) |
(1ULL << NVDEV_ENGINE_GR) | (1ULL << NVDEV_ENGINE_GR) |
(1ULL << NVDEV_ENGINE_CE0) | (1ULL << NVDEV_ENGINE_CE0) |
......
...@@ -252,10 +252,12 @@ gk104_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -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); nvif_ioctl(parent, "create channel gpfifo size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, false)) { 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", "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); args->v0.ilength, args->v0.engine);
if (args->v0.vm)
return -ENOENT;
} else } else
return ret; return ret;
...@@ -282,8 +284,7 @@ gk104_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -282,8 +284,7 @@ gk104_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine,
i = __ffs(engines); i = __ffs(engines);
ret = nvkm_fifo_channel_create(parent, engine, oclass, 1, ret = nvkm_fifo_channel_create(parent, engine, oclass, 1,
fifo->user.bar.offset, 0x200, fifo->user.bar.offset, 0x200, 0,
args->v0.pushbuf,
fifo_engine[i].mask, &chan); fifo_engine[i].mask, &chan);
*pobject = nv_object(chan); *pobject = nv_object(chan);
if (ret) if (ret)
......
...@@ -121,7 +121,7 @@ nv04_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -121,7 +121,7 @@ nv04_fifo_chan_ctor(struct nvkm_object *parent,
nvif_ioctl(parent, "create channel dma size %d\n", size); nvif_ioctl(parent, "create channel dma size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, false)) { if (nvif_unpack(args->v0, 0, 0, false)) {
nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " 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); args->v0.pushbuf, args->v0.offset);
} else } else
return ret; return ret;
......
...@@ -65,7 +65,7 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -65,7 +65,7 @@ nv10_fifo_chan_ctor(struct nvkm_object *parent,
nvif_ioctl(parent, "create channel dma size %d\n", size); nvif_ioctl(parent, "create channel dma size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, false)) { if (nvif_unpack(args->v0, 0, 0, false)) {
nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " 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); args->v0.pushbuf, args->v0.offset);
} else } else
return ret; return ret;
......
...@@ -70,7 +70,7 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent, ...@@ -70,7 +70,7 @@ nv17_fifo_chan_ctor(struct nvkm_object *parent,
nvif_ioctl(parent, "create channel dma size %d\n", size); nvif_ioctl(parent, "create channel dma size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, false)) { if (nvif_unpack(args->v0, 0, 0, false)) {
nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " 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); args->v0.pushbuf, args->v0.offset);
} else } else
return ret; return ret;
......
...@@ -193,7 +193,7 @@ nv40_fifo_chan_ctor(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -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); nvif_ioctl(parent, "create channel dma size %d\n", size);
if (nvif_unpack(args->v0, 0, 0, false)) { if (nvif_unpack(args->v0, 0, 0, false)) {
nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx " 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); args->v0.pushbuf, args->v0.offset);
} else } else
return ret; return ret;
......
...@@ -203,7 +203,7 @@ nv50_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -203,7 +203,7 @@ nv50_fifo_chan_ctor_dma(struct nvkm_object *parent, struct nvkm_object *engine,
struct nvkm_object **pobject) struct nvkm_object **pobject)
{ {
union { union {
struct nv03_channel_dma_v0 v0; struct nv50_channel_dma_v0 v0;
} *args = data; } *args = data;
struct nvkm_bar *bar = nvkm_bar(parent); struct nvkm_bar *bar = nvkm_bar(parent);
struct nv50_fifo_base *base = (void *)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, ...@@ -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 " nvif_ioctl(parent, "create channel dma vers %d pushbuf %llx "
"offset %016llx\n", args->v0.version, "offset %016llx\n", args->v0.version,
args->v0.pushbuf, args->v0.offset); args->v0.pushbuf, args->v0.offset);
if (args->v0.vm)
return -ENOENT;
} else } else
return ret; return ret;
...@@ -280,6 +282,8 @@ nv50_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine, ...@@ -280,6 +282,8 @@ nv50_fifo_chan_ctor_ind(struct nvkm_object *parent, struct nvkm_object *engine,
"ioffset %016llx ilength %08x\n", "ioffset %016llx ilength %08x\n",
args->v0.version, args->v0.pushbuf, args->v0.ioffset, args->v0.version, args->v0.pushbuf, args->v0.ioffset,
args->v0.ilength); args->v0.ilength);
if (args->v0.vm)
return -ENOENT;
} else } else
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment