mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Christian Gmeiner <christian.gmeiner@gmail.com>,
	Russell King <linux+etnaviv@armlinux.org.uk>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>
Cc: etnaviv@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	 linux-kernel@vger.kernel.org,
	Christian Gmeiner <cgmeiner@igalia.com>,
	 stable@vger.kernel.org
Subject: Re: [PATCH] drm/etnaviv: Flush the tile status cache through both the PE and BLT
Date: Wed, 04 Nov 2026 12:03:25 +0100	[thread overview]
Message-ID: <bf6acbfabf47de84243495f564865db19d44e184.camel@pengutronix.de> (raw)
In-Reply-To: <20261102-etna-pe-ts-flush-v1-1-e4454ed86f85@igalia.com>

Am Montag, dem 02.11.2026 um 11:18 +0100 schrieb Christian Gmeiner:
> From: Christian Gmeiner <cgmeiner@igalia.com>
> 
> Since commit f232d9ec029c ("drm/etnaviv: fix TS cache flushing on GPUs
> with BLT engine"), jobs on GPUs with a BLT engine use a BLT command to
> flush the tile status cache instead of TS_FLUSH_CACHE, which is broken
> on most of these GPUs.
> 
> GC7000 r6008/r6009 and GC8200 r6401 are the other way around:
> TS_FLUSH_CACHE works, but the BLT command does not flush the cache.
> The vendor driver handles these GPUs using TS_FLUSH_CACHE, but the
> etnaviv kernel driver has no way to identify them.
> 
> As a result, dirty tile status cache lines survive the end of a job.
> They are written back by the next cache flush, using the page table of
> the job issuing it. If that job belongs to another process, the write
> goes to the wrong address space.
> 
> On GC7000 r6009 this causes MMU faults and GPU recoveries blamed on an
> innocent process. I see around 1100 per run of a multisample
> depth/stencil test running alongside two other GPU clients.
> 
> Emit both flushes at the end of every job on GPUs with a BLT engine.
> Whichever does not work on a given GPU is a no-op. Since dirty lines
> are only written back once, this costs one additional state load per
> job.
> 
> Fixes: f232d9ec029c ("drm/etnaviv: fix TS cache flushing on GPUs with BLT engine")
> Cc: stable@vger.kernel.org
> Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 40 ++++++++++++++------------------
>  1 file changed, 18 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> index 03b2576af67f..99c91a9eecf1 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_buffer.c
> @@ -168,6 +168,17 @@ u16 etnaviv_buffer_config_pta(struct etnaviv_gpu *gpu, unsigned short id)
>  	return buffer->user_size / 8;
>  }
>  
> +static void etnaviv_cmd_flush_ts(struct etnaviv_cmdbuf *buffer, bool has_blt)
> +{
> +	CMD_LOAD_STATE(buffer, VIVS_TS_FLUSH_CACHE, VIVS_TS_FLUSH_CACHE_FLUSH);
> +
> +	if (has_blt) {
> +		CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1);
> +		CMD_LOAD_STATE(buffer, VIVS_BLT_SET_COMMAND, 0x1);
> +		CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0);
> +	}
> +}
> +
>  void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
>  {
>  	struct etnaviv_cmdbuf *buffer = &gpu->buffer;
> @@ -191,7 +202,7 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
>  		unsigned int dwords = 7;
>  
>  		if (has_blt)
> -			dwords += 10;
> +			dwords += 11;
>  
>  		link_target = etnaviv_buffer_reserve(gpu, buffer, dwords);
>  
> @@ -204,16 +215,8 @@ void etnaviv_buffer_end(struct etnaviv_gpu *gpu)
>  			CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0);
>  		}
>  		CMD_LOAD_STATE(buffer, VIVS_GL_FLUSH_CACHE, flush);
> -		if (gpu->exec_state == ETNA_PIPE_3D) {
> -			if (has_blt) {
> -				CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x1);
> -				CMD_LOAD_STATE(buffer, VIVS_BLT_SET_COMMAND, 0x1);
> -				CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0);
> -			} else {
> -				CMD_LOAD_STATE(buffer, VIVS_TS_FLUSH_CACHE,
> -					       VIVS_TS_FLUSH_CACHE_FLUSH);
> -			}
> -		}
> +		if (gpu->exec_state == ETNA_PIPE_3D)
> +			etnaviv_cmd_flush_ts(buffer, has_blt);
>  		CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
>  		CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
>  		if (has_blt) {
> @@ -400,12 +403,12 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
>  	return_dwords = 7;
>  
>  	/*
> -	 * When the BLT engine is present we need 6 more dwords in the return
> +	 * When the BLT engine is present we need 7 more dwords in the return
>  	 * target: 3 enable/flush/disable + 4 enable/semaphore stall/disable,
> -	 * but we don't need the normal TS flush state.
> +	 * on top of the normal TS flush state.
>  	 */
>  	if (has_blt)
> -		return_dwords += 6;
> +		return_dwords += 7;
>  
>  	return_target = etnaviv_buffer_reserve(gpu, buffer, return_dwords);
>  	CMD_LINK(cmdbuf, return_dwords, return_target);
> @@ -422,14 +425,7 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,
>  				       VIVS_GL_FLUSH_CACHE_DEPTH |
>  				       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);
> -			CMD_LOAD_STATE(buffer, VIVS_BLT_ENABLE, 0x0);
> -		} else {
> -			CMD_LOAD_STATE(buffer, VIVS_TS_FLUSH_CACHE,
> -					       VIVS_TS_FLUSH_CACHE_FLUSH);
> -		}
> +		etnaviv_cmd_flush_ts(buffer, has_blt);
>  	}
>  	CMD_SEM(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
>  	CMD_STALL(buffer, SYNC_RECIPIENT_FE, SYNC_RECIPIENT_PE);
> 
> ---
> base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
> change-id: 20261102-etna-pe-ts-flush-ffa01363b98c
> 
> Best regards,

      reply	other threads:[~2026-11-04 11:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 10:18 Christian Gmeiner
2026-11-04 11:03 ` Lucas Stach [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bf6acbfabf47de84243495f564865db19d44e184.camel@pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=airlied@gmail.com \
    --cc=cgmeiner@igalia.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®