Skip to contentSkip to conversation

xen/arm64: Add support Clang build on arm64

PATCH Superseded Saman Dehghan 3 participants 13 messages Dec 9, 2025 – Dec 11, 2025

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm64: Add support Clang build on arm64

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

---
 xen/arch/arm/arch.mk     | 1 +
 xen/arch/arm/arm64/vfp.c | 6 ++++++
 2 files changed, 7 insertions(+)
xen/arch/arm/arch.mk +1 -0
index 9c4bedfb3b..bcf548069b 100644
@@ -13,6 +13,7 @@ ifeq ($(CONFIG_MPU),y)
 CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
 else
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8
 endif
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
 $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
xen/arch/arm/arm64/vfp.c +6 -0
index c4f89c7b0e..51fd2ddc54 100644
@@ -46,6 +46,9 @@ static inline void restore_state(const uint64_t *fpregs)
                  : : "Q" (*fpregs), "r" (fpregs));
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_save_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )
@@ -62,6 +65,9 @@ void vfp_save_state(struct vcpu *v)
         v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_restore_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )
Signature · 1 line
2.49.0
#1 lore raw
Quoted 7 lines · Saman Dehghan

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

Quoted 5 lines
---
 xen/arch/arm/arch.mk     | 1 +
 xen/arch/arm/arm64/vfp.c | 6 ++++++
 2 files changed, 7 insertions(+)

Please also update ./README then accordingly.

Quoted 13 lines
xen/arch/arm/arm64/vfp.c +3 -0
@@ -46,6 +46,9 @@ static inline void restore_state(const uint64_t *fpregs)
                  : : "Q" (*fpregs), "r" (fpregs));
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_save_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )

xen/arch/arm/arm64/vfp.c void vfp_save_state(struct vcpu *v) · line 73

Quoted 9 lines
xen/arch/arm/arm64/vfp.c +3 -0
@@ -62,6 +65,9 @@ void vfp_save_state(struct vcpu *v)
         v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_restore_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )

Aren't it save_state() and restore_state() which actually use FP registers? Applying such attributes in too wide a fashion risks the compiler using FP registers also for other purposes. On x86 we were hit by such when we suppressed use of SSE registers while not suppressing use of MMX ones. In some configuration, after many years of this having gone fine, the compiler chose to use MMX insns for some odd reason.

Seeing that save_state() and restore_state() are a single asm() statement each, any reason not to actually have them in an assembly file, just like their SVE counterparts are?

Jan

#2 lore raw
Quoted 9 lines · Jan Beulich
Quoted 7 lines · Saman Dehghan

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

Quoted 7 lines
Quoted 5 lines
---
 xen/arch/arm/arch.mk     | 1 +
 xen/arch/arm/arm64/vfp.c | 6 ++++++
 2 files changed, 7 insertions(+)

Please also update ./README then accordingly.

Thank you, Jan, I will do that.

~Saman

Quoted 31 lines
Quoted 14 lines
xen/arch/arm/arm64/vfp.c +3 -0
@@ -46,6 +46,9 @@ static inline void restore_state(const uint64_t *fpregs)
                  : : "Q" (*fpregs), "r" (fpregs));
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_save_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )

xen/arch/arm/arm64/vfp.c void vfp_save_state(struct vcpu *v) · line 73

Quoted 9 lines
xen/arch/arm/arm64/vfp.c +3 -0
@@ -62,6 +65,9 @@ void vfp_save_state(struct vcpu *v)
         v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_restore_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )

Aren't it save_state() and restore_state() which actually use FP registers? Applying such attributes in too wide a fashion risks the compiler using FP registers also for other purposes. On x86 we were hit by such when we suppressed use of SSE registers while not suppressing use of MMX ones. In some configuration, after many years of this having gone fine, the compiler chose to use MMX insns for some odd reason.

Quoted 4 lines

Seeing that save_state() and restore_state() are a single asm() statement each, any reason not to actually have them in an assembly file, just like their SVE counterparts are?

On top of those, READ_SYSREG(FPSR), READ_SYSREG(FPCR), WRITE_SYSREG(v->arch.vfp.fpsr, FPSR)and WRITE_SYSREG(v->arch.vfp.fpcr, FPCR) using FP. I think I cannot apply __attribute__ on statements.

