From nobody Sun Apr 28 19:18:08 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 1500554602657776.998834103999; Thu, 20 Jul 2017 05:43:22 -0700 (PDT) Received: from localhost ([::1]:37937 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAnZ-0002lr-DA for importer@patchew.org; Thu, 20 Jul 2017 08:43:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43321) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAhv-0006WR-8m for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYAht-0004QC-4H for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58408) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYAhs-0004Po-UT for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:29 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C2C087717; Thu, 20 Jul 2017 12:37:27 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-151.ams2.redhat.com [10.36.117.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 18BD37D4E8; Thu, 20 Jul 2017 12:37:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com C2C087717 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com C2C087717 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 20 Jul 2017 14:37:17 +0200 Message-Id: <20170720123721.12366-2-david@redhat.com> In-Reply-To: <20170720123721.12366-1-david@redhat.com> References: <20170720123721.12366-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 20 Jul 2017 12:37:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/5] target/s390x: drop BE_BIT() 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, rth@twiddle.net 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" Unused and broken, let's just get rid of it. Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand --- target/s390x/cpu_features.h | 1 - 1 file changed, 1 deletion(-) diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h index 14bc311..770435e 100644 --- a/target/s390x/cpu_features.h +++ b/target/s390x/cpu_features.h @@ -92,6 +92,5 @@ typedef struct { const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group); =20 #define BE_BIT_NR(BIT) (BIT ^ (BITS_PER_LONG - 1)) -#define BE_BIT(BIT) (1ULL < BE_BIT_NR(BIT)) =20 #endif /* TARGET_S390X_CPU_FEATURES_H */ --=20 2.9.4 From nobody Sun Apr 28 19:18:08 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 1500554364353849.8158663164877; Thu, 20 Jul 2017 05:39:24 -0700 (PDT) Received: from localhost ([::1]:37916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAji-0007jp-2T for importer@patchew.org; Thu, 20 Jul 2017 08:39:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAhw-0006XO-CJ for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYAhv-0004RE-7Y for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35664) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYAhu-0004Qr-Ue for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:31 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DD5B6267F6; Thu, 20 Jul 2017 12:37:29 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-151.ams2.redhat.com [10.36.117.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1C15A7D4E8; Thu, 20 Jul 2017 12:37:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com DD5B6267F6 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com DD5B6267F6 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 20 Jul 2017 14:37:18 +0200 Message-Id: <20170720123721.12366-3-david@redhat.com> In-Reply-To: <20170720123721.12366-1-david@redhat.com> References: <20170720123721.12366-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 20 Jul 2017 12:37:30 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/5] target/s390x: indicate query subfunction in s390_fill_feat_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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, rth@twiddle.net 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" We'll have to do the same for TCG, so let's just move it in there. Reviewed-by: Christian Borntraeger Signed-off-by: David Hildenbrand --- target/s390x/cpu_features.c | 31 ++++++++++++++++++++++++++----- target/s390x/kvm.c | 13 ------------- 2 files changed, 26 insertions(+), 18 deletions(-) diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index fa887d9..8b14917 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -336,11 +336,32 @@ void s390_fill_feat_block(const S390FeatBitmap featur= es, S390FeatType type, S390Feat feat; int bit_nr; =20 - if (type =3D=3D S390_FEAT_TYPE_STFL && test_bit(S390_FEAT_ZARCH, featu= res)) { - /* Features that are always active */ - data[0] |=3D 0x20; /* z/Architecture */ - data[17] |=3D 0x20; /* Configuration-z-architectural-mode */ - } + switch (type) { + case S390_FEAT_TYPE_STFL: + if (test_bit(S390_FEAT_ZARCH, features)) { + /* Features that are always active */ + data[0] |=3D 0x20; /* z/Architecture */ + data[17] |=3D 0x20; /* Configuration-z-architectural-mode */ + } + break; + case S390_FEAT_TYPE_PTFF: + case S390_FEAT_TYPE_KMAC: + case S390_FEAT_TYPE_KMC: + case S390_FEAT_TYPE_KM: + case S390_FEAT_TYPE_KIMD: + case S390_FEAT_TYPE_KLMD: + case S390_FEAT_TYPE_PCKMO: + case S390_FEAT_TYPE_KMCTR: + case S390_FEAT_TYPE_KMF: + case S390_FEAT_TYPE_KMO: + case S390_FEAT_TYPE_PCC: + case S390_FEAT_TYPE_PPNO: + case S390_FEAT_TYPE_KMA: + data[0] |=3D 0x80; /* query is always available */ + break; + default: + break; + }; =20 feat =3D find_first_bit(features, S390_FEAT_MAX); while (feat < S390_FEAT_MAX) { diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 831492f..999ea57 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2506,41 +2506,28 @@ static int configure_cpu_subfunc(const S390FeatBitm= ap features) s390_fill_feat_block(features, S390_FEAT_TYPE_PLO, prop.plo); if (test_bit(S390_FEAT_TOD_CLOCK_STEERING, features)) { s390_fill_feat_block(features, S390_FEAT_TYPE_PTFF, prop.ptff); - prop.ptff[0] |=3D 0x80; /* query is always available */ } if (test_bit(S390_FEAT_MSA, features)) { s390_fill_feat_block(features, S390_FEAT_TYPE_KMAC, prop.kmac); - prop.kmac[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_KMC, prop.kmc); - prop.kmc[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_KM, prop.km); - prop.km[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_KIMD, prop.kimd); - prop.kimd[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_KLMD, prop.klmd); - prop.klmd[0] |=3D 0x80; /* query is always available */ } if (test_bit(S390_FEAT_MSA_EXT_3, features)) { s390_fill_feat_block(features, S390_FEAT_TYPE_PCKMO, prop.pckmo); - prop.pckmo[0] |=3D 0x80; /* query is always available */ } if (test_bit(S390_FEAT_MSA_EXT_4, features)) { s390_fill_feat_block(features, S390_FEAT_TYPE_KMCTR, prop.kmctr); - prop.kmctr[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_KMF, prop.kmf); - prop.kmf[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_KMO, prop.kmo); - prop.kmo[0] |=3D 0x80; /* query is always available */ s390_fill_feat_block(features, S390_FEAT_TYPE_PCC, prop.pcc); - prop.pcc[0] |=3D 0x80; /* query is always available */ } if (test_bit(S390_FEAT_MSA_EXT_5, 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 2.9.4 From nobody Sun Apr 28 19:18:08 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 1500554514127806.2905072091104; Thu, 20 Jul 2017 05:41:54 -0700 (PDT) Received: from localhost ([::1]:37932 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAm8-0001WW-Ri for importer@patchew.org; Thu, 20 Jul 2017 08:41:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43364) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAhy-0006Zf-Vk for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYAhx-0004SZ-Rt for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42142) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYAhx-0004S7-K2 for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:33 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4975B87649; Thu, 20 Jul 2017 12:37:32 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-151.ams2.redhat.com [10.36.117.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E1AC7D4E8; Thu, 20 Jul 2017 12:37:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4975B87649 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4975B87649 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 20 Jul 2017 14:37:19 +0200 Message-Id: <20170720123721.12366-4-david@redhat.com> In-Reply-To: <20170720123721.12366-1-david@redhat.com> References: <20170720123721.12366-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 20 Jul 2017 12:37:32 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/5] target/s390x: introduce (test|set)_be_bit 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, rth@twiddle.net 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" Using ordinary bitmap operations to set/test bits does not work properly on architectures !s390x. Let's drop (test|set)_bit_inv and introduce (test|set)_be_bit instead. These functions work on uint8_t array, not on unsigned longs arrays and are for now only used in the context of CPU features. Signed-off-by: David Hildenbrand --- target/s390x/cpu_features.c | 8 ++++---- target/s390x/cpu_features.h | 8 ++++++++ target/s390x/kvm.c | 14 ++------------ 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/target/s390x/cpu_features.c b/target/s390x/cpu_features.c index 8b14917..1d3a036 100644 --- a/target/s390x/cpu_features.c +++ b/target/s390x/cpu_features.c @@ -340,8 +340,8 @@ void s390_fill_feat_block(const S390FeatBitmap features= , S390FeatType type, case S390_FEAT_TYPE_STFL: if (test_bit(S390_FEAT_ZARCH, features)) { /* Features that are always active */ - data[0] |=3D 0x20; /* z/Architecture */ - data[17] |=3D 0x20; /* Configuration-z-architectural-mode */ + set_be_bit(2, data); /* z/Architecture */ + set_be_bit(138, data); /* Configuration-z-architectural-mode */ } break; case S390_FEAT_TYPE_PTFF: @@ -357,7 +357,7 @@ void s390_fill_feat_block(const S390FeatBitmap features= , S390FeatType type, case S390_FEAT_TYPE_PCC: case S390_FEAT_TYPE_PPNO: case S390_FEAT_TYPE_KMA: - data[0] |=3D 0x80; /* query is always available */ + set_be_bit(0, data); /* query is always available */ break; default: break; @@ -368,7 +368,7 @@ void s390_fill_feat_block(const S390FeatBitmap features= , S390FeatType type, if (s390_features[feat].type =3D=3D type) { bit_nr =3D s390_features[feat].bit; /* big endian on uint8_t array */ - data[bit_nr / 8] |=3D 0x80 >> (bit_nr % 8); + set_be_bit(bit_nr, data); } feat =3D find_next_bit(features, S390_FEAT_MAX, feat + 1); } diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h index 770435e..e306aa7 100644 --- a/target/s390x/cpu_features.h +++ b/target/s390x/cpu_features.h @@ -93,4 +93,12 @@ const S390FeatGroupDef *s390_feat_group_def(S390FeatGrou= p group); =20 #define BE_BIT_NR(BIT) (BIT ^ (BITS_PER_LONG - 1)) =20 +static inline void set_be_bit(unsigned int bit_nr, uint8_t *array) +{ + array[bit_nr / 8] |=3D 0x80 >> (bit_nr % 8); +} +static inline bool test_be_bit(unsigned int bit_nr, const uint8_t *array) +{ + return array[bit_nr / 8] & (0x80 >> (bit_nr % 8)); +} #endif /* TARGET_S390X_CPU_FEATURES_H */ diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 999ea57..9bec481 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2430,16 +2430,6 @@ int kvm_arch_msi_data_to_gsi(uint32_t data) abort(); } =20 -static inline int test_bit_inv(long nr, const unsigned long *addr) -{ - return test_bit(BE_BIT_NR(nr), addr); -} - -static inline void set_bit_inv(long nr, unsigned long *addr) -{ - set_bit(BE_BIT_NR(nr), addr); -} - static int query_cpu_subfunc(S390FeatBitmap features) { struct kvm_s390_vm_cpu_subfunc prop; @@ -2566,7 +2556,7 @@ static int query_cpu_feat(S390FeatBitmap features) } =20 for (i =3D 0; i < ARRAY_SIZE(kvm_to_feat); i++) { - if (test_bit_inv(kvm_to_feat[i][0], (unsigned long *)prop.feat)) { + if (test_be_bit(kvm_to_feat[i][0], (uint8_t *) prop.feat)) { set_bit(kvm_to_feat[i][1], features); } } @@ -2585,7 +2575,7 @@ static int configure_cpu_feat(const S390FeatBitmap fe= atures) =20 for (i =3D 0; i < ARRAY_SIZE(kvm_to_feat); i++) { if (test_bit(kvm_to_feat[i][1], features)) { - set_bit_inv(kvm_to_feat[i][0], (unsigned long *)prop.feat); + set_be_bit(kvm_to_feat[i][0], (uint8_t *) prop.feat); } } return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); --=20 2.9.4 From nobody Sun Apr 28 19:18:08 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 150055449170976.44161626571486; Thu, 20 Jul 2017 05:41:31 -0700 (PDT) Received: from localhost ([::1]:37930 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAli-000196-Dz for importer@patchew.org; Thu, 20 Jul 2017 08:41:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAi0-0006bJ-IW for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYAhz-0004TY-Np for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:41118) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYAhz-0004T3-I2 for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:35 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7373F7D0C2; Thu, 20 Jul 2017 12:37:34 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-151.ams2.redhat.com [10.36.117.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id 85D3280A28; Thu, 20 Jul 2017 12:37:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 7373F7D0C2 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 7373F7D0C2 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 20 Jul 2017 14:37:20 +0200 Message-Id: <20170720123721.12366-5-david@redhat.com> In-Reply-To: <20170720123721.12366-1-david@redhat.com> References: <20170720123721.12366-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 20 Jul 2017 12:37:34 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/5] s390x/kvm: better comment regarding zPCI feature availability 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, rth@twiddle.net 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" Acked-by: Christian Borntraeger Signed-off-by: David Hildenbrand --- target/s390x/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c index 9bec481..84416c0 100644 --- a/target/s390x/kvm.c +++ b/target/s390x/kvm.c @@ -2661,7 +2661,7 @@ void kvm_s390_get_host_cpu_model(S390CPUModel *model,= Error **errp) clear_bit(S390_FEAT_CMM_NT, model->features); } =20 - /* set zpci and aen facilities */ + /* We emulate a zPCI bus and AEN, therefore we don't need HW support */ set_bit(S390_FEAT_ZPCI, model->features); set_bit(S390_FEAT_ADAPTER_EVENT_NOTIFICATION, model->features); =20 --=20 2.9.4 From nobody Sun Apr 28 19:18:08 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 1500554510070910.2643621255951; Thu, 20 Jul 2017 05:41:50 -0700 (PDT) Received: from localhost ([::1]:37931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAm4-0001T2-Rs for importer@patchew.org; Thu, 20 Jul 2017 08:41:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43419) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dYAi6-0006gn-Ao for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dYAi2-0004Vl-3K for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55168) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dYAi1-0004VK-QR for qemu-devel@nongnu.org; Thu, 20 Jul 2017 08:37:38 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BC47DC04F4AC; Thu, 20 Jul 2017 12:37:36 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-151.ams2.redhat.com [10.36.117.151]) by smtp.corp.redhat.com (Postfix) with ESMTP id C505B80A28; Thu, 20 Jul 2017 12:37:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BC47DC04F4AC Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BC47DC04F4AC From: David Hildenbrand To: qemu-devel@nongnu.org Date: Thu, 20 Jul 2017 14:37:21 +0200 Message-Id: <20170720123721.12366-6-david@redhat.com> In-Reply-To: <20170720123721.12366-1-david@redhat.com> References: <20170720123721.12366-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 20 Jul 2017 12:37:36 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/5] target/s390x: improve baselining if certain base features are missing 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: thuth@redhat.com, david@redhat.com, cohuck@redhat.com, borntraeger@de.ibm.com, jjherne@linux.vnet.ibm.com, rth@twiddle.net 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" There are certain features that we put into base models, but that are not relevant for the actual search. The most famous example are MSA subfunctions that might be disabled on certain real hardware out there. While the kvm host model detection will usually detect the correct model on such machines (as it will in the common case not pass features to check for into s390_find_cpu_def()), baselining will fall back to a quite old model just because some MSA subfunctions are missing. Let's improve that by ignoring lack of these features while performing the search for a base model. Signed-off-by: David Hildenbrand --- target/s390x/cpu_models.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c index f4e5bb6..92120f4 100644 --- a/target/s390x/cpu_models.c +++ b/target/s390x/cpu_models.c @@ -78,6 +78,9 @@ static S390CPUDef s390_cpu_defs[] =3D { CPUDEF_INIT(0x3906, 14, 1, 47, 0x08000000U, "z14", "IBM z14 GA1"), }; =20 +/* features part of a base model but not relevant for finding a base model= */ +S390FeatBitmap ignored_base_feat; + void s390_cpudef_featoff(uint8_t gen, uint8_t ec_ga, S390Feat feat) { const S390CPUDef *def; @@ -237,6 +240,11 @@ const S390CPUDef *s390_find_cpu_def(uint16_t type, uin= t8_t gen, uint8_t ec_ga, if (features) { /* see if the model satisfies the minimum features */ bitmap_andnot(missing, def->base_feat, features, S390_FEAT_MAX= ); + /* + * Ignore certain features that are in the base model, but not + * relevant for the search (esp. MSA subfunctions). + */ + bitmap_andnot(missing, missing, ignored_base_feat, S390_FEAT_M= AX); if (!bitmap_empty(missing, S390_FEAT_MAX)) { break; } @@ -1209,10 +1217,35 @@ static const TypeInfo host_s390_cpu_type_info =3D { }; #endif =20 +static void init_ignored_base_feat(void) +{ + static const int feats[] =3D { + /* MSA subfunctions that could not be available on certain machin= es */ + S390_FEAT_KMAC_DEA, + S390_FEAT_KMAC_TDEA_128, + S390_FEAT_KMAC_TDEA_192, + S390_FEAT_KMC_DEA, + S390_FEAT_KMC_TDEA_128, + S390_FEAT_KMC_TDEA_192, + S390_FEAT_KM_DEA, + S390_FEAT_KM_TDEA_128, + S390_FEAT_KM_TDEA_192, + S390_FEAT_KIMD_SHA_1, + S390_FEAT_KLMD_SHA_1, + }; + int i; + + for (i =3D 0; i < ARRAY_SIZE(feats); i++) { + set_bit(feats[i], ignored_base_feat); + } +} + static void register_types(void) { int i; =20 + init_ignored_base_feat(); + /* init all bitmaps from gnerated data initially */ for (i =3D 0; i < ARRAY_SIZE(s390_cpu_defs); i++) { s390_init_feat_bitmap(s390_cpu_defs[i].base_init, --=20 2.9.4