- transition from "ioctl" interface

Signed-off-by: Ben Skeggs <bske...@nvidia.com>
---
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  2 +
 drivers/gpu/drm/nouveau/include/nvif/ioctl.h  | 17 ----
 drivers/gpu/drm/nouveau/include/nvif/object.h |  5 --
 .../drm/nouveau/include/nvkm/core/object.h    | 11 ---
 drivers/gpu/drm/nouveau/nouveau_chan.c        |  7 +-
 drivers/gpu/drm/nouveau/nvif/object.c         | 77 -------------------
 drivers/gpu/drm/nouveau/nvkm/core/ioctl.c     | 62 ---------------
 drivers/gpu/drm/nouveau/nvkm/core/object.c    | 18 -----
 drivers/gpu/drm/nouveau/nvkm/core/oproxy.c    | 21 -----
 .../gpu/drm/nouveau/nvkm/engine/fifo/uchan.c  | 26 ++-----
 10 files changed, 12 insertions(+), 234 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h 
b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
index 7dd2b187e6d6..75861e0327ac 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
@@ -446,6 +446,8 @@ struct nvif_chan_impl {
                } aper;
                u64 addr;
        } inst;
+
+       struct nvif_mapinfo map;
 };
 
 struct nvif_cgrp_impl {
diff --git a/drivers/gpu/drm/nouveau/include/nvif/ioctl.h 
b/drivers/gpu/drm/nouveau/include/nvif/ioctl.h
index e825c8a1d9ca..0eb479695c0a 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/ioctl.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/ioctl.h
@@ -8,8 +8,6 @@ struct nvif_ioctl_v0 {
 #define NVIF_IOCTL_V0_NEW                                                  0x02
 #define NVIF_IOCTL_V0_DEL                                                  0x03
 #define NVIF_IOCTL_V0_MTHD                                                 0x04
-#define NVIF_IOCTL_V0_MAP                                                  0x07
-#define NVIF_IOCTL_V0_UNMAP                                                0x08
        __u8  type;
        __u8  pad02[4];
 #define NVIF_IOCTL_V0_OWNER_NVIF                                           0x00
@@ -57,19 +55,4 @@ struct nvif_ioctl_mthd_v0 {
        __u8  pad02[6];
        __u8  data[];           /* method data (class.h) */
 };
-
-struct nvif_ioctl_map_v0 {
-       /* nvif_ioctl ... */
-       __u8  version;
-#define NVIF_IOCTL_MAP_V0_IO                                               0x00
-#define NVIF_IOCTL_MAP_V0_VA                                               0x01
-       __u8  type;
-       __u8  pad02[6];
-       __u64 handle;
-       __u64 length;
-       __u8  data[];
-};
-
-struct nvif_ioctl_unmap {
-};
 #endif
diff --git a/drivers/gpu/drm/nouveau/include/nvif/object.h 
b/drivers/gpu/drm/nouveau/include/nvif/object.h
index 10a8f3e1ea81..d52d59d9805d 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/object.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/object.h
@@ -51,11 +51,6 @@ void nvif_object_sclass_put(struct nvif_sclass **);
 int  nvif_object_mthd(struct nvif_object *, u32, void *, u32);
 int nvif_object_map_cpu(struct nvif_object *, const struct nvif_mapinfo *, 
struct nvif_map *);
 int nvif_object_unmap_cpu(struct nvif_map *);
-int  nvif_object_map_handle(struct nvif_object *, void *, u32,
-                           u64 *handle, u64 *length);
-void nvif_object_unmap_handle(struct nvif_object *);
-int  nvif_object_map(struct nvif_object *, void *, u32);
-void nvif_object_unmap(struct nvif_object *);
 
 #define nvif_handle(a) (unsigned long)(void *)(a)
 #define nvif_object(a) (a)->object
diff --git a/drivers/gpu/drm/nouveau/include/nvkm/core/object.h 
b/drivers/gpu/drm/nouveau/include/nvkm/core/object.h
index 9ab163d9a4d0..69972b0836e4 100644
--- a/drivers/gpu/drm/nouveau/include/nvkm/core/object.h
+++ b/drivers/gpu/drm/nouveau/include/nvkm/core/object.h
@@ -19,20 +19,12 @@ struct nvkm_object {
        struct rb_node node;
 };
 
-enum nvkm_object_map {
-       NVKM_OBJECT_MAP_IO,
-       NVKM_OBJECT_MAP_VA
-};
-
 struct nvkm_object_func {
        void *(*dtor)(struct nvkm_object *);
        int (*init)(struct nvkm_object *);
        int (*fini)(struct nvkm_object *, bool suspend);
        int (*mthd)(struct nvkm_object *, u32 mthd, void *data, u32 size);
        int (*ntfy)(struct nvkm_object *, u32 mthd, struct nvkm_event **);
-       int (*map)(struct nvkm_object *, void *argv, u32 argc,
-                  enum nvkm_object_map *, u64 *addr, u64 *size);
-       int (*unmap)(struct nvkm_object *);
        int (*bind)(struct nvkm_object *, struct nvkm_gpuobj *, int align,
                    struct nvkm_gpuobj **);
        int (*sclass)(struct nvkm_object *, int index, struct nvkm_oclass *);
@@ -52,9 +44,6 @@ int nvkm_object_init(struct nvkm_object *);
 int nvkm_object_fini(struct nvkm_object *, bool suspend);
 int nvkm_object_mthd(struct nvkm_object *, u32 mthd, void *data, u32 size);
 int nvkm_object_ntfy(struct nvkm_object *, u32 mthd, struct nvkm_event **);
-int nvkm_object_map(struct nvkm_object *, void *argv, u32 argc,
-                   enum nvkm_object_map *, u64 *addr, u64 *size);
-int nvkm_object_unmap(struct nvkm_object *);
 int nvkm_object_bind(struct nvkm_object *, struct nvkm_gpuobj *, int align,
                     struct nvkm_gpuobj **);
 
diff --git a/drivers/gpu/drm/nouveau/nouveau_chan.c 
b/drivers/gpu/drm/nouveau/nouveau_chan.c
index 21927b817fa8..60be87d5fd59 100644
--- a/drivers/gpu/drm/nouveau/nouveau_chan.c
+++ b/drivers/gpu/drm/nouveau/nouveau_chan.c
@@ -101,8 +101,6 @@ nouveau_channel_del(struct nouveau_channel **pchan)
                nvif_object_dtor(&chan->gart);
                nvif_object_dtor(&chan->vram);
                nvif_event_dtor(&chan->kill);
-               if (!chan->userd.map.impl)
-                       chan->userd.map.ptr = NULL;
                nvif_object_unmap_cpu(&chan->userd.map);
                nvif_chan_dtor(&chan->chan);
                nvif_mem_dtor(&chan->userd.mem);
@@ -359,11 +357,10 @@ nouveau_channel_init(struct nouveau_channel *chan, u32 
vram, u32 gart)
        int ret, i;
 
        if (!chan->userd.mem.impl) {
-               ret = nvif_object_map(&chan->chan.object, NULL, 0);
+               ret = nvif_object_map_cpu(&chan->chan.object, 
&chan->chan.impl->map,
+                                         &chan->userd.map);
                if (ret)
                        return ret;
-
-               chan->userd.map.ptr = chan->chan.object.map.ptr;
        } else {
                ret = nvif_mem_map(&chan->userd.mem, NULL, 0, &chan->userd.map);
                if (ret)
diff --git a/drivers/gpu/drm/nouveau/nvif/object.c 
b/drivers/gpu/drm/nouveau/nvif/object.c
index d0f4ddca085e..371a3605f537 100644
--- a/drivers/gpu/drm/nouveau/nvif/object.c
+++ b/drivers/gpu/drm/nouveau/nvif/object.c
@@ -126,58 +126,6 @@ nvif_object_mthd(struct nvif_object *object, u32 mthd, 
void *data, u32 size)
        return ret;
 }
 
-void
-nvif_object_unmap_handle(struct nvif_object *object)
-{
-       struct {
-               struct nvif_ioctl_v0 ioctl;
-               struct nvif_ioctl_unmap unmap;
-       } args = {
-               .ioctl.type = NVIF_IOCTL_V0_UNMAP,
-       };
-
-       nvif_object_ioctl(object, &args, sizeof(args), NULL);
-}
-
-int
-nvif_object_map_handle(struct nvif_object *object, void *argv, u32 argc,
-                      u64 *handle, u64 *length)
-{
-       struct {
-               struct nvif_ioctl_v0 ioctl;
-               struct nvif_ioctl_map_v0 map;
-       } *args;
-       u32 argn = sizeof(*args) + argc;
-       int ret, maptype;
-
-       if (!(args = kzalloc(argn, GFP_KERNEL)))
-               return -ENOMEM;
-       args->ioctl.type = NVIF_IOCTL_V0_MAP;
-       memcpy(args->map.data, argv, argc);
-
-       ret = nvif_object_ioctl(object, args, argn, NULL);
-       *handle = args->map.handle;
-       *length = args->map.length;
-       maptype = args->map.type;
-       kfree(args);
-       return ret ? ret : (maptype == NVIF_IOCTL_MAP_V0_IO);
-}
-
-void
-nvif_object_unmap(struct nvif_object *object)
-{
-       struct nvif_client *client = object->client;
-       if (object->map.ptr) {
-               if (object->map.size) {
-                       client->driver->unmap(client->object.priv, 
object->map.ptr,
-                                                                  
object->map.size);
-                       object->map.size = 0;
-               }
-               object->map.ptr = NULL;
-               nvif_object_unmap_handle(object);
-       }
-}
-
 int
 nvif_object_unmap_cpu(struct nvif_map *map)
 {
@@ -224,30 +172,6 @@ nvif_object_map_cpu(struct nvif_object *object,
        return 0;
 }
 
-int
-nvif_object_map(struct nvif_object *object, void *argv, u32 argc)
-{
-       struct nvif_client *client = object->client;
-       u64 handle, length;
-       int ret = nvif_object_map_handle(object, argv, argc, &handle, &length);
-       if (ret >= 0) {
-               if (ret) {
-                       object->map.ptr = 
client->driver->map(client->object.priv,
-                                                             handle,
-                                                             length);
-                       if (ret = -ENOMEM, object->map.ptr) {
-                               object->map.size = length;
-                               return 0;
-                       }
-               } else {
-                       object->map.ptr = (void *)(unsigned long)handle;
-                       return 0;
-               }
-               nvif_object_unmap_handle(object);
-       }
-       return ret;
-}
-
 void
 nvif_object_dtor(struct nvif_object *object)
 {
@@ -261,7 +185,6 @@ nvif_object_dtor(struct nvif_object *object)
        if (!nvif_object_constructed(object))
                return;
 
-       nvif_object_unmap(object);
        nvif_object_ioctl(object, &args, sizeof(args), NULL);
        object->client = NULL;
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c 
b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
index 45051a1249da..66f843cac37d 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c
@@ -186,64 +186,6 @@ nvkm_ioctl_mthd(struct nvkm_client *client,
        return ret;
 }
 
-
-static int
-nvkm_ioctl_rd(struct nvkm_client *client,
-             struct nvkm_object *object, void *data, u32 size)
-{
-       return -ENOSYS;
-}
-
-static int
-nvkm_ioctl_wr(struct nvkm_client *client,
-             struct nvkm_object *object, void *data, u32 size)
-{
-       return -ENOSYS;
-}
-
-static int
-nvkm_ioctl_map(struct nvkm_client *client,
-              struct nvkm_object *object, void *data, u32 size)
-{
-       union {
-               struct nvif_ioctl_map_v0 v0;
-       } *args = data;
-       enum nvkm_object_map type;
-       int ret = -ENOSYS;
-
-       nvif_ioctl(object, "map size %d\n", size);
-       if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, true))) {
-               nvif_ioctl(object, "map vers %d\n", args->v0.version);
-               ret = nvkm_object_map(object, data, size, &type,
-                                     &args->v0.handle,
-                                     &args->v0.length);
-               if (type == NVKM_OBJECT_MAP_IO)
-                       args->v0.type = NVIF_IOCTL_MAP_V0_IO;
-               else
-                       args->v0.type = NVIF_IOCTL_MAP_V0_VA;
-       }
-
-       return ret;
-}
-
-static int
-nvkm_ioctl_unmap(struct nvkm_client *client,
-                struct nvkm_object *object, void *data, u32 size)
-{
-       union {
-               struct nvif_ioctl_unmap none;
-       } *args = data;
-       int ret = -ENOSYS;
-
-       nvif_ioctl(object, "unmap size %d\n", size);
-       if (!(ret = nvif_unvers(ret, &data, &size, args->none))) {
-               nvif_ioctl(object, "unmap\n");
-               ret = nvkm_object_unmap(object);
-       }
-
-       return ret;
-}
-
 static struct {
        int version;
        int (*func)(struct nvkm_client *, struct nvkm_object *, void *, u32);
@@ -254,10 +196,6 @@ nvkm_ioctl_v0[] = {
        { 0x00, nvkm_ioctl_new },
        { 0x00, nvkm_ioctl_del },
        { 0x00, nvkm_ioctl_mthd },
-       { 0x00, nvkm_ioctl_rd },
-       { 0x00, nvkm_ioctl_wr },
-       { 0x00, nvkm_ioctl_map },
-       { 0x00, nvkm_ioctl_unmap },
 };
 
 static int
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/object.c 
b/drivers/gpu/drm/nouveau/nvkm/core/object.c
index d34a8ee1a0ae..8ad1aff9b8c7 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/object.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/object.c
@@ -115,23 +115,6 @@ nvkm_object_ntfy(struct nvkm_object *object, u32 mthd,
        return -ENODEV;
 }
 
-int
-nvkm_object_map(struct nvkm_object *object, void *argv, u32 argc,
-               enum nvkm_object_map *type, u64 *addr, u64 *size)
-{
-       if (likely(object->func->map))
-               return object->func->map(object, argv, argc, type, addr, size);
-       return -ENODEV;
-}
-
-int
-nvkm_object_unmap(struct nvkm_object *object)
-{
-       if (likely(object->func->unmap))
-               return object->func->unmap(object);
-       return -ENODEV;
-}
-
 int
 nvkm_object_bind(struct nvkm_object *object, struct nvkm_gpuobj *gpuobj,
                 int align, struct nvkm_gpuobj **pgpuobj)
@@ -234,7 +217,6 @@ nvkm_object_dtor(struct nvkm_object *object)
        }
 
        nvif_debug(object, "destroy running...\n");
-       nvkm_object_unmap(object);
        if (object->func->dtor)
                data = object->func->dtor(object);
        nvkm_engine_unref(&object->engine);
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c 
b/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c
index 5db80d1780f0..690131104d7b 100644
--- a/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c
+++ b/drivers/gpu/drm/nouveau/nvkm/core/oproxy.c
@@ -36,25 +36,6 @@ nvkm_oproxy_ntfy(struct nvkm_object *object, u32 mthd,
        return nvkm_object_ntfy(nvkm_oproxy(object)->object, mthd, pevent);
 }
 
-static int
-nvkm_oproxy_map(struct nvkm_object *object, void *argv, u32 argc,
-               enum nvkm_object_map *type, u64 *addr, u64 *size)
-{
-       struct nvkm_oproxy *oproxy = nvkm_oproxy(object);
-       return nvkm_object_map(oproxy->object, argv, argc, type, addr, size);
-}
-
-static int
-nvkm_oproxy_unmap(struct nvkm_object *object)
-{
-       struct nvkm_oproxy *oproxy = nvkm_oproxy(object);
-
-       if (unlikely(!oproxy->object))
-               return 0;
-
-       return nvkm_object_unmap(oproxy->object);
-}
-
 static int
 nvkm_oproxy_bind(struct nvkm_object *object, struct nvkm_gpuobj *parent,
                 int align, struct nvkm_gpuobj **pgpuobj)
@@ -159,8 +140,6 @@ nvkm_oproxy_func = {
        .fini = nvkm_oproxy_fini,
        .mthd = nvkm_oproxy_mthd,
        .ntfy = nvkm_oproxy_ntfy,
-       .map = nvkm_oproxy_map,
-       .unmap = nvkm_oproxy_unmap,
        .bind = nvkm_oproxy_bind,
        .sclass = nvkm_oproxy_sclass,
        .uevent = nvkm_oproxy_uevent,
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c 
b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c
index f21cd52d5ae3..e9279902c472 100644
--- a/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/fifo/uchan.c
@@ -254,23 +254,6 @@ nvkm_uchan_sclass(struct nvkm_object *object, int index, 
struct nvkm_oclass *ocl
        return -EINVAL;
 }
 
-static int
-nvkm_uchan_map(struct nvkm_object *object, void *argv, u32 argc,
-              enum nvkm_object_map *type, u64 *addr, u64 *size)
-{
-       struct nvkm_chan *chan = container_of(object, struct nvif_chan_priv, 
object)->chan;
-       struct nvkm_device *device = 
chan->cgrp->runl->fifo->engine.subdev.device;
-
-       if (chan->func->userd->bar < 0)
-               return -ENOSYS;
-
-       *type = NVKM_OBJECT_MAP_IO;
-       *addr = device->func->resource_addr(device, chan->func->userd->bar) +
-               chan->func->userd->base + chan->userd.base;
-       *size = chan->func->userd->size;
-       return 0;
-}
-
 static void
 nvkm_uchan_del(struct nvif_chan_priv *uchan)
 {
@@ -329,7 +312,6 @@ nvkm_uchan = {
        .dtor = nvkm_uchan_dtor,
        .init = nvkm_uchan_init,
        .fini = nvkm_uchan_fini,
-       .map = nvkm_uchan_map,
        .sclass = nvkm_uchan_sclass,
        .uevent = nvkm_uchan_uevent,
 };
@@ -414,6 +396,14 @@ nvkm_uchan_new(struct nvkm_device *device, struct 
nvkm_cgrp *cgrp, u8 runi, u8 r
 
        uchan->impl.inst.addr = nvkm_memory_addr(chan->inst->memory);
 
+       if (chan->func->userd->bar >= 0) {
+               uchan->impl.map.type = NVIF_MAP_IO;
+               uchan->impl.map.handle =
+                       device->func->resource_addr(device, 
chan->func->userd->bar) +
+                       chan->func->userd->base + chan->userd.base;
+               uchan->impl.map.length = chan->func->userd->size;
+       }
+
        *pimpl = &uchan->impl;
        *ppriv = uchan;
        *pobject = &uchan->object;
-- 
2.41.0

Reply via email to