arm: Enable ns registers access in secure mode
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Thu, 16 Nov 2017 17:44:12 +0000 (17:44 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 1 Dec 2017 11:37:12 +0000 (11:37 +0000)
Arm security extension introduced register banking between secure and
non-secure mode. This has been removed in armv8 using AArch64 in EL3,
where the decoded register is by default the non-secure version. Using
non-secure register infos(flags) was preventing secure execution to
access the register with the MRC/MCR at EL1.
The patch updates the following banked registers' flags so that their
non-secure version can be accessed in secure mode:

MISCREG_CSSELR, MISCREG_SCTLR, MISCREG_ACTLR, MISCREG_TTBR0,
MISCREG_TTBR1, MISCREG_TTBCR, MISCREG_DACR, MISCREG_DFSR, MISCREG_IFSR,
MISCREG_ADFSR, MISCREG_AIFSR, MISCREG_DFAR, MISCREG_IFAR, MISCREG_PAR,
MISCREG_PRRR, MISCREG_MAIR0, MISCREG_NMRR, MISCREG_MAIR1,
MISCREG_AMAIR0, MISCREG_AMAIR1, MISCREG_VBAR, MISCREG_CONTEXTIDR,
MISCREG_TPIDRURW, MISCREG_TPIDRURO, MISCREG_TPIDRPRW, MISCREG_CNTP_TVAL,
MISCREG_CNTP_CTL, MISCREG_CNTP_CVAL

For those registers the following permission bits have been set:

MISCREG_PRI_S_RD
MISCREG_PRI_S_WR

Change-Id: Ib881c526e75d69e313f8ef66eb78fc704de6bf59
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-by: Giacomo Gabrielli <giacomo.gabrielli@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/6201
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Maintainer: Andreas Sandberg <andreas.sandberg@arm.com>

src/arch/arm/miscregs.cc

index d31c84ca625ad6474d8b2fff30960137bf79ac16..d08f75142171dff27bbc1c7ec251e0b94ff0e02e 100644 (file)
@@ -344,7 +344,7 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_CSSELR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_CSSELR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_CSSELR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_VPIDR
@@ -354,13 +354,13 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_SCTLR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_SCTLR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_SCTLR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_ACTLR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_ACTLR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_ACTLR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_CPACR
@@ -388,19 +388,19 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_TTBR0
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_TTBR0_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_TTBR0_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_TTBR1
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_TTBR1_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_TTBR1_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_TTBCR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_TTBCR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_TTBCR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_HTCR
@@ -410,31 +410,31 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_DACR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_DACR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_DACR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_DFSR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_DFSR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_DFSR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_IFSR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_IFSR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_IFSR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_ADFSR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010100")),
     // MISCREG_ADFSR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100100")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100100")),
     // MISCREG_ADFSR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100100")),
     // MISCREG_AIFSR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010100")),
     // MISCREG_AIFSR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100100")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100100")),
     // MISCREG_AIFSR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100100")),
     // MISCREG_HADFSR
@@ -446,13 +446,13 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_DFAR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_DFAR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_DFAR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_IFAR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_IFAR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_IFAR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_HDFAR
@@ -468,7 +468,7 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_PAR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_PAR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_PAR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_ICIALLU
@@ -618,37 +618,37 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_PRRR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_PRRR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_PRRR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_MAIR0
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_MAIR0_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_MAIR0_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_NMRR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_NMRR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_NMRR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_MAIR1
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_MAIR1_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_MAIR1_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_AMAIR0
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_AMAIR0_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_AMAIR0_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_AMAIR1
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_AMAIR1_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_AMAIR1_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_HMAIR0
@@ -662,7 +662,7 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_VBAR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_VBAR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_VBAR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_MVBAR
@@ -678,25 +678,25 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_CONTEXTIDR
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_CONTEXTIDR_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_CONTEXTIDR_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_TPIDRURW
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_TPIDRURW_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100111111100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111111111100001")),
     // MISCREG_TPIDRURW_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_TPIDRURO
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_TPIDRURO_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110101100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110101100001")),
     // MISCREG_TPIDRURO_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_TPIDRPRW
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_TPIDRPRW_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100110000100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111110000100001")),
     // MISCREG_TPIDRPRW_S
     bitset<NUM_MISCREG_INFOS>(string("00110011000000100001")),
     // MISCREG_HTPIDR
@@ -708,13 +708,13 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_CNTP_TVAL
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_CNTP_TVAL_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100111111100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111111111100001")),
     // MISCREG_CNTP_TVAL_S
     bitset<NUM_MISCREG_INFOS>(string("00110011001111100000")),
     // MISCREG_CNTP_CTL
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_CNTP_CTL_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100111111100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111111111100001")),
     // MISCREG_CNTP_CTL_S
     bitset<NUM_MISCREG_INFOS>(string("00110011001111100000")),
     // MISCREG_CNTV_TVAL
@@ -762,7 +762,7 @@ bitset<NUM_MISCREG_INFOS> miscRegInfo[NUM_MISCREGS] = {
     // MISCREG_CNTP_CVAL
     bitset<NUM_MISCREG_INFOS>(string("00000000000000010001")),
     // MISCREG_CNTP_CVAL_NS
-    bitset<NUM_MISCREG_INFOS>(string("11001100111111100001")),
+    bitset<NUM_MISCREG_INFOS>(string("11001111111111100001")),
     // MISCREG_CNTP_CVAL_S
     bitset<NUM_MISCREG_INFOS>(string("00110011001111100000")),
     // MISCREG_CNTV_CVAL