All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Auger <eric.auger@redhat.com>
To: Joey Gouly <joey.gouly@arm.com>, kvm@vger.kernel.org
Cc: alexandru.elisei@arm.com, andrew.jones@linux.dev,
	kvmarm@lists.linux.dev, Marc Zyngier <maz@kernel.org>,
	Oliver Upton <oliver.upton@linux.dev>
Subject: Re: [kvm-unit-tests PATCH v3 02/10] arm64: efi: initialise SCTLR_ELx fully
Date: Thu, 27 Nov 2025 17:49:45 +0100	[thread overview]
Message-ID: <92f27f98-e4c9-41d9-badc-635e5ba40552@redhat.com> (raw)
In-Reply-To: <20250925141958.468311-3-joey.gouly@arm.com>

Hi Joey,

On 9/25/25 4:19 PM, Joey Gouly wrote:
> Don't rely on the value of SCTLR_ELx when booting via EFI.
>
> Signed-off-by: Joey Gouly <joey.gouly@arm.com>
> ---
>  lib/arm/asm/setup.h   |  6 ++++++
>  lib/arm/setup.c       |  3 +++
>  lib/arm64/processor.c | 12 ++++++++++++
>  3 files changed, 21 insertions(+)
>
> diff --git a/lib/arm/asm/setup.h b/lib/arm/asm/setup.h
> index 9f8ef82e..4e60d552 100644
> --- a/lib/arm/asm/setup.h
> +++ b/lib/arm/asm/setup.h
> @@ -28,6 +28,12 @@ void setup(const void *fdt, phys_addr_t freemem_start);
>  
>  #include <efi.h>
>  
> +#ifdef __aarch64__
> +void setup_efi_sctlr(void);
> +#else
> +static inline void setup_efi_sctlr(void) {}
> +#endif
> +
>  efi_status_t setup_efi(efi_bootinfo_t *efi_bootinfo);
>  
>  #endif
> diff --git a/lib/arm/setup.c b/lib/arm/setup.c
> index 67b5db07..0aaa1d3a 100644
> --- a/lib/arm/setup.c
> +++ b/lib/arm/setup.c
> @@ -349,6 +349,9 @@ efi_status_t setup_efi(efi_bootinfo_t *efi_bootinfo)
>  {
>  	efi_status_t status;
>  
> +
spurious line
> +	setup_efi_sctlr();
> +
>  	exceptions_init();
>  
>  	memregions_init(arm_mem_regions, NR_MEM_REGIONS);
> diff --git a/lib/arm64/processor.c b/lib/arm64/processor.c
> index eb93fd7c..edc0ad87 100644
> --- a/lib/arm64/processor.c
> +++ b/lib/arm64/processor.c
> @@ -8,6 +8,7 @@
>  #include <libcflat.h>
>  #include <asm/ptrace.h>
>  #include <asm/processor.h>
> +#include <asm/setup.h>
>  #include <asm/thread_info.h>
>  
>  static const char *vector_names[] = {
> @@ -271,3 +272,14 @@ bool __mmu_enabled(void)
>  {
>  	return read_sysreg(sctlr_el1) & SCTLR_EL1_M;
>  }
> +
> +#ifdef CONFIG_EFI
> +
> +void setup_efi_sctlr(void)
> +{
> +	// EFI exits boot services with SCTLR_ELx.M=1, so keep
> +	// the MMU enabled.
I don't really understand the comment, if MMU was enabled why are we
mandated to set M bit again?

Eric
> +	write_sysreg(INIT_SCTLR_EL1_MMU_OFF | SCTLR_EL1_M, sctlr_el1);
> +}
> +
> +#endif


  reply	other threads:[~2025-11-27 16:49 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-25 14:19 [kvm-unit-tests PATCH v3 00/10] arm64: EL2 support Joey Gouly
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 01/10] arm64: drop to EL1 if booted at EL2 Joey Gouly
2025-11-27 17:07   ` Eric Auger
2025-11-28 15:11     ` Joey Gouly
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 02/10] arm64: efi: initialise SCTLR_ELx fully Joey Gouly
2025-11-27 16:49   ` Eric Auger [this message]
2025-11-28 15:18     ` Joey Gouly
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 03/10] arm64: efi: initialise the EL Joey Gouly
2025-11-27 17:08   ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 04/10] arm64: timer: use hypervisor timers when at EL2 Joey Gouly
2025-12-02  8:36   ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 05/10] arm64: micro-bench: fix timer IRQ Joey Gouly
2025-12-02  8:36   ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 06/10] arm64: micro-bench: use smc when at EL2 Joey Gouly
2025-12-02  9:11   ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 07/10] arm64: selftest: update test for running " Joey Gouly
2025-12-02  9:16   ` Eric Auger
2025-12-02 12:21     ` Joey Gouly
2025-12-02 12:30       ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 08/10] arm64: pmu: count EL2 cycles Joey Gouly
2025-12-02 10:31   ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 09/10] arm64: run at EL2 if supported Joey Gouly
2025-12-02 10:35   ` Eric Auger
2025-09-25 14:19 ` [kvm-unit-tests PATCH v3 10/10] arm64: add EL2 environment variable Joey Gouly
2025-11-27 10:34   ` Eric Auger
2025-11-27 10:40     ` Joey Gouly
2025-12-01 23:34   ` Andrew Jones
2025-11-19 13:18 ` [kvm-unit-tests PATCH v3 00/10] arm64: EL2 support Joey Gouly
2025-11-19 13:48   ` Nadav Amit
2025-11-19 14:02     ` Joey Gouly
2025-11-19 15:34       ` Andrew Jones
2025-11-19 15:34 ` Marc Zyngier
2025-11-27 10:04 ` Eric Auger
2025-11-27 11:08   ` Joey Gouly
2025-11-27 12:04     ` Eric Auger
2025-11-27 14:52       ` Joey Gouly
2025-12-01 23:16         ` Andrew Jones
2025-12-02 14:22           ` Joey Gouly

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=92f27f98-e4c9-41d9-badc-635e5ba40552@redhat.com \
    --to=eric.auger@redhat.com \
    --cc=alexandru.elisei@arm.com \
    --cc=andrew.jones@linux.dev \
    --cc=joey.gouly@arm.com \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oliver.upton@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.