Skip to contentSkip to conversation

ARM: Drop ThumbEE support

PATCH In review Andrew Cooper 2 participants 2 messages Dec 4, 2025

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: Drop ThumbEE support

It was reported that Xen no longer builds on Debian unstable/sid.

Assembler messages:
{standard input}:474: Error: unknown or missing system register name at operand 1 -- msr TEECR32_EL1,x0' {standard input}:480: Error: unknown or missing system register name at operand 1 -- msr TEEHBR32_EL1,x0' {standard input}:488: Error: unknown or missing system register name at operand 2 -- mrs x0,TEECR32_EL1' {standard input}:494: Error: unknown or missing system register name at operand 2 -- mrs x0,TEEHBR32_EL1' make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1

This turns out to be an intentional change in binutils. ThumbEE was dropped ahead of ARM v8 (i.e. AArch64).

Xen supports ARM v7+virt extensions so in principle we could #ifdef CONFIG_ARM_32 to keep it working. However, there was apparently no use of ThumbEE outside of demo code, so simply drop it.

On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and drop the context switching logic for TEE{CR,HBR}32.

---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Volodymyr Babchuk <[email protected]>
CC: Bertrand Marquis <[email protected]>
CC: Michal Orzel <[email protected]>
CC: Jan Beulich <[email protected]>
CC: Hans van Kranenburg <[email protected]>
CC: Maximilian Engelhardt <[email protected]>

v2:
* Trap ThumbEE
* s/Trixie/Sid/ in the commit message

https://gitlab.com/xen-project/hardware/xen-staging/-/pipelines/2195763116

Bintuils link:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=8c0024ca8f6c01fc45f081f5ef11c9a6a1c24eb0

---
 xen/arch/arm/domain.c                | 12 ------------
 xen/arch/arm/include/asm/domain.h    |  1 -
 xen/arch/arm/include/asm/processor.h |  1 +
 xen/arch/arm/traps.c                 |  4 ++--
 4 files changed, 3 insertions(+), 15 deletions(-)
xen/arch/arm/domain.c +0 -12
index ab7844433597..3e32a15cac7a 100644
@@ -111,12 +111,6 @@ static void ctxt_switch_from(struct vcpu *p)
     p->arch.cntkctl = READ_SYSREG(CNTKCTL_EL1);
     virt_timer_save(p);
 
-    if ( is_32bit_domain(p->domain) && cpu_has_thumbee )
-    {
-        p->arch.teecr = READ_SYSREG(TEECR32_EL1);
-        p->arch.teehbr = READ_SYSREG(TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     p->arch.joscr = READ_CP32(JOSCR);
     p->arch.jmcr = READ_CP32(JMCR);
@@ -244,12 +238,6 @@ static void ctxt_switch_to(struct vcpu *n)
     WRITE_SYSREG(n->arch.tpidrro_el0, TPIDRRO_EL0);
     WRITE_SYSREG(n->arch.tpidr_el1, TPIDR_EL1);
 
-    if ( is_32bit_domain(n->domain) && cpu_has_thumbee )
-    {
-        WRITE_SYSREG(n->arch.teecr, TEECR32_EL1);
-        WRITE_SYSREG(n->arch.teehbr, TEEHBR32_EL1);
-    }
-
 #ifdef CONFIG_ARM_32
     WRITE_CP32(n->arch.joscr, JOSCR);
     WRITE_CP32(n->arch.jmcr, JMCR);
xen/arch/arm/include/asm/domain.h +0 -1
index af3e168374b4..758ad807e461 100644
@@ -211,7 +211,6 @@ struct arch_vcpu
     register_t hcr_el2;
     register_t mdcr_el2;
 
-    uint32_t teecr, teehbr; /* ThumbEE, 32-bit guests only */
 #ifdef CONFIG_ARM_32
     /*
      * ARMv8 only supports a trivial implementation on Jazelle when in AArch32
xen/arch/arm/include/asm/processor.h +1 -0
index 92c8bc1a3125..ec23fd098b63 100644
@@ -411,6 +411,7 @@
 
 /* HSTR Hyp. System Trap Register */
 #define HSTR_T(x)       ((_AC(1,U)<<(x)))       /* Trap Cp15 c<x> */
+#define HSTR_TTEE       (_AC(1,U)<<16)          /* Trap ThumbEE */
 
 /* HDCR Hyp. Debug Configuration Register */
 #define HDCR_TDRA       (_AC(1,U)<<11)          /* Trap Debug ROM access */
xen/arch/arm/traps.c +2 -2
index 2bc3e1df0416..040c0f2e0db1 100644
@@ -158,8 +158,8 @@ void init_traps(void)
     WRITE_SYSREG(HDCR_TDRA|HDCR_TDOSA|HDCR_TDA|HDCR_TPM|HDCR_TPMCR,
                  MDCR_EL2);
 
-    /* Trap CP15 c15 used for implementation defined registers */
-    WRITE_SYSREG(HSTR_T(15), HSTR_EL2);
+    /* Trap CP15 c15 used for implementation defined registers, and ThumbEE. */
+    WRITE_SYSREG(HSTR_T(15) | (cpu_has_thumbee ? HSTR_TTEE : 0), HSTR_EL2);
 
     WRITE_SYSREG(get_default_cptr_flags(), CPTR_EL2);
 

base-commit: 62bd4c2a8ee809c181d47098583270dc9db9300e

Signature · 1 line
2.39.5
Reviewed-by on v2 1/1
#1 lore raw

Hi Andrew,

Quoted 18 lines · Andrew Cooper

It was reported that Xen no longer builds on Debian unstable/sid.

Assembler messages:
{standard input}:474: Error: unknown or missing system register name at operand 1 -- msr TEECR32_EL1,x0' {standard input}:480: Error: unknown or missing system register name at operand 1 -- msr TEEHBR32_EL1,x0' {standard input}:488: Error: unknown or missing system register name at operand 2 -- mrs x0,TEECR32_EL1' {standard input}:494: Error: unknown or missing system register name at operand 2 -- mrs x0,TEEHBR32_EL1' make[5]: *** [Rules.mk:249: arch/arm/domain.o] Error 1

This turns out to be an intentional change in binutils. ThumbEE was dropped ahead of ARM v8 (i.e. AArch64).

Xen supports ARM v7+virt extensions so in principle we could #ifdef CONFIG_ARM_32 to keep it working. However, there was apparently no use of ThumbEE outside of demo code, so simply drop it.

Quoted 5 lines

On ThumbEE capable hardware, unconditionally trap ThumbEE instructions, and drop the context switching logic for TEE{CR,HBR}32.

Looks good to me:

Cheers
Bertrand