aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRadim Krčmář <rkrcmar@redhat.com>2017-12-06 09:55:44 -0500
committerRadim Krčmář <rkrcmar@redhat.com>2017-12-06 09:55:44 -0500
commitd29899a30f987de46bcdab3ca4513de2479629e5 (patch)
tree58869cb489ae91c13b77f2b4ff93fda835fd1405
parent2895db67b01cb875457c9c3f30a14723b6b5dfd5 (diff)
parentca76ec9ca871e67d8cd0b6caba24aca3d3ac4546 (diff)
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
-rw-r--r--Documentation/virtual/kvm/api.txt15
-rw-r--r--arch/s390/kvm/Makefile5
-rw-r--r--arch/s390/kvm/diag.c5
-rw-r--r--arch/s390/kvm/gaccess.h5
-rw-r--r--arch/s390/kvm/guestdbg.c5
-rw-r--r--arch/s390/kvm/intercept.c5
-rw-r--r--arch/s390/kvm/interrupt.c5
-rw-r--r--arch/s390/kvm/irq.h5
-rw-r--r--arch/s390/kvm/kvm-s390.c11
-rw-r--r--arch/s390/kvm/kvm-s390.h5
-rw-r--r--arch/s390/kvm/priv.c16
-rw-r--r--arch/s390/kvm/sigp.c5
-rw-r--r--arch/s390/kvm/vsie.c5
-rw-r--r--include/uapi/linux/kvm.h4
14 files changed, 39 insertions, 57 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index f670e4b9e7f3..57d3ee9e4bde 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2901,14 +2901,19 @@ userspace buffer and its length:
2901 2901
2902struct kvm_s390_irq_state { 2902struct kvm_s390_irq_state {
2903 __u64 buf; 2903 __u64 buf;
2904 __u32 flags; 2904 __u32 flags; /* will stay unused for compatibility reasons */
2905 __u32 len; 2905 __u32 len;
2906 __u32 reserved[4]; 2906 __u32 reserved[4]; /* will stay unused for compatibility reasons */
2907}; 2907};
2908 2908
2909Userspace passes in the above struct and for each pending interrupt a 2909Userspace passes in the above struct and for each pending interrupt a
2910struct kvm_s390_irq is copied to the provided buffer. 2910struct kvm_s390_irq is copied to the provided buffer.
2911 2911
2912The structure contains a flags and a reserved field for future extensions. As
2913the kernel never checked for flags == 0 and QEMU never pre-zeroed flags and
2914reserved, these fields can not be used in the future without breaking
2915compatibility.
2916
2912If -ENOBUFS is returned the buffer provided was too small and userspace 2917If -ENOBUFS is returned the buffer provided was too small and userspace
2913may retry with a bigger buffer. 2918may retry with a bigger buffer.
2914 2919
@@ -2932,10 +2937,14 @@ containing a struct kvm_s390_irq_state:
2932 2937
2933struct kvm_s390_irq_state { 2938struct kvm_s390_irq_state {
2934 __u64 buf; 2939 __u64 buf;
2940 __u32 flags; /* will stay unused for compatibility reasons */
2935 __u32 len; 2941 __u32 len;
2936 __u32 pad; 2942 __u32 reserved[4]; /* will stay unused for compatibility reasons */
2937}; 2943};
2938 2944
2945The restrictions for flags and reserved apply as well.
2946(see KVM_S390_GET_IRQ_STATE)
2947
2939The userspace memory referenced by buf contains a struct kvm_s390_irq 2948The userspace memory referenced by buf contains a struct kvm_s390_irq
2940for each interrupt to be injected into the guest. 2949for each interrupt to be injected into the guest.
2941If one of the interrupts could not be injected for some reason the 2950If one of the interrupts could not be injected for some reason the
diff --git a/arch/s390/kvm/Makefile b/arch/s390/kvm/Makefile
index 6048b1c6e580..05ee90a5ea08 100644
--- a/arch/s390/kvm/Makefile
+++ b/arch/s390/kvm/Makefile
@@ -1,10 +1,7 @@
1# SPDX-License-Identifier: GPL-2.0
1# Makefile for kernel virtual machines on s390 2# Makefile for kernel virtual machines on s390
2# 3#
3# Copyright IBM Corp. 2008 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
9KVM := ../../../virt/kvm 6KVM := ../../../virt/kvm
10common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o 7common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o
diff --git a/arch/s390/kvm/diag.c b/arch/s390/kvm/diag.c
index d93a2c0474bf..89aa114a2cba 100644
--- a/arch/s390/kvm/diag.c
+++ b/arch/s390/kvm/diag.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * handling diagnose instructions 3 * handling diagnose instructions
3 * 4 *
4 * Copyright IBM Corp. 2008, 2011 5 * Copyright IBM Corp. 2008, 2011
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
12 */ 9 */
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h
index bec42b852246..f4c51756c462 100644
--- a/arch/s390/kvm/gaccess.h
+++ b/arch/s390/kvm/gaccess.h
@@ -1,12 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * access guest memory 3 * access guest memory
3 * 4 *
4 * Copyright IBM Corp. 2008, 2014 5 * Copyright IBM Corp. 2008, 2014
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 */ 8 */
12 9
diff --git a/arch/s390/kvm/guestdbg.c b/arch/s390/kvm/guestdbg.c
index bcbd86621d01..b5f3e82006d0 100644
--- a/arch/s390/kvm/guestdbg.c
+++ b/arch/s390/kvm/guestdbg.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * kvm guest debug support 3 * kvm guest debug support
3 * 4 *
4 * Copyright IBM Corp. 2014 5 * Copyright IBM Corp. 2014
5 * 6 *
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 *
10 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com> 7 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>
11 */ 8 */
12#include <linux/kvm_host.h> 9#include <linux/kvm_host.h>
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 8fe034beb623..9c7d70715862 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * in-kernel handling for sie intercepts 3 * in-kernel handling for sie intercepts
3 * 4 *
4 * Copyright IBM Corp. 2008, 2014 5 * Copyright IBM Corp. 2008, 2014
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
12 */ 9 */
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index fa557372d600..024ad8bcc516 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * handling kvm guest interrupts 3 * handling kvm guest interrupts
3 * 4 *
4 * Copyright IBM Corp. 2008, 2015 5 * Copyright IBM Corp. 2008, 2015
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 */ 8 */
12 9
diff --git a/arch/s390/kvm/irq.h b/arch/s390/kvm/irq.h
index d98e4159643d..484608c71dd0 100644
--- a/arch/s390/kvm/irq.h
+++ b/arch/s390/kvm/irq.h
@@ -1,12 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * s390 irqchip routines 3 * s390 irqchip routines
3 * 4 *
4 * Copyright IBM Corp. 2014 5 * Copyright IBM Corp. 2014
5 * 6 *
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 *
10 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> 7 * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
11 */ 8 */
12#ifndef __KVM_IRQ_H 9#ifndef __KVM_IRQ_H
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 9614aea5839b..ec8b68e97d3c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -1,11 +1,8 @@
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 * Copyright IBM Corp. 2008, 2017
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 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
@@ -3808,6 +3805,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
3808 r = -EINVAL; 3805 r = -EINVAL;
3809 break; 3806 break;
3810 } 3807 }
3808 /* do not use irq_state.flags, it will break old QEMUs */
3811 r = kvm_s390_set_irq_state(vcpu, 3809 r = kvm_s390_set_irq_state(vcpu,
3812 (void __user *) irq_state.buf, 3810 (void __user *) irq_state.buf,
3813 irq_state.len); 3811 irq_state.len);
@@ -3823,6 +3821,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
3823 r = -EINVAL; 3821 r = -EINVAL;
3824 break; 3822 break;
3825 } 3823 }
3824 /* do not use irq_state.flags, it will break old QEMUs */
3826 r = kvm_s390_get_irq_state(vcpu, 3825 r = kvm_s390_get_irq_state(vcpu,
3827 (__u8 __user *) irq_state.buf, 3826 (__u8 __user *) irq_state.buf,
3828 irq_state.len); 3827 irq_state.len);
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 10d65dfbc306..5e46ba429bcb 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -1,12 +1,9 @@
1/* SPDX-License-Identifier: GPL-2.0 */
1/* 2/*
2 * definition for kvm on s390 3 * definition for kvm on s390
3 * 4 *
4 * Copyright IBM Corp. 2008, 2009 5 * Copyright IBM Corp. 2008, 2009
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
12 * Christian Ehrhardt <ehrhardt@de.ibm.com> 9 * Christian Ehrhardt <ehrhardt@de.ibm.com>
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index c954ac49eee4..572496c688cc 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * handling privileged instructions 3 * handling privileged instructions
3 * 4 *
4 * Copyright IBM Corp. 2008, 2013 5 * Copyright IBM Corp. 2008, 2013
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
12 */ 9 */
@@ -235,8 +232,6 @@ static int try_handle_skey(struct kvm_vcpu *vcpu)
235 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); 232 VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");
236 return -EAGAIN; 233 return -EAGAIN;
237 } 234 }
238 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
239 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
240 return 0; 235 return 0;
241} 236}
242 237
@@ -247,6 +242,9 @@ static int handle_iske(struct kvm_vcpu *vcpu)
247 int reg1, reg2; 242 int reg1, reg2;
248 int rc; 243 int rc;
249 244
245 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
246 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
247
250 rc = try_handle_skey(vcpu); 248 rc = try_handle_skey(vcpu);
251 if (rc) 249 if (rc)
252 return rc != -EAGAIN ? rc : 0; 250 return rc != -EAGAIN ? rc : 0;
@@ -276,6 +274,9 @@ static int handle_rrbe(struct kvm_vcpu *vcpu)
276 int reg1, reg2; 274 int reg1, reg2;
277 int rc; 275 int rc;
278 276
277 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
278 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
279
279 rc = try_handle_skey(vcpu); 280 rc = try_handle_skey(vcpu);
280 if (rc) 281 if (rc)
281 return rc != -EAGAIN ? rc : 0; 282 return rc != -EAGAIN ? rc : 0;
@@ -311,6 +312,9 @@ static int handle_sske(struct kvm_vcpu *vcpu)
311 int reg1, reg2; 312 int reg1, reg2;
312 int rc; 313 int rc;
313 314
315 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
316 return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
317
314 rc = try_handle_skey(vcpu); 318 rc = try_handle_skey(vcpu);
315 if (rc) 319 if (rc)
316 return rc != -EAGAIN ? rc : 0; 320 return rc != -EAGAIN ? rc : 0;
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index 9d592ef4104b..c1f5cde2c878 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * handling interprocessor communication 3 * handling interprocessor communication
3 * 4 *
4 * Copyright IBM Corp. 2008, 2013 5 * Copyright IBM Corp. 2008, 2013
5 * 6 *
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 *
10 * Author(s): Carsten Otte <cotte@de.ibm.com> 7 * Author(s): Carsten Otte <cotte@de.ibm.com>
11 * Christian Borntraeger <borntraeger@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com>
12 * Christian Ehrhardt <ehrhardt@de.ibm.com> 9 * Christian Ehrhardt <ehrhardt@de.ibm.com>
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index a311938b63b3..5d6ae0326d9e 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -1,12 +1,9 @@
1// SPDX-License-Identifier: GPL-2.0
1/* 2/*
2 * kvm nested virtualization support for s390x 3 * kvm nested virtualization support for s390x
3 * 4 *
4 * Copyright IBM Corp. 2016 5 * Copyright IBM Corp. 2016
5 * 6 *
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 *
10 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com> 7 * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>
11 */ 8 */
12#include <linux/vmalloc.h> 9#include <linux/vmalloc.h>
diff --git a/include/uapi/linux/kvm.h b/include/uapi/linux/kvm.h
index 282d7613fce8..496e59a2738b 100644
--- a/include/uapi/linux/kvm.h
+++ b/include/uapi/linux/kvm.h
@@ -630,9 +630,9 @@ struct kvm_s390_irq {
630 630
631struct kvm_s390_irq_state { 631struct kvm_s390_irq_state {
632 __u64 buf; 632 __u64 buf;
633 __u32 flags; 633 __u32 flags; /* will stay unused for compatibility reasons */
634 __u32 len; 634 __u32 len;
635 __u32 reserved[4]; 635 __u32 reserved[4]; /* will stay unused for compatibility reasons */
636}; 636};
637 637
638/* for KVM_SET_GUEST_DEBUG */ 638/* for KVM_SET_GUEST_DEBUG */