@@ -574,8 +574,8 @@ static int etnaviv_hw_reset(struct etnaviv_gpu *gpu)
574574 continue ;
575575 }
576576
577- /* disable debug registers, as they are not normally needed */
578- control |= VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS ;
577+ /* enable debug register access */
578+ control &= ~ VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS ;
579579 gpu_write (gpu , VIVS_HI_CLOCK_CONTROL , control );
580580
581581 failed = false;
@@ -839,17 +839,8 @@ int etnaviv_gpu_init(struct etnaviv_gpu *gpu)
839839 if (ret )
840840 goto fail ;
841841
842- /*
843- * If the GPU is part of a system with DMA addressing limitations,
844- * request pages for our SHM backend buffers from the DMA32 zone to
845- * hopefully avoid performance killing SWIOTLB bounce buffering.
846- */
847- if (dma_addressing_limited (gpu -> dev ))
848- priv -> shm_gfp_mask |= GFP_DMA32 ;
849-
850842 /* Create buffer: */
851- ret = etnaviv_cmdbuf_init (priv -> cmdbuf_suballoc , & gpu -> buffer ,
852- PAGE_SIZE );
843+ ret = etnaviv_cmdbuf_init (priv -> cmdbuf_suballoc , & gpu -> buffer , SZ_4K );
853844 if (ret ) {
854845 dev_err (gpu -> dev , "could not create command buffer\n" );
855846 goto fail ;
@@ -1330,17 +1321,16 @@ static void sync_point_perfmon_sample_pre(struct etnaviv_gpu *gpu,
13301321{
13311322 u32 val ;
13321323
1324+ mutex_lock (& gpu -> lock );
1325+
13331326 /* disable clock gating */
13341327 val = gpu_read_power (gpu , VIVS_PM_POWER_CONTROLS );
13351328 val &= ~VIVS_PM_POWER_CONTROLS_ENABLE_MODULE_CLOCK_GATING ;
13361329 gpu_write_power (gpu , VIVS_PM_POWER_CONTROLS , val );
13371330
1338- /* enable debug register */
1339- val = gpu_read (gpu , VIVS_HI_CLOCK_CONTROL );
1340- val &= ~VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS ;
1341- gpu_write (gpu , VIVS_HI_CLOCK_CONTROL , val );
1342-
13431331 sync_point_perfmon_sample (gpu , event , ETNA_PM_PROCESS_PRE );
1332+
1333+ mutex_unlock (& gpu -> lock );
13441334}
13451335
13461336static void sync_point_perfmon_sample_post (struct etnaviv_gpu * gpu ,
@@ -1350,23 +1340,22 @@ static void sync_point_perfmon_sample_post(struct etnaviv_gpu *gpu,
13501340 unsigned int i ;
13511341 u32 val ;
13521342
1343+ mutex_lock (& gpu -> lock );
1344+
13531345 sync_point_perfmon_sample (gpu , event , ETNA_PM_PROCESS_POST );
13541346
1347+ /* enable clock gating */
1348+ val = gpu_read_power (gpu , VIVS_PM_POWER_CONTROLS );
1349+ val |= VIVS_PM_POWER_CONTROLS_ENABLE_MODULE_CLOCK_GATING ;
1350+ gpu_write_power (gpu , VIVS_PM_POWER_CONTROLS , val );
1351+
1352+ mutex_unlock (& gpu -> lock );
1353+
13551354 for (i = 0 ; i < submit -> nr_pmrs ; i ++ ) {
13561355 const struct etnaviv_perfmon_request * pmr = submit -> pmrs + i ;
13571356
13581357 * pmr -> bo_vma = pmr -> sequence ;
13591358 }
1360-
1361- /* disable debug register */
1362- val = gpu_read (gpu , VIVS_HI_CLOCK_CONTROL );
1363- val |= VIVS_HI_CLOCK_CONTROL_DISABLE_DEBUG_REGISTERS ;
1364- gpu_write (gpu , VIVS_HI_CLOCK_CONTROL , val );
1365-
1366- /* enable clock gating */
1367- val = gpu_read_power (gpu , VIVS_PM_POWER_CONTROLS );
1368- val |= VIVS_PM_POWER_CONTROLS_ENABLE_MODULE_CLOCK_GATING ;
1369- gpu_write_power (gpu , VIVS_PM_POWER_CONTROLS , val );
13701359}
13711360
13721361
@@ -1862,7 +1851,7 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
18621851 if (!gpu )
18631852 return - ENOMEM ;
18641853
1865- gpu -> dev = & pdev -> dev ;
1854+ gpu -> dev = dev ;
18661855 mutex_init (& gpu -> lock );
18671856 mutex_init (& gpu -> sched_lock );
18681857
@@ -1876,8 +1865,8 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
18761865 if (gpu -> irq < 0 )
18771866 return gpu -> irq ;
18781867
1879- err = devm_request_irq (& pdev -> dev , gpu -> irq , irq_handler , 0 ,
1880- dev_name (gpu -> dev ), gpu );
1868+ err = devm_request_irq (dev , gpu -> irq , irq_handler , 0 ,
1869+ dev_name (dev ), gpu );
18811870 if (err ) {
18821871 dev_err (dev , "failed to request IRQ%u: %d\n" , gpu -> irq , err );
18831872 return err ;
@@ -1914,13 +1903,13 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
19141903 * autosuspend delay is rather arbitary: no measurements have
19151904 * yet been performed to determine an appropriate value.
19161905 */
1917- pm_runtime_use_autosuspend (gpu -> dev );
1918- pm_runtime_set_autosuspend_delay (gpu -> dev , 200 );
1919- pm_runtime_enable (gpu -> dev );
1906+ pm_runtime_use_autosuspend (dev );
1907+ pm_runtime_set_autosuspend_delay (dev , 200 );
1908+ pm_runtime_enable (dev );
19201909
1921- err = component_add (& pdev -> dev , & gpu_ops );
1910+ err = component_add (dev , & gpu_ops );
19221911 if (err < 0 ) {
1923- dev_err (& pdev -> dev , "failed to register component: %d\n" , err );
1912+ dev_err (dev , "failed to register component: %d\n" , err );
19241913 return err ;
19251914 }
19261915
@@ -1929,8 +1918,13 @@ static int etnaviv_gpu_platform_probe(struct platform_device *pdev)
19291918
19301919static void etnaviv_gpu_platform_remove (struct platform_device * pdev )
19311920{
1921+ struct etnaviv_gpu * gpu = dev_get_drvdata (& pdev -> dev );
1922+
19321923 component_del (& pdev -> dev , & gpu_ops );
19331924 pm_runtime_disable (& pdev -> dev );
1925+
1926+ mutex_destroy (& gpu -> lock );
1927+ mutex_destroy (& gpu -> sched_lock );
19341928}
19351929
19361930static int etnaviv_gpu_rpm_suspend (struct device * dev )
0 commit comments