Skip to contentSkip to conversation

aarch64: Enable FGT for EL2

PATCH In review Marc Zyngier 4 participants 4 messages May 3, 2021 – May 4, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 aarch64: Enable FGT for EL2

We have no intention of handling FGT traps to EL3, so let EL2 play with the feature directly.

---

Notes:
Needed to boot Linux 5.13 at EL2.

 arch/aarch64/boot.S | 7 +++++++
 1 file changed, 7 insertions(+)
arch/aarch64/boot.S +7 -0
index e47cf59..fd7133d 100644
@@ -54,6 +54,13 @@ _start:
 	cbz	x1, 1f
 
 	orr	x0, x0, #(1 << 34)		// TME enable
+1:
+	/* Enable FGT if present */
+	mrs	x1, id_aa64mmfr0_el1
+	ubfx	x1, x1, #56, #4
+	cbz	x1, 1f
+
+	orr	x0, x0, #(1 << 27)		// FGT enable
 1:
 #ifndef KERNEL_32
 	orr	x0, x0, #(1 << 10)		// 64-bit EL2
Signature · 7 lines
2.29.2


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · On Mon, 3 May 2021 13:09:20 +0100 Marc Zyngier <[email protected]> wrote:

We have no intention of handling FGT traps to EL3, so let EL2 play with the feature directly.

Verified the bits used against the ARM ARM. Also Trusted Firmware does the same thing, so:

Cheers,
Andre

Quoted 16 lines

---

Notes:
Needed to boot Linux 5.13 at EL2.

 arch/aarch64/boot.S | 7 +++++++
 1 file changed, 7 insertions(+)
arch/aarch64/boot.S +0 -0
index e47cf59..fd7133d 100644
@@ -54,6 +54,13 @@ _start:
 	cbz	x1, 1f
 
 	orr	x0, x0, #(1 << 34)		// TME enable

arch/aarch64/boot.S _start: · line 66

Quoted 10 lines
arch/aarch64/boot.S +7 -0
+1:
+	/* Enable FGT if present */
+	mrs	x1, id_aa64mmfr0_el1
+	ubfx	x1, x1, #56, #4
+	cbz	x1, 1f
+
+	orr	x0, x0, #(1 << 27)		// FGT enable
 1:
 #ifndef KERNEL_32
 	orr	x0, x0, #(1 << 10)		// 64-bit EL2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Tested-by on v1 1/1
#2 lore raw
In reply to Marc Zyngier
Quoted 3 lines · Marc Zyngier

We have no intention of handling FGT traps to EL3, so let EL2 play with the feature directly.

I had cooked up hacky fix after Mark Brown pointed out this could be reason for boot failure on FVP. So,

Signature · 7 lines
Regards,
Sudeep

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#3 lore raw
In reply to Marc Zyngier
Quoted 4 lines · Marc Zyngier

We have no intention of handling FGT traps to EL3, so let EL2 play with the feature directly.

Thanks; applied.

Mark.

Quoted 29 lines

---

Notes:
Needed to boot Linux 5.13 at EL2.

 arch/aarch64/boot.S | 7 +++++++
 1 file changed, 7 insertions(+)
arch/aarch64/boot.S +7 -0
index e47cf59..fd7133d 100644
@@ -54,6 +54,13 @@ _start:
 	cbz	x1, 1f
 
 	orr	x0, x0, #(1 << 34)		// TME enable
+1:
+	/* Enable FGT if present */
+	mrs	x1, id_aa64mmfr0_el1
+	ubfx	x1, x1, #56, #4
+	cbz	x1, 1f
+
+	orr	x0, x0, #(1 << 27)		// FGT enable
 1:
 #ifndef KERNEL_32
 	orr	x0, x0, #(1 << 10)		// 64-bit EL2
Signature · 1 line
2.29.2

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel