From nobody Thu Dec 5 01:43:11 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 1732311647798919.3064770195022; Fri, 22 Nov 2024 13:40:47 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 260FB15B1; Fri, 22 Nov 2024 16:40:47 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 9C4291536; Fri, 22 Nov 2024 16:34:34 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 65B1E139E; Fri, 22 Nov 2024 16:34:23 -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 EBED01660 for ; Fri, 22 Nov 2024 16:33:47 -0500 (EST) Received: from mx-prod-mc-04.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-619-z-sfE0CtPY6NVNXBHYmjnA-1; Fri, 22 Nov 2024 16:33:46 -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-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 60A2F19773FF for ; Fri, 22 Nov 2024 21:33:45 +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 D35FB196BC20 for ; Fri, 22 Nov 2024 21:33:44 +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_H2,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=1732311227; 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=t9auH4KdiFuk3BpEkvfAM3tLn2GHvIjD48Ux3oHgQEo=; b=TEATp8Bvs+kwfo0aZZIZ+UZB7xIwuqJOv21MxRLQKwwb7KhwyqbV4Xp+YSbmY7n+s1E9tm ji4BaD9vOtmXJc8TTDCY7rm4/UBOTXPeLcJ5upCWD5S/jZEaBTseVhPqNT+2NReBI9G6u7 2sjKTciYzmYdBYQv+6XrYS+eQ7LW8Qw= X-MC-Unique: z-sfE0CtPY6NVNXBHYmjnA-1 X-Mimecast-MFC-AGG-ID: z-sfE0CtPY6NVNXBHYmjnA From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH v2 12/36] sync_qemu_models_i386: Copy signatures from base model Date: Fri, 22 Nov 2024 22:32:52 +0100 Message-ID: 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: toBuN2GEf41D-0cJwqcDsG2XGYg8sN0JsxAUl47rHtw_1732311225 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: EZOMS223COPIDTAUGEWTFHEVOHOPUFGN X-Message-ID-Hash: EZOMS223COPIDTAUGEWTFHEVOHOPUFGN 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: 1732311648937116600 Content-Type: text/plain; charset="utf-8" The signatures in the CPU map are used for matching physical CPUs and thus we need to cover all possible real world variants we know about. When adding a new version of an existing CPU model, we should copy the signature(s) of the existing model rather than replacing it with the signature that QEMU uses. Signed-off-by: Jiri Denemark Reviewed-by: Daniel P. Berrang=C3=A9 --- Notes: Version 2: - no change src/cpu_map/sync_qemu_models_i386.py | 46 ++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/src/cpu_map/sync_qemu_models_i386.py b/src/cpu_map/sync_qemu_m= odels_i386.py index 024bc92f07..798d767f4d 100755 --- a/src/cpu_map/sync_qemu_models_i386.py +++ b/src/cpu_map/sync_qemu_models_i386.py @@ -429,7 +429,30 @@ def transform(item): raise RuntimeError("unexpected item type") =20 =20 -def expand_model(model): +def get_signature(outdir, model): + file =3D os.path.join(outdir, f"x86_{model}.xml") + + if not os.path.isfile(file): + return None + + xml =3D lxml.etree.parse(file) + + signature =3D [] + for sig in xml.xpath("//signature"): + attr =3D sig.attrib + family =3D attr["family"] + model =3D attr["model"] + if "stepping" in attr: + stepping =3D attr["stepping"] + else: + stepping =3D None + + signature.append((family, model, stepping)) + + return signature + + +def expand_model(outdir, model): """Expand a qemu cpu model description that has its feature split up i= nto different fields and may have differing versions into several libvirt- friendly cpu models.""" @@ -438,11 +461,14 @@ def expand_model(model): "name": model.pop(".name"), "vendor": translate_vendor(model.pop(".vendor")), "features": set(), - "extra": dict()} + "extra": dict(), + "signature": list(), + } =20 if ".family" in model and ".model" in model: - result["family"] =3D model.pop(".family") - result["model"] =3D model.pop(".model") + result["signature"].append((model.pop(".family"), + model.pop(".model"), + None)) =20 for k in [k for k in model if k.startswith(".features")]: v =3D model.pop(k) @@ -470,6 +496,10 @@ def expand_model(model): if not alias and ver =3D=3D 1: alias =3D name =20 + sig =3D get_signature(outdir, name) + if sig: + result["signature"] =3D sig + props =3D version.pop(".props", dict()) for k, v in props: if k not in ("model-id", "stepping", "model"): @@ -524,7 +554,11 @@ def output_model(f, extra, model): if "alias" in model: f.write(f" \n") else: - f.write(f" \n") + for sig_family, sig_model, sig_stepping in model['signature']: + f.write(f" \n") f.write(f" \n") =20 for feature in sorted(model["features"]): @@ -600,7 +634,7 @@ def main(): =20 models =3D list() for model in models_json: - models.extend(expand_model(model)) + models.extend(expand_model(args.outdir, model)) =20 files =3D dict() =20 --=20 2.47.0