diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common')
-rw-r--r-- | drivers/gpu/nvgpu/common/bus.c | 50 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | 1 |
2 files changed, 51 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/bus.c b/drivers/gpu/nvgpu/common/bus.c new file mode 100644 index 00000000..9fd827bc --- /dev/null +++ b/drivers/gpu/nvgpu/common/bus.c | |||
@@ -0,0 +1,50 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License | ||
14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
15 | */ | ||
16 | |||
17 | #include <nvgpu/bus.h> | ||
18 | |||
19 | #include "gk20a/gk20a.h" | ||
20 | |||
21 | int nvgpu_get_timestamps_zipper(struct gk20a *g, | ||
22 | u32 source_id, u32 count, | ||
23 | struct nvgpu_cpu_time_correlation_sample *samples) | ||
24 | { | ||
25 | int err = 0; | ||
26 | unsigned int i = 0; | ||
27 | |||
28 | if (source_id != NVGPU_GPU_GET_CPU_TIME_CORRELATION_INFO_SRC_ID_TSC) { | ||
29 | nvgpu_err(g, "source_id %u not supported", source_id); | ||
30 | return -EINVAL; | ||
31 | } | ||
32 | |||
33 | if (gk20a_busy(g)) { | ||
34 | nvgpu_err(g, "GPU not powered on\n"); | ||
35 | err = -EINVAL; | ||
36 | goto end; | ||
37 | } | ||
38 | |||
39 | for (i = 0; i < count; i++) { | ||
40 | err = g->ops.bus.read_ptimer(g, &samples[i].gpu_timestamp); | ||
41 | if (err) | ||
42 | return err; | ||
43 | |||
44 | samples[i].cpu_timestamp = (u64)get_cycles(); | ||
45 | } | ||
46 | |||
47 | end: | ||
48 | gk20a_idle(g); | ||
49 | return err; | ||
50 | } | ||
diff --git a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c index 025a30fe..caf8d309 100644 --- a/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c +++ b/drivers/gpu/nvgpu/common/linux/ioctl_ctrl.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <nvgpu/bitops.h> | 24 | #include <nvgpu/bitops.h> |
25 | #include <nvgpu/kmem.h> | 25 | #include <nvgpu/kmem.h> |
26 | #include <nvgpu/bug.h> | 26 | #include <nvgpu/bug.h> |
27 | #include <nvgpu/bus.h> | ||
27 | 28 | ||
28 | #include "ioctl_ctrl.h" | 29 | #include "ioctl_ctrl.h" |
29 | #include "ioctl_tsg.h" | 30 | #include "ioctl_tsg.h" |