@@ -172,10 +172,12 @@ int etnaviv_gpu_get_param(struct etnaviv_gpu *gpu, u32 param, u64 *value)
172172 return 0 ;
173173}
174174
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+ }
175180
176- #define etnaviv_is_model_rev (gpu , mod , rev ) \
177- ((gpu)->identity.model == chipModel_##mod && \
178- (gpu)->identity.revision == rev)
179181#define etnaviv_field (val , field ) \
180182 (((val) & field##__MASK) >> field##__SHIFT)
181183
@@ -281,7 +283,7 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
281283
282284 switch (gpu -> identity .instruction_count ) {
283285 case 0 :
284- if (etnaviv_is_model_rev (gpu , GC2000 , 0x5108 ) ||
286+ if (etnaviv_is_model_rev (gpu , 0x2000 , 0x5108 ) ||
285287 gpu -> identity .model == chipModel_GC880 )
286288 gpu -> identity .instruction_count = 512 ;
287289 else
@@ -315,17 +317,17 @@ static void etnaviv_hw_specs(struct etnaviv_gpu *gpu)
315317 * For some cores, two varyings are consumed for position, so the
316318 * maximum varying count needs to be reduced by one.
317319 */
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 ))
329331 gpu -> identity .varyings_count -= 1 ;
330332}
331333
@@ -351,7 +353,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
351353 * Reading these two registers on GC600 rev 0x19 result in a
352354 * unhandled fault: external abort on non-linefetch
353355 */
354- if (!etnaviv_is_model_rev (gpu , GC600 , 0x19 )) {
356+ if (!etnaviv_is_model_rev (gpu , 0x600 , 0x19 )) {
355357 gpu -> identity .product_id = gpu_read (gpu , VIVS_HI_CHIP_PRODUCT_ID );
356358 gpu -> identity .eco_id = gpu_read (gpu , VIVS_HI_CHIP_ECO_ID );
357359 }
@@ -368,7 +370,7 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
368370 }
369371
370372 /* Another special case */
371- if (etnaviv_is_model_rev (gpu , GC300 , 0x2201 )) {
373+ if (etnaviv_is_model_rev (gpu , 0x300 , 0x2201 )) {
372374 u32 chipTime = gpu_read (gpu , VIVS_HI_CHIP_TIME );
373375
374376 if (chipDate == 0x20080814 && chipTime == 0x12051100 ) {
@@ -387,15 +389,15 @@ static void etnaviv_hw_identify(struct etnaviv_gpu *gpu)
387389 * Fix model/rev here, so all other places can refer to this
388390 * core by its real identity.
389391 */
390- if (etnaviv_is_model_rev (gpu , GC2000 , 0xffff5450 )) {
392+ if (etnaviv_is_model_rev (gpu , 0x2000 , 0xffff5450 )) {
391393 gpu -> identity .model = chipModel_GC3000 ;
392394 gpu -> identity .revision &= 0xffff ;
393395 }
394396
395- if (etnaviv_is_model_rev (gpu , GC1000 , 0x5037 ) && (chipDate == 0x20120617 ))
397+ if (etnaviv_is_model_rev (gpu , 0x1000 , 0x5037 ) && (chipDate == 0x20120617 ))
396398 gpu -> identity .eco_id = 1 ;
397399
398- if (etnaviv_is_model_rev (gpu , GC320 , 0x5303 ) && (chipDate == 0x20140511 ))
400+ if (etnaviv_is_model_rev (gpu , 0x320 , 0x5303 ) && (chipDate == 0x20140511 ))
399401 gpu -> identity .eco_id = 1 ;
400402 }
401403
@@ -641,17 +643,23 @@ static void etnaviv_gpu_enable_mlcg(struct etnaviv_gpu *gpu)
641643 pmc |= BIT (15 ); /* Unknown bit */
642644
643645 /* 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 ))
648650 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_TX ;
649651
650652 /* 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 ))
652654 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_SE |
653655 VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA ;
654656
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+
655663 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_HZ ;
656664 pmc |= VIVS_PM_MODULE_CONTROLS_DISABLE_MODULE_CLOCK_GATING_RA_EZ ;
657665
@@ -701,14 +709,14 @@ static void etnaviv_gpu_setup_pulse_eater(struct etnaviv_gpu *gpu)
701709 */
702710 u32 pulse_eater = 0x01590880 ;
703711
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 )) {
706714 pulse_eater |= BIT (23 );
707715
708716 }
709717
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 )) {
712720 pulse_eater &= ~BIT (16 );
713721 pulse_eater |= BIT (17 );
714722 }
@@ -729,8 +737,8 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
729737 WARN_ON (!(gpu -> state == ETNA_GPU_STATE_IDENTIFIED ||
730738 gpu -> state == ETNA_GPU_STATE_RESET ));
731739
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 )) &&
734742 gpu_read (gpu , VIVS_HI_CHIP_TIME ) != 0x2062400 ) {
735743 u32 mc_memory_debug ;
736744
@@ -756,7 +764,7 @@ static void etnaviv_gpu_hw_init(struct etnaviv_gpu *gpu)
756764 VIVS_HI_AXI_CONFIG_ARCACHE (2 ));
757765
758766 /* 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 )) {
760768 u32 bus_config = gpu_read (gpu , VIVS_MC_BUS_CONFIG );
761769 bus_config &= ~(VIVS_MC_BUS_CONFIG_FE_BUS_CONFIG__MASK |
762770 VIVS_MC_BUS_CONFIG_TX_BUS_CONFIG__MASK );
@@ -855,12 +863,15 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
855863 *
856864 * On MC1.0 cores the linear window offset is ignored by the TS engine,
857865 * 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.
859869 */
860870 cmdbuf_paddr = ALIGN_DOWN (etnaviv_cmdbuf_get_pa (& gpu -> buffer ), SZ_128M );
861871
862872 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 )) {
864875 if (cmdbuf_paddr >= SZ_2G )
865876 priv -> mmu_global -> memory_base = SZ_2G ;
866877 else
@@ -1537,6 +1548,7 @@ static irqreturn_t irq_handler(int irq, void *data)
15371548 u32 intr = gpu_read (gpu , VIVS_HI_INTR_ACKNOWLEDGE );
15381549
15391550 if (intr != 0 ) {
1551+ ktime_t now = ktime_get ();
15401552 int event ;
15411553
15421554 pm_runtime_mark_last_busy (gpu -> dev );
@@ -1586,7 +1598,7 @@ static irqreturn_t irq_handler(int irq, void *data)
15861598 */
15871599 if (fence_after (fence -> seqno , gpu -> completed_fence ))
15881600 gpu -> completed_fence = fence -> seqno ;
1589- dma_fence_signal (fence );
1601+ dma_fence_signal_timestamp (fence , now );
15901602
15911603 event_free (gpu , event );
15921604 }
@@ -1975,7 +1987,6 @@ static const struct dev_pm_ops etnaviv_gpu_pm_ops = {
19751987struct platform_driver etnaviv_gpu_driver = {
19761988 .driver = {
19771989 .name = "etnaviv-gpu" ,
1978- .owner = THIS_MODULE ,
19791990 .pm = pm_ptr (& etnaviv_gpu_pm_ops ),
19801991 .of_match_table = etnaviv_gpu_match ,
19811992 },
0 commit comments