|
|
383d26 |
From d5c27d4667cc1fb8065c27dc7e7d0e5d29f34e29 Mon Sep 17 00:00:00 2001
|
|
|
383d26 |
From: Thomas Huth <thuth@redhat.com>
|
|
|
383d26 |
Date: Tue, 28 Aug 2018 17:03:12 +0200
|
|
|
383d26 |
Subject: [PATCH 02/29] s390x/kvm: add etoken facility
|
|
|
383d26 |
|
|
|
383d26 |
RH-Author: Thomas Huth <thuth@redhat.com>
|
|
|
383d26 |
Message-id: <1535475792-21136-3-git-send-email-thuth@redhat.com>
|
|
|
383d26 |
Patchwork-id: 81948
|
|
|
383d26 |
O-Subject: [RHEL-7.6 qemu-kvm-ma PATCH 2/2] s390x/kvm: add etoken facility
|
|
|
383d26 |
Bugzilla: 1622962
|
|
|
383d26 |
RH-Acked-by: David Hildenbrand <david@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
383d26 |
RH-Acked-by: Jens Freimann <jfreimann@redhat.com>
|
|
|
383d26 |
|
|
|
383d26 |
From: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
383d26 |
|
|
|
383d26 |
Provide the etoken facility. We need to handle cpu model, migration and
|
|
|
383d26 |
clear reset.
|
|
|
383d26 |
|
|
|
383d26 |
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
|
|
|
383d26 |
Acked-by: Janosch Frank <frankja@linux.ibm.com>
|
|
|
383d26 |
Message-Id: <20180731090448.36662-3-borntraeger@de.ibm.com>
|
|
|
383d26 |
Reviewed-by: David Hildenbrand <david@redhat.com>
|
|
|
383d26 |
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
|
|
|
383d26 |
(cherry picked from commit 27e84d4ebd25b981ab27cb590fe06d1b0fcd06d2)
|
|
|
383d26 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
383d26 |
---
|
|
|
383d26 |
target/s390x/cpu.h | 3 +++
|
|
|
383d26 |
target/s390x/cpu_features.c | 3 ++-
|
|
|
383d26 |
target/s390x/cpu_features_def.h | 3 ++-
|
|
|
383d26 |
target/s390x/gen-features.c | 3 ++-
|
|
|
383d26 |
target/s390x/kvm.c | 11 +++++++++++
|
|
|
383d26 |
target/s390x/machine.c | 20 +++++++++++++++++++-
|
|
|
383d26 |
6 files changed, 39 insertions(+), 4 deletions(-)
|
|
|
383d26 |
|
|
|
383d26 |
diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
|
|
|
383d26 |
index 3ee40f0..86d08fa 100644
|
|
|
383d26 |
--- a/target/s390x/cpu.h
|
|
|
383d26 |
+++ b/target/s390x/cpu.h
|
|
|
383d26 |
@@ -2,6 +2,7 @@
|
|
|
383d26 |
* S/390 virtual CPU header
|
|
|
383d26 |
*
|
|
|
383d26 |
* Copyright (c) 2009 Ulrich Hecht
|
|
|
383d26 |
+ * Copyright IBM Corp. 2012, 2018
|
|
|
383d26 |
*
|
|
|
383d26 |
* This library is free software; you can redistribute it and/or
|
|
|
383d26 |
* modify it under the terms of the GNU Lesser General Public
|
|
|
383d26 |
@@ -68,6 +69,8 @@ struct CPUS390XState {
|
|
|
383d26 |
uint32_t aregs[16]; /* access registers */
|
|
|
383d26 |
uint8_t riccb[64]; /* runtime instrumentation control */
|
|
|
383d26 |
uint64_t gscb[4]; /* guarded storage control */
|
|
|
383d26 |
+ uint64_t etoken; /* etoken */
|
|
|
383d26 |
+ uint64_t etoken_extension; /* etoken extension */
|
|
|
383d26 |
|
|
|
383d26 |
/* Fields up to this point are not cleared by initial CPU reset */
|
|
|
383d26 |
struct {} start_initial_reset_fields;
|
|
|
383d26 |
diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c
|
|
|
383d26 |
index 3b9e274..e05e6aa 100644
|
|
|
383d26 |
--- a/target/s390x/cpu_features.c
|
|
|
383d26 |
+++ b/target/s390x/cpu_features.c
|
|
|
383d26 |
@@ -1,7 +1,7 @@
|
|
|
383d26 |
/*
|
|
|
383d26 |
* CPU features/facilities for s390x
|
|
|
383d26 |
*
|
|
|
383d26 |
- * Copyright 2016 IBM Corp.
|
|
|
383d26 |
+ * Copyright IBM Corp. 2016, 2018
|
|
|
383d26 |
*
|
|
|
383d26 |
* Author(s): David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
|
383d26 |
*
|
|
|
383d26 |
@@ -106,6 +106,7 @@ static const S390FeatDef s390_features[] = {
|
|
|
383d26 |
FEAT_INIT("irbm", S390_FEAT_TYPE_STFL, 145, "Insert-reference-bits-multiple facility"),
|
|
|
383d26 |
FEAT_INIT("msa8-base", S390_FEAT_TYPE_STFL, 146, "Message-security-assist-extension-8 facility (excluding subfunctions)"),
|
|
|
383d26 |
FEAT_INIT("cmmnt", S390_FEAT_TYPE_STFL, 147, "CMM: ESSA-enhancement (no translate) facility"),
|
|
|
383d26 |
+ FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "Etoken facility"),
|
|
|
383d26 |
|
|
|
383d26 |
/* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */
|
|
|
383d26 |
FEAT_INIT("gsls", S390_FEAT_TYPE_SCLP_CONF_CHAR, 40, "SIE: Guest-storage-limit-suppression facility"),
|
|
|
383d26 |
diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_def.h
|
|
|
383d26 |
index 7c5915c..ac2c947 100644
|
|
|
383d26 |
--- a/target/s390x/cpu_features_def.h
|
|
|
383d26 |
+++ b/target/s390x/cpu_features_def.h
|
|
|
383d26 |
@@ -1,7 +1,7 @@
|
|
|
383d26 |
/*
|
|
|
383d26 |
* CPU features/facilities for s390
|
|
|
383d26 |
*
|
|
|
383d26 |
- * Copyright 2016 IBM Corp.
|
|
|
383d26 |
+ * Copyright IBM Corp. 2016, 2018
|
|
|
383d26 |
*
|
|
|
383d26 |
* Author(s): Michael Mueller <mimu@linux.vnet.ibm.com>
|
|
|
383d26 |
* David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
|
383d26 |
@@ -93,6 +93,7 @@ typedef enum {
|
|
|
383d26 |
S390_FEAT_INSERT_REFERENCE_BITS_MULT,
|
|
|
383d26 |
S390_FEAT_MSA_EXT_8,
|
|
|
383d26 |
S390_FEAT_CMM_NT,
|
|
|
383d26 |
+ S390_FEAT_ETOKEN,
|
|
|
383d26 |
|
|
|
383d26 |
/* Sclp Conf Char */
|
|
|
383d26 |
S390_FEAT_SIE_GSLS,
|
|
|
383d26 |
diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c
|
|
|
383d26 |
index 6626b6f..5af042c 100644
|
|
|
383d26 |
--- a/target/s390x/gen-features.c
|
|
|
383d26 |
+++ b/target/s390x/gen-features.c
|
|
|
383d26 |
@@ -1,7 +1,7 @@
|
|
|
383d26 |
/*
|
|
|
383d26 |
* S390 feature list generator
|
|
|
383d26 |
*
|
|
|
383d26 |
- * Copyright 2016 IBM Corp.
|
|
|
383d26 |
+ * Copyright IBM Corp. 2016, 2018
|
|
|
383d26 |
*
|
|
|
383d26 |
* Author(s): Michael Mueller <mimu@linux.vnet.ibm.com>
|
|
|
383d26 |
* David Hildenbrand <dahi@linux.vnet.ibm.com>
|
|
|
383d26 |
@@ -471,6 +471,7 @@ static uint16_t full_GEN14_GA1[] = {
|
|
|
383d26 |
S390_FEAT_GROUP_MSA_EXT_7,
|
|
|
383d26 |
S390_FEAT_GROUP_MSA_EXT_8,
|
|
|
383d26 |
S390_FEAT_CMM_NT,
|
|
|
383d26 |
+ S390_FEAT_ETOKEN,
|
|
|
383d26 |
S390_FEAT_HPMA2,
|
|
|
383d26 |
S390_FEAT_SIE_KSS,
|
|
|
383d26 |
S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF,
|
|
|
383d26 |
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
|
|
|
383d26 |
index fbccceb..ca8c32e 100644
|
|
|
383d26 |
--- a/target/s390x/kvm.c
|
|
|
383d26 |
+++ b/target/s390x/kvm.c
|
|
|
383d26 |
@@ -494,6 +494,12 @@ int kvm_arch_put_registers(CPUState *cs, int level)
|
|
|
383d26 |
cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_BPBC;
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+ if (can_sync_regs(cs, KVM_SYNC_ETOKEN)) {
|
|
|
383d26 |
+ cs->kvm_run->s.regs.etoken = env->etoken;
|
|
|
383d26 |
+ cs->kvm_run->s.regs.etoken_extension = env->etoken_extension;
|
|
|
383d26 |
+ cs->kvm_run->kvm_dirty_regs |= KVM_SYNC_ETOKEN;
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+
|
|
|
383d26 |
/* Finally the prefix */
|
|
|
383d26 |
if (can_sync_regs(cs, KVM_SYNC_PREFIX)) {
|
|
|
383d26 |
cs->kvm_run->s.regs.prefix = env->psa;
|
|
|
383d26 |
@@ -608,6 +614,11 @@ int kvm_arch_get_registers(CPUState *cs)
|
|
|
383d26 |
env->bpbc = cs->kvm_run->s.regs.bpbc;
|
|
|
383d26 |
}
|
|
|
383d26 |
|
|
|
383d26 |
+ if (can_sync_regs(cs, KVM_SYNC_ETOKEN)) {
|
|
|
383d26 |
+ env->etoken = cs->kvm_run->s.regs.etoken;
|
|
|
383d26 |
+ env->etoken_extension = cs->kvm_run->s.regs.etoken_extension;
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+
|
|
|
383d26 |
/* pfault parameters */
|
|
|
383d26 |
if (can_sync_regs(cs, KVM_SYNC_PFAULT)) {
|
|
|
383d26 |
env->pfault_token = cs->kvm_run->s.regs.pft;
|
|
|
383d26 |
diff --git a/target/s390x/machine.c b/target/s390x/machine.c
|
|
|
383d26 |
index 84b4928..8421deb 100644
|
|
|
383d26 |
--- a/target/s390x/machine.c
|
|
|
383d26 |
+++ b/target/s390x/machine.c
|
|
|
383d26 |
@@ -1,7 +1,7 @@
|
|
|
383d26 |
/*
|
|
|
383d26 |
* S390x machine definitions and functions
|
|
|
383d26 |
*
|
|
|
383d26 |
- * Copyright IBM Corp. 2014
|
|
|
383d26 |
+ * Copyright IBM Corp. 2014, 2018
|
|
|
383d26 |
*
|
|
|
383d26 |
* Authors:
|
|
|
383d26 |
* Thomas Huth <thuth@linux.vnet.ibm.com>
|
|
|
383d26 |
@@ -210,6 +210,23 @@ const VMStateDescription vmstate_bpbc = {
|
|
|
383d26 |
}
|
|
|
383d26 |
};
|
|
|
383d26 |
|
|
|
383d26 |
+static bool etoken_needed(void *opaque)
|
|
|
383d26 |
+{
|
|
|
383d26 |
+ return s390_has_feat(S390_FEAT_ETOKEN);
|
|
|
383d26 |
+}
|
|
|
383d26 |
+
|
|
|
383d26 |
+const VMStateDescription vmstate_etoken = {
|
|
|
383d26 |
+ .name = "cpu/etoken",
|
|
|
383d26 |
+ .version_id = 1,
|
|
|
383d26 |
+ .minimum_version_id = 1,
|
|
|
383d26 |
+ .needed = etoken_needed,
|
|
|
383d26 |
+ .fields = (VMStateField[]) {
|
|
|
383d26 |
+ VMSTATE_UINT64(env.etoken, S390CPU),
|
|
|
383d26 |
+ VMSTATE_UINT64(env.etoken_extension, S390CPU),
|
|
|
383d26 |
+ VMSTATE_END_OF_LIST()
|
|
|
383d26 |
+ }
|
|
|
383d26 |
+};
|
|
|
383d26 |
+
|
|
|
383d26 |
const VMStateDescription vmstate_s390_cpu = {
|
|
|
383d26 |
.name = "cpu",
|
|
|
383d26 |
.post_load = cpu_post_load,
|
|
|
383d26 |
@@ -245,6 +262,7 @@ const VMStateDescription vmstate_s390_cpu = {
|
|
|
383d26 |
&vmstate_exval,
|
|
|
383d26 |
&vmstate_gscb,
|
|
|
383d26 |
&vmstate_bpbc,
|
|
|
383d26 |
+ &vmstate_etoken,
|
|
|
383d26 |
NULL
|
|
|
383d26 |
},
|
|
|
383d26 |
};
|
|
|
383d26 |
--
|
|
|
383d26 |
1.8.3.1
|
|
|
383d26 |
|