Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 99d4d36a authored by Ben Skeggs's avatar Ben Skeggs
Browse files

drm/nouveau/nvif: extend nop ioctl to return nvif version identifier



Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent bf81df9b
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -6,6 +6,7 @@
struct nvif_client {
struct nvif_client {
	struct nvif_object object;
	struct nvif_object object;
	const struct nvif_driver *driver;
	const struct nvif_driver *driver;
	u64 version;
	u8 route;
	u8 route;
	bool super;
	bool super;
};
};
+4 −1
Original line number Original line Diff line number Diff line
#ifndef __NVIF_IOCTL_H__
#ifndef __NVIF_IOCTL_H__
#define __NVIF_IOCTL_H__
#define __NVIF_IOCTL_H__


#define NVIF_VERSION_LATEST                               0x0000000000000000ULL

struct nvif_ioctl_v0 {
struct nvif_ioctl_v0 {
	__u8  version;
	__u8  version;
#define NVIF_IOCTL_V0_NOP                                                  0x00
#define NVIF_IOCTL_V0_NOP                                                  0x00
@@ -29,7 +31,8 @@ struct nvif_ioctl_v0 {
	__u8  data[];		/* ioctl data (below) */
	__u8  data[];		/* ioctl data (below) */
};
};


struct nvif_ioctl_nop {
struct nvif_ioctl_nop_v0 {
	__u64 version;
};
};


struct nvif_ioctl_sclass_v0 {
struct nvif_ioctl_sclass_v0 {
+9 −0
Original line number Original line Diff line number Diff line
@@ -71,6 +71,10 @@ int
nvif_client_init(const char *driver, const char *name, u64 device,
nvif_client_init(const char *driver, const char *name, u64 device,
		 const char *cfg, const char *dbg, struct nvif_client *client)
		 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;
	int ret, i;


	ret = nvif_object_init(NULL, 0, 0, NULL, 0, &client->object);
	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)
	if (ret)
		nvif_client_fini(client);
		nvif_client_fini(client);
	return ret;
	return ret;
+4 −3
Original line number Original line Diff line number Diff line
@@ -35,13 +35,14 @@ nvkm_ioctl_nop(struct nvkm_handle *handle, void *data, u32 size)
{
{
	struct nvkm_object *object = handle->object;
	struct nvkm_object *object = handle->object;
	union {
	union {
		struct nvif_ioctl_nop none;
		struct nvif_ioctl_nop_v0 v0;
	} *args = data;
	} *args = data;
	int ret;
	int ret;


	nvif_ioctl(object, "nop size %d\n", size);
	nvif_ioctl(object, "nop size %d\n", size);
	if (nvif_unvers(args->none)) {
	if (nvif_unpack(args->v0, 0, 0, false)) {
		nvif_ioctl(object, "nop\n");
		nvif_ioctl(object, "nop vers %lld\n", args->v0.version);
		args->v0.version = NVIF_VERSION_LATEST;
	}
	}


	return ret;
	return ret;