[PATCH v4 15/27] KVM: S390: Prepare gmap for a second KVM implementation

Janosch Frank frankja at linux.ibm.com
Wed Jul 8 05:33:30 PDT 2026


On 7/6/26 10:52, Steffen Eiden wrote:
> Refactor gmap code such that a second s390 (host) KVM implementation can
> use the gmap code as well. Move relevant definitions into the shared
> kvm_host.h. Move mmu code from s390 to gmap so the other KVM
> implementation can use it as well.
> 
> No functional change.
> 
> Signed-off-by: Steffen Eiden <seiden at linux.ibm.com>
> ---
>   arch/s390/include/asm/kvm_host.h      |   9 ++
>   arch/s390/include/asm/kvm_host_s390.h |  11 +-
>   arch/s390/kvm/gmap/Makefile           |   2 +-
>   arch/s390/kvm/gmap/faultin.c          |   1 -
>   arch/s390/kvm/gmap/gmap.c             |   5 -
>   arch/s390/kvm/gmap/gmap.h             |  15 ++
>   arch/s390/kvm/gmap/mmu.c              | 193 ++++++++++++++++++++++++++
>   arch/s390/kvm/s390/s390.c             | 134 ++----------------
>   arch/s390/kvm/s390/s390.h             |  16 +++
>   9 files changed, 245 insertions(+), 141 deletions(-)
>   create mode 100644 arch/s390/kvm/gmap/mmu.c
> 
> diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
> index e76ceee11ef5..33af8842a71c 100644
> --- a/arch/s390/include/asm/kvm_host.h
> +++ b/arch/s390/include/asm/kvm_host.h
> @@ -5,4 +5,13 @@
>   
>   #include <asm/kvm_host_s390.h>
>   
> +#define PGM_PROTECTION			0x04
> +#define PGM_ADDRESSING			0x05
> +#define PGM_SEGMENT_TRANSLATION		0x10
> +#define PGM_PAGE_TRANSLATION		0x11
> +#define PGM_ASCE_TYPE			0x38
> +#define PGM_REGION_FIRST_TRANS		0x39
> +#define PGM_REGION_SECOND_TRANS		0x3a
> +#define PGM_REGION_THIRD_TRANS		0x3b

Before we go out and do funny stuff like this I'd much rather have it 
all in one file even though the arm code won't use most of the PGMs.

Either we keep all of it in kvm_host.h or we move it out entirely into 
ptrace.h if the s390 kernel team doesn't complain.

I don't think this change belongs in this patch anyway.

[...]

> -bool kvm_arch_setup_async_pf(struct kvm_vcpu *vcpu);
>   #define CREATE_TRACE_POINTS
>   #include "trace-gmap.h"
>   
> diff --git a/arch/s390/kvm/gmap/gmap.c b/arch/s390/kvm/gmap/gmap.c
> index 8773aa34f107..a04e0a4355a0 100644
> --- a/arch/s390/kvm/gmap/gmap.c
> +++ b/arch/s390/kvm/gmap/gmap.c
> @@ -24,11 +24,6 @@
>   #include "s390.h"
>   #include "faultin.h"
>   
> -static inline bool kvm_s390_is_in_sie(struct kvm_vcpu *vcpu)
> -{
> -	return vcpu->arch.sie_block->prog0c & PROG_IN_SIE;
> -}
> -

With a small modification we can re-use this in vsie.c and throw it into 
kvm_host.h before we move it into kvm_host_s390.h. Make it work on sblks 
instead of vcpus and name it something like kvm_s390_sblk_is_in_sie().






More information about the linux-arm-kernel mailing list