aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2017-06-28 03:08:12 -0400
committerDave Airlie <airlied@redhat.com>2017-06-28 03:08:12 -0400
commit8cd373707bc1903869573f577f7d39f9cee9c7ad (patch)
tree23b9bc8257c669ce985e1918a78d45a51017398b
parent6d61e70ccc21606ffb8a0a03bd3aba24f659502b (diff)
parent46a269da7e8a1ab6510ea5c88b2732925e5efc79 (diff)
Merge branch 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux into drm-next
- a fix from Eric for synchronization with etnaviv exported dma-bufs - thermal throttle support for newer GPU cores - updated module clock gating to work around GPU errata - a fix to restore userspace buffer cache performance * 'etnaviv/next' of https://git.pengutronix.de/git/lst/linux: drm/etnaviv: restore ETNA_PREP_NOSYNC behaviour drm/etnaviv: implement cooling support for new GPU cores drm/etnaviv: update MLCG disables with info from newer Vivante driver drm/etnaviv: update common.xml.h drm/etnaviv: Expose our reservation object when exporting a dmabuf.
-rw-r--r--drivers/gpu/drm/etnaviv/common.xml.h150
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_drv.c1
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_drv.h1
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem.c24
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c7
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.c30
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_gpu.h2
7 files changed, 136 insertions, 79 deletions
diff --git a/drivers/gpu/drm/etnaviv/common.xml.h b/drivers/gpu/drm/etnaviv/common.xml.h
index e881482b5971..207f45c999c3 100644
--- a/drivers/gpu/drm/etnaviv/common.xml.h
+++ b/drivers/gpu/drm/etnaviv/common.xml.h
@@ -8,10 +8,38 @@ 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_hi.xml ( 24309 bytes, from 2015-12-12 09:02:53) 11- state.xml ( 19930 bytes, from 2017-03-09 15:43:43)
12- common.xml ( 18379 bytes, from 2015-12-12 09:02:53) 12- common.xml ( 23473 bytes, from 2017-03-09 15:43:43)
13- state_hi.xml ( 26403 bytes, from 2017-03-09 15:43:43)
14- copyright.xml ( 1597 bytes, from 2016-12-08 16:37:56)
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)
13 18
14Copyright (C) 2015 19Copyright (C) 2012-2017 by the following authors:
20- Wladimir J. van der Laan <laanwj@gmail.com>
21- Christian Gmeiner <christian.gmeiner@gmail.com>
22- Lucas Stach <l.stach@pengutronix.de>
23- Russell King <rmk@arm.linux.org.uk>
24
25Permission is hereby granted, free of charge, to any person obtaining a
26copy of this software and associated documentation files (the "Software"),
27to deal in the Software without restriction, including without limitation
28the rights to use, copy, modify, merge, publish, distribute, sub license,
29and/or sell copies of the Software, and to permit persons to whom the
30Software is furnished to do so, subject to the following conditions:
31
32The above copyright notice and this permission notice (including the
33next paragraph) shall be included in all copies or substantial portions
34of the Software.
35
36THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
37IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
38FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
39THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
40LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
41FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
42DEALINGS IN THE SOFTWARE.
15*/ 43*/
16 44
17 45
@@ -162,129 +190,129 @@ Copyright (C) 2015
162#define chipMinorFeatures1_FC_FLUSH_STALL 0x80000000 190#define chipMinorFeatures1_FC_FLUSH_STALL 0x80000000
163#define chipMinorFeatures2_LINE_LOOP 0x00000001 191#define chipMinorFeatures2_LINE_LOOP 0x00000001
164#define chipMinorFeatures2_LOGIC_OP 0x00000002 192#define chipMinorFeatures2_LOGIC_OP 0x00000002
165#define chipMinorFeatures2_UNK2 0x00000004 193#define chipMinorFeatures2_SEAMLESS_CUBE_MAP 0x00000004
166#define chipMinorFeatures2_SUPERTILED_TEXTURE 0x00000008 194#define chipMinorFeatures2_SUPERTILED_TEXTURE 0x00000008
167#define chipMinorFeatures2_UNK4 0x00000010 195#define chipMinorFeatures2_LINEAR_PE 0x00000010
168#define chipMinorFeatures2_RECT_PRIMITIVE 0x00000020 196#define chipMinorFeatures2_RECT_PRIMITIVE 0x00000020
169#define chipMinorFeatures2_COMPOSITION 0x00000040 197#define chipMinorFeatures2_COMPOSITION 0x00000040
170#define chipMinorFeatures2_CORRECT_AUTO_DISABLE_COUNT 0x00000080 198#define chipMinorFeatures2_CORRECT_AUTO_DISABLE_COUNT 0x00000080
171#define chipMinorFeatures2_UNK8 0x00000100 199#define chipMinorFeatures2_PE_SWIZZLE 0x00000100
172#define chipMinorFeatures2_UNK9 0x00000200 200#define chipMinorFeatures2_END_EVENT 0x00000200
173#define chipMinorFeatures2_UNK10 0x00000400 201#define chipMinorFeatures2_S1S8 0x00000400
174#define chipMinorFeatures2_HALTI1 0x00000800 202#define chipMinorFeatures2_HALTI1 0x00000800
175#define chipMinorFeatures2_UNK12 0x00001000 203#define chipMinorFeatures2_RGB888 0x00001000
176#define chipMinorFeatures2_UNK13 0x00002000 204#define chipMinorFeatures2_TX__YUV_ASSEMBLER 0x00002000
177#define chipMinorFeatures2_UNK14 0x00004000 205#define chipMinorFeatures2_DYNAMIC_FREQUENCY_SCALING 0x00004000
178#define chipMinorFeatures2_EXTRA_TEXTURE_STATE 0x00008000 206#define chipMinorFeatures2_EXTRA_TEXTURE_STATE 0x00008000
179#define chipMinorFeatures2_FULL_DIRECTFB 0x00010000 207#define chipMinorFeatures2_FULL_DIRECTFB 0x00010000
180#define chipMinorFeatures2_2D_TILING 0x00020000 208#define chipMinorFeatures2_2D_TILING 0x00020000
181#define chipMinorFeatures2_THREAD_WALKER_IN_PS 0x00040000 209#define chipMinorFeatures2_THREAD_WALKER_IN_PS 0x00040000
182#define chipMinorFeatures2_TILE_FILLER 0x00080000 210#define chipMinorFeatures2_TILE_FILLER 0x00080000
183#define chipMinorFeatures2_UNK20 0x00100000 211#define chipMinorFeatures2_YUV_STANDARD 0x00100000
184#define chipMinorFeatures2_2D_MULTI_SOURCE_BLIT 0x00200000 212#define chipMinorFeatures2_2D_MULTI_SOURCE_BLIT 0x00200000
185#define chipMinorFeatures2_UNK22 0x00400000 213#define chipMinorFeatures2_YUV_CONVERSION 0x00400000
186#define chipMinorFeatures2_UNK23 0x00800000 214#define chipMinorFeatures2_FLUSH_FIXED_2D 0x00800000
187#define chipMinorFeatures2_UNK24 0x01000000 215#define chipMinorFeatures2_INTERLEAVER 0x01000000
188#define chipMinorFeatures2_MIXED_STREAMS 0x02000000 216#define chipMinorFeatures2_MIXED_STREAMS 0x02000000
189#define chipMinorFeatures2_2D_420_L2CACHE 0x04000000 217#define chipMinorFeatures2_2D_420_L2CACHE 0x04000000
190#define chipMinorFeatures2_UNK27 0x08000000 218#define chipMinorFeatures2_BUG_FIXES7 0x08000000
191#define chipMinorFeatures2_2D_NO_INDEX8_BRUSH 0x10000000 219#define chipMinorFeatures2_2D_NO_INDEX8_BRUSH 0x10000000
192#define chipMinorFeatures2_TEXTURE_TILED_READ 0x20000000 220#define chipMinorFeatures2_TEXTURE_TILED_READ 0x20000000
193#define chipMinorFeatures2_UNK30 0x40000000 221#define chipMinorFeatures2_DECOMPRESS_Z16 0x40000000
194#define chipMinorFeatures2_UNK31 0x80000000 222#define chipMinorFeatures2_BUG_FIXES8 0x80000000
195#define chipMinorFeatures3_ROTATION_STALL_FIX 0x00000001 223#define chipMinorFeatures3_ROTATION_STALL_FIX 0x00000001
196#define chipMinorFeatures3_UNK1 0x00000002 224#define chipMinorFeatures3_OCL_ONLY 0x00000002
197#define chipMinorFeatures3_2D_MULTI_SOURCE_BLT_EX 0x00000004 225#define chipMinorFeatures3_2D_MULTI_SOURCE_BLT_EX 0x00000004
198#define chipMinorFeatures3_UNK3 0x00000008 226#define chipMinorFeatures3_INSTRUCTION_CACHE 0x00000008
199#define chipMinorFeatures3_UNK4 0x00000010 227#define chipMinorFeatures3_GEOMETRY_SHADER 0x00000010
200#define chipMinorFeatures3_UNK5 0x00000020 228#define chipMinorFeatures3_TEX_COMPRESSION_SUPERTILED 0x00000020
201#define chipMinorFeatures3_UNK6 0x00000040 229#define chipMinorFeatures3_GENERICS 0x00000040
202#define chipMinorFeatures3_UNK7 0x00000080 230#define chipMinorFeatures3_BUG_FIXES9 0x00000080
203#define chipMinorFeatures3_FAST_MSAA 0x00000100 231#define chipMinorFeatures3_FAST_MSAA 0x00000100
204#define chipMinorFeatures3_UNK9 0x00000200 232#define chipMinorFeatures3_WCLIP 0x00000200
205#define chipMinorFeatures3_BUG_FIXES10 0x00000400 233#define chipMinorFeatures3_BUG_FIXES10 0x00000400
206#define chipMinorFeatures3_UNK11 0x00000800 234#define chipMinorFeatures3_UNIFIED_SAMPLERS 0x00000800
207#define chipMinorFeatures3_BUG_FIXES11 0x00001000 235#define chipMinorFeatures3_BUG_FIXES11 0x00001000
208#define chipMinorFeatures3_UNK13 0x00002000 236#define chipMinorFeatures3_PERFORMANCE_COUNTERS 0x00002000
209#define chipMinorFeatures3_UNK14 0x00004000 237#define chipMinorFeatures3_HAS_FAST_TRANSCENDENTALS 0x00004000
210#define chipMinorFeatures3_UNK15 0x00008000 238#define chipMinorFeatures3_BUG_FIXES12 0x00008000
211#define chipMinorFeatures3_UNK16 0x00010000 239#define chipMinorFeatures3_BUG_FIXES13 0x00010000
212#define chipMinorFeatures3_UNK17 0x00020000 240#define chipMinorFeatures3_DE_ENHANCEMENTS1 0x00020000
213#define chipMinorFeatures3_ACE 0x00040000 241#define chipMinorFeatures3_ACE 0x00040000
214#define chipMinorFeatures3_UNK19 0x00080000 242#define chipMinorFeatures3_TX_ENHANCEMENTS1 0x00080000
215#define chipMinorFeatures3_UNK20 0x00100000 243#define chipMinorFeatures3_SH_ENHANCEMENTS1 0x00100000
216#define chipMinorFeatures3_UNK21 0x00200000 244#define chipMinorFeatures3_SH_ENHANCEMENTS2 0x00200000
217#define chipMinorFeatures3_UNK22 0x00400000 245#define chipMinorFeatures3_UNK22 0x00400000
218#define chipMinorFeatures3_UNK23 0x00800000 246#define chipMinorFeatures3_2D_FC_SOURCE 0x00800000
219#define chipMinorFeatures3_UNK24 0x01000000 247#define chipMinorFeatures3_UNK24 0x01000000
220#define chipMinorFeatures3_UNK25 0x02000000 248#define chipMinorFeatures3_UNK25 0x02000000
221#define chipMinorFeatures3_NEW_HZ 0x04000000 249#define chipMinorFeatures3_NEW_HZ 0x04000000
222#define chipMinorFeatures3_UNK27 0x08000000 250#define chipMinorFeatures3_UNK27 0x08000000
223#define chipMinorFeatures3_UNK28 0x10000000 251#define chipMinorFeatures3_UNK28 0x10000000
224#define chipMinorFeatures3_UNK29 0x20000000 252#define chipMinorFeatures3_SH_ENHANCEMENTS3 0x20000000
225#define chipMinorFeatures3_UNK30 0x40000000 253#define chipMinorFeatures3_UNK30 0x40000000
226#define chipMinorFeatures3_UNK31 0x80000000 254#define chipMinorFeatures3_UNK31 0x80000000
227#define chipMinorFeatures4_UNK0 0x00000001 255#define chipMinorFeatures4_UNK0 0x00000001
228#define chipMinorFeatures4_UNK1 0x00000002 256#define chipMinorFeatures4_PE_ENHANCEMENTS2 0x00000002
229#define chipMinorFeatures4_UNK2 0x00000004 257#define chipMinorFeatures4_FRUSTUM_CLIP_FIX 0x00000004
230#define chipMinorFeatures4_UNK3 0x00000008 258#define chipMinorFeatures4_UNK3 0x00000008
231#define chipMinorFeatures4_UNK4 0x00000010 259#define chipMinorFeatures4_UNK4 0x00000010
232#define chipMinorFeatures4_UNK5 0x00000020 260#define chipMinorFeatures4_2D_GAMMA 0x00000020
233#define chipMinorFeatures4_UNK6 0x00000040 261#define chipMinorFeatures4_SINGLE_BUFFER 0x00000040
234#define chipMinorFeatures4_UNK7 0x00000080 262#define chipMinorFeatures4_UNK7 0x00000080
235#define chipMinorFeatures4_UNK8 0x00000100 263#define chipMinorFeatures4_UNK8 0x00000100
236#define chipMinorFeatures4_UNK9 0x00000200 264#define chipMinorFeatures4_UNK9 0x00000200
237#define chipMinorFeatures4_UNK10 0x00000400 265#define chipMinorFeatures4_UNK10 0x00000400
238#define chipMinorFeatures4_UNK11 0x00000800 266#define chipMinorFeatures4_TX_LERP_PRECISION_FIX 0x00000800
239#define chipMinorFeatures4_UNK12 0x00001000 267#define chipMinorFeatures4_2D_COLOR_SPACE_CONVERSION 0x00001000
240#define chipMinorFeatures4_UNK13 0x00002000 268#define chipMinorFeatures4_TEXTURE_ASTC 0x00002000
241#define chipMinorFeatures4_UNK14 0x00004000 269#define chipMinorFeatures4_UNK14 0x00004000
242#define chipMinorFeatures4_UNK15 0x00008000 270#define chipMinorFeatures4_UNK15 0x00008000
243#define chipMinorFeatures4_HALTI2 0x00010000 271#define chipMinorFeatures4_HALTI2 0x00010000
244#define chipMinorFeatures4_UNK17 0x00020000 272#define chipMinorFeatures4_UNK17 0x00020000
245#define chipMinorFeatures4_SMALL_MSAA 0x00040000 273#define chipMinorFeatures4_SMALL_MSAA 0x00040000
246#define chipMinorFeatures4_UNK19 0x00080000 274#define chipMinorFeatures4_UNK19 0x00080000
247#define chipMinorFeatures4_UNK20 0x00100000 275#define chipMinorFeatures4_NEW_RA 0x00100000
248#define chipMinorFeatures4_UNK21 0x00200000 276#define chipMinorFeatures4_2D_OPF_YUV_OUTPUT 0x00200000
249#define chipMinorFeatures4_UNK22 0x00400000 277#define chipMinorFeatures4_2D_MULTI_SOURCE_BLT_EX2 0x00400000
250#define chipMinorFeatures4_UNK23 0x00800000 278#define chipMinorFeatures4_NO_USER_CSC 0x00800000
251#define chipMinorFeatures4_UNK24 0x01000000 279#define chipMinorFeatures4_ZFIXES 0x01000000
252#define chipMinorFeatures4_UNK25 0x02000000 280#define chipMinorFeatures4_BUG_FIXES18 0x02000000
253#define chipMinorFeatures4_UNK26 0x04000000 281#define chipMinorFeatures4_2D_COMPRESSION 0x04000000
254#define chipMinorFeatures4_UNK27 0x08000000 282#define chipMinorFeatures4_PROBE 0x08000000
255#define chipMinorFeatures4_UNK28 0x10000000 283#define chipMinorFeatures4_UNK28 0x10000000
256#define chipMinorFeatures4_UNK29 0x20000000 284#define chipMinorFeatures4_2D_SUPER_TILE_VERSION 0x20000000
257#define chipMinorFeatures4_UNK30 0x40000000 285#define chipMinorFeatures4_UNK30 0x40000000
258#define chipMinorFeatures4_UNK31 0x80000000 286#define chipMinorFeatures4_UNK31 0x80000000
259#define chipMinorFeatures5_UNK0 0x00000001 287#define chipMinorFeatures5_UNK0 0x00000001
260#define chipMinorFeatures5_UNK1 0x00000002 288#define chipMinorFeatures5_UNK1 0x00000002
261#define chipMinorFeatures5_UNK2 0x00000004 289#define chipMinorFeatures5_UNK2 0x00000004
262#define chipMinorFeatures5_UNK3 0x00000008 290#define chipMinorFeatures5_UNK3 0x00000008
263#define chipMinorFeatures5_UNK4 0x00000010 291#define chipMinorFeatures5_EEZ 0x00000010
264#define chipMinorFeatures5_UNK5 0x00000020 292#define chipMinorFeatures5_UNK5 0x00000020
265#define chipMinorFeatures5_UNK6 0x00000040 293#define chipMinorFeatures5_UNK6 0x00000040
266#define chipMinorFeatures5_UNK7 0x00000080 294#define chipMinorFeatures5_UNK7 0x00000080
267#define chipMinorFeatures5_UNK8 0x00000100 295#define chipMinorFeatures5_UNK8 0x00000100
268#define chipMinorFeatures5_HALTI3 0x00000200 296#define chipMinorFeatures5_HALTI3 0x00000200
269#define chipMinorFeatures5_UNK10 0x00000400 297#define chipMinorFeatures5_UNK10 0x00000400
270#define chipMinorFeatures5_UNK11 0x00000800 298#define chipMinorFeatures5_2D_ONE_PASS_FILTER_TAP 0x00000800
271#define chipMinorFeatures5_UNK12 0x00001000 299#define chipMinorFeatures5_UNK12 0x00001000
272#define chipMinorFeatures5_UNK13 0x00002000 300#define chipMinorFeatures5_SEPARATE_SRC_DST 0x00002000
273#define chipMinorFeatures5_UNK14 0x00004000 301#define chipMinorFeatures5_HALTI4 0x00004000
274#define chipMinorFeatures5_UNK15 0x00008000 302#define chipMinorFeatures5_UNK15 0x00008000
275#define chipMinorFeatures5_UNK16 0x00010000 303#define chipMinorFeatures5_ANDROID_ONLY 0x00010000
276#define chipMinorFeatures5_UNK17 0x00020000 304#define chipMinorFeatures5_HAS_PRODUCTID 0x00020000
277#define chipMinorFeatures5_UNK18 0x00040000 305#define chipMinorFeatures5_UNK18 0x00040000
278#define chipMinorFeatures5_UNK19 0x00080000 306#define chipMinorFeatures5_UNK19 0x00080000
279#define chipMinorFeatures5_UNK20 0x00100000 307#define chipMinorFeatures5_PE_DITHER_FIX2 0x00100000
280#define chipMinorFeatures5_UNK21 0x00200000 308#define chipMinorFeatures5_UNK21 0x00200000
281#define chipMinorFeatures5_UNK22 0x00400000 309#define chipMinorFeatures5_UNK22 0x00400000
282#define chipMinorFeatures5_UNK23 0x00800000 310#define chipMinorFeatures5_UNK23 0x00800000
283#define chipMinorFeatures5_UNK24 0x01000000 311#define chipMinorFeatures5_UNK24 0x01000000
284#define chipMinorFeatures5_UNK25 0x02000000 312#define chipMinorFeatures5_UNK25 0x02000000
285#define chipMinorFeatures5_UNK26 0x04000000 313#define chipMinorFeatures5_UNK26 0x04000000
286#define chipMinorFeatures5_UNK27 0x08000000 314#define chipMinorFeatures5_RS_DEPTHSTENCIL_NATIVE_SUPPORT 0x08000000
287#define chipMinorFeatures5_UNK28 0x10000000 315#define chipMinorFeatures5_V2_MSAA_COMP_FIX 0x10000000
288#define chipMinorFeatures5_UNK29 0x20000000 316#define chipMinorFeatures5_UNK29 0x20000000
289#define chipMinorFeatures5_UNK30 0x40000000 317#define chipMinorFeatures5_UNK30 0x40000000
290#define chipMinorFeatures5_UNK31 0x80000000 318#define chipMinorFeatures5_UNK31 0x80000000
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index 5255278dde56..91e17aeee1da 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -495,6 +495,7 @@ static struct drm_driver etnaviv_drm_driver = {
495 .prime_fd_to_handle = drm_gem_prime_fd_to_handle, 495 .prime_fd_to_handle = drm_gem_prime_fd_to_handle,
496 .gem_prime_export = drm_gem_prime_export, 496 .gem_prime_export = drm_gem_prime_export,
497 .gem_prime_import = drm_gem_prime_import, 497 .gem_prime_import = drm_gem_prime_import,
498 .gem_prime_res_obj = etnaviv_gem_prime_res_obj,
498 .gem_prime_pin = etnaviv_gem_prime_pin, 499 .gem_prime_pin = etnaviv_gem_prime_pin,
499 .gem_prime_unpin = etnaviv_gem_prime_unpin, 500 .gem_prime_unpin = etnaviv_gem_prime_unpin,
500 .gem_prime_get_sg_table = etnaviv_gem_prime_get_sg_table, 501 .gem_prime_get_sg_table = etnaviv_gem_prime_get_sg_table,
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.h b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
index e41f38667c1c..058389f93b69 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.h
@@ -80,6 +80,7 @@ void *etnaviv_gem_prime_vmap(struct drm_gem_object *obj);
80void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr); 80void etnaviv_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
81int etnaviv_gem_prime_mmap(struct drm_gem_object *obj, 81int etnaviv_gem_prime_mmap(struct drm_gem_object *obj,
82 struct vm_area_struct *vma); 82 struct vm_area_struct *vma);
83struct reservation_object *etnaviv_gem_prime_res_obj(struct drm_gem_object *obj);
83struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev, 84struct drm_gem_object *etnaviv_gem_prime_import_sg_table(struct drm_device *dev,
84 struct dma_buf_attachment *attach, struct sg_table *sg); 85 struct dma_buf_attachment *attach, struct sg_table *sg);
85int etnaviv_gem_prime_pin(struct drm_gem_object *obj); 86int etnaviv_gem_prime_pin(struct drm_gem_object *obj);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem.c b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
index d6fb724fc3cc..9a3bea738330 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem.c
@@ -411,16 +411,20 @@ int etnaviv_gem_cpu_prep(struct drm_gem_object *obj, u32 op,
411 struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj); 411 struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
412 struct drm_device *dev = obj->dev; 412 struct drm_device *dev = obj->dev;
413 bool write = !!(op & ETNA_PREP_WRITE); 413 bool write = !!(op & ETNA_PREP_WRITE);
414 unsigned long remain = 414 int ret;
415 op & ETNA_PREP_NOSYNC ? 0 : etnaviv_timeout_to_jiffies(timeout); 415
416 long lret; 416 if (op & ETNA_PREP_NOSYNC) {
417 417 if (!reservation_object_test_signaled_rcu(etnaviv_obj->resv,
418 lret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv, 418 write))
419 write, true, remain); 419 return -EBUSY;
420 if (lret < 0) 420 } else {
421 return lret; 421 unsigned long remain = etnaviv_timeout_to_jiffies(timeout);
422 else if (lret == 0) 422
423 return remain == 0 ? -EBUSY : -ETIMEDOUT; 423 ret = reservation_object_wait_timeout_rcu(etnaviv_obj->resv,
424 write, true, remain);
425 if (ret <= 0)
426 return ret == 0 ? -ETIMEDOUT : ret;
427 }
424 428
425 if (etnaviv_obj->flags & ETNA_BO_CACHED) { 429 if (etnaviv_obj->flags & ETNA_BO_CACHED) {
426 if (!etnaviv_obj->sgt) { 430 if (!etnaviv_obj->sgt) {
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
index 367bf952f61a..e5da4f2300ba 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_prime.c
@@ -150,3 +150,10 @@ fail:
150 150
151 return ERR_PTR(ret); 151 return ERR_PTR(ret);
152} 152}
153
154struct reservation_object *etnaviv_gem_prime_res_obj(struct drm_gem_object *obj)
155{
156 struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
157
158 return etnaviv_obj->resv;
159}
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 9a9c40717801..ada45fdd0eae 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -412,13 +412,19 @@ static void etnaviv_gpu_load_clock(struct etnaviv_gpu *gpu, u32 clock)
412 412
413static void etnaviv_gpu_update_clock(struct etnaviv_gpu *gpu) 413static void etnaviv_gpu_update_clock(struct etnaviv_gpu *gpu)
414{ 414{
415 unsigned int fscale = 1 << (6 - gpu->freq_scale); 415 if (gpu->identity.minor_features2 &
416 u32 clock; 416 chipMinorFeatures2_DYNAMIC_FREQUENCY_SCALING) {
417 417 clk_set_rate(gpu->clk_core,
418 clock = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS | 418 gpu->base_rate_core >> gpu->freq_scale);
419 VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale); 419 clk_set_rate(gpu->clk_shader,
420 gpu->base_rate_shader >> gpu->freq_scale);
421 } else {
422 unsigned int fscale = 1 << (6 - gpu->freq_scale);
423 u32 clock = VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS |
424 VIVS_HI_CLOCK_CONTROL_FSCALE_VAL(fscale);
420 425
421 etnaviv_gpu_load_clock(gpu, clock); 426 etnaviv_gpu_load_clock(gpu, clock);
427 }
422} 428}
423 429
424static int etnaviv_hw_reset(struct etnaviv_gpu *gpu) 430static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
@@ -523,9 +529,10 @@ static void etnaviv_gpu_enable_mlcg(struct etnaviv_gpu *gpu)
523 529
524 pmc = gpu_read(gpu, VIVS_PM_MODULE_CONTROLS); 530 pmc = gpu_read(gpu, VIVS_PM_MODULE_CONTROLS);
525 531
526 /* Disable PA clock gating for GC400+ except for GC420 */ 532 /* Disable PA clock gating for GC400+ without bugfix except for GC420 */
527 if (gpu->identity.model >= chipModel_GC400 && 533 if (gpu->identity.model >= chipModel_GC400 &&
528 gpu->identity.model != chipModel_GC420) 534 gpu->identity.model != chipModel_GC420 &&
535 !(gpu->identity.minor_features3 & chipMinorFeatures3_BUG_FIXES12))
529 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_PA; 536 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_PA;
530 537
531 /* 538 /*
@@ -541,6 +548,11 @@ static void etnaviv_gpu_enable_mlcg(struct etnaviv_gpu *gpu)
541 if (gpu->identity.revision < 0x5422) 548 if (gpu->identity.revision < 0x5422)
542 pmc |= BIT(15); /* Unknown bit */ 549 pmc |= BIT(15); /* Unknown bit */
543 550
551 /* Disable TX clock gating on affected core revisions. */
552 if (etnaviv_is_model_rev(gpu, GC4000, 0x5222) ||
553 etnaviv_is_model_rev(gpu, GC2000, 0x5108))
554 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_TX;
555
544 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_HZ; 556 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_HZ;
545 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_EZ; 557 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_EZ;
546 558
@@ -1736,11 +1748,13 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
1736 DBG("clk_core: %p", gpu->clk_core); 1748 DBG("clk_core: %p", gpu->clk_core);
1737 if (IS_ERR(gpu->clk_core)) 1749 if (IS_ERR(gpu->clk_core))
1738 gpu->clk_core = NULL; 1750 gpu->clk_core = NULL;
1751 gpu->base_rate_core = clk_get_rate(gpu->clk_core);
1739 1752
1740 gpu->clk_shader = devm_clk_get(&pdev->dev, "shader"); 1753 gpu->clk_shader = devm_clk_get(&pdev->dev, "shader");
1741 DBG("clk_shader: %p", gpu->clk_shader); 1754 DBG("clk_shader: %p", gpu->clk_shader);
1742 if (IS_ERR(gpu->clk_shader)) 1755 if (IS_ERR(gpu->clk_shader))
1743 gpu->clk_shader = NULL; 1756 gpu->clk_shader = NULL;
1757 gpu->base_rate_shader = clk_get_rate(gpu->clk_shader);
1744 1758
1745 /* TODO: figure out max mapped size */ 1759 /* TODO: figure out max mapped size */
1746 dev_set_drvdata(dev, gpu); 1760 dev_set_drvdata(dev, gpu);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
index 9227a9740447..689cb8f3680c 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.h
@@ -152,6 +152,8 @@ struct etnaviv_gpu {
152 u32 hangcheck_dma_addr; 152 u32 hangcheck_dma_addr;
153 struct work_struct recover_work; 153 struct work_struct recover_work;
154 unsigned int freq_scale; 154 unsigned int freq_scale;
155 unsigned long base_rate_core;
156 unsigned long base_rate_shader;
155}; 157};
156 158
157static inline void gpu_write(struct etnaviv_gpu *gpu, u32 reg, u32 data) 159static inline void gpu_write(struct etnaviv_gpu *gpu, u32 reg, u32 data)