Skip to contentSkip to conversation

xen/arm32: SPSR_hyp/SPSR

PATCH In review Stefano Stabellini 3 participants 4 messages Jun 9, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm32: SPSR_hyp/SPSR

SPSR_hyp is not meant to be accessed from Hyp mode (EL2); accesses trigger UNPREDICTABLE behaviour. Xen should read/write SPSR instead.

This fixes booting Xen/arm32 on QEMU.

---
 xen/arch/arm/arm32/entry.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/arm/arm32/entry.S +2 -2
index f2f1bc7a31..4e421109db 100644
@@ -170,7 +170,7 @@ ENDPROC(prepare_context_from_guest)
         mrc     CP32(r11, HSR)                 /* Save exception syndrome */
         str     r11, [sp, #UREGS_hsr]
 
-        mrs     r11, SPSR_hyp
+        mrs     r11, SPSR
         str     r11, [sp, #UREGS_cpsr]
 
         /*
@@ -395,7 +395,7 @@ return_to_hypervisor:
         ldr r11, [sp, #UREGS_pc]
         msr ELR_hyp, r11
         ldr r11, [sp, #UREGS_cpsr]
-        msr SPSR_hyp, r11
+        msr SPSR, r11
 #ifdef CONFIG_ARM32_HARDEN_BRANCH_PREDICTOR
         /*
          * Hardening branch predictor may require to setup a different
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw

Hi Stefano,

Quoted 2 lines · Stefano Stabellini

SPSR_hyp is not meant to be accessed from Hyp mode (EL2); accesses trigger UNPREDICTABLE behaviour. Xen should read/write SPSR instead.

Please provide a reference to the spec. This helps reviewer and/or future developper to figure out quickly where this comes from.

Quoted 4 lines

This fixes booting Xen/arm32 on QEMU.

With the reference added:

Cheers,

Signature · 1 line
Julien Grall
Reviewed-by Tested-by
#2 lore raw
Quoted 10 lines · Julien Grall

Hi Stefano,

Quoted 2 lines · Stefano Stabellini

SPSR_hyp is not meant to be accessed from Hyp mode (EL2); accesses trigger UNPREDICTABLE behaviour. Xen should read/write SPSR instead.

Please provide a reference to the spec. This helps reviewer and/or future developper to figure out quickly where this comes from.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

This fixes booting Xen/arm32 on QEMU.

With the reference added:

Cheers,
Edgar

#3 lore raw
In reply to Julien Grall
Quoted 10 lines · Julien Grall

Hi Stefano,

Quoted 2 lines · Stefano Stabellini

SPSR_hyp is not meant to be accessed from Hyp mode (EL2); accesses trigger UNPREDICTABLE behaviour. Xen should read/write SPSR instead.

Please provide a reference to the spec. This helps reviewer and/or future developper to figure out quickly where this comes from.

Quoted 1 line
Quoted 7 lines
Quoted 3 lines

This fixes booting Xen/arm32 on QEMU.

With the reference added:

Thanks!

I added: ARM DDI 0487D.b page G8-5993 and committed it