~Saman

Quoted 1 line

Jan

#3 lore raw

PATCH v2 1/1 xen/arm64: Add support Clang build on arm64

In reply to Saman Dehghan

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

---
 README                   | 2 ++
 xen/arch/arm/arch.mk     | 1 +
 xen/arch/arm/arm64/vfp.c | 6 ++++++
 3 files changed, 9 insertions(+)
README +2 -0
index 889a4ea906..67c1aa7fe6 100644
@@ -45,6 +45,8 @@ provided by your OS distributor:
       - For ARM:
         - GCC 5.1 or later
         - GNU Binutils 2.25 or later
+        or
+        - Clang/LLVM 11 or later
       - For RISC-V 64-bit:
         - GCC 12.2 or later
         - GNU Binutils 2.39 or later
xen/arch/arm/arch.mk +1 -0
index 9c4bedfb3b..bcf548069b 100644
@@ -13,6 +13,7 @@ ifeq ($(CONFIG_MPU),y)
 CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
 else
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8
 endif
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
 $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
xen/arch/arm/arm64/vfp.c +6 -0
index c4f89c7b0e..51fd2ddc54 100644
@@ -46,6 +46,9 @@ static inline void restore_state(const uint64_t *fpregs)
                  : : "Q" (*fpregs), "r" (fpregs));
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_save_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )
@@ -62,6 +65,9 @@ void vfp_save_state(struct vcpu *v)
         v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
 }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif
 void vfp_restore_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )
Signature · 1 line
2.49.0
#4 lore raw

Hi Saman,

A bit of process first. Usually, when sending a v2, a new thread is started (IOW, this is not sent in reply to v1).

Quoted 44 lines · Saman Dehghan

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

---
  README                   | 2 ++
  xen/arch/arm/arch.mk     | 1 +
  xen/arch/arm/arm64/vfp.c | 6 ++++++
  3 files changed, 9 insertions(+)
README +2 -0
index 889a4ea906..67c1aa7fe6 100644
@@ -45,6 +45,8 @@ provided by your OS distributor:
        - For ARM:
          - GCC 5.1 or later
          - GNU Binutils 2.25 or later
+        or
+        - Clang/LLVM 11 or later
        - For RISC-V 64-bit:
          - GCC 12.2 or later
          - GNU Binutils 2.39 or later
xen/arch/arm/arch.mk +1 -0
index 9c4bedfb3b..bcf548069b 100644
@@ -13,6 +13,7 @@ ifeq ($(CONFIG_MPU),y)
  CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
  else
  CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8
  endif
  CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
  $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
xen/arch/arm/arm64/vfp.c +0 -0
index c4f89c7b0e..51fd2ddc54 100644

xen/arch/arm/arm64/vfp.c static inline void restore_state(const uint64_t *fpregs) · line 51

Quoted 6 lines
xen/arch/arm/arm64/vfp.c +3 -0
@@ -46,6 +46,9 @@ static inline void restore_state(const uint64_t *fpregs)
                   : : "Q" (*fpregs), "r" (fpregs));
  }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif

Based on Jan's comment, I am a bit puzzled why adding #ifdef is sufficient. In fact, I do agree with Jan, my understanding of target(...) is this will impact the ABI.

I haven't experienced any issue with the C side yet. But I know in the Rust world (they also have an LLVM backend), they decided to prevent enabling fp/neon [1] at the function level.

Did you find any documentation that would suggest this is safe?

Now regarding the issue you mentioned in v1:

Quoted 4 lines
xen/arch/arm/arm64/vfp.c +0 -0
 On top of those, `READ_SYSREG(FPSR)`, `READ_SYSREG(FPCR)`,

WRITE_SYSREG(v->arch.vfp.fpsr, FPSR)and WRITE_SYSREG(v->arch.vfp.fpcr, FPCR) using FP. I think I cannot apply __attribute__ on statements.

Do you mean the compiler will complain that you are trying to access FPCR/FPSR if you don't add the __atribute__ at the function level?

If so, what you could possibly do is either rewriting the functions in assembly or open-code the "{WRITE, READ}_SYSREG()" and add a line ".arch_extension fp".

Cheers,

[1] https://github.com/llvm/llvm-project/issues/110632

