From nobody Thu Dec 5 01:49:06 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1732311497097742.5287869299583; Fri, 22 Nov 2024 13:38:17 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7C97AD90; Fri, 22 Nov 2024 16:38:16 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 03E5A16DD; Fri, 22 Nov 2024 16:34:22 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 301B8151B; Fri, 22 Nov 2024 16:34:17 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 28E88151B for ; Fri, 22 Nov 2024 16:33:37 -0500 (EST) Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-160-d9prvvIMOuuQTVsYYqCYjg-1; Fri, 22 Nov 2024 16:33:35 -0500 Received: from mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 29B891955F42 for ; Fri, 22 Nov 2024 21:33:34 +0000 (UTC) Received: from orkuz (unknown [10.45.224.26]) by mx-prod-int-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id A1D9B1956086 for ; Fri, 22 Nov 2024 21:33:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732311216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZpGGQYfuAreBh/yUdNdnY52ZJiCn52jxApQIKNiDDPU=; b=Nyw8zE7sHbfUIHZ4v2OEogCvShpXIGPstFC0Xh3kHSWDEvLhLAy6ILgiwKXiVWoYhfXGaH HBrA3qgy6qtUwJu1CRKic2wjTZ/QocWM3hbM660VTOCsnIX5Wx36Ed/6uDg/0HdspFS2KN LAy2inItv45WNRpF9fI8FkeFX5kr4TA= X-MC-Unique: d9prvvIMOuuQTVsYYqCYjg-1 X-Mimecast-MFC-AGG-ID: d9prvvIMOuuQTVsYYqCYjg From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH v2 07/36] sync_qemu_models_i386: Add support for versioned CPU models Date: Fri, 22 Nov 2024 22:32:47 +0100 Message-ID: <788865cdbc2cb2b1d6e3629ed92178c5de98ed09.1732311125.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.15 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -hFu5s4IABnjUvBBTKs5jPw5tjEIzYDDzw6JZEFDA2c_1732311214 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: PQICLSKOXC42NVNROACAGGKOVLK4D3MT X-Message-ID-Hash: PQICLSKOXC42NVNROACAGGKOVLK4D3MT X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1732311498419116600 Content-Type: text/plain; charset="utf-8" Each CPU model with -v* suffix is defined as a standalone model copying all attributes of the previous version. CPU model versions with an alias are handled differently. The full definition is used for the alias and the versioned model is created as an identical copy of the alias. To avoid breaking migration compatibility of host-model CPUs all versioned models are marked with so that they are ignored when selecting candidates for host-model. It's not ideal but not doing so would break almost all host-model CPUs as the new versioned CPU models have all vmx-* features included since their introduction while existing CPU models were updated later. This meas existing models would be accompanied with a long list of vmx-* features to properly describe a host CPU while the newly added CPU models would have those features enabled implicitly and their list of features would be significantly shorter. Thus the new models would always be better candidates for host-model than the existing models. Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrang=C3=A9 --- Notes: Version 2: - make -v? variants linked to their corresponding non-versioned models (such as -noTSX, -IBRS, etc.) - all -v? variants are marked with src/cpu_map/sync_qemu_models_i386.py | 44 ++++++++++++++++++++++++---- 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_m= odels_i386.py index 13f62780e6..5169d50b08 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -454,11 +454,21 @@ def expand_model(model): versions =3D model.pop(".versions", []) for k, v in model.items(): result["extra"]["model" + k] =3D v + + print(result['name']) yield result =20 + name =3D result["name"] for version in versions: result =3D copy.deepcopy(result) - result["name"] =3D version.pop(".alias", result["name"]) + + ver =3D int(version.pop(".version")) + result["name"] =3D f"{name}-v{ver}" + result["base"] =3D name + + alias =3D version.pop(".alias", None) + if not alias and ver =3D=3D 1: + alias =3D name =20 props =3D version.pop(".props", dict()) for k, v in props: @@ -477,7 +487,24 @@ def expand_model(model): for k, v in version.items(): result["extra"]["version" + k] =3D v =20 - yield result + if alias: + print(f"v{ver}: {result['name']} =3D> {alias}") + yield { + "vendor": result["vendor"], + "name": result["name"], + "base": result["base"], + "alias": alias, + "extra": None, + "features": [], + } + + if ver !=3D 1: + result["name"] =3D alias + print(f"v{ver}: {result['name']}") + yield result + else: + print(f"v{ver}: {result['name']}") + yield result =20 =20 def output_model(f, model): @@ -487,11 +514,18 @@ def output_model(f, model): f.write(f" '{k}': '{v}'\n") f.write("-->\n") =20 + decode =3D "off" if "base" in model else "on" + f.write("\n") f.write(f" \n") - f.write(" \n") - f.write(f" \n") - f.write(f" \n") + f.write(f" \n") + + if "alias" in model: + f.write(f" \n") + else: + f.write(f" \n") + f.write(f" \n") + for feature in sorted(model["features"]): f.write(f" \n") f.write(" \n") --=20 2.47.0