diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2015-08-20 00:54:16 -0400 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2015-08-27 22:40:32 -0400 |
commit | 99d4d36ad673c2b4fea364f6d456718f0f701ce4 (patch) | |
tree | 399fcfec785e9b4f94ad003ea9a8c45c4245edb2 /drivers/gpu | |
parent | bf81df9be28657eea4aca8c6ab4ed3e69f8a051c (diff) |
drm/nouveau/nvif: extend nop ioctl to return nvif version identifier
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvif/client.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/include/nvif/ioctl.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvif/client.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/nouveau/nvkm/core/ioctl.c | 7 |
4 files changed, 18 insertions, 4 deletions
diff --git a/drivers/gpu/drm/nouveau/include/nvif/client.h b/drivers/gpu/drm/nouveau/include/nvif/client.h index cd6fbfa88762..4d5db8039576 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/client.h +++ b/drivers/gpu/drm/nouveau/include/nvif/client.h | |||
@@ -6,6 +6,7 @@ | |||
6 | struct nvif_client { | 6 | struct nvif_client { |
7 | struct nvif_object object; | 7 | struct nvif_object object; |
8 | const struct nvif_driver *driver; | 8 | const struct nvif_driver *driver; |
9 | u64 version; | ||
9 | u8 route; | 10 | u8 route; |
10 | bool super; | 11 | bool super; |
11 | }; | 12 | }; |
diff --git a/drivers/gpu/drm/nouveau/include/nvif/ioctl.h b/drivers/gpu/drm/nouveau/include/nvif/ioctl.h index 9d99768f1a35..772db0de044a 100644 --- a/drivers/gpu/drm/nouveau/include/nvif/ioctl.h +++ b/drivers/gpu/drm/nouveau/include/nvif/ioctl.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __NVIF_IOCTL_H__ | 1 | #ifndef __NVIF_IOCTL_H__ |
2 | #define __NVIF_IOCTL_H__ | 2 | #define __NVIF_IOCTL_H__ |
3 | 3 | ||
4 | #define NVIF_VERSION_LATEST 0x0000000000000000ULL | ||
5 | |||
4 | struct nvif_ioctl_v0 { | 6 | struct nvif_ioctl_v0 { |
5 | __u8 version; | 7 | __u8 version; |
6 | #define NVIF_IOCTL_V0_NOP 0x00 | 8 | #define NVIF_IOCTL_V0_NOP 0x00 |
@@ -29,7 +31,8 @@ struct nvif_ioctl_v0 { | |||
29 | __u8 data[]; /* ioctl data (below) */ | 31 | __u8 data[]; /* ioctl data (below) */ |
30 | }; | 32 | }; |
31 | 33 | ||
32 | struct nvif_ioctl_nop { | 34 | struct nvif_ioctl_nop_v0 { |
35 | __u64 version; | ||
33 | }; | 36 | }; |
34 | 37 | ||
35 | struct nvif_ioctl_sclass_v0 { | 38 | struct nvif_ioctl_sclass_v0 { |
diff --git a/drivers/gpu/drm/nouveau/nvif/client.c b/drivers/gpu/drm/nouveau/nvif/client.c index 64d3d0c37a83..1ee9294eca2e 100644 --- a/drivers/gpu/drm/nouveau/nvif/client.c +++ b/drivers/gpu/drm/nouveau/nvif/client.c | |||
@@ -71,6 +71,10 @@ int | |||
71 | nvif_client_init(const char *driver, const char *name, u64 device, | 71 | nvif_client_init(const char *driver, const char *name, u64 device, |
72 | const char *cfg, const char *dbg, struct nvif_client *client) | 72 | const char *cfg, const char *dbg, struct nvif_client *client) |
73 | { | 73 | { |
74 | struct { | ||
75 | struct nvif_ioctl_v0 ioctl; | ||
76 | struct nvif_ioctl_nop_v0 nop; | ||
77 | } args = {}; | ||
74 | int ret, i; | 78 | int ret, i; |
75 | 79 | ||
76 | ret = nvif_object_init(NULL, 0, 0, NULL, 0, &client->object); | 80 | 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, | |||
91 | } | 95 | } |
92 | } | 96 | } |
93 | 97 | ||
98 | if (ret == 0) { | ||
99 | ret = nvif_client_ioctl(client, &args, sizeof(args)); | ||
100 | client->version = args.nop.version; | ||
101 | } | ||
102 | |||
94 | if (ret) | 103 | if (ret) |
95 | nvif_client_fini(client); | 104 | nvif_client_fini(client); |
96 | return ret; | 105 | return ret; |
diff --git a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c index 7654783e8350..629ee56dd8ab 100644 --- a/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c +++ b/drivers/gpu/drm/nouveau/nvkm/core/ioctl.c | |||
@@ -35,13 +35,14 @@ nvkm_ioctl_nop(struct nvkm_handle *handle, void *data, u32 size) | |||
35 | { | 35 | { |
36 | struct nvkm_object *object = handle->object; | 36 | struct nvkm_object *object = handle->object; |
37 | union { | 37 | union { |
38 | struct nvif_ioctl_nop none; | 38 | struct nvif_ioctl_nop_v0 v0; |
39 | } *args = data; | 39 | } *args = data; |
40 | int ret; | 40 | int ret; |
41 | 41 | ||
42 | nvif_ioctl(object, "nop size %d\n", size); | 42 | nvif_ioctl(object, "nop size %d\n", size); |
43 | if (nvif_unvers(args->none)) { | 43 | if (nvif_unpack(args->v0, 0, 0, false)) { |
44 | nvif_ioctl(object, "nop\n"); | 44 | nvif_ioctl(object, "nop vers %lld\n", args->v0.version); |
45 | args->v0.version = NVIF_VERSION_LATEST; | ||
45 | } | 46 | } |
46 | 47 | ||
47 | return ret; | 48 | return ret; |