mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Andrea della Porta <andrea.porta@suse.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Cc: nik.borisov@suse.com, arnd@arndb.de, mark.rutland@arm.com
Subject: Re: [PATCH v2 1/4] arm64: Introduce aarch32_enabled()
Date: Tue, 24 Oct 2023 12:56:12 +0100	[thread overview]
Message-ID: <e13d8d85-67d7-4a5e-893c-69dacb3a6d24@arm.com> (raw)
In-Reply-To: <1dec05cc8f54d0b85acffce69d929f13e6d81313.1698069331.git.andrea.porta@suse.com>

On 23/10/2023 3:42 pm, Andrea della Porta wrote:
> Aarch32 bit support on 64bit kernels depends on whether CONFIG_COMPAT
> is selected or not. As it is a compile time option it doesn't
> provide the flexibility to have distributions set their own policy for
> Aarch32 support and give the user the flexibility to override it.
> 
> As a first step introduce aarch32_enabled() which abstracts whether 32
> bit compat is turned on or off. Upcoming patches will implement
> the ability to set Aarch32 compat state at boot time.

Other than patch #3, which as previously mentioned should be unnecessary 
if the kernel correctly never starts an "unsupported" AArch32 process to 
begin with, what does this do that simply overriding ID_AA64PFR0_EL1.EL0 
via the existing idreg-override mechanism wouldn't?

Thanks,
Robin.

> Signed-off-by: Andrea della Porta <andrea.porta@suse.com>
> ---
>   arch/arm64/include/asm/cpufeature.h | 15 +++++++++++++++
>   arch/arm64/kernel/entry-common.c    |  2 ++
>   2 files changed, 17 insertions(+)
> 
> diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h
> index 396af9b9c857..1180d68daaff 100644
> --- a/arch/arm64/include/asm/cpufeature.h
> +++ b/arch/arm64/include/asm/cpufeature.h
> @@ -657,6 +657,21 @@ static inline bool supports_clearbhb(int scope)
>   						    ID_AA64ISAR2_EL1_CLRBHB_SHIFT);
>   }
>   
> +#ifdef CONFIG_COMPAT
> +extern bool __aarch32_enabled;
> +
> +static inline bool aarch32_enabled(void)
> +{
> +	return __aarch32_enabled;
> +}
> +#else /* !CONFIG_COMPAT */
> +
> +static inline bool aarch32_enabled(void)
> +{
> +	return false;
> +}
> +#endif
> +
>   const struct cpumask *system_32bit_el0_cpumask(void);
>   DECLARE_STATIC_KEY_FALSE(arm64_mismatched_32bit_el0);
>   
> diff --git a/arch/arm64/kernel/entry-common.c b/arch/arm64/kernel/entry-common.c
> index 0fc94207e69a..69ff9b8c0bde 100644
> --- a/arch/arm64/kernel/entry-common.c
> +++ b/arch/arm64/kernel/entry-common.c
> @@ -877,6 +877,8 @@ asmlinkage void noinstr el0t_32_error_handler(struct pt_regs *regs)
>   {
>   	__el0_error_handler_common(regs);
>   }
> +
> +bool __aarch32_enabled __ro_after_init = true;
>   #else /* CONFIG_COMPAT */
>   UNHANDLED(el0t, 32, sync)
>   UNHANDLED(el0t, 32, irq)

  reply	other threads:[~2023-10-24 11:56 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-23 14:42 [PATCH v2 0/4] arm64: Make Aarch32 compatibility enablement optional at boot Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 1/4] arm64: Introduce aarch32_enabled() Andrea della Porta
2023-10-24 11:56   ` Robin Murphy [this message]
2023-11-15 15:36     ` Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 2/4] arm64/process: Make loading of 32bit processes depend on aarch32_enabled() Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 3/4] arm64/entry-common: Make Aarch32 exceptions' availability " Andrea della Porta
2023-10-25 11:27   ` Mark Rutland
2023-11-15 16:09     ` Andrea della Porta
2023-10-23 14:42 ` [PATCH v2 4/4] arm64: Make Aarch32 support boot time configurable Andrea della Porta

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=e13d8d85-67d7-4a5e-893c-69dacb3a6d24@arm.com \
    --to=robin.murphy@arm.com \
    --cc=andrea.porta@suse.com \
    --cc=arnd@arndb.de \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=nik.borisov@suse.com \
    --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

all inboxes | Powered by JetHome®