summaryrefslogtreecommitdiff
path: root/drm
diff options
context:
space:
mode:
Diffstat (limited to 'drm')
-rw-r--r--drm/nouveau/include/nvif/class.h7
-rw-r--r--drm/nouveau/include/nvif/device.h1
-rw-r--r--drm/nouveau/nvif/device.c6
-rw-r--r--drm/nouveau/nvkm/engine/device/user.c21
4 files changed, 33 insertions, 2 deletions
diff --git a/drm/nouveau/include/nvif/class.h b/drm/nouveau/include/nvif/class.h
index e11b5acb3..d52b27ac3 100644
--- a/drm/nouveau/include/nvif/class.h
+++ b/drm/nouveau/include/nvif/class.h
@@ -129,6 +129,7 @@ struct nv_device_v0 {
};
#define NV_DEVICE_V0_INFO 0x00
+#define NV_DEVICE_V0_TIME 0x01
struct nv_device_info_v0 {
__u8 version;
@@ -157,6 +158,12 @@ struct nv_device_info_v0 {
char name[64];
};
+struct nv_device_time_v0 {
+ __u8 version;
+ __u8 pad01[7];
+ __u64 time;
+};
+
/*******************************************************************************
* context dma
diff --git a/drm/nouveau/include/nvif/device.h b/drm/nouveau/include/nvif/device.h
index 68b431b24..68196f487 100644
--- a/drm/nouveau/include/nvif/device.h
+++ b/drm/nouveau/include/nvif/device.h
@@ -57,7 +57,6 @@ u64 nvif_device_time(struct nvif_device *);
#define nvxx_gpio(a) nvkm_gpio(nvxx_device(a))
#define nvxx_clk(a) nvkm_clk(nvxx_device(a))
#define nvxx_i2c(a) nvkm_i2c(nvxx_device(a))
-#define nvxx_timer(a) nvkm_timer(nvxx_device(a))
#define nvxx_therm(a) nvkm_therm(nvxx_device(a))
#include <core/device.h>
diff --git a/drm/nouveau/nvif/device.c b/drm/nouveau/nvif/device.c
index 561fb9d7b..252d8c332 100644
--- a/drm/nouveau/nvif/device.c
+++ b/drm/nouveau/nvif/device.c
@@ -27,7 +27,11 @@
u64
nvif_device_time(struct nvif_device *device)
{
- return nvxx_timer(device)->read(nvxx_timer(device));
+ 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;
}
void
diff --git a/drm/nouveau/nvkm/engine/device/user.c b/drm/nouveau/nvkm/engine/device/user.c
index e44d60739..cb3f3deef 100644
--- a/drm/nouveau/nvkm/engine/device/user.c
+++ b/drm/nouveau/nvkm/engine/device/user.c
@@ -26,6 +26,7 @@
#include <core/client.h>
#include <subdev/fb.h>
#include <subdev/instmem.h>
+#include <subdev/timer.h>
#include <nvif/class.h>
#include <nvif/unpack.h>
@@ -112,11 +113,31 @@ nvkm_udevice_info(struct nvkm_object *object, void *data, u32 size)
}
static int
+nvkm_udevice_time(struct nvkm_object *object, void *data, u32 size)
+{
+ struct nvkm_udevice *udev = (void *)object;
+ struct nvkm_device *device = udev->device;
+ struct nvkm_timer *tmr = device->timer;
+ union {
+ struct nv_device_time_v0 v0;
+ } *args = data;
+ int ret;
+
+ if (nvif_unpack(args->v0, 0, 0, false)) {
+ args->v0.time = tmr->read(tmr);
+ }
+
+ return ret;
+}
+
+static int
nvkm_udevice_mthd(struct nvkm_object *object, u32 mthd, void *data, u32 size)
{
switch (mthd) {
case NV_DEVICE_V0_INFO:
return nvkm_udevice_info(object, data, size);
+ case NV_DEVICE_V0_TIME:
+ return nvkm_udevice_time(object, data, size);
default:
break;
}