[PATCH 069/156] drm/nouveau/nvif: rework device "time" api

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]<

 



- transition from "ioctl" interface

Signed-off-by: Ben Skeggs <bskeggs@xxxxxxxxxx>
---
 drivers/gpu/drm/nouveau/include/nvif/cl0080.h |  7 ----
 .../gpu/drm/nouveau/include/nvif/driverif.h   |  2 +
 drivers/gpu/drm/nouveau/nvif/device.c         |  9 +---
 drivers/gpu/drm/nouveau/nvkm/device/user.c    | 41 ++-----------------
 4 files changed, 8 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/include/nvif/cl0080.h b/drivers/gpu/drm/nouveau/include/nvif/cl0080.h
index f1684dbd8e3b..db096a41dc4f 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/cl0080.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/cl0080.h
@@ -3,7 +3,6 @@
 #define __NVIF_CL0080_H__
 
 #define NV_DEVICE_V0_INFO                                                  0x00
-#define NV_DEVICE_V0_TIME                                                  0x01
 
 struct nv_device_info_v0 {
 	__u8  version;
@@ -36,10 +35,4 @@ struct nv_device_info_v0 {
 	char  chip[16];
 	char  name[64];
 };
-
-struct nv_device_time_v0 {
-	__u8  version;
-	__u8  pad01[7];
-	__u64 time;
-};
 #endif
diff --git a/drivers/gpu/drm/nouveau/include/nvif/driverif.h b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
index 54446d38cb91..44064b5da897 100644
--- a/drivers/gpu/drm/nouveau/include/nvif/driverif.h
+++ b/drivers/gpu/drm/nouveau/include/nvif/driverif.h
@@ -61,6 +61,8 @@ struct nvif_device_impl {
 	u64 ram_size;
 	u64 ram_user;
 
+	u64 (*time)(struct nvif_device_priv *);
+
 	struct {
 		s32 oclass;
 	} usermode;
diff --git a/drivers/gpu/drm/nouveau/nvif/device.c b/drivers/gpu/drm/nouveau/nvif/device.c
index d4d00a757cd0..7d057691600f 100644
--- a/drivers/gpu/drm/nouveau/nvif/device.c
+++ b/drivers/gpu/drm/nouveau/nvif/device.c
@@ -28,13 +28,8 @@
 u64
 nvif_device_time(struct nvif_device *device)
 {
-	if (!device->user.func) {
-		struct nv_device_time_v0 args = {};
-		int ret = nvif_object_mthd(&device->object, NV_DEVICE_V0_TIME,
-					   &args, sizeof(args));
-		WARN_ON_ONCE(ret != 0);
-		return args.time;
-	}
+	if (!device->user.func)
+		return device->impl->time(device->priv);
 
 	return device->user.func->time(&device->user);
 }
diff --git a/drivers/gpu/drm/nouveau/nvkm/device/user.c b/drivers/gpu/drm/nouveau/nvkm/device/user.c
index 26ce50fc2aac..b37c857863b8 100644
--- a/drivers/gpu/drm/nouveau/nvkm/device/user.c
+++ b/drivers/gpu/drm/nouveau/nvkm/device/user.c
@@ -32,12 +32,6 @@
 #include <engine/disp/priv.h>
 #include <engine/fifo/ufifo.h>
 
-#include <nvif/class.h>
-#include <nvif/cl0080.h>
-#include <nvif/unpack.h>
-
-#define nvkm_udevice nvif_device_priv
-
 struct nvif_device_priv {
 	struct nvkm_object object;
 	struct nvkm_device *device;
@@ -45,23 +39,10 @@ struct nvif_device_priv {
 	struct nvif_device_impl impl;
 };
 
-static int
-nvkm_udevice_time(struct nvkm_udevice *udev, void *data, u32 size)
+static u64
+nvkm_udevice_time(struct nvif_device_priv *udev)
 {
-	struct nvkm_object *object = &udev->object;
-	struct nvkm_device *device = udev->device;
-	union {
-		struct nv_device_time_v0 v0;
-	} *args = data;
-	int ret = -ENOSYS;
-
-	nvif_ioctl(object, "device time size %d\n", size);
-	if (!(ret = nvif_unpack(ret, &data, &size, args->v0, 0, 0, false))) {
-		nvif_ioctl(object, "device time vers %d\n", args->v0.version);
-		args->v0.time = nvkm_timer_read(device->timer);
-	}
-
-	return ret;
+	return nvkm_timer_read(udev->device->timer);
 }
 
 static void
@@ -76,22 +57,9 @@ nvkm_udevice_del(struct nvif_device_priv *udev)
 static const struct nvif_device_impl
 nvkm_udevice_impl = {
 	.del = nvkm_udevice_del,
+	.time = nvkm_udevice_time,
 };
 
-static int
-nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
-{
-	struct nvif_device_priv *udev = container_of(object, typeof(*udev), object);
-	nvif_ioctl(object, "device mthd %08x\n", mthd);
-	switch (mthd) {
-	case NV_DEVICE_V0_TIME:
-		return nvkm_udevice_time(udev, data, size);
-	default:
-		break;
-	}
-	return -EINVAL;
-}
-
 static int
 nvkm_udevice_fini(struct nvkm_object *object, bool suspend)
 {
@@ -190,7 +158,6 @@ static const struct nvkm_object_func
 nvkm_udevice = {
 	.init = nvkm_udevice_init,
 	.fini = nvkm_udevice_fini,
-	.mthd = nvkm_udevice_mthd,
 	.sclass = nvkm_udevice_child_get,
 };
 
-- 
2.41.0




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux