aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2018-03-22 16:16:51 -0400
committerDave Airlie <airlied@redhat.com>2018-03-22 16:16:51 -0400
commitf3924ae723d84746546bd74bdefc99c17da2a467 (patch)
treedb57c3cddaab0db958de7f537e668267aae4115e
parent0c5286a8222e1d178f57115401673ac34126a510 (diff)
parent4ed75c3e525598ff1aa6aed09c419c73a4efd2f2 (diff)
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next
Changes this time mostly come down to: - hook up the DRM GPU scheduler - prep work for GC7000L support, to be completed in the next cycle * 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux: (22 commits) drm/etnaviv: bump HW job limit to 4 drm/etnaviv: etnaviv_sched: Staticize functions when possible drm/etnaviv: add PTA handling to MMUv2 drm/etnaviv: add function to load the initial PTA state drm/etnaviv: handle security states drm/etnaviv: add security handling mode enum drm/etnaviv: add hardware database drm/etnaviv: add more minor features fields drm/etnaviv: update hardware headers from rnndb drm/etnaviv: add support for slave interface clock drm/etnaviv: split out and optimize MMU fault dumping drm/etnaviv: remove the need for a gpu-subsystem DT node dt-bindings: etnaviv: add slave interface clock drm/etnaviv: use correct format specifier for size_t drm/etnaviv: replace hangcheck with scheduler timeout drm/etnaviv: lock BOs after all other submit work is done drm/etnaviv: move dependency handling to scheduler drm/etnaviv: hook up DRM GPU scheduler drm/etnaviv: track fences by IDR instead of seqno drm/etnaviv: add missing major features field to debugfs ...
-rw-r--r--Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt24
-rw-r--r--drivers/gpu/drm/etnaviv/Kconfig1
-rw-r--r--drivers/gpu/drm/etnaviv/Makefile4
-rw-r--r--drivers/gpu/drm/etnaviv/common.xml.h281
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_buffer.c18
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_drv.c52
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_drv.h8
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_dump.c21
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem.h5
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c68
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c406
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.h54
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_hwdb.c65
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_iommu.c2
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c78
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_mmu.c4
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_sched.c170
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_sched.h35
-rw-r--r--drivers/gpu/drm/etnaviv/state.xml.h256
-rw-r--r--drivers/gpu/drm/etnaviv/state_3d.xml.h5
-rw-r--r--drivers/gpu/drm/etnaviv/state_blt.xml.h52
-rw-r--r--drivers/gpu/drm/etnaviv/state_hi.xml.h150
-rw-r--r--include/uapi/drm/etnaviv_drm.h6
23 files changed, 1310 insertions, 455 deletions
diff --git a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
index 05176f1ae108..8def11b16a24 100644
--- a/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
+++ b/Documentation/devicetree/bindings/display/etnaviv/etnaviv-drm.txt
@@ -1,23 +1,3 @@
1Etnaviv DRM master device
2=========================
3
4The Etnaviv DRM master device is a virtual device needed to list all
5Vivante GPU cores that comprise the GPU subsystem.
6
7Required properties:
8- compatible: Should be one of
9 "fsl,imx-gpu-subsystem"
10 "marvell,dove-gpu-subsystem"
11- cores: Should contain a list of phandles pointing to Vivante GPU devices
12
13example:
14
15gpu-subsystem {
16 compatible = "fsl,imx-gpu-subsystem";
17 cores = <&gpu_2d>, <&gpu_3d>;
18};
19
20
21Vivante GPU core devices 1Vivante GPU core devices
22======================== 2========================
23 3
@@ -32,7 +12,9 @@ Required properties:
32- clocks: should contain one clock for entry in clock-names 12- clocks: should contain one clock for entry in clock-names
33 see Documentation/devicetree/bindings/clock/clock-bindings.txt 13 see Documentation/devicetree/bindings/clock/clock-bindings.txt
34- clock-names: 14- clock-names:
35 - "bus": AXI/register clock 15 - "bus": AXI/master interface clock
16 - "reg": AHB/slave interface clock
17 (only required if GPU can gate slave interface independently)
36 - "core": GPU core clock 18 - "core": GPU core clock
37 - "shader": Shader clock (only required if GPU has feature PIPE_3D) 19 - "shader": Shader clock (only required if GPU has feature PIPE_3D)
38 20
diff --git a/drivers/gpu/drm/etnaviv/Kconfig b/drivers/gpu/drm/etnaviv/Kconfig
index 3f58b4077767..e5bfeca361bd 100644
--- a/drivers/gpu/drm/etnaviv/Kconfig
+++ b/drivers/gpu/drm/etnaviv/Kconfig
@@ -11,6 +11,7 @@ config DRM_ETNAVIV
11 select WANT_DEV_COREDUMP 11 select WANT_DEV_COREDUMP
12 select CMA if HAVE_DMA_CONTIGUOUS 12 select CMA if HAVE_DMA_CONTIGUOUS
13 select DMA_CMA if HAVE_DMA_CONTIGUOUS 13 select DMA_CMA if HAVE_DMA_CONTIGUOUS
14 select DRM_SCHED
14 help 15 help
15 DRM driver for Vivante GPUs. 16 DRM driver for Vivante GPUs.
16 17
diff --git a/drivers/gpu/drm/etnaviv/Makefile b/drivers/gpu/drm/etnaviv/Makefile
index 1281c8d4fae5..46e5ffad69a6 100644
--- a/drivers/gpu/drm/etnaviv/Makefile
+++ b/drivers/gpu/drm/etnaviv/Makefile
@@ -9,9 +9,11 @@ etnaviv-y := \
9 etnaviv_gem_submit.o \ 9 etnaviv_gem_submit.o \
10 etnaviv_gem.o \ 10 etnaviv_gem.o \
11 etnaviv_gpu.o \ 11 etnaviv_gpu.o \
12 etnaviv_hwdb.o \
12 etnaviv_iommu_v2.o \ 13 etnaviv_iommu_v2.o \
13 etnaviv_iommu.o \ 14 etnaviv_iommu.o \
14 etnaviv_mmu.o \ 15 etnaviv_mmu.o \
15 etnaviv_perfmon.o 16 etnaviv_perfmon.o \
17 etnaviv_sched.o
16 18
17obj-$(CONFIG_DRM_ETNAVIV) += etnaviv.o 19obj-$(CONFIG_DRM_ETNAVIV) += etnaviv.o
diff --git a/drivers/gpu/drm/etnaviv/common.xml.h b/drivers/gpu/drm/etnaviv/common.xml.h
index 207f45c999c3..001faea80fef 100644
--- a/drivers/gpu/drm/etnaviv/common.xml.h
+++ b/drivers/gpu/drm/etnaviv/common.xml.h
@@ -8,15 +8,12 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
8git clone git://0x04.net/rules-ng-ng 8git clone git://0x04.net/rules-ng-ng
9 9
10The rules-ng-ng source files this header was generated from are: 10The rules-ng-ng source files this header was generated from are:
11- state.xml ( 19930 bytes, from 2017-03-09 15:43:43) 11- texdesc_3d.xml ( 3183 bytes, from 2017-12-18 16:51:59)
12- common.xml ( 23473 bytes, from 2017-03-09 15:43:43) 12- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
13- state_hi.xml ( 26403 bytes, from 2017-03-09 15:43:43) 13- common.xml ( 35468 bytes, from 2018-01-22 13:48:54)
14- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56) 14- common_3d.xml ( 14615 bytes, from 2017-12-18 16:51:59)
15- state_2d.xml ( 51552 bytes, from 2016-12-08 16:37:56)
16- state_3d.xml ( 66957 bytes, from 2017-03-09 15:43:43)
17- state_vg.xml ( 5975 bytes, from 2016-12-08 16:37:56)
18 15
19Copyright (C) 2012-2017 by the following authors: 16Copyright (C) 2012-2018 by the following authors:
20- Wladimir J. van der Laan <laanwj@gmail.com> 17- Wladimir J. van der Laan <laanwj@gmail.com>
21- Christian Gmeiner <christian.gmeiner@gmail.com> 18- Christian Gmeiner <christian.gmeiner@gmail.com>
22- Lucas Stach <l.stach@pengutronix.de> 19- Lucas Stach <l.stach@pengutronix.de>
@@ -49,12 +46,7 @@ DEALINGS IN THE SOFTWARE.
49#define SYNC_RECIPIENT_RA 0x00000005 46#define SYNC_RECIPIENT_RA 0x00000005
50#define SYNC_RECIPIENT_PE 0x00000007 47#define SYNC_RECIPIENT_PE 0x00000007
51#define SYNC_RECIPIENT_DE 0x0000000b 48#define SYNC_RECIPIENT_DE 0x0000000b
52#define SYNC_RECIPIENT_VG 0x0000000f 49#define SYNC_RECIPIENT_BLT 0x00000010
53#define SYNC_RECIPIENT_TESSELATOR 0x00000010
54#define SYNC_RECIPIENT_VG2 0x00000011
55#define SYNC_RECIPIENT_TESSELATOR2 0x00000012
56#define SYNC_RECIPIENT_VG3 0x00000013
57#define SYNC_RECIPIENT_TESSELATOR3 0x00000014
58#define ENDIAN_MODE_NO_SWAP 0x00000000 50#define ENDIAN_MODE_NO_SWAP 0x00000000
59#define ENDIAN_MODE_SWAP_16 0x00000001 51#define ENDIAN_MODE_SWAP_16 0x00000001
60#define ENDIAN_MODE_SWAP_32 0x00000002 52#define ENDIAN_MODE_SWAP_32 0x00000002
@@ -77,6 +69,7 @@ DEALINGS IN THE SOFTWARE.
77#define chipModel_GC800 0x00000800 69#define chipModel_GC800 0x00000800
78#define chipModel_GC860 0x00000860 70#define chipModel_GC860 0x00000860
79#define chipModel_GC880 0x00000880 71#define chipModel_GC880 0x00000880
72#define chipModel_GC900 0x00000900
80#define chipModel_GC1000 0x00001000 73#define chipModel_GC1000 0x00001000
81#define chipModel_GC1500 0x00001500 74#define chipModel_GC1500 0x00001500
82#define chipModel_GC2000 0x00002000 75#define chipModel_GC2000 0x00002000
@@ -88,6 +81,12 @@ DEALINGS IN THE SOFTWARE.
88#define chipModel_GC5000 0x00005000 81#define chipModel_GC5000 0x00005000
89#define chipModel_GC5200 0x00005200 82#define chipModel_GC5200 0x00005200
90#define chipModel_GC6400 0x00006400 83#define chipModel_GC6400 0x00006400
84#define chipModel_GC7000 0x00007000
85#define chipModel_GC7400 0x00007400
86#define chipModel_GC8000 0x00008000
87#define chipModel_GC8100 0x00008100
88#define chipModel_GC8200 0x00008200
89#define chipModel_GC8400 0x00008400
91#define RGBA_BITS_R 0x00000001 90#define RGBA_BITS_R 0x00000001
92#define RGBA_BITS_G 0x00000002 91#define RGBA_BITS_G 0x00000002
93#define RGBA_BITS_B 0x00000004 92#define RGBA_BITS_B 0x00000004
@@ -203,7 +202,7 @@ DEALINGS IN THE SOFTWARE.
203#define chipMinorFeatures2_RGB888 0x00001000 202#define chipMinorFeatures2_RGB888 0x00001000
204#define chipMinorFeatures2_TX__YUV_ASSEMBLER 0x00002000 203#define chipMinorFeatures2_TX__YUV_ASSEMBLER 0x00002000
205#define chipMinorFeatures2_DYNAMIC_FREQUENCY_SCALING 0x00004000 204#define chipMinorFeatures2_DYNAMIC_FREQUENCY_SCALING 0x00004000
206#define chipMinorFeatures2_EXTRA_TEXTURE_STATE 0x00008000 205#define chipMinorFeatures2_TX_FILTER 0x00008000
207#define chipMinorFeatures2_FULL_DIRECTFB 0x00010000 206#define chipMinorFeatures2_FULL_DIRECTFB 0x00010000
208#define chipMinorFeatures2_2D_TILING 0x00020000 207#define chipMinorFeatures2_2D_TILING 0x00020000
209#define chipMinorFeatures2_THREAD_WALKER_IN_PS 0x00040000 208#define chipMinorFeatures2_THREAD_WALKER_IN_PS 0x00040000
@@ -242,36 +241,36 @@ DEALINGS IN THE SOFTWARE.
242#define chipMinorFeatures3_TX_ENHANCEMENTS1 0x00080000 241#define chipMinorFeatures3_TX_ENHANCEMENTS1 0x00080000
243#define chipMinorFeatures3_SH_ENHANCEMENTS1 0x00100000 242#define chipMinorFeatures3_SH_ENHANCEMENTS1 0x00100000
244#define chipMinorFeatures3_SH_ENHANCEMENTS2 0x00200000 243#define chipMinorFeatures3_SH_ENHANCEMENTS2 0x00200000
245#define chipMinorFeatures3_UNK22 0x00400000 244#define chipMinorFeatures3_PE_ENHANCEMENTS1 0x00400000
246#define chipMinorFeatures3_2D_FC_SOURCE 0x00800000 245#define chipMinorFeatures3_2D_FC_SOURCE 0x00800000
247#define chipMinorFeatures3_UNK24 0x01000000 246#define chipMinorFeatures3_BUG_FIXES_14 0x01000000
248#define chipMinorFeatures3_UNK25 0x02000000 247#define chipMinorFeatures3_POWER_OPTIMIZATIONS_0 0x02000000
249#define chipMinorFeatures3_NEW_HZ 0x04000000 248#define chipMinorFeatures3_NEW_HZ 0x04000000
250#define chipMinorFeatures3_UNK27 0x08000000 249#define chipMinorFeatures3_PE_DITHER_FIX 0x08000000
251#define chipMinorFeatures3_UNK28 0x10000000 250#define chipMinorFeatures3_DE_ENHANCEMENTS3 0x10000000
252#define chipMinorFeatures3_SH_ENHANCEMENTS3 0x20000000 251#define chipMinorFeatures3_SH_ENHANCEMENTS3 0x20000000
253#define chipMinorFeatures3_UNK30 0x40000000 252#define chipMinorFeatures3_SH_ENHANCEMENTS4 0x40000000
254#define chipMinorFeatures3_UNK31 0x80000000 253#define chipMinorFeatures3_TX_ENHANCEMENTS2 0x80000000
255#define chipMinorFeatures4_UNK0 0x00000001 254#define chipMinorFeatures4_FE_ENHANCEMENTS1 0x00000001
256#define chipMinorFeatures4_PE_ENHANCEMENTS2 0x00000002 255#define chipMinorFeatures4_PE_ENHANCEMENTS2 0x00000002
257#define chipMinorFeatures4_FRUSTUM_CLIP_FIX 0x00000004 256#define chipMinorFeatures4_FRUSTUM_CLIP_FIX 0x00000004
258#define chipMinorFeatures4_UNK3 0x00000008 257#define chipMinorFeatures4_DE_NO_GAMMA 0x00000008
259#define chipMinorFeatures4_UNK4 0x00000010 258#define chipMinorFeatures4_PA_ENHANCEMENTS_2 0x00000010
260#define chipMinorFeatures4_2D_GAMMA 0x00000020 259#define chipMinorFeatures4_2D_GAMMA 0x00000020
261#define chipMinorFeatures4_SINGLE_BUFFER 0x00000040 260#define chipMinorFeatures4_SINGLE_BUFFER 0x00000040
262#define chipMinorFeatures4_UNK7 0x00000080 261#define chipMinorFeatures4_HI_ENHANCEMENTS_1 0x00000080
263#define chipMinorFeatures4_UNK8 0x00000100 262#define chipMinorFeatures4_TX_ENHANCEMENTS_3 0x00000100
264#define chipMinorFeatures4_UNK9 0x00000200 263#define chipMinorFeatures4_SH_ENHANCEMENTS_5 0x00000200
265#define chipMinorFeatures4_UNK10 0x00000400 264#define chipMinorFeatures4_FE_ENHANCEMENTS_2 0x00000400
266#define chipMinorFeatures4_TX_LERP_PRECISION_FIX 0x00000800 265#define chipMinorFeatures4_TX_LERP_PRECISION_FIX 0x00000800
267#define chipMinorFeatures4_2D_COLOR_SPACE_CONVERSION 0x00001000 266#define chipMinorFeatures4_2D_COLOR_SPACE_CONVERSION 0x00001000
268#define chipMinorFeatures4_TEXTURE_ASTC 0x00002000 267#define chipMinorFeatures4_TEXTURE_ASTC 0x00002000
269#define chipMinorFeatures4_UNK14 0x00004000 268#define chipMinorFeatures4_PE_ENHANCEMENTS_4 0x00004000
270#define chipMinorFeatures4_UNK15 0x00008000 269#define chipMinorFeatures4_MC_ENHANCEMENTS_1 0x00008000
271#define chipMinorFeatures4_HALTI2 0x00010000 270#define chipMinorFeatures4_HALTI2 0x00010000
272#define chipMinorFeatures4_UNK17 0x00020000 271#define chipMinorFeatures4_2D_MIRROR_EXTENSION 0x00020000
273#define chipMinorFeatures4_SMALL_MSAA 0x00040000 272#define chipMinorFeatures4_SMALL_MSAA 0x00040000
274#define chipMinorFeatures4_UNK19 0x00080000 273#define chipMinorFeatures4_BUG_FIXES_17 0x00080000
275#define chipMinorFeatures4_NEW_RA 0x00100000 274#define chipMinorFeatures4_NEW_RA 0x00100000
276#define chipMinorFeatures4_2D_OPF_YUV_OUTPUT 0x00200000 275#define chipMinorFeatures4_2D_OPF_YUV_OUTPUT 0x00200000
277#define chipMinorFeatures4_2D_MULTI_SOURCE_BLT_EX2 0x00400000 276#define chipMinorFeatures4_2D_MULTI_SOURCE_BLT_EX2 0x00400000
@@ -280,41 +279,207 @@ DEALINGS IN THE SOFTWARE.
280#define chipMinorFeatures4_BUG_FIXES18 0x02000000 279#define chipMinorFeatures4_BUG_FIXES18 0x02000000
281#define chipMinorFeatures4_2D_COMPRESSION 0x04000000 280#define chipMinorFeatures4_2D_COMPRESSION 0x04000000
282#define chipMinorFeatures4_PROBE 0x08000000 281#define chipMinorFeatures4_PROBE 0x08000000
283#define chipMinorFeatures4_UNK28 0x10000000 282#define chipMinorFeatures4_MEDIUM_PRECISION 0x10000000
284#define chipMinorFeatures4_2D_SUPER_TILE_VERSION 0x20000000 283#define chipMinorFeatures4_2D_SUPER_TILE_VERSION 0x20000000
285#define chipMinorFeatures4_UNK30 0x40000000 284#define chipMinorFeatures4_BUG_FIXES19 0x40000000
286#define chipMinorFeatures4_UNK31 0x80000000 285#define chipMinorFeatures4_SH_ENHANCEMENTS6 0x80000000
287#define chipMinorFeatures5_UNK0 0x00000001 286#define chipMinorFeatures5_SH_ENHANCEMENTS7 0x00000001
288#define chipMinorFeatures5_UNK1 0x00000002 287#define chipMinorFeatures5_BUG_FIXES20 0x00000002
289#define chipMinorFeatures5_UNK2 0x00000004 288#define chipMinorFeatures5_DE_ADDRESS_40 0x00000004
290#define chipMinorFeatures5_UNK3 0x00000008 289#define chipMinorFeatures5_MINI_MMU_FIX 0x00000008
291#define chipMinorFeatures5_EEZ 0x00000010 290#define chipMinorFeatures5_EEZ 0x00000010
292#define chipMinorFeatures5_UNK5 0x00000020 291#define chipMinorFeatures5_BUG_FIXES21 0x00000020
293#define chipMinorFeatures5_UNK6 0x00000040 292#define chipMinorFeatures5_EXTRA_VG_CAPS 0x00000040
294#define chipMinorFeatures5_UNK7 0x00000080 293#define chipMinorFeatures5_MULTI_SRC_V15 0x00000080
295#define chipMinorFeatures5_UNK8 0x00000100 294#define chipMinorFeatures5_BUG_FIXES22 0x00000100
296#define chipMinorFeatures5_HALTI3 0x00000200 295#define chipMinorFeatures5_HALTI3 0x00000200
297#define chipMinorFeatures5_UNK10 0x00000400 296#define chipMinorFeatures5_TESSELATION_SHADERS 0x00000400
298#define chipMinorFeatures5_2D_ONE_PASS_FILTER_TAP 0x00000800 297#define chipMinorFeatures5_2D_ONE_PASS_FILTER_TAP 0x00000800
299#define chipMinorFeatures5_UNK12 0x00001000 298#define chipMinorFeatures5_MULTI_SRC_V2_STR_QUAD 0x00001000
300#define chipMinorFeatures5_SEPARATE_SRC_DST 0x00002000 299#define chipMinorFeatures5_SEPARATE_SRC_DST 0x00002000
301#define chipMinorFeatures5_HALTI4 0x00004000 300#define chipMinorFeatures5_HALTI4 0x00004000
302#define chipMinorFeatures5_UNK15 0x00008000 301#define chipMinorFeatures5_RA_WRITE_DEPTH 0x00008000
303#define chipMinorFeatures5_ANDROID_ONLY 0x00010000 302#define chipMinorFeatures5_ANDROID_ONLY 0x00010000
304#define chipMinorFeatures5_HAS_PRODUCTID 0x00020000 303#define chipMinorFeatures5_HAS_PRODUCTID 0x00020000
305#define chipMinorFeatures5_UNK18 0x00040000 304#define chipMinorFeatures5_TX_SUPPORT_DEC 0x00040000
306#define chipMinorFeatures5_UNK19 0x00080000 305#define chipMinorFeatures5_S8_MSAA_COMPRESSION 0x00080000
307#define chipMinorFeatures5_PE_DITHER_FIX2 0x00100000 306#define chipMinorFeatures5_PE_DITHER_FIX2 0x00100000
308#define chipMinorFeatures5_UNK21 0x00200000 307#define chipMinorFeatures5_L2_CACHE_REMOVE 0x00200000
309#define chipMinorFeatures5_UNK22 0x00400000 308#define chipMinorFeatures5_FE_ALLOW_RND_VTX_CNT 0x00400000
310#define chipMinorFeatures5_UNK23 0x00800000 309#define chipMinorFeatures5_CUBE_MAP_FL28 0x00800000
311#define chipMinorFeatures5_UNK24 0x01000000 310#define chipMinorFeatures5_TX_6BIT_FRAC 0x01000000
312#define chipMinorFeatures5_UNK25 0x02000000 311#define chipMinorFeatures5_FE_ALLOW_STALL_PREFETCH_ENG 0x02000000
313#define chipMinorFeatures5_UNK26 0x04000000 312#define chipMinorFeatures5_THIRD_PARTY_COMPRESSION 0x04000000
314#define chipMinorFeatures5_RS_DEPTHSTENCIL_NATIVE_SUPPORT 0x08000000 313#define chipMinorFeatures5_RS_DEPTHSTENCIL_NATIVE_SUPPORT 0x08000000
315#define chipMinorFeatures5_V2_MSAA_COMP_FIX 0x10000000 314#define chipMinorFeatures5_V2_MSAA_COMP_FIX 0x10000000
316#define chipMinorFeatures5_UNK29 0x20000000 315#define chipMinorFeatures5_HALTI5 0x20000000
317#define chipMinorFeatures5_UNK30 0x40000000 316#define chipMinorFeatures5_EVIS 0x40000000
318#define chipMinorFeatures5_UNK31 0x80000000 317#define chipMinorFeatures5_BLT_ENGINE 0x80000000
318#define chipMinorFeatures6_BUG_FIXES_23 0x00000001
319#define chipMinorFeatures6_BUG_FIXES_24 0x00000002
320#define chipMinorFeatures6_DEC 0x00000004
321#define chipMinorFeatures6_VS_TILE_NV12 0x00000008
322#define chipMinorFeatures6_VS_TILE_NV12_10BIT 0x00000010
323#define chipMinorFeatures6_RENDER_TARGET_8 0x00000020
324#define chipMinorFeatures6_TEX_LOD_FLOW_CORR 0x00000040
325#define chipMinorFeatures6_FACE_LOD 0x00000080
326#define chipMinorFeatures6_MULTI_CORE_SEMAPHORE_STALL_V2 0x00000100
327#define chipMinorFeatures6_VMSAA 0x00000200
328#define chipMinorFeatures6_CHIP_ENABLE_LINK 0x00000400
329#define chipMinorFeatures6_MULTI_SRC_BLT_1_5_ENHANCEMENT 0x00000800
330#define chipMinorFeatures6_MULTI_SRC_BLT_BILINEAR_FILTER 0x00001000
331#define chipMinorFeatures6_RA_HZEZ_CLOCK_CONTROL 0x00002000
332#define chipMinorFeatures6_CACHE128B256BPERLINE 0x00004000
333#define chipMinorFeatures6_V4_COMPRESSION 0x00008000
334#define chipMinorFeatures6_PE2D_MAJOR_SUPER_TILE 0x00010000
335#define chipMinorFeatures6_PE_32BPC_COLORMASK_FIX 0x00020000
336#define chipMinorFeatures6_ALPHA_BLENDING_OPT 0x00040000
337#define chipMinorFeatures6_NEW_GPIPE 0x00080000
338#define chipMinorFeatures6_PIPELINE_32_ATTRIBUTES 0x00100000
339#define chipMinorFeatures6_MSAA_SHADING 0x00200000
340#define chipMinorFeatures6_NO_ANISTRO_FILTER 0x00400000
341#define chipMinorFeatures6_NO_ASTC 0x00800000
342#define chipMinorFeatures6_NO_DXT 0x01000000
343#define chipMinorFeatures6_HWTFB 0x02000000
344#define chipMinorFeatures6_RA_DEPTH_WRITE_MSAA1X_FIX 0x04000000
345#define chipMinorFeatures6_EZHZ_CLOCKGATE_FIX 0x08000000
346#define chipMinorFeatures6_SH_SNAP2PAGE_FIX 0x10000000
347#define chipMinorFeatures6_SH_HALFDEPENDENCY_FIX 0x20000000
348#define chipMinorFeatures6_USC_MCFILL_FIX 0x40000000
349#define chipMinorFeatures6_TPG_TCPERF_FIX 0x80000000
350#define chipMinorFeatures7_USC_MDFIFO_OVERFLOW_FIX 0x00000001
351#define chipMinorFeatures7_SH_TEXLD_BARRIER_IN_CS_FIX 0x00000002
352#define chipMinorFeatures7_RS_NEW_BASEADDR 0x00000004
353#define chipMinorFeatures7_PE_8BPP_DUALPIPE_FIX 0x00000008
354#define chipMinorFeatures7_SH_ADVANCED_INSTR 0x00000010
355#define chipMinorFeatures7_SH_FLAT_INTERPOLATION_DUAL16_FIX 0x00000020
356#define chipMinorFeatures7_USC_CONTINUOUS_FLUS_FIX 0x00000040
357#define chipMinorFeatures7_SH_SUPPORT_V4 0x00000080
358#define chipMinorFeatures7_SH_SUPPORT_ALPHA_KILL 0x00000100
359#define chipMinorFeatures7_PE_NO_ALPHA_TEST 0x00000200
360#define chipMinorFeatures7_TX_LOD_NEAREST_SELECT 0x00000400
361#define chipMinorFeatures7_SH_FIX_LDEXP 0x00000800
362#define chipMinorFeatures7_SUPPORT_MOVAI 0x00001000
363#define chipMinorFeatures7_SH_SNAP2PAGE_MAXPAGES_FIX 0x00002000
364#define chipMinorFeatures7_PE_RGBA16I_FIX 0x00004000
365#define chipMinorFeatures7_BLT_8bpp_256TILE_FC_FIX 0x00008000
366#define chipMinorFeatures7_PE_64BIT_FENCE_FIX 0x00010000
367#define chipMinorFeatures7_USC_FULL_CACHE_FIX 0x00020000
368#define chipMinorFeatures7_TX_YUV_ASSEMBLER_10BIT 0x00040000
369#define chipMinorFeatures7_FE_32BIT_INDEX_FIX 0x00080000
370#define chipMinorFeatures7_BLT_64BPP_MASKED_CLEAR_FIX 0x00100000
371#define chipMinorFeatures7_BIT_SECURITY 0x00200000
372#define chipMinorFeatures7_BIT_ROBUSTNESS 0x00400000
373#define chipMinorFeatures7_USC_ATOMIC_FIX 0x00800000
374#define chipMinorFeatures7_SH_PSO_MSAA1x_FIX 0x01000000
375#define chipMinorFeatures7_BIT_USC_VX_PERF_FIX 0x02000000
376#define chipMinorFeatures7_EVIS_NO_ABSDIFF 0x04000000
377#define chipMinorFeatures7_EVIS_NO_BITREPLACE 0x08000000
378#define chipMinorFeatures7_EVIS_NO_BOXFILTER 0x10000000
379#define chipMinorFeatures7_EVIS_NO_CORDIAC 0x20000000
380#define chipMinorFeatures7_EVIS_NO_DP32 0x40000000
381#define chipMinorFeatures7_EVIS_NO_FILTER 0x80000000
382#define chipMinorFeatures8_EVIS_NO_IADD 0x00000001
383#define chipMinorFeatures8_EVIS_NO_SELECTADD 0x00000002
384#define chipMinorFeatures8_EVIS_LERP_7OUTPUT 0x00000004
385#define chipMinorFeatures8_EVIS_ACCSQ_8OUTPUT 0x00000008
386#define chipMinorFeatures8_USC_GOS_ADDR_FIX 0x00000010
387#define chipMinorFeatures8_TX_8BIT_UVFRAC 0x00000020
388#define chipMinorFeatures8_TX_DESC_CACHE_CLOCKGATE_FIX 0x00000040
389#define chipMinorFeatures8_RSBLT_MSAA_DECOMPRESSION 0x00000080
390#define chipMinorFeatures8_TX_INTEGER_COORDINATE 0x00000100
391#define chipMinorFeatures8_DRAWID 0x00000200
392#define chipMinorFeatures8_PSIO_SAMPLEMASK_IN_R0ZW_FIX 0x00000400
393#define chipMinorFeatures8_TX_INTEGER_COORDINATE_V2 0x00000800
394#define chipMinorFeatures8_MULTI_CORE_BLOCK_SET_CONFIG 0x00001000
395#define chipMinorFeatures8_VG_RESOLVE_ENGINE 0x00002000
396#define chipMinorFeatures8_VG_PE_COLOR_KEY 0x00004000
397#define chipMinorFeatures8_VG_IM_INDEX_FORMAT 0x00008000
398#define chipMinorFeatures8_SNAPPAGE_CMD 0x00010000
399#define chipMinorFeatures8_SH_NO_INDEX_CONST_ON_A0 0x00020000
400#define chipMinorFeatures8_SH_NO_ONECONST_LIMIT 0x00040000
401#define chipMinorFeatures8_SH_IMG_LDST_ON_TEMP 0x00080000
402#define chipMinorFeatures8_COMPUTE_ONLY 0x00100000
403#define chipMinorFeatures8_SH_IMG_LDST_CLAMP 0x00200000
404#define chipMinorFeatures8_SH_ICACHE_ALLOC_COUNT_FIX 0x00400000
405#define chipMinorFeatures8_SH_ICACHE_PREFETCH 0x00800000
406#define chipMinorFeatures8_PE2D_SEPARATE_CACHE 0x01000000
407#define chipMinorFeatures8_VG_AYUV_INPUT_OUTPUT 0x02000000
408#define chipMinorFeatures8_VG_DOUBLE_IMAGE 0x04000000
409#define chipMinorFeatures8_VG_RECTANGLE_STRIPE_MODE 0x08000000
410#define chipMinorFeatures8_VG_MMU 0x10000000
411#define chipMinorFeatures8_VG_IM_FILTER 0x20000000
412#define chipMinorFeatures8_VG_IM_YUV_PACKET 0x40000000
413#define chipMinorFeatures8_VG_IM_YUV_PLANAR 0x80000000
414#define chipMinorFeatures9_VG_PE_YUV_PACKET 0x00000001
415#define chipMinorFeatures9_VG_COLOR_PRECISION_8_BIT 0x00000002
416#define chipMinorFeatures9_PE_MSAA_OQ_FIX 0x00000004
417#define chipMinorFeatures9_PSIO_MSAA_CL_FIX 0x00000008
418#define chipMinorFeatures9_USC_DEFER_FILL_FIX 0x00000010
419#define chipMinorFeatures9_SH_CLOCK_GATE_FIX 0x00000020
420#define chipMinorFeatures9_FE_NEED_DUMMYDRAW 0x00000040
421#define chipMinorFeatures9_PE2D_LINEAR_YUV420_OUTPUT 0x00000080
422#define chipMinorFeatures9_PE2D_LINEAR_YUV420_10BIT 0x00000100
423#define chipMinorFeatures9_MULTI_CLUSTER 0x00000200
424#define chipMinorFeatures9_VG_TS_CULLING 0x00000400
425#define chipMinorFeatures9_VG_FP25 0x00000800
426#define chipMinorFeatures9_SH_MULTI_WG_PACK 0x00001000
427#define chipMinorFeatures9_SH_DUAL16_SAMPLEMASK_ZW 0x00002000
428#define chipMinorFeatures9_TPG_TRIVIAL_MODE_FIX 0x00004000
429#define chipMinorFeatures9_TX_ASTC_MULTISLICE_FIX 0x00008000
430#define chipMinorFeatures9_FE_ROBUST_FIX 0x00010000
431#define chipMinorFeatures9_SH_GPIPE_ACCESS_FULLTEMPS 0x00020000
432#define chipMinorFeatures9_PSIO_INTERLOCK 0x00040000
433#define chipMinorFeatures9_PA_WIDELINE_FIX 0x00080000
434#define chipMinorFeatures9_WIDELINE_HELPER_FIX 0x00100000
435#define chipMinorFeatures9_G2D_3RD_PARTY_COMPRESSION_1_1 0x00200000
436#define chipMinorFeatures9_TX_FLUSH_L1CACHE 0x00400000
437#define chipMinorFeatures9_PE_DITHER_FIX2 0x00800000
438#define chipMinorFeatures9_G2D_DEC400 0x01000000
439#define chipMinorFeatures9_SH_TEXLD_U_FIX 0x02000000
440#define chipMinorFeatures9_MC_FCCACHE_BYTEMASK 0x04000000
441#define chipMinorFeatures9_SH_MULTI_WG_PACK_FIX 0x08000000
442#define chipMinorFeatures9_DC_OVERLAY_SCALING 0x10000000
443#define chipMinorFeatures9_DC_SOURCE_ROTATION 0x20000000
444#define chipMinorFeatures9_DC_TILED 0x40000000
445#define chipMinorFeatures9_DC_YUV_L1 0x80000000
446#define chipMinorFeatures10_DC_D30_OUTPUT 0x00000001
447#define chipMinorFeatures10_DC_MMU 0x00000002
448#define chipMinorFeatures10_DC_COMPRESSION 0x00000004
449#define chipMinorFeatures10_DC_QOS 0x00000008
450#define chipMinorFeatures10_PE_ADVANCE_BLEND_PART0 0x00000010
451#define chipMinorFeatures10_FE_PATCHLIST_FETCH_FIX 0x00000020
452#define chipMinorFeatures10_RA_CG_FIX 0x00000040
453#define chipMinorFeatures10_EVIS_VX2 0x00000080
454#define chipMinorFeatures10_NN_FLOAT 0x00000100
455#define chipMinorFeatures10_DEC400 0x00000200
456#define chipMinorFeatures10_LS_SUPPORT_PERCOMP_DEPENDENCY 0x00000400
457#define chipMinorFeatures10_TP_ENGINE 0x00000800
458#define chipMinorFeatures10_MULTI_CORE_BLOCK_SET_CONFIG2 0x00001000
459#define chipMinorFeatures10_PE_VMSAA_COVERAGE_CACHE_FIX 0x00002000
460#define chipMinorFeatures10_SECURITY_AHB 0x00004000
461#define chipMinorFeatures10_MULTICORE_SEMAPHORESTALL_V3 0x00008000
462#define chipMinorFeatures10_SMALLBATCH 0x00010000
463#define chipMinorFeatures10_SH_CMPLX 0x00020000
464#define chipMinorFeatures10_SH_IDIV0_SWZL_EHS 0x00040000
465#define chipMinorFeatures10_TX_LERP_LESS_BIT 0x00080000
466#define chipMinorFeatures10_SH_GM_ENDIAN 0x00100000
467#define chipMinorFeatures10_SH_GM_USC_UNALLOC 0x00200000
468#define chipMinorFeatures10_SH_END_OF_BB 0x00400000
469#define chipMinorFeatures10_VIP_V7 0x00800000
470#define chipMinorFeatures10_TX_BORDER_CLAMP_FIX 0x01000000
471#define chipMinorFeatures10_SH_IMG_LD_LASTPIXEL_FIX 0x02000000
472#define chipMinorFeatures10_ASYNC_BLT 0x04000000
473#define chipMinorFeatures10_ASYNC_FE_FENCE_FIX 0x08000000
474#define chipMinorFeatures10_PSCS_THROTTLE 0x10000000
475#define chipMinorFeatures10_SEPARATE_LS 0x20000000
476#define chipMinorFeatures10_MCFE 0x40000000
477#define chipMinorFeatures10_WIDELINE_TRIANGLE_EMU 0x80000000
478#define chipMinorFeatures11_VG_RESOLUTION_8K 0x00000001
479#define chipMinorFeatures11_FENCE_32BIT 0x00000002
480#define chipMinorFeatures11_FENCE_64BIT 0x00000004
481#define chipMinorFeatures11_NN_INTERLEVE8 0x00000008
482#define chipMinorFeatures11_TP_REORDER 0x00000010
483#define chipMinorFeatures11_PE_DEPTH_ONLY_OQFIX 0x00000020
319 484
320#endif /* COMMON_XML */ 485#endif /* COMMON_XML */
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
index 99ad2f073c6e..bfc6d4aa3b7c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
@@ -215,6 +215,24 @@ u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe
215 return buffer->user_size / 8; 215 return buffer->user_size / 8;
216} 216}
217 217
218u16 etnaviv_buffer_config_pta(struct etnaviv_gpu *gpu)
219{
220 struct etnaviv_cmdbuf *buffer = &gpu->buffer;
221
222 lockdep_assert_held(&gpu->lock);
223
224 buffer->user_size = 0;
225
226 CMD_LOAD_STATE(buffer, VIVS_MMUv2_PTA_CONFIG,
227 VIVS_MMUv2_PTA_CONFIG_INDEX(0));
228
229 CMD_END(buffer);
230
231 buffer->user_size = ALIGN(buffer->user_size, 8);
232
233 return buffer->user_size / 8;
234}
235
218void etnaviv_buffer_end(struct etnaviv_gpu *gpu) 236void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
219{ 237{
220 struct etnaviv_cmdbuf *buffer = &gpu->buffer; 238 struct etnaviv_cmdbuf *buffer = &gpu->buffer;
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 6faf4042db23..ab50090d066c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -101,12 +101,25 @@ static void load_gpu(struct drm_device *dev)
101 101
102static int etnaviv_open(struct drm_device *dev, struct drm_file *file) 102static int etnaviv_open(struct drm_device *dev, struct drm_file *file)
103{ 103{
104 struct etnaviv_drm_private *priv = dev->dev_private;
104 struct etnaviv_file_private *ctx; 105 struct etnaviv_file_private *ctx;
106 int i;
105 107
106 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 108 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
107 if (!ctx) 109 if (!ctx)
108 return -ENOMEM; 110 return -ENOMEM;
109 111
112 for (i = 0; i < ETNA_MAX_PIPES; i++) {
113 struct etnaviv_gpu *gpu = priv->gpu[i];
114
115 if (gpu) {
116 drm_sched_entity_init(&gpu->sched,
117 &ctx->sched_entity[i],
118 &gpu->sched.sched_rq[DRM_SCHED_PRIORITY_NORMAL],
119 32, NULL);
120 }
121 }
122
110 file->driver_priv = ctx; 123 file->driver_priv = ctx;
111 124
112 return 0; 125 return 0;
@@ -126,6 +139,9 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file)
126 if (gpu->lastctx == ctx) 139 if (gpu->lastctx == ctx)
127 gpu->lastctx = NULL; 140 gpu->lastctx = NULL;
128 mutex_unlock(&gpu->lock); 141 mutex_unlock(&gpu->lock);
142
143 drm_sched_entity_fini(&gpu->sched,
144 &ctx->sched_entity[i]);
129 } 145 }
130 } 146 }
131 147
@@ -637,25 +653,21 @@ static int compare_str(struct device *dev, void *data)
637static int etnaviv_pdev_probe(struct platform_device *pdev) 653static int etnaviv_pdev_probe(struct platform_device *pdev)
638{ 654{
639 struct device *dev = &pdev->dev; 655 struct device *dev = &pdev->dev;
640 struct device_node *node = dev->of_node;
641 struct component_match *match = NULL; 656 struct component_match *match = NULL;
642 657
643 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32)); 658 dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
644 659
645 if (node) { 660 if (!dev->platform_data) {
646 struct device_node *core_node; 661 struct device_node *core_node;
647 int i;
648 662
649 for (i = 0; ; i++) { 663 for_each_compatible_node(core_node, NULL, "vivante,gc") {
650 core_node = of_parse_phandle(node, "cores", i); 664 if (!of_device_is_available(core_node))
651 if (!core_node) 665 continue;
652 break;
653 666
654 drm_of_component_match_add(&pdev->dev, &match, 667 drm_of_component_match_add(&pdev->dev, &match,
655 compare_of, core_node); 668 compare_of, core_node);
656 of_node_put(core_node);
657 } 669 }
658 } else if (dev->platform_data) { 670 } else {
659 char **names = dev->platform_data; 671 char **names = dev->platform_data;
660 unsigned i; 672 unsigned i;
661 673
@@ -673,25 +685,18 @@ static int etnaviv_pdev_remove(struct platform_device *pdev)
673 return 0; 685 return 0;
674} 686}
675 687
676static const struct of_device_id dt_match[] = {
677 { .compatible = "fsl,imx-gpu-subsystem" },
678 { .compatible = "marvell,dove-gpu-subsystem" },
679 {}
680};
681MODULE_DEVICE_TABLE(of, dt_match);
682
683static struct platform_driver etnaviv_platform_driver = { 688static struct platform_driver etnaviv_platform_driver = {
684 .probe = etnaviv_pdev_probe, 689 .probe = etnaviv_pdev_probe,
685 .remove = etnaviv_pdev_remove, 690 .remove = etnaviv_pdev_remove,
686 .driver = { 691 .driver = {
687 .name = "etnaviv", 692 .name = "etnaviv",
688 .of_match_table = dt_match,
689 }, 693 },
690}; 694};
691 695
692static int __init etnaviv_init(void) 696static int __init etnaviv_init(void)
693{ 697{
694 int ret; 698 int ret;
699 struct device_node *np;
695 700
696 etnaviv_validate_init(); 701 etnaviv_validate_init();
697 702
@@ -703,6 +708,19 @@ static int __init etnaviv_init(void)
703 if (ret != 0) 708 if (ret != 0)
704 platform_driver_unregister(&etnaviv_gpu_driver); 709 platform_driver_unregister(&etnaviv_gpu_driver);
705 710
711 /*
712 * If the DT contains at least one available GPU device, instantiate
713 * the DRM platform device.
714 */
715 for_each_compatible_node(np, NULL, "vivante,gc") {
716 if (!of_device_is_available(np))
717 continue;
718
719 platform_device_register_simple("etnaviv", -1, NULL, 0);
720 of_node_put(np);
721 break;
722 }
723
706 return ret; 724 return ret;
707} 725}
708module_init(etnaviv_init); 726module_init(etnaviv_init);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
index a54f0b758a5c..ddb17ee565e9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
@@ -34,6 +34,7 @@
34#include <drm/drm_fb_helper.h> 34#include <drm/drm_fb_helper.h>
35#include <drm/drm_gem.h> 35#include <drm/drm_gem.h>
36#include <drm/etnaviv_drm.h> 36#include <drm/etnaviv_drm.h>
37#include <drm/gpu_scheduler.h>
37 38
38struct etnaviv_cmdbuf; 39struct etnaviv_cmdbuf;
39struct etnaviv_gpu; 40struct etnaviv_gpu;
@@ -42,11 +43,11 @@ struct etnaviv_gem_object;
42struct etnaviv_gem_submit; 43struct etnaviv_gem_submit;
43 44
44struct etnaviv_file_private { 45struct etnaviv_file_private {
45 /* currently we don't do anything useful with this.. but when 46 /*
46 * per-context address spaces are supported we'd keep track of 47 * When per-context address spaces are supported we'd keep track of
47 * the context's page-tables here. 48 * the context's page-tables here.
48 */ 49 */
49 int dummy; 50 struct drm_sched_entity sched_entity[ETNA_MAX_PIPES];
50}; 51};
51 52
52struct etnaviv_drm_private { 53struct etnaviv_drm_private {
@@ -85,6 +86,7 @@ int etnaviv_gem_new_userptr(struct drm_device *dev, struct drm_file *file,
85 uintptr_t ptr, u32 size, u32 flags, u32 *handle); 86 uintptr_t ptr, u32 size, u32 flags, u32 *handle);
86u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu); 87u16 etnaviv_buffer_init(struct etnaviv_gpu *gpu);
87u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe_addr); 88u16 etnaviv_buffer_config_mmuv2(struct etnaviv_gpu *gpu, u32 mtlb_addr, u32 safe_addr);
89u16 etnaviv_buffer_config_pta(struct etnaviv_gpu *gpu);
88void etnaviv_buffer_end(struct etnaviv_gpu *gpu); 90void etnaviv_buffer_end(struct etnaviv_gpu *gpu);
89void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event); 91void etnaviv_sync_point_queue(struct etnaviv_gpu *gpu, unsigned int event);
90void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state, 92void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index 6d0909c589d1..48aef6cf6a42 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -20,9 +20,13 @@
20#include "etnaviv_gem.h" 20#include "etnaviv_gem.h"
21#include "etnaviv_gpu.h" 21#include "etnaviv_gpu.h"
22#include "etnaviv_mmu.h" 22#include "etnaviv_mmu.h"
23#include "etnaviv_sched.h"
23#include "state.xml.h" 24#include "state.xml.h"
24#include "state_hi.xml.h" 25#include "state_hi.xml.h"
25 26
27static bool etnaviv_dump_core = true;
28module_param_named(dump_core, etnaviv_dump_core, bool, 0600);
29
26struct core_dump_iterator { 30struct core_dump_iterator {
27 void *start; 31 void *start;
28 struct etnaviv_dump_object_header *hdr; 32 struct etnaviv_dump_object_header *hdr;
@@ -121,10 +125,16 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
121 struct etnaviv_vram_mapping *vram; 125 struct etnaviv_vram_mapping *vram;
122 struct etnaviv_gem_object *obj; 126 struct etnaviv_gem_object *obj;
123 struct etnaviv_gem_submit *submit; 127 struct etnaviv_gem_submit *submit;
128 struct drm_sched_job *s_job;
124 unsigned int n_obj, n_bomap_pages; 129 unsigned int n_obj, n_bomap_pages;
125 size_t file_size, mmu_size; 130 size_t file_size, mmu_size;
126 __le64 *bomap, *bomap_start; 131 __le64 *bomap, *bomap_start;
127 132
133 /* Only catch the first event, or when manually re-armed */
134 if (!etnaviv_dump_core)
135 return;
136 etnaviv_dump_core = false;
137
128 mmu_size = etnaviv_iommu_dump_size(gpu->mmu); 138 mmu_size = etnaviv_iommu_dump_size(gpu->mmu);
129 139
130 /* We always dump registers, mmu, ring and end marker */ 140 /* We always dump registers, mmu, ring and end marker */
@@ -135,10 +145,13 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
135 mmu_size + gpu->buffer.size; 145 mmu_size + gpu->buffer.size;
136 146
137 /* Add in the active command buffers */ 147 /* Add in the active command buffers */
138 list_for_each_entry(submit, &gpu->active_submit_list, node) { 148 spin_lock(&gpu->sched.job_list_lock);
149 list_for_each_entry(s_job, &gpu->sched.ring_mirror_list, node) {
150 submit = to_etnaviv_submit(s_job);
139 file_size += submit->cmdbuf.size; 151 file_size += submit->cmdbuf.size;
140 n_obj++; 152 n_obj++;
141 } 153 }
154 spin_unlock(&gpu->sched.job_list_lock);
142 155
143 /* Add in the active buffer objects */ 156 /* Add in the active buffer objects */
144 list_for_each_entry(vram, &gpu->mmu->mappings, mmu_node) { 157 list_for_each_entry(vram, &gpu->mmu->mappings, mmu_node) {
@@ -180,10 +193,14 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
180 gpu->buffer.size, 193 gpu->buffer.size,
181 etnaviv_cmdbuf_get_va(&gpu->buffer)); 194 etnaviv_cmdbuf_get_va(&gpu->buffer));
182 195
183 list_for_each_entry(submit, &gpu->active_submit_list, node) 196 spin_lock(&gpu->sched.job_list_lock);
197 list_for_each_entry(s_job, &gpu->sched.ring_mirror_list, node) {
198 submit = to_etnaviv_submit(s_job);
184 etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD, 199 etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
185 submit->cmdbuf.vaddr, submit->cmdbuf.size, 200 submit->cmdbuf.vaddr, submit->cmdbuf.size,
186 etnaviv_cmdbuf_get_va(&submit->cmdbuf)); 201 etnaviv_cmdbuf_get_va(&submit->cmdbuf));
202 }
203 spin_unlock(&gpu->sched.job_list_lock);
187 204
188 /* Reserve space for the bomap */ 205 /* Reserve space for the bomap */
189 if (n_bomap_pages) { 206 if (n_bomap_pages) {
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.h b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
index be72a9833f2b..93e696fcc14f 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.h
@@ -94,6 +94,9 @@ struct etnaviv_gem_submit_bo {
94 u32 flags; 94 u32 flags;
95 struct etnaviv_gem_object *obj; 95 struct etnaviv_gem_object *obj;
96 struct etnaviv_vram_mapping *mapping; 96 struct etnaviv_vram_mapping *mapping;
97 struct dma_fence *excl;
98 unsigned int nr_shared;
99 struct dma_fence **shared;
97}; 100};
98 101
99/* Created per submit-ioctl, to track bo's and cmdstream bufs, etc, 102/* Created per submit-ioctl, to track bo's and cmdstream bufs, etc,
@@ -101,9 +104,11 @@ struct etnaviv_gem_submit_bo {
101 * make it easier to unwind when things go wrong, etc). 104 * make it easier to unwind when things go wrong, etc).
102 */ 105 */
103struct etnaviv_gem_submit { 106struct etnaviv_gem_submit {
107 struct drm_sched_job sched_job;
104 struct kref refcount; 108 struct kref refcount;
105 struct etnaviv_gpu *gpu; 109 struct etnaviv_gpu *gpu;
106 struct dma_fence *out_fence, *in_fence; 110 struct dma_fence *out_fence, *in_fence;
111 int out_fence_id;
107 struct list_head node; /* GPU active submit list */ 112 struct list_head node; /* GPU active submit list */
108 struct etnaviv_cmdbuf cmdbuf; 113 struct etnaviv_cmdbuf cmdbuf;
109 bool runtime_resumed; 114 bool runtime_resumed;
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
index 1f8202bca061..46ecd3e66ac9 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
@@ -22,6 +22,7 @@
22#include "etnaviv_gpu.h" 22#include "etnaviv_gpu.h"
23#include "etnaviv_gem.h" 23#include "etnaviv_gem.h"
24#include "etnaviv_perfmon.h" 24#include "etnaviv_perfmon.h"
25#include "etnaviv_sched.h"
25 26
26/* 27/*
27 * Cmdstream submission: 28 * Cmdstream submission:
@@ -169,29 +170,33 @@ fail:
169 return ret; 170 return ret;
170} 171}
171 172
172static int submit_fence_sync(const struct etnaviv_gem_submit *submit) 173static int submit_fence_sync(struct etnaviv_gem_submit *submit)
173{ 174{
174 unsigned int context = submit->gpu->fence_context;
175 int i, ret = 0; 175 int i, ret = 0;
176 176
177 for (i = 0; i < submit->nr_bos; i++) { 177 for (i = 0; i < submit->nr_bos; i++) {
178 struct etnaviv_gem_object *etnaviv_obj = submit->bos[i].obj; 178 struct etnaviv_gem_submit_bo *bo = &submit->bos[i];
179 bool write = submit->bos[i].flags & ETNA_SUBMIT_BO_WRITE; 179 struct reservation_object *robj = bo->obj->resv;
180 bool explicit = !!(submit->flags & ETNA_SUBMIT_NO_IMPLICIT);
181 180
182 ret = etnaviv_gpu_fence_sync_obj(etnaviv_obj, context, write, 181 if (!(bo->flags & ETNA_SUBMIT_BO_WRITE)) {
183 explicit); 182 ret = reservation_object_reserve_shared(robj);
184 if (ret) 183 if (ret)
185 break; 184 return ret;
186 } 185 }
186
187 if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT)
188 continue;
189
190 if (bo->flags & ETNA_SUBMIT_BO_WRITE) {
191 ret = reservation_object_get_fences_rcu(robj, &bo->excl,
192 &bo->nr_shared,
193 &bo->shared);
194 if (ret)
195 return ret;
196 } else {
197 bo->excl = reservation_object_get_excl_rcu(robj);
198 }
187 199
188 if (submit->flags & ETNA_SUBMIT_FENCE_FD_IN) {
189 /*
190 * Wait if the fence is from a foreign context, or if the fence
191 * array contains any fence from a foreign context.
192 */
193 if (!dma_fence_match_context(submit->in_fence, context))
194 ret = dma_fence_wait(submit->in_fence, true);
195 } 200 }
196 201
197 return ret; 202 return ret;
@@ -381,8 +386,13 @@ static void submit_cleanup(struct kref *kref)
381 386
382 if (submit->in_fence) 387 if (submit->in_fence)
383 dma_fence_put(submit->in_fence); 388 dma_fence_put(submit->in_fence);
384 if (submit->out_fence) 389 if (submit->out_fence) {
390 /* first remove from IDR, so fence can not be found anymore */
391 mutex_lock(&submit->gpu->fence_idr_lock);
392 idr_remove(&submit->gpu->fence_idr, submit->out_fence_id);
393 mutex_unlock(&submit->gpu->fence_idr_lock);
385 dma_fence_put(submit->out_fence); 394 dma_fence_put(submit->out_fence);
395 }
386 kfree(submit->pmrs); 396 kfree(submit->pmrs);
387 kfree(submit); 397 kfree(submit);
388} 398}
@@ -395,6 +405,7 @@ void etnaviv_submit_put(struct etnaviv_gem_submit *submit)
395int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data, 405int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
396 struct drm_file *file) 406 struct drm_file *file)
397{ 407{
408 struct etnaviv_file_private *ctx = file->driver_priv;
398 struct etnaviv_drm_private *priv = dev->dev_private; 409 struct etnaviv_drm_private *priv = dev->dev_private;
399 struct drm_etnaviv_gem_submit *args = data; 410 struct drm_etnaviv_gem_submit *args = data;
400 struct drm_etnaviv_gem_submit_reloc *relocs; 411 struct drm_etnaviv_gem_submit_reloc *relocs;
@@ -503,10 +514,6 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
503 if (ret) 514 if (ret)
504 goto err_submit_objects; 515 goto err_submit_objects;
505 516
506 ret = submit_lock_objects(submit, &ticket);
507 if (ret)
508 goto err_submit_objects;
509
510 if (!etnaviv_cmd_validate_one(gpu, stream, args->stream_size / 4, 517 if (!etnaviv_cmd_validate_one(gpu, stream, args->stream_size / 4,
511 relocs, args->nr_relocs)) { 518 relocs, args->nr_relocs)) {
512 ret = -EINVAL; 519 ret = -EINVAL;
@@ -521,10 +528,6 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
521 } 528 }
522 } 529 }
523 530
524 ret = submit_fence_sync(submit);
525 if (ret)
526 goto err_submit_objects;
527
528 ret = submit_pin_objects(submit); 531 ret = submit_pin_objects(submit);
529 if (ret) 532 if (ret)
530 goto err_submit_objects; 533 goto err_submit_objects;
@@ -539,9 +542,16 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
539 goto err_submit_objects; 542 goto err_submit_objects;
540 543
541 memcpy(submit->cmdbuf.vaddr, stream, args->stream_size); 544 memcpy(submit->cmdbuf.vaddr, stream, args->stream_size);
542 submit->cmdbuf.user_size = ALIGN(args->stream_size, 8);
543 545
544 ret = etnaviv_gpu_submit(gpu, submit); 546 ret = submit_lock_objects(submit, &ticket);
547 if (ret)
548 goto err_submit_objects;
549
550 ret = submit_fence_sync(submit);
551 if (ret)
552 goto err_submit_objects;
553
554 ret = etnaviv_sched_push_job(&ctx->sched_entity[args->pipe], submit);
545 if (ret) 555 if (ret)
546 goto err_submit_objects; 556 goto err_submit_objects;
547 557
@@ -563,7 +573,7 @@ int etnaviv_ioctl_gem_submit(struct drm_device *dev, void *data,
563 } 573 }
564 574
565 args->fence_fd = out_fence_fd; 575 args->fence_fd = out_fence_fd;
566 args->fence = submit->out_fence->seqno; 576 args->fence = submit->out_fence_id;
567 577
568err_submit_objects: 578err_submit_objects:
569 etnaviv_submit_put(submit); 579 etnaviv_submit_put(submit);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 21d0d22f1168..8a88799bf79b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -26,19 +26,21 @@
26#include "etnaviv_gem.h" 26#include "etnaviv_gem.h"
27#include "etnaviv_mmu.h" 27#include "etnaviv_mmu.h"
28#include "etnaviv_perfmon.h" 28#include "etnaviv_perfmon.h"
29#include "etnaviv_sched.h"
29#include "common.xml.h" 30#include "common.xml.h"
30#include "state.xml.h" 31#include "state.xml.h"
31#include "state_hi.xml.h" 32#include "state_hi.xml.h"
32#include "cmdstream.xml.h" 33#include "cmdstream.xml.h"
33 34
35#ifndef PHYS_OFFSET
36#define PHYS_OFFSET 0
37#endif
38
34static const struct platform_device_id gpu_ids[] = { 39static const struct platform_device_id gpu_ids[] = {
35 { .name = "etnaviv-gpu,2d" }, 40 { .name = "etnaviv-gpu,2d" },
36 { }, 41 { },
37}; 42};
38 43
39static bool etnaviv_dump_core = true;
40module_param_named(dump_core, etnaviv_dump_core, bool, 0600);
41
42/* 44/*
43 * Driver functions: 45 * Driver functions:
44 */ 46 */
@@ -82,6 +84,30 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
82 *value = gpu->identity.minor_features5; 84 *value = gpu->identity.minor_features5;
83 break; 85 break;
84 86
87 case ETNAVIV_PARAM_GPU_FEATURES_7:
88 *value = gpu->identity.minor_features6;
89 break;
90
91 case ETNAVIV_PARAM_GPU_FEATURES_8:
92 *value = gpu->identity.minor_features7;
93 break;
94
95 case ETNAVIV_PARAM_GPU_FEATURES_9:
96 *value = gpu->identity.minor_features8;
97 break;
98
99 case ETNAVIV_PARAM_GPU_FEATURES_10:
100 *value = gpu->identity.minor_features9;
101 break;
102
103 case ETNAVIV_PARAM_GPU_FEATURES_11:
104 *value = gpu->identity.minor_features10;
105 break;
106
107 case ETNAVIV_PARAM_GPU_FEATURES_12:
108 *value = gpu->identity.minor_features11;
109 break;
110
85 case ETNAVIV_PARAM_GPU_STREAM_COUNT: 111 case ETNAVIV_PARAM_GPU_STREAM_COUNT:
86 *value = gpu->identity.stream_count; 112 *value = gpu->identity.stream_count;
87 break; 113 break;
@@ -348,6 +374,13 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
348 dev_info(gpu->dev, "model: GC%x, revision: %x\n", 374 dev_info(gpu->dev, "model: GC%x, revision: %x\n",
349 gpu->identity.model, gpu->identity.revision); 375 gpu->identity.model, gpu->identity.revision);
350 376
377 /*
378 * If there is a match in the HWDB, we aren't interested in the
379 * remaining register values, as they might be wrong.
380 */
381 if (etnaviv_fill_identity_from_hwdb(gpu))
382 return;
383
351 gpu->identity.features = gpu_read(gpu, VIVS_HI_CHIP_FEATURE); 384 gpu->identity.features = gpu_read(gpu, VIVS_HI_CHIP_FEATURE);
352 385
353 /* Disable fast clear on GC700. */ 386 /* Disable fast clear on GC700. */
@@ -448,9 +481,14 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
448 control |= VIVS_HI_CLOCK_CONTROL_ISOLATE_GPU; 481 control |= VIVS_HI_CLOCK_CONTROL_ISOLATE_GPU;
449 gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control); 482 gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control);
450 483
451 /* set soft reset. */ 484 if (gpu->sec_mode == ETNA_SEC_KERNEL) {
452 control |= VIVS_HI_CLOCK_CONTROL_SOFT_RESET; 485 gpu_write(gpu, VIVS_MMUv2_AHB_CONTROL,
453 gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control); 486 VIVS_MMUv2_AHB_CONTROL_RESET);
487 } else {
488 /* set soft reset. */
489 control |= VIVS_HI_CLOCK_CONTROL_SOFT_RESET;
490 gpu_write(gpu, VIVS_HI_CLOCK_CONTROL, control);
491 }
454 492
455 /* wait for reset. */ 493 /* wait for reset. */
456 usleep_range(10, 20); 494 usleep_range(10, 20);
@@ -561,6 +599,12 @@ void etnaviv_gpu_start_fe(struct etnaviv_gpu *gpu, u32 address, u16 prefetch)
561 gpu_write(gpu, VIVS_FE_COMMAND_CONTROL, 599 gpu_write(gpu, VIVS_FE_COMMAND_CONTROL,
562 VIVS_FE_COMMAND_CONTROL_ENABLE | 600 VIVS_FE_COMMAND_CONTROL_ENABLE |
563 VIVS_FE_COMMAND_CONTROL_PREFETCH(prefetch)); 601 VIVS_FE_COMMAND_CONTROL_PREFETCH(prefetch));
602
603 if (gpu->sec_mode == ETNA_SEC_KERNEL) {
604 gpu_write(gpu, VIVS_MMUv2_SEC_COMMAND_CONTROL,
605 VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE |
606 VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(prefetch));
607 }
564} 608}
565 609
566static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu) 610static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
@@ -634,6 +678,12 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
634 gpu_write(gpu, VIVS_MC_BUS_CONFIG, bus_config); 678 gpu_write(gpu, VIVS_MC_BUS_CONFIG, bus_config);
635 } 679 }
636 680
681 if (gpu->sec_mode == ETNA_SEC_KERNEL) {
682 u32 val = gpu_read(gpu, VIVS_MMUv2_AHB_CONTROL);
683 val |= VIVS_MMUv2_AHB_CONTROL_NONSEC_ACCESS;
684 gpu_write(gpu, VIVS_MMUv2_AHB_CONTROL, val);
685 }
686
637 /* setup the pulse eater */ 687 /* setup the pulse eater */
638 etnaviv_gpu_setup_pulse_eater(gpu); 688 etnaviv_gpu_setup_pulse_eater(gpu);
639 689
@@ -696,6 +746,14 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
696 gpu->identity.features &= ~chipFeatures_FAST_CLEAR; 746 gpu->identity.features &= ~chipFeatures_FAST_CLEAR;
697 } 747 }
698 748
749 /*
750 * On cores with security features supported, we claim control over the
751 * security states.
752 */
753 if ((gpu->identity.minor_features7 & chipMinorFeatures7_BIT_SECURITY) &&
754 (gpu->identity.minor_features10 & chipMinorFeatures10_SECURITY_AHB))
755 gpu->sec_mode = ETNA_SEC_KERNEL;
756
699 ret = etnaviv_hw_reset(gpu); 757 ret = etnaviv_hw_reset(gpu);
700 if (ret) { 758 if (ret) {
701 dev_err(gpu->dev, "GPU reset failed\n"); 759 dev_err(gpu->dev, "GPU reset failed\n");
@@ -807,6 +865,8 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
807 verify_dma(gpu, &debug); 865 verify_dma(gpu, &debug);
808 866
809 seq_puts(m, "\tfeatures\n"); 867 seq_puts(m, "\tfeatures\n");
868 seq_printf(m, "\t major_features: 0x%08x\n",
869 gpu->identity.features);
810 seq_printf(m, "\t minor_features0: 0x%08x\n", 870 seq_printf(m, "\t minor_features0: 0x%08x\n",
811 gpu->identity.minor_features0); 871 gpu->identity.minor_features0);
812 seq_printf(m, "\t minor_features1: 0x%08x\n", 872 seq_printf(m, "\t minor_features1: 0x%08x\n",
@@ -819,6 +879,18 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
819 gpu->identity.minor_features4); 879 gpu->identity.minor_features4);
820 seq_printf(m, "\t minor_features5: 0x%08x\n", 880 seq_printf(m, "\t minor_features5: 0x%08x\n",
821 gpu->identity.minor_features5); 881 gpu->identity.minor_features5);
882 seq_printf(m, "\t minor_features6: 0x%08x\n",
883 gpu->identity.minor_features6);
884 seq_printf(m, "\t minor_features7: 0x%08x\n",
885 gpu->identity.minor_features7);
886 seq_printf(m, "\t minor_features8: 0x%08x\n",
887 gpu->identity.minor_features8);
888 seq_printf(m, "\t minor_features9: 0x%08x\n",
889 gpu->identity.minor_features9);
890 seq_printf(m, "\t minor_features10: 0x%08x\n",
891 gpu->identity.minor_features10);
892 seq_printf(m, "\t minor_features11: 0x%08x\n",
893 gpu->identity.minor_features11);
822 894
823 seq_puts(m, "\tspecs\n"); 895 seq_puts(m, "\tspecs\n");
824 seq_printf(m, "\t stream_count: %d\n", 896 seq_printf(m, "\t stream_count: %d\n",
@@ -912,38 +984,24 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)
912} 984}
913#endif 985#endif
914 986
915/* 987void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)
916 * Hangcheck detection for locked gpu:
917 */
918static void recover_worker(struct work_struct *work)
919{ 988{
920 struct etnaviv_gpu *gpu = container_of(work, struct etnaviv_gpu,
921 recover_work);
922 unsigned long flags; 989 unsigned long flags;
923 unsigned int i = 0; 990 unsigned int i = 0;
924 991
925 dev_err(gpu->dev, "hangcheck recover!\n"); 992 dev_err(gpu->dev, "recover hung GPU!\n");
926 993
927 if (pm_runtime_get_sync(gpu->dev) < 0) 994 if (pm_runtime_get_sync(gpu->dev) < 0)
928 return; 995 return;
929 996
930 mutex_lock(&gpu->lock); 997 mutex_lock(&gpu->lock);
931 998
932 /* Only catch the first event, or when manually re-armed */
933 if (etnaviv_dump_core) {
934 etnaviv_core_dump(gpu);
935 etnaviv_dump_core = false;
936 }
937
938 etnaviv_hw_reset(gpu); 999 etnaviv_hw_reset(gpu);
939 1000
940 /* complete all events, the GPU won't do it after the reset */ 1001 /* complete all events, the GPU won't do it after the reset */
941 spin_lock_irqsave(&gpu->event_spinlock, flags); 1002 spin_lock_irqsave(&gpu->event_spinlock, flags);
942 for_each_set_bit_from(i, gpu->event_bitmap, ETNA_NR_EVENTS) { 1003 for_each_set_bit_from(i, gpu->event_bitmap, ETNA_NR_EVENTS)
943 dma_fence_signal(gpu->event[i].fence);
944 gpu->event[i].fence = NULL;
945 complete(&gpu->event_free); 1004 complete(&gpu->event_free);
946 }
947 bitmap_zero(gpu->event_bitmap, ETNA_NR_EVENTS); 1005 bitmap_zero(gpu->event_bitmap, ETNA_NR_EVENTS);
948 spin_unlock_irqrestore(&gpu->event_spinlock, flags); 1006 spin_unlock_irqrestore(&gpu->event_spinlock, flags);
949 gpu->completed_fence = gpu->active_fence; 1007 gpu->completed_fence = gpu->active_fence;
@@ -955,56 +1013,6 @@ static void recover_worker(struct work_struct *work)
955 mutex_unlock(&gpu->lock); 1013 mutex_unlock(&gpu->lock);
956 pm_runtime_mark_last_busy(gpu->dev); 1014 pm_runtime_mark_last_busy(gpu->dev);
957 pm_runtime_put_autosuspend(gpu->dev); 1015 pm_runtime_put_autosuspend(gpu->dev);
958
959 /* Retire the buffer objects in a work */
960 queue_work(gpu->wq, &gpu->retire_work);
961}
962
963static void hangcheck_timer_reset(struct etnaviv_gpu *gpu)
964{
965 DBG("%s", dev_name(gpu->dev));
966 mod_timer(&gpu->hangcheck_timer,
967 round_jiffies_up(jiffies + DRM_ETNAVIV_HANGCHECK_JIFFIES));
968}
969
970static void hangcheck_handler(struct timer_list *t)
971{
972 struct etnaviv_gpu *gpu = from_timer(gpu, t, hangcheck_timer);
973 u32 fence = gpu->completed_fence;
974 bool progress = false;
975
976 if (fence != gpu->hangcheck_fence) {
977 gpu->hangcheck_fence = fence;
978 progress = true;
979 }
980
981 if (!progress) {
982 u32 dma_addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
983 int change = dma_addr - gpu->hangcheck_dma_addr;
984
985 if (change < 0 || change > 16) {
986 gpu->hangcheck_dma_addr = dma_addr;
987 progress = true;
988 }
989 }
990
991 if (!progress && fence_after(gpu->active_fence, fence)) {
992 dev_err(gpu->dev, "hangcheck detected gpu lockup!\n");
993 dev_err(gpu->dev, " completed fence: %u\n", fence);
994 dev_err(gpu->dev, " active fence: %u\n",
995 gpu->active_fence);
996 queue_work(gpu->wq, &gpu->recover_work);
997 }
998
999 /* if still more pending work, reset the hangcheck timer: */
1000 if (fence_after(gpu->active_fence, gpu->hangcheck_fence))
1001 hangcheck_timer_reset(gpu);
1002}
1003
1004static void hangcheck_disable(struct etnaviv_gpu *gpu)
1005{
1006 del_timer_sync(&gpu->hangcheck_timer);
1007 cancel_work_sync(&gpu->recover_work);
1008} 1016}
1009 1017
1010/* fence object management */ 1018/* fence object management */
@@ -1080,54 +1088,6 @@ static struct dma_fence *etnaviv_gpu_fence_alloc(struct etnaviv_gpu *gpu)
1080 return &f->base; 1088 return &f->base;
1081} 1089}
1082 1090
1083int etnaviv_gpu_fence_sync_obj(struct etnaviv_gem_object *etnaviv_obj,
1084 unsigned int context, bool exclusive, bool explicit)
1085{
1086 struct reservation_object *robj = etnaviv_obj->resv;
1087 struct reservation_object_list *fobj;
1088 struct dma_fence *fence;
1089 int i, ret;
1090
1091 if (!exclusive) {
1092 ret = reservation_object_reserve_shared(robj);
1093 if (ret)
1094 return ret;
1095 }
1096
1097 if (explicit)
1098 return 0;
1099
1100 /*
1101 * If we have any shared fences, then the exclusive fence
1102 * should be ignored as it will already have been signalled.
1103 */
1104 fobj = reservation_object_get_list(robj);
1105 if (!fobj || fobj->shared_count == 0) {
1106 /* Wait on any existing exclusive fence which isn't our own */
1107 fence = reservation_object_get_excl(robj);
1108 if (fence && fence->context != context) {
1109 ret = dma_fence_wait(fence, true);
1110 if (ret)
1111 return ret;
1112 }
1113 }
1114
1115 if (!exclusive || !fobj)
1116 return 0;
1117
1118 for (i = 0; i < fobj->shared_count; i++) {
1119 fence = rcu_dereference_protected(fobj->shared[i],
1120 reservation_object_held(robj));
1121 if (fence->context != context) {
1122 ret = dma_fence_wait(fence, true);
1123 if (ret)
1124 return ret;
1125 }
1126 }
1127
1128 return 0;
1129}
1130
1131/* 1091/*
1132 * event management: 1092 * event management:
1133 */ 1093 */
@@ -1194,67 +1154,47 @@ static void event_free(struct etnaviv_gpu *gpu, unsigned int event)
1194/* 1154/*
1195 * Cmdstream submission/retirement: 1155 * Cmdstream submission/retirement:
1196 */ 1156 */
1197
1198static void retire_worker(struct work_struct *work)
1199{
1200 struct etnaviv_gpu *gpu = container_of(work, struct etnaviv_gpu,
1201 retire_work);
1202 u32 fence = gpu->completed_fence;
1203 struct etnaviv_gem_submit *submit, *tmp;
1204 LIST_HEAD(retire_list);
1205
1206 mutex_lock(&gpu->lock);
1207 list_for_each_entry_safe(submit, tmp, &gpu->active_submit_list, node) {
1208 if (!dma_fence_is_signaled(submit->out_fence))
1209 break;
1210
1211 list_move(&submit->node, &retire_list);
1212 }
1213
1214 gpu->retired_fence = fence;
1215
1216 mutex_unlock(&gpu->lock);
1217
1218 list_for_each_entry_safe(submit, tmp, &retire_list, node)
1219 etnaviv_submit_put(submit);
1220}
1221
1222int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu, 1157int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu,
1223 u32 fence, struct timespec *timeout) 1158 u32 id, struct timespec *timeout)
1224{ 1159{
1160 struct dma_fence *fence;
1225 int ret; 1161 int ret;
1226 1162
1227 if (fence_after(fence, gpu->next_fence)) { 1163 /*
1228 DRM_ERROR("waiting on invalid fence: %u (of %u)\n", 1164 * Look up the fence and take a reference. We might still find a fence
1229 fence, gpu->next_fence); 1165 * whose refcount has already dropped to zero. dma_fence_get_rcu
1230 return -EINVAL; 1166 * pretends we didn't find a fence in that case.
1231 } 1167 */
1168 rcu_read_lock();
1169 fence = idr_find(&gpu->fence_idr, id);
1170 if (fence)
1171 fence = dma_fence_get_rcu(fence);
1172 rcu_read_unlock();
1173
1174 if (!fence)
1175 return 0;
1232 1176
1233 if (!timeout) { 1177 if (!timeout) {
1234 /* No timeout was requested: just test for completion */ 1178 /* No timeout was requested: just test for completion */
1235 ret = fence_completed(gpu, fence) ? 0 : -EBUSY; 1179 ret = dma_fence_is_signaled(fence) ? 0 : -EBUSY;
1236 } else { 1180 } else {
1237 unsigned long remaining = etnaviv_timeout_to_jiffies(timeout); 1181 unsigned long remaining = etnaviv_timeout_to_jiffies(timeout);
1238 1182
1239 ret = wait_event_interruptible_timeout(gpu->fence_event, 1183 ret = dma_fence_wait_timeout(fence, true, remaining);
1240 fence_completed(gpu, fence), 1184 if (ret == 0)
1241 remaining);
1242 if (ret == 0) {
1243 DBG("timeout waiting for fence: %u (retired: %u completed: %u)",
1244 fence, gpu->retired_fence,
1245 gpu->completed_fence);
1246 ret = -ETIMEDOUT; 1185 ret = -ETIMEDOUT;
1247 } else if (ret != -ERESTARTSYS) { 1186 else if (ret != -ERESTARTSYS)
1248 ret = 0; 1187 ret = 0;
1249 } 1188
1250 } 1189 }
1251 1190
1191 dma_fence_put(fence);
1252 return ret; 1192 return ret;
1253} 1193}
1254 1194
1255/* 1195/*
1256 * Wait for an object to become inactive. This, on it's own, is not race 1196 * Wait for an object to become inactive. This, on it's own, is not race
1257 * free: the object is moved by the retire worker off the active list, and 1197 * free: the object is moved by the scheduler off the active list, and
1258 * then the iova is put. Moreover, the object could be re-submitted just 1198 * then the iova is put. Moreover, the object could be re-submitted just
1259 * after we notice that it's become inactive. 1199 * after we notice that it's become inactive.
1260 * 1200 *
@@ -1343,16 +1283,19 @@ static void sync_point_perfmon_sample_post(struct etnaviv_gpu *gpu,
1343 1283
1344 1284
1345/* add bo's to gpu's ring, and kick gpu: */ 1285/* add bo's to gpu's ring, and kick gpu: */
1346int etnaviv_gpu_submit(struct etnaviv_gpu *gpu, 1286struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit)
1347 struct etnaviv_gem_submit *submit)
1348{ 1287{
1288 struct etnaviv_gpu *gpu = submit->gpu;
1289 struct dma_fence *gpu_fence;
1349 unsigned int i, nr_events = 1, event[3]; 1290 unsigned int i, nr_events = 1, event[3];
1350 int ret; 1291 int ret;
1351 1292
1352 ret = pm_runtime_get_sync(gpu->dev); 1293 if (!submit->runtime_resumed) {
1353 if (ret < 0) 1294 ret = pm_runtime_get_sync(gpu->dev);
1354 return ret; 1295 if (ret < 0)
1355 submit->runtime_resumed = true; 1296 return NULL;
1297 submit->runtime_resumed = true;
1298 }
1356 1299
1357 /* 1300 /*
1358 * if there are performance monitor requests we need to have 1301 * if there are performance monitor requests we need to have
@@ -1367,21 +1310,20 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
1367 ret = event_alloc(gpu, nr_events, event); 1310 ret = event_alloc(gpu, nr_events, event);
1368 if (ret) { 1311 if (ret) {
1369 DRM_ERROR("no free events\n"); 1312 DRM_ERROR("no free events\n");
1370 return ret; 1313 return NULL;
1371 } 1314 }
1372 1315
1373 mutex_lock(&gpu->lock); 1316 mutex_lock(&gpu->lock);
1374 1317
1375 submit->out_fence = etnaviv_gpu_fence_alloc(gpu); 1318 gpu_fence = etnaviv_gpu_fence_alloc(gpu);
1376 if (!submit->out_fence) { 1319 if (!gpu_fence) {
1377 for (i = 0; i < nr_events; i++) 1320 for (i = 0; i < nr_events; i++)
1378 event_free(gpu, event[i]); 1321 event_free(gpu, event[i]);
1379 1322
1380 ret = -ENOMEM;
1381 goto out_unlock; 1323 goto out_unlock;
1382 } 1324 }
1383 1325
1384 gpu->active_fence = submit->out_fence->seqno; 1326 gpu->active_fence = gpu_fence->seqno;
1385 1327
1386 if (submit->nr_pmrs) { 1328 if (submit->nr_pmrs) {
1387 gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre; 1329 gpu->event[event[1]].sync_point = &sync_point_perfmon_sample_pre;
@@ -1390,8 +1332,8 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
1390 etnaviv_sync_point_queue(gpu, event[1]); 1332 etnaviv_sync_point_queue(gpu, event[1]);
1391 } 1333 }
1392 1334
1393 kref_get(&submit->refcount); 1335 gpu->event[event[0]].fence = gpu_fence;
1394 gpu->event[event[0]].fence = submit->out_fence; 1336 submit->cmdbuf.user_size = submit->cmdbuf.size - 8;
1395 etnaviv_buffer_queue(gpu, submit->exec_state, event[0], 1337 etnaviv_buffer_queue(gpu, submit->exec_state, event[0],
1396 &submit->cmdbuf); 1338 &submit->cmdbuf);
1397 1339
@@ -1402,15 +1344,10 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
1402 etnaviv_sync_point_queue(gpu, event[2]); 1344 etnaviv_sync_point_queue(gpu, event[2]);
1403 } 1345 }
1404 1346
1405 list_add_tail(&submit->node, &gpu->active_submit_list);
1406
1407 hangcheck_timer_reset(gpu);
1408 ret = 0;
1409
1410out_unlock: 1347out_unlock:
1411 mutex_unlock(&gpu->lock); 1348 mutex_unlock(&gpu->lock);
1412 1349
1413 return ret; 1350 return gpu_fence;
1414} 1351}
1415 1352
1416static void sync_point_worker(struct work_struct *work) 1353static void sync_point_worker(struct work_struct *work)
@@ -1428,9 +1365,35 @@ static void sync_point_worker(struct work_struct *work)
1428 etnaviv_gpu_start_fe(gpu, addr + 2, 2); 1365 etnaviv_gpu_start_fe(gpu, addr + 2, 2);
1429} 1366}
1430 1367
1431/* 1368static void dump_mmu_fault(struct etnaviv_gpu *gpu)
1432 * Init/Cleanup: 1369{
1433 */ 1370 u32 status_reg, status;
1371 int i;
1372
1373 if (gpu->sec_mode == ETNA_SEC_NONE)
1374 status_reg = VIVS_MMUv2_STATUS;
1375 else
1376 status_reg = VIVS_MMUv2_SEC_STATUS;
1377
1378 status = gpu_read(gpu, status_reg);
1379 dev_err_ratelimited(gpu->dev, "MMU fault status 0x%08x\n", status);
1380
1381 for (i = 0; i < 4; i++) {
1382 u32 address_reg;
1383
1384 if (!(status & (VIVS_MMUv2_STATUS_EXCEPTION0__MASK << (i * 4))))
1385 continue;
1386
1387 if (gpu->sec_mode == ETNA_SEC_NONE)
1388 address_reg = VIVS_MMUv2_EXCEPTION_ADDR(i);
1389 else
1390 address_reg = VIVS_MMUv2_SEC_EXCEPTION_ADDR;
1391
1392 dev_err_ratelimited(gpu->dev, "MMU %d fault addr 0x%08x\n", i,
1393 gpu_read(gpu, address_reg));
1394 }
1395}
1396
1434static irqreturn_t irq_handler(int irq, void *data) 1397static irqreturn_t irq_handler(int irq, void *data)
1435{ 1398{
1436 struct etnaviv_gpu *gpu = data; 1399 struct etnaviv_gpu *gpu = data;
@@ -1451,17 +1414,7 @@ static irqreturn_t irq_handler(int irq, void *data)
1451 } 1414 }
1452 1415
1453 if (intr & VIVS_HI_INTR_ACKNOWLEDGE_MMU_EXCEPTION) { 1416 if (intr & VIVS_HI_INTR_ACKNOWLEDGE_MMU_EXCEPTION) {
1454 int i; 1417 dump_mmu_fault(gpu);
1455
1456 dev_err_ratelimited(gpu->dev,
1457 "MMU fault status 0x%08x\n",
1458 gpu_read(gpu, VIVS_MMUv2_STATUS));
1459 for (i = 0; i < 4; i++) {
1460 dev_err_ratelimited(gpu->dev,
1461 "MMU %d fault addr 0x%08x\n",
1462 i, gpu_read(gpu,
1463 VIVS_MMUv2_EXCEPTION_ADDR(i)));
1464 }
1465 intr &= ~VIVS_HI_INTR_ACKNOWLEDGE_MMU_EXCEPTION; 1418 intr &= ~VIVS_HI_INTR_ACKNOWLEDGE_MMU_EXCEPTION;
1466 } 1419 }
1467 1420
@@ -1484,7 +1437,6 @@ static irqreturn_t irq_handler(int irq, void *data)
1484 continue; 1437 continue;
1485 1438
1486 gpu->event[event].fence = NULL; 1439 gpu->event[event].fence = NULL;
1487 dma_fence_signal(fence);
1488 1440
1489 /* 1441 /*
1490 * Events can be processed out of order. Eg, 1442 * Events can be processed out of order. Eg,
@@ -1497,13 +1449,11 @@ static irqreturn_t irq_handler(int irq, void *data)
1497 */ 1449 */
1498 if (fence_after(fence->seqno, gpu->completed_fence)) 1450 if (fence_after(fence->seqno, gpu->completed_fence))
1499 gpu->completed_fence = fence->seqno; 1451 gpu->completed_fence = fence->seqno;
1452 dma_fence_signal(fence);
1500 1453
1501 event_free(gpu, event); 1454 event_free(gpu, event);
1502 } 1455 }
1503 1456
1504 /* Retire the buffer objects in a work */
1505 queue_work(gpu->wq, &gpu->retire_work);
1506
1507 ret = IRQ_HANDLED; 1457 ret = IRQ_HANDLED;
1508 } 1458 }
1509 1459
@@ -1514,6 +1464,12 @@ static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu)
1514{ 1464{
1515 int ret; 1465 int ret;
1516 1466
1467 if (gpu->clk_reg) {
1468 ret = clk_prepare_enable(gpu->clk_reg);
1469 if (ret)
1470 return ret;
1471 }
1472
1517 if (gpu->clk_bus) { 1473 if (gpu->clk_bus) {
1518 ret = clk_prepare_enable(gpu->clk_bus); 1474 ret = clk_prepare_enable(gpu->clk_bus);
1519 if (ret) 1475 if (ret)
@@ -1552,6 +1508,8 @@ static int etnaviv_gpu_clk_disable(struct etnaviv_gpu *gpu)
1552 clk_disable_unprepare(gpu->clk_core); 1508 clk_disable_unprepare(gpu->clk_core);
1553 if (gpu->clk_bus) 1509 if (gpu->clk_bus)
1554 clk_disable_unprepare(gpu->clk_bus); 1510 clk_disable_unprepare(gpu->clk_bus);
1511 if (gpu->clk_reg)
1512 clk_disable_unprepare(gpu->clk_reg);
1555 1513
1556 return 0; 1514 return 0;
1557} 1515}
@@ -1675,41 +1633,49 @@ static int etnaviv_gpu_bind(struct device *dev, struct device *master,
1675 1633
1676 gpu->wq = alloc_ordered_workqueue(dev_name(dev), 0); 1634 gpu->wq = alloc_ordered_workqueue(dev_name(dev), 0);
1677 if (!gpu->wq) { 1635 if (!gpu->wq) {
1678 if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) 1636 ret = -ENOMEM;
1679 thermal_cooling_device_unregister(gpu->cooling); 1637 goto out_thermal;
1680 return -ENOMEM;
1681 } 1638 }
1682 1639
1640 ret = etnaviv_sched_init(gpu);
1641 if (ret)
1642 goto out_workqueue;
1643
1683#ifdef CONFIG_PM 1644#ifdef CONFIG_PM
1684 ret = pm_runtime_get_sync(gpu->dev); 1645 ret = pm_runtime_get_sync(gpu->dev);
1685#else 1646#else
1686 ret = etnaviv_gpu_clk_enable(gpu); 1647 ret = etnaviv_gpu_clk_enable(gpu);
1687#endif 1648#endif
1688 if (ret < 0) { 1649 if (ret < 0)
1689 destroy_workqueue(gpu->wq); 1650 goto out_sched;
1690 if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) 1651
1691 thermal_cooling_device_unregister(gpu->cooling);
1692 return ret;
1693 }
1694 1652
1695 gpu->drm = drm; 1653 gpu->drm = drm;
1696 gpu->fence_context = dma_fence_context_alloc(1); 1654 gpu->fence_context = dma_fence_context_alloc(1);
1655 idr_init(&gpu->fence_idr);
1697 spin_lock_init(&gpu->fence_spinlock); 1656 spin_lock_init(&gpu->fence_spinlock);
1698 1657
1699 INIT_LIST_HEAD(&gpu->active_submit_list);
1700 INIT_WORK(&gpu->retire_work, retire_worker);
1701 INIT_WORK(&gpu->sync_point_work, sync_point_worker); 1658 INIT_WORK(&gpu->sync_point_work, sync_point_worker);
1702 INIT_WORK(&gpu->recover_work, recover_worker);
1703 init_waitqueue_head(&gpu->fence_event); 1659 init_waitqueue_head(&gpu->fence_event);
1704 1660
1705 timer_setup(&gpu->hangcheck_timer, hangcheck_handler, TIMER_DEFERRABLE);
1706
1707 priv->gpu[priv->num_gpus++] = gpu; 1661 priv->gpu[priv->num_gpus++] = gpu;
1708 1662
1709 pm_runtime_mark_last_busy(gpu->dev); 1663 pm_runtime_mark_last_busy(gpu->dev);
1710 pm_runtime_put_autosuspend(gpu->dev); 1664 pm_runtime_put_autosuspend(gpu->dev);
1711 1665
1712 return 0; 1666 return 0;
1667
1668out_sched:
1669 etnaviv_sched_fini(gpu);
1670
1671out_workqueue:
1672 destroy_workqueue(gpu->wq);
1673
1674out_thermal:
1675 if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL))
1676 thermal_cooling_device_unregister(gpu->cooling);
1677
1678 return ret;
1713} 1679}
1714 1680
1715static void etnaviv_gpu_unbind(struct device *dev, struct device *master, 1681static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
@@ -1719,11 +1685,11 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
1719 1685
1720 DBG("%s", dev_name(gpu->dev)); 1686 DBG("%s", dev_name(gpu->dev));
1721 1687
1722 hangcheck_disable(gpu);
1723
1724 flush_workqueue(gpu->wq); 1688 flush_workqueue(gpu->wq);
1725 destroy_workqueue(gpu->wq); 1689 destroy_workqueue(gpu->wq);
1726 1690
1691 etnaviv_sched_fini(gpu);
1692
1727#ifdef CONFIG_PM 1693#ifdef CONFIG_PM
1728 pm_runtime_get_sync(gpu->dev); 1694 pm_runtime_get_sync(gpu->dev);
1729 pm_runtime_put_sync_suspend(gpu->dev); 1695 pm_runtime_put_sync_suspend(gpu->dev);
@@ -1745,6 +1711,7 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master,
1745 } 1711 }
1746 1712
1747 gpu->drm = NULL; 1713 gpu->drm = NULL;
1714 idr_destroy(&gpu->fence_idr);
1748 1715
1749 if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL)) 1716 if (IS_ENABLED(CONFIG_DRM_ETNAVIV_THERMAL))
1750 thermal_cooling_device_unregister(gpu->cooling); 1717 thermal_cooling_device_unregister(gpu->cooling);
@@ -1762,6 +1729,7 @@ static const struct of_device_id etnaviv_gpu_match[] = {
1762 }, 1729 },
1763 { /* sentinel */ } 1730 { /* sentinel */ }
1764}; 1731};
1732MODULE_DEVICE_TABLE(of, etnaviv_gpu_match);
1765 1733
1766static int etnaviv_gpu_platform_probe(struct platform_device *pdev) 1734static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
1767{ 1735{
@@ -1775,6 +1743,7 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
1775 1743
1776 gpu->dev = &pdev->dev; 1744 gpu->dev = &pdev->dev;
1777 mutex_init(&gpu->lock); 1745 mutex_init(&gpu->lock);
1746 mutex_init(&gpu->fence_idr_lock);
1778 1747
1779 /* Map registers: */ 1748 /* Map registers: */
1780 gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev)); 1749 gpu->mmio = etnaviv_ioremap(pdev, NULL, dev_name(gpu->dev));
@@ -1796,6 +1765,11 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
1796 } 1765 }
1797 1766
1798 /* Get Clocks: */ 1767 /* Get Clocks: */
1768 gpu->clk_reg = devm_clk_get(&pdev->dev, "reg");
1769 DBG("clk_reg: %p", gpu->clk_reg);
1770 if (IS_ERR(gpu->clk_reg))
1771 gpu->clk_reg = NULL;
1772
1799 gpu->clk_bus = devm_clk_get(&pdev->dev, "bus"); 1773 gpu->clk_bus = devm_clk_get(&pdev->dev, "bus");
1800 DBG("clk_bus: %p", gpu->clk_bus); 1774 DBG("clk_bus: %p", gpu->clk_bus);
1801 if (IS_ERR(gpu->clk_bus)) 1775 if (IS_ERR(gpu->clk_bus))
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
index 7623905210dc..3c3005501846 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
@@ -38,21 +38,17 @@ struct etnaviv_chip_identity {
38 38
39 /* Supported minor feature fields. */ 39 /* Supported minor feature fields. */
40 u32 minor_features0; 40 u32 minor_features0;
41
42 /* Supported minor feature 1 fields. */
43 u32 minor_features1; 41 u32 minor_features1;
44
45 /* Supported minor feature 2 fields. */
46 u32 minor_features2; 42 u32 minor_features2;
47
48 /* Supported minor feature 3 fields. */
49 u32 minor_features3; 43 u32 minor_features3;
50
51 /* Supported minor feature 4 fields. */
52 u32 minor_features4; 44 u32 minor_features4;
53
54 /* Supported minor feature 5 fields. */
55 u32 minor_features5; 45 u32 minor_features5;
46 u32 minor_features6;
47 u32 minor_features7;
48 u32 minor_features8;
49 u32 minor_features9;
50 u32 minor_features10;
51 u32 minor_features11;
56 52
57 /* Number of streams supported. */ 53 /* Number of streams supported. */
58 u32 stream_count; 54 u32 stream_count;
@@ -88,6 +84,12 @@ struct etnaviv_chip_identity {
88 u8 varyings_count; 84 u8 varyings_count;
89}; 85};
90 86
87enum etnaviv_sec_mode {
88 ETNA_SEC_NONE = 0,
89 ETNA_SEC_KERNEL,
90 ETNA_SEC_TZ
91};
92
91struct etnaviv_event { 93struct etnaviv_event {
92 struct dma_fence *fence; 94 struct dma_fence *fence;
93 struct etnaviv_gem_submit *submit; 95 struct etnaviv_gem_submit *submit;
@@ -106,8 +108,10 @@ struct etnaviv_gpu {
106 struct device *dev; 108 struct device *dev;
107 struct mutex lock; 109 struct mutex lock;
108 struct etnaviv_chip_identity identity; 110 struct etnaviv_chip_identity identity;
111 enum etnaviv_sec_mode sec_mode;
109 struct etnaviv_file_private *lastctx; 112 struct etnaviv_file_private *lastctx;
110 struct workqueue_struct *wq; 113 struct workqueue_struct *wq;
114 struct drm_gpu_scheduler sched;
111 115
112 /* 'ring'-buffer: */ 116 /* 'ring'-buffer: */
113 struct etnaviv_cmdbuf buffer; 117 struct etnaviv_cmdbuf buffer;
@@ -122,23 +126,18 @@ struct etnaviv_gpu {
122 struct completion event_free; 126 struct completion event_free;
123 spinlock_t event_spinlock; 127 spinlock_t event_spinlock;
124 128
125 /* list of currently in-flight command buffers */
126 struct list_head active_submit_list;
127
128 u32 idle_mask; 129 u32 idle_mask;
129 130
130 /* Fencing support */ 131 /* Fencing support */
132 struct mutex fence_idr_lock;
133 struct idr fence_idr;
131 u32 next_fence; 134 u32 next_fence;
132 u32 active_fence; 135 u32 active_fence;
133 u32 completed_fence; 136 u32 completed_fence;
134 u32 retired_fence;
135 wait_queue_head_t fence_event; 137 wait_queue_head_t fence_event;
136 u64 fence_context; 138 u64 fence_context;
137 spinlock_t fence_spinlock; 139 spinlock_t fence_spinlock;
138 140
139 /* worker for handling active-list retiring: */
140 struct work_struct retire_work;
141
142 /* worker for handling 'sync' points: */ 141 /* worker for handling 'sync' points: */
143 struct work_struct sync_point_work; 142 struct work_struct sync_point_work;
144 int sync_point_event; 143 int sync_point_event;
@@ -151,16 +150,10 @@ struct etnaviv_gpu {
151 150
152 /* Power Control: */ 151 /* Power Control: */
153 struct clk *clk_bus; 152 struct clk *clk_bus;
153 struct clk *clk_reg;
154 struct clk *clk_core; 154 struct clk *clk_core;
155 struct clk *clk_shader; 155 struct clk *clk_shader;
156 156
157 /* Hang Detction: */
158#define DRM_ETNAVIV_HANGCHECK_PERIOD 500 /* in ms */
159#define DRM_ETNAVIV_HANGCHECK_JIFFIES msecs_to_jiffies(DRM_ETNAVIV_HANGCHECK_PERIOD)
160 struct timer_list hangcheck_timer;
161 u32 hangcheck_fence;
162 u32 hangcheck_dma_addr;
163 struct work_struct recover_work;
164 unsigned int freq_scale; 157 unsigned int freq_scale;
165 unsigned long base_rate_core; 158 unsigned long base_rate_core;
166 unsigned long base_rate_shader; 159 unsigned long base_rate_shader;
@@ -181,29 +174,22 @@ static inline bool fence_completed(struct etnaviv_gpu *gpu, u32 fence)
181 return fence_after_eq(gpu->completed_fence, fence); 174 return fence_after_eq(gpu->completed_fence, fence);
182} 175}
183 176
184static inline bool fence_retired(struct etnaviv_gpu *gpu, u32 fence)
185{
186 return fence_after_eq(gpu->retired_fence, fence);
187}
188
189int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value); 177int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value);
190 178
191int etnaviv_gpu_init(struct etnaviv_gpu *gpu); 179int etnaviv_gpu_init(struct etnaviv_gpu *gpu);
180bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu);
192 181
193#ifdef CONFIG_DEBUG_FS 182#ifdef CONFIG_DEBUG_FS
194int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m); 183int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m);
195#endif 184#endif
196 185
197int etnaviv_gpu_fence_sync_obj(struct etnaviv_gem_object *etnaviv_obj, 186void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu);
198 unsigned int context, bool exclusive, bool implicit);
199
200void etnaviv_gpu_retire(struct etnaviv_gpu *gpu); 187void etnaviv_gpu_retire(struct etnaviv_gpu *gpu);
201int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu, 188int etnaviv_gpu_wait_fence_interruptible(struct etnaviv_gpu *gpu,
202 u32 fence, struct timespec *timeout); 189 u32 fence, struct timespec *timeout);
203int etnaviv_gpu_wait_obj_inactive(struct etnaviv_gpu *gpu, 190int etnaviv_gpu_wait_obj_inactive(struct etnaviv_gpu *gpu,
204 struct etnaviv_gem_object *etnaviv_obj, struct timespec *timeout); 191 struct etnaviv_gem_object *etnaviv_obj, struct timespec *timeout);
205int etnaviv_gpu_submit(struct etnaviv_gpu *gpu, 192struct dma_fence *etnaviv_gpu_submit(struct etnaviv_gem_submit *submit);
206 struct etnaviv_gem_submit *submit);
207int etnaviv_gpu_pm_get_sync(struct etnaviv_gpu *gpu); 193int etnaviv_gpu_pm_get_sync(struct etnaviv_gpu *gpu);
208void etnaviv_gpu_pm_put(struct etnaviv_gpu *gpu); 194void etnaviv_gpu_pm_put(struct etnaviv_gpu *gpu);
209int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms); 195int etnaviv_gpu_wait_idle(struct etnaviv_gpu *gpu, unsigned int timeout_ms);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
new file mode 100644
index 000000000000..ea08bb38caaf
--- /dev/null
+++ b/drivers/gpu/drm/etnaviv/etnaviv_hwdb.c
@@ -0,0 +1,65 @@
1/*
2 * Copyright (C) 2018 Etnaviv Project
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that 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 along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "etnaviv_gpu.h"
18
19static const struct etnaviv_chip_identity etnaviv_chip_identities[] = {
20 {
21 .model = 0x7000,
22 .revision = 0x6214,
23 .stream_count = 16,
24 .register_max = 64,
25 .thread_count = 1024,
26 .shader_core_count = 4,
27 .vertex_cache_size = 16,
28 .vertex_output_buffer_size = 1024,
29 .pixel_pipes = 2,
30 .instruction_count = 512,
31 .num_constants = 320,
32 .buffer_size = 0,
33 .varyings_count = 16,
34 .features = 0xe0287cad,
35 .minor_features0 = 0xc1799eff,
36 .minor_features1 = 0xfefbfad9,
37 .minor_features2 = 0xeb9d4fbf,
38 .minor_features3 = 0xedfffced,
39 .minor_features4 = 0xdb0dafc7,
40 .minor_features5 = 0xbb5ac333,
41 .minor_features6 = 0xfc8ee200,
42 .minor_features7 = 0x03fbfa6f,
43 .minor_features8 = 0x00ef0ef0,
44 .minor_features9 = 0x0edbf03c,
45 .minor_features10 = 0x90044250,
46 .minor_features11 = 0x00000024,
47 },
48};
49
50bool etnaviv_fill_identity_from_hwdb(struct etnaviv_gpu *gpu)
51{
52 struct etnaviv_chip_identity *ident = &gpu->identity;
53 int i;
54
55 for (i = 0; i < ARRAY_SIZE(etnaviv_chip_identities); i++) {
56 if (etnaviv_chip_identities[i].model == ident->model &&
57 etnaviv_chip_identities[i].revision == ident->revision) {
58 memcpy(ident, &etnaviv_chip_identities[i],
59 sizeof(*ident));
60 return true;
61 }
62 }
63
64 return false;
65}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
index 7a8c94731748..4b9b11ca6f03 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu.c
@@ -158,7 +158,7 @@ void etnaviv_iommuv1_restore(struct etnaviv_gpu *gpu)
158 gpu_write(gpu, VIVS_MC_MMU_RA_PAGE_TABLE, pgtable); 158 gpu_write(gpu, VIVS_MC_MMU_RA_PAGE_TABLE, pgtable);
159} 159}
160 160
161const struct etnaviv_iommu_domain_ops etnaviv_iommuv1_ops = { 161static const struct etnaviv_iommu_domain_ops etnaviv_iommuv1_ops = {
162 .free = etnaviv_iommuv1_domain_free, 162 .free = etnaviv_iommuv1_domain_free,
163 .map = etnaviv_iommuv1_map, 163 .map = etnaviv_iommuv1_map,
164 .unmap = etnaviv_iommuv1_unmap, 164 .unmap = etnaviv_iommuv1_unmap,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
index 1e956e266aa3..9752dbd5d28b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_iommu_v2.c
@@ -40,6 +40,9 @@
40 40
41struct etnaviv_iommuv2_domain { 41struct etnaviv_iommuv2_domain {
42 struct etnaviv_iommu_domain base; 42 struct etnaviv_iommu_domain base;
43 /* P(age) T(able) A(rray) */
44 u64 *pta_cpu;
45 dma_addr_t pta_dma;
43 /* M(aster) TLB aka first level pagetable */ 46 /* M(aster) TLB aka first level pagetable */
44 u32 *mtlb_cpu; 47 u32 *mtlb_cpu;
45 dma_addr_t mtlb_dma; 48 dma_addr_t mtlb_dma;
@@ -114,6 +117,15 @@ static int etnaviv_iommuv2_init(struct etnaviv_iommuv2_domain *etnaviv_domain)
114 for (i = 0; i < SZ_4K / 4; i++) 117 for (i = 0; i < SZ_4K / 4; i++)
115 *p++ = 0xdead55aa; 118 *p++ = 0xdead55aa;
116 119
120 etnaviv_domain->pta_cpu = dma_alloc_coherent(etnaviv_domain->base.dev,
121 SZ_4K,
122 &etnaviv_domain->pta_dma,
123 GFP_KERNEL);
124 if (!etnaviv_domain->pta_cpu) {
125 ret = -ENOMEM;
126 goto fail_mem;
127 }
128
117 etnaviv_domain->mtlb_cpu = dma_alloc_coherent(etnaviv_domain->base.dev, 129 etnaviv_domain->mtlb_cpu = dma_alloc_coherent(etnaviv_domain->base.dev,
118 SZ_4K, 130 SZ_4K,
119 &etnaviv_domain->mtlb_dma, 131 &etnaviv_domain->mtlb_dma,
@@ -150,6 +162,11 @@ fail_mem:
150 etnaviv_domain->base.bad_page_cpu, 162 etnaviv_domain->base.bad_page_cpu,
151 etnaviv_domain->base.bad_page_dma); 163 etnaviv_domain->base.bad_page_dma);
152 164
165 if (etnaviv_domain->pta_cpu)
166 dma_free_coherent(etnaviv_domain->base.dev, SZ_4K,
167 etnaviv_domain->pta_cpu,
168 etnaviv_domain->pta_dma);
169
153 if (etnaviv_domain->mtlb_cpu) 170 if (etnaviv_domain->mtlb_cpu)
154 dma_free_coherent(etnaviv_domain->base.dev, SZ_4K, 171 dma_free_coherent(etnaviv_domain->base.dev, SZ_4K,
155 etnaviv_domain->mtlb_cpu, 172 etnaviv_domain->mtlb_cpu,
@@ -176,6 +193,10 @@ static void etnaviv_iommuv2_domain_free(struct etnaviv_iommu_domain *domain)
176 etnaviv_domain->base.bad_page_dma); 193 etnaviv_domain->base.bad_page_dma);
177 194
178 dma_free_coherent(etnaviv_domain->base.dev, SZ_4K, 195 dma_free_coherent(etnaviv_domain->base.dev, SZ_4K,
196 etnaviv_domain->pta_cpu,
197 etnaviv_domain->pta_dma);
198
199 dma_free_coherent(etnaviv_domain->base.dev, SZ_4K,
179 etnaviv_domain->mtlb_cpu, 200 etnaviv_domain->mtlb_cpu,
180 etnaviv_domain->mtlb_dma); 201 etnaviv_domain->mtlb_dma);
181 202
@@ -216,7 +237,7 @@ static void etnaviv_iommuv2_dump(struct etnaviv_iommu_domain *domain, void *buf)
216 memcpy(buf, etnaviv_domain->stlb_cpu[i], SZ_4K); 237 memcpy(buf, etnaviv_domain->stlb_cpu[i], SZ_4K);
217} 238}
218 239
219void etnaviv_iommuv2_restore(struct etnaviv_gpu *gpu) 240static void etnaviv_iommuv2_restore_nonsec(struct etnaviv_gpu *gpu)
220{ 241{
221 struct etnaviv_iommuv2_domain *etnaviv_domain = 242 struct etnaviv_iommuv2_domain *etnaviv_domain =
222 to_etnaviv_domain(gpu->mmu->domain); 243 to_etnaviv_domain(gpu->mmu->domain);
@@ -236,7 +257,60 @@ void etnaviv_iommuv2_restore(struct etnaviv_gpu *gpu)
236 gpu_write(gpu, VIVS_MMUv2_CONTROL, VIVS_MMUv2_CONTROL_ENABLE); 257 gpu_write(gpu, VIVS_MMUv2_CONTROL, VIVS_MMUv2_CONTROL_ENABLE);
237} 258}
238 259
239const struct etnaviv_iommu_domain_ops etnaviv_iommuv2_ops = { 260static void etnaviv_iommuv2_restore_sec(struct etnaviv_gpu *gpu)
261{
262 struct etnaviv_iommuv2_domain *etnaviv_domain =
263 to_etnaviv_domain(gpu->mmu->domain);
264 u16 prefetch;
265
266 /* If the MMU is already enabled the state is still there. */
267 if (gpu_read(gpu, VIVS_MMUv2_SEC_CONTROL) & VIVS_MMUv2_SEC_CONTROL_ENABLE)
268 return;
269
270 gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_LOW,
271 lower_32_bits(etnaviv_domain->pta_dma));
272 gpu_write(gpu, VIVS_MMUv2_PTA_ADDRESS_HIGH,
273 upper_32_bits(etnaviv_domain->pta_dma));
274 gpu_write(gpu, VIVS_MMUv2_PTA_CONTROL, VIVS_MMUv2_PTA_CONTROL_ENABLE);
275
276 gpu_write(gpu, VIVS_MMUv2_NONSEC_SAFE_ADDR_LOW,
277 lower_32_bits(etnaviv_domain->base.bad_page_dma));
278 gpu_write(gpu, VIVS_MMUv2_SEC_SAFE_ADDR_LOW,
279 lower_32_bits(etnaviv_domain->base.bad_page_dma));
280 gpu_write(gpu, VIVS_MMUv2_SAFE_ADDRESS_CONFIG,
281 VIVS_MMUv2_SAFE_ADDRESS_CONFIG_NON_SEC_SAFE_ADDR_HIGH(
282 upper_32_bits(etnaviv_domain->base.bad_page_dma)) |
283 VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH(
284 upper_32_bits(etnaviv_domain->base.bad_page_dma)));
285
286 etnaviv_domain->pta_cpu[0] = etnaviv_domain->mtlb_dma |
287 VIVS_MMUv2_CONFIGURATION_MODE_MODE4_K;
288
289 /* trigger a PTA load through the FE */
290 prefetch = etnaviv_buffer_config_pta(gpu);
291 etnaviv_gpu_start_fe(gpu, (u32)etnaviv_cmdbuf_get_pa(&gpu->buffer),
292 prefetch);
293 etnaviv_gpu_wait_idle(gpu, 100);
294
295 gpu_write(gpu, VIVS_MMUv2_SEC_CONTROL, VIVS_MMUv2_SEC_CONTROL_ENABLE);
296}
297
298void etnaviv_iommuv2_restore(struct etnaviv_gpu *gpu)
299{
300 switch (gpu->sec_mode) {
301 case ETNA_SEC_NONE:
302 etnaviv_iommuv2_restore_nonsec(gpu);
303 break;
304 case ETNA_SEC_KERNEL:
305 etnaviv_iommuv2_restore_sec(gpu);
306 break;
307 default:
308 WARN(1, "unhandled GPU security mode\n");
309 break;
310 }
311}
312
313static const struct etnaviv_iommu_domain_ops etnaviv_iommuv2_ops = {
240 .free = etnaviv_iommuv2_domain_free, 314 .free = etnaviv_iommuv2_domain_free,
241 .map = etnaviv_iommuv2_map, 315 .map = etnaviv_iommuv2_map,
242 .unmap = etnaviv_iommuv2_unmap, 316 .unmap = etnaviv_iommuv2_unmap,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index d113fe06e6b5..49e049713a52 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -29,7 +29,7 @@ static void etnaviv_domain_unmap(struct etnaviv_iommu_domain *domain,
29 size_t pgsize = SZ_4K; 29 size_t pgsize = SZ_4K;
30 30
31 if (!IS_ALIGNED(iova | size, pgsize)) { 31 if (!IS_ALIGNED(iova | size, pgsize)) {
32 pr_err("unaligned: iova 0x%lx size 0x%zx min_pagesz 0x%x\n", 32 pr_err("unaligned: iova 0x%lx size 0x%zx min_pagesz 0x%zx\n",
33 iova, size, pgsize); 33 iova, size, pgsize);
34 return; 34 return;
35 } 35 }
@@ -54,7 +54,7 @@ static int etnaviv_domain_map(struct etnaviv_iommu_domain *domain,
54 int ret = 0; 54 int ret = 0;
55 55
56 if (!IS_ALIGNED(iova | paddr | size, pgsize)) { 56 if (!IS_ALIGNED(iova | paddr | size, pgsize)) {
57 pr_err("unaligned: iova 0x%lx pa %pa size 0x%zx min_pagesz 0x%x\n", 57 pr_err("unaligned: iova 0x%lx pa %pa size 0x%zx min_pagesz 0x%zx\n",
58 iova, &paddr, size, pgsize); 58 iova, &paddr, size, pgsize);
59 return -EINVAL; 59 return -EINVAL;
60 } 60 }
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
new file mode 100644
index 000000000000..6cf0775dbcd7
--- /dev/null
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -0,0 +1,170 @@
1/*
2 * Copyright (C) 2017 Etnaviv Project
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that 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 along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/kthread.h>
18
19#include "etnaviv_drv.h"
20#include "etnaviv_dump.h"
21#include "etnaviv_gem.h"
22#include "etnaviv_gpu.h"
23#include "etnaviv_sched.h"
24
25static int etnaviv_job_hang_limit = 0;
26module_param_named(job_hang_limit, etnaviv_job_hang_limit, int , 0444);
27static int etnaviv_hw_jobs_limit = 4;
28module_param_named(hw_job_limit, etnaviv_hw_jobs_limit, int , 0444);
29
30static struct dma_fence *
31etnaviv_sched_dependency(struct drm_sched_job *sched_job,
32 struct drm_sched_entity *entity)
33{
34 struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
35 struct dma_fence *fence;
36 int i;
37
38 if (unlikely(submit->in_fence)) {
39 fence = submit->in_fence;
40 submit->in_fence = NULL;
41
42 if (!dma_fence_is_signaled(fence))
43 return fence;
44
45 dma_fence_put(fence);
46 }
47
48 for (i = 0; i < submit->nr_bos; i++) {
49 struct etnaviv_gem_submit_bo *bo = &submit->bos[i];
50 int j;
51
52 if (bo->excl) {
53 fence = bo->excl;
54 bo->excl = NULL;
55
56 if (!dma_fence_is_signaled(fence))
57 return fence;
58
59 dma_fence_put(fence);
60 }
61
62 for (j = 0; j < bo->nr_shared; j++) {
63 if (!bo->shared[j])
64 continue;
65
66 fence = bo->shared[j];
67 bo->shared[j] = NULL;
68
69 if (!dma_fence_is_signaled(fence))
70 return fence;
71
72 dma_fence_put(fence);
73 }
74 kfree(bo->shared);
75 bo->nr_shared = 0;
76 bo->shared = NULL;
77 }
78
79 return NULL;
80}
81
82static struct dma_fence *etnaviv_sched_run_job(struct drm_sched_job *sched_job)
83{
84 struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
85 struct dma_fence *fence = NULL;
86
87 if (likely(!sched_job->s_fence->finished.error))
88 fence = etnaviv_gpu_submit(submit);
89 else
90 dev_dbg(submit->gpu->dev, "skipping bad job\n");
91
92 return fence;
93}
94
95static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
96{
97 struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
98 struct etnaviv_gpu *gpu = submit->gpu;
99
100 /* block scheduler */
101 kthread_park(gpu->sched.thread);
102 drm_sched_hw_job_reset(&gpu->sched, sched_job);
103
104 /* get the GPU back into the init state */
105 etnaviv_core_dump(gpu);
106 etnaviv_gpu_recover_hang(gpu);
107
108 /* restart scheduler after GPU is usable again */
109 drm_sched_job_recovery(&gpu->sched);
110 kthread_unpark(gpu->sched.thread);
111}
112
113static void etnaviv_sched_free_job(struct drm_sched_job *sched_job)
114{
115 struct etnaviv_gem_submit *submit = to_etnaviv_submit(sched_job);
116
117 etnaviv_submit_put(submit);
118}
119
120static const struct drm_sched_backend_ops etnaviv_sched_ops = {
121 .dependency = etnaviv_sched_dependency,
122 .run_job = etnaviv_sched_run_job,
123 .timedout_job = etnaviv_sched_timedout_job,
124 .free_job = etnaviv_sched_free_job,
125};
126
127int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity,
128 struct etnaviv_gem_submit *submit)
129{
130 int ret;
131
132 ret = drm_sched_job_init(&submit->sched_job, &submit->gpu->sched,
133 sched_entity, submit->cmdbuf.ctx);
134 if (ret)
135 return ret;
136
137 submit->out_fence = dma_fence_get(&submit->sched_job.s_fence->finished);
138 mutex_lock(&submit->gpu->fence_idr_lock);
139 submit->out_fence_id = idr_alloc_cyclic(&submit->gpu->fence_idr,
140 submit->out_fence, 0,
141 INT_MAX, GFP_KERNEL);
142 mutex_unlock(&submit->gpu->fence_idr_lock);
143 if (submit->out_fence_id < 0)
144 return -ENOMEM;
145
146 /* the scheduler holds on to the job now */
147 kref_get(&submit->refcount);
148
149 drm_sched_entity_push_job(&submit->sched_job, sched_entity);
150
151 return 0;
152}
153
154int etnaviv_sched_init(struct etnaviv_gpu *gpu)
155{
156 int ret;
157
158 ret = drm_sched_init(&gpu->sched, &etnaviv_sched_ops,
159 etnaviv_hw_jobs_limit, etnaviv_job_hang_limit,
160 msecs_to_jiffies(500), dev_name(gpu->dev));
161 if (ret)
162 return ret;
163
164 return 0;
165}
166
167void etnaviv_sched_fini(struct etnaviv_gpu *gpu)
168{
169 drm_sched_fini(&gpu->sched);
170}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.h b/drivers/gpu/drm/etnaviv/etnaviv_sched.h
new file mode 100644
index 000000000000..097635fa78ae
--- /dev/null
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.h
@@ -0,0 +1,35 @@
1/*
2 * Copyright (C) 2017 Etnaviv Project
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License version 2 as published by
6 * the Free Software Foundation.
7 *
8 * This program is distributed in the hope that 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 along with
14 * this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef __ETNAVIV_SCHED_H__
18#define __ETNAVIV_SCHED_H__
19
20#include <drm/gpu_scheduler.h>
21
22struct etnaviv_gpu;
23
24static inline
25struct etnaviv_gem_submit *to_etnaviv_submit(struct drm_sched_job *sched_job)
26{
27 return container_of(sched_job, struct etnaviv_gem_submit, sched_job);
28}
29
30int etnaviv_sched_init(struct etnaviv_gpu *gpu);
31void etnaviv_sched_fini(struct etnaviv_gpu *gpu);
32int etnaviv_sched_push_job(struct drm_sched_entity *sched_entity,
33 struct etnaviv_gem_submit *submit);
34
35#endif /* __ETNAVIV_SCHED_H__ */
diff --git a/drivers/gpu/drm/etnaviv/state.xml.h b/drivers/gpu/drm/etnaviv/state.xml.h
index c27c1484cfa9..421cb7cc0053 100644
--- a/drivers/gpu/drm/etnaviv/state.xml.h
+++ b/drivers/gpu/drm/etnaviv/state.xml.h
@@ -1,4 +1,3 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef STATE_XML 1#ifndef STATE_XML
3#define STATE_XML 2#define STATE_XML
4 3
@@ -9,14 +8,40 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
9git clone git://0x04.net/rules-ng-ng 8git clone git://0x04.net/rules-ng-ng
10 9
11The rules-ng-ng source files this header was generated from are: 10The rules-ng-ng source files this header was generated from are:
12- state.xml ( 18882 bytes, from 2015-03-25 11:42:32) 11- state.xml ( 26087 bytes, from 2017-12-18 16:51:59)
13- common.xml ( 18437 bytes, from 2015-03-25 11:27:41) 12- common.xml ( 35468 bytes, from 2018-01-22 13:48:54)
14- state_hi.xml ( 23420 bytes, from 2015-03-25 11:47:21) 13- common_3d.xml ( 14615 bytes, from 2017-12-18 16:51:59)
15- state_2d.xml ( 51549 bytes, from 2015-03-25 11:25:06) 14- state_hi.xml ( 30232 bytes, from 2018-02-15 15:48:01)
16- state_3d.xml ( 54600 bytes, from 2015-03-25 11:25:19) 15- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
17- state_vg.xml ( 5973 bytes, from 2015-03-25 11:26:01) 16- state_2d.xml ( 51552 bytes, from 2016-12-08 16:37:56)
18 17- state_3d.xml ( 79992 bytes, from 2017-12-18 16:51:59)
19Copyright (C) 2015 18- state_blt.xml ( 13405 bytes, from 2017-12-18 16:51:59)
19- state_vg.xml ( 5975 bytes, from 2016-12-08 16:37:56)
20
21Copyright (C) 2012-2017 by the following authors:
22- Wladimir J. van der Laan <laanwj@gmail.com>
23- Christian Gmeiner <christian.gmeiner@gmail.com>
24- Lucas Stach <l.stach@pengutronix.de>
25- Russell King <rmk@arm.linux.org.uk>
26
27Permission is hereby granted, free of charge, to any person obtaining a
28copy of this software and associated documentation files (the "Software"),
29to deal in the Software without restriction, including without limitation
30the rights to use, copy, modify, merge, publish, distribute, sub license,
31and/or sell copies of the Software, and to permit persons to whom the
32Software is furnished to do so, subject to the following conditions:
33
34The above copyright notice and this permission notice (including the
35next paragraph) shall be included in all copies or substantial portions
36of the Software.
37
38THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
41THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
43FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
44DEALINGS IN THE SOFTWARE.
20*/ 45*/
21 46
22 47
@@ -24,9 +49,25 @@ Copyright (C) 2015
24#define VARYING_COMPONENT_USE_USED 0x00000001 49#define VARYING_COMPONENT_USE_USED 0x00000001
25#define VARYING_COMPONENT_USE_POINTCOORD_X 0x00000002 50#define VARYING_COMPONENT_USE_POINTCOORD_X 0x00000002
26#define VARYING_COMPONENT_USE_POINTCOORD_Y 0x00000003 51#define VARYING_COMPONENT_USE_POINTCOORD_Y 0x00000003
52#define FE_DATA_TYPE_BYTE 0x00000000
53#define FE_DATA_TYPE_UNSIGNED_BYTE 0x00000001
54#define FE_DATA_TYPE_SHORT 0x00000002
55#define FE_DATA_TYPE_UNSIGNED_SHORT 0x00000003
56#define FE_DATA_TYPE_INT 0x00000004
57#define FE_DATA_TYPE_UNSIGNED_INT 0x00000005
58#define FE_DATA_TYPE_FLOAT 0x00000008
59#define FE_DATA_TYPE_HALF_FLOAT 0x00000009
60#define FE_DATA_TYPE_FIXED 0x0000000b
61#define FE_DATA_TYPE_INT_10_10_10_2 0x0000000c
62#define FE_DATA_TYPE_UNSIGNED_INT_10_10_10_2 0x0000000d
63#define FE_DATA_TYPE_BYTE_I 0x0000000e
64#define FE_DATA_TYPE_SHORT_I 0x0000000f
27#define FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__MASK 0x000000ff 65#define FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__MASK 0x000000ff
28#define FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__SHIFT 0 66#define FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__SHIFT 0
29#define FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE(x) (((x) << FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__SHIFT) & FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__MASK) 67#define FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE(x) (((x) << FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__SHIFT) & FE_VERTEX_STREAM_CONTROL_VERTEX_STRIDE__MASK)
68#define FE_VERTEX_STREAM_CONTROL_VERTEX_DIVISOR__MASK 0x00ff0000
69#define FE_VERTEX_STREAM_CONTROL_VERTEX_DIVISOR__SHIFT 16
70#define FE_VERTEX_STREAM_CONTROL_VERTEX_DIVISOR(x) (((x) << FE_VERTEX_STREAM_CONTROL_VERTEX_DIVISOR__SHIFT) & FE_VERTEX_STREAM_CONTROL_VERTEX_DIVISOR__MASK)
30#define VIVS_FE 0x00000000 71#define VIVS_FE 0x00000000
31 72
32#define VIVS_FE_VERTEX_ELEMENT_CONFIG(i0) (0x00000600 + 0x4*(i0)) 73#define VIVS_FE_VERTEX_ELEMENT_CONFIG(i0) (0x00000600 + 0x4*(i0))
@@ -34,17 +75,7 @@ Copyright (C) 2015
34#define VIVS_FE_VERTEX_ELEMENT_CONFIG__LEN 0x00000010 75#define VIVS_FE_VERTEX_ELEMENT_CONFIG__LEN 0x00000010
35#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE__MASK 0x0000000f 76#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE__MASK 0x0000000f
36#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE__SHIFT 0 77#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE__SHIFT 0
37#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_BYTE 0x00000000 78#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE(x) (((x) << VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE__SHIFT) & VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE__MASK)
38#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_UNSIGNED_BYTE 0x00000001
39#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_SHORT 0x00000002
40#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_UNSIGNED_SHORT 0x00000003
41#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_INT 0x00000004
42#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_UNSIGNED_INT 0x00000005
43#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_FLOAT 0x00000008
44#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_HALF_FLOAT 0x00000009
45#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_FIXED 0x0000000b
46#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_INT_10_10_10_2 0x0000000c
47#define VIVS_FE_VERTEX_ELEMENT_CONFIG_TYPE_UNSIGNED_INT_10_10_10_2 0x0000000d
48#define VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__MASK 0x00000030 79#define VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__MASK 0x00000030
49#define VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__SHIFT 4 80#define VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__SHIFT 4
50#define VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN(x) (((x) << VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__SHIFT) & VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__MASK) 81#define VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN(x) (((x) << VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__SHIFT) & VIVS_FE_VERTEX_ELEMENT_CONFIG_ENDIAN__MASK)
@@ -76,6 +107,7 @@ Copyright (C) 2015
76#define VIVS_FE_INDEX_STREAM_CONTROL_TYPE_UNSIGNED_CHAR 0x00000000 107#define VIVS_FE_INDEX_STREAM_CONTROL_TYPE_UNSIGNED_CHAR 0x00000000
77#define VIVS_FE_INDEX_STREAM_CONTROL_TYPE_UNSIGNED_SHORT 0x00000001 108#define VIVS_FE_INDEX_STREAM_CONTROL_TYPE_UNSIGNED_SHORT 0x00000001
78#define VIVS_FE_INDEX_STREAM_CONTROL_TYPE_UNSIGNED_INT 0x00000002 109#define VIVS_FE_INDEX_STREAM_CONTROL_TYPE_UNSIGNED_INT 0x00000002
110#define VIVS_FE_INDEX_STREAM_CONTROL_PRIMITIVE_RESTART 0x00000100
79 111
80#define VIVS_FE_VERTEX_STREAM_BASE_ADDR 0x0000064c 112#define VIVS_FE_VERTEX_STREAM_BASE_ADDR 0x0000064c
81 113
@@ -151,6 +183,8 @@ Copyright (C) 2015
151 183
152#define VIVS_FE_AUTO_FLUSH 0x00000670 184#define VIVS_FE_AUTO_FLUSH 0x00000670
153 185
186#define VIVS_FE_PRIMITIVE_RESTART_INDEX 0x00000674
187
154#define VIVS_FE_UNK00678 0x00000678 188#define VIVS_FE_UNK00678 0x00000678
155 189
156#define VIVS_FE_UNK0067C 0x0000067c 190#define VIVS_FE_UNK0067C 0x0000067c
@@ -163,17 +197,40 @@ Copyright (C) 2015
163 197
164#define VIVS_FE_VERTEX_STREAMS_CONTROL(i0) (0x000006a0 + 0x4*(i0)) 198#define VIVS_FE_VERTEX_STREAMS_CONTROL(i0) (0x000006a0 + 0x4*(i0))
165 199
166#define VIVS_FE_UNK00700(i0) (0x00000700 + 0x4*(i0)) 200#define VIVS_FE_GENERIC_ATTRIB(i0) (0x00000000 + 0x4*(i0))
167#define VIVS_FE_UNK00700__ESIZE 0x00000004 201#define VIVS_FE_GENERIC_ATTRIB__ESIZE 0x00000004
168#define VIVS_FE_UNK00700__LEN 0x00000010 202#define VIVS_FE_GENERIC_ATTRIB__LEN 0x00000010
203
204#define VIVS_FE_GENERIC_ATTRIB_UNK006C0(i0) (0x000006c0 + 0x4*(i0))
205
206#define VIVS_FE_GENERIC_ATTRIB_UNK00700(i0) (0x00000700 + 0x4*(i0))
207
208#define VIVS_FE_GENERIC_ATTRIB_UNK00740(i0) (0x00000740 + 0x4*(i0))
209
210#define VIVS_FE_GENERIC_ATTRIB_SCALE(i0) (0x00000780 + 0x4*(i0))
211
212#define VIVS_FE_HALTI5_UNK007C4 0x000007c4
213
214#define VIVS_FE_HALTI5_UNK007D0(i0) (0x000007d0 + 0x4*(i0))
215#define VIVS_FE_HALTI5_UNK007D0__ESIZE 0x00000004
216#define VIVS_FE_HALTI5_UNK007D0__LEN 0x00000002
217
218#define VIVS_FE_HALTI5_UNK007D8 0x000007d8
219
220#define VIVS_FE_DESC_START 0x000007dc
221
222#define VIVS_FE_DESC_END 0x000007e0
223
224#define VIVS_FE_DESC_AVAIL 0x000007e4
225#define VIVS_FE_DESC_AVAIL_COUNT__MASK 0x0000007f
226#define VIVS_FE_DESC_AVAIL_COUNT__SHIFT 0
227#define VIVS_FE_DESC_AVAIL_COUNT(x) (((x) << VIVS_FE_DESC_AVAIL_COUNT__SHIFT) & VIVS_FE_DESC_AVAIL_COUNT__MASK)
228
229#define VIVS_FE_FENCE_WAIT_DATA_LOW 0x000007e8
169 230
170#define VIVS_FE_UNK00740(i0) (0x00000740 + 0x4*(i0)) 231#define VIVS_FE_FENCE_WAIT_DATA_HIGH 0x000007f4
171#define VIVS_FE_UNK00740__ESIZE 0x00000004
172#define VIVS_FE_UNK00740__LEN 0x00000010
173 232
174#define VIVS_FE_UNK00780(i0) (0x00000780 + 0x4*(i0)) 233#define VIVS_FE_ROBUSTNESS_UNK007F8 0x000007f8
175#define VIVS_FE_UNK00780__ESIZE 0x00000004
176#define VIVS_FE_UNK00780__LEN 0x00000010
177 234
178#define VIVS_GL 0x00000000 235#define VIVS_GL 0x00000000
179 236
@@ -188,6 +245,7 @@ Copyright (C) 2015
188#define VIVS_GL_EVENT_EVENT_ID(x) (((x) << VIVS_GL_EVENT_EVENT_ID__SHIFT) & VIVS_GL_EVENT_EVENT_ID__MASK) 245#define VIVS_GL_EVENT_EVENT_ID(x) (((x) << VIVS_GL_EVENT_EVENT_ID__SHIFT) & VIVS_GL_EVENT_EVENT_ID__MASK)
189#define VIVS_GL_EVENT_FROM_FE 0x00000020 246#define VIVS_GL_EVENT_FROM_FE 0x00000020
190#define VIVS_GL_EVENT_FROM_PE 0x00000040 247#define VIVS_GL_EVENT_FROM_PE 0x00000040
248#define VIVS_GL_EVENT_FROM_BLT 0x00000080
191#define VIVS_GL_EVENT_SOURCE__MASK 0x00001f00 249#define VIVS_GL_EVENT_SOURCE__MASK 0x00001f00
192#define VIVS_GL_EVENT_SOURCE__SHIFT 8 250#define VIVS_GL_EVENT_SOURCE__SHIFT 8
193#define VIVS_GL_EVENT_SOURCE(x) (((x) << VIVS_GL_EVENT_SOURCE__SHIFT) & VIVS_GL_EVENT_SOURCE__MASK) 251#define VIVS_GL_EVENT_SOURCE(x) (((x) << VIVS_GL_EVENT_SOURCE__SHIFT) & VIVS_GL_EVENT_SOURCE__MASK)
@@ -199,6 +257,9 @@ Copyright (C) 2015
199#define VIVS_GL_SEMAPHORE_TOKEN_TO__MASK 0x00001f00 257#define VIVS_GL_SEMAPHORE_TOKEN_TO__MASK 0x00001f00
200#define VIVS_GL_SEMAPHORE_TOKEN_TO__SHIFT 8 258#define VIVS_GL_SEMAPHORE_TOKEN_TO__SHIFT 8
201#define VIVS_GL_SEMAPHORE_TOKEN_TO(x) (((x) << VIVS_GL_SEMAPHORE_TOKEN_TO__SHIFT) & VIVS_GL_SEMAPHORE_TOKEN_TO__MASK) 259#define VIVS_GL_SEMAPHORE_TOKEN_TO(x) (((x) << VIVS_GL_SEMAPHORE_TOKEN_TO__SHIFT) & VIVS_GL_SEMAPHORE_TOKEN_TO__MASK)
260#define VIVS_GL_SEMAPHORE_TOKEN_UNK28__MASK 0x30000000
261#define VIVS_GL_SEMAPHORE_TOKEN_UNK28__SHIFT 28
262#define VIVS_GL_SEMAPHORE_TOKEN_UNK28(x) (((x) << VIVS_GL_SEMAPHORE_TOKEN_UNK28__SHIFT) & VIVS_GL_SEMAPHORE_TOKEN_UNK28__MASK)
202 263
203#define VIVS_GL_FLUSH_CACHE 0x0000380c 264#define VIVS_GL_FLUSH_CACHE 0x0000380c
204#define VIVS_GL_FLUSH_CACHE_DEPTH 0x00000001 265#define VIVS_GL_FLUSH_CACHE_DEPTH 0x00000001
@@ -208,6 +269,10 @@ Copyright (C) 2015
208#define VIVS_GL_FLUSH_CACHE_TEXTUREVS 0x00000010 269#define VIVS_GL_FLUSH_CACHE_TEXTUREVS 0x00000010
209#define VIVS_GL_FLUSH_CACHE_SHADER_L1 0x00000020 270#define VIVS_GL_FLUSH_CACHE_SHADER_L1 0x00000020
210#define VIVS_GL_FLUSH_CACHE_SHADER_L2 0x00000040 271#define VIVS_GL_FLUSH_CACHE_SHADER_L2 0x00000040
272#define VIVS_GL_FLUSH_CACHE_UNK10 0x00000400
273#define VIVS_GL_FLUSH_CACHE_UNK11 0x00000800
274#define VIVS_GL_FLUSH_CACHE_DESCRIPTOR_UNK12 0x00001000
275#define VIVS_GL_FLUSH_CACHE_DESCRIPTOR_UNK13 0x00002000
211 276
212#define VIVS_GL_FLUSH_MMU 0x00003810 277#define VIVS_GL_FLUSH_MMU 0x00003810
213#define VIVS_GL_FLUSH_MMU_FLUSH_FEMMU 0x00000001 278#define VIVS_GL_FLUSH_MMU_FLUSH_FEMMU 0x00000001
@@ -244,30 +309,8 @@ Copyright (C) 2015
244#define VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM(x) (((x) << VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM__SHIFT) & VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM__MASK) 309#define VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM(x) (((x) << VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM__SHIFT) & VIVS_GL_VARYING_TOTAL_COMPONENTS_NUM__MASK)
245 310
246#define VIVS_GL_VARYING_NUM_COMPONENTS 0x00003820 311#define VIVS_GL_VARYING_NUM_COMPONENTS 0x00003820
247#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR0__MASK 0x00000007 312
248#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR0__SHIFT 0 313#define VIVS_GL_OCCLUSION_QUERY_ADDR 0x00003824
249#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR0(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR0__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR0__MASK)
250#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR1__MASK 0x00000070
251#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR1__SHIFT 4
252#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR1(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR1__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR1__MASK)
253#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR2__MASK 0x00000700
254#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR2__SHIFT 8
255#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR2(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR2__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR2__MASK)
256#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR3__MASK 0x00007000
257#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR3__SHIFT 12
258#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR3(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR3__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR3__MASK)
259#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR4__MASK 0x00070000
260#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR4__SHIFT 16
261#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR4(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR4__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR4__MASK)
262#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR5__MASK 0x00700000
263#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR5__SHIFT 20
264#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR5(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR5__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR5__MASK)
265#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR6__MASK 0x07000000
266#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR6__SHIFT 24
267#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR6(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR6__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR6__MASK)
268#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR7__MASK 0x70000000
269#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR7__SHIFT 28
270#define VIVS_GL_VARYING_NUM_COMPONENTS_VAR7(x) (((x) << VIVS_GL_VARYING_NUM_COMPONENTS_VAR7__SHIFT) & VIVS_GL_VARYING_NUM_COMPONENTS_VAR7__MASK)
271 314
272#define VIVS_GL_VARYING_COMPONENT_USE(i0) (0x00003828 + 0x4*(i0)) 315#define VIVS_GL_VARYING_COMPONENT_USE(i0) (0x00003828 + 0x4*(i0))
273#define VIVS_GL_VARYING_COMPONENT_USE__ESIZE 0x00000004 316#define VIVS_GL_VARYING_COMPONENT_USE__ESIZE 0x00000004
@@ -321,6 +364,10 @@ Copyright (C) 2015
321#define VIVS_GL_VARYING_COMPONENT_USE_COMP15__SHIFT 30 364#define VIVS_GL_VARYING_COMPONENT_USE_COMP15__SHIFT 30
322#define VIVS_GL_VARYING_COMPONENT_USE_COMP15(x) (((x) << VIVS_GL_VARYING_COMPONENT_USE_COMP15__SHIFT) & VIVS_GL_VARYING_COMPONENT_USE_COMP15__MASK) 365#define VIVS_GL_VARYING_COMPONENT_USE_COMP15(x) (((x) << VIVS_GL_VARYING_COMPONENT_USE_COMP15__SHIFT) & VIVS_GL_VARYING_COMPONENT_USE_COMP15__MASK)
323 366
367#define VIVS_GL_UNK0382C 0x0000382c
368
369#define VIVS_GL_OCCLUSION_QUERY_CONTROL 0x00003830
370
324#define VIVS_GL_UNK03834 0x00003834 371#define VIVS_GL_UNK03834 0x00003834
325 372
326#define VIVS_GL_UNK03838 0x00003838 373#define VIVS_GL_UNK03838 0x00003838
@@ -332,8 +379,58 @@ Copyright (C) 2015
332 379
333#define VIVS_GL_CONTEXT_POINTER 0x00003850 380#define VIVS_GL_CONTEXT_POINTER 0x00003850
334 381
382#define VIVS_GL_UNK03854 0x00003854
383
384#define VIVS_GL_BUG_FIXES 0x00003860
385
386#define VIVS_GL_FENCE_OUT_ADDRESS 0x00003868
387
388#define VIVS_GL_FENCE_OUT_DATA_LOW 0x0000386c
389
390#define VIVS_GL_HALTI5_UNK03884 0x00003884
391
392#define VIVS_GL_HALTI5_SH_SPECIALS 0x00003888
393#define VIVS_GL_HALTI5_SH_SPECIALS_VS_PSIZE_OUT__MASK 0x0000007f
394#define VIVS_GL_HALTI5_SH_SPECIALS_VS_PSIZE_OUT__SHIFT 0
395#define VIVS_GL_HALTI5_SH_SPECIALS_VS_PSIZE_OUT(x) (((x) << VIVS_GL_HALTI5_SH_SPECIALS_VS_PSIZE_OUT__SHIFT) & VIVS_GL_HALTI5_SH_SPECIALS_VS_PSIZE_OUT__MASK)
396#define VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN__MASK 0x00007f00
397#define VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN__SHIFT 8
398#define VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN(x) (((x) << VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN__SHIFT) & VIVS_GL_HALTI5_SH_SPECIALS_PS_PCOORD_IN__MASK)
399#define VIVS_GL_HALTI5_SH_SPECIALS_UNK16__MASK 0x007f0000
400#define VIVS_GL_HALTI5_SH_SPECIALS_UNK16__SHIFT 16
401#define VIVS_GL_HALTI5_SH_SPECIALS_UNK16(x) (((x) << VIVS_GL_HALTI5_SH_SPECIALS_UNK16__SHIFT) & VIVS_GL_HALTI5_SH_SPECIALS_UNK16__MASK)
402#define VIVS_GL_HALTI5_SH_SPECIALS_UNK24__MASK 0xff000000
403#define VIVS_GL_HALTI5_SH_SPECIALS_UNK24__SHIFT 24
404#define VIVS_GL_HALTI5_SH_SPECIALS_UNK24(x) (((x) << VIVS_GL_HALTI5_SH_SPECIALS_UNK24__SHIFT) & VIVS_GL_HALTI5_SH_SPECIALS_UNK24__MASK)
405
406#define VIVS_GL_GS_UNK0388C 0x0000388c
407
408#define VIVS_GL_FENCE_OUT_DATA_HIGH 0x00003898
409
410#define VIVS_GL_SHADER_INDEX 0x0000389c
411
412#define VIVS_GL_GS_UNK038A0(i0) (0x000038a0 + 0x4*(i0))
413#define VIVS_GL_GS_UNK038A0__ESIZE 0x00000004
414#define VIVS_GL_GS_UNK038A0__LEN 0x00000008
415
416#define VIVS_GL_HALTI5_UNK038C0(i0) (0x000038c0 + 0x4*(i0))
417#define VIVS_GL_HALTI5_UNK038C0__ESIZE 0x00000004
418#define VIVS_GL_HALTI5_UNK038C0__LEN 0x00000010
419
420#define VIVS_GL_SECURITY_UNK3900 0x00003900
421
422#define VIVS_GL_SECURITY_UNK3904 0x00003904
423
335#define VIVS_GL_UNK03A00 0x00003a00 424#define VIVS_GL_UNK03A00 0x00003a00
336 425
426#define VIVS_GL_UNK03A04 0x00003a04
427
428#define VIVS_GL_UNK03A08 0x00003a08
429
430#define VIVS_GL_UNK03A0C 0x00003a0c
431
432#define VIVS_GL_UNK03A10 0x00003a10
433
337#define VIVS_GL_STALL_TOKEN 0x00003c00 434#define VIVS_GL_STALL_TOKEN 0x00003c00
338#define VIVS_GL_STALL_TOKEN_FROM__MASK 0x0000001f 435#define VIVS_GL_STALL_TOKEN_FROM__MASK 0x0000001f
339#define VIVS_GL_STALL_TOKEN_FROM__SHIFT 0 436#define VIVS_GL_STALL_TOKEN_FROM__SHIFT 0
@@ -344,6 +441,59 @@ Copyright (C) 2015
344#define VIVS_GL_STALL_TOKEN_FLIP0 0x40000000 441#define VIVS_GL_STALL_TOKEN_FLIP0 0x40000000
345#define VIVS_GL_STALL_TOKEN_FLIP1 0x80000000 442#define VIVS_GL_STALL_TOKEN_FLIP1 0x80000000
346 443
444#define VIVS_NFE 0x00000000
445
446#define VIVS_NFE_VERTEX_STREAMS(i0) (0x00000000 + 0x4*(i0))
447#define VIVS_NFE_VERTEX_STREAMS__ESIZE 0x00000004
448#define VIVS_NFE_VERTEX_STREAMS__LEN 0x00000010
449
450#define VIVS_NFE_VERTEX_STREAMS_BASE_ADDR(i0) (0x00014600 + 0x4*(i0))
451
452#define VIVS_NFE_VERTEX_STREAMS_CONTROL(i0) (0x00014640 + 0x4*(i0))
453
454#define VIVS_NFE_VERTEX_STREAMS_UNK14680(i0) (0x00014680 + 0x4*(i0))
455
456#define VIVS_NFE_VERTEX_STREAMS_ROBUSTNESS_UNK146C0(i0) (0x000146c0 + 0x4*(i0))
457
458#define VIVS_NFE_GENERIC_ATTRIB(i0) (0x00000000 + 0x4*(i0))
459#define VIVS_NFE_GENERIC_ATTRIB__ESIZE 0x00000004
460#define VIVS_NFE_GENERIC_ATTRIB__LEN 0x00000020
461
462#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0(i0) (0x00017800 + 0x4*(i0))
463#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_TYPE__MASK 0x0000000f
464#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_TYPE__SHIFT 0
465#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_TYPE(x) (((x) << VIVS_NFE_GENERIC_ATTRIB_CONFIG0_TYPE__SHIFT) & VIVS_NFE_GENERIC_ATTRIB_CONFIG0_TYPE__MASK)
466#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_ENDIAN__MASK 0x00000030
467#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_ENDIAN__SHIFT 4
468#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_ENDIAN(x) (((x) << VIVS_NFE_GENERIC_ATTRIB_CONFIG0_ENDIAN__SHIFT) & VIVS_NFE_GENERIC_ATTRIB_CONFIG0_ENDIAN__MASK)
469#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_STREAM__MASK 0x00000700
470#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_STREAM__SHIFT 8
471#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_STREAM(x) (((x) << VIVS_NFE_GENERIC_ATTRIB_CONFIG0_STREAM__SHIFT) & VIVS_NFE_GENERIC_ATTRIB_CONFIG0_STREAM__MASK)
472#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NUM__MASK 0x00003000
473#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NUM__SHIFT 12
474#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NUM(x) (((x) << VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NUM__SHIFT) & VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NUM__MASK)
475#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NORMALIZE__MASK 0x0000c000
476#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NORMALIZE__SHIFT 14
477#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NORMALIZE_OFF 0x00000000
478#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_NORMALIZE_ON 0x00008000
479#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_START__MASK 0x00ff0000
480#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_START__SHIFT 16
481#define VIVS_NFE_GENERIC_ATTRIB_CONFIG0_START(x) (((x) << VIVS_NFE_GENERIC_ATTRIB_CONFIG0_START__SHIFT) & VIVS_NFE_GENERIC_ATTRIB_CONFIG0_START__MASK)
482
483#define VIVS_NFE_GENERIC_ATTRIB_UNK17880(i0) (0x00017880 + 0x4*(i0))
484
485#define VIVS_NFE_GENERIC_ATTRIB_UNK17900(i0) (0x00017900 + 0x4*(i0))
486
487#define VIVS_NFE_GENERIC_ATTRIB_UNK17980(i0) (0x00017980 + 0x4*(i0))
488
489#define VIVS_NFE_GENERIC_ATTRIB_SCALE(i0) (0x00017a00 + 0x4*(i0))
490
491#define VIVS_NFE_GENERIC_ATTRIB_CONFIG1(i0) (0x00017a80 + 0x4*(i0))
492#define VIVS_NFE_GENERIC_ATTRIB_CONFIG1_END__MASK 0x000000ff
493#define VIVS_NFE_GENERIC_ATTRIB_CONFIG1_END__SHIFT 0
494#define VIVS_NFE_GENERIC_ATTRIB_CONFIG1_END(x) (((x) << VIVS_NFE_GENERIC_ATTRIB_CONFIG1_END__SHIFT) & VIVS_NFE_GENERIC_ATTRIB_CONFIG1_END__MASK)
495#define VIVS_NFE_GENERIC_ATTRIB_CONFIG1_NONCONSECUTIVE 0x00000800
496
347#define VIVS_DUMMY 0x00000000 497#define VIVS_DUMMY 0x00000000
348 498
349#define VIVS_DUMMY_DUMMY 0x0003fffc 499#define VIVS_DUMMY_DUMMY 0x0003fffc
diff --git a/drivers/gpu/drm/etnaviv/state_3d.xml.h b/drivers/gpu/drm/etnaviv/state_3d.xml.h
index 73a97d35c51b..ebbd4fcf3096 100644
--- a/drivers/gpu/drm/etnaviv/state_3d.xml.h
+++ b/drivers/gpu/drm/etnaviv/state_3d.xml.h
@@ -7,4 +7,9 @@
7#define VIVS_TS_FLUSH_CACHE 0x00001650 7#define VIVS_TS_FLUSH_CACHE 0x00001650
8#define VIVS_TS_FLUSH_CACHE_FLUSH 0x00000001 8#define VIVS_TS_FLUSH_CACHE_FLUSH 0x00000001
9 9
10#define VIVS_NTE_DESCRIPTOR_FLUSH 0x00014c44
11#define VIVS_NTE_DESCRIPTOR_FLUSH_UNK28__MASK 0xf0000000
12#define VIVS_NTE_DESCRIPTOR_FLUSH_UNK28__SHIFT 28
13#define VIVS_NTE_DESCRIPTOR_FLUSH_UNK28(x) (((x) << VIVS_NTE_DESCRIPTOR_FLUSH_UNK28__SHIFT) & VIVS_NTE_DESCRIPTOR_FLUSH_UNK28__MASK)
14
10#endif /* STATE_3D_XML */ 15#endif /* STATE_3D_XML */
diff --git a/drivers/gpu/drm/etnaviv/state_blt.xml.h b/drivers/gpu/drm/etnaviv/state_blt.xml.h
new file mode 100644
index 000000000000..daae55995def
--- /dev/null
+++ b/drivers/gpu/drm/etnaviv/state_blt.xml.h
@@ -0,0 +1,52 @@
1#ifndef STATE_BLT_XML
2#define STATE_BLT_XML
3
4/* Autogenerated file, DO NOT EDIT manually!
5
6This file was generated by the rules-ng-ng headergen tool in this git repository:
7http://0x04.net/cgit/index.cgi/rules-ng-ng
8git clone git://0x04.net/rules-ng-ng
9
10The rules-ng-ng source files this header was generated from are:
11- state.xml ( 26087 bytes, from 2017-12-18 16:51:59)
12- common.xml ( 35468 bytes, from 2018-01-22 13:48:54)
13- common_3d.xml ( 14615 bytes, from 2017-12-18 16:51:59)
14- state_hi.xml ( 30232 bytes, from 2018-02-15 15:48:01)
15- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
16- state_2d.xml ( 51552 bytes, from 2016-12-08 16:37:56)
17- state_3d.xml ( 79992 bytes, from 2017-12-18 16:51:59)
18- state_blt.xml ( 13405 bytes, from 2017-12-18 16:51:59)
19- state_vg.xml ( 5975 bytes, from 2016-12-08 16:37:56)
20
21Copyright (C) 2012-2017 by the following authors:
22- Wladimir J. van der Laan <laanwj@gmail.com>
23- Christian Gmeiner <christian.gmeiner@gmail.com>
24- Lucas Stach <l.stach@pengutronix.de>
25- Russell King <rmk@arm.linux.org.uk>
26
27Permission is hereby granted, free of charge, to any person obtaining a
28copy of this software and associated documentation files (the "Software"),
29to deal in the Software without restriction, including without limitation
30the rights to use, copy, modify, merge, publish, distribute, sub license,
31and/or sell copies of the Software, and to permit persons to whom the
32Software is furnished to do so, subject to the following conditions:
33
34The above copyright notice and this permission notice (including the
35next paragraph) shall be included in all copies or substantial portions
36of the Software.
37
38THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
41THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
43FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
44DEALINGS IN THE SOFTWARE.
45*/
46
47/* This is a cut-down version of the state_blt.xml.h file */
48
49#define VIVS_BLT_ENABLE 0x000140b8
50#define VIVS_BLT_ENABLE_ENABLE 0x00000001
51
52#endif /* STATE_BLT_XML */
diff --git a/drivers/gpu/drm/etnaviv/state_hi.xml.h b/drivers/gpu/drm/etnaviv/state_hi.xml.h
index 60808daf7e8d..41d8da2b6f4f 100644
--- a/drivers/gpu/drm/etnaviv/state_hi.xml.h
+++ b/drivers/gpu/drm/etnaviv/state_hi.xml.h
@@ -1,4 +1,3 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef STATE_HI_XML 1#ifndef STATE_HI_XML
3#define STATE_HI_XML 2#define STATE_HI_XML
4 3
@@ -9,10 +8,40 @@ http://0x04.net/cgit/index.cgi/rules-ng-ng
9git clone git://0x04.net/rules-ng-ng 8git clone git://0x04.net/rules-ng-ng
10 9
11The rules-ng-ng source files this header was generated from are: 10The rules-ng-ng source files this header was generated from are:
12- state_hi.xml ( 25620 bytes, from 2016-08-19 22:07:37) 11- state.xml ( 26087 bytes, from 2017-12-18 16:51:59)
13- common.xml ( 20583 bytes, from 2016-06-07 05:22:38) 12- common.xml ( 35468 bytes, from 2018-01-22 13:48:54)
14 13- common_3d.xml ( 14615 bytes, from 2017-12-18 16:51:59)
15Copyright (C) 2016 14- state_hi.xml ( 30232 bytes, from 2018-02-15 15:48:01)
15- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
16- state_2d.xml ( 51552 bytes, from 2016-12-08 16:37:56)
17- state_3d.xml ( 79992 bytes, from 2017-12-18 16:51:59)
18- state_blt.xml ( 13405 bytes, from 2017-12-18 16:51:59)
19- state_vg.xml ( 5975 bytes, from 2016-12-08 16:37:56)
20
21Copyright (C) 2012-2018 by the following authors:
22- Wladimir J. van der Laan <laanwj@gmail.com>
23- Christian Gmeiner <christian.gmeiner@gmail.com>
24- Lucas Stach <l.stach@pengutronix.de>
25- Russell King <rmk@arm.linux.org.uk>
26
27Permission is hereby granted, free of charge, to any person obtaining a
28copy of this software and associated documentation files (the "Software"),
29to deal in the Software without restriction, including without limitation
30the rights to use, copy, modify, merge, publish, distribute, sub license,
31and/or sell copies of the Software, and to permit persons to whom the
32Software is furnished to do so, subject to the following conditions:
33
34The above copyright notice and this permission notice (including the
35next paragraph) shall be included in all copies or substantial portions
36of the Software.
37
38THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
41THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
43FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
44DEALINGS IN THE SOFTWARE.
16*/ 45*/
17 46
18 47
@@ -192,6 +221,9 @@ Copyright (C) 2016
192#define VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT__SHIFT 0 221#define VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT__SHIFT 0
193#define VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT(x) (((x) << VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT__SHIFT) & VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT__MASK) 222#define VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT(x) (((x) << VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT__SHIFT) & VIVS_HI_CHIP_SPECS_3_GPU_CORE_COUNT__MASK)
194 223
224#define VIVS_HI_COMPRESSION_FLAGS 0x00000090
225#define VIVS_HI_COMPRESSION_FLAGS_DEC300 0x00000040
226
195#define VIVS_HI_CHIP_MINOR_FEATURE_4 0x00000094 227#define VIVS_HI_CHIP_MINOR_FEATURE_4 0x00000094
196 228
197#define VIVS_HI_CHIP_SPECS_4 0x0000009c 229#define VIVS_HI_CHIP_SPECS_4 0x0000009c
@@ -203,6 +235,10 @@ Copyright (C) 2016
203 235
204#define VIVS_HI_CHIP_PRODUCT_ID 0x000000a8 236#define VIVS_HI_CHIP_PRODUCT_ID 0x000000a8
205 237
238#define VIVS_HI_BLT_INTR 0x000000d4
239
240#define VIVS_HI_AUXBIT 0x000000ec
241
206#define VIVS_PM 0x00000000 242#define VIVS_PM 0x00000000
207 243
208#define VIVS_PM_POWER_CONTROLS 0x00000100 244#define VIVS_PM_POWER_CONTROLS 0x00000100
@@ -239,6 +275,17 @@ Copyright (C) 2016
239#define VIVS_PM_MODULE_STATUS_MODULE_CLOCK_GATED_TX 0x00000080 275#define VIVS_PM_MODULE_STATUS_MODULE_CLOCK_GATED_TX 0x00000080
240 276
241#define VIVS_PM_PULSE_EATER 0x0000010c 277#define VIVS_PM_PULSE_EATER 0x0000010c
278#define VIVS_PM_PULSE_EATER_DISABLE 0x00000001
279#define VIVS_PM_PULSE_EATER_DVFS_PERIOD__MASK 0x0000ff00
280#define VIVS_PM_PULSE_EATER_DVFS_PERIOD__SHIFT 8
281#define VIVS_PM_PULSE_EATER_DVFS_PERIOD(x) (((x) << VIVS_PM_PULSE_EATER_DVFS_PERIOD__SHIFT) & VIVS_PM_PULSE_EATER_DVFS_PERIOD__MASK)
282#define VIVS_PM_PULSE_EATER_UNK16 0x00010000
283#define VIVS_PM_PULSE_EATER_UNK17 0x00020000
284#define VIVS_PM_PULSE_EATER_INTERNAL_DFS 0x00040000
285#define VIVS_PM_PULSE_EATER_UNK19 0x00080000
286#define VIVS_PM_PULSE_EATER_UNK20 0x00100000
287#define VIVS_PM_PULSE_EATER_UNK22 0x00400000
288#define VIVS_PM_PULSE_EATER_UNK23 0x00800000
242 289
243#define VIVS_MMUv2 0x00000000 290#define VIVS_MMUv2 0x00000000
244 291
@@ -280,6 +327,68 @@ Copyright (C) 2016
280#define VIVS_MMUv2_EXCEPTION_ADDR__ESIZE 0x00000004 327#define VIVS_MMUv2_EXCEPTION_ADDR__ESIZE 0x00000004
281#define VIVS_MMUv2_EXCEPTION_ADDR__LEN 0x00000004 328#define VIVS_MMUv2_EXCEPTION_ADDR__LEN 0x00000004
282 329
330#define VIVS_MMUv2_PROFILE_BLT_READ 0x000001a4
331
332#define VIVS_MMUv2_PTA_CONFIG 0x000001ac
333#define VIVS_MMUv2_PTA_CONFIG_INDEX__MASK 0x0000ffff
334#define VIVS_MMUv2_PTA_CONFIG_INDEX__SHIFT 0
335#define VIVS_MMUv2_PTA_CONFIG_INDEX(x) (((x) << VIVS_MMUv2_PTA_CONFIG_INDEX__SHIFT) & VIVS_MMUv2_PTA_CONFIG_INDEX__MASK)
336#define VIVS_MMUv2_PTA_CONFIG_UNK16 0x00010000
337
338#define VIVS_MMUv2_AXI_POLICY(i0) (0x000001c0 + 0x4*(i0))
339#define VIVS_MMUv2_AXI_POLICY__ESIZE 0x00000004
340#define VIVS_MMUv2_AXI_POLICY__LEN 0x00000008
341
342#define VIVS_MMUv2_SEC_EXCEPTION_ADDR 0x00000380
343
344#define VIVS_MMUv2_SEC_STATUS 0x00000384
345#define VIVS_MMUv2_SEC_STATUS_EXCEPTION0__MASK 0x00000003
346#define VIVS_MMUv2_SEC_STATUS_EXCEPTION0__SHIFT 0
347#define VIVS_MMUv2_SEC_STATUS_EXCEPTION0(x) (((x) << VIVS_MMUv2_SEC_STATUS_EXCEPTION0__SHIFT) & VIVS_MMUv2_SEC_STATUS_EXCEPTION0__MASK)
348#define VIVS_MMUv2_SEC_STATUS_EXCEPTION1__MASK 0x00000030
349#define VIVS_MMUv2_SEC_STATUS_EXCEPTION1__SHIFT 4
350#define VIVS_MMUv2_SEC_STATUS_EXCEPTION1(x) (((x) << VIVS_MMUv2_SEC_STATUS_EXCEPTION1__SHIFT) & VIVS_MMUv2_SEC_STATUS_EXCEPTION1__MASK)
351#define VIVS_MMUv2_SEC_STATUS_EXCEPTION2__MASK 0x00000300
352#define VIVS_MMUv2_SEC_STATUS_EXCEPTION2__SHIFT 8
353#define VIVS_MMUv2_SEC_STATUS_EXCEPTION2(x) (((x) << VIVS_MMUv2_SEC_STATUS_EXCEPTION2__SHIFT) & VIVS_MMUv2_SEC_STATUS_EXCEPTION2__MASK)
354#define VIVS_MMUv2_SEC_STATUS_EXCEPTION3__MASK 0x00003000
355#define VIVS_MMUv2_SEC_STATUS_EXCEPTION3__SHIFT 12
356#define VIVS_MMUv2_SEC_STATUS_EXCEPTION3(x) (((x) << VIVS_MMUv2_SEC_STATUS_EXCEPTION3__SHIFT) & VIVS_MMUv2_SEC_STATUS_EXCEPTION3__MASK)
357
358#define VIVS_MMUv2_SEC_CONTROL 0x00000388
359#define VIVS_MMUv2_SEC_CONTROL_ENABLE 0x00000001
360
361#define VIVS_MMUv2_PTA_ADDRESS_LOW 0x0000038c
362
363#define VIVS_MMUv2_PTA_ADDRESS_HIGH 0x00000390
364
365#define VIVS_MMUv2_PTA_CONTROL 0x00000394
366#define VIVS_MMUv2_PTA_CONTROL_ENABLE 0x00000001
367
368#define VIVS_MMUv2_NONSEC_SAFE_ADDR_LOW 0x00000398
369
370#define VIVS_MMUv2_SEC_SAFE_ADDR_LOW 0x0000039c
371
372#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG 0x000003a0
373#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_NON_SEC_SAFE_ADDR_HIGH__MASK 0x000000ff
374#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_NON_SEC_SAFE_ADDR_HIGH__SHIFT 0
375#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_NON_SEC_SAFE_ADDR_HIGH(x) (((x) << VIVS_MMUv2_SAFE_ADDRESS_CONFIG_NON_SEC_SAFE_ADDR_HIGH__SHIFT) & VIVS_MMUv2_SAFE_ADDRESS_CONFIG_NON_SEC_SAFE_ADDR_HIGH__MASK)
376#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_UNK15 0x00008000
377#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH__MASK 0x00ff0000
378#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH__SHIFT 16
379#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH(x) (((x) << VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH__SHIFT) & VIVS_MMUv2_SAFE_ADDRESS_CONFIG_SEC_SAFE_ADDR_HIGH__MASK)
380#define VIVS_MMUv2_SAFE_ADDRESS_CONFIG_UNK31 0x80000000
381
382#define VIVS_MMUv2_SEC_COMMAND_CONTROL 0x000003a4
383#define VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH__MASK 0x0000ffff
384#define VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH__SHIFT 0
385#define VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH(x) (((x) << VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH__SHIFT) & VIVS_MMUv2_SEC_COMMAND_CONTROL_PREFETCH__MASK)
386#define VIVS_MMUv2_SEC_COMMAND_CONTROL_ENABLE 0x00010000
387
388#define VIVS_MMUv2_AHB_CONTROL 0x000003a8
389#define VIVS_MMUv2_AHB_CONTROL_RESET 0x00000001
390#define VIVS_MMUv2_AHB_CONTROL_NONSEC_ACCESS 0x00000002
391
283#define VIVS_MC 0x00000000 392#define VIVS_MC 0x00000000
284 393
285#define VIVS_MC_MMU_FE_PAGE_TABLE 0x00000400 394#define VIVS_MC_MMU_FE_PAGE_TABLE 0x00000400
@@ -340,13 +449,13 @@ Copyright (C) 2016
340#define VIVS_MC_PROFILE_HI_READ 0x0000046c 449#define VIVS_MC_PROFILE_HI_READ 0x0000046c
341 450
342#define VIVS_MC_PROFILE_CONFIG0 0x00000470 451#define VIVS_MC_PROFILE_CONFIG0 0x00000470
343#define VIVS_MC_PROFILE_CONFIG0_FE__MASK 0x0000000f 452#define VIVS_MC_PROFILE_CONFIG0_FE__MASK 0x000000ff
344#define VIVS_MC_PROFILE_CONFIG0_FE__SHIFT 0 453#define VIVS_MC_PROFILE_CONFIG0_FE__SHIFT 0
345#define VIVS_MC_PROFILE_CONFIG0_FE_RESET 0x0000000f 454#define VIVS_MC_PROFILE_CONFIG0_FE_RESET 0x0000000f
346#define VIVS_MC_PROFILE_CONFIG0_DE__MASK 0x00000f00 455#define VIVS_MC_PROFILE_CONFIG0_DE__MASK 0x0000ff00
347#define VIVS_MC_PROFILE_CONFIG0_DE__SHIFT 8 456#define VIVS_MC_PROFILE_CONFIG0_DE__SHIFT 8
348#define VIVS_MC_PROFILE_CONFIG0_DE_RESET 0x00000f00 457#define VIVS_MC_PROFILE_CONFIG0_DE_RESET 0x00000f00
349#define VIVS_MC_PROFILE_CONFIG0_PE__MASK 0x000f0000 458#define VIVS_MC_PROFILE_CONFIG0_PE__MASK 0x00ff0000
350#define VIVS_MC_PROFILE_CONFIG0_PE__SHIFT 16 459#define VIVS_MC_PROFILE_CONFIG0_PE__SHIFT 16
351#define VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_KILLED_BY_COLOR_PIPE 0x00000000 460#define VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_KILLED_BY_COLOR_PIPE 0x00000000
352#define VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_KILLED_BY_DEPTH_PIPE 0x00010000 461#define VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_KILLED_BY_DEPTH_PIPE 0x00010000
@@ -354,7 +463,7 @@ Copyright (C) 2016
354#define VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_DRAWN_BY_DEPTH_PIPE 0x00030000 463#define VIVS_MC_PROFILE_CONFIG0_PE_PIXEL_COUNT_DRAWN_BY_DEPTH_PIPE 0x00030000
355#define VIVS_MC_PROFILE_CONFIG0_PE_PIXELS_RENDERED_2D 0x000b0000 464#define VIVS_MC_PROFILE_CONFIG0_PE_PIXELS_RENDERED_2D 0x000b0000
356#define VIVS_MC_PROFILE_CONFIG0_PE_RESET 0x000f0000 465#define VIVS_MC_PROFILE_CONFIG0_PE_RESET 0x000f0000
357#define VIVS_MC_PROFILE_CONFIG0_SH__MASK 0x0f000000 466#define VIVS_MC_PROFILE_CONFIG0_SH__MASK 0xff000000
358#define VIVS_MC_PROFILE_CONFIG0_SH__SHIFT 24 467#define VIVS_MC_PROFILE_CONFIG0_SH__SHIFT 24
359#define VIVS_MC_PROFILE_CONFIG0_SH_SHADER_CYCLES 0x04000000 468#define VIVS_MC_PROFILE_CONFIG0_SH_SHADER_CYCLES 0x04000000
360#define VIVS_MC_PROFILE_CONFIG0_SH_PS_INST_COUNTER 0x07000000 469#define VIVS_MC_PROFILE_CONFIG0_SH_PS_INST_COUNTER 0x07000000
@@ -368,7 +477,7 @@ Copyright (C) 2016
368#define VIVS_MC_PROFILE_CONFIG0_SH_RESET 0x0f000000 477#define VIVS_MC_PROFILE_CONFIG0_SH_RESET 0x0f000000
369 478
370#define VIVS_MC_PROFILE_CONFIG1 0x00000474 479#define VIVS_MC_PROFILE_CONFIG1 0x00000474
371#define VIVS_MC_PROFILE_CONFIG1_PA__MASK 0x0000000f 480#define VIVS_MC_PROFILE_CONFIG1_PA__MASK 0x000000ff
372#define VIVS_MC_PROFILE_CONFIG1_PA__SHIFT 0 481#define VIVS_MC_PROFILE_CONFIG1_PA__SHIFT 0
373#define VIVS_MC_PROFILE_CONFIG1_PA_INPUT_VTX_COUNTER 0x00000003 482#define VIVS_MC_PROFILE_CONFIG1_PA_INPUT_VTX_COUNTER 0x00000003
374#define VIVS_MC_PROFILE_CONFIG1_PA_INPUT_PRIM_COUNTER 0x00000004 483#define VIVS_MC_PROFILE_CONFIG1_PA_INPUT_PRIM_COUNTER 0x00000004
@@ -377,12 +486,12 @@ Copyright (C) 2016
377#define VIVS_MC_PROFILE_CONFIG1_PA_TRIVIAL_REJECTED_COUNTER 0x00000007 486#define VIVS_MC_PROFILE_CONFIG1_PA_TRIVIAL_REJECTED_COUNTER 0x00000007
378#define VIVS_MC_PROFILE_CONFIG1_PA_CULLED_COUNTER 0x00000008 487#define VIVS_MC_PROFILE_CONFIG1_PA_CULLED_COUNTER 0x00000008
379#define VIVS_MC_PROFILE_CONFIG1_PA_RESET 0x0000000f 488#define VIVS_MC_PROFILE_CONFIG1_PA_RESET 0x0000000f
380#define VIVS_MC_PROFILE_CONFIG1_SE__MASK 0x00000f00 489#define VIVS_MC_PROFILE_CONFIG1_SE__MASK 0x0000ff00
381#define VIVS_MC_PROFILE_CONFIG1_SE__SHIFT 8 490#define VIVS_MC_PROFILE_CONFIG1_SE__SHIFT 8
382#define VIVS_MC_PROFILE_CONFIG1_SE_CULLED_TRIANGLE_COUNT 0x00000000 491#define VIVS_MC_PROFILE_CONFIG1_SE_CULLED_TRIANGLE_COUNT 0x00000000
383#define VIVS_MC_PROFILE_CONFIG1_SE_CULLED_LINES_COUNT 0x00000100 492#define VIVS_MC_PROFILE_CONFIG1_SE_CULLED_LINES_COUNT 0x00000100
384#define VIVS_MC_PROFILE_CONFIG1_SE_RESET 0x00000f00 493#define VIVS_MC_PROFILE_CONFIG1_SE_RESET 0x00000f00
385#define VIVS_MC_PROFILE_CONFIG1_RA__MASK 0x000f0000 494#define VIVS_MC_PROFILE_CONFIG1_RA__MASK 0x00ff0000
386#define VIVS_MC_PROFILE_CONFIG1_RA__SHIFT 16 495#define VIVS_MC_PROFILE_CONFIG1_RA__SHIFT 16
387#define VIVS_MC_PROFILE_CONFIG1_RA_VALID_PIXEL_COUNT 0x00000000 496#define VIVS_MC_PROFILE_CONFIG1_RA_VALID_PIXEL_COUNT 0x00000000
388#define VIVS_MC_PROFILE_CONFIG1_RA_TOTAL_QUAD_COUNT 0x00010000 497#define VIVS_MC_PROFILE_CONFIG1_RA_TOTAL_QUAD_COUNT 0x00010000
@@ -392,7 +501,7 @@ Copyright (C) 2016
392#define VIVS_MC_PROFILE_CONFIG1_RA_PREFETCH_CACHE_MISS_COUNTER 0x000a0000 501#define VIVS_MC_PROFILE_CONFIG1_RA_PREFETCH_CACHE_MISS_COUNTER 0x000a0000
393#define VIVS_MC_PROFILE_CONFIG1_RA_CULLED_QUAD_COUNT 0x000b0000 502#define VIVS_MC_PROFILE_CONFIG1_RA_CULLED_QUAD_COUNT 0x000b0000
394#define VIVS_MC_PROFILE_CONFIG1_RA_RESET 0x000f0000 503#define VIVS_MC_PROFILE_CONFIG1_RA_RESET 0x000f0000
395#define VIVS_MC_PROFILE_CONFIG1_TX__MASK 0x0f000000 504#define VIVS_MC_PROFILE_CONFIG1_TX__MASK 0xff000000
396#define VIVS_MC_PROFILE_CONFIG1_TX__SHIFT 24 505#define VIVS_MC_PROFILE_CONFIG1_TX__SHIFT 24
397#define VIVS_MC_PROFILE_CONFIG1_TX_TOTAL_BILINEAR_REQUESTS 0x00000000 506#define VIVS_MC_PROFILE_CONFIG1_TX_TOTAL_BILINEAR_REQUESTS 0x00000000
398#define VIVS_MC_PROFILE_CONFIG1_TX_TOTAL_TRILINEAR_REQUESTS 0x01000000 507#define VIVS_MC_PROFILE_CONFIG1_TX_TOTAL_TRILINEAR_REQUESTS 0x01000000
@@ -407,18 +516,21 @@ Copyright (C) 2016
407#define VIVS_MC_PROFILE_CONFIG1_TX_RESET 0x0f000000 516#define VIVS_MC_PROFILE_CONFIG1_TX_RESET 0x0f000000
408 517
409#define VIVS_MC_PROFILE_CONFIG2 0x00000478 518#define VIVS_MC_PROFILE_CONFIG2 0x00000478
410#define VIVS_MC_PROFILE_CONFIG2_MC__MASK 0x0000000f 519#define VIVS_MC_PROFILE_CONFIG2_MC__MASK 0x000000ff
411#define VIVS_MC_PROFILE_CONFIG2_MC__SHIFT 0 520#define VIVS_MC_PROFILE_CONFIG2_MC__SHIFT 0
412#define VIVS_MC_PROFILE_CONFIG2_MC_TOTAL_READ_REQ_8B_FROM_PIPELINE 0x00000001 521#define VIVS_MC_PROFILE_CONFIG2_MC_TOTAL_READ_REQ_8B_FROM_PIPELINE 0x00000001
413#define VIVS_MC_PROFILE_CONFIG2_MC_TOTAL_READ_REQ_8B_FROM_IP 0x00000002 522#define VIVS_MC_PROFILE_CONFIG2_MC_TOTAL_READ_REQ_8B_FROM_IP 0x00000002
414#define VIVS_MC_PROFILE_CONFIG2_MC_TOTAL_WRITE_REQ_8B_FROM_PIPELINE 0x00000003 523#define VIVS_MC_PROFILE_CONFIG2_MC_TOTAL_WRITE_REQ_8B_FROM_PIPELINE 0x00000003
415#define VIVS_MC_PROFILE_CONFIG2_MC_RESET 0x0000000f 524#define VIVS_MC_PROFILE_CONFIG2_MC_RESET 0x0000000f
416#define VIVS_MC_PROFILE_CONFIG2_HI__MASK 0x00000f00 525#define VIVS_MC_PROFILE_CONFIG2_HI__MASK 0x0000ff00
417#define VIVS_MC_PROFILE_CONFIG2_HI__SHIFT 8 526#define VIVS_MC_PROFILE_CONFIG2_HI__SHIFT 8
418#define VIVS_MC_PROFILE_CONFIG2_HI_AXI_CYCLES_READ_REQUEST_STALLED 0x00000000 527#define VIVS_MC_PROFILE_CONFIG2_HI_AXI_CYCLES_READ_REQUEST_STALLED 0x00000000
419#define VIVS_MC_PROFILE_CONFIG2_HI_AXI_CYCLES_WRITE_REQUEST_STALLED 0x00000100 528#define VIVS_MC_PROFILE_CONFIG2_HI_AXI_CYCLES_WRITE_REQUEST_STALLED 0x00000100
420#define VIVS_MC_PROFILE_CONFIG2_HI_AXI_CYCLES_WRITE_DATA_STALLED 0x00000200 529#define VIVS_MC_PROFILE_CONFIG2_HI_AXI_CYCLES_WRITE_DATA_STALLED 0x00000200
421#define VIVS_MC_PROFILE_CONFIG2_HI_RESET 0x00000f00 530#define VIVS_MC_PROFILE_CONFIG2_HI_RESET 0x00000f00
531#define VIVS_MC_PROFILE_CONFIG2_BLT__MASK 0xff000000
532#define VIVS_MC_PROFILE_CONFIG2_BLT__SHIFT 24
533#define VIVS_MC_PROFILE_CONFIG2_BLT_UNK0 0x00000000
422 534
423#define VIVS_MC_PROFILE_CONFIG3 0x0000047c 535#define VIVS_MC_PROFILE_CONFIG3 0x0000047c
424 536
@@ -432,7 +544,13 @@ Copyright (C) 2016
432 544
433#define VIVS_MC_START_COMPOSITION 0x00000554 545#define VIVS_MC_START_COMPOSITION 0x00000554
434 546
435#define VIVS_MC_128B_MERGE 0x00000558 547#define VIVS_MC_FLAGS 0x00000558
548#define VIVS_MC_FLAGS_128B_MERGE 0x00000001
549#define VIVS_MC_FLAGS_TPCV11_COMPRESSION 0x08000000
550
551#define VIVS_MC_L2_CACHE_CONFIG 0x0000055c
552
553#define VIVS_MC_PROFILE_L2_READ 0x00000564
436 554
437 555
438#endif /* STATE_HI_XML */ 556#endif /* STATE_HI_XML */
diff --git a/include/uapi/drm/etnaviv_drm.h b/include/uapi/drm/etnaviv_drm.h
index e9b997a0ef27..0d5c49dc478c 100644
--- a/include/uapi/drm/etnaviv_drm.h
+++ b/include/uapi/drm/etnaviv_drm.h
@@ -55,6 +55,12 @@ struct drm_etnaviv_timespec {
55#define ETNAVIV_PARAM_GPU_FEATURES_4 0x07 55#define ETNAVIV_PARAM_GPU_FEATURES_4 0x07
56#define ETNAVIV_PARAM_GPU_FEATURES_5 0x08 56#define ETNAVIV_PARAM_GPU_FEATURES_5 0x08
57#define ETNAVIV_PARAM_GPU_FEATURES_6 0x09 57#define ETNAVIV_PARAM_GPU_FEATURES_6 0x09
58#define ETNAVIV_PARAM_GPU_FEATURES_7 0x0a
59#define ETNAVIV_PARAM_GPU_FEATURES_8 0x0b
60#define ETNAVIV_PARAM_GPU_FEATURES_9 0x0c
61#define ETNAVIV_PARAM_GPU_FEATURES_10 0x0d
62#define ETNAVIV_PARAM_GPU_FEATURES_11 0x0e
63#define ETNAVIV_PARAM_GPU_FEATURES_12 0x0f
58 64
59#define ETNAVIV_PARAM_GPU_STREAM_COUNT 0x10 65#define ETNAVIV_PARAM_GPU_STREAM_COUNT 0x10
60#define ETNAVIV_PARAM_GPU_REGISTER_MAX 0x11 66#define ETNAVIV_PARAM_GPU_REGISTER_MAX 0x11