Re: (subset) [PATCH v9 00/24] KVM: s390: Introduce arm64 KVM
From: Marc Zyngier
Date: Thu Oct 01 2026 - 11:20:08 EST
On Thu, 01 Oct 2026 14:27:15 +0100,
Steffen Eiden <seiden@xxxxxxxxxxxxx> wrote:
>
> On Thu, Oct 01, 2026 at 12:04:51PM +0100, Marc Zyngier wrote:
> > On Wed, 30 Sep 2026 19:34:15 +0200, Steffen Eiden wrote:
> > > Introduce arm-on-s390. Enable KVM-accelerated ARM CPU virtualisation on s390.
> > >
> > > The new KVM functionally depends on KVM/vfio: Use file-based reference
> > > counting for KVM [5] The series itself should apply w/o those.
> > >
> > > For the original, now partially outdated, cover letter, have a look at versions
> > > one to three [1].
> > >
> > > [...]
> >
> > Applied to next, thanks!
> >
> > [05/24] arm64: ptrace: Use constants for compat register numbers
> > commit: 295d3df9b1e425099a4eb37954a02c4a08fdb496
> > [06/24] arm64: sysreg: Convert SPSR_ELx to automatic register generation
> > commit: d3d78520068779779e1ed7aa0dd8a3ce63e1ca43
> > [07/24] KVM: arm64: Access elements of vcpu_gp_regs individually
> > commit: 29d92585ab987bb80b1e78d811aaea2a8db86e62
> > [08/24] KVM: arm64: Use accessor functions for core regs
> > commit: 89ed62818f10e38e64fea46d43ee6455a1beb647
> > [09/24] arm64: Prepare sharing arm64 headers with s390
> > commit: df6a70516adec8b7f5fa49e1755d8ee33d980d9c
> > [10/24] arm64: Share arm64 headers with s390
> > commit: c7e18ba462536e870b0ff4deca581babcac9135b
> > [11/24] KVM: arm64: Share arm64 code with s390
> > commit: dcb776bfcccc9662001a75b99dbfbef55f46eb31
> >
> > Note that there were a few conflicts. Please check that I resolved
> > them correctly.
>
>
> After rebasing on those the arm-on-s390 part does not build anymore :(
Well, that's sort of expected. The kvmarm tree doesn't have the S390
stuff yet, and contains tons of new stuff.
> We are missing the definition of
> static __always_inline bool esr_abt_is_s1ptw(unsigned long esr)
>
>
> quick fix:
>
> on top of [10/24] arm64: Share arm64 headers with s390
>
> diff --git a/arch/arm64/include/asm/kvm_emulate.h b/arch/arm64/include/asm/kvm_emulate.h
> index bf35cbe8ddcb..0708f792c631 100644
> --- a/arch/arm64/include/asm/kvm_emulate.h
> +++ b/arch/arm64/include/asm/kvm_emulate.h
> @@ -367,10 +367,13 @@ static __always_inline u64 kvm_vcpu_get_esr(const struct kvm_vcpu *vcpu)
> return vcpu->arch.fault.esr_el2;
> }
>
> +#if ARM64_S390_COMMON == 1
> static __always_inline bool esr_abt_is_s1ptw(unsigned long esr)
> {
> return esr & ESR_ELx_S1PTW;
> }
> +
> +#endif /* ARM64_S390_COMMON == 1 */
>
> static __always_inline bool esr_abt_is_exec_fault(unsigned long esr)
> {
>
>
>
> A cleaner solution it to move this defenition just below
> void kvm_vcpu_wfi(struct kvm_vcpu *vcpu) in
> [09/24] arm64: Prepare sharing arm64 headers with s390
> and expand the shared region in the following patch.
I'm redoing the merge and fixing it as follows (note that the
ARM64_S390_COMMON guards are already present):
@@ -336,16 +367,6 @@ static __always_inline u64 kvm_vcpu_get_esr(const struct kvm_vcpu *vcpu)
return vcpu->arch.fault.esr_el2;
}
-static __always_inline bool esr_abt_is_s1ptw(unsigned long esr)
-{
- return esr & ESR_ELx_S1PTW;
-}
-
-static __always_inline bool esr_abt_is_exec_fault(unsigned long esr)
-{
- return esr_trap_is_iabt(esr) && !esr_abt_is_s1ptw(esr);
-}
-
static inline bool guest_hyp_wfx_traps_enabled(const struct kvm_vcpu *vcpu)
{
u64 esr = kvm_vcpu_get_esr(vcpu);
@@ -389,6 +410,12 @@ static inline u64 kvm_vcpu_get_disr(const struct kvm_vcpu *vcpu)
return vcpu->arch.fault.disr_el1;
}
+#if ARM64_S390_COMMON == 1
+static __always_inline bool esr_abt_is_s1ptw(unsigned long esr)
+{
+ return esr & ESR_ELx_S1PTW;
+}
+
static inline u32 kvm_vcpu_hvc_get_imm(const struct kvm_vcpu *vcpu)
{
return kvm_vcpu_get_esr(vcpu) & ESR_ELx_xVC_IMM_MASK;
@@ -456,6 +483,13 @@ static __always_inline u8 kvm_vcpu_trap_get_fault(const struct kvm_vcpu *vcpu)
return kvm_vcpu_get_esr(vcpu) & ESR_ELx_FSC;
}
+#endif /* ARM64_S390_COMMON == 1 */
+
+static __always_inline bool esr_abt_is_exec_fault(unsigned long esr)
+{
+ return esr_trap_is_iabt(esr) && !esr_abt_is_s1ptw(esr);
+}
+
static inline
bool kvm_vcpu_trap_is_permission_fault(const struct kvm_vcpu *vcpu)
{
Does this work for you?
M.
--
Without deviation from the norm, progress is not possible.