qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <richard.henderson@linaro.org>
To: Gabriel Brookman <brookmangabriel@gmail.com>, qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Gustavo Romero <gustavo.romero@linaro.org>,
	qemu-arm@nongnu.org
Subject: Re: [PATCH RFC v2 04/10] target/arm: add FEAT_MTE_STORE_ONLY logic
Date: Mon, 17 Nov 2025 16:26:14 +0100	[thread overview]
Message-ID: <9b2de87c-b7d8-4a64-8c7b-bf94e3233275@linaro.org> (raw)
In-Reply-To: <20251116-feat-mte4-v2-4-9a7122b7fa76@gmail.com>

On 11/17/25 02:40, Gabriel Brookman wrote:
> This feature automatically succeeds tag checks on load instructions when
> the appropriate SCTLR_TCSO register for the current exception level is
> set. Find information on this feature in the "Tag Checking" section of
> the ARM ARM, Memory Tagging Extension chapter.
> 
> Signed-off-by: Gabriel Brookman <brookmangabriel@gmail.com>
> ---
>   target/arm/tcg/mte_helper.c | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/target/arm/tcg/mte_helper.c b/target/arm/tcg/mte_helper.c
> index bb48fe359b..f9fd6fd408 100644
> --- a/target/arm/tcg/mte_helper.c
> +++ b/target/arm/tcg/mte_helper.c
> @@ -865,8 +865,30 @@ static int mte_probe_int(CPUARMState *env, uint32_t desc, uint64_t ptr,
>       return 0;
>   }
>   
> +static bool mte_store_only_active(CPUARMState *env)
> +{
> +    int el = arm_current_el(env);
> +    if (el) {
> +        if (SCTLR_TCSO & env->cp15.sctlr_el[el]) {
> +            return true;
> +        }
> +    } else {
> +        if ((HCR_E2H & env->cp15.hcr_el2) &&'

You can't test hcr_el2 directly, because SecEL2 might not exist when (Non-secure) EL2 
does.  However, this can be simplified using arm_sctlr():

     uint64_t sctlr = arm_sctlr(env, el);
     uint64_t test = el ? SCTLR_TCSO : SCTLR_TCSO0;
     return sctlr & test;


That said, we should cache this in TBFLAGS so that we don't generate the mte_check 
function call at runtime for reads.  See target/arm/tcg/hflags.c, s/MTE_ACTIVE/.


r~


  reply	other threads:[~2025-11-17 15:27 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-17  1:40 [PATCH RFC v2 00/10] target/arm: add support for MTE4 Gabriel Brookman
2025-11-17  1:40 ` [PATCH RFC v2 01/10] target/arm: explicitly disable MTE4 for max Gabriel Brookman
2025-11-17  9:48   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 02/10] tests/tcg: added test for MTE FAR Gabriel Brookman
2025-11-17  9:51   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 03/10] target/arm: add TCSO bitmasks to SCTLR Gabriel Brookman
2025-11-17 15:14   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 04/10] target/arm: add FEAT_MTE_STORE_ONLY logic Gabriel Brookman
2025-11-17 15:26   ` Richard Henderson [this message]
2025-11-17  1:40 ` [PATCH RFC v2 05/10] tests/tcg: added test for MTE write-only Gabriel Brookman
2025-11-17 15:39   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 06/10] target/arm: add canonical and no-address tag logic Gabriel Brookman
2025-11-17 16:18   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 07/10] target/arm: ldg on canonical tag loads the tag Gabriel Brookman
2025-11-17 16:26   ` Richard Henderson
2025-11-18 17:31     ` brookmangabriel
2025-11-17  1:40 ` [PATCH RFC v2 08/10] target/arm: storing to canonical tags faults Gabriel Brookman
2025-11-19  7:48   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 09/10] tests/tcg: added test for MTE canonical and NAT Gabriel Brookman
2025-11-19  7:49   ` Richard Henderson
2025-11-17  1:40 ` [PATCH RFC v2 10/10] docs: added MTE4 features to docs Gabriel Brookman
2025-11-19  7:51   ` Richard Henderson

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=9b2de87c-b7d8-4a64-8c7b-bf94e3233275@linaro.org \
    --to=richard.henderson@linaro.org \
    --cc=brookmangabriel@gmail.com \
    --cc=gustavo.romero@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).