On Thu, 6 Dec 2018 17:30:05 -0500 Collin Walling <walling@xxxxxxxxxxxxx> wrote: > The diagnose 318 instruction is a privileged instruction that must be > interpreted by SIE and handled via KVM. > > The control program name and version codes (CPNC and CPVC) set by this > instruction are saved to the kvm->arch struct. The CPNC is also set in > the SIE control block of all VCPUs. The new kvm_s390_set_machine > interface is introduced for migration. > > Signed-off-by: Collin Walling <walling@xxxxxxxxxxxxx> > Reviewed-by: Janosch Frank <frankja@xxxxxxxxxxxxx> > --- > arch/s390/include/asm/kvm_host.h | 13 +++++- > arch/s390/include/uapi/asm/kvm.h | 5 +++ > arch/s390/kvm/diag.c | 12 ++++++ > arch/s390/kvm/kvm-s390.c | 92 ++++++++++++++++++++++++++++++++++++++++ > arch/s390/kvm/kvm-s390.h | 1 + > arch/s390/kvm/vsie.c | 7 +++ > 6 files changed, 129 insertions(+), 1 deletion(-) > (...) > diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h > index 16511d9..6420aad 100644 > --- a/arch/s390/include/uapi/asm/kvm.h > +++ b/arch/s390/include/uapi/asm/kvm.h > @@ -74,6 +74,7 @@ struct kvm_s390_io_adapter_req { > #define KVM_S390_VM_CRYPTO 2 > #define KVM_S390_VM_CPU_MODEL 3 > #define KVM_S390_VM_MIGRATION 4 > +#define KVM_S390_VM_MACHINE 5 Please update Documentation/virtual/kvm/api.txt for this as well. [Looking at the documentation, I also notice that KVM_S390_VM_CRYPTO_{EN,DIS}ABLE_APIE seem to lack an entry in that file. Obviously not within the scope of this patch :)] > > /* kvm attributes for mem_ctrl */ > #define KVM_S390_VM_MEM_ENABLE_CMMA 0 > @@ -130,6 +131,7 @@ struct kvm_s390_vm_cpu_machine { > #define KVM_S390_VM_CPU_FEAT_PFMFI 11 > #define KVM_S390_VM_CPU_FEAT_SIGPIF 12 > #define KVM_S390_VM_CPU_FEAT_KSS 13 > +#define KVM_S390_VM_CPU_FEAT_DIAG318 14 > struct kvm_s390_vm_cpu_feat { > __u64 feat[16]; > }; > @@ -168,6 +170,9 @@ struct kvm_s390_vm_cpu_subfunc { > #define KVM_S390_VM_MIGRATION_START 1 > #define KVM_S390_VM_MIGRATION_STATUS 2 > > +/* kvm attributes for KVM_S390_VM_MACHINE */ > +#define KVM_S390_VM_MACHINE_CPC 0 > + > /* for KVM_GET_REGS and KVM_SET_REGS */ > struct kvm_regs { > /* general purpose regs for s390 */