Re: [PATCH 01/12] arm64: Prepare for sharing with s390
From: Marc Zyngier
Date: Sat Dec 05 2026 - 13:30:57 EST
On Fri, 04 Dec 2026 11:27:55 +0000,
Andreas Grapentin <gra@xxxxxxxxxxxxx> wrote:
>
> On Dec 04 26, Marc Zyngier wrote:
> > On Wed, 02 Dec 2026 14:11:39 +0000,
> > Steffen Eiden <seiden@xxxxxxxxxxxxx> wrote:
> > >
> > > Add s390 guards for arm headers which reside in include/kvm. This allows
> > > s390 to use headers placed in its arch include/arm64/ .
> >
> > As I said in my reply to another patch, this isn't an acceptable
> > outcome. If you are taking the full include file, you take it all,
> > without s390 stuff in it.
> >
> > > diff --git a/include/kvm/arm_hypercalls.h b/include/kvm/arm_hypercalls.h
> > > index 2df152207ccd..5ce4c2d43f9a 100644
> > > --- a/include/kvm/arm_hypercalls.h
> > > +++ b/include/kvm/arm_hypercalls.h
> > > @@ -4,7 +4,10 @@
> > > #ifndef __KVM_ARM_HYPERCALLS_H
> > > #define __KVM_ARM_HYPERCALLS_H>
> > >
> > > +/* s390 provides its own header view */
> > > +#ifndef __s390__
> > > #include <asm/kvm_emulate.h>
> > > +#endif // !__s390__
> > >
> > > int kvm_smccc_call_handler(struct kvm_vcpu *vcpu);
> >
> > The real question really is: why can't this directly target your own
> > version of kvm_emulate.h? My hunch is that the problem is in the
> > generated path:
> >
> > $ find . -name kvm_emulate.h | grep arm64
> > ./arch/s390/include/arm64/kvm_emulate.h
> > ./arch/arm64/include/asm/kvm_emulate.h
> >
> > Shouldn't the s390 path be arch/s390/include/arm64/asm/kvm_emulate.h
> > so that <asm/kvm_emulate.h> reaches the correct file?
>
> We tried this initially, but there were examples where a header with the
> path ./arch/s390/include/asm/foo.h already exists, which would shadow
> the generated header during compile time.
>
> We tried to solve this with a bunch of unholy trickery in the include
> paths, but in the end we settled for rewriting all the asm/ includes to
> arm64/ during processing of the shared headers to separate the
> namespaces cleanly.
>
> The fallout of this decision is that actually verbatim shared headers
> now disagree in their view of the include path.
There seem to be a pretty simple solution to this conundrum, in the
form of a symbolic link. See the hack below, which allows me to build
the kvms390/sea branch without any __s390__ horror.
Or is there another set of nasty stuff lurking somewhere else?
Thanks,
M.
From cf64943fbd34b626d748b1fd101dbaf872bd1bb9 Mon Sep 17 00:00:00 2001
From: Marc Zyngier <maz@xxxxxxxxxx>
Date: Sat, 5 Dec 2026 18:12:31 +0000
Subject: [PATCH] KVM: s390: arm64: Allow asm/foo.h directives in inherited
arm64 code
Make sure that:
- arch/arm64/include/arm64 is in include path for code inherited
from arm64
- asm/foo.h can be located in arch/arm64/include/arm64 by having
an "asm" symlink pointing to that same directory
This ensures that any foo.h include file that has is present in
arch/arm64/include/arm64 can be reached using <asm/foo.h>, and
avoids other unsavoury methods.
Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
---
arch/s390/include/arm64/asm | 1 +
arch/s390/kvm/arm64/Makefile | 1 +
2 files changed, 2 insertions(+)
create mode 120000 arch/s390/include/arm64/asm
diff --git a/arch/s390/include/arm64/asm b/arch/s390/include/arm64/asm
new file mode 120000
index 0000000000000..945c9b46d684f
--- /dev/null
+++ b/arch/s390/include/arm64/asm
@@ -0,0 +1 @@
+.
\ No newline at end of file
diff --git a/arch/s390/kvm/arm64/Makefile b/arch/s390/kvm/arm64/Makefile
index e22037a7c498f..bfe3605d7cec3 100644
--- a/arch/s390/kvm/arm64/Makefile
+++ b/arch/s390/kvm/arm64/Makefile
@@ -7,6 +7,7 @@ include $(srctree)/virt/kvm/Makefile.kvm
include $(srctree)/arch/$(SRCARCH)/kvm/gmap/Makefile
include $(src)/Makefile.gen
+ccflags-y += -I$(srctree)/arch/$(SRCARCH)/include/arm64
ccflags-y += -I $(src) -I $(objtree)/$(obj) -I$(srctree)/arch/$(SRCARCH)/kvm/gmap -DKVM_S390_ARM64
kvm-arm64-local := \
--
2.47.3
--
Jazz isn't dead. It just smells funny.