From: Vladimir Murzin <vladimir.murzin@arm.com>
To: Mark Rutland <mark.rutland@arm.com>,
linux-arm-kernel@lists.infradead.org
Cc: catalin.marinas@arm.com, james.morse@arm.com, maz@kernel.org,
will@kernel.org
Subject: Re: [PATCH 1/2] arm64: mte-kasan: Use IS_ENABLED() rather than ALTERNATIVE() 'cfg' parameter
Date: Tue, 22 Sep 2026 12:25:28 +0100 [thread overview]
Message-ID: <16066089-ccbd-4c29-9401-5cdcc5c29aab@arm.com> (raw)
In-Reply-To: <20260902113232.314831-2-mark.rutland@arm.com>
On 9/2/26 12:32, Mark Rutland wrote:
> The ALTERNATIVE() macro accepts an optional 'cfg' parameter, which
> accepts a CONFIG_* symbol. Where a CONFIG_* symbol is provided, but is
> not selected, the ALTERNATIVE() macro will expand to nothing.
>
> It would be nicer overall to remove the 'cfg' parameter and to have an
> explicit check for 'cfg' outside of the asm() block. This is clearer to
> a reader, and permits the compiler to elide the asm() block when 'cfg'
> is not selected.
>
> In the mte-kasan code, replace the usage of the 'cfg' parameter with an
> explicit IS_ENABLED() check.
>
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: James Morse <james.morse@arm.com>
> Cc: Marc Zyngier <maz@kernel.org>
> Cc: Will Deacon <will@kernel.org>
> ---
> arch/arm64/include/asm/mte-kasan.h | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/include/asm/mte-kasan.h b/arch/arm64/include/asm/mte-kasan.h
> index 3521392719189..de910f1c19e1b 100644
> --- a/arch/arm64/include/asm/mte-kasan.h
> +++ b/arch/arm64/include/asm/mte-kasan.h
> @@ -53,14 +53,16 @@ static inline bool system_uses_mte_async_or_asymm_mode(void)
> */
> static inline void mte_disable_tco(void)
> {
> - asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(0),
> - ARM64_MTE, CONFIG_KASAN_HW_TAGS));
> + if (!IS_ENABLED(CONFIG_KASAN_HW_TAGS))
> + return;
> + asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(0), ARM64_MTE));
> }
>
> static inline void mte_enable_tco(void)
> {
> - asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1),
> - ARM64_MTE, CONFIG_KASAN_HW_TAGS));
> + if (!IS_ENABLED(CONFIG_KASAN_HW_TAGS))
> + return;
> + asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1), ARM64_MTE));
> }
>
> /*
> -- 2.30.2
>
Looks reasonable, FWIW
Reviewed-by: Vladimir Murzin <vladimir.murzin@arm.com>
next prev parent reply other threads:[~2026-09-22 11:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 11:32 [PATCH 0/2] arm64: alternative: Remove optional 'cfg' parameter Mark Rutland
2026-09-02 11:32 ` [PATCH 1/2] arm64: mte-kasan: Use IS_ENABLED() rather than ALTERNATIVE() " Mark Rutland
2026-09-22 11:25 ` Vladimir Murzin [this message]
2026-09-02 11:32 ` [PATCH 2/2] arm64: alternative: Remove " Mark Rutland
2026-09-22 11:34 ` Vladimir Murzin
2026-09-23 18:20 ` [PATCH 0/2] arm64: alternative: Remove optional " Catalin Marinas
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=16066089-ccbd-4c29-9401-5cdcc5c29aab@arm.com \
--to=vladimir.murzin@arm.com \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=maz@kernel.org \
--cc=will@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