From nobody Fri Dec 19 20:14:06 2025 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 8.43.85.245 is neither permitted nor denied by domain of lists.libvirt.org) 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 1699309456451651.9654440905225; Mon, 6 Nov 2023 14:24:16 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id DE2D31A93; Mon, 6 Nov 2023 17:24:14 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9B37719A8; Mon, 6 Nov 2023 17:22:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 4F9DF19D9; Mon, 6 Nov 2023 17:21:32 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 0711B19B3 for ; Mon, 6 Nov 2023 17:21:27 -0500 (EST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-39-p4XYMVPJNEK1m5euE-aFcw-1; Mon, 06 Nov 2023 17:21:26 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (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 mimecast-mx02.redhat.com (Postfix) with ESMTPS id C06A5832D60 for ; Mon, 6 Nov 2023 22:21:25 +0000 (UTC) Received: from himantopus.redhat.com (unknown [10.2.18.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9CCE5502B for ; Mon, 6 Nov 2023 22:21:25 +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.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.4 X-MC-Unique: p4XYMVPJNEK1m5euE-aFcw-1 From: Jonathon Jongsma To: devel@lists.libvirt.org Subject: [libvirt PATCH 01/19] cpu_map: update script to generate versioned CPUs Date: Mon, 6 Nov 2023 16:21:06 -0600 Message-ID: <20231106222124.3675713-2-jjongsma@redhat.com> In-Reply-To: <20231106222124.3675713-1-jjongsma@redhat.com> References: <20231106222124.3675713-1-jjongsma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: AXTJKEK6O5F67M3YXDALL72TAF5CRC75 X-Message-ID-Hash: AXTJKEK6O5F67M3YXDALL72TAF5CRC75 X-MailFrom: jjongsma@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: Content-Type: text/plain; charset="utf-8"; x-default="true" Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1699309458563100001 Previously, the script only generated the parent CPU and any versions that had a defined alias. Now generate all CPU versions. Any version that had a defined alias will continue to use that alias, but those without aliases will use the generated name $BASECPUNAME-vN. This generated name will be used as an alternate name for those CPU versions with defined aliases. --- src/cpu_map/sync_qemu_models_i386.py | 44 +++++++++++++++++++++++----- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_m= odels_i386.py index 1c6a2d4d27..956e4700de 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -322,31 +322,55 @@ def expand_model(model): different fields and may have differing versions into several libvirt- friendly cpu models.""" =20 - result =3D { - "name": model.pop(".name"), + basename =3D model.pop(".name") + parent =3D { + "name": basename, + "alias": None, "vendor": translate_vendor(model.pop(".vendor")), "features": set(), "extra": dict()} =20 if ".family" in model and ".model" in model: - result["family"] =3D model.pop(".family") - result["model"] =3D model.pop(".model") + parent["family"] =3D model.pop(".family") + parent["model"] =3D model.pop(".model") =20 for k in [k for k in model if k.startswith(".features")]: v =3D model.pop(k) for feature in v.split(): translated =3D translate_feature(feature) if translated: - result["features"].add(translated) + parent["features"].add(translated) =20 versions =3D model.pop(".versions", []) for k, v in model.items(): - result["extra"]["model" + k] =3D v - yield result + parent["extra"]["model" + k] =3D v + + result =3D parent =20 for version in versions: + # each version builds on the previous one result =3D copy.deepcopy(result) - result["name"] =3D version.pop(".alias", result["name"]) + vnum =3D int(version.pop(".version")) + vname =3D "{}-v{}".format(basename, vnum) + if vnum =3D=3D 1: + # the first version should always be an alias for the parent a= nd + # should therefore have no extra properties + if version.items(): + raise RuntimeError("Unexpected properties in version 1") + # just treat this version as an alias of the parent model and = don't + # generate a new CPU model + parent["alias"] =3D vname + continue + + # prefer the 'alias' over the generated the name if it exists sinc= e we + # have already been using these aliases + alias =3D version.pop(".alias", None) + if alias: + result["name"] =3D alias + result["alias"] =3D vname + else: + result["name"] =3D vname + result["alias"] =3D None =20 props =3D version.pop(".props", dict()) for k, v in props: @@ -367,6 +391,8 @@ def expand_model(model): =20 yield result =20 + yield parent + =20 def output_model(f, model): if model["extra"]: @@ -377,6 +403,8 @@ def output_model(f, model): =20 f.write("\n") f.write(" \n".format(model["name"])) + if model["alias"]: + f.write(" \n".format(model["alias"])) f.write(" \n") f.write(" \n".format( model["family"], model["model"])) --=20 2.41.0 _______________________________________________ Devel mailing list -- devel@lists.libvirt.org To unsubscribe send an email to devel-leave@lists.libvirt.org