Re: [PATCH v8 20/29] s390: Introduce Start Arm Execution instruction
From: Ilya Leoshkevich
Date: Mon Sep 28 2026 - 11:58:15 EST
On 9/18/26 15:30, Steffen Eiden wrote:
The Start Arm Execution (SAE) instruction is the centerpiece for^^^^^^^^
executing arm64 (KVM) guests on s390. Its purpose is, similar to SIE, to
enable accelerated execution of arm64 virtual machines. SAE expects the
physical address of a control block as the only argument.
The host is responsible to save & restore
- GPRs 0-13
- access register 0-15
registers> - breaking event register (BEAR)
- vector/floating point registers^^^^^^^^^^^^^^^^^
between SAE executions to guarantee host consistency.
GPRs and BEAR are save and restores in the asm functions. The other
saved and restored
register are handled in within C code. Access registers are handled in a^^^^^^^^ ^^
registers not needed probably?
later patch and SVEs will be handled when they are introduced in a
future series. Most arm64 registers are handled by a satellite block
called save_area. Some registers, frequently used by hypervisors, are
placed into the SAE control block itself.
Enlighten asm/kvm_host_types.h for the new header variant. The new
header is chosen instead of asm/kvm_host_s390_types.h if KVM_S390_ARM64
is defined.
Co-developed-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
Signed-off-by: Andreas Grapentin <gra@xxxxxxxxxxxxx>
Co-developed-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>
Signed-off-by: Nina Schoetterl-Glausch <nsg@xxxxxxxxxxxxx>
Signed-off-by: Steffen Eiden <seiden@xxxxxxxxxxxxx>
---
arch/s390/include/asm/asm-prototypes.h | 1 +
arch/s390/include/asm/kvm_host_arm64_types.h | 124 +++++++++++++++++++
arch/s390/include/asm/kvm_host_types.h | 4 +
arch/s390/include/asm/sae.h | 58 +++++++++
arch/s390/include/asm/stacktrace.h | 5 +
arch/s390/kernel/asm-offsets.c | 1 +
arch/s390/kernel/entry.S | 22 ++++
arch/s390/tools/opcodes.txt | 3 +
8 files changed, 218 insertions(+)
create mode 100644 arch/s390/include/asm/kvm_host_arm64_types.h
create mode 100644 arch/s390/include/asm/sae.h
[...]
> +#if IS_ENABLED(CONFIG_KVM)
+/*^^^^^^^^^^ I guess it's just a physical address and not a
+ * __sae64a calling convention:
+ * %r2 pointer to sae control block physical address
pointer to it?
^^^ sometimes it's called "sae", sometimes "SAE" -
it would be nice to have some consistency> + */
+SYM_FUNC_START(__sae64a)
+ stmg %r6,%r14,__SF_GPRS(%r15) # store kernel registers
Strictly speaking we don't need to save %r14, but I guess you do this
for unwinding?
+ STBEAR __SF_SAE_BEAR(%r15) # save breaking event address register[...]
+ .insn rre,0xb9a50000,%r2,0 # Start Arm Execution
+ LBEAR __SF_SAE_BEAR(%r15) # restore breaking event address register
+ lmg %r6,%r14,__SF_GPRS(%r15) # restore kernel registers
+ xgr %r0,%r0 # clear guest registers to
+ xgr %r1,%r1 # prevent speculative use
+ xgr %r2,%r2
+ xgr %r3,%r3
+ xgr %r4,%r4
+ xgr %r5,%r5
+ BR_EX %r14
+SYM_FUNC_END(__sae64a)
+EXPORT_SYMBOL(__sae64a)
+#endif