From nobody Wed Dec 4 19:05:36 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 1732042635557979.2248030919727; Tue, 19 Nov 2024 10:57:15 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 718AE1B12; Tue, 19 Nov 2024 13:57:14 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id EDB0E14C0; Tue, 19 Nov 2024 13:51:19 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id 7E451140B; Tue, 19 Nov 2024 13:51:13 -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 D9629148A for ; Tue, 19 Nov 2024 13:50: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-92-WvO3S16YN0GShtHPXZ-o6Q-1; Tue, 19 Nov 2024 13:50:36 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 595C31955D58 for ; Tue, 19 Nov 2024 18:50:35 +0000 (UTC) Received: from orkuz (unknown [10.45.226.13]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id CF7F91956052 for ; Tue, 19 Nov 2024 18:50:34 +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=1732042237; 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=4gBSDgC1lvPFCChT6Hv08pN8/aqbWi42SS5i2QgHgTw=; b=LetZ1nAOWjAbWDIAG3SmcGdiVlz57iC+njSMNUFv5kRJiXO+HOMPDWtWh0YTTci8rPQVMn pXaABX/YBU1fwBtZwE4oD1QqTnPNgHkr61fl6F4VTzzXYqT3AVMWej0ZKGHOqD9d7XSAHH sX8T7kjZGTNi+mttu+btkzeSlrqsSdg= X-MC-Unique: WvO3S16YN0GShtHPXZ-o6Q-1 X-Mimecast-MFC-AGG-ID: WvO3S16YN0GShtHPXZ-o6Q From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 11/32] sync_qemu_models_i386: Copy signatures from base model Date: Tue, 19 Nov 2024 19:49:47 +0100 Message-ID: <56d5afa5abc116eddc811bf2a86a587cf578f52e.1732039836.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: w5gNpgBOIrtyat2s6vSF0pL0PlDCr6bjS0fWCKZAjyo_1732042235 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: ESIGYKCILQ6VMU4AWZP66CQMAAPHCVNC X-Message-ID-Hash: ESIGYKCILQ6VMU4AWZP66CQMAAPHCVNC 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: 1732042636562116600 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 --- 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 40d71e66be..9b7cb8a047 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) @@ -469,6 +495,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"): @@ -525,7 +555,11 @@ def output_model(f, extra, model): if alias: 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"]): @@ -601,7 +635,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