[PATCH v7 11/23] KVM: arm64: Share arm64 code with s390

Steffen Eiden seiden at linux.ibm.com
Wed Sep 2 05:41:52 PDT 2026


On Wed, Sep 02, 2026 at 08:41:27AM +0100, Marc Zyngier wrote:
> On Tue, 01 Sep 2026 09:40:37 +0100,
> Steffen Eiden <seiden at linux.ibm.com> wrote:
> > 
> > On Tue, Sep 01, 2026 at 09:13:56AM +0100, Marc Zyngier wrote:
> > > Why the exit handler, and not the EC handlers aside from the UNKNOWN
> > > one? Yes, you probably aren't there yet in this series, but I can tell
> > > you are going to add more and more of these.
> > > 
> > > But the EC array is absolutely architectural, and there is no good
> > > reason to maintain your own.
> > > 
> > > So instead of this, why not keep the EC array altogether, and
> > > implement stubs for the ECs you don't support?
> > > 
> > > 	M.
> > > 
> > 
> > There was no specific reasson to define our own EC array as far as I
> > remember. I will try reusing the array and find out if there are any
> > issues with that. But I do not expect any. 
> > 
> > I assume the stubs probably just forward to handle_unknown_ec, or do you
> > have a different suggestion?
> 
> Probably. This is an indication of something being deeply wrong in the
> implementation (HW or SW). On reflection, kvm_handle_unknown_ec()
> should result in a KVM_BUG().
> 
> 	M.
> 
> -- 
> Jazz isn't dead. It just smells funny.


While I tried to implement the change I noticed that it might be a good
idea to share most if not all EC functions defined in handle_exit.c
The handling is architectural as well and s390 and arm do (and should)
not differ in their implementation.

But switching stubs to a real shared implementation is not possible if
we want to not mix up changes in arm64 and s390 in one patch. I.e. in
one patch expand the shared region and remove the stub. But we would
neet to do that in one so the (s390) kernel keeps compiling.

So my suggestion is:

For series 1 (and 2) s390 has its own, local implementation of
handle_exit without sharing any code with arm64 in regard to EC

When s390 has all the relevant code available (likely series 3) s390 can
switch to using most (if not all) EC handling code used by
arm_exit_handlers implemented in handle_exit.c.

This can be done without a mixed patch:

1. Mark arm64 handle_exit.c as shared (roughly the first 400Loc w/o
   includes) - s390 will not use it after this patch.
2. remove the handle exit code from s390's handle_exit.c and include the
   new generated handle_exit.inc

This approach brings us further into the share architecture not only code
approach you meantrioned in the comments regarding sys-regs. (I or
Andreas will provide a solution for this later :) ) 

Is that OK with you, what do you think?
	
	Steffen



More information about the linux-arm-kernel mailing list