- SPDX tags
 - Fence storage key accesses from problem state
 - Make sure that irq_state.flags is not used in the future
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJaJ6rwAAoJEBF7vIC1phx8QDIP/jUgH9OpLpg+bhrEUvB7e83X
 sAQuKv7jVTTEpZ6mTkqjPihdiRC72x1spzz5ACw5XaZ9NoxMiOtABFBtiaTfoYz+
 l6eu+qOqk6lIn7n/WR8VQFSuizHa1VjnQiuco/GEUE+3FOZQPVE/u8gpNsjvWwfV
 gB+45oTCF24LZEgPAotPglMWOtbxjauMmqHkUh3jDgsk0bFCGWe+MR+T3ljIZ45M
 /6JBDchEibCsfkg4/ck0HjnQ3p9J4gfictAKJWeYgNh/4oB2krId9FNYbxXkOFNX
 1+zeurttmRuFjFwVdCD6SoxE0PQTYXnL/hisITxRfX5otoXQ/x5PffiBrXIZucWK
 fZZvPX0MBNNzIx1UvCaJ8bKEmtzXdGuy5mpzX84kJNqCIkqft/bFrOPAf/p/Nrrv
 4RoF00FH6ZZdxPD3rLkBYSs//P6lTEivkrMHGFndHrJc844pVTEN45lTg0ngOcmF
 aOBbpZQl6etRwobWJdye76OuVszadoECYrnLPP+fFgWjFqp0F3b9Ki1WkSPsZ4E1
 isXp/tYRA+/0tZPBQT297tuUXv7c0ID2SROIUvgQt2yC2EdrizWvXsl2QCGsfbxL
 8jT5AsPg0U3qUeBAUZP6gtdIAIuN5lj75uOM83CEcPTo4fOkGuvCnHI0LSHz6Ooc
 oz2Z8aZAENKd+3193FnO
 =uodY
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Radim Krčmář 2017-12-06 15:55:44 +01:00
Родитель 2895db67b0 ca76ec9ca8
Коммит d29899a30f
14 изменённых файлов: 39 добавлений и 57 удалений

Просмотреть файл

@ -2901,14 +2901,19 @@ userspace buffer and its length:
struct kvm_s390_irq_state { struct kvm_s390_irq_state {
__u64 buf; __u64 buf;
__u32 flags; __u32 flags; /* will stay unused for compatibility reasons */
__u32 len; __u32 len;
__u32 reserved[4]; __u32 reserved[4]; /* will stay unused for compatibility reasons */
}; };
Userspace passes in the above struct and for each pending interrupt a Userspace passes in the above struct and for each pending interrupt a
struct kvm_s390_irq is copied to the provided buffer. struct kvm_s390_irq is copied to the provided buffer.
The structure contains a flags and a reserved field for future extensions. As
the kernel never checked for flags == 0 and QEMU never pre-zeroed flags and
reserved, these fields can not be used in the future without breaking
compatibility.
If -ENOBUFS is returned the buffer provided was too small and userspace If -ENOBUFS is returned the buffer provided was too small and userspace
may retry with a bigger buffer. may retry with a bigger buffer.
@ -2932,10 +2937,14 @@ containing a struct kvm_s390_irq_state:
struct kvm_s390_irq_state { struct kvm_s390_irq_state {
__u64 buf; __u64 buf;
__u32 flags; /* will stay unused for compatibility reasons */
__u32 len; __u32 len;
__u32 pad; __u32 reserved[4]; /* will stay unused for compatibility reasons */
}; };
The restrictions for flags and reserved apply as well.
(see KVM_S390_GET_IRQ_STATE)
The userspace memory referenced by buf contains a struct kvm_s390_irq The userspace memory referenced by buf contains a struct kvm_s390_irq
for each interrupt to be injected into the guest. for each interrupt to be injected into the guest.
If one of the interrupts could not be injected for some reason the If one of the interrupts could not be injected for some reason the

Просмотреть файл

@ -1,10 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
# Makefile for kernel virtual machines on s390 # Makefile for kernel virtual machines on s390
# #
# Copyright IBM Corp. 2008 # Copyright IBM Corp. 2008
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License (version 2 only)
# as published by the Free Software Foundation.
KVM := ../../../virt/kvm KVM := ../../../virt/kvm
common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o common-objs = $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/async_pf.o $(KVM)/irqchip.o $(KVM)/vfio.o

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* handling diagnose instructions * handling diagnose instructions
* *
* Copyright IBM Corp. 2008, 2011 * Copyright IBM Corp. 2008, 2011
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com>
*/ */

Просмотреть файл

@ -1,12 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* access guest memory * access guest memory
* *
* Copyright IBM Corp. 2008, 2014 * Copyright IBM Corp. 2008, 2014
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
*/ */

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* kvm guest debug support * kvm guest debug support
* *
* Copyright IBM Corp. 2014 * Copyright IBM Corp. 2014
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com> * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>
*/ */
#include <linux/kvm_host.h> #include <linux/kvm_host.h>

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* in-kernel handling for sie intercepts * in-kernel handling for sie intercepts
* *
* Copyright IBM Corp. 2008, 2014 * Copyright IBM Corp. 2008, 2014
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com>
*/ */

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* handling kvm guest interrupts * handling kvm guest interrupts
* *
* Copyright IBM Corp. 2008, 2015 * Copyright IBM Corp. 2008, 2015
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
*/ */

