public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Anshuman Khandual <anshuman.khandual@arm.com>
To: linux-arm-kernel@lists.infradead.org
Cc: mark.rutland@arm.com, Anshuman Khandual <anshuman.khandual@arm.com>
Subject: [boot-wrapper 2/3] aarch64: Enable access into SCTLR2_ELx registers from EL2 and below
Date: Tue, 23 Jul 2024 16:36:29 +0530	[thread overview]
Message-ID: <20240723110630.483871-3-anshuman.khandual@arm.com> (raw)
In-Reply-To: <20240723110630.483871-1-anshuman.khandual@arm.com>

FEAT_SCTLR2 adds SCTLR2_EL1 and SCTLR2_EL2 system registers But access into
these register from EL2 and below trap to EL3 unless SCR_EL3.D128En is set.

Enable access to SCTLR2_ELx registers when they are implemented.

Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
 arch/aarch64/include/asm/cpu.h | 4 +++-
 arch/aarch64/init.c            | 3 +++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/aarch64/include/asm/cpu.h b/arch/aarch64/include/asm/cpu.h
index 0b8b463..57d66e4 100644
--- a/arch/aarch64/include/asm/cpu.h
+++ b/arch/aarch64/include/asm/cpu.h
@@ -56,6 +56,7 @@
 #define SCR_EL3_HXEn			BIT(38)
 #define SCR_EL3_EnTP2			BIT(41)
 #define SCR_EL3_TCR2EN			BIT(43)
+#define SCR_EL3_SCTLR2En		BIT(44)
 #define SCR_EL3_PIEN			BIT(45)
 #define SCR_EL3_D128En			BIT(47)
 
@@ -81,7 +82,8 @@
 
 #define ID_AA64MMFR1_EL1_HCX		BITS(43, 40)
 
-#define ID_AA64MMFR3_EL1_TCRX		BITS(4, 0)
+#define ID_AA64MMFR3_EL1_TCRX		BITS(3, 0)
+#define ID_AA64MMFR3_EL1_SCTLRX		BITS(7, 4)
 #define ID_AA64MMFR3_EL1_S1PIE		BITS(11, 8)
 #define ID_AA64MMFR3_EL1_S2PIE		BITS(15, 12)
 #define ID_AA64MMFR3_EL1_S1POE		BITS(19, 16)
diff --git a/arch/aarch64/init.c b/arch/aarch64/init.c
index 7d9d0d9..5b21cb8 100644
--- a/arch/aarch64/init.c
+++ b/arch/aarch64/init.c
@@ -92,6 +92,9 @@ void cpu_init_el3(void)
 	if (mrs_field(ID_AA64MMFR3_EL1, D128))
 		scr |= SCR_EL3_D128En;
 
+	if (mrs_field(ID_AA64MMFR3_EL1, SCTLRX))
+		scr |= SCR_EL3_SCTLR2En;
+
 	msr(SCR_EL3, scr);
 
 	msr(CPTR_EL3, cptr);
-- 
2.25.1



  parent reply	other threads:[~2024-07-23 11:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-23 11:06 [boot-wrapper 0/3] aarch64: Enable access for FEAT_D128 registers in EL1/EL2 Anshuman Khandual
2024-07-23 11:06 ` [boot-wrapper 1/3] aarch64: Enable access into 128 bit system registers from EL2 and below Anshuman Khandual
2024-07-25  8:44   ` Mark Rutland
2024-07-26  7:12     ` Anshuman Khandual
2024-07-23 11:06 ` Anshuman Khandual [this message]
2024-07-25  8:40   ` [boot-wrapper 2/3] aarch64: Enable access into SCTLR2_ELx " Mark Rutland
2024-07-26  6:55     ` Anshuman Khandual
2024-07-26  8:45       ` Mark Rutland
2024-07-23 11:06 ` [boot-wrapper 3/3] aarch64: Enable access into RCW[S]MASK_EL1 " Anshuman Khandual
2024-07-25  8:51   ` Mark Rutland
2024-07-26  8:31     ` Anshuman Khandual

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=20240723110630.483871-3-anshuman.khandual@arm.com \
    --to=anshuman.khandual@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@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