File tree Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Expand file tree Collapse file tree 3 files changed +24
-5
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ struct nvif_user {
10
10
11
11
struct nvif_user_func {
12
12
void (* doorbell )(struct nvif_user * , u32 token );
13
+ u64 (* time )(struct nvif_user * );
13
14
};
14
15
15
16
int nvif_user_init (struct nvif_device * );
Original file line number Diff line number Diff line change 27
27
u64
28
28
nvif_device_time (struct nvif_device * device )
29
29
{
30
- struct nv_device_time_v0 args = {};
31
- int ret = nvif_object_mthd (& device -> object , NV_DEVICE_V0_TIME ,
32
- & args , sizeof (args ));
33
- WARN_ON_ONCE (ret != 0 );
34
- return args .time ;
30
+ if (!device -> user .func ) {
31
+ struct nv_device_time_v0 args = {};
32
+ int ret = nvif_object_mthd (& device -> object , NV_DEVICE_V0_TIME ,
33
+ & args , sizeof (args ));
34
+ WARN_ON_ONCE (ret != 0 );
35
+ return args .time ;
36
+ }
37
+
38
+ return device -> user .func -> time (& device -> user );
35
39
}
36
40
37
41
void
Original file line number Diff line number Diff line change 21
21
*/
22
22
#include <nvif/user.h>
23
23
24
+ static u64
25
+ nvif_userc361_time (struct nvif_user * user )
26
+ {
27
+ u32 hi , lo ;
28
+
29
+ do {
30
+ hi = nvif_rd32 (& user -> object , 0x084 );
31
+ lo = nvif_rd32 (& user -> object , 0x080 );
32
+ } while (hi != nvif_rd32 (& user -> object , 0x084 ));
33
+
34
+ return ((u64 )hi << 32 | lo );
35
+ }
36
+
24
37
static void
25
38
nvif_userc361_doorbell (struct nvif_user * user , u32 token )
26
39
{
@@ -30,4 +43,5 @@ nvif_userc361_doorbell(struct nvif_user *user, u32 token)
30
43
const struct nvif_user_func
31
44
nvif_userc361 = {
32
45
.doorbell = nvif_userc361_doorbell ,
46
+ .time = nvif_userc361_time ,
33
47
};
You can’t perform that action at this time.
0 commit comments