Skip to contentSkip to conversation

xen/arm64: Correctly align VFP regs

PATCH In review Julien Grall 2 participants 2 messages Apr 10, 2014 – Apr 16, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm64: Correctly align VFP regs

On arm64, VFP instructions requires vfpregs to be 128-byte aligned.

By chance, the field is already correctly aligned. In the case if someone decides to add a new field before, Xen will receive a data abort as soon as it saves/restores VFP.

We are safe on arm32 as the only constraint is to be 32-byte aligned.

---
I think this patch is a good candidate for backporting to Xen 4.4

---
 xen/include/asm-arm/arm64/vfp.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
xen/include/asm-arm/arm64/vfp.h +4 -1
index 373f156..6ab5d36 100644
@@ -1,9 +1,12 @@
 #ifndef _ARM_ARM64_VFP_H
 #define _ARM_ARM64_VFP_H
 
+/* ARM64 VFP instruction requires fpregs address to be 128-byte aligned */
+#define __vfp_aligned __attribute__((aligned(16)))
+
 struct vfp_state
 {
-    uint64_t fpregs[64];
+    uint64_t fpregs[64] __vfp_aligned;
     uint32_t fpcr;
     uint32_t fpexc32_el2;
     uint32_t fpsr;
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 10 lines · Julien Grall

On arm64, VFP instructions requires vfpregs to be 128-byte aligned.

By chance, the field is already correctly aligned. In the case if someone decides to add a new field before, Xen will receive a data abort as soon as it saves/restores VFP.

We are safe on arm32 as the only constraint is to be 32-byte aligned.

Acked + applied.

Quoted 2 lines

---
I think this patch is a good candidate for backporting to Xen 4.4

noted