Signature · 1 line
Julien Grall
#5 lore raw
Quoted 5 lines · Julien Grall

Hi Saman,

A bit of process first. Usually, when sending a v2, a new thread is started (IOW, this is not sent in reply to v1).

Hi Julien,

Thanks :)

Quoted 70 lines · Saman Dehghan
Quoted 44 lines

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

---
  README                   | 2 ++
  xen/arch/arm/arch.mk     | 1 +
  xen/arch/arm/arm64/vfp.c | 6 ++++++
  3 files changed, 9 insertions(+)
README +2 -0
index 889a4ea906..67c1aa7fe6 100644
@@ -45,6 +45,8 @@ provided by your OS distributor:
        - For ARM:
          - GCC 5.1 or later
          - GNU Binutils 2.25 or later
+        or
+        - Clang/LLVM 11 or later
        - For RISC-V 64-bit:
          - GCC 12.2 or later
          - GNU Binutils 2.39 or later
xen/arch/arm/arch.mk +1 -0
index 9c4bedfb3b..bcf548069b 100644
@@ -13,6 +13,7 @@ ifeq ($(CONFIG_MPU),y)
  CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
  else
  CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8
  endif
  CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
  $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
xen/arch/arm/arm64/vfp.c +0 -0
index c4f89c7b0e..51fd2ddc54 100644

xen/arch/arm/arm64/vfp.c static inline void restore_state(const uint64_t *fpregs) · line 51

Quoted 6 lines
xen/arch/arm/arm64/vfp.c +3 -0
@@ -46,6 +46,9 @@ static inline void restore_state(const uint64_t *fpregs)
                   : : "Q" (*fpregs), "r" (fpregs));
  }
 
+#if defined(CONFIG_CC_IS_CLANG)
+__attribute__((target("fp-armv8")))
+#endif

Based on Jan's comment, I am a bit puzzled why adding #ifdef is sufficient. In fact, I do agree with Jan, my understanding of target(...) is this will impact the ABI.

I haven't experienced any issue with the C side yet. But I know in the Rust world (they also have an LLVM backend), they decided to prevent enabling fp/neon [1] at the function level.

Did you find any documentation that would suggest this is safe?

Now regarding the issue you mentioned in v1:

Quoted 4 lines
xen/arch/arm/arm64/vfp.c +0 -0
 On top of those, `READ_SYSREG(FPSR)`, `READ_SYSREG(FPCR)`,

WRITE_SYSREG(v->arch.vfp.fpsr, FPSR)and WRITE_SYSREG(v->arch.vfp.fpcr, FPCR) using FP. I think I cannot apply __attribute__ on statements.

Quoted 6 lines

Do you mean the compiler will complain that you are trying to access FPCR/FPSR if you don't add the __atribute__ at the function level?

If so, what you could possibly do is either rewriting the functions in assembly or open-code the "{WRITE, READ}_SYSREG()" and add a line ".arch_extension fp".

I couldn't find any documentation to suggest that it is safe. I will do what you and Jan suggested and use ".arch_extension fp".

~Saman

Quoted 8 lines

Cheers,

[1] https://github.com/llvm/llvm-project/issues/110632

--
Julien Grall

#6 lore raw
In reply to Saman Dehghan
Quoted 19 lines · Saman Dehghan

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

---
  README                   | 2 ++
  xen/arch/arm/arch.mk     | 1 +
  xen/arch/arm/arm64/vfp.c | 6 ++++++
  3 files changed, 9 insertions(+)
README +0 -0
index 889a4ea906..67c1aa7fe6 100644

README provided by your OS distributor: · line 49

Quoted 5 lines
README +2 -0
@@ -45,6 +45,8 @@ provided by your OS distributor:
        - For ARM:
          - GCC 5.1 or later
          - GNU Binutils 2.25 or later
+        or
+        - Clang/LLVM 11 or later

I forgot to ask. Is this cross-compiling or native? Or both?

And OOI, how did you chose Clang 11?

Cheers,

Signature · 1 line
Julien Grall
#7 lore raw
Quoted 31 lines · Julien Grall
Quoted 19 lines · Saman Dehghan

This patch enables building Xen on arm64 architecture using the Clang compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Add __attribute__((target("fp-armv8"))) to vfp_save_state and vfp_restore_state functions when building with Clang to allow FP instructions despite -mgeneral-regs-only.

---
  README                   | 2 ++
  xen/arch/arm/arch.mk     | 1 +
  xen/arch/arm/arm64/vfp.c | 6 ++++++
  3 files changed, 9 insertions(+)
README +0 -0
index 889a4ea906..67c1aa7fe6 100644

README provided by your OS distributor: · line 49

Quoted 5 lines
README +2 -0
@@ -45,6 +45,8 @@ provided by your OS distributor:
        - For ARM:
          - GCC 5.1 or later
          - GNU Binutils 2.25 or later
+        or
+        - Clang/LLVM 11 or later

I forgot to ask. Is this cross-compiling or native? Or both?

Quoted 1 line

And OOI, how did you chose Clang 11?

Hi Julien,

To be consistent with minimum requirements for Clang/LLVM on x86.

~Saman

Quoted 6 lines

Cheers,

--
Julien Grall

#8 lore raw

Hi,

Quoted 5 lines · Saman Dehghan
Quoted 1 line

And OOI, how did you chose Clang 11?

Hi Julien,

To be consistent with minimum requirements for Clang/LLVM on x86.

To double check did you try the version and confirm every works?

Cheers,

Signature · 1 line
Julien Grall
#9 lore raw
Quoted 11 lines · Julien Grall

Hi,

Quoted 5 lines · Saman Dehghan
Quoted 1 line

And OOI, how did you chose Clang 11?

Hi Julien,

To be consistent with minimum requirements for Clang/LLVM on x86.

To double check did you try the version and confirm every works?

Hi Julien,

I compiled and booted Xen with Clang-{11 - 20} on both native and CROSS_COMPILE=aarch64-linux-gnu-.

~Saman

Quoted 6 lines

Cheers,

--
Julien Grall

#10 lore raw

PATCH v3 1/1 xen/arm64: Add support Clang build on arm64

In reply to Saman Dehghan

This patch enables building Xen for the arm64 using the Clang/LLVM compiler. Changes include:
- Add explicit -march=armv8 flag for arm64 builds.
- Introduce READ_FP_SYSREG and WRITE_FP_SYSREG to encapsulate the required .arch_extension fp directive for system fp register access.
- Add ".arch_extension fp" to the inline assembly for save_state and restore_state.

---
 README                   |  2 ++
 xen/arch/arm/arch.mk     |  1 +
 xen/arch/arm/arm64/vfp.c | 30 ++++++++++++++++++++++--------
 3 files changed, 25 insertions(+), 8 deletions(-)
README +2 -0
index 889a4ea906..67c1aa7fe6 100644
@@ -45,6 +45,8 @@ provided by your OS distributor:
       - For ARM:
         - GCC 5.1 or later
         - GNU Binutils 2.25 or later
+        or
+        - Clang/LLVM 11 or later
       - For RISC-V 64-bit:
         - GCC 12.2 or later
         - GNU Binutils 2.39 or later
xen/arch/arm/arch.mk +1 -0
index 9c4bedfb3b..bcf548069b 100644
@@ -13,6 +13,7 @@ ifeq ($(CONFIG_MPU),y)
 CFLAGS-$(CONFIG_ARM_64) += -march=armv8-r
 else
 CFLAGS-$(CONFIG_ARM_64) += -mcpu=generic
+CFLAGS-$(CONFIG_ARM_64) += -march=armv8
 endif
 CFLAGS-$(CONFIG_ARM_64) += -mgeneral-regs-only # No fp registers etc
 $(call cc-option-add,CFLAGS-$(CONFIG_ARM_64),CC,-mno-outline-atomics)
xen/arch/arm/arm64/vfp.c +22 -8
index c4f89c7b0e..ea75c7a2b2 100644
@@ -6,7 +6,8 @@
 
 static inline void save_state(uint64_t *fpregs)
 {
-    asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"
+    asm volatile(".arch_extension fp\n\t"
+                 "stp q0, q1, [%1, #16 * 0]\n\t"
                  "stp q2, q3, [%1, #16 * 2]\n\t"
                  "stp q4, q5, [%1, #16 * 4]\n\t"
                  "stp q6, q7, [%1, #16 * 6]\n\t"
@@ -27,7 +28,8 @@ static inline void save_state(uint64_t *fpregs)
 
 static inline void restore_state(const uint64_t *fpregs)
 {
-    asm volatile("ldp q0, q1, [%1, #16 * 0]\n\t"
+    asm volatile(".arch_extension fp\n\t"
+                 "ldp q0, q1, [%1, #16 * 0]\n\t"
                  "ldp q2, q3, [%1, #16 * 2]\n\t"
                  "ldp q4, q5, [%1, #16 * 4]\n\t"
                  "ldp q6, q7, [%1, #16 * 6]\n\t"
@@ -46,6 +48,18 @@ static inline void restore_state(const uint64_t *fpregs)
                  : : "Q" (*fpregs), "r" (fpregs));
 }
 
+#define WRITE_FP_SYSREG(v, name) do {                               \
+    uint64_t _r = (v);                                              \
+    asm volatile(".arch_extension fp\n\t"                           \
+                 "msr "__stringify(name)", %0" : : "r" (_r));       \
+} while (0)
+
+#define READ_FP_SYSREG(name) ({                                     \
+    uint64_t _r;                                                    \
+    asm volatile(".arch_extension fp\n\t"                           \
+                 "mrs  %0, "__stringify(name) : "=r" (_r));         \
+    _r; })
+
 void vfp_save_state(struct vcpu *v)
 {
     if ( !cpu_has_fp )
@@ -56,10 +70,10 @@ void vfp_save_state(struct vcpu *v)
     else
         save_state(v->arch.vfp.fpregs);
 
-    v->arch.vfp.fpsr = READ_SYSREG(FPSR);
-    v->arch.vfp.fpcr = READ_SYSREG(FPCR);
+    v->arch.vfp.fpsr = READ_FP_SYSREG(FPSR);
+    v->arch.vfp.fpcr = READ_FP_SYSREG(FPCR);
     if ( is_32bit_domain(v->domain) )
-        v->arch.vfp.fpexc32_el2 = READ_SYSREG(FPEXC32_EL2);
+        v->arch.vfp.fpexc32_el2 = READ_FP_SYSREG(FPEXC32_EL2);
 }
 
 void vfp_restore_state(struct vcpu *v)
@@ -72,8 +86,8 @@ void vfp_restore_state(struct vcpu *v)
     else
         restore_state(v->arch.vfp.fpregs);
 
-    WRITE_SYSREG(v->arch.vfp.fpsr, FPSR);
-    WRITE_SYSREG(v->arch.vfp.fpcr, FPCR);
+    WRITE_FP_SYSREG(v->arch.vfp.fpsr, FPSR);
+    WRITE_FP_SYSREG(v->arch.vfp.fpcr, FPCR);
     if ( is_32bit_domain(v->domain) )
-        WRITE_SYSREG(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
+        WRITE_FP_SYSREG(v->arch.vfp.fpexc32_el2, FPEXC32_EL2);
 }
Signature · 1 line
2.49.0
#11 lore raw

xen/arch/arm/arm64/vfp.c line 9

Quoted 8 lines · Saman Dehghan
xen/arch/arm/arm64/vfp.c +1 -1
@@ -6,7 +6,8 @@
 
 static inline void save_state(uint64_t *fpregs)
 {
-    asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"
+    asm volatile(".arch_extension fp\n\t"

This will take effect for the rest of the (generated) assembler file, which aiui isn't what you want.

Jan

#12 lore raw
Quoted 6 lines · Jan Beulich
Quoted 4 lines · Saman Dehghan
xen/arch/arm/arm64/vfp.c +0 -0
@@ -6,7 +6,8 @@
 
Quoted 7 lines

xen/arch/arm/arm64/vfp.c line 9

Quoted 4 lines
xen/arch/arm/arm64/vfp.c +1 -1
 static inline void save_state(uint64_t *fpregs)
 {
-    asm volatile("stp q0, q1, [%1, #16 * 0]\n\t"
+    asm volatile(".arch_extension fp\n\t"

This will take effect for the rest of the (generated) assembler file, which aiui isn't what you want.

Thanks Jan, I also noticed I forgot ".arch_extension nofp" just after sending the patch. Sorry about that.

~Saman

Quoted 2 lines

Jan