From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561681876; cv=none; d=zoho.com; s=zohoarc; b=eCgTwGZqDPQeIEvZLwNmyQ9IWOdr99ElCAh9yPrNmSbaVVUcRAhNoqdqi8AgPaQRiUwh69qk8Wgm6Cxiw2011pe7eUno5YDrQL3OOgVpcqALQ1QpyApL3iTd7cm6U8nQ9eTr9L+FIjtRtyZOw1UzcWPxcUEhQZqx3hQRsdJMZfw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561681876; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=5AMk3K0mph2OVcEF5vskVgLnEfNXVlFb/n2IYudufWI=; b=TlZQ6tJnjzbYABKC3UZpGQ8QtCRttGYp5jqX2jIu9AvJsMu/Ydy6uPrrcDoj6B62ElruzIRdANnmAOk6IirY8gV1WhZCYc/V+uCVttPq5nYVCQOdE8j3YNRqGPQbPR3+2zgFjohldVO+GueehO3kJW4oiZGoAZI9QsTIy/0jTWg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561681876016214.79627188783036; Thu, 27 Jun 2019 17:31:16 -0700 (PDT) Received: from localhost ([::1]:55398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgen2-00021P-B6 for importer@patchew.org; Thu, 27 Jun 2019 20:30:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36190) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgel2-0008Kz-3l for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgel1-0006jv-2p for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52462) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgel0-0006jA-Tg for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:51 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 48301308424E for ; Fri, 28 Jun 2019 00:28:49 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id AD0E45C237; Fri, 28 Jun 2019 00:28:48 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:36 -0300 Message-Id: <20190628002844.24894-2-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Fri, 28 Jun 2019 00:28:49 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/9] qmp: Add "alias-of" field to query-cpu-definitions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P. Berrange" , "Dr. David Alan Gilbert" , Markus Armbruster , Igor Mammedov , Jiri Denemark Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Management software will be expected to resolve CPU model name aliases using the new field. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes v1 -> v2: * (none) Cc: Eric Blake Cc: Markus Armbruster --- qapi/target.json | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/qapi/target.json b/qapi/target.json index 1d4d54b600..0197c7962c 100644 --- a/qapi/target.json +++ b/qapi/target.json @@ -475,6 +475,12 @@ # to introspect properties configurable using -cpu or -global. # (since 2.9) # +# @alias-of: Name of CPU model this model is an alias for. The target of = the +# CPU model alias may change depending on the machine type. +# Management software is supposed to translate CPU model aliases +# in the VM configuration, because aliases may stop being +# migration-safe in the future (since 4.1) +# # @unavailable-features is a list of QOM property names that # represent CPU model attributes that prevent the CPU from running. # If the QOM property is read-only, that means there's no known @@ -498,7 +504,8 @@ '*migration-safe': 'bool', 'static': 'bool', '*unavailable-features': [ 'str' ], - 'typename': 'str' }, + 'typename': 'str', + '*alias-of' : 'str' }, 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386= ) || defined(TARGET_S390X) || defined(TARGET_MIPS)' } =20 ## --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561681870; cv=none; d=zoho.com; s=zohoarc; b=L/W0msWDkke3YxN4iJ3JoF+1j0TrCfenE9jHWO2OsmpP+IPi0Gb75VH4PgQvPNx9KPazJQ7hZgbnxCQaYtRPwrT6VxMBo81qm3hNSUqcwtsO/TShDPYsn2Pqnag0TQeCzb0tnHqfuwv+UyINsUJT1ufbYziY88KXKXExN6Ea06s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561681870; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=4/gC8inLoSlhVIMvkzV1yUPwhnRzfJsVFnZ2N5xTVuw=; b=JJsMdcB8aqcazSc//zaxVMIiNxGVjIGcFmlaIAMCOrxn7uhxDDq3P1u6cUBvCWOxjc/u6cgU/VnMHxvm6Qd5X8XH50x2aZDQm2EvvoBkPQoqkwhuSdra1CY62+IkpAZPSJVq44YDOcaP7Y6x3C1mkO1+Z5R/44PRRCGo5kxtrWM= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561681870345788.0258610896815; Thu, 27 Jun 2019 17:31:10 -0700 (PDT) Received: from localhost ([::1]:55400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgen4-00025b-Fu for importer@patchew.org; Thu, 27 Jun 2019 20:30:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36213) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgel3-0008Nb-Dn for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgel2-0006kx-DI for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40440) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgel2-0006kQ-7t for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:52 -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 90F0F3DE0D for ; Fri, 28 Jun 2019 00:28:51 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07EAD600CC; Fri, 28 Jun 2019 00:28:50 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:37 -0300 Message-Id: <20190628002844.24894-3-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@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.29]); Fri, 28 Jun 2019 00:28:51 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 2/9] i386: Add x-force-features option for testing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add a new option that can be used to disable feature flag filtering. This will allow CPU model compatibility test cases to work without host hardware dependencies. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes v1 -> v2: * (none) --- target/i386/cpu.h | 6 ++++++ target/i386/cpu.c | 8 ++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 0a96c78669..4727226a6a 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1417,6 +1417,12 @@ struct X86CPU { =20 bool check_cpuid; bool enforce_cpuid; + /* + * Force features to be enabled even if the host doesn't support them. + * This is dangerous and should be done only for testing CPUID + * compatibility. + */ + bool force_features; bool expose_kvm; bool expose_tcg; bool migratable; diff --git a/target/i386/cpu.c b/target/i386/cpu.c index ea52db0600..1bdb906e9f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -5179,8 +5179,11 @@ static int x86_cpu_filter_features(X86CPU *cpu) uint32_t host_feat =3D x86_cpu_get_supported_feature_word(w, false); uint32_t requested_features =3D env->features[w]; - env->features[w] &=3D host_feat; - cpu->filtered_features[w] =3D requested_features & ~env->features[= w]; + uint32_t available_features =3D requested_features & host_feat; + if (!cpu->force_features) { + env->features[w] =3D available_features; + } + cpu->filtered_features[w] =3D requested_features & ~available_feat= ures; if (cpu->filtered_features[w]) { rv =3D 1; } @@ -5909,6 +5912,7 @@ static Property x86_cpu_properties[] =3D { =20 DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true), DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false), + DEFINE_PROP_BOOL("x-force-features", X86CPU, force_features, false), DEFINE_PROP_BOOL("kvm", X86CPU, expose_kvm, true), DEFINE_PROP_UINT32("phys-bits", X86CPU, phys_bits, 0), DEFINE_PROP_BOOL("host-phys-bits", X86CPU, host_phys_bits, false), --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561681883; cv=none; d=zoho.com; s=zohoarc; b=Wp3f4u21JZ4OojjrB4J76oefsc6zF4XQiC5nOpXXnSsVLG6SKF3BBj+a413hw+jY6WuTu4LXcmC/iDsT+EkuMv3vstYKQjt0+23II9HgaWj4k8CdDBwM/cSwrZu3k3UtYsc3qLH0bw7+Y2m+5wHGHjJ5Vyl7O97hv4mZwO2H3ps= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561681883; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=cgkVZSWfECNRzqtYQcX/AfkT7CLjZRXysQNt/W3LYKU=; b=ZxVaI2CJ1cK0Ro5HAnmJKsVToG3iDjAkJgqGaydue+tG6i0JMhkRMlG7QLaAZgxWpYBiKwsOWNAIYqykmDatX8jhqrmpJiIv6uBqRNos3JPF2HihkkHLMjR9D3aPCpPmo+NuNXj7EZhoO2RYQPF/yk2MjErCeykFYGYj1GuoGuc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561681883707874.0155069440833; Thu, 27 Jun 2019 17:31:23 -0700 (PDT) Received: from localhost ([::1]:55402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgen7-0002C0-Ft for importer@patchew.org; Thu, 27 Jun 2019 20:31:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36225) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgel5-0008Q3-OA for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgel4-0006nl-SF for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40442) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgel4-0006nI-Mu for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:54 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DFFA43DE0D for ; Fri, 28 Jun 2019 00:28:53 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 60F255D71D; Fri, 28 Jun 2019 00:28:53 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:38 -0300 Message-Id: <20190628002844.24894-4-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 28 Jun 2019 00:28:54 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 3/9] i386: Get model-id from CPU object on "-cpu help" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When introducing versioned CPU models, the string at X86CPUDefinition::model_id might not be the model-id we'll really use. Instantiate a CPU object and check the model-id property on "-cpu help" Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- (New patch, added to series in v2) --- target/i386/cpu.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 1bdb906e9f..49bf92d3f9 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -3766,18 +3766,28 @@ static GSList *get_sorted_cpu_model_list(void) return list; } =20 +static char *x86_cpu_class_get_model_id(X86CPUClass *xc) +{ + Object *obj =3D object_new(object_class_get_name(OBJECT_CLASS(xc))); + char *r =3D object_property_get_str(obj, "model-id", &error_abort); + object_unref(obj); + return r; +} + static void x86_cpu_list_entry(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; X86CPUClass *cc =3D X86_CPU_CLASS(oc); char *name =3D x86_cpu_class_get_model_name(cc); - const char *desc =3D cc->model_description; - if (!desc && cc->cpu_def) { - desc =3D cc->cpu_def->model_id; + char *desc =3D g_strdup(cc->model_description); + + if (!desc) { + desc =3D x86_cpu_class_get_model_id(cc); } =20 qemu_printf("x86 %-20s %-48s\n", name, desc); g_free(name); + g_free(desc); } =20 /* list available CPU models and flags */ --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561682064; cv=none; d=zoho.com; s=zohoarc; b=O5N8Cm9XpAbMF4vGEJ1wVjPvnt51LzGq+vmJh6DXkJRNK76fk3HsLeFoGLSprD2eQo31XtjNihlQKSzND5/Sc/GUg92RRyv4RHotVyKhIEMSaaJSaRA2wyneH2EW+d2SaL+axH0H97ZHmUzH4aTVDmdrtmdptUcPfrihmEr3+TI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561682064; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=NpfIgJzZ6etLlv+btoIQIlUBWvKVY9NPmH9UWWI+NlM=; b=J6grxZTIUqwS3RFZcJUK1AxAJCEN4dvOcpoKFTdMAUT0GwIhn6MtnqKr+9CLzx0M7/tXUhS2BFZCVU6qUTow8QgmJ9oGgD8sMI3ZTWKFh+jpDxHEIXsasXSpDZbhlEEGqihyYW8mxmOu4xzZnMWKMtAWLl9hRRePKrrvgs5L2ug= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561682064212765.322334650367; Thu, 27 Jun 2019 17:34:24 -0700 (PDT) Received: from localhost ([::1]:55424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgeqH-0005OL-BT for importer@patchew.org; Thu, 27 Jun 2019 20:34:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36249) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgelA-00008w-8L for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgel7-0006ov-JG for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:00 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35678) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgel7-0006oY-As for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:57 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A74F23083391 for ; Fri, 28 Jun 2019 00:28:56 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9BC65C28F; Fri, 28 Jun 2019 00:28:55 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:39 -0300 Message-Id: <20190628002844.24894-5-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Fri, 28 Jun 2019 00:28:56 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 4/9] i386: Register versioned CPU models X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for registration of multiple versions of CPU models. The existing CPU models will be registered with a "-v1" suffix. The -noTSX, -IBRS, and -IBPB CPU model variants will become versions of the original models in a separate patch, so make sure we register no versions for them. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Patch v1 was "[PATCH 4/6] i386: Infrastructure for versioned CPU models", and was split into multiple patches. Changes v1 -> v2: * Make version numbers simple integers, completely independent from machine type versions * Don't register versions for -noTSX, -IBRS, and -IBPB CPU models * Code for reporting alias-of on query-cpu-definitions is now in a separate patch * Code for machine-type compatibility is now in a separate patch * New X86CPUVersion typedef * New CPU_VERSION_* defines to make X86CPUModel::version semantics clearer --- target/i386/cpu-qom.h | 10 +- target/i386/cpu.h | 10 + target/i386/cpu.c | 223 +++++++++++++++++++-- tests/acceptance/x86_cpu_model_versions.py | 105 ++++++++++ 4 files changed, 318 insertions(+), 30 deletions(-) create mode 100644 tests/acceptance/x86_cpu_model_versions.py diff --git a/target/i386/cpu-qom.h b/target/i386/cpu-qom.h index 22f95eb3a4..1a52f02a4c 100644 --- a/target/i386/cpu-qom.h +++ b/target/i386/cpu-qom.h @@ -36,13 +36,7 @@ #define X86_CPU_GET_CLASS(obj) \ OBJECT_GET_CLASS(X86CPUClass, (obj), TYPE_X86_CPU) =20 -/** - * X86CPUDefinition: - * - * CPU model definition data that was not converted to QOM per-subclass - * property defaults yet. - */ -typedef struct X86CPUDefinition X86CPUDefinition; +typedef struct X86CPUModel X86CPUModel; =20 /** * X86CPUClass: @@ -64,7 +58,7 @@ typedef struct X86CPUClass { /* CPU definition, automatically loaded by instance_init if not NULL. * Should be eventually replaced by subclass-specific property default= s. */ - X86CPUDefinition *cpu_def; + X86CPUModel *model; =20 bool host_cpuid_required; int ordering; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 4727226a6a..12bc3cd4a8 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1929,6 +1929,16 @@ void apic_handle_tpr_access_report(DeviceState *d, t= arget_ulong ip, */ void x86_cpu_change_kvm_default(const char *prop, const char *value); =20 +/* Special values for X86CPUVersion: */ + +/* Resolve to latest CPU version */ +#define CPU_VERSION_LATEST -1 + +/* Don't resolve to any versioned CPU models, like old QEMU versions */ +#define CPU_VERSION_LEGACY 0 + +typedef int X86CPUVersion; + /* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32(unsigned int reg); =20 diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 49bf92d3f9..b304c87b0f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1433,7 +1433,17 @@ static char *x86_cpu_class_get_model_name(X86CPUClas= s *cc) strlen(class_name) - strlen(X86_CPU_TYPE_SUFFIX)); } =20 -struct X86CPUDefinition { +typedef struct PropValue { + const char *prop, *value; +} PropValue; + +typedef struct X86CPUVersionDefinition { + X86CPUVersion version; + PropValue *props; +} X86CPUVersionDefinition; + +/* Base definition for a CPU model */ +typedef struct X86CPUDefinition { const char *name; uint32_t level; uint32_t xlevel; @@ -1445,8 +1455,41 @@ struct X86CPUDefinition { FeatureWordArray features; const char *model_id; CPUCaches *cache_info; + /* + * Definitions for alternative versions of CPU model. + * List is terminated by item with version =3D=3D 0. + * If NULL, version 1 will be registered automatically. + */ + const X86CPUVersionDefinition *versions; +} X86CPUDefinition; + +/* Reference to a specific CPU model version */ +struct X86CPUModel { + /* Base CPU definition */ + X86CPUDefinition *cpudef; + /* CPU model version */ + X86CPUVersion version; }; =20 +/* Get full model name for CPU version */ +static char *x86_cpu_versioned_model_name(X86CPUDefinition *cpudef, + X86CPUVersion version) +{ + assert(version > 0); + return g_strdup_printf("%s-v%d", cpudef->name, (int)version); +} + +static const X86CPUVersionDefinition *x86_cpu_def_get_versions(X86CPUDefin= ition *def) +{ + /* When X86CPUDefinition::versions is NULL, we register only v1 */ + static const X86CPUVersionDefinition default_version_list[] =3D { + { 1 }, + { /* end of list */ } + }; + + return def->versions ?: default_version_list; +} + static CPUCaches epyc_cache_info =3D { .l1d_cache =3D &(CPUCacheInfo) { .type =3D DATA_CACHE, @@ -1833,6 +1876,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_EXT3_LAHF_LM, .xlevel =3D 0x80000008, .model_id =3D "Intel Core i7 9xx (Nehalem Core i7, IBRS update)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Westmere", @@ -1887,6 +1935,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Westmere E56xx/L56xx/X56xx (IBRS update)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "SandyBridge", @@ -1951,6 +2004,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon E312xx (Sandy Bridge, IBRS update)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "IvyBridge", @@ -2021,6 +2079,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Haswell-noTSX", @@ -2057,6 +2120,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Haswell, no TSX)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Haswell-noTSX-IBRS", @@ -2095,6 +2163,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Haswell, no TSX, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Haswell", @@ -2171,6 +2244,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Haswell, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Broadwell-noTSX", @@ -2209,6 +2287,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Broadwell, no TSX)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Broadwell-noTSX-IBRS", @@ -2249,6 +2332,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Broadwell, no TSX, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Broadwell", @@ -2327,6 +2415,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Broadwell, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Skylake-Client", @@ -2419,6 +2512,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Skylake, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Skylake-Server", @@ -2521,6 +2619,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon Processor (Skylake, IBRS)", + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Cascadelake-Server", @@ -2958,6 +3061,11 @@ static X86CPUDefinition builtin_x86_defs[] =3D { .xlevel =3D 0x8000001E, .model_id =3D "AMD EPYC Processor (with IBPB)", .cache_info =3D &epyc_cache_info, + /* + * This CPU model will eventually be replaced by an alias, + * don't register any versions for it. + */ + .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, }, { .name =3D "Dhyana", @@ -3011,10 +3119,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { }, }; =20 -typedef struct PropValue { - const char *prop, *value; -} PropValue; - /* KVM-specific features that are automatically added/removed * from all CPU models when KVM is enabled. */ @@ -3040,6 +3144,28 @@ static PropValue tcg_default_props[] =3D { }; =20 =20 +static X86CPUVersion x86_cpu_model_last_version(const X86CPUModel *model) +{ + int v =3D 0; + const X86CPUVersionDefinition *vdef =3D + x86_cpu_def_get_versions(model->cpudef); + while (vdef->version) { + v =3D vdef->version; + vdef++; + } + return v; +} + +/* Return the actual version being used for a specific CPU model */ +static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *mode= l) +{ + X86CPUVersion v =3D model->version; + if (v =3D=3D CPU_VERSION_LATEST) { + return x86_cpu_model_last_version(model); + } + return v; +} + void x86_cpu_change_kvm_default(const char *prop, const char *value) { PropValue *pv; @@ -3117,8 +3243,6 @@ static void max_x86_cpu_class_init(ObjectClass *oc, v= oid *data) dc->props =3D max_x86_cpu_properties; } =20 -static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **e= rrp); - static void max_x86_cpu_initfn(Object *obj) { X86CPU *cpu =3D X86_CPU(obj); @@ -3909,10 +4033,40 @@ static void x86_cpu_apply_props(X86CPU *cpu, PropVa= lue *props) } } =20 +/* Apply properties for the CPU model version specified in model */ +static void x86_cpu_apply_version_props(X86CPU *cpu, X86CPUModel *model) +{ + const X86CPUVersionDefinition *vdef; + X86CPUVersion version =3D x86_cpu_model_resolve_version(model); + + if (version =3D=3D CPU_VERSION_LEGACY) { + return; + } + + for (vdef =3D x86_cpu_def_get_versions(model->cpudef); vdef->version; = vdef++) { + PropValue *p; + + for (p =3D vdef->props; p && p->prop; p++) { + object_property_parse(OBJECT(cpu), p->value, p->prop, + &error_abort); + } + + if (vdef->version =3D=3D version) { + break; + } + } + + /* + * If we reached the end of the list, version number was invalid + */ + assert(vdef->version =3D=3D version); +} + /* Load data from X86CPUDefinition into a X86CPU object */ -static void x86_cpu_load_def(X86CPU *cpu, X86CPUDefinition *def, Error **e= rrp) +static void x86_cpu_load_model(X86CPU *cpu, X86CPUModel *model, Error **er= rp) { + X86CPUDefinition *def =3D model->cpudef; CPUX86State *env =3D &cpu->env; const char *vendor; char host_vendor[CPUID_VENDOR_SZ + 1]; @@ -3969,11 +4123,12 @@ static void x86_cpu_load_def(X86CPU *cpu, X86CPUDef= inition *def, Error **errp) =20 object_property_set_str(OBJECT(cpu), vendor, "vendor", errp); =20 + x86_cpu_apply_version_props(cpu, model); } =20 #ifndef CONFIG_USER_ONLY /* Return a QDict containing keys for all properties that can be included - * in static expansion of CPU models. All properties set by x86_cpu_load_d= ef() + * in static expansion of CPU models. All properties set by x86_cpu_load_m= odel() * must be included in the dictionary. */ static QDict *x86_cpu_static_props(void) @@ -4187,23 +4342,33 @@ static gchar *x86_gdb_arch_name(CPUState *cs) =20 static void x86_cpu_cpudef_class_init(ObjectClass *oc, void *data) { - X86CPUDefinition *cpudef =3D data; + X86CPUModel *model =3D data; X86CPUClass *xcc =3D X86_CPU_CLASS(oc); =20 - xcc->cpu_def =3D cpudef; + xcc->model =3D model; xcc->migration_safe =3D true; } =20 -static void x86_register_cpudef_type(X86CPUDefinition *def) +static void x86_register_cpu_model_type(const char *name, X86CPUModel *mod= el) { - char *typename =3D x86_cpu_type_name(def->name); + char *typename =3D x86_cpu_type_name(name); TypeInfo ti =3D { .name =3D typename, .parent =3D TYPE_X86_CPU, .class_init =3D x86_cpu_cpudef_class_init, - .class_data =3D def, + .class_data =3D model, }; =20 + type_register(&ti); + g_free(typename); +} + +static void x86_register_cpudef_types(X86CPUDefinition *def) +{ + X86CPUModel *m; + const X86CPUVersionDefinition *vdef; + char *name; + /* AMD aliases are handled at runtime based on CPUID vendor, so * they shouldn't be set on the CPU model table. */ @@ -4211,9 +4376,23 @@ static void x86_register_cpudef_type(X86CPUDefinitio= n *def) /* catch mistakes instead of silently truncating model_id when too lon= g */ assert(def->model_id && strlen(def->model_id) <=3D 48); =20 + /* Unversioned model: */ + m =3D g_new0(X86CPUModel, 1); + m->cpudef =3D def; + m->version =3D CPU_VERSION_LEGACY; + x86_register_cpu_model_type(def->name, m); + + /* Versioned models: */ + + for (vdef =3D x86_cpu_def_get_versions(def); vdef->version; vdef++) { + X86CPUModel *m =3D g_new0(X86CPUModel, 1); + m->cpudef =3D def; + m->version =3D vdef->version; + name =3D x86_cpu_versioned_model_name(def, vdef->version); + x86_register_cpu_model_type(name, m); + g_free(name); + } =20 - type_register(&ti); - g_free(typename); } =20 #if !defined(CONFIG_USER_ONLY) @@ -5039,7 +5218,7 @@ static void x86_cpu_enable_xsave_components(X86CPU *c= pu) * involved in setting up CPUID data are: * * 1) Loading CPU model definition (X86CPUDefinition). This is - * implemented by x86_cpu_load_def() and should be completely + * implemented by x86_cpu_load_model() and should be completely * transparent, as it is done automatically by instance_init. * No code should need to look at X86CPUDefinition structs * outside instance_init. @@ -5361,7 +5540,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) =20 /* Cache information initialization */ if (!cpu->legacy_cache) { - if (!xcc->cpu_def || !xcc->cpu_def->cache_info) { + if (!xcc->model || !xcc->model->cpudef->cache_info) { char *name =3D x86_cpu_class_get_model_name(xcc); error_setg(errp, "CPU model '%s' doesn't support legacy-cache=3Doff"= , name); @@ -5369,7 +5548,7 @@ static void x86_cpu_realizefn(DeviceState *dev, Error= **errp) return; } env->cache_info_cpuid2 =3D env->cache_info_cpuid4 =3D env->cache_i= nfo_amd =3D - *xcc->cpu_def->cache_info; + *xcc->model->cpudef->cache_info; } else { /* Build legacy cache information */ env->cache_info_cpuid2.l1d_cache =3D &legacy_l1d_cache; @@ -5728,8 +5907,8 @@ static void x86_cpu_initfn(Object *obj) object_property_add_alias(obj, "sse4_1", obj, "sse4.1", &error_abort); object_property_add_alias(obj, "sse4_2", obj, "sse4.2", &error_abort); =20 - if (xcc->cpu_def) { - x86_cpu_load_def(cpu, xcc->cpu_def, &error_abort); + if (xcc->model) { + x86_cpu_load_model(cpu, xcc->model, &error_abort); } } =20 @@ -6068,7 +6247,7 @@ static void x86_cpu_register_types(void) =20 type_register_static(&x86_cpu_type_info); for (i =3D 0; i < ARRAY_SIZE(builtin_x86_defs); i++) { - x86_register_cpudef_type(&builtin_x86_defs[i]); + x86_register_cpudef_types(&builtin_x86_defs[i]); } type_register_static(&max_x86_cpu_type_info); type_register_static(&x86_base_cpu_type_info); diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/= x86_cpu_model_versions.py new file mode 100644 index 0000000000..b85d6f8604 --- /dev/null +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -0,0 +1,105 @@ +#!/usr/bin/env python +# +# Basic validation of x86 versioned CPU models and CPU model aliases +# +# Copyright (c) 2019 Red Hat Inc +# +# Author: +# Eduardo Habkost +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . +# + + +import avocado_qemu +import re + +class X86CPUModelAliases(avocado_qemu.Test): + """ + Validation of PC CPU model versions and CPU model aliases + + :avocado: tags=3Darch:x86_64 + """ + def validate_aliases(self, cpus): + for c in cpus.values(): + if 'alias-of' in c: + # all aliases must point to a valid CPU model name: + self.assertIn(c['alias-of'], cpus, + '%s.alias-of (%s) is not a valid CPU model n= ame' % (c['name'], c['alias-of'])) + # aliases must not point to aliases + self.assertNotIn('alias-of', cpus[c['alias-of']], + '%s.alias-of (%s) points to another alias= ' % (c['name'], c['alias-of'])) + + # aliases must not be static + self.assertFalse(c['static']) + + def validate_variant_aliases(self, cpus): + # -noTSX, -IBRS and -IBPB variants of CPU models are special: + # they shouldn't have their own versions: + self.assertNotIn("Haswell-noTSX-v1", cpus, + "Haswell-noTSX shouldn't be versioned") + self.assertNotIn("Broadwell-noTSX-v1", cpus, + "Broadwell-noTSX shouldn't be versioned") + self.assertNotIn("Nehalem-IBRS-v1", cpus, + "Nehalem-IBRS shouldn't be versioned") + self.assertNotIn("Westmere-IBRS-v1", cpus, + "Westmere-IBRS shouldn't be versioned") + self.assertNotIn("SandyBridge-IBRS-v1", cpus, + "SandyBridge-IBRS shouldn't be versioned") + self.assertNotIn("IvyBridge-IBRS-v1", cpus, + "IvyBridge-IBRS shouldn't be versioned") + self.assertNotIn("Haswell-noTSX-IBRS-v1", cpus, + "Haswell-noTSX-IBRS shouldn't be versioned") + self.assertNotIn("Haswell-IBRS-v1", cpus, + "Haswell-IBRS shouldn't be versioned") + self.assertNotIn("Broadwell-noTSX-IBRS-v1", cpus, + "Broadwell-noTSX-IBRS shouldn't be versioned") + self.assertNotIn("Broadwell-IBRS-v1", cpus, + "Broadwell-IBRS shouldn't be versioned") + self.assertNotIn("Skylake-Client-IBRS-v1", cpus, + "Skylake-Client-IBRS shouldn't be versioned") + self.assertNotIn("Skylake-Server-IBRS-v1", cpus, + "Skylake-Server-IBRS shouldn't be versioned") + self.assertNotIn("EPYC-IBPB-v1", cpus, + "EPYC-IBPB shouldn't be versioned") + + def test_4_0_alias_compatibility(self): + """Check if pc-*-4.0 unversioned CPU model won't be reported as al= iases""" + # pc-*-4.0 won't expose non-versioned CPU models as aliases + # We do this to help management software to keep compatibility + # with older QEMU versions that didn't have the versioned CPU model + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.0') + self.vm.launch() + cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) + + self.assertFalse(cpus['Cascadelake-Server']['static'], + 'unversioned Cascadelake-Server CPU model must no= t be static') + self.assertNotIn('alias-of', cpus['Cascadelake-Server'], + 'Cascadelake-Server must not be an alias') + self.assertNotIn('alias-of', cpus['Cascadelake-Server-v1'], + 'Cascadelake-Server-v1 must not be an alias') + + self.assertFalse(cpus['qemu64']['static'], + 'unversioned qemu64 CPU model must not be static') + self.assertNotIn('alias-of', cpus['qemu64'], + 'qemu64 must not be an alias') + self.assertNotIn('alias-of', cpus['qemu64-v1'], + 'qemu64-v1 must not be an alias') + + self.validate_variant_aliases(cpus) + + # On pc-*-4.0, no CPU model should be reported as an alias: + for name,c in cpus.items(): + self.assertNotIn('alias-of', c, "%s shouldn't be an alias" % (= name)) --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561682056; cv=none; d=zoho.com; s=zohoarc; b=HybZZXIg2gH0uhBQJykOBGJEp2iYhPMGiMBq1qEbnx39MdfUYv+cjdRj8Un23l5GUhw4Ci33MITq4+q12lV1RW4CKuDgjOjeLL/46yCU0zUlYWX2QpO1L94RWJ+QFpEVJxA8lQpZIrIu9i9JTg6IvGm9byeLNE+GDpVaPyI0qK8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561682056; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FOINtoMImsNONoDqwp2R1A5qaHJ+/kJ4zUSi0CYl7aU=; b=FPtoZrbIuaLkf/k0OgOX0ONvCFq5xlTA+bm85ANhiZU+fcjJdQYI54tGb5p0RXFlSwqtFAGG9nyTHDxvSrOMQwSeYOSpNm4x4jivEbmfSk/UfC+pbejaGKmmcnR4ZPgorljKEjsdx3e3uKWXZJRz9UMuyNXD5ifQomwdo9ifEZc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561682056641862.9611856490982; Thu, 27 Jun 2019 17:34:16 -0700 (PDT) Received: from localhost ([::1]:55422 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgeq9-0005Kd-On for importer@patchew.org; Thu, 27 Jun 2019 20:34:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36257) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgelB-0000Bo-Bp for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgelA-0006qV-05 for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40454) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgel9-0006pp-N9 for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:28:59 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0F34737F46 for ; Fri, 28 Jun 2019 00:28:59 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 755EF5D9D2; Fri, 28 Jun 2019 00:28:58 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:40 -0300 Message-Id: <20190628002844.24894-6-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 28 Jun 2019 00:28:59 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 5/9] i386: Define -IBRS, -noTSX, -IBRS versions of CPU models X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add versions of CPU models that are equivalent to their -IBRS, -noTSX and -IBRS variants. The separate variants will eventually be removed and become aliases for these CPU versions. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- (New patch, added to series in v2) --- target/i386/cpu.c | 186 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 186 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index b304c87b0f..5d33e75890 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1851,6 +1851,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_EXT3_LAHF_LM, .xlevel =3D 0x80000008, .model_id =3D "Intel Core i7 9xx (Nehalem Class Core i7)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to Nehalem-IBRS */ + .props =3D (PropValue[]) { + { "spec-ctrl", "on" }, + { "model-id", + "Intel Core i7 9xx (Nehalem Core i7, IBRS update)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "Nehalem-IBRS", @@ -1907,6 +1921,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Westmere E56xx/L56xx/X56xx (Nehalem-C)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to Westmere-IBRS */ + .props =3D (PropValue[]) { + { "spec-ctrl", "on" }, + { "model-id", + "Westmere E56xx/L56xx/X56xx (IBRS update)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "Westmere-IBRS", @@ -1971,6 +1999,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon E312xx (Sandy Bridge)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to SandyBridge-IBRS */ + .props =3D (PropValue[]) { + { "spec-ctrl", "on" }, + { "model-id", + "Intel Xeon E312xx (Sandy Bridge, IBRS update)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "SandyBridge-IBRS", @@ -2043,6 +2085,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon E3-12xx v2 (Ivy Bridge)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to IvyBridge-IBRS */ + .props =3D (PropValue[]) { + { "spec-ctrl", "on" }, + { "model-id", + "Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "IvyBridge-IBRS", @@ -2205,6 +2261,52 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Haswell)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to Haswell-noTSX */ + .props =3D (PropValue[]) { + { "hle", "off" }, + { "rtm", "off" }, + { "stepping", "1" }, + { "model-id", "Intel Core Processor (Haswell, no TSX)"= , }, + { /* end of list */ } + }, + }, + { + .version =3D 3, + /* Equivalent to Haswell-IBRS */ + .props =3D (PropValue[]) { + /* Restore TSX features removed by -v2 above */ + { "hle", "on" }, + { "rtm", "on" }, + /* + * Haswell and Haswell-IBRS had stepping=3D4 in + * QEMU 4.0 and older + */ + { "stepping", "4" }, + { "spec-ctrl", "on" }, + { "model-id", + "Intel Core Processor (Haswell, IBRS)" }, + { /* end of list */ } + } + }, + { + .version =3D 4, + /* Equivalent to Haswell-noTSX-IBRS */ + .props =3D (PropValue[]) { + { "hle", "off" }, + { "rtm", "off" }, + /* spec-ctrl was already enabled by -v3 above */ + { "stepping", "1" }, + { "model-id", + "Intel Core Processor (Haswell, no TSX, IBRS)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "Haswell-IBRS", @@ -2375,6 +2477,45 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Broadwell)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to Broadwell-noTSX */ + .props =3D (PropValue[]) { + { "hle", "off" }, + { "rtm", "off" }, + { "model-id", "Intel Core Processor (Broadwell, no TSX= )", }, + { /* end of list */ } + }, + }, + { + .version =3D 3, + /* Equivalent to Broadwell-IBRS */ + .props =3D (PropValue[]) { + /* Restore TSX features removed by -v2 above */ + { "hle", "on" }, + { "rtm", "on" }, + { "spec-ctrl", "on" }, + { "model-id", + "Intel Core Processor (Broadwell, IBRS)" }, + { /* end of list */ } + } + }, + { + .version =3D 4, + /* Equivalent to Broadwell-noTSX-IBRS */ + .props =3D (PropValue[]) { + { "hle", "off" }, + { "rtm", "off" }, + /* spec-ctrl was already enabled by -v3 above */ + { "model-id", + "Intel Core Processor (Broadwell, no TSX, IBRS)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "Broadwell-IBRS", @@ -2465,6 +2606,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Core Processor (Skylake)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to Skylake-Client-IBRS */ + .props =3D (PropValue[]) { + { "spec-ctrl", "on" }, + { "model-id", + "Intel Core Processor (Skylake, IBRS)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "Skylake-Client-IBRS", @@ -2567,6 +2722,23 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon Processor (Skylake)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to Skylake-Server-IBRS */ + .props =3D (PropValue[]) { + /* clflushopt was not added to Skylake-Server-IBRS */ + /* TODO: add -v3 including clflushopt */ + { "clflushopt", "off" }, + { "spec-ctrl", "on" }, + { "model-id", + "Intel Xeon Processor (Skylake, IBRS)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "Skylake-Server-IBRS", @@ -3011,6 +3183,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { .xlevel =3D 0x8000001E, .model_id =3D "AMD EPYC Processor", .cache_info =3D &epyc_cache_info, + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { + .version =3D 2, + /* Equivalent to EPYC-IBPB */ + .props =3D (PropValue[]) { + { "ibpb", "on" }, + { "model-id", + "AMD EPYC Processor (with IBPB)" }, + { /* end of list */ } + } + }, + { /* end of list */ } + } }, { .name =3D "EPYC-IBPB", --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561682272; cv=none; d=zoho.com; s=zohoarc; b=UauCIsCB/0jvTySJnRjHlgqkzX3thx6JElSDHfuPKh2AsYIFdpt65jy/BsYphVH7eRrYsv5mUySrSN4C6wvkQDxM+EB3d1tOHV01YetmiRLpXR9aU0I6ZF5gSFnKQURsUjRrIbCdITZ6799RtxLNvDKcAiC3mvQUHVHF5LpbJYk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561682272; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=QhjvSx38HRQoZ8QSa8/eJMWXhBYd2wu+steAlVGxPUk=; b=odnIc/4ZgtAy6kemV/snnUjgr3sNT0K/Xxyf1qB2172ZlEwPSlhBw22AovCP6YgzVlOh2pmbvwpPo2WjYXKbjXDL0aW1Vqm3Wx3/JaIgjeMqYvMWRi0ydQSYy4NyANY3DU/Ws83aS4euV8Zhy4IcaL3S9t0i4UZEeFWbl03NUPU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561682272875743.0832090813234; Thu, 27 Jun 2019 17:37:52 -0700 (PDT) Received: from localhost ([::1]:55440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgeta-0008Gq-UN for importer@patchew.org; Thu, 27 Jun 2019 20:37:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36289) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgelF-0000M6-M2 for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgelC-0006rv-Pd for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52500) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgelC-0006rR-H9 for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:02 -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 DB4D3308424E for ; Fri, 28 Jun 2019 00:29:01 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id D130B6012E; Fri, 28 Jun 2019 00:29:00 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:41 -0300 Message-Id: <20190628002844.24894-7-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@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.40]); Fri, 28 Jun 2019 00:29:01 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 6/9] i386: Replace -noTSX, -IBRS, -IBPB CPU models with aliases X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The old CPU models will be just aliases for specific versions of the original CPU models. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- (New patch, added to series in v2) --- target/i386/cpu.c | 601 ++-------------------------------------------- 1 file changed, 21 insertions(+), 580 deletions(-) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 5d33e75890..cddea91b1f 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1439,6 +1439,7 @@ typedef struct PropValue { =20 typedef struct X86CPUVersionDefinition { X86CPUVersion version; + const char *alias; PropValue *props; } X86CPUVersionDefinition; =20 @@ -1855,7 +1856,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to Nehalem-IBRS */ + .alias =3D "Nehalem-IBRS", .props =3D (PropValue[]) { { "spec-ctrl", "on" }, { "model-id", @@ -1866,36 +1867,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "Nehalem-IBRS", - .level =3D 11, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 26, - .stepping =3D 3, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_POPCNT | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | - CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_SSE3, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_LAHF_LM, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core i7 9xx (Nehalem Core i7, IBRS update)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Westmere", .level =3D 11, @@ -1925,7 +1896,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to Westmere-IBRS */ + .alias =3D "Westmere-IBRS", .props =3D (PropValue[]) { { "spec-ctrl", "on" }, { "model-id", @@ -1936,39 +1907,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "Westmere-IBRS", - .level =3D 11, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 44, - .stepping =3D 1, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AES | CPUID_EXT_POPCNT | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_SYSCALL | CPUID_EXT2_NX, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_LAHF_LM, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Westmere E56xx/L56xx/X56xx (IBRS update)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "SandyBridge", .level =3D 0xd, @@ -2003,7 +1941,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to SandyBridge-IBRS */ + .alias =3D "SandyBridge-IBRS", .props =3D (PropValue[]) { { "spec-ctrl", "on" }, { "model-id", @@ -2014,44 +1952,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "SandyBridge-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 42, - .stepping =3D 1, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_POPCNT | - CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | - CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ | - CPUID_EXT_SSE3, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_LAHF_LM, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Xeon E312xx (Sandy Bridge, IBRS update)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "IvyBridge", .level =3D 0xd, @@ -2089,7 +1989,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to IvyBridge-IBRS */ + .alias =3D "IvyBridge-IBRS", .props =3D (PropValue[]) { { "spec-ctrl", "on" }, { "model-id", @@ -2100,131 +2000,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "IvyBridge-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 58, - .stepping =3D 9, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_POPCNT | - CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | - CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | CPUID_EXT_PCLMULQDQ | - CPUID_EXT_SSE3 | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_ERMS, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_LAHF_LM, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, - { - .name =3D "Haswell-noTSX", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 60, - .stepping =3D 1, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Haswell, no TSX)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, - { - .name =3D "Haswell-noTSX-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 60, - .stepping =3D 1, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Haswell, no TSX, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Haswell", .level =3D 0xd, @@ -2265,7 +2040,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to Haswell-noTSX */ + .alias =3D "Haswell-noTSX", .props =3D (PropValue[]) { { "hle", "off" }, { "rtm", "off" }, @@ -2276,7 +2051,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { }, { .version =3D 3, - /* Equivalent to Haswell-IBRS */ + .alias =3D "Haswell-IBRS", .props =3D (PropValue[]) { /* Restore TSX features removed by -v2 above */ { "hle", "on" }, @@ -2294,7 +2069,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { }, { .version =3D 4, - /* Equivalent to Haswell-noTSX-IBRS */ + .alias =3D "Haswell-noTSX-IBRS", .props =3D (PropValue[]) { { "hle", "off" }, { "rtm", "off" }, @@ -2308,138 +2083,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "Haswell-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 60, - .stepping =3D 4, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D | - CPUID_7_0_EBX_RTM, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Haswell, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, - { - .name =3D "Broadwell-noTSX", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 61, - .stepping =3D 2, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D | - CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | - CPUID_7_0_EBX_SMAP, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Broadwell, no TSX)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, - { - .name =3D "Broadwell-noTSX-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 61, - .stepping =3D 2, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D | - CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | - CPUID_7_0_EBX_SMAP, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Broadwell, no TSX, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Broadwell", .level =3D 0xd, @@ -2481,7 +2124,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to Broadwell-noTSX */ + .alias =3D "Broadwell-noTSX", .props =3D (PropValue[]) { { "hle", "off" }, { "rtm", "off" }, @@ -2491,7 +2134,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { }, { .version =3D 3, - /* Equivalent to Broadwell-IBRS */ + .alias =3D "Broadwell-IBRS", .props =3D (PropValue[]) { /* Restore TSX features removed by -v2 above */ { "hle", "on" }, @@ -2504,7 +2147,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { }, { .version =3D 4, - /* Equivalent to Broadwell-noTSX-IBRS */ + .alias =3D "Broadwell-noTSX-IBRS", .props =3D (PropValue[]) { { "hle", "off" }, { "rtm", "off" }, @@ -2517,51 +2160,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "Broadwell-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 61, - .stepping =3D 2, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D | - CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | - CPUID_7_0_EBX_SMAP, - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Broadwell, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Skylake-Client", .level =3D 0xd, @@ -2610,7 +2208,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to Skylake-Client-IBRS */ + .alias =3D "Skylake-Client-IBRS", .props =3D (PropValue[]) { { "spec-ctrl", "on" }, { "model-id", @@ -2621,58 +2219,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "Skylake-Client-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 94, - .stepping =3D 3, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D | - CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | - CPUID_7_0_EBX_SMAP, - /* Missing: XSAVES (not supported by some Linux versions, - * including v4.1 to v4.12). - * KVM doesn't yet expose any XSAVES state save component, - * and the only one defined in Skylake (processor tracing) - * probably will block migration anyway. - */ - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | - CPUID_XSAVE_XGETBV1, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Core Processor (Skylake, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Skylake-Server", .level =3D 0xd, @@ -2726,7 +2272,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to Skylake-Server-IBRS */ + .alias =3D "Skylake-Server-IBRS", .props =3D (PropValue[]) { /* clflushopt was not added to Skylake-Server-IBRS */ /* TODO: add -v3 including clflushopt */ @@ -2740,63 +2286,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "Skylake-Server-IBRS", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_INTEL, - .family =3D 6, - .model =3D 85, - .stepping =3D 4, - .features[FEAT_1_EDX] =3D - CPUID_VME | CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | - CPUID_CLFLUSH | CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_M= CA | - CPUID_PGE | CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | - CPUID_MCE | CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | - CPUID_DE | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_AVX | CPUID_EXT_XSAVE | CPUID_EXT_AES | - CPUID_EXT_POPCNT | CPUID_EXT_X2APIC | CPUID_EXT_SSE42 | - CPUID_EXT_SSE41 | CPUID_EXT_CX16 | CPUID_EXT_SSSE3 | - CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3 | - CPUID_EXT_TSC_DEADLINE_TIMER | CPUID_EXT_FMA | CPUID_EXT_MOVBE= | - CPUID_EXT_PCID | CPUID_EXT_F16C | CPUID_EXT_RDRAND, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_PDPE1GB | CPUID_EXT2_RDTSCP | - CPUID_EXT2_NX | CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_ABM | CPUID_EXT3_LAHF_LM | CPUID_EXT3_3DNOWPREFETCH, - .features[FEAT_7_0_EDX] =3D - CPUID_7_0_EDX_SPEC_CTRL, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | - CPUID_7_0_EBX_HLE | CPUID_7_0_EBX_AVX2 | CPUID_7_0_EBX_SMEP | - CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_ERMS | CPUID_7_0_EBX_INVPCI= D | - CPUID_7_0_EBX_RTM | CPUID_7_0_EBX_RDSEED | CPUID_7_0_EBX_ADX | - CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLWB | - CPUID_7_0_EBX_AVX512F | CPUID_7_0_EBX_AVX512DQ | - CPUID_7_0_EBX_AVX512BW | CPUID_7_0_EBX_AVX512CD | - CPUID_7_0_EBX_AVX512VL, - .features[FEAT_7_0_ECX] =3D - CPUID_7_0_ECX_PKU, - /* Missing: XSAVES (not supported by some Linux versions, - * including v4.1 to v4.12). - * KVM doesn't yet expose any XSAVES state save component, - * and the only one defined in Skylake (processor tracing) - * probably will block migration anyway. - */ - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | - CPUID_XSAVE_XGETBV1, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .xlevel =3D 0x80000008, - .model_id =3D "Intel Xeon Processor (Skylake, IBRS)", - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Cascadelake-Server", .level =3D 0xd, @@ -3187,7 +2676,7 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { .version =3D 1 }, { .version =3D 2, - /* Equivalent to EPYC-IBPB */ + .alias =3D "EPYC-IBPB", .props =3D (PropValue[]) { { "ibpb", "on" }, { "model-id", @@ -3198,61 +2687,6 @@ static X86CPUDefinition builtin_x86_defs[] =3D { { /* end of list */ } } }, - { - .name =3D "EPYC-IBPB", - .level =3D 0xd, - .vendor =3D CPUID_VENDOR_AMD, - .family =3D 23, - .model =3D 1, - .stepping =3D 2, - .features[FEAT_1_EDX] =3D - CPUID_SSE2 | CPUID_SSE | CPUID_FXSR | CPUID_MMX | CPUID_CLFLUS= H | - CPUID_PSE36 | CPUID_PAT | CPUID_CMOV | CPUID_MCA | CPUID_PGE | - CPUID_MTRR | CPUID_SEP | CPUID_APIC | CPUID_CX8 | CPUID_MCE | - CPUID_PAE | CPUID_MSR | CPUID_TSC | CPUID_PSE | CPUID_DE | - CPUID_VME | CPUID_FP87, - .features[FEAT_1_ECX] =3D - CPUID_EXT_RDRAND | CPUID_EXT_F16C | CPUID_EXT_AVX | - CPUID_EXT_XSAVE | CPUID_EXT_AES | CPUID_EXT_POPCNT | - CPUID_EXT_MOVBE | CPUID_EXT_SSE42 | CPUID_EXT_SSE41 | - CPUID_EXT_CX16 | CPUID_EXT_FMA | CPUID_EXT_SSSE3 | - CPUID_EXT_MONITOR | CPUID_EXT_PCLMULQDQ | CPUID_EXT_SSE3, - .features[FEAT_8000_0001_EDX] =3D - CPUID_EXT2_LM | CPUID_EXT2_RDTSCP | CPUID_EXT2_PDPE1GB | - CPUID_EXT2_FFXSR | CPUID_EXT2_MMXEXT | CPUID_EXT2_NX | - CPUID_EXT2_SYSCALL, - .features[FEAT_8000_0001_ECX] =3D - CPUID_EXT3_OSVW | CPUID_EXT3_3DNOWPREFETCH | - CPUID_EXT3_MISALIGNSSE | CPUID_EXT3_SSE4A | CPUID_EXT3_ABM | - CPUID_EXT3_CR8LEG | CPUID_EXT3_SVM | CPUID_EXT3_LAHF_LM | - CPUID_EXT3_TOPOEXT, - .features[FEAT_8000_0008_EBX] =3D - CPUID_8000_0008_EBX_IBPB, - .features[FEAT_7_0_EBX] =3D - CPUID_7_0_EBX_FSGSBASE | CPUID_7_0_EBX_BMI1 | CPUID_7_0_EBX_AV= X2 | - CPUID_7_0_EBX_SMEP | CPUID_7_0_EBX_BMI2 | CPUID_7_0_EBX_RDSEED= | - CPUID_7_0_EBX_ADX | CPUID_7_0_EBX_SMAP | CPUID_7_0_EBX_CLFLUSH= OPT | - CPUID_7_0_EBX_SHA_NI, - /* Missing: XSAVES (not supported by some Linux versions, - * including v4.1 to v4.12). - * KVM doesn't yet expose any XSAVES state save component. - */ - .features[FEAT_XSAVE] =3D - CPUID_XSAVE_XSAVEOPT | CPUID_XSAVE_XSAVEC | - CPUID_XSAVE_XGETBV1, - .features[FEAT_6_EAX] =3D - CPUID_6_EAX_ARAT, - .features[FEAT_SVM] =3D - CPUID_SVM_NPT | CPUID_SVM_NRIPSAVE, - .xlevel =3D 0x8000001E, - .model_id =3D "AMD EPYC Processor (with IBPB)", - .cache_info =3D &epyc_cache_info, - /* - * This CPU model will eventually be replaced by an alias, - * don't register any versions for it. - */ - .versions =3D (X86CPUVersionDefinition[]) { { /* end of list */ } = }, - }, { .name =3D "Dhyana", .level =3D 0xd, @@ -4577,6 +4011,13 @@ static void x86_register_cpudef_types(X86CPUDefiniti= on *def) name =3D x86_cpu_versioned_model_name(def, vdef->version); x86_register_cpu_model_type(name, m); g_free(name); + + if (vdef->alias) { + X86CPUModel *am =3D g_new0(X86CPUModel, 1); + am->cpudef =3D def; + am->version =3D vdef->version; + x86_register_cpu_model_type(vdef->alias, am); + } } =20 } --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561682412; cv=none; d=zoho.com; s=zohoarc; b=KP6ms42fMaJ9nE4DugdLQ1sT7w3Y+rJK2+Pjxd3X6QAhjL4lIhv45KJctgqVuNcmt3PwTxtIC8d7xx80pTdJB7cBbROMFXT6d8oWoPz/5US7lXyCQLIDkysIAP7NiufJEL4ddRXB+wS4TMLY5tb9BzFUMP36K5OnijVBE7njsWk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561682412; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=j+ZpmrO4lkftBy0jWAf+4Xs0IUPZLSTqYeEYtfqhuf4=; b=iU/2CfB/YECmUbRIX0VDRcz280/SpK/VIEK88MywDSLho7PneDL24VrCldsCLm52pU+YYHfwhnzULCatC0DOr4+mm76ApnrxEj+3WV4OUSUtxdbYQjNmS0KcQ29DC0qS7k0SlUBuJCnS3AGgYbKtlPanYIgs1h/10/hw5E0flGo= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561682412847790.790858984474; Thu, 27 Jun 2019 17:40:12 -0700 (PDT) Received: from localhost ([::1]:55448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgevq-0001nQ-Rg for importer@patchew.org; Thu, 27 Jun 2019 20:40:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36303) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgelH-0000QM-Fg for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgelF-0006tW-CY for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49908) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgelF-0006sy-4R for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7A2D93082E71 for ; Fri, 28 Jun 2019 00:29:04 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id A6AE0608C1; Fri, 28 Jun 2019 00:29:03 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:42 -0300 Message-Id: <20190628002844.24894-8-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Fri, 28 Jun 2019 00:29:04 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 7/9] i386: Make unversioned CPU models be aliases X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Igor Mammedov , Jiri Denemark , "Daniel P. Berrange" , "Dr. David Alan Gilbert" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This will make unversioned CPU models behavior depend on the machine type: * "pc-*-4.0" and older will not report them as aliases. This is done to keep compatibility with older QEMU versions after management software starts translating aliases. * "pc-*-4.1" will translate unversioned CPU models to -v1. This is done to keep compatibility with existing management software, that still relies on CPU model runnability promises. * "none" will translate unversioned CPU models to their latest version. This is planned become the default in future machine types (probably in pc-*-4.3). Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Patch v1 was "[PATCH 4/6] i386: Infrastructure for versioned CPU models", and was split into multiple patches. Changes v1 -> v2: * Make version numbers simple integers, completely independent from machine type versions * New X86CPUVersion typedef * New CPU_VERSION_* defines to make X86CPUModel::version semantics clearer --- include/hw/i386/pc.h | 3 + target/i386/cpu.h | 12 ++ hw/i386/pc.c | 3 + hw/i386/pc_piix.c | 4 + hw/i386/pc_q35.c | 4 + target/i386/cpu.c | 52 ++++++++- tests/acceptance/x86_cpu_model_versions.py | 126 +++++++++++++++++++++ 7 files changed, 203 insertions(+), 1 deletion(-) diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h index ee79d71ccc..1946c1023f 100644 --- a/include/hw/i386/pc.h +++ b/include/hw/i386/pc.h @@ -109,6 +109,9 @@ typedef struct PCMachineClass { =20 /* Compat options: */ =20 + /* Default CPU model version. See x86_cpu_set_default_version(). */ + int default_cpu_version; + /* ACPI compat: */ bool has_acpi_build; bool rsdp_in_ram; diff --git a/target/i386/cpu.h b/target/i386/cpu.h index 12bc3cd4a8..05393cf9d1 100644 --- a/target/i386/cpu.h +++ b/target/i386/cpu.h @@ -1934,11 +1934,23 @@ void x86_cpu_change_kvm_default(const char *prop, c= onst char *value); /* Resolve to latest CPU version */ #define CPU_VERSION_LATEST -1 =20 +/* + * Resolve to version defined by current machine type. + * See x86_cpu_set_default_version() + */ +#define CPU_VERSION_AUTO -2 + /* Don't resolve to any versioned CPU models, like old QEMU versions */ #define CPU_VERSION_LEGACY 0 =20 typedef int X86CPUVersion; =20 +/* + * Set default CPU model version for CPU models having + * version =3D=3D CPU_VERSION_AUTO. + */ +void x86_cpu_set_default_version(X86CPUVersion version); + /* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32(unsigned int reg); =20 diff --git a/hw/i386/pc.c b/hw/i386/pc.c index 3f0f221a5b..1df569620a 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -1649,6 +1649,9 @@ void pc_cpus_init(PCMachineState *pcms) const CPUArchIdList *possible_cpus; MachineState *ms =3D MACHINE(pcms); MachineClass *mc =3D MACHINE_GET_CLASS(pcms); + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(mc); + + x86_cpu_set_default_version(pcmc->default_cpu_version); =20 /* Calculates the limit to CPU APIC ID values * diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index c07c4a5b38..0a069bff54 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -430,9 +430,11 @@ static void pc_i440fx_machine_options(MachineClass *m) =20 static void pc_i440fx_4_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_machine_options(m); m->alias =3D "pc"; m->is_default =3D 1; + pcmc->default_cpu_version =3D 1; } =20 DEFINE_I440FX_MACHINE(v4_1, "pc-i440fx-4.1", NULL, @@ -440,9 +442,11 @@ DEFINE_I440FX_MACHINE(v4_1, "pc-i440fx-4.1", NULL, =20 static void pc_i440fx_4_0_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_i440fx_4_1_machine_options(m); m->alias =3D NULL; m->is_default =3D 0; + pcmc->default_cpu_version =3D CPU_VERSION_LEGACY; compat_props_add(m->compat_props, hw_compat_4_0, hw_compat_4_0_len); compat_props_add(m->compat_props, pc_compat_4_0, pc_compat_4_0_len); } diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c index 57232aed6b..397e1fdd2f 100644 --- a/hw/i386/pc_q35.c +++ b/hw/i386/pc_q35.c @@ -367,8 +367,10 @@ static void pc_q35_machine_options(MachineClass *m) =20 static void pc_q35_4_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_machine_options(m); m->alias =3D "q35"; + pcmc->default_cpu_version =3D 1; } =20 DEFINE_Q35_MACHINE(v4_1, "pc-q35-4.1", NULL, @@ -376,8 +378,10 @@ DEFINE_Q35_MACHINE(v4_1, "pc-q35-4.1", NULL, =20 static void pc_q35_4_0_1_machine_options(MachineClass *m) { + PCMachineClass *pcmc =3D PC_MACHINE_CLASS(m); pc_q35_4_1_machine_options(m); m->alias =3D NULL; + pcmc->default_cpu_version =3D CPU_VERSION_LEGACY; /* * This is the default machine for the 4.0-stable branch. It is basica= lly * a 4.0 that doesn't use split irqchip by default. It MUST hence appl= y the diff --git a/target/i386/cpu.c b/target/i386/cpu.c index cddea91b1f..10a09c971a 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -1470,6 +1470,11 @@ struct X86CPUModel { X86CPUDefinition *cpudef; /* CPU model version */ X86CPUVersion version; + /* + * If true, this is an alias CPU model. + * This matters only for "-cpu help" and query-cpu-definitions + */ + bool is_alias; }; =20 /* Get full model name for CPU version */ @@ -2764,6 +2769,15 @@ static PropValue tcg_default_props[] =3D { }; =20 =20 +X86CPUVersion default_cpu_version =3D CPU_VERSION_LATEST; + +void x86_cpu_set_default_version(X86CPUVersion version) +{ + /* Translating CPU_VERSION_AUTO to CPU_VERSION_AUTO doesn't make sense= */ + assert(version !=3D CPU_VERSION_AUTO); + default_cpu_version =3D version; +} + static X86CPUVersion x86_cpu_model_last_version(const X86CPUModel *model) { int v =3D 0; @@ -2780,6 +2794,9 @@ static X86CPUVersion x86_cpu_model_last_version(const= X86CPUModel *model) static X86CPUVersion x86_cpu_model_resolve_version(const X86CPUModel *mode= l) { X86CPUVersion v =3D model->version; + if (v =3D=3D CPU_VERSION_AUTO) { + v =3D default_cpu_version; + } if (v =3D=3D CPU_VERSION_LATEST) { return x86_cpu_model_last_version(model); } @@ -3518,13 +3535,35 @@ static char *x86_cpu_class_get_model_id(X86CPUClass= *xc) return r; } =20 +static char *x86_cpu_class_get_alias_of(X86CPUClass *cc) +{ + X86CPUVersion version; + + if (!cc->model || !cc->model->is_alias) { + return NULL; + } + version =3D x86_cpu_model_resolve_version(cc->model); + if (version <=3D 0) { + return NULL; + } + return x86_cpu_versioned_model_name(cc->model->cpudef, version); +} + static void x86_cpu_list_entry(gpointer data, gpointer user_data) { ObjectClass *oc =3D data; X86CPUClass *cc =3D X86_CPU_CLASS(oc); char *name =3D x86_cpu_class_get_model_name(cc); char *desc =3D g_strdup(cc->model_description); + char *alias_of =3D x86_cpu_class_get_alias_of(cc); =20 + if (!desc && alias_of) { + if (cc->model && cc->model->version =3D=3D CPU_VERSION_AUTO) { + desc =3D g_strdup("(alias configured by machine type)"); + } else { + desc =3D g_strdup_printf("(alias of %s)", alias_of); + } + } if (!desc) { desc =3D x86_cpu_class_get_model_id(cc); } @@ -3532,6 +3571,7 @@ static void x86_cpu_list_entry(gpointer data, gpointe= r user_data) qemu_printf("x86 %-20s %-48s\n", name, desc); g_free(name); g_free(desc); + g_free(alias_of); } =20 /* list available CPU models and flags */ @@ -3580,6 +3620,14 @@ static void x86_cpu_definition_entry(gpointer data, = gpointer user_data) info->migration_safe =3D cc->migration_safe; info->has_migration_safe =3D true; info->q_static =3D cc->static_model; + /* + * Old machine types won't report aliases, so that alias translation + * doesn't break compatibility with previous QEMU versions. + */ + if (default_cpu_version !=3D CPU_VERSION_LEGACY) { + info->alias_of =3D x86_cpu_class_get_alias_of(cc); + info->has_alias_of =3D !!info->alias_of; + } =20 entry =3D g_malloc0(sizeof(*entry)); entry->value =3D info; @@ -3999,7 +4047,8 @@ static void x86_register_cpudef_types(X86CPUDefinitio= n *def) /* Unversioned model: */ m =3D g_new0(X86CPUModel, 1); m->cpudef =3D def; - m->version =3D CPU_VERSION_LEGACY; + m->version =3D CPU_VERSION_AUTO; + m->is_alias =3D true; x86_register_cpu_model_type(def->name, m); =20 /* Versioned models: */ @@ -4016,6 +4065,7 @@ static void x86_register_cpudef_types(X86CPUDefinitio= n *def) X86CPUModel *am =3D g_new0(X86CPUModel, 1); am->cpudef =3D def; am->version =3D vdef->version; + am->is_alias =3D true; x86_register_cpu_model_type(vdef->alias, am); } } diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/= x86_cpu_model_versions.py index b85d6f8604..165c0c7601 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -103,3 +103,129 @@ class X86CPUModelAliases(avocado_qemu.Test): # On pc-*-4.0, no CPU model should be reported as an alias: for name,c in cpus.items(): self.assertNotIn('alias-of', c, "%s shouldn't be an alias" % (= name)) + + def test_4_1_alias(self): + """Check if unversioned CPU model is an alias pointing to right ve= rsion""" + self.vm.add_args('-S') + self.vm.set_machine('pc-i440fx-4.1') + self.vm.launch() + + cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) + + self.assertFalse(cpus['Cascadelake-Server']['static'], + 'unversioned Cascadelake-Server CPU model must no= t be static') + self.assertEquals(cpus['Cascadelake-Server'].get('alias-of'), 'Cas= cadelake-Server-v1', + 'Cascadelake-Server must be an alias of Cascadel= ake-Server-v1') + self.assertNotIn('alias-of', cpus['Cascadelake-Server-v1'], + 'Cascadelake-Server-v1 must not be an alias') + + self.assertFalse(cpus['qemu64']['static'], + 'unversioned qemu64 CPU model must not be static') + self.assertEquals(cpus['qemu64'].get('alias-of'), 'qemu64-v1', + 'qemu64 must be an alias of qemu64-v1') + self.assertNotIn('alias-of', cpus['qemu64-v1'], + 'qemu64-v1 must not be an alias') + + self.validate_variant_aliases(cpus) + + # On pc-*-4.1, -noTSX and -IBRS models should be aliases: + self.assertEquals(cpus["Haswell"].get('alias-of'), + "Haswell-v1", + "Haswell must be an alias") + self.assertEquals(cpus["Haswell-noTSX"].get('alias-of'), + "Haswell-v2", + "Haswell-noTSX must be an alias") + self.assertEquals(cpus["Haswell-IBRS"].get('alias-of'), + "Haswell-v3", + "Haswell-IBRS must be an alias") + self.assertEquals(cpus["Haswell-noTSX-IBRS"].get('alias-of'), + "Haswell-v4", + "Haswell-noTSX-IBRS must be an alias") + + self.assertEquals(cpus["Broadwell"].get('alias-of'), + "Broadwell-v1", + "Broadwell must be an alias") + self.assertEquals(cpus["Broadwell-noTSX"].get('alias-of'), + "Broadwell-v2", + "Broadwell-noTSX must be an alias") + self.assertEquals(cpus["Broadwell-IBRS"].get('alias-of'), + "Broadwell-v3", + "Broadwell-IBRS must be an alias") + self.assertEquals(cpus["Broadwell-noTSX-IBRS"].get('alias-of'), + "Broadwell-v4", + "Broadwell-noTSX-IBRS must be an alias") + + self.assertEquals(cpus["Nehalem"].get('alias-of'), + "Nehalem-v1", + "Nehalem must be an alias") + self.assertEquals(cpus["Nehalem-IBRS"].get('alias-of'), + "Nehalem-v2", + "Nehalem-IBRS must be an alias") + + self.assertEquals(cpus["Westmere"].get('alias-of'), + "Westmere-v1", + "Westmere must be an alias") + self.assertEquals(cpus["Westmere-IBRS"].get('alias-of'), + "Westmere-v2", + "Westmere-IBRS must be an alias") + + self.assertEquals(cpus["SandyBridge"].get('alias-of'), + "SandyBridge-v1", + "SandyBridge must be an alias") + self.assertEquals(cpus["SandyBridge-IBRS"].get('alias-of'), + "SandyBridge-v2", + "SandyBridge-IBRS must be an alias") + + self.assertEquals(cpus["IvyBridge"].get('alias-of'), + "IvyBridge-v1", + "IvyBridge must be an alias") + self.assertEquals(cpus["IvyBridge-IBRS"].get('alias-of'), + "IvyBridge-v2", + "IvyBridge-IBRS must be an alias") + + self.assertEquals(cpus["Skylake-Client"].get('alias-of'), + "Skylake-Client-v1", + "Skylake-Client must be an alias") + self.assertEquals(cpus["Skylake-Client-IBRS"].get('alias-of'), + "Skylake-Client-v2", + "Skylake-Client-IBRS must be an alias") + + self.assertEquals(cpus["Skylake-Server"].get('alias-of'), + "Skylake-Server-v1", + "Skylake-Server must be an alias") + self.assertEquals(cpus["Skylake-Server-IBRS"].get('alias-of'), + "Skylake-Server-v2", + "Skylake-Server-IBRS must be an alias") + + self.assertEquals(cpus["EPYC"].get('alias-of'), + "EPYC-v1", + "EPYC must be an alias") + self.assertEquals(cpus["EPYC-IBPB"].get('alias-of'), + "EPYC-v2", + "EPYC-IBPB must be an alias") + + self.validate_aliases(cpus) + + def test_none_alias(self): + """Check if unversioned CPU model is an alias pointing to some ver= sion""" + self.vm.add_args('-S') + self.vm.set_machine('none') + self.vm.launch() + + cpus =3D dict((m['name'], m) for m in self.vm.command('query-cpu-d= efinitions')) + + self.assertFalse(cpus['Cascadelake-Server']['static'], + 'unversioned Cascadelake-Server CPU model must no= t be static') + self.assertTrue(re.match('Cascadelake-Server-v[0-9]+', cpus['Casca= delake-Server']['alias-of']), + 'Cascadelake-Server must be an alias of versioned = CPU model') + self.assertNotIn('alias-of', cpus['Cascadelake-Server-v1'], + 'Cascadelake-Server-v1 must not be an alias') + + self.assertFalse(cpus['qemu64']['static'], + 'unversioned qemu64 CPU model must not be static') + self.assertTrue(re.match('qemu64-v[0-9]+', cpus['qemu64']['alias-o= f']), + 'qemu64 must be an alias of versioned CPU model') + self.assertNotIn('alias-of', cpus['qemu64-v1'], + 'qemu64-v1 must not be an alias') + + self.validate_aliases(cpus) --=20 2.18.0.rc1.1.g3f1ff2140 From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561681793; cv=none; d=zoho.com; s=zohoarc; b=RsVHL7bMv+lapgrNc2jIbBPgYjxluWatVyakBartQz2II9Swz3+8WTZu9hgh11Dtzf26zLKC05GNBU1GATOVNqyNOkvQQGKcunoZEF3wlIHO+q01tkijUj2DfXe9CvCdqU2YFFew4xQhFckFmq37VqixOJNXV/1SFYQQcoQiUiQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561681793; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=sxxtStTAc6Jr+nUmriUVHfRmgKRnWPQHjWJYuKkF/iA=; b=CWM3yaKDMk8DUfeBN2HpPWoW0tfYF4yd5ZafQ3M5AqfIpVoQ+PYb20jj1LSPIlWAK4i/0yEXyslmlR3Lk7Z96jPd4b5Vyyp6WyfjxP+WhtaPuMVeJ+oNQIpQCBCXXcFLH/B7Uuz19V7TT1UwIKqunBsZXSak+egjUC8AD2rcLBI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1561681793544815.0322459054314; Thu, 27 Jun 2019 17:29:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id CEB50308A953; Fri, 28 Jun 2019 00:29:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BE58B1001B17; Fri, 28 Jun 2019 00:29:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9590554D3D; Fri, 28 Jun 2019 00:29:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5S0T8UA025917 for ; Thu, 27 Jun 2019 20:29:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id E019560C69; Fri, 28 Jun 2019 00:29:08 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3448360BE0; Fri, 28 Jun 2019 00:29:05 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:43 -0300 Message-Id: <20190628002844.24894-9-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com, Igor Mammedov , Jiri Denemark , "Dr. David Alan Gilbert" Subject: [libvirt] [PATCH v2 8/9] docs: Deprecate CPU model runnability guarantees X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 28 Jun 2019 00:29:46 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Document that CPU model runnability guarantees won't apply to unversioned CPU models anymore. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes v1 -> v2: * (none) Cc: libvir-list@redhat.com --- qemu-deprecated.texi | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/qemu-deprecated.texi b/qemu-deprecated.texi index 9cba82d5ec..18f85f70e1 100644 --- a/qemu-deprecated.texi +++ b/qemu-deprecated.texi @@ -276,3 +276,22 @@ Note that if you are exposing the export via /dev/nbd0= , it is easier to just export the entire image and then mount only /dev/nbd0p1 than it is to reinvoke @command{qemu-nbd -c /dev/nbd0} limited to just a subset of the image. + +@section Backwards compatibility + +@subsection Runnability guarantee of CPU models (since 4.1.0) + +Previous versions of QEMU never changed existing CPU models in +ways that introduced additional host software or hardware +requirements to the VM. This allowed management software to +safely change the machine type of an existing VM without +introducing new requirements ("runnability guarantee"). This +prevented CPU models from being updated to include CPU +vulnerability mitigations, leaving guests vulnerable in the +default configuration. + +The CPU model runnability guarantee won't apply anymore to +existing CPU models. Management software that needs runnability +guarantees must resolve the CPU model aliases using te +``alias-of'' field returned by the ``query-cpu-definitions'' QMP +command. --=20 2.18.0.rc1.1.g3f1ff2140 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Wed May 15 10:43:59 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1561682525; cv=none; d=zoho.com; s=zohoarc; b=S3zRpNTEbKJ5jWqilPI27ScYcG74oHINJkbFwtySR8FjPBCPz3h6nCzj8jUHnKuDiaAd8aiHnPVqeMhxvZZWHktaVxTd4a2KshwQuRiW+5udmthuyZRolapNALDAFtpYdJkSz/adg9DZjTabRRX67tZgsy3lUS4gWMJjj2uUipY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1561682525; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=DTBSRY5OtUyF5huourTB9rgioGe6GWvVQEwdmggXJCI=; b=dqEQu9sFhdx8jZ39mbsSZAZiIhI9ZvhzakZCo2gMn7Y+SG9P0EPQOfURR5mF0YxmAYHkrYegPQvrxMlPmimb20nZI66gE41yi5uoo/sfsAEC+eJFjuGeJTa3cBzGFG7sgsWYqQsNFZdairhghw/5IisP7T/tQNLjsRkh1hB2K+c= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1561682525702657.9950850487514; Thu, 27 Jun 2019 17:42:05 -0700 (PDT) Received: from localhost ([::1]:55457 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgexi-0002zo-Lr for importer@patchew.org; Thu, 27 Jun 2019 20:41:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36352) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hgelN-0000dw-Ik for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hgelM-0006xF-5Y for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:52552) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hgelL-0006wo-Tn for qemu-devel@nongnu.org; Thu, 27 Jun 2019 20:29:12 -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 3064B3084288; Fri, 28 Jun 2019 00:29:11 +0000 (UTC) Received: from localhost (ovpn-116-7.gru2.redhat.com [10.97.116.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5828600CC; Fri, 28 Jun 2019 00:29:10 +0000 (UTC) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Thu, 27 Jun 2019 21:28:44 -0300 Message-Id: <20190628002844.24894-10-ehabkost@redhat.com> In-Reply-To: <20190628002844.24894-1-ehabkost@redhat.com> References: <20190628002844.24894-1-ehabkost@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.40]); Fri, 28 Jun 2019 00:29:11 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 9/9] i386: Add Cascadelake-Server-v2 CPU model X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Daniel P. Berrange" , jingqi.liu@intel.com, Tao Xu , "Dr. David Alan Gilbert" , "Hu, Robert" , Igor Mammedov , Jiri Denemark , "Lai, Paul C" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add new version of Cascadelake-Server CPU model, setting stepping=3D5 and enabling the IA32_ARCH_CAPABILITIES MSR with some flags. The new feature will introduce a new host software requirement, breaking our CPU model runnability promises. This means we can't enable the new CPU model version by default in QEMU 4.1, because management software isn't ready yet to resolve CPU model aliases. This is why "pc-*-4.1" will keep returning Cascadelake-Server-v1 if "-cpu Cascadelake-Server" is specified. Includes a test case to ensure the right combinations of machine-type + CPU model + command-line feature flags will work as expected. Signed-off-by: Eduardo Habkost Reviewed-by: Daniel P. Berrang=C3=A9 --- Changes v1 -> v2: * Enable rdctl-no, ibrs-all, skip-l1dfl-vmentry (Suggested by Tao Xu) Cc: "Hu, Robert" Cc: Tao Xu Cc: jingqi.liu@intel.com, Cc: "Lai, Paul C" --- target/i386/cpu.c | 14 +++++ tests/acceptance/x86_cpu_model_versions.py | 73 ++++++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/target/i386/cpu.c b/target/i386/cpu.c index 10a09c971a..570890a7dd 100644 --- a/target/i386/cpu.c +++ b/target/i386/cpu.c @@ -2343,6 +2343,20 @@ static X86CPUDefinition builtin_x86_defs[] =3D { CPUID_6_EAX_ARAT, .xlevel =3D 0x80000008, .model_id =3D "Intel Xeon Processor (Cascadelake)", + .versions =3D (X86CPUVersionDefinition[]) { + { .version =3D 1 }, + { .version =3D 2, + .props =3D (PropValue[]) { + { "stepping", "5" }, + { "arch-capabilities", "on" }, + { "rdctl-no", "on" }, + { "ibrs-all", "on" }, + { "skip-l1dfl-vmentry", "on" }, + { /* end of list */ } + }, + }, + { /* end of list */ } + } }, { .name =3D "Icelake-Client", diff --git a/tests/acceptance/x86_cpu_model_versions.py b/tests/acceptance/= x86_cpu_model_versions.py index 165c0c7601..1c9fd6a56e 100644 --- a/tests/acceptance/x86_cpu_model_versions.py +++ b/tests/acceptance/x86_cpu_model_versions.py @@ -25,6 +25,10 @@ import avocado_qemu import re =20 +def get_cpu_prop(vm, prop): + cpu_path =3D vm.command('query-cpus')[0].get('qom_path') + return vm.command('qom-get', path=3Dcpu_path, property=3Dprop) + class X86CPUModelAliases(avocado_qemu.Test): """ Validation of PC CPU model versions and CPU model aliases @@ -229,3 +233,72 @@ class X86CPUModelAliases(avocado_qemu.Test): 'qemu64-v1 must not be an alias') =20 self.validate_aliases(cpus) + + def test_Cascadelake_arch_capabilities_result(self): + # machine-type only: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.1') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server should not ha= ve arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server should not ha= ve arch-capabilities') + + # command line must override machine-type if CPU model is not vers= ioned: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,+arch-capabilities') + vm.launch() + self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server,+arch-capabili= ties should have arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.1') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,-arch-capabilities') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server,-arch-capabil= ities should not have arch-capabilities') + + # versioned CPU model overrides machine-type: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server-v1,x-force-features=3Don,c= heck=3Doff,enforce=3Doff') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server-v1 should not= have arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,c= heck=3Doff,enforce=3Doff') + vm.launch() + self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server-v1 should hav= e arch-capabilities') + + # command line must override machine-type and versioned CPU model: + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.0') + vm.add_args('-cpu', 'Cascadelake-Server,x-force-features=3Don,chec= k=3Doff,enforce=3Doff,+arch-capabilities') + vm.launch() + self.assertTrue(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.0 + Cascadelake-Server-v1,+arch-capa= bilities should have arch-capabilities') + + vm =3D self.get_vm() + vm.add_args('-S') + vm.set_machine('pc-i440fx-4.1') + vm.add_args('-cpu', 'Cascadelake-Server-v2,x-force-features=3Don,c= heck=3Doff,enforce=3Doff,-arch-capabilities') + vm.launch() + self.assertFalse(get_cpu_prop(vm, 'arch-capabilities'), + 'pc-i440fx-4.1 + Cascadelake-Server-v2,-arch-capa= bilities should not have arch-capabilities') --=20 2.18.0.rc1.1.g3f1ff2140