From nobody Mon Feb 9 03:12:45 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153477037525864.22622828058707; Mon, 20 Aug 2018 06:06:15 -0700 (PDT) Received: from localhost ([::1]:47000 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frjso-0001BO-AC for importer@patchew.org; Mon, 20 Aug 2018 09:06:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46087) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frjhC-0007I2-82 for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:54:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frjh9-000677-QF for qemu-devel@nongnu.org; Mon, 20 Aug 2018 08:54:10 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:51632 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frjh9-00066z-Kq; Mon, 20 Aug 2018 08:54:07 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 473FD804B9F2; Mon, 20 Aug 2018 12:54:07 +0000 (UTC) Received: from localhost (dhcp-192-222.str.redhat.com [10.33.192.222]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6EC362026D66; Mon, 20 Aug 2018 12:54:05 +0000 (UTC) From: Cornelia Huck To: Peter Maydell Date: Mon, 20 Aug 2018 14:53:40 +0200 Message-Id: <20180820125341.5882-7-cohuck@redhat.com> In-Reply-To: <20180820125341.5882-1-cohuck@redhat.com> References: <20180820125341.5882-1-cohuck@redhat.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 20 Aug 2018 12:54:07 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Mon, 20 Aug 2018 12:54:07 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'cohuck@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PULL 6/7] s390x/kvm: add etoken facility X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Thomas Huth , David Hildenbrand , Cornelia Huck , Alexander Graf , qemu-devel@nongnu.org, Christian Borntraeger , qemu-s390x@nongnu.org, Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Christian Borntraeger Provide the etoken facility. We need to handle cpu model, migration and clear reset. Signed-off-by: Christian Borntraeger Acked-by: Janosch Frank Message-Id: <20180731090448.36662-3-borntraeger@de.ibm.com> Reviewed-by: David Hildenbrand Signed-off-by: Cornelia Huck --- target/s390x/cpu.h | 3 +++ target/s390x/cpu_features.c | 3 ++- target/s390x/cpu_features_def.h | 3 ++- target/s390x/gen-features.c | 3 ++- target/s390x/kvm.c | 11 +++++++++++ target/s390x/machine.c | 20 +++++++++++++++++++- 6 files changed, 39 insertions(+), 4 deletions(-) diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 86b66dfeac..6f8861e554 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -2,6 +2,7 @@ * S/390 virtual CPU header * * Copyright (c) 2009 Ulrich Hecht + * Copyright IBM Corp. 2012, 2018 * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -68,6 +69,8 @@ struct CPUS390XState { uint32_t aregs[16]; /* access registers */ uint8_t riccb[64]; /* runtime instrumentation control */ uint64_t gscb[4]; /* guarded storage control */ + uint64_t etoken; /* etoken */ + uint64_t etoken_extension; /* etoken extension */ =20 /* Fields up to this point are not cleared by initial CPU reset */ struct {} start_initial_reset_fields; diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index d623db34a6..172fb18df7 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -1,7 +1,7 @@ /* * CPU features/facilities for s390x * - * Copyright 2016 IBM Corp. + * Copyright IBM Corp. 2016, 2018 * * Author(s): David Hildenbrand * @@ -105,6 +105,7 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("irbm", S390_FEAT_TYPE_STFL, 145, "Insert-reference-bits-mul= tiple facility"), FEAT_INIT("msa8-base", S390_FEAT_TYPE_STFL, 146, "Message-security-ass= ist-extension-8 facility (excluding subfunctions)"), FEAT_INIT("cmmnt", S390_FEAT_TYPE_STFL, 147, "CMM: ESSA-enhancement (n= o translate) facility"), + FEAT_INIT("etoken", S390_FEAT_TYPE_STFL, 156, "Etoken facility"), =20 /* SCLP SCCB Byte 80 - 98 (bit numbers relative to byte-80) */ FEAT_INIT("gsls", S390_FEAT_TYPE_SCLP_CONF_CHAR, 40, "SIE: Guest-stora= ge-limit-suppression facility"), diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_de= f.h index 7c5915c7b2..ac2c947f30 100644 --- a/target/s390x/cpu_features_def.h +++ b/target/s390x/cpu_features_def.h @@ -1,7 +1,7 @@ /* * CPU features/facilities for s390 * - * Copyright 2016 IBM Corp. + * Copyright IBM Corp. 2016, 2018 * * Author(s): Michael Mueller * David Hildenbrand @@ -93,6 +93,7 @@ typedef enum { S390_FEAT_INSERT_REFERENCE_BITS_MULT, S390_FEAT_MSA_EXT_8, S390_FEAT_CMM_NT, + S390_FEAT_ETOKEN, =20 /* Sclp Conf Char */ S390_FEAT_SIE_GSLS, diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 2ca5ededb3..384b61cd67 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -1,7 +1,7 @@ /* * S390 feature list generator * - * Copyright 2016 IBM Corp. + * Copyright IBM Corp. 2016, 2018 * * Author(s): Michael Mueller * David Hildenbrand @@ -471,6 +471,7 @@ static uint16_t full_GEN14_GA1[] =3D { S390_FEAT_GROUP_MSA_EXT_7, S390_FEAT_GROUP_MSA_EXT_8, S390_FEAT_CMM_NT, + S390_FEAT_ETOKEN, S390_FEAT_HPMA2, S390_FEAT_SIE_KSS, S390_FEAT_GROUP_MULTIPLE_EPOCH_PTFF, diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index d923cf4240..af83955e5f 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -493,6 +493,12 @@ int kvm_arch_put_registers(CPUState *cs, int level) cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_BPBC; } =20 + if (can_sync_regs(cs, KVM_SYNC_ETOKEN)) { + cs->kvm_run->s.regs.etoken =3D env->etoken; + cs->kvm_run->s.regs.etoken_extension =3D env->etoken_extension; + cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_ETOKEN; + } + /* Finally the prefix */ if (can_sync_regs(cs, KVM_SYNC_PREFIX)) { cs->kvm_run->s.regs.prefix =3D env->psa; @@ -607,6 +613,11 @@ int kvm_arch_get_registers(CPUState *cs) env->bpbc =3D cs->kvm_run->s.regs.bpbc; } =20 + if (can_sync_regs(cs, KVM_SYNC_ETOKEN)) { + env->etoken =3D cs->kvm_run->s.regs.etoken; + env->etoken_extension =3D cs->kvm_run->s.regs.etoken_extension; + } + /* pfault parameters */ if (can_sync_regs(cs, KVM_SYNC_PFAULT)) { env->pfault_token =3D cs->kvm_run->s.regs.pft; diff --git a/target/s390x/machine.c b/target/s390x/machine.c index bd3230d027..cb792aa103 100644 --- a/target/s390x/machine.c +++ b/target/s390x/machine.c @@ -1,7 +1,7 @@ /* * S390x machine definitions and functions * - * Copyright IBM Corp. 2014 + * Copyright IBM Corp. 2014, 2018 * * Authors: * Thomas Huth @@ -216,6 +216,23 @@ const VMStateDescription vmstate_bpbc =3D { } }; =20 +static bool etoken_needed(void *opaque) +{ + return s390_has_feat(S390_FEAT_ETOKEN); +} + +const VMStateDescription vmstate_etoken =3D { + .name =3D "cpu/etoken", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D etoken_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT64(env.etoken, S390CPU), + VMSTATE_UINT64(env.etoken_extension, S390CPU), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_s390_cpu =3D { .name =3D "cpu", .post_load =3D cpu_post_load, @@ -251,6 +268,7 @@ const VMStateDescription vmstate_s390_cpu =3D { &vmstate_exval, &vmstate_gscb, &vmstate_bpbc, + &vmstate_etoken, NULL }, }; --=20 2.14.4