Merge tag 'kvm-s390-master-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux

KVM: s390: Fixes for 4.15

- SPDX tags
- Fence storage key accesses from problem state
- Make sure that irq_state.flags is not used in the future

+39 -57
+12 -3
Documentation/virtual/kvm/api.txt
··· 2901 2901 2902 2902 struct kvm_s390_irq_state { 2903 2903 __u64 buf; 2904 - __u32 flags; 2904 + __u32 flags; /* will stay unused for compatibility reasons */ 2905 2905 __u32 len; 2906 - __u32 reserved[4]; 2906 + __u32 reserved[4]; /* will stay unused for compatibility reasons */ 2907 2907 }; 2908 2908 2909 2909 Userspace passes in the above struct and for each pending interrupt a 2910 2910 struct kvm_s390_irq is copied to the provided buffer. 2911 + 2912 + The structure contains a flags and a reserved field for future extensions. As 2913 + the kernel never checked for flags == 0 and QEMU never pre-zeroed flags and 2914 + reserved, these fields can not be used in the future without breaking 2915 + compatibility. 2911 2916 2912 2917 If -ENOBUFS is returned the buffer provided was too small and userspace 2913 2918 may retry with a bigger buffer. ··· 2937 2932 2938 2933 struct kvm_s390_irq_state { 2939 2934 __u64 buf; 2935 + __u32 flags; /* will stay unused for compatibility reasons */ 2940 2936 __u32 len; 2941 - __u32 pad; 2937 + __u32 reserved[4]; /* will stay unused for compatibility reasons */ 2942 2938 }; 2939 + 2940 + The restrictions for flags and reserved apply as well. 2941 + (see KVM_S390_GET_IRQ_STATE) 2943 2942 2944 2943 The userspace memory referenced by buf contains a struct kvm_s390_irq 2945 2944 for each interrupt to be injected into the guest.
+1 -4
arch/s390/kvm/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 1 2 # Makefile for kernel virtual machines on s390 2 3 # 3 4 # Copyright IBM Corp. 2008 4 - # 5 - # This program is free software; you can redistribute it and/or modify 6 - # it under the terms of the GNU General Public License (version 2 only) 7 - # as published by the Free Software Foundation. 8 5 9 6 KVM := ../../../virt/kvm 10 7 common-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
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * handling diagnose instructions 3 4 * 4 5 * Copyright IBM Corp. 2008, 2011 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 * Christian Borntraeger <borntraeger@de.ibm.com>
+1 -4
arch/s390/kvm/gaccess.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 2 3 * access guest memory 3 4 * 4 5 * Copyright IBM Corp. 2008, 2014 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 */
+1 -4
arch/s390/kvm/guestdbg.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * kvm guest debug support 3 4 * 4 5 * Copyright IBM Corp. 2014 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com> 11 8 */
+1 -4
arch/s390/kvm/intercept.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * in-kernel handling for sie intercepts 3 4 * 4 5 * Copyright IBM Corp. 2008, 2014 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 * Christian Borntraeger <borntraeger@de.ibm.com>
+1 -4
arch/s390/kvm/interrupt.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * handling kvm guest interrupts 3 4 * 4 5 * Copyright IBM Corp. 2008, 2015 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 */
+1 -4
arch/s390/kvm/irq.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 2 3 * s390 irqchip routines 3 4 * 4 5 * Copyright IBM Corp. 2014 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 11 8 */
+5 -6
arch/s390/kvm/kvm-s390.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 - * hosting zSeries kernel virtual machines 3 + * hosting IBM Z kernel virtual machines (s390x) 3 4 * 4 - * Copyright IBM Corp. 2008, 2009 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 5 + * Copyright IBM Corp. 2008, 2017 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 * Christian Borntraeger <borntraeger@de.ibm.com> ··· 3805 3808 r = -EINVAL; 3806 3809 break; 3807 3810 } 3811 + /* do not use irq_state.flags, it will break old QEMUs */ 3808 3812 r = kvm_s390_set_irq_state(vcpu, 3809 3813 (void __user *) irq_state.buf, 3810 3814 irq_state.len); ··· 3821 3823 r = -EINVAL; 3822 3824 break; 3823 3825 } 3826 + /* do not use irq_state.flags, it will break old QEMUs */ 3824 3827 r = kvm_s390_get_irq_state(vcpu, 3825 3828 (__u8 __user *) irq_state.buf, 3826 3829 irq_state.len);
+1 -4
arch/s390/kvm/kvm-s390.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 1 2 /* 2 3 * definition for kvm on s390 3 4 * 4 5 * Copyright IBM Corp. 2008, 2009 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 * Christian Borntraeger <borntraeger@de.ibm.com>
+10 -6
arch/s390/kvm/priv.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * handling privileged instructions 3 4 * 4 5 * Copyright IBM Corp. 2008, 2013 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 * Christian Borntraeger <borntraeger@de.ibm.com> ··· 232 235 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); 233 236 return -EAGAIN; 234 237 } 235 - if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE) 236 - return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP); 237 238 return 0; 238 239 } 239 240 ··· 241 246 unsigned char key; 242 247 int reg1, reg2; 243 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); 244 252 245 253 rc = try_handle_skey(vcpu); 246 254 if (rc) ··· 273 275 unsigned long addr; 274 276 int reg1, reg2; 275 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); 276 281 277 282 rc = try_handle_skey(vcpu); 278 283 if (rc) ··· 311 310 unsigned char key, oldkey; 312 311 int reg1, reg2; 313 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); 314 316 315 317 rc = try_handle_skey(vcpu); 316 318 if (rc)
+1 -4
arch/s390/kvm/sigp.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * handling interprocessor communication 3 4 * 4 5 * Copyright IBM Corp. 2008, 2013 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 11 8 * Christian Borntraeger <borntraeger@de.ibm.com>
+1 -4
arch/s390/kvm/vsie.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 1 2 /* 2 3 * kvm nested virtualization support for s390x 3 4 * 4 5 * Copyright IBM Corp. 2016 5 - * 6 - * This program is free software; you can redistribute it and/or modify 7 - * it under the terms of the GNU General Public License (version 2 only) 8 - * as published by the Free Software Foundation. 9 6 * 10 7 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com> 11 8 */
+2 -2
include/uapi/linux/kvm.h
··· 630 630 631 631 struct kvm_s390_irq_state { 632 632 __u64 buf; 633 - __u32 flags; 633 + __u32 flags; /* will stay unused for compatibility reasons */ 634 634 __u32 len; 635 - __u32 reserved[4]; 635 + __u32 reserved[4]; /* will stay unused for compatibility reasons */ 636 636 }; 637 637 638 638 /* for KVM_SET_GUEST_DEBUG */