kvm-s390.c (200197908dc4afe03a75234478e6a14634a0a788) kvm-s390.c (d6c8097803cbc3bb8d875baef542e6d77d10c203)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * hosting IBM Z kernel virtual machines (s390x)
4 *
5 * Copyright IBM Corp. 2008, 2020
6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>

--- 39 unchanged lines hidden (view full) ---

48#include <asm/timex.h>
49#include <asm/asm.h>
50#include <asm/fpu.h>
51#include <asm/ap.h>
52#include <asm/uv.h>
53#include "kvm-s390.h"
54#include "gaccess.h"
55#include "pci.h"
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * hosting IBM Z kernel virtual machines (s390x)
4 *
5 * Copyright IBM Corp. 2008, 2020
6 *
7 * Author(s): Carsten Otte <cotte@de.ibm.com>
8 * Christian Borntraeger <borntraeger@de.ibm.com>

--- 39 unchanged lines hidden (view full) ---

48#include <asm/timex.h>
49#include <asm/asm.h>
50#include <asm/fpu.h>
51#include <asm/ap.h>
52#include <asm/uv.h>
53#include "kvm-s390.h"
54#include "gaccess.h"
55#include "pci.h"
56#include "gmap.h"
57
58#define CREATE_TRACE_POINTS
59#include "trace.h"
60#include "trace-s390.h"
61
62#define MEM_OP_MAX_SIZE 65536 /* Maximum transfer size for KVM_S390_MEM_OP */
63#define LOCAL_IRQS 32
64#define VCPU_IRQS_MAX_BUF (sizeof(struct kvm_s390_irq) * \

--- 4906 unchanged lines hidden (view full) ---

4971 case PGM_SECURE_STORAGE_VIOLATION:
4972 kvm_s390_assert_primary_as(vcpu);
4973 /*
4974 * This can happen after a reboot with asynchronous teardown;
4975 * the new guest (normal or protected) will run on top of the
4976 * previous protected guest. The old pages need to be destroyed
4977 * so the new guest can use them.
4978 */
56
57#define CREATE_TRACE_POINTS
58#include "trace.h"
59#include "trace-s390.h"
60
61#define MEM_OP_MAX_SIZE 65536 /* Maximum transfer size for KVM_S390_MEM_OP */
62#define LOCAL_IRQS 32
63#define VCPU_IRQS_MAX_BUF (sizeof(struct kvm_s390_irq) * \

--- 4906 unchanged lines hidden (view full) ---

4970 case PGM_SECURE_STORAGE_VIOLATION:
4971 kvm_s390_assert_primary_as(vcpu);
4972 /*
4973 * This can happen after a reboot with asynchronous teardown;
4974 * the new guest (normal or protected) will run on top of the
4975 * previous protected guest. The old pages need to be destroyed
4976 * so the new guest can use them.
4977 */
4979 if (gmap_destroy_page(vcpu->arch.gmap, gaddr)) {
4978 if (kvm_s390_pv_destroy_page(vcpu->kvm, gaddr)) {
4980 /*
4981 * Either KVM messed up the secure guest mapping or the
4982 * same page is mapped into multiple secure guests.
4983 *
4984 * This exception is only triggered when a guest 2 is
4985 * running and can therefore never occur in kernel
4986 * context.
4987 */

--- 5 unchanged lines hidden (view full) ---

4993 break;
4994 case PGM_NON_SECURE_STORAGE_ACCESS:
4995 kvm_s390_assert_primary_as(vcpu);
4996 /*
4997 * This is normal operation; a page belonging to a protected
4998 * guest has not been imported yet. Try to import the page into
4999 * the protected guest.
5000 */
4979 /*
4980 * Either KVM messed up the secure guest mapping or the
4981 * same page is mapped into multiple secure guests.
4982 *
4983 * This exception is only triggered when a guest 2 is
4984 * running and can therefore never occur in kernel
4985 * context.
4986 */

--- 5 unchanged lines hidden (view full) ---

4992 break;
4993 case PGM_NON_SECURE_STORAGE_ACCESS:
4994 kvm_s390_assert_primary_as(vcpu);
4995 /*
4996 * This is normal operation; a page belonging to a protected
4997 * guest has not been imported yet. Try to import the page into
4998 * the protected guest.
4999 */
5001 rc = gmap_convert_to_secure(vcpu->arch.gmap, gaddr);
5000 rc = kvm_s390_pv_convert_to_secure(vcpu->kvm, gaddr);
5002 if (rc == -EINVAL)
5003 send_sig(SIGSEGV, current, 0);
5004 if (rc != -ENXIO)
5005 break;
5006 flags = FAULT_FLAG_WRITE;
5007 fallthrough;
5008 case PGM_PROTECTION:
5009 case PGM_SEGMENT_TRANSLATION:

--- 1146 unchanged lines hidden ---
5001 if (rc == -EINVAL)
5002 send_sig(SIGSEGV, current, 0);
5003 if (rc != -ENXIO)
5004 break;
5005 flags = FAULT_FLAG_WRITE;
5006 fallthrough;
5007 case PGM_PROTECTION:
5008 case PGM_SEGMENT_TRANSLATION:

--- 1146 unchanged lines hidden ---