Merge tag 'drm-misc-next-2020-06-19' of git://anongit.freedesktop.org/drm/drm-misc...
[linux-2.6-microblaze.git] / drivers / gpu / drm / msm / adreno / a5xx_gpu.c
index ad41ff0..0e1933e 100644 (file)
@@ -1404,6 +1404,10 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu)
 {
        u64 busy_cycles, busy_time;
 
+       /* Only read the gpu busy if the hardware is already active */
+       if (pm_runtime_get_if_in_use(&gpu->pdev->dev) == 0)
+               return 0;
+
        busy_cycles = gpu_read64(gpu, REG_A5XX_RBBM_PERFCTR_RBBM_0_LO,
                        REG_A5XX_RBBM_PERFCTR_RBBM_0_HI);
 
@@ -1412,6 +1416,8 @@ static unsigned long a5xx_gpu_busy(struct msm_gpu *gpu)
 
        gpu->devfreq.busy_cycles = busy_cycles;
 
+       pm_runtime_put(&gpu->pdev->dev);
+
        if (WARN_ON(busy_time > ~0LU))
                return ~0LU;
 
@@ -1439,6 +1445,7 @@ static const struct adreno_gpu_funcs funcs = {
                .gpu_busy = a5xx_gpu_busy,
                .gpu_state_get = a5xx_gpu_state_get,
                .gpu_state_put = a5xx_gpu_state_put,
+               .create_address_space = adreno_iommu_create_address_space,
        },
        .get_timestamp = a5xx_get_timestamp,
 };