hc
2024-10-22 8ac6c7a54ed1b98d142dce24b11c6de6a1e239a5
kernel/drivers/gpu/host1x/hw/cdma_hw.c
....@@ -1,19 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Tegra host1x Command DMA
34 *
45 * Copyright (c) 2010-2013, NVIDIA Corporation.
5
- *
6
- * This program is free software; you can redistribute it and/or modify it
7
- * under the terms and conditions of the GNU General Public License,
8
- * version 2, as published by the Free Software Foundation.
9
- *
10
- * This program is distributed in the hope it will be useful, but WITHOUT
11
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13
- * more details.
14
- *
15
- * You should have received a copy of the GNU General Public License
16
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
176 */
187
198 #include <linux/slab.h>
....@@ -39,8 +28,6 @@
3928 static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
4029 u32 syncpt_incrs, u32 syncval, u32 nr_slots)
4130 {
42
- struct host1x *host1x = cdma_to_host1x(cdma);
43
- struct push_buffer *pb = &cdma->push_buffer;
4431 unsigned int i;
4532
4633 for (i = 0; i < syncpt_incrs; i++)
....@@ -48,18 +35,6 @@
4835
4936 /* after CPU incr, ensure shadow is up to date */
5037 host1x_syncpt_load(cdma->timeout.syncpt);
51
-
52
- /* NOP all the PB slots */
53
- while (nr_slots--) {
54
- u32 *p = (u32 *)(pb->mapped + getptr);
55
- *(p++) = HOST1X_OPCODE_NOP;
56
- *(p++) = HOST1X_OPCODE_NOP;
57
- dev_dbg(host1x->dev, "%s: NOP at %pad+%#x\n", __func__,
58
- &pb->dma, getptr);
59
- getptr = (getptr + 8) & (pb->size - 1);
60
- }
61
-
62
- wmb();
6338 }
6439
6540 /*
....@@ -68,20 +43,31 @@
6843 static void cdma_start(struct host1x_cdma *cdma)
6944 {
7045 struct host1x_channel *ch = cdma_to_channel(cdma);
46
+ u64 start, end;
7147
7248 if (cdma->running)
7349 return;
7450
7551 cdma->last_pos = cdma->push_buffer.pos;
52
+ start = cdma->push_buffer.dma;
53
+ end = cdma->push_buffer.size + 4;
7654
7755 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP,
7856 HOST1X_CHANNEL_DMACTRL);
7957
8058 /* set base, put and end pointer */
81
- host1x_ch_writel(ch, cdma->push_buffer.dma, HOST1X_CHANNEL_DMASTART);
59
+ host1x_ch_writel(ch, lower_32_bits(start), HOST1X_CHANNEL_DMASTART);
60
+#if HOST1X_HW >= 6
61
+ host1x_ch_writel(ch, upper_32_bits(start), HOST1X_CHANNEL_DMASTART_HI);
62
+#endif
8263 host1x_ch_writel(ch, cdma->push_buffer.pos, HOST1X_CHANNEL_DMAPUT);
83
- host1x_ch_writel(ch, cdma->push_buffer.dma + cdma->push_buffer.size + 4,
84
- HOST1X_CHANNEL_DMAEND);
64
+#if HOST1X_HW >= 6
65
+ host1x_ch_writel(ch, 0, HOST1X_CHANNEL_DMAPUT_HI);
66
+#endif
67
+ host1x_ch_writel(ch, lower_32_bits(end), HOST1X_CHANNEL_DMAEND);
68
+#if HOST1X_HW >= 6
69
+ host1x_ch_writel(ch, upper_32_bits(end), HOST1X_CHANNEL_DMAEND_HI);
70
+#endif
8571
8672 /* reset GET */
8773 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP |
....@@ -104,6 +90,7 @@
10490 {
10591 struct host1x *host1x = cdma_to_host1x(cdma);
10692 struct host1x_channel *ch = cdma_to_channel(cdma);
93
+ u64 start, end;
10794
10895 if (cdma->running)
10996 return;
....@@ -113,10 +100,18 @@
113100 host1x_ch_writel(ch, HOST1X_CHANNEL_DMACTRL_DMASTOP,
114101 HOST1X_CHANNEL_DMACTRL);
115102
103
+ start = cdma->push_buffer.dma;
104
+ end = cdma->push_buffer.size + 4;
105
+
116106 /* set base, end pointer (all of memory) */
117
- host1x_ch_writel(ch, cdma->push_buffer.dma, HOST1X_CHANNEL_DMASTART);
118
- host1x_ch_writel(ch, cdma->push_buffer.dma + cdma->push_buffer.size,
119
- HOST1X_CHANNEL_DMAEND);
107
+ host1x_ch_writel(ch, lower_32_bits(start), HOST1X_CHANNEL_DMASTART);
108
+#if HOST1X_HW >= 6
109
+ host1x_ch_writel(ch, upper_32_bits(start), HOST1X_CHANNEL_DMASTART_HI);
110
+#endif
111
+ host1x_ch_writel(ch, lower_32_bits(end), HOST1X_CHANNEL_DMAEND);
112
+#if HOST1X_HW >= 6
113
+ host1x_ch_writel(ch, upper_32_bits(end), HOST1X_CHANNEL_DMAEND_HI);
114
+#endif
120115
121116 /* set GET, by loading the value in PUT (then reset GET) */
122117 host1x_ch_writel(ch, getptr, HOST1X_CHANNEL_DMAPUT);