···29012902struct kvm_s390_irq_state {2903 __u64 buf;2904- __u32 flags;2905 __u32 len;2906- __u32 reserved[4];2907};29082909Userspace passes in the above struct and for each pending interrupt a2910struct kvm_s390_irq is copied to the provided buffer.0000029112912If -ENOBUFS is returned the buffer provided was too small and userspace2913may retry with a bigger buffer.···29372938struct kvm_s390_irq_state {2939 __u64 buf;02940 __u32 len;2941- __u32 pad;2942};00029432944The userspace memory referenced by buf contains a struct kvm_s390_irq2945for each interrupt to be injected into the guest.
···29012902struct kvm_s390_irq_state {2903 __u64 buf;2904+ __u32 flags; /* will stay unused for compatibility reasons */2905 __u32 len;2906+ __u32 reserved[4]; /* will stay unused for compatibility reasons */2907};29082909Userspace passes in the above struct and for each pending interrupt a2910struct kvm_s390_irq is copied to the provided buffer.2911+2912+The structure contains a flags and a reserved field for future extensions. As2913+the kernel never checked for flags == 0 and QEMU never pre-zeroed flags and2914+reserved, these fields can not be used in the future without breaking2915+compatibility.29162917If -ENOBUFS is returned the buffer provided was too small and userspace2918may retry with a bigger buffer.···29322933struct kvm_s390_irq_state {2934 __u64 buf;2935+ __u32 flags; /* will stay unused for compatibility reasons */2936 __u32 len;2937+ __u32 reserved[4]; /* will stay unused for compatibility reasons */2938};2939+2940+The restrictions for flags and reserved apply as well.2941+(see KVM_S390_GET_IRQ_STATE)29422943The userspace memory referenced by buf contains a struct kvm_s390_irq2944for each interrupt to be injected into the guest.
+1-4
arch/s390/kvm/Makefile
···01# Makefile for kernel virtual machines on s3902#3# Copyright IBM Corp. 20084-#5-# This program is free software; you can redistribute it and/or modify6-# it under the terms of the GNU General Public License (version 2 only)7-# as published by the Free Software Foundation.89KVM := ../../../virt/kvm10common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o
···1+# SPDX-License-Identifier: GPL-2.02# Makefile for kernel virtual machines on s3903#4# Copyright IBM Corp. 2008000056KVM := ../../../virt/kvm7common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o
+1-4
arch/s390/kvm/diag.c
···01/*2 * handling diagnose instructions3 *4 * Copyright IBM Corp. 2008, 20115- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 * Christian Borntraeger <borntraeger@de.ibm.com>
···01/*2 * access guest memory3 *4 * Copyright IBM Corp. 2008, 20145- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 */
···01/*2 * kvm guest debug support3 *4 * Copyright IBM Corp. 20145- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>11 */
···01/*2 * in-kernel handling for sie intercepts3 *4 * Copyright IBM Corp. 2008, 20145- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 * Christian Borntraeger <borntraeger@de.ibm.com>
···1+// SPDX-License-Identifier: GPL-2.02/*3 * in-kernel handling for sie intercepts4 *5 * Copyright IBM Corp. 2008, 201400006 *7 * Author(s): Carsten Otte <cotte@de.ibm.com>8 * Christian Borntraeger <borntraeger@de.ibm.com>
+1-4
arch/s390/kvm/interrupt.c
···01/*2 * handling kvm guest interrupts3 *4 * Copyright IBM Corp. 2008, 20155- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 */
···01/*2 * s390 irqchip routines3 *4 * Copyright IBM Corp. 20145- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>11 */
···01/*2- * hosting zSeries kernel virtual machines3 *4- * Copyright IBM Corp. 2008, 20095- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 * Christian Borntraeger <borntraeger@de.ibm.com>···3805 r = -EINVAL;3806 break;3807 }03808 r = kvm_s390_set_irq_state(vcpu,3809 (void __user *) irq_state.buf,3810 irq_state.len);···3821 r = -EINVAL;3822 break;3823 }03824 r = kvm_s390_get_irq_state(vcpu,3825 (__u8 __user *) irq_state.buf,3826 irq_state.len);
···1+// SPDX-License-Identifier: GPL-2.02/*3+ * hosting IBM Z kernel virtual machines (s390x)4 *5+ * Copyright IBM Corp. 2008, 201700006 *7 * Author(s): Carsten Otte <cotte@de.ibm.com>8 * Christian Borntraeger <borntraeger@de.ibm.com>···3808 r = -EINVAL;3809 break;3810 }3811+ /* do not use irq_state.flags, it will break old QEMUs */3812 r = kvm_s390_set_irq_state(vcpu,3813 (void __user *) irq_state.buf,3814 irq_state.len);···3823 r = -EINVAL;3824 break;3825 }3826+ /* do not use irq_state.flags, it will break old QEMUs */3827 r = kvm_s390_get_irq_state(vcpu,3828 (__u8 __user *) irq_state.buf,3829 irq_state.len);
+1-4
arch/s390/kvm/kvm-s390.h
···01/*2 * definition for kvm on s3903 *4 * Copyright IBM Corp. 2008, 20095- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 * Christian Borntraeger <borntraeger@de.ibm.com>
···1+/* SPDX-License-Identifier: GPL-2.0 */2/*3 * definition for kvm on s3904 *5 * Copyright IBM Corp. 2008, 200900006 *7 * Author(s): Carsten Otte <cotte@de.ibm.com>8 * Christian Borntraeger <borntraeger@de.ibm.com>
+10-6
arch/s390/kvm/priv.c
···01/*2 * handling privileged instructions3 *4 * Copyright IBM Corp. 2008, 20135- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 * Christian Borntraeger <borntraeger@de.ibm.com>···232 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");233 return -EAGAIN;234 }235- if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)236- return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);237 return 0;238}239···241 unsigned char key;242 int reg1, reg2;243 int rc;000244245 rc = try_handle_skey(vcpu);246 if (rc)···273 unsigned long addr;274 int reg1, reg2;275 int rc;000276277 rc = try_handle_skey(vcpu);278 if (rc)···311 unsigned char key, oldkey;312 int reg1, reg2;313 int rc;000314315 rc = try_handle_skey(vcpu);316 if (rc)
···1+// SPDX-License-Identifier: GPL-2.02/*3 * handling privileged instructions4 *5 * Copyright IBM Corp. 2008, 201300006 *7 * Author(s): Carsten Otte <cotte@de.ibm.com>8 * Christian Borntraeger <borntraeger@de.ibm.com>···235 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");236 return -EAGAIN;237 }00238 return 0;239}240···246 unsigned char key;247 int reg1, reg2;248 int rc;249+250+ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)251+ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);252253 rc = try_handle_skey(vcpu);254 if (rc)···275 unsigned long addr;276 int reg1, reg2;277 int rc;278+279+ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)280+ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);281282 rc = try_handle_skey(vcpu);283 if (rc)···310 unsigned char key, oldkey;311 int reg1, reg2;312 int rc;313+314+ if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)315+ return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);316317 rc = try_handle_skey(vcpu);318 if (rc)
+1-4
arch/s390/kvm/sigp.c
···01/*2 * handling interprocessor communication3 *4 * Copyright IBM Corp. 2008, 20135- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): Carsten Otte <cotte@de.ibm.com>11 * Christian Borntraeger <borntraeger@de.ibm.com>
···01/*2 * kvm nested virtualization support for s390x3 *4 * Copyright IBM Corp. 20165- *6- * This program is free software; you can redistribute it and/or modify7- * it under the terms of the GNU General Public License (version 2 only)8- * as published by the Free Software Foundation.9 *10 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>11 */
···1+// SPDX-License-Identifier: GPL-2.02/*3 * kvm nested virtualization support for s390x4 *5 * Copyright IBM Corp. 201600006 *7 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>8 */