drm/nouveau/nvif: extend nop ioctl to return nvif version identifier
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:32 +0000 (12:40 +1000)
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/include/nvif/client.h
drivers/gpu/drm/nouveau/include/nvif/ioctl.h
drivers/gpu/drm/nouveau/nvif/client.c
drivers/gpu/drm/nouveau/nvkm/core/ioctl.c

index cd6fbfa887621efcf147365b29c8603dbe463da4..4d5db8039576baef9da12d27c86f9537383d0bb8 100644 (file)
@@ -6,6 +6,7 @@
 struct nvif_client {
        struct nvif_object object;
        const struct nvif_driver *driver;
+       u64 version;
        u8 route;
        bool super;
 };
index 9d99768f1a35710bee35daa1e8539d786bf24e2a..772db0de044aeea32cfa75cf19f408e6b8a353f4 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __NVIF_IOCTL_H__
 #define __NVIF_IOCTL_H__
 
+#define NVIF_VERSION_LATEST                               0x0000000000000000ULL
+
 struct nvif_ioctl_v0 {
        __u8  version;
 #define NVIF_IOCTL_V0_NOP                                                  0x00
@@ -29,7 +31,8 @@ struct nvif_ioctl_v0 {
        __u8  data[];           /* ioctl data (below) */
 };
 
-struct nvif_ioctl_nop {
+struct nvif_ioctl_nop_v0 {
+       __u64 version;
 };
 
 struct nvif_ioctl_sclass_v0 {
index 64d3d0c37a83acc99b1fc723cd359e851ce4ae12..1ee9294eca2eac27070ded42a200d9e45a50dc49 100644 (file)
@@ -71,6 +71,10 @@ int
 nvif_client_init(const char *driver, const char *name, u64 device,
                 const char *cfg, const char *dbg, struct nvif_client *client)
 {
+       struct {
+               struct nvif_ioctl_v0 ioctl;
+               struct nvif_ioctl_nop_v0 nop;
+       } args = {};
        int ret, i;
 
        ret = nvif_object_init(NULL, 0, 0, NULL, 0, &client->object);
@@ -91,6 +95,11 @@ nvif_client_init(const char *driver, const char *name, u64 device,
                }
        }
 
+       if (ret == 0) {
+               ret = nvif_client_ioctl(client, &args, sizeof(args));
+               client->version = args.nop.version;
+       }
+
        if (ret)
                nvif_client_fini(client);
        return ret;
index 7654783e835041a09ea68b249893a6bfeb3658d1..629ee56dd8ab989e48f37a4ab562698d8aa27ee3 100644 (file)
@@ -35,13 +35,14 @@ nvkm_ioctl_nop(struct nvkm_handle *handle, void *data, u32 size)
 {
        struct nvkm_object *object = handle->object;
        union {
-               struct nvif_ioctl_nop none;
+               struct nvif_ioctl_nop_v0 v0;
        } *args = data;
        int ret;
 
        nvif_ioctl(object, "nop size %d\n", size);
-       if (nvif_unvers(args->none)) {
-               nvif_ioctl(object, "nop\n");
+       if (nvif_unpack(args->v0, 0, 0, false)) {
+               nvif_ioctl(object, "nop vers %lld\n", args->v0.version);
+               args->v0.version = NVIF_VERSION_LATEST;
        }
 
        return ret;