From nobody Mon Apr 29 15:18:54 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 1500458556857243.0927413729537; Wed, 19 Jul 2017 03:02:36 -0700 (PDT) Received: from localhost ([::1]:60854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXloR-0002Kh-Ol for importer@patchew.org; Wed, 19 Jul 2017 06:02:35 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50579) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlmS-0000vj-2O for qemu-devel@nongnu.org; Wed, 19 Jul 2017 06:00:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXlmN-0006H3-4R for qemu-devel@nongnu.org; Wed, 19 Jul 2017 06:00:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46636) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXlmM-0006GU-Ut for qemu-devel@nongnu.org; Wed, 19 Jul 2017 06:00:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 351207F3E5; Wed, 19 Jul 2017 09:50:47 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7519A7E135; Wed, 19 Jul 2017 09:50:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 351207F3E5 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 351207F3E5 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 11:50:29 +0200 Message-Id: <20170719095033.20482-2-david@redhat.com> In-Reply-To: <20170719095033.20482-1-david@redhat.com> References: <20170719095033.20482-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 19 Jul 2017 09:50:47 +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 v1 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. Signed-off-by: David Hildenbrand Acked-by: Christian Borntraeger --- 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 Mon Apr 29 15:18:54 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 150045855533521.38104423486152; Wed, 19 Jul 2017 03:02:35 -0700 (PDT) Received: from localhost ([::1]:60853 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXloO-0002Ik-Mg for importer@patchew.org; Wed, 19 Jul 2017 06:02:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50578) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlmS-0000vd-1q for qemu-devel@nongnu.org; Wed, 19 Jul 2017 06:00:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXlmN-0006HB-6n for qemu-devel@nongnu.org; Wed, 19 Jul 2017 06:00:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46654) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXlmM-0006GY-VC for qemu-devel@nongnu.org; Wed, 19 Jul 2017 06:00:27 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2F6C97F3F2; Wed, 19 Jul 2017 09:50:50 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFF3F7E12D; Wed, 19 Jul 2017 09:50:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2F6C97F3F2 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2F6C97F3F2 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 11:50:30 +0200 Message-Id: <20170719095033.20482-3-david@redhat.com> In-Reply-To: <20170719095033.20482-1-david@redhat.com> References: <20170719095033.20482-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 19 Jul 2017 09:50:50 +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 v1 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. Signed-off-by: David Hildenbrand Reviewed-by: Christian Borntraeger --- 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 Mon Apr 29 15:18:54 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 1500458339521243.82205297875828; Wed, 19 Jul 2017 02:58:59 -0700 (PDT) Received: from localhost ([::1]:60835 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlkt-0007dz-OU for importer@patchew.org; Wed, 19 Jul 2017 05:58:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49645) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXljU-0006no-J5 for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:57:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXljR-0005Rp-FZ for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:57:28 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45154) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXljR-0005RJ-6a for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:57:25 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0ED39C04B948; Wed, 19 Jul 2017 09:50:54 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id A7E077E12D; Wed, 19 Jul 2017 09:50:50 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0ED39C04B948 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 0ED39C04B948 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 11:50:31 +0200 Message-Id: <20170719095033.20482-4-david@redhat.com> In-Reply-To: <20170719095033.20482-1-david@redhat.com> References: <20170719095033.20482-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 19 Jul 2017 09:50:54 +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 v1 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..fe02315 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], 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], prop.feat); } } return kvm_vm_ioctl(kvm_state, KVM_SET_DEVICE_ATTR, &attr); --=20 2.9.4 From nobody Mon Apr 29 15:18:54 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 1500458341574603.4800882707975; Wed, 19 Jul 2017 02:59:01 -0700 (PDT) Received: from localhost ([::1]:60837 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlky-0007hE-94 for importer@patchew.org; Wed, 19 Jul 2017 05:59:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49661) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXljX-0006nv-0v for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:57:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXljW-0005So-A4 for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:57:31 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60402) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXljW-0005Sc-47 for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:57:30 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 305D64E4D6; Wed, 19 Jul 2017 09:51:02 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id B33BF7E12D; Wed, 19 Jul 2017 09:50:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 305D64E4D6 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 305D64E4D6 From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 11:50:32 +0200 Message-Id: <20170719095033.20482-5-david@redhat.com> In-Reply-To: <20170719095033.20482-1-david@redhat.com> References: <20170719095033.20482-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 19 Jul 2017 09:51:02 +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 v1 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" Signed-off-by: David Hildenbrand Acked-by: Christian Borntraeger --- 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 fe02315..3d0b7b3 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 Mon Apr 29 15:18:54 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 1500458450500166.28466776767425; Wed, 19 Jul 2017 03:00:50 -0700 (PDT) Received: from localhost ([::1]:60847 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlmj-0000y1-BP for importer@patchew.org; Wed, 19 Jul 2017 06:00:49 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49788) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlk9-0007Hb-Ra for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:58:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dXlk6-0005Zh-Of for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:58:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34150) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dXlk6-0005ZM-FR for qemu-devel@nongnu.org; Wed, 19 Jul 2017 05:58:06 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0500F2F86CE; Wed, 19 Jul 2017 09:51:12 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-115.ams2.redhat.com [10.36.116.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6F7147E12D; Wed, 19 Jul 2017 09:51:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0500F2F86CE Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=david@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0500F2F86CE From: David Hildenbrand To: qemu-devel@nongnu.org Date: Wed, 19 Jul 2017 11:50:33 +0200 Message-Id: <20170719095033.20482-6-david@redhat.com> In-Reply-To: <20170719095033.20482-1-david@redhat.com> References: <20170719095033.20482-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 19 Jul 2017 09:51:12 +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 v1 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