@@ -172,10 +172,12 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
172
172
return 0 ;
173
173
}
174
174
175
+ static inline bool etnaviv_is_model_rev (struct etnaviv_gpu * gpu , u32 model , u32 revision )
176
+ {
177
+ return gpu -> identity .model == model &&
178
+ gpu -> identity .revision == revision ;
179
+ }
175
180
176
- #define etnaviv_is_model_rev (gpu , mod , rev ) \
177
- ((gpu)->identity.model == chipModel_##mod && \
178
- (gpu)->identity.revision == rev)
179
181
#define etnaviv_field (val , field ) \
180
182
(((val) & field##__MASK) >> field##__SHIFT)
181
183
@@ -281,7 +283,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
281
283
282
284
switch (gpu -> identity .instruction_count ) {
283
285
case 0 :
284
- if (etnaviv_is_model_rev (gpu , GC2000 , 0x5108 ) ||
286
+ if (etnaviv_is_model_rev (gpu , 0x2000 , 0x5108 ) ||
285
287
gpu -> identity .model == chipModel_GC880 )
286
288
gpu -> identity .instruction_count = 512 ;
287
289
else
@@ -315,17 +317,17 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
315
317
* For some cores, two varyings are consumed for position, so the
316
318
* maximum varying count needs to be reduced by one.
317
319
*/
318
- if (etnaviv_is_model_rev (gpu , GC5000 , 0x5434 ) ||
319
- etnaviv_is_model_rev (gpu , GC4000 , 0x5222 ) ||
320
- etnaviv_is_model_rev (gpu , GC4000 , 0x5245 ) ||
321
- etnaviv_is_model_rev (gpu , GC4000 , 0x5208 ) ||
322
- etnaviv_is_model_rev (gpu , GC3000 , 0x5435 ) ||
323
- etnaviv_is_model_rev (gpu , GC2200 , 0x5244 ) ||
324
- etnaviv_is_model_rev (gpu , GC2100 , 0x5108 ) ||
325
- etnaviv_is_model_rev (gpu , GC2000 , 0x5108 ) ||
326
- etnaviv_is_model_rev (gpu , GC1500 , 0x5246 ) ||
327
- etnaviv_is_model_rev (gpu , GC880 , 0x5107 ) ||
328
- etnaviv_is_model_rev (gpu , GC880 , 0x5106 ))
320
+ if (etnaviv_is_model_rev (gpu , 0x5000 , 0x5434 ) ||
321
+ etnaviv_is_model_rev (gpu , 0x4000 , 0x5222 ) ||
322
+ etnaviv_is_model_rev (gpu , 0x4000 , 0x5245 ) ||
323
+ etnaviv_is_model_rev (gpu , 0x4000 , 0x5208 ) ||
324
+ etnaviv_is_model_rev (gpu , 0x3000 , 0x5435 ) ||
325
+ etnaviv_is_model_rev (gpu , 0x2200 , 0x5244 ) ||
326
+ etnaviv_is_model_rev (gpu , 0x2100 , 0x5108 ) ||
327
+ etnaviv_is_model_rev (gpu , 0x2000 , 0x5108 ) ||
328
+ etnaviv_is_model_rev (gpu , 0x1500 , 0x5246 ) ||
329
+ etnaviv_is_model_rev (gpu , 0x880 , 0x5107 ) ||
330
+ etnaviv_is_model_rev (gpu , 0x880 , 0x5106 ))
329
331
gpu -> identity .varyings_count -= 1 ;
330
332
}
331
333
@@ -351,7 +353,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
351
353
* Reading these two registers on GC600 rev 0x19 result in a
352
354
* unhandled fault: external abort on non-linefetch
353
355
*/
354
- if (!etnaviv_is_model_rev (gpu , GC600 , 0x19 )) {
356
+ if (!etnaviv_is_model_rev (gpu , 0x600 , 0x19 )) {
355
357
gpu -> identity .product_id = gpu_read (gpu , VIVS_HI_CHIP_PRODUCT_ID );
356
358
gpu -> identity .eco_id = gpu_read (gpu , VIVS_HI_CHIP_ECO_ID );
357
359
}
@@ -368,7 +370,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
368
370
}
369
371
370
372
/* Another special case */
371
- if (etnaviv_is_model_rev (gpu , GC300 , 0x2201 )) {
373
+ if (etnaviv_is_model_rev (gpu , 0x300 , 0x2201 )) {
372
374
u32 chipTime = gpu_read (gpu , VIVS_HI_CHIP_TIME );
373
375
374
376
if (chipDate == 0x20080814 && chipTime == 0x12051100 ) {
@@ -387,15 +389,15 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
387
389
* Fix model/rev here, so all other places can refer to this
388
390
* core by its real identity.
389
391
*/
390
- if (etnaviv_is_model_rev (gpu , GC2000 , 0xffff5450 )) {
392
+ if (etnaviv_is_model_rev (gpu , 0x2000 , 0xffff5450 )) {
391
393
gpu -> identity .model = chipModel_GC3000 ;
392
394
gpu -> identity .revision &= 0xffff ;
393
395
}
394
396
395
- if (etnaviv_is_model_rev (gpu , GC1000 , 0x5037 ) && (chipDate == 0x20120617 ))
397
+ if (etnaviv_is_model_rev (gpu , 0x1000 , 0x5037 ) && (chipDate == 0x20120617 ))
396
398
gpu -> identity .eco_id = 1 ;
397
399
398
- if (etnaviv_is_model_rev (gpu , GC320 , 0x5303 ) && (chipDate == 0x20140511 ))
400
+ if (etnaviv_is_model_rev (gpu , 0x320 , 0x5303 ) && (chipDate == 0x20140511 ))
399
401
gpu -> identity .eco_id = 1 ;
400
402
}
401
403
@@ -641,17 +643,23 @@ static void etnaviv_gpu_enable_mlcg(struct etnaviv_gpu *gpu)
641
643
pmc |= BIT (15 ); /* Unknown bit */
642
644
643
645
/* Disable TX clock gating on affected core revisions. */
644
- if (etnaviv_is_model_rev (gpu , GC4000 , 0x5222 ) ||
645
- etnaviv_is_model_rev (gpu , GC2000 , 0x5108 ) ||
646
- etnaviv_is_model_rev (gpu , GC7000 , 0x6202 ) ||
647
- etnaviv_is_model_rev (gpu , GC7000 , 0x6203 ))
646
+ if (etnaviv_is_model_rev (gpu , 0x4000 , 0x5222 ) ||
647
+ etnaviv_is_model_rev (gpu , 0x2000 , 0x5108 ) ||
648
+ etnaviv_is_model_rev (gpu , 0x7000 , 0x6202 ) ||
649
+ etnaviv_is_model_rev (gpu , 0x7000 , 0x6203 ))
648
650
pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_TX ;
649
651
650
652
/* Disable SE and RA clock gating on affected core revisions. */
651
- if (etnaviv_is_model_rev (gpu , GC7000 , 0x6202 ))
653
+ if (etnaviv_is_model_rev (gpu , 0x7000 , 0x6202 ))
652
654
pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_SE |
653
655
VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA ;
654
656
657
+ /* Disable SH_EU clock gating on affected core revisions. */
658
+ if (etnaviv_is_model_rev (gpu , 0x8000 , 0x7200 ) ||
659
+ etnaviv_is_model_rev (gpu , 0x8000 , 0x8002 ) ||
660
+ etnaviv_is_model_rev (gpu , 0x9200 , 0x6304 ))
661
+ pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_SH_EU ;
662
+
655
663
pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_HZ ;
656
664
pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_EZ ;
657
665
@@ -701,14 +709,14 @@ static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
701
709
*/
702
710
u32 pulse_eater = 0x01590880 ;
703
711
704
- if (etnaviv_is_model_rev (gpu , GC4000 , 0x5208 ) ||
705
- etnaviv_is_model_rev (gpu , GC4000 , 0x5222 )) {
712
+ if (etnaviv_is_model_rev (gpu , 0x4000 , 0x5208 ) ||
713
+ etnaviv_is_model_rev (gpu , 0x4000 , 0x5222 )) {
706
714
pulse_eater |= BIT (23 );
707
715
708
716
}
709
717
710
- if (etnaviv_is_model_rev (gpu , GC1000 , 0x5039 ) ||
711
- etnaviv_is_model_rev (gpu , GC1000 , 0x5040 )) {
718
+ if (etnaviv_is_model_rev (gpu , 0x1000 , 0x5039 ) ||
719
+ etnaviv_is_model_rev (gpu , 0x1000 , 0x5040 )) {
712
720
pulse_eater &= ~BIT (16 );
713
721
pulse_eater |= BIT (17 );
714
722
}
@@ -729,8 +737,8 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
729
737
WARN_ON (!(gpu -> state == ETNA_GPU_STATE_IDENTIFIED ||
730
738
gpu -> state == ETNA_GPU_STATE_RESET ));
731
739
732
- if ((etnaviv_is_model_rev (gpu , GC320 , 0x5007 ) ||
733
- etnaviv_is_model_rev (gpu , GC320 , 0x5220 )) &&
740
+ if ((etnaviv_is_model_rev (gpu , 0x320 , 0x5007 ) ||
741
+ etnaviv_is_model_rev (gpu , 0x320 , 0x5220 )) &&
734
742
gpu_read (gpu , VIVS_HI_CHIP_TIME ) != 0x2062400 ) {
735
743
u32 mc_memory_debug ;
736
744
@@ -756,7 +764,7 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
756
764
VIVS_HI_AXI_CONFIG_ARCACHE (2 ));
757
765
758
766
/* GC2000 rev 5108 needs a special bus config */
759
- if (etnaviv_is_model_rev (gpu , GC2000 , 0x5108 )) {
767
+ if (etnaviv_is_model_rev (gpu , 0x2000 , 0x5108 )) {
760
768
u32 bus_config = gpu_read (gpu , VIVS_MC_BUS_CONFIG );
761
769
bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK |
762
770
VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK );
@@ -855,12 +863,15 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
855
863
*
856
864
* On MC1.0 cores the linear window offset is ignored by the TS engine,
857
865
* leading to inconsistent memory views. Avoid using the offset on those
858
- * cores if possible, otherwise disable the TS feature.
866
+ * cores if possible, otherwise disable the TS feature. MMUv2 doesn't
867
+ * expose this issue, as all TS accesses are MMU translated, so the
868
+ * linear window offset won't be used.
859
869
*/
860
870
cmdbuf_paddr = ALIGN_DOWN (etnaviv_cmdbuf_get_pa (& gpu -> buffer ), SZ_128M );
861
871
862
872
if (!(gpu -> identity .features & chipFeatures_PIPE_3D ) ||
863
- (gpu -> identity .minor_features0 & chipMinorFeatures0_MC20 )) {
873
+ (gpu -> identity .minor_features0 & chipMinorFeatures0_MC20 ) ||
874
+ (gpu -> identity .minor_features1 & chipMinorFeatures1_MMU_VERSION )) {
864
875
if (cmdbuf_paddr >= SZ_2G )
865
876
priv -> mmu_global -> memory_base = SZ_2G ;
866
877
else
@@ -1537,6 +1548,7 @@ static irqreturn_t irq_handler(int irq, void *data)
1537
1548
u32 intr = gpu_read (gpu , VIVS_HI_INTR_ACKNOWLEDGE );
1538
1549
1539
1550
if (intr != 0 ) {
1551
+ ktime_t now = ktime_get ();
1540
1552
int event ;
1541
1553
1542
1554
pm_runtime_mark_last_busy (gpu -> dev );
@@ -1586,7 +1598,7 @@ static irqreturn_t irq_handler(int irq, void *data)
1586
1598
*/
1587
1599
if (fence_after (fence -> seqno , gpu -> completed_fence ))
1588
1600
gpu -> completed_fence = fence -> seqno ;
1589
- dma_fence_signal (fence );
1601
+ dma_fence_signal_timestamp (fence , now );
1590
1602
1591
1603
event_free (gpu , event );
1592
1604
}
@@ -1975,7 +1987,6 @@ static const struct dev_pm_ops etnaviv_gpu_pm_ops = {
1975
1987
struct platform_driver etnaviv_gpu_driver = {
1976
1988
.driver = {
1977
1989
.name = "etnaviv-gpu" ,
1978
- .owner = THIS_MODULE ,
1979
1990
.pm = pm_ptr (& etnaviv_gpu_pm_ops ),
1980
1991
.of_match_table = etnaviv_gpu_match ,
1981
1992
},
0 commit comments