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