From patchwork Wed Jul 19 09:50:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 9851095 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4D08260388 for ; Wed, 19 Jul 2017 10:00:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 350A026E40 for ; Wed, 19 Jul 2017 10:00:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 29B4B2862A; Wed, 19 Jul 2017 10:00:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3D9D26E40 for ; Wed, 19 Jul 2017 10:00:30 +0000 (UTC) Received: from localhost ([::1]:60840 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dXlmQ-0008UH-3X for patchwork-qemu-devel@patchwork.kernel.org; Wed, 19 Jul 2017 06:00:30 -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) 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 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) 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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[] = { CPUDEF_INIT(0x3906, 14, 1, 47, 0x08000000U, "z14", "IBM z14 GA1"), }; +/* 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, uint8_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_MAX); if (!bitmap_empty(missing, S390_FEAT_MAX)) { break; } @@ -1209,10 +1217,35 @@ static const TypeInfo host_s390_cpu_type_info = { }; #endif +static void init_ignored_base_feat(void) +{ + static const int feats[] = { + /* MSA subfunctions that could not be available on certain machines */ + 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 = 0; i < ARRAY_SIZE(feats); i++) { + set_bit(feats[i], ignored_base_feat); + } +} + static void register_types(void) { int i; + init_ignored_base_feat(); + /* init all bitmaps from gnerated data initially */ for (i = 0; i < ARRAY_SIZE(s390_cpu_defs); i++) { s390_init_feat_bitmap(s390_cpu_defs[i].base_init,