]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
drm/etnaviv: assert GPU lock held in perfmon pipe_*_read functions
authorLucas Stach <l.stach@pengutronix.de>
Fri, 5 Jul 2024 20:00:10 +0000 (22:00 +0200)
committerLucas Stach <l.stach@pengutronix.de>
Mon, 28 Oct 2024 15:33:43 +0000 (16:33 +0100)
The perf counter read functions don't just read registers, but they
also mutate state to direct the reads towards the correct pipe and
engine. Assert that the GPU mutex is held at this point, so that
those state changes don't interfere with others.

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/etnaviv/etnaviv_perfmon.c

index dc9dea664a28d3ec9a845a6f639d89fbed3ab2ad..d53a5c29337398584f35a1bf5b6194ea022c5b36 100644 (file)
@@ -62,6 +62,8 @@ static u32 pipe_perf_reg_read(struct etnaviv_gpu *gpu,
        u32 value = 0;
        unsigned i;
 
+       lockdep_assert_held(&gpu->lock);
+
        for (i = 0; i < gpu->identity.pixel_pipes; i++) {
                pipe_select(gpu, clock, i);
                value += perf_reg_read(gpu, domain, signal);
@@ -81,6 +83,8 @@ static u32 pipe_reg_read(struct etnaviv_gpu *gpu,
        u32 value = 0;
        unsigned i;
 
+       lockdep_assert_held(&gpu->lock);
+
        for (i = 0; i < gpu->identity.pixel_pipes; i++) {
                pipe_select(gpu, clock, i);
                value += gpu_read(gpu, signal->data);