[PATCH v4 23/27] KVM: s390: arm64: Implement required functions

Steffen Eiden seiden at linux.ibm.com
Fri Jul 10 06:40:49 PDT 2026


On Mon, Jul 06, 2026 at 09:35:54PM +0100, Marc Zyngier wrote:
> On Mon, 06 Jul 2026 09:52:23 +0100,
> Steffen Eiden <seiden at linux.ibm.com> wrote:
> > 
> > Implement the mostly trivial functions that the shared arm64 (kvm)
> > code & headers oblige s390 to implement.
> > 
> > Implement a very basic smccc handler that (non-compliantly) is just able
> > to stop a vcpu.
> > 
> > Signed-off-by: Steffen Eiden <seiden at linux.ibm.com>
> > ---
> >  arch/s390/include/arm64/kvm_emulate.h | 135 ++++++++++++++++++++++++++
> >  arch/s390/include/arm64/kvm_nested.h  |  11 +++
> >  arch/s390/kvm/arm64/handle_exit.c     | 110 +++++++++++++++++++++
> >  arch/s390/kvm/arm64/inject_fault.c    |  21 ++++
> >  4 files changed, 277 insertions(+)
> >  create mode 100644 arch/s390/include/arm64/kvm_emulate.h
> >  create mode 100644 arch/s390/include/arm64/kvm_nested.h
> >  create mode 100644 arch/s390/kvm/arm64/handle_exit.c
> >  create mode 100644 arch/s390/kvm/arm64/inject_fault.c

...

> > +
> > +#define SPSR_SS BIT(21)
> 
> We may be better off defining SPSR_ELx in the sysreg file and use that
> all over the place.
> 

make sense. I'll create a patch for this.

...

> > +
> > +#define __INCL_GEN_ARM_FILE
> > +#include "generated/handle_exit.inc"
> > +#undef __INCL_GEN_ARM_FILE
> > +
> > +#define PSCI_0_2_FN_SYSTEM_OFF		0x84000008
> > +#define PSCI_RET_NOT_SUPPORTED		-1
> > +#define PSCI_RET_INTERNAL_FAILURE	-6
> 
> All of this exists in include/uapi/linux/psci.h.

Yes. We'll use them in a later series as well.
this is just a placeholder implememtation so guests do not have to run
idefenitely. 


...

> > +	[ESR_ELx_EC_SOFTSTP_CUR]	= "Software Step (current EL)",
> > +	[ESR_ELx_EC_WATCHPT_LOW]	= "Watchpoint (lower EL)",
> > +	[ESR_ELx_EC_WATCHPT_CUR]	= "Watchpoint (current EL)",
> > +	[ESR_ELx_EC_BKPT32]		= "BKPT (AArch32)",
> > +	[ESR_ELx_EC_VECTOR32]		= "Vector catch (AArch32)",
> > +	[ESR_ELx_EC_BRK64]		= "BRK (AArch64)",
> > +};
> 
> There are a lot of AArch32-specific ECs here that you may not need.

you are absolutely right. This was just a blind 1to1 copy. IMO they do
not hurt but I can reduce 32 specific ones.

FYI
The code is not shared as I would have to spin up a whole sharing
infrastructure to share this one defenition from arm kernel code.

	Steffen



More information about the linux-arm-kernel mailing list