From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499962377949409.54229157043414; Thu, 13 Jul 2017 09:12:57 -0700 (PDT) Received: from localhost ([::1]:32794 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgjX-0004J4-G4 for importer@patchew.org; Thu, 13 Jul 2017 12:12:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaL-0004Th-2X for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaH-0005WK-UH for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:25 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41489) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaH-0005Vx-Jg for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:21 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG2m5N139635 for ; Thu, 13 Jul 2017 12:03:20 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpb5jtj63-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:18 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:14 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:11 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3AKG52101202; Thu, 13 Jul 2017 16:03:10 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 22A2C4C05E; Thu, 13 Jul 2017 17:00:54 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EFCA84C04E; Thu, 13 Jul 2017 17:00:53 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 17:00:53 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 53EE020F69D; Thu, 13 Jul 2017 18:03:10 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:03 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0016-0000-0000-000004D6F325 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0017-0000-0000-0000280B3CB7 Message-Id: <1499961789-127874-2-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 1/7] s390x/cpumodel: wire up new hardware features 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: Christian Borntraeger , Cornelia Huck , Alexander Graf , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Jason J. Herne" Some new guest features have been introduced recently. Lets wire them up in the CPU model. Signed-off-by: Jason J. Herne Acked-by: Christian Borntraeger Signed-off-by: Christian Borntraeger [split patch] Acked-by: Cornelia Huck --- include/hw/s390x/sclp.h | 3 +-- target/s390x/cpu_features.c | 41 +++++++++++++++++++++++++++++++++++++= ++++ target/s390x/cpu_features.h | 4 ++++ target/s390x/cpu_features_def.h | 41 +++++++++++++++++++++++++++++++++++++= +++- target/s390x/cpu_models.c | 25 +++++++++++++++++++++++++ target/s390x/gen-features.c | 39 +++++++++++++++++++++++++++++++++++++= ++ target/s390x/kvm.c | 10 ++++++++++ 7 files changed, 160 insertions(+), 3 deletions(-) diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h index 3008a51..e71d526 100644 --- a/include/hw/s390x/sclp.h +++ b/include/hw/s390x/sclp.h @@ -123,8 +123,7 @@ typedef struct ReadInfo { uint64_t facilities; /* 48-55 */ uint8_t _reserved0[76 - 56]; /* 56-75 */ uint32_t ibc_val; - uint8_t conf_char[96 - 80]; /* 80-95 */ - uint8_t _reserved4[99 - 96]; /* 96-98 */ + uint8_t conf_char[99 - 80]; /* 80-98 */ uint8_t mha_pow; uint32_t rnsize2; uint64_t rnmax2; diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index 8ab5cd7..e5a3f71 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -59,6 +59,7 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("exrl", S390_FEAT_TYPE_STFL, 35, "Execute-extensions facilit= y"), FEAT_INIT("emon", S390_FEAT_TYPE_STFL, 36, "Enhanced-monitor facility"= ), FEAT_INIT("fpe", S390_FEAT_TYPE_STFL, 37, "Floating-point extension fa= cility"), + FEAT_INIT("opc", S390_FEAT_TYPE_STFL, 38, "Order Preserving Compressio= n facility"), FEAT_INIT("sprogp", S390_FEAT_TYPE_STFL, 40, "Set-program-parameters f= acility"), FEAT_INIT("fpseh", S390_FEAT_TYPE_STFL, 41, "Floating-point-support-en= hancement facilities"), FEAT_INIT("dfp", S390_FEAT_TYPE_STFL, 42, "DFP (decimal-floating-point= ) facility"), @@ -72,7 +73,11 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("ltlbc", S390_FEAT_TYPE_STFL, 51, "Local-TLB-clearing facili= ty"), FEAT_INIT("iacc2", S390_FEAT_TYPE_STFL, 52, "Interlocked-access facili= ty 2"), FEAT_INIT("stfle53", S390_FEAT_TYPE_STFL, 53, "Various facilities intr= oduced with z13"), + FEAT_INIT("eec", S390_FEAT_TYPE_STFL, 54, "Entropy encoding compressio= n facility"), FEAT_INIT("msa5-base", S390_FEAT_TYPE_STFL, 57, "Message-security-assi= st-extension-5 facility (excluding subfunctions)"), + FEAT_INIT("minste2", S390_FEAT_TYPE_STFL, 58, "Miscellaneous-instructi= on-extensions facility 2"), + FEAT_INIT("sema", S390_FEAT_TYPE_STFL, 59, "Semaphore-assist facility"= ), + FEAT_INIT("tsi", S390_FEAT_TYPE_STFL, 60, "Time-slice Instrumentation = facility"), FEAT_INIT("ri", S390_FEAT_TYPE_STFL, 64, "CPU runtime-instrumentation = facility"), FEAT_INIT("zpci", S390_FEAT_TYPE_STFL, 69, "z/PCI facility"), FEAT_INIT("aen", S390_FEAT_TYPE_STFL, 71, "General-purpose-adapter-eve= nt-notification facility"), @@ -85,10 +90,22 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("edat2", S390_FEAT_TYPE_STFL, 78, "Enhanced-DAT facility 2"), FEAT_INIT("dfppc", S390_FEAT_TYPE_STFL, 80, "Decimal-floating-point pa= cked-conversion facility"), FEAT_INIT("vx", S390_FEAT_TYPE_STFL, 129, "Vector facility"), + FEAT_INIT("iep", S390_FEAT_TYPE_STFL, 130, "Instruction-execution-prot= ection facility"), + FEAT_INIT("sea_esop2", S390_FEAT_TYPE_STFL, 131, "Side-effect-access f= acility and Enhanced-suppression-on-protection facility 2"), + FEAT_INIT("gs", S390_FEAT_TYPE_STFL, 133, "Guarded-storage facility"), + FEAT_INIT("vxpd", S390_FEAT_TYPE_STFL, 134, "Vector packed decimal fac= ility"), + FEAT_INIT("vxeh", S390_FEAT_TYPE_STFL, 135, "Vector enhancements facil= ity"), + FEAT_INIT("mepoch", S390_FEAT_TYPE_STFL, 139, "Multiple-epoch facility= "), + FEAT_INIT("tpei", S390_FEAT_TYPE_STFL, 144, "Test-pending-external-int= erruption facility"), + 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"), =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"), FEAT_INIT("esop", S390_FEAT_TYPE_SCLP_CONF_CHAR, 46, "Enhanced-suppres= sion-on-protection facility"), + FEAT_INIT("hpma2", S390_FEAT_TYPE_SCLP_CONF_CHAR, 90, "Host page manag= ement assist 2 Facility"), /* 91-2 */ + FEAT_INIT("kss", S390_FEAT_TYPE_SCLP_CONF_CHAR, 151, "SIE: Keyless-sub= set facility"), /* 98-7 */ =20 /* SCLP SCCB Byte 116 - 119 (bit numbers relative to byte-116) */ FEAT_INIT("64bscao", S390_FEAT_TYPE_SCLP_CONF_CHAR_EXT, 0, "SIE: 64-bi= t-SCAO facility"), @@ -187,11 +204,23 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("kimd-sha-1", S390_FEAT_TYPE_KIMD, 1, "KIMD SHA-1"), FEAT_INIT("kimd-sha-256", S390_FEAT_TYPE_KIMD, 2, "KIMD SHA-256"), FEAT_INIT("kimd-sha-512", S390_FEAT_TYPE_KIMD, 3, "KIMD SHA-512"), + FEAT_INIT("kimd-sha3-224", S390_FEAT_TYPE_KIMD, 32, "KIMD SHA3-224"), + FEAT_INIT("kimd-sha3-256", S390_FEAT_TYPE_KIMD, 33, "KIMD SHA3-256"), + FEAT_INIT("kimd-sha3-384", S390_FEAT_TYPE_KIMD, 34, "KIMD SHA3-384"), + FEAT_INIT("kimd-sha3-512", S390_FEAT_TYPE_KIMD, 35, "KIMD SHA3-512"), + FEAT_INIT("kimd-shake-128", S390_FEAT_TYPE_KIMD, 36, "KIMD SHAKE-128"), + FEAT_INIT("kimd-shake-256", S390_FEAT_TYPE_KIMD, 37, "KIMD SHAKE-256"), FEAT_INIT("kimd-ghash", S390_FEAT_TYPE_KIMD, 65, "KIMD GHASH"), =20 FEAT_INIT("klmd-sha-1", S390_FEAT_TYPE_KLMD, 1, "KLMD SHA-1"), FEAT_INIT("klmd-sha-256", S390_FEAT_TYPE_KLMD, 2, "KLMD SHA-256"), FEAT_INIT("klmd-sha-512", S390_FEAT_TYPE_KLMD, 3, "KLMD SHA-512"), + FEAT_INIT("klmd-sha3-224", S390_FEAT_TYPE_KLMD, 32, "KLMD SHA3-224"), + FEAT_INIT("klmd-sha3-256", S390_FEAT_TYPE_KLMD, 33, "KLMD SHA3-256"), + FEAT_INIT("klmd-sha3-384", S390_FEAT_TYPE_KLMD, 34, "KLMD SHA3-384"), + FEAT_INIT("klmd-sha3-512", S390_FEAT_TYPE_KLMD, 35, "KLMD SHA3-512"), + FEAT_INIT("klmd-shake-128", S390_FEAT_TYPE_KLMD, 36, "KLMD SHAKE-128"), + FEAT_INIT("klmd-shake-256", S390_FEAT_TYPE_KLMD, 37, "KLMD SHAKE-256"), =20 FEAT_INIT("pckmo-edea", S390_FEAT_TYPE_PCKMO, 1, "PCKMO Encrypted-DEA-= Key"), FEAT_INIT("pckmo-etdea-128", S390_FEAT_TYPE_PCKMO, 2, "PCKMO Encrypted= -TDEA-128-Key"), @@ -257,6 +286,15 @@ static const S390FeatDef s390_features[] =3D { FEAT_INIT("pcc-xts-eaes-256", S390_FEAT_TYPE_PCC, 60, "PCC Compute-XTS= -Parameter-Using-Encrypted-AES-256"), =20 FEAT_INIT("ppno-sha-512-drng", S390_FEAT_TYPE_PPNO, 3, "PPNO SHA-512-D= RNG"), + FEAT_INIT("prno-trng-qrtcr", S390_FEAT_TYPE_PPNO, 112, "PRNO TRNG-Quer= y-Raw-to-Conditioned-Ratio"), + FEAT_INIT("prno-trng", S390_FEAT_TYPE_PPNO, 114, "PRNO TRNG"), + + FEAT_INIT("kma-gcm-aes-128", S390_FEAT_TYPE_KMA, 18, "KMA GCM-AES-128"= ), + FEAT_INIT("kma-gcm-aes-192", S390_FEAT_TYPE_KMA, 19, "KMA GCM-AES-192"= ), + FEAT_INIT("kma-gcm-aes-256", S390_FEAT_TYPE_KMA, 20, "KMA GCM-AES-256"= ), + FEAT_INIT("kma-gcm-eaes-128", S390_FEAT_TYPE_KMA, 26, "KMA GCM-Encrypt= ed-AES-128"), + FEAT_INIT("kma-gcm-eaes-192", S390_FEAT_TYPE_KMA, 27, "KMA GCM-Encrypt= ed-AES-192"), + FEAT_INIT("kma-gcm-eaes-256", S390_FEAT_TYPE_KMA, 28, "KMA GCM-Encrypt= ed-AES-256"), }; =20 const S390FeatDef *s390_feat_def(S390Feat feat) @@ -389,6 +427,9 @@ static S390FeatGroupDef s390_feature_groups[] =3D { FEAT_GROUP_INIT("msa3", MSA_EXT_3, "Message-security-assist-extension = 3 facility"), FEAT_GROUP_INIT("msa4", MSA_EXT_4, "Message-security-assist-extension = 4 facility"), FEAT_GROUP_INIT("msa5", MSA_EXT_5, "Message-security-assist-extension = 5 facility"), + FEAT_GROUP_INIT("msa6", MSA_EXT_6, "Message-security-assist-extension = 6 facility"), + FEAT_GROUP_INIT("msa7", MSA_EXT_7, "Message-security-assist-extension = 7 facility"), + FEAT_GROUP_INIT("msa8", MSA_EXT_8, "Message-security-assist-extension = 8 facility"), }; =20 const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group) diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h index d669121..14bc311 100644 --- a/target/s390x/cpu_features.h +++ b/target/s390x/cpu_features.h @@ -37,6 +37,7 @@ typedef enum { S390_FEAT_TYPE_KMO, S390_FEAT_TYPE_PCC, S390_FEAT_TYPE_PPNO, + S390_FEAT_TYPE_KMA, } S390FeatType; =20 /* Definition of a CPU feature */ @@ -74,6 +75,9 @@ typedef enum { S390_FEAT_GROUP_MSA_EXT_3, S390_FEAT_GROUP_MSA_EXT_4, S390_FEAT_GROUP_MSA_EXT_5, + S390_FEAT_GROUP_MSA_EXT_6, + S390_FEAT_GROUP_MSA_EXT_7, + S390_FEAT_GROUP_MSA_EXT_8, S390_FEAT_GROUP_MAX, } S390FeatGroup; =20 diff --git a/target/s390x/cpu_features_def.h b/target/s390x/cpu_features_de= f.h index c939a00..4b6d4e9 100644 --- a/target/s390x/cpu_features_def.h +++ b/target/s390x/cpu_features_def.h @@ -50,6 +50,7 @@ typedef enum { S390_FEAT_EXECUTE_EXT, S390_FEAT_ENHANCED_MONITOR, S390_FEAT_FLOATING_POINT_EXT, + S390_FEAT_ORDER_PRESERVING_COMPRESSION, S390_FEAT_SET_PROGRAM_PARAMETERS, S390_FEAT_FLOATING_POINT_SUPPPORT_ENH, S390_FEAT_DFP, @@ -63,7 +64,11 @@ typedef enum { S390_FEAT_LOCAL_TLB_CLEARING, S390_FEAT_INTERLOCKED_ACCESS_2, S390_FEAT_STFLE_53, + S390_FEAT_ENTROPY_ENC_COMP, S390_FEAT_MSA_EXT_5, + S390_FEAT_MISC_INSTRUCTION_EXT, + S390_FEAT_SEMAPHORE_ASSIST, + S390_FEAT_TIME_SLICE_INSTRUMENTATION, S390_FEAT_RUNTIME_INSTRUMENTATION, S390_FEAT_ZPCI, S390_FEAT_ADAPTER_EVENT_NOTIFICATION, @@ -76,10 +81,22 @@ typedef enum { S390_FEAT_EDAT_2, S390_FEAT_DFP_PACKED_CONVERSION, S390_FEAT_VECTOR, + S390_FEAT_INSTRUCTION_EXEC_PROT, + S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, + S390_FEAT_GUARDED_STORAGE, + S390_FEAT_VECTOR_PACKED_DECIMAL, + S390_FEAT_VECTOR_ENH, + S390_FEAT_MULTIPLE_EPOCH, + S390_FEAT_TEST_PENDING_EXT_INTERRUPTION, + S390_FEAT_INSERT_REFERENCE_BITS_MULT, + S390_FEAT_MSA_EXT_8, + S390_FEAT_CMM_NT, =20 /* Sclp Conf Char */ S390_FEAT_SIE_GSLS, S390_FEAT_ESOP, + S390_FEAT_HPMA2, + S390_FEAT_SIE_KSS, =20 /* Sclp Conf Char Ext */ S390_FEAT_SIE_64BSCAO, @@ -186,12 +203,24 @@ typedef enum { S390_FEAT_KIMD_SHA_1, S390_FEAT_KIMD_SHA_256, S390_FEAT_KIMD_SHA_512, + S390_FEAT_KIMD_SHA3_224, + S390_FEAT_KIMD_SHA3_256, + S390_FEAT_KIMD_SHA3_384, + S390_FEAT_KIMD_SHA3_512, + S390_FEAT_KIMD_SHAKE_128, + S390_FEAT_KIMD_SHAKE_256, S390_FEAT_KIMD_GHASH, =20 /* KLMD */ S390_FEAT_KLMD_SHA_1, S390_FEAT_KLMD_SHA_256, S390_FEAT_KLMD_SHA_512, + S390_FEAT_KLMD_SHA3_224, + S390_FEAT_KLMD_SHA3_256, + S390_FEAT_KLMD_SHA3_384, + S390_FEAT_KLMD_SHA3_512, + S390_FEAT_KLMD_SHAKE_128, + S390_FEAT_KLMD_SHAKE_256, =20 /* PCKMO */ S390_FEAT_PCKMO_EDEA, @@ -261,8 +290,18 @@ typedef enum { S390_FEAT_PCC_XTS_EAES_128, S390_FEAT_PCC_XTS_EAES_256, =20 - /* PPNO */ + /* PPNO/PRNO */ S390_FEAT_PPNO_SHA_512_DRNG, + S390_FEAT_PRNO_TRNG_QRTCR, + S390_FEAT_PRNO_TRNG, + + /* KMA */ + S390_FEAT_KMA_GCM_AES_128, + S390_FEAT_KMA_GCM_AES_192, + S390_FEAT_KMA_GCM_AES_256 , + S390_FEAT_KMA_GCM_EAES_128, + S390_FEAT_KMA_GCM_EAES_192, + S390_FEAT_KMA_GCM_EAES_256, S390_FEAT_MAX, } S390Feat; =20 diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index fd3f459..16100ec 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -697,6 +697,31 @@ static void check_consistency(const S390CPUModel *mode= l) { S390_FEAT_SIE_CMMA, S390_FEAT_CMM }, { S390_FEAT_SIE_CMMA, S390_FEAT_SIE_GSLS }, { S390_FEAT_SIE_PFMFI, S390_FEAT_EDAT }, + { S390_FEAT_MSA_EXT_8, S390_FEAT_MSA_EXT_3 }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, + { S390_FEAT_VECTOR_PACKED_DECIMAL, S390_FEAT_VECTOR }, + { S390_FEAT_VECTOR_ENH, S390_FEAT_VECTOR }, + { S390_FEAT_INSTRUCTION_EXEC_PROT, S390_FEAT_SIDE_EFFECT_ACCESS_ES= OP2 }, + { S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, S390_FEAT_ESOP }, + { S390_FEAT_CMM_NT, S390_FEAT_CMM }, + { S390_FEAT_GUARDED_STORAGE, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2 }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_STORE_CLOCK_FAST }, + { S390_FEAT_MULTIPLE_EPOCH, S390_FEAT_TOD_CLOCK_STEERING }, + { S390_FEAT_SEMAPHORE_ASSIST, S390_FEAT_STFLE_49 }, + { S390_FEAT_KIMD_SHA3_224, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_256, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_384, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHA3_512, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHAKE_128, S390_FEAT_MSA }, + { S390_FEAT_KIMD_SHAKE_256, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_224, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_256, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_384, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHA3_512, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHAKE_128, S390_FEAT_MSA }, + { S390_FEAT_KLMD_SHAKE_256, S390_FEAT_MSA }, + { S390_FEAT_PRNO_TRNG_QRTCR, S390_FEAT_MSA_EXT_5 }, + { S390_FEAT_PRNO_TRNG, S390_FEAT_MSA_EXT_5 }, }; int i; =20 diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 622ee24..33404e4 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -182,6 +182,33 @@ S390_FEAT_MSA_EXT_5, \ S390_FEAT_PPNO_SHA_512_DRNG =20 +#define S390_FEAT_GROUP_MSA_EXT_6 \ + S390_FEAT_KIMD_SHA3_224, \ + S390_FEAT_KIMD_SHA3_256, \ + S390_FEAT_KIMD_SHA3_384, \ + S390_FEAT_KIMD_SHA3_512, \ + S390_FEAT_KIMD_SHAKE_128, \ + S390_FEAT_KIMD_SHAKE_256, \ + S390_FEAT_KLMD_SHA3_224, \ + S390_FEAT_KLMD_SHA3_256, \ + S390_FEAT_KLMD_SHA3_384, \ + S390_FEAT_KLMD_SHA3_512, \ + S390_FEAT_KLMD_SHAKE_128, \ + S390_FEAT_KLMD_SHAKE_256 + +#define S390_FEAT_GROUP_MSA_EXT_7 \ + S390_FEAT_PRNO_TRNG_QRTCR, \ + S390_FEAT_PRNO_TRNG + +#define S390_FEAT_GROUP_MSA_EXT_8 \ + S390_FEAT_MSA_EXT_8, \ + S390_FEAT_KMA_GCM_AES_128, \ + S390_FEAT_KMA_GCM_AES_192, \ + S390_FEAT_KMA_GCM_AES_256 , \ + S390_FEAT_KMA_GCM_EAES_128, \ + S390_FEAT_KMA_GCM_EAES_192, \ + S390_FEAT_KMA_GCM_EAES_256 + /* cpu feature groups */ static uint16_t group_PLO[] =3D { S390_FEAT_GROUP_PLO, @@ -210,6 +237,15 @@ static uint16_t group_MSA_EXT_4[] =3D { static uint16_t group_MSA_EXT_5[] =3D { S390_FEAT_GROUP_MSA_EXT_5, }; +static uint16_t group_MSA_EXT_6[] =3D { + S390_FEAT_GROUP_MSA_EXT_6, +}; +static uint16_t group_MSA_EXT_7[] =3D { + S390_FEAT_GROUP_MSA_EXT_7, +}; +static uint16_t group_MSA_EXT_8[] =3D { + S390_FEAT_GROUP_MSA_EXT_8, +}; =20 /* Base features (in order of release) * Only non-hypervisor managed features belong here. @@ -548,6 +584,9 @@ static FeatGroupDefSpec FeatGroupDef[] =3D { FEAT_GROUP_INITIALIZER(MSA_EXT_3), FEAT_GROUP_INITIALIZER(MSA_EXT_4), FEAT_GROUP_INITIALIZER(MSA_EXT_5), + FEAT_GROUP_INITIALIZER(MSA_EXT_6), + FEAT_GROUP_INITIALIZER(MSA_EXT_7), + FEAT_GROUP_INITIALIZER(MSA_EXT_8), }; =20 static void set_bits(uint64_t list[], BitSpec bits) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 1901153..3a80f1f 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2447,6 +2447,9 @@ static int query_cpu_subfunc(S390FeatBitmap features) if (test_bit(S390_FEAT_MSA_EXT_5, features)) { s390_add_from_feat_block(features, S390_FEAT_TYPE_PPNO, prop.ppno); } + if (test_bit(S390_FEAT_MSA_EXT_8, features)) { + s390_add_from_feat_block(features, S390_FEAT_TYPE_KMA, prop.kma); + } return 0; } =20 @@ -2500,6 +2503,10 @@ static int configure_cpu_subfunc(const S390FeatBitma= p features) s390_fill_feat_block(features, S390_FEAT_TYPE_PPNO, prop.ppno); prop.ppno[0] |=3D 0x80; /* query is always available */ } + if (test_bit(S390_FEAT_MSA_EXT_8, features)) { + s390_fill_feat_block(features, S390_FEAT_TYPE_KMA, prop.kma); + prop.kma[0] |=3D 0x80; /* query is always available */ + } return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); } =20 @@ -2636,6 +2643,9 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model,= Error **errp) /* with cpu model support, CMM is only indicated if really available */ if (kvm_s390_cmma_available()) { set_bit(S390_FEAT_CMM, model->features); + } else { + /* no cmm -> no cmm nt */ + clear_bit(S390_FEAT_CMM_NT, model->features); } =20 /* set zpci and aen facilities */ --=20 2.7.4 From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499962696705363.6890712043064; Thu, 13 Jul 2017 09:18:16 -0700 (PDT) Received: from localhost ([::1]:32834 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgof-0001RL-BL for importer@patchew.org; Thu, 13 Jul 2017 12:18:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59764) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaV-0004fd-Dz for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaS-0005b4-AZ for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:35 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:49227 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaS-0005av-5Z for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:32 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG35Jt064407 for ; Thu, 13 Jul 2017 12:03:31 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bpafm4kxc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:30 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:14 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:11 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3BTv15925598; Thu, 13 Jul 2017 16:03:11 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B63AC11C058; Thu, 13 Jul 2017 17:00:36 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9ED0611C052; Thu, 13 Jul 2017 17:00:36 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 17:00:36 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 95CC020F69C; Thu, 13 Jul 2017 18:03:10 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:04 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0020-0000-0000-000003A1E8E7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0021-0000-0000-00004227399A Message-Id: <1499961789-127874-3-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 2/7] s390x/cpumodel: we are always in zarchitecture mode 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: Christian Borntraeger , Cornelia Huck , Alexander Graf , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Jason J. Herne" In QEMU, a guest VCPU always started in and never was able to leave z/Architecture mode. Now we have an architected way of showing this condition. The SIGP SET ARCHITECTURE instruction is simply rejected. Linux as guest seems to not care about the return value, which is a good thing The new handling is just like already being in z/Architecture mode. We'll not try to fake absence of this facility, but still not indicate the facility in case some strange CPU model turned z/Architecture off completely (which doesn't work either way but let's us see how a guest would react on a lack of this facility). Signed-off-by: Jason J. Herne Acked-by: Christian Borntraeger Acked-by: Cornelia Huck Signed-off-by: Christian Borntraeger --- target/s390x/cpu_features.c | 5 +++-- target/s390x/kvm.c | 38 +++++++++++--------------------------- 2 files changed, 14 insertions(+), 29 deletions(-) diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index e5a3f71..fa887d9 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -337,8 +337,9 @@ void s390_fill_feat_block(const S390FeatBitmap features= , S390FeatType type, int bit_nr; =20 if (type =3D=3D S390_FEAT_TYPE_STFL && test_bit(S390_FEAT_ZARCH, featu= res)) { - /* z/Architecture is always active if around */ - data[0] |=3D 0x20; + /* Features that are always active */ + data[0] |=3D 0x20; /* z/Architecture */ + data[17] |=3D 0x20; /* Configuration-z-architectural-mode */ } =20 feat =3D find_first_bit(features, S390_FEAT_MAX); diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 3a80f1f..8c6cc0a 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -1757,41 +1757,25 @@ static int sigp_set_architecture(S390CPU *cpu, uint= 32_t param, { CPUState *cur_cs; S390CPU *cur_cpu; + bool all_stopped =3D true; =20 - /* due to the BQL, we are the only active cpu */ CPU_FOREACH(cur_cs) { cur_cpu =3D S390_CPU(cur_cs); - if (cur_cpu->env.sigp_order !=3D 0) { - return SIGP_CC_BUSY; + + if (cur_cpu =3D=3D cpu) { + continue; } - cpu_synchronize_state(cur_cs); - /* all but the current one have to be stopped */ - if (cur_cpu !=3D cpu && - s390_cpu_get_state(cur_cpu) !=3D CPU_STATE_STOPPED) { - *status_reg &=3D 0xffffffff00000000ULL; - *status_reg |=3D SIGP_STAT_INCORRECT_STATE; - return SIGP_CC_STATUS_STORED; + if (s390_cpu_get_state(cur_cpu) !=3D CPU_STATE_STOPPED) { + all_stopped =3D false; } } =20 - switch (param & 0xff) { - case SIGP_MODE_ESA_S390: - /* not supported */ - return SIGP_CC_NOT_OPERATIONAL; - case SIGP_MODE_Z_ARCH_TRANS_ALL_PSW: - case SIGP_MODE_Z_ARCH_TRANS_CUR_PSW: - CPU_FOREACH(cur_cs) { - cur_cpu =3D S390_CPU(cur_cs); - cur_cpu->env.pfault_token =3D -1UL; - } - break; - default: - *status_reg &=3D 0xffffffff00000000ULL; - *status_reg |=3D SIGP_STAT_INVALID_PARAMETER; - return SIGP_CC_STATUS_STORED; - } + *status_reg &=3D 0xffffffff00000000ULL; =20 - return SIGP_CC_ORDER_CODE_ACCEPTED; + /* Reject set arch order, with czam we're always in z/Arch mode. */ + *status_reg |=3D (all_stopped ? SIGP_STAT_INVALID_PARAMETER : + SIGP_STAT_INCORRECT_STATE); + return SIGP_CC_STATUS_STORED; } =20 static int handle_sigp(S390CPU *cpu, struct kvm_run *run, uint8_t ipa1) --=20 2.7.4 From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 149996253462265.42527105271529; Thu, 13 Jul 2017 09:15:34 -0700 (PDT) Received: from localhost ([::1]:32818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgm1-0006md-T4 for importer@patchew.org; Thu, 13 Jul 2017 12:15:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59693) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaO-0004XJ-KN for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaL-0005YV-IF for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:28 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54333) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaL-0005Xs-9o for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:25 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG2wPs049087 for ; Thu, 13 Jul 2017 12:03:24 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bnt3pyc61-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:23 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:14 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:11 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3BIG16908422; Thu, 13 Jul 2017 16:03:11 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 293AB42041; Thu, 13 Jul 2017 17:00:34 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 178B04203F; Thu, 13 Jul 2017 17:00:34 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 17:00:34 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id E179320F69D; Thu, 13 Jul 2017 18:03:10 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:05 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0008-0000-0000-00000480E9FC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0009-0000-0000-00001E0C26E2 Message-Id: <1499961789-127874-4-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 3/7] s390x/cpumodel: add esop/esop2 to z12 model 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: Christian Borntraeger , Cornelia Huck , Alexander Graf , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: "Jason J. Herne" Add esop and esop2 features to z12 model where esop2 was originally introdu= ced. Provide a mechanism to disable features in compatibility machines and use t= his method to disable esop and esop2 when using compatibility machine v2.9 or earlier. Signed-off-by: Jason J. Herne Acked-by: Christian Borntraeger Signed-off-by: Christian Borntraeger Reviewed-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 3 +++ target/s390x/gen-features.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index e484aed..657a45f 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -30,6 +30,7 @@ #include "hw/s390x/s390-virtio-ccw.h" #include "hw/s390x/css-bridge.h" #include "migration/register.h" +#include "cpu_models.h" =20 static const char *const reset_dev_types[] =3D { TYPE_VIRTUAL_CSS_BRIDGE, @@ -503,6 +504,8 @@ DEFINE_CCW_MACHINE(2_10, "2.10", true); static void ccw_machine_2_9_instance_options(MachineState *machine) { ccw_machine_2_10_instance_options(machine); + s390_cpudef_featoff_greater(12, 1, S390_FEAT_ESOP); + s390_cpudef_featoff_greater(12, 1, S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2); s390_cpudef_featoff_greater(12, 1, S390_FEAT_ZPCI); s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_INT_SUPPRESSION); s390_cpudef_featoff_greater(12, 1, S390_FEAT_ADAPTER_EVENT_NOTIFICATIO= N); diff --git a/target/s390x/gen-features.c b/target/s390x/gen-features.c index 33404e4..af14b11 100644 --- a/target/s390x/gen-features.c +++ b/target/s390x/gen-features.c @@ -429,6 +429,7 @@ static uint16_t full_GEN12_GA1[] =3D { S390_FEAT_ADAPTER_EVENT_NOTIFICATION, S390_FEAT_ADAPTER_INT_SUPPRESSION, S390_FEAT_EDAT_2, + S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, }; =20 static uint16_t full_GEN12_GA2[] =3D { @@ -488,6 +489,8 @@ static uint16_t default_GEN12_GA1[] =3D { S390_FEAT_ZPCI, S390_FEAT_ADAPTER_EVENT_NOTIFICATION, S390_FEAT_EDAT_2, + S390_FEAT_ESOP, + S390_FEAT_SIDE_EFFECT_ACCESS_ESOP2, }; =20 #define default_GEN12_GA2 EmptyFeat --=20 2.7.4 From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14999624780261014.1322836073554; Thu, 13 Jul 2017 09:14:38 -0700 (PDT) Received: from localhost ([::1]:32813 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgl7-0005nO-Oj for importer@patchew.org; Thu, 13 Jul 2017 12:14:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaI-0004Qg-9n for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaF-0005Ux-7X for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:22 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53770) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaE-0005UI-UA for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:19 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG2pE8048663 for ; Thu, 13 Jul 2017 12:03:17 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bnt3pyc5y-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:17 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:14 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:12 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3BBO18088418; Thu, 13 Jul 2017 16:03:11 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 512F8A404D; Thu, 13 Jul 2017 17:00:29 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3E843A4057; Thu, 13 Jul 2017 17:00:29 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 17:00:29 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 2CEDB20F69C; Thu, 13 Jul 2017 18:03:11 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:06 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0016-0000-0000-000004D6F32C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0017-0000-0000-0000280B3CB9 Message-Id: <1499961789-127874-5-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 4/7] s390x/kvm: Enable KSS facility for nested virtualization 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: Cornelia Huck , Farhan Ali , Alexander Graf , Christian Borntraeger , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Farhan Ali If the host supports keyless subset (KSS) then first level guest (G2) should enable KSS facility as well. Signed-off-by: Farhan Ali Reviewed-by: Eric Farman Signed-off-by: Christian Borntraeger Acked-by: Cornelia Huck --- target/s390x/kvm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 8c6cc0a..c773bd6 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2508,6 +2508,7 @@ static int kvm_to_feat[][2] =3D { { KVM_S390_VM_CPU_FEAT_CMMA, S390_FEAT_SIE_CMMA }, { KVM_S390_VM_CPU_FEAT_PFMFI, S390_FEAT_SIE_PFMFI}, { KVM_S390_VM_CPU_FEAT_SIGPIF, S390_FEAT_SIE_SIGPIF}, + { KVM_S390_VM_CPU_FEAT_KSS, S390_FEAT_SIE_KSS}, }; =20 static int query_cpu_feat(S390FeatBitmap features) --=20 2.7.4 From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499962606172455.2337940030769; Thu, 13 Jul 2017 09:16:46 -0700 (PDT) Received: from localhost ([::1]:32826 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgnC-00088E-HR for importer@patchew.org; Thu, 13 Jul 2017 12:16:42 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaS-0004bV-PB for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaP-0005aM-J1 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:32 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:54121) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaP-0005Zo-9V for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:29 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG355B040174 for ; Thu, 13 Jul 2017 12:03:28 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bnt3rq7k3-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:25 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:14 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:12 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3B1J13959468; Thu, 13 Jul 2017 16:03:11 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 37AD8AE056; Thu, 13 Jul 2017 16:59:47 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1C112AE053; Thu, 13 Jul 2017 16:59:47 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 16:59:47 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 6EC8420F69D; Thu, 13 Jul 2017 18:03:11 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:07 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0040-0000-0000-000003C3EA0F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0041-0000-0000-000025BF2FDA Message-Id: <1499961789-127874-6-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PATCH 5/7] s390x/kvm: enable guarded storage 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: Cornelia Huck , Alexander Graf , Fan Zhang , Christian Borntraeger , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fan Zhang Introduce guarded storage support for KVM guests on s390. We need to enable the capability, extend machine check validity, sigp store-additional-status-at-address, and migration. The feature is fenced for older machine type versions. Signed-off-by: Fan Zhang Signed-off-by: Christian Borntraeger Reviewed-by: Cornelia Huck --- hw/s390x/s390-virtio-ccw.c | 18 ++++++++++ include/hw/s390x/s390-virtio-ccw.h | 3 ++ target/s390x/cpu.h | 7 ++++ target/s390x/kvm.c | 71 ++++++++++++++++++++++++++++++++--= ---- target/s390x/machine.c | 17 +++++++++ 5 files changed, 106 insertions(+), 10 deletions(-) diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c index 657a45f..ce3921e 100644 --- a/hw/s390x/s390-virtio-ccw.c +++ b/hw/s390x/s390-virtio-ccw.c @@ -211,6 +211,7 @@ static void ccw_machine_class_init(ObjectClass *oc, voi= d *data) s390mc->ri_allowed =3D true; s390mc->cpu_model_allowed =3D true; s390mc->css_migration_enabled =3D true; + s390mc->gs_allowed =3D true; mc->init =3D ccw_init; mc->reset =3D s390_machine_reset; mc->hot_add_cpu =3D s390_hot_add_cpu; @@ -288,6 +289,22 @@ bool cpu_model_allowed(void) return get_machine_class()->cpu_model_allowed; } =20 +bool gs_allowed(void) +{ + if (kvm_enabled()) { + MachineClass *mc =3D MACHINE_GET_CLASS(qdev_get_machine()); + if (object_class_dynamic_cast(OBJECT_CLASS(mc), + TYPE_S390_CCW_MACHINE)) { + S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); + + return s390mc->gs_allowed; + } + /* Make sure the "none" machine can have gs */ + return true; + } + return false; +} + static char *machine_get_loadparm(Object *obj, Error **errp) { S390CcwMachineState *ms =3D S390_CCW_MACHINE(obj); @@ -515,6 +532,7 @@ static void ccw_machine_2_9_class_options(MachineClass = *mc) { S390CcwMachineClass *s390mc =3D S390_MACHINE_CLASS(mc); =20 + s390mc->gs_allowed =3D false; ccw_machine_2_10_class_options(mc); SET_MACHINE_COMPAT(mc, CCW_COMPAT_2_9); s390mc->css_migration_enabled =3D false; diff --git a/include/hw/s390x/s390-virtio-ccw.h b/include/hw/s390x/s390-vir= tio-ccw.h index ab88d49..41a9d28 100644 --- a/include/hw/s390x/s390-virtio-ccw.h +++ b/include/hw/s390x/s390-virtio-ccw.h @@ -40,12 +40,15 @@ typedef struct S390CcwMachineClass { bool ri_allowed; bool cpu_model_allowed; bool css_migration_enabled; + bool gs_allowed; } S390CcwMachineClass; =20 /* runtime-instrumentation allowed by the machine */ bool ri_allowed(void); /* cpu model allowed by the machine */ bool cpu_model_allowed(void); +/* guarded-storage allowed by the machine */ +bool gs_allowed(void); =20 /** * Returns true if (vmstate based) migration of the channel subsystem diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h index 8ab75c0..7732d01 100644 --- a/target/s390x/cpu.h +++ b/target/s390x/cpu.h @@ -89,6 +89,7 @@ typedef struct CPUS390XState { CPU_DoubleU vregs[32][2]; /* vector registers */ uint32_t aregs[16]; /* access registers */ uint8_t riccb[64]; /* runtime instrumentation control */ + uint64_t gscb[4]; /* guarded storage control */ =20 /* Fields up to this point are not cleared by initial CPU reset */ struct {} start_initial_reset_fields; @@ -1166,6 +1167,7 @@ int kvm_s390_set_mem_limit(KVMState *s, uint64_t new_= limit, uint64_t *hw_limit); void kvm_s390_vcpu_interrupt_pre_save(S390CPU *cpu); int kvm_s390_vcpu_interrupt_post_load(S390CPU *cpu); int kvm_s390_get_ri(void); +int kvm_s390_get_gs(void); void kvm_s390_crypto_reset(void); #else static inline void kvm_s390_io_interrupt(uint16_t subchannel_id, @@ -1220,6 +1222,10 @@ static inline int kvm_s390_get_ri(void) { return 0; } +static inline int kvm_s390_get_gs(void) +{ + return 0; +} static inline void kvm_s390_crypto_reset(void) { } @@ -1328,6 +1334,7 @@ static inline bool s390_get_squash_mcss(void) #define MCIC_VB_CR 0x0000000400000000ULL #define MCIC_VB_ST 0x0000000100000000ULL #define MCIC_VB_AR 0x0000000040000000ULL +#define MCIC_VB_GS 0x0000000008000000ULL #define MCIC_VB_PR 0x0000000000200000ULL #define MCIC_VB_FC 0x0000000000100000ULL #define MCIC_VB_CT 0x0000000000020000ULL diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index c773bd6..831492f 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -139,6 +139,7 @@ static int cap_async_pf; static int cap_mem_op; static int cap_s390_irq; static int cap_ri; +static int cap_gs; =20 static int active_cmma; =20 @@ -301,6 +302,11 @@ int kvm_arch_init(MachineState *ms, KVMState *s) cap_ri =3D 1; } } + if (gs_allowed()) { + if (kvm_vm_enable_cap(s, KVM_CAP_S390_GS, 0) =3D=3D 0) { + cap_gs =3D 1; + } + } =20 /* Try to enable AIS facility */ kvm_vm_enable_cap(s, KVM_CAP_S390_AIS, 0); @@ -472,6 +478,11 @@ int kvm_arch_put_registers(CPUState *cs, int level) } } =20 + if (can_sync_regs(cs, KVM_SYNC_GSCB)) { + memcpy(cs->kvm_run->s.regs.gscb, env->gscb, 32); + cs->kvm_run->kvm_dirty_regs |=3D KVM_SYNC_GSCB; + } + /* Finally the prefix */ if (can_sync_regs(cs, KVM_SYNC_PREFIX)) { cs->kvm_run->s.regs.prefix =3D env->psa; @@ -578,6 +589,10 @@ int kvm_arch_get_registers(CPUState *cs) memcpy(env->riccb, cs->kvm_run->s.regs.riccb, 64); } =20 + if (can_sync_regs(cs, KVM_SYNC_GSCB)) { + memcpy(env->gscb, cs->kvm_run->s.regs.gscb, 32); + } + /* pfault parameters */ if (can_sync_regs(cs, KVM_SYNC_PFAULT)) { env->pfault_token =3D cs->kvm_run->s.regs.pft; @@ -1474,22 +1489,28 @@ static void sigp_stop(CPUState *cs, run_on_cpu_data= arg) si->cc =3D SIGP_CC_ORDER_CODE_ACCEPTED; } =20 -#define ADTL_SAVE_AREA_SIZE 1024 -static int kvm_s390_store_adtl_status(S390CPU *cpu, hwaddr addr) +#define ADTL_GS_OFFSET 1024 /* offset of GS data in adtl save area */ +#define ADTL_GS_MIN_SIZE 2048 /* minimal size of adtl save area for GS */ +static int do_store_adtl_status(S390CPU *cpu, hwaddr addr, hwaddr len) { + hwaddr save =3D len; void *mem; - hwaddr len =3D ADTL_SAVE_AREA_SIZE; =20 - mem =3D cpu_physical_memory_map(addr, &len, 1); + mem =3D cpu_physical_memory_map(addr, &save, 1); if (!mem) { return -EFAULT; } - if (len !=3D ADTL_SAVE_AREA_SIZE) { + if (save !=3D len) { cpu_physical_memory_unmap(mem, len, 1, 0); return -EFAULT; } =20 - memcpy(mem, &cpu->env.vregs, 512); + if (s390_has_feat(S390_FEAT_VECTOR)) { + memcpy(mem, &cpu->env.vregs, 512); + } + if (s390_has_feat(S390_FEAT_GUARDED_STORAGE) && len >=3D ADTL_GS_MIN_S= IZE) { + memcpy(mem + ADTL_GS_OFFSET, &cpu->env.gscb, 32); + } =20 cpu_physical_memory_unmap(mem, len, 1, len); =20 @@ -1585,12 +1606,17 @@ static void sigp_store_status_at_address(CPUState *= cs, run_on_cpu_data arg) si->cc =3D SIGP_CC_ORDER_CODE_ACCEPTED; } =20 +#define ADTL_SAVE_LC_MASK 0xfUL static void sigp_store_adtl_status(CPUState *cs, run_on_cpu_data arg) { S390CPU *cpu =3D S390_CPU(cs); SigpInfo *si =3D arg.host_ptr; + uint8_t lc =3D si->param & ADTL_SAVE_LC_MASK; + hwaddr addr =3D si->param & ~ADTL_SAVE_LC_MASK; + hwaddr len =3D 1UL << (lc ? lc : 10); =20 - if (!s390_has_feat(S390_FEAT_VECTOR)) { + if (!s390_has_feat(S390_FEAT_VECTOR) && + !s390_has_feat(S390_FEAT_GUARDED_STORAGE)) { set_sigp_status(si, SIGP_STAT_INVALID_ORDER); return; } @@ -1601,15 +1627,32 @@ static void sigp_store_adtl_status(CPUState *cs, ru= n_on_cpu_data arg) return; } =20 - /* parameter must be aligned to 1024-byte boundary */ - if (si->param & 0x3ff) { + /* address must be aligned to length */ + if (addr & (len - 1)) { + set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); + return; + } + + /* no GS: only lc =3D=3D 0 is valid */ + if (!s390_has_feat(S390_FEAT_GUARDED_STORAGE) && + lc !=3D 0) { + set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); + return; + } + + /* GS: 0, 10, 11, 12 are valid */ + if (s390_has_feat(S390_FEAT_GUARDED_STORAGE) && + lc !=3D 0 && + lc !=3D 10 && + lc !=3D 11 && + lc !=3D 12) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } =20 cpu_synchronize_state(cs); =20 - if (kvm_s390_store_adtl_status(cpu, si->param)) { + if (do_store_adtl_status(cpu, addr, len)) { set_sigp_status(si, SIGP_STAT_INVALID_PARAMETER); return; } @@ -2188,6 +2231,9 @@ static uint64_t build_channel_report_mcic(void) if (s390_has_feat(S390_FEAT_VECTOR)) { mcic |=3D MCIC_VB_VR; } + if (s390_has_feat(S390_FEAT_GUARDED_STORAGE)) { + mcic |=3D MCIC_VB_GS; + } return mcic; } =20 @@ -2253,6 +2299,11 @@ int kvm_s390_get_ri(void) return cap_ri; } =20 +int kvm_s390_get_gs(void) +{ + return cap_gs; +} + int kvm_s390_set_cpu_state(S390CPU *cpu, uint8_t cpu_state) { struct kvm_mp_state mp_state =3D {}; diff --git a/target/s390x/machine.c b/target/s390x/machine.c index 8f908bb..2dcadfd 100644 --- a/target/s390x/machine.c +++ b/target/s390x/machine.c @@ -174,6 +174,22 @@ const VMStateDescription vmstate_exval =3D { } }; =20 +static bool gscb_needed(void *opaque) +{ + return kvm_s390_get_gs(); +} + +const VMStateDescription vmstate_gscb =3D { + .name =3D "cpu/gscb", + .version_id =3D 1, + .minimum_version_id =3D 1, + .needed =3D gscb_needed, + .fields =3D (VMStateField[]) { + VMSTATE_UINT64_ARRAY(env.gscb, S390CPU, 4), + VMSTATE_END_OF_LIST() + } +}; + const VMStateDescription vmstate_s390_cpu =3D { .name =3D "cpu", .post_load =3D cpu_post_load, @@ -207,6 +223,7 @@ const VMStateDescription vmstate_s390_cpu =3D { &vmstate_vregs, &vmstate_riccb, &vmstate_exval, + &vmstate_gscb, NULL }, }; --=20 2.7.4 From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499962382581922.7479703749917; Thu, 13 Jul 2017 09:13:02 -0700 (PDT) Received: from localhost ([::1]:32797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgjb-0004MD-6I for importer@patchew.org; Thu, 13 Jul 2017 12:12:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59647) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaL-0004US-Pz for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaI-0005Wk-Nu for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:25 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:37490 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaI-0005WV-If for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:22 -0400 Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG35fi092712 for ; Thu, 13 Jul 2017 12:03:21 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bp61g00qb-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:18 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:15 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:12 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3CKT13959472; Thu, 13 Jul 2017 16:03:12 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D85E5A4053; Thu, 13 Jul 2017 17:00:29 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C64A5A404D; Thu, 13 Jul 2017 17:00:29 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 17:00:29 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id B594620F69C; Thu, 13 Jul 2017 18:03:11 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:08 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0040-0000-0000-000003E3EC16 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0041-0000-0000-0000207F2F04 Message-Id: <1499961789-127874-7-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 6/7] s390x/arch_dump: also dump guarded storage control block 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: Christian Borntraeger , Cornelia Huck , Alexander Graf , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Write the new note section of type 30b (guarded storage control block). Signed-off-by: Christian Borntraeger Acked-by: Cornelia Huck --- include/elf.h | 1 + target/s390x/arch_dump.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/include/elf.h b/include/elf.h index 0dbd3e9..cd51434 100644 --- a/include/elf.h +++ b/include/elf.h @@ -1476,6 +1476,7 @@ typedef struct elf64_shdr { #define NT_TASKSTRUCT 4 #define NT_AUXV 6 #define NT_PRXFPREG 0x46e62b7f /* copied from gdb5.1/include/elf/= common.h */ +#define NT_S390_GS_CB 0x30b /* s390 guarded storage registers = */ #define NT_S390_VXRS_HIGH 0x30a /* s390 vector registers 16-31 */ #define NT_S390_VXRS_LOW 0x309 /* s390 vector registers 0-15 (low= er half) */ #define NT_S390_PREFIX 0x305 /* s390 prefix register */ diff --git a/target/s390x/arch_dump.c b/target/s390x/arch_dump.c index 105ae9a..96c9fb9 100644 --- a/target/s390x/arch_dump.c +++ b/target/s390x/arch_dump.c @@ -57,6 +57,12 @@ struct S390xElfVregsHiStruct { =20 typedef struct S390xElfVregsHiStruct S390xElfVregsHi; =20 +struct S390xElfGSCBStruct { + uint64_t gsregs[4]; +} QEMU_PACKED; + +typedef struct S390xElfGSCBStruct S390xElfGSCB; + typedef struct noteStruct { Elf64_Nhdr hdr; char name[8]; @@ -65,6 +71,7 @@ typedef struct noteStruct { S390xElfFpregset fpregset; S390xElfVregsLo vregslo; S390xElfVregsHi vregshi; + S390xElfGSCB gscb; uint32_t prefix; uint64_t timer; uint64_t todcmp; @@ -126,6 +133,16 @@ static void s390x_write_elf64_vregshi(Note *note, S390= CPU *cpu, int id) } } =20 +static void s390x_write_elf64_gscb(Note *note, S390CPU *cpu, int id) +{ + int i; + + note->hdr.n_type =3D cpu_to_be32(NT_S390_GS_CB); + for (i =3D 0; i < 4; i++) { + note->contents.gscb.gsregs[i] =3D cpu_to_be64(cpu->env.gscb[i]); + } +} + static void s390x_write_elf64_timer(Note *note, S390CPU *cpu, int id) { note->hdr.n_type =3D cpu_to_be32(NT_S390_TIMER); @@ -181,6 +198,7 @@ static const NoteFuncDesc note_linux[] =3D { {sizeof(((Note *)0)->contents.todpreg), s390x_write_elf64_todpreg}, {sizeof(((Note *)0)->contents.vregslo), s390x_write_elf64_vregslo}, {sizeof(((Note *)0)->contents.vregshi), s390x_write_elf64_vregshi}, + {sizeof(((Note *)0)->contents.gscb), s390x_write_elf64_gscb}, { 0, NULL} }; =20 --=20 2.7.4 From nobody Sun May 19 22:19:05 2024 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1499962229099580.1126939656112; Thu, 13 Jul 2017 09:10:29 -0700 (PDT) Received: from localhost ([::1]:60971 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgh7-0001n1-HI for importer@patchew.org; Thu, 13 Jul 2017 12:10:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59631) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVgaK-0004TU-Uc for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVgaH-0005WE-Rv for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:24 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36426 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dVgaH-0005W4-MC for qemu-devel@nongnu.org; Thu, 13 Jul 2017 12:03:21 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6DG2pST112451 for ; Thu, 13 Jul 2017 12:03:21 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2bpapdv659-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 13 Jul 2017 12:03:20 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 13 Jul 2017 17:03:15 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 13 Jul 2017 17:03:12 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6DG3CPt17760346; Thu, 13 Jul 2017 16:03:12 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DFB1A4053; Thu, 13 Jul 2017 17:00:30 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 14CF9A405E; Thu, 13 Jul 2017 17:00:30 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Thu, 13 Jul 2017 17:00:30 +0100 (BST) Received: by tuxmaker.boeblingen.de.ibm.com (Postfix, from userid 25651) id 0367F20F69D; Thu, 13 Jul 2017 18:03:12 +0200 (CEST) From: Christian Borntraeger To: qemu-devel Date: Thu, 13 Jul 2017 18:03:09 +0200 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> References: <1499961789-127874-1-git-send-email-borntraeger@de.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17071316-0020-0000-0000-000003A1E8EB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071316-0021-0000-0000-00004227399D Message-Id: <1499961789-127874-8-git-send-email-borntraeger@de.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-13_09:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707130251 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.158.5 Subject: [Qemu-devel] [PATCH 7/7] s390x/gdb: add gs registers 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: Christian Borntraeger , Cornelia Huck , Alexander Graf , "Jason J . Herne" , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Let's provide the guarded storage registers via gdb server. Signed-off-by: Christian Borntraeger Acked-by: Cornelia Huck --- configure | 2 +- gdb-xml/s390-gs.xml | 14 ++++++++++++++ target/s390x/gdbstub.c | 24 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 gdb-xml/s390-gs.xml diff --git a/configure b/configure index 5096cbc..1fd09b4 100755 --- a/configure +++ b/configure @@ -6227,7 +6227,7 @@ case "$target_name" in echo "TARGET_ABI32=3Dy" >> $config_target_mak ;; s390x) - gdb_xml_files=3D"s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xm= l s390-cr.xml s390-virt.xml" + gdb_xml_files=3D"s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xm= l s390-cr.xml s390-virt.xml s390-gs.xml" ;; tilegx) ;; diff --git a/gdb-xml/s390-gs.xml b/gdb-xml/s390-gs.xml new file mode 100644 index 0000000..0487d31 --- /dev/null +++ b/gdb-xml/s390-gs.xml @@ -0,0 +1,14 @@ + + + + + + + + + + diff --git a/target/s390x/gdbstub.c b/target/s390x/gdbstub.c index 94ab74d..a7efafe 100644 --- a/target/s390x/gdbstub.c +++ b/target/s390x/gdbstub.c @@ -286,6 +286,26 @@ static int cpu_write_virt_reg(CPUS390XState *env, uint= 8_t *mem_buf, int n) } #endif =20 +/* the values represent the positions in s390-gs.xml */ +#define S390_GS_RESERVED_REGNUM 0 +#define S390_GS_GSD_REGNUM 1 +#define S390_GS_GSSM_REGNUM 2 +#define S390_GS_GSEPLA_REGNUM 3 +/* total number of registers in s390-gs.xml */ +#define S390_NUM_GS_REGS 4 + +static int cpu_read_gs_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +{ + return gdb_get_regl(mem_buf, env->gscb[n]); +} + +static int cpu_write_gs_reg(CPUS390XState *env, uint8_t *mem_buf, int n) +{ + env->gscb[n] =3D ldtul_p(mem_buf); + cpu_synchronize_post_init(ENV_GET_CPU(env)); + return 8; +} + void s390_cpu_gdb_init(CPUState *cs) { gdb_register_coprocessor(cs, cpu_read_ac_reg, @@ -300,6 +320,10 @@ void s390_cpu_gdb_init(CPUState *cs) cpu_write_vreg, S390_NUM_VREGS, "s390-vx.xml", 0); =20 + gdb_register_coprocessor(cs, cpu_read_gs_reg, + cpu_write_gs_reg, + S390_NUM_GS_REGS, "s390-gs.xml", 0); + #ifndef CONFIG_USER_ONLY gdb_register_coprocessor(cs, cpu_read_c_reg, cpu_write_c_reg, --=20 2.7.4