hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/drivers/gpu/drm/msm/msm_ringbuffer.h
....@@ -1,18 +1,7 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * Copyright (C) 2013 Red Hat
34 * Author: Rob Clark <robdclark@gmail.com>
4
- *
5
- * This program is free software; you can redistribute it and/or modify it
6
- * under the terms of the GNU General Public License version 2 as published by
7
- * the Free Software Foundation.
8
- *
9
- * This program is distributed in the hope that it will be useful, but WITHOUT
10
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
- * more details.
13
- *
14
- * You should have received a copy of the GNU General Public License along with
15
- * this program. If not, see <http://www.gnu.org/licenses/>.
165 */
176
187 #ifndef __MSM_RINGBUFFER_H__
....@@ -23,9 +12,26 @@
2312 #define rbmemptr(ring, member) \
2413 ((ring)->memptrs_iova + offsetof(struct msm_rbmemptrs, member))
2514
15
+#define rbmemptr_stats(ring, index, member) \
16
+ (rbmemptr((ring), stats) + \
17
+ ((index) * sizeof(struct msm_gpu_submit_stats)) + \
18
+ offsetof(struct msm_gpu_submit_stats, member))
19
+
20
+struct msm_gpu_submit_stats {
21
+ u64 cpcycles_start;
22
+ u64 cpcycles_end;
23
+ u64 alwayson_start;
24
+ u64 alwayson_end;
25
+};
26
+
27
+#define MSM_GPU_SUBMIT_STATS_COUNT 64
28
+
2629 struct msm_rbmemptrs {
2730 volatile uint32_t rptr;
2831 volatile uint32_t fence;
32
+
33
+ volatile struct msm_gpu_submit_stats stats[MSM_GPU_SUBMIT_STATS_COUNT];
34
+ volatile u64 ttbr0;
2935 };
3036
3137 struct msm_ringbuffer {
....@@ -40,7 +46,12 @@
4046 struct msm_rbmemptrs *memptrs;
4147 uint64_t memptrs_iova;
4248 struct msm_fence_context *fctx;
43
- spinlock_t lock;
49
+
50
+ /*
51
+ * preempt_lock protects preemption and serializes wptr updates against
52
+ * preemption. Can be aquired from irq context.
53
+ */
54
+ spinlock_t preempt_lock;
4455 };
4556
4657 struct msm_ringbuffer *msm_ringbuffer_new(struct msm_gpu *gpu, int id,