Просмотреть файл

@ -1,12 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* s390 irqchip routines * s390 irqchip routines
* *
* Copyright IBM Corp. 2014 * Copyright IBM Corp. 2014
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Cornelia Huck <cornelia.huck@de.ibm.com> * Author(s): Cornelia Huck <cornelia.huck@de.ibm.com>
*/ */
#ifndef __KVM_IRQ_H #ifndef __KVM_IRQ_H

Просмотреть файл

@ -1,11 +1,8 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* hosting zSeries kernel virtual machines * hosting IBM Z kernel virtual machines (s390x)
* *
* Copyright IBM Corp. 2008, 2009 * Copyright IBM Corp. 2008, 2017
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
* *
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com>
@ -3808,6 +3805,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
r = -EINVAL; r = -EINVAL;
break; break;
} }
/* do not use irq_state.flags, it will break old QEMUs */
r = kvm_s390_set_irq_state(vcpu, r = kvm_s390_set_irq_state(vcpu,
(void __user *) irq_state.buf, (void __user *) irq_state.buf,
irq_state.len); irq_state.len);
@ -3823,6 +3821,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
r = -EINVAL; r = -EINVAL;
break; break;
} }
/* do not use irq_state.flags, it will break old QEMUs */
r = kvm_s390_get_irq_state(vcpu, r = kvm_s390_get_irq_state(vcpu,
(__u8 __user *) irq_state.buf, (__u8 __user *) irq_state.buf,
irq_state.len); irq_state.len);

Просмотреть файл

@ -1,12 +1,9 @@
/* SPDX-License-Identifier: GPL-2.0 */
/* /*
* definition for kvm on s390 * definition for kvm on s390
* *
* Copyright IBM Corp. 2008, 2009 * Copyright IBM Corp. 2008, 2009
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com>
* Christian Ehrhardt <ehrhardt@de.ibm.com> * Christian Ehrhardt <ehrhardt@de.ibm.com>

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* handling privileged instructions * handling privileged instructions
* *
* Copyright IBM Corp. 2008, 2013 * Copyright IBM Corp. 2008, 2013
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com>
*/ */
@ -235,8 +232,6 @@ static int try_handle_skey(struct kvm_vcpu *vcpu)
VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation"); VCPU_EVENT(vcpu, 4, "%s", "retrying storage key operation");
return -EAGAIN; return -EAGAIN;
} }
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
return 0; return 0;
} }
@ -247,6 +242,9 @@ static int handle_iske(struct kvm_vcpu *vcpu)
int reg1, reg2; int reg1, reg2;
int rc; int rc;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
rc = try_handle_skey(vcpu); rc = try_handle_skey(vcpu);
if (rc) if (rc)
return rc != -EAGAIN ? rc : 0; return rc != -EAGAIN ? rc : 0;
@ -276,6 +274,9 @@ static int handle_rrbe(struct kvm_vcpu *vcpu)
int reg1, reg2; int reg1, reg2;
int rc; int rc;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
rc = try_handle_skey(vcpu); rc = try_handle_skey(vcpu);
if (rc) if (rc)
return rc != -EAGAIN ? rc : 0; return rc != -EAGAIN ? rc : 0;
@ -311,6 +312,9 @@ static int handle_sske(struct kvm_vcpu *vcpu)
int reg1, reg2; int reg1, reg2;
int rc; int rc;
if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)
return kvm_s390_inject_program_int(vcpu, PGM_PRIVILEGED_OP);
rc = try_handle_skey(vcpu); rc = try_handle_skey(vcpu);
if (rc) if (rc)
return rc != -EAGAIN ? rc : 0; return rc != -EAGAIN ? rc : 0;

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* handling interprocessor communication * handling interprocessor communication
* *
* Copyright IBM Corp. 2008, 2013 * Copyright IBM Corp. 2008, 2013
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): Carsten Otte <cotte@de.ibm.com> * Author(s): Carsten Otte <cotte@de.ibm.com>
* Christian Borntraeger <borntraeger@de.ibm.com> * Christian Borntraeger <borntraeger@de.ibm.com>
* Christian Ehrhardt <ehrhardt@de.ibm.com> * Christian Ehrhardt <ehrhardt@de.ibm.com>

Просмотреть файл

@ -1,12 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
/* /*
* kvm nested virtualization support for s390x * kvm nested virtualization support for s390x
* *
* Copyright IBM Corp. 2016 * Copyright IBM Corp. 2016
* *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License (version 2 only)
* as published by the Free Software Foundation.
*
* Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com> * Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>
*/ */
#include <linux/vmalloc.h> #include <linux/vmalloc.h>

Просмотреть файл

@ -630,9 +630,9 @@ struct kvm_s390_irq {
struct kvm_s390_irq_state { struct kvm_s390_irq_state {
__u64 buf; __u64 buf;
__u32 flags; __u32 flags; /* will stay unused for compatibility reasons */
__u32 len; __u32 len;
__u32 reserved[4]; __u32 reserved[4]; /* will stay unused for compatibility reasons */
}; };
/* for KVM_SET_GUEST_DEBUG */ /* for KVM_SET_GUEST_DEBUG */