From: Boris Brezillon <[email protected]>
If we don't do that, we end up with invalid timestamps in the block
headers.
We also need to skip the warning on the cycle counter reference being
other than 0 during device reset, because of perfcnt's lingering ref.
Ideally this would be dealt with by splitting the reset sequence into
pre and post stages, so that a hypothetical panfrost_perfcnt_pre_reset()
would release the cycle counter reference. In the absence thereof, we
just make do.
Fixes: 7786fd108777 ("drm/panfrost: Expose performance counters through
unstable ioctls")
Signed-off-by: Boris Brezillon <[email protected]>
Reviewed-by: Steven Price <[email protected]>
Signed-off-by: Adrián Larumbe <[email protected]>
---
drivers/gpu/drm/panfrost/panfrost_gpu.c | 7 +++----
drivers/gpu/drm/panfrost/panfrost_perfcnt.c | 3 +++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/panfrost/panfrost_gpu.c
b/drivers/gpu/drm/panfrost/panfrost_gpu.c
index 6081b27829e1..5c3fee65c9e3 100644
--- a/drivers/gpu/drm/panfrost/panfrost_gpu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_gpu.c
@@ -94,11 +94,10 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)
GPU_IRQ_CLEAN_CACHES_COMPLETED);
/*
- * All in-flight jobs should have released their cycle
- * counter references upon reset, but let us make sure
+ * Even though all in-flight jobs should have released their cycle
counter
+ * references upon reset, perfcnt's might still hang about.
*/
- if (drm_WARN_ON(&pfdev->base,
atomic_read(&pfdev->cycle_counter.use_count) != 0))
- atomic_set(&pfdev->cycle_counter.use_count, 0);
+ atomic_set(&pfdev->cycle_counter.use_count, 0);
return 0;
}
diff --git a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
index a9def452d5ef..b26da057a1a0 100644
--- a/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
+++ b/drivers/gpu/drm/panfrost/panfrost_perfcnt.c
@@ -17,6 +17,7 @@
#include "panfrost_device.h"
#include "panfrost_features.h"
#include "panfrost_gem.h"
+#include "panfrost_gpu.h"
#include "panfrost_issues.h"
#include "panfrost_job.h"
#include "panfrost_mmu.h"
@@ -52,6 +53,7 @@ static void panfrost_perfcnt_hw_disable(struct
panfrost_device *pfdev)
gpu_write(pfdev, GPU_PRFCNT_TILER_EN, 0);
if (perfcnt->owns_as_ref) {
+ panfrost_cycle_counter_put(pfdev);
panfrost_mmu_as_put(pfdev, perfcnt->mapping->mmu);
perfcnt->owns_as_ref = false;
}
@@ -84,6 +86,7 @@ static int panfrost_perfcnt_hw_enable(struct panfrost_device
*pfdev)
return ret;
perfcnt->owns_as_ref = true;
+ panfrost_cycle_counter_get(pfdev);
as = ret;
cfg = GPU_PERFCNT_CFG_AS(as) |
--
2.56.0