diff mbox series

drm/etnaviv: flush shader L1 cache after user commandstream

Message ID 20241025151446.2475994-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/etnaviv: flush shader L1 cache after user commandstream | expand

Commit Message

Lucas Stach Oct. 25, 2024, 3:14 p.m. UTC
The shader L1 cache is a writeback cache for shader loads/stores
and thus must be flushed before any BOs backing the shader buffers
are potentially freed.

Cc: stable@vger.kernel.org
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Christian Gmeiner Oct. 28, 2024, 8:41 a.m. UTC | #1
Hi Lucas

>
> The shader L1 cache is a writeback cache for shader loads/stores
> and thus must be flushed before any BOs backing the shader buffers
> are potentially freed.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> index 384df1659be6..b13a17276d07 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> @@ -482,7 +482,8 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
>         } else {
>                 CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE,
>                                        VIVS_GL_FLUSH_CACHE_DEPTH |
> -                                      VIVS_GL_FLUSH_CACHE_COLOR);
> +                                      VIVS_GL_FLUSH_CACHE_COLOR |
> +                                      VIVS_GL_FLUSH_CACHE_SHADER_L1);
>                 if (has_blt) {
>                         CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1);
>                         CMD_LOAD_STATE(buffer, VIVS_BLT_SET_COMMAND, 0x1);
> --
> 2.39.5
>

While we're at it, should we also flush VIVS_GL_FLUSH_CACHE_UNK10 and
VIVS_GL_FLUSH_CACHE_UNK11 as done
in the blob kernel driver?
https://github.com/nxp-imx/linux-imx/blob/lf-6.6.3-1.0.0/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c#L4883

This could help with some image workloads that may be exposed soon.

--
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
index 384df1659be6..b13a17276d07 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
@@ -482,7 +482,8 @@  void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
 	} else {
 		CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE,
 				       VIVS_GL_FLUSH_CACHE_DEPTH |
-				       VIVS_GL_FLUSH_CACHE_COLOR);
+				       VIVS_GL_FLUSH_CACHE_COLOR |
+				       VIVS_GL_FLUSH_CACHE_SHADER_L1);
 		if (has_blt) {
 			CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1);
 			CMD_LOAD_STATE(buffer, VIVS_BLT_SET_COMMAND, 0x1);