From: Mark Rutland <mark.rutland@arm.com>
To: Andre Przywara <andre.przywara@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, broonie@kernel.org,
jaxson.han@arm.com, robin.murphy@arm.com,
vladimir.murzin@arm.com, wei.chen@arm.com
Subject: Re: [bootwrapper PATCH v3 02/15] aarch64: correct SCTLR_EL1_KERNEL for AA32 kernels
Date: Thu, 27 Jan 2022 15:52:13 +0000 [thread overview]
Message-ID: <YfK/rXWybS55syzi@FVFF77S0Q05N> (raw)
In-Reply-To: <20220126150338.5af163e5@donnerap.cambridge.arm.com>
On Wed, Jan 26, 2022 at 03:03:38PM +0000, Andre Przywara wrote:
> On Tue, 25 Jan 2022 15:00:44 +0000
> Mark Rutland <mark.rutland@arm.com> wrote:
>
> Hi,
>
> > Bits [31:0] of the AArch64 SCTLR_EL1 register are architecturally mapped
> > to bits [31:0] of the AArch32 SCTLR register. This means that any
> > individual bit always has the same value across the two registers.
> >
> > Across the two registers, the same bit may have distinct meanings,
> > distinct RESx behaviour, and distinct reset behaviour. For example,
> > SCTLR_EL1[28] is nTLSMD, which we wich to initialize to 0b1, whereas
> > SCTLR[28] is TRE, which we wish to initialize to 0b0.
> >
> > To avoid setting bits which we did not intend to, and in preparation for
> > configuring more AArch64 RES1 bits, this patch decouples the
> > SCTLR_EL1_KERNEL value used for AArch32 kernels from the SCTLR_EL1_RES1
> > definitions such that is does not inherit AArch64 SCTLR_EL1 bits which
> > would be problematic in the AArch32 SCTLR. For now we open-code a copy
> > of the bits defined in arch/aarch64/include/asm/cpu.h.
> >
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> > Cc: Andre Przywara <andre.przywara@arm.com>
> > ---
> > arch/aarch64/include/asm/cpu.h | 11 +++++++++--
> > 1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/aarch64/include/asm/cpu.h b/arch/aarch64/include/asm/cpu.h
> > index e3269b8..49d3f86 100644
> > --- a/arch/aarch64/include/asm/cpu.h
> > +++ b/arch/aarch64/include/asm/cpu.h
> > @@ -36,8 +36,15 @@
> > #define SCTLR_EL1_RES1 (3 << 28 | 3 << 22 | 1 << 11)
> >
> > #ifdef KERNEL_32
> > -/* 32-bit kernel decompressor uses CP15 barriers */
> > -#define SCTLR_EL1_KERNEL (SCTLR_EL1_RES1 | SCTLR_EL1_CP15BEN)
> > +/*
> > + * When booting a 32-bit kernel, EL1 uses AArch32 and registers which are
> > + * architecturally mapped must be configured with the AArch32 layout.
> > + *
> > + * We copy the AArch32 definition of SCTLR_KERNEL here.
> > + *
> > + * TODO: restructure the headers to share a single definition.
> > + */
> > +#define SCTLR_EL1_KERNEL (3 << 22 | 1 << 11 | 1 << 5 | 3 << 4)
>
> Is the verbatim copying of the value, including the redundancy, intended?
Yup, the intent is to have the exact same definition, overlapping bits and all.
I would like to clean that up in future, but for now I want this to clearly be
the same.
> Maybe that meant 3 << 3, as bits[4:3] are documented as "Reserved,
> RAO/SBOP" in the ARMv7 ARM?
> It's fine with me either way, since it copies the aarch32 value, just
> wanted to check:
>
> Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Thanks!
Mark.
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-27 15:53 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 15:00 [bootwrapper PATCH v3 00/15] Cleanups and improvements Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 01/15] aarch64: correct ZCR_EL3.LEN initialization Mark Rutland
2022-01-25 15:59 ` Mark Brown
2022-01-25 16:33 ` Mark Rutland
2022-01-25 17:44 ` Mark Brown
2022-01-27 16:08 ` Mark Rutland
2022-01-27 18:55 ` Mark Brown
2022-01-28 10:03 ` Mark Rutland
2022-01-28 12:41 ` Mark Brown
2022-01-26 15:02 ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 02/15] aarch64: correct SCTLR_EL1_KERNEL for AA32 kernels Mark Rutland
2022-01-26 15:03 ` Andre Przywara
2022-01-27 15:52 ` Mark Rutland [this message]
2022-01-25 15:00 ` [bootwrapper PATCH v3 03/15] Document entry requirements Mark Rutland
2022-01-26 15:03 ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 04/15] Add bit-field macros Mark Rutland
2022-01-26 15:03 ` Andre Przywara
2022-01-27 16:11 ` Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 05/15] aarch64: add system register accessors Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 06/15] aarch32: add coprocessor accessors Mark Rutland
2022-01-26 16:35 ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 07/15] aarch64: add mov_64 macro Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 08/15] aarch64: initialize SCTLR_ELx for the boot-wrapper Mark Rutland
2022-01-26 16:35 ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 09/15] Rework common init C code Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 10/15] Announce boot-wrapper mode / exception level Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 11/15] aarch64: move the bulk of EL3 initialization to C Mark Rutland
2022-01-26 16:36 ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 12/15] aarch32: move the bulk of Secure PL1 " Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 13/15] Announce locations of memory objects Mark Rutland
2022-01-25 15:00 ` [bootwrapper PATCH v3 14/15] Rework bootmethod initialization Mark Rutland
2022-01-26 16:36 ` Andre Przywara
2022-01-25 15:00 ` [bootwrapper PATCH v3 15/15] Unify start_el3 & start_no_el3 Mark Rutland
2022-01-28 15:50 ` [bootwrapper PATCH v3 00/15] Cleanups and improvements Mark Rutland
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=YfK/rXWybS55syzi@FVFF77S0Q05N \
--to=mark.rutland@arm.com \
--cc=andre.przywara@arm.com \
--cc=broonie@kernel.org \
--cc=jaxson.han@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=robin.murphy@arm.com \
--cc=vladimir.murzin@arm.com \
--cc=wei.chen@arm.com \
/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