From nobody Mon Feb 9 00:41:04 2026 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 1729190733632174.20064911355212; Thu, 17 Oct 2024 11:45:33 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 84222A55; Thu, 17 Oct 2024 14:45:32 -0400 (EDT) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id BA1371549; Thu, 17 Oct 2024 14:40:59 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 996) id 982D8B3A; Thu, 17 Oct 2024 14:40:53 -0400 (EDT) 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 A5B6514C8 for ; Thu, 17 Oct 2024 14:40:18 -0400 (EDT) Received: from mx-prod-mc-03.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-47-ohMDJ1F2M9O4NLbvn1lTXQ-1; Thu, 17 Oct 2024 14:40:15 -0400 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 19FA219560BD for ; Thu, 17 Oct 2024 18:40:14 +0000 (UTC) Received: from orkuz (unknown [10.45.224.13]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 96D4019560AD for ; Thu, 17 Oct 2024 18:40:13 +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=3.0 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_SBL_CSS, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED, SPF_HELO_NONE autolearn=no autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1729190418; 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=PHgtGSQhoK+3GJXgkjDh8Xox4k3lCkDgB+n/zcUAeOs=; b=g5q4dZQKeb6zzwp07LVMXYaTURuncaFEX7Iqj7Tb4gVLT4Q8py98sfIXA+xlP3ugfoIQMN 2U5JN4i/0DTP6aTGdzn0XolDn2SHLoecGHMXi6Ljrvr58yyJnVXRcgve1xwx2tHlbPiMbl YroTxVDiXRpQmVvH/FTa0DMlk3+XwIY= X-MC-Unique: ohMDJ1F2M9O4NLbvn1lTXQ-1 From: Jiri Denemark To: devel@lists.libvirt.org Subject: [PATCH 8/9] qemu_capabilities: Introduce virQEMUCapsGetCPUBlockers Date: Thu, 17 Oct 2024 20:39:54 +0200 Message-ID: <1a17bbfb596839b4a8c5d2e2ee3f93725734c003.1729190350.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BKNRXER7V4WYFMTQAX4WDPJXV3K2D2CV X-Message-ID-Hash: BKNRXER7V4WYFMTQAX4WDPJXV3K2D2CV 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: 1729190734210116600 Content-Type: text/plain; charset="utf-8" A function for accessing a list of features blocking CPU model usability. Signed-off-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 38 ++++++++++++++++++++++++++++++++++++ src/qemu/qemu_capabilities.h | 4 ++++ 2 files changed, 42 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index e1e28e5cd1..b5fa738bd8 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2507,6 +2507,44 @@ virQEMUCapsIsCPUUsable(virQEMUCaps *qemuCaps, } =20 =20 +/** + * virQEMUCapsGetCPUBlockers: + * @qemuCaps: QEMU capabilities + * @type: virtualization type + * @cpu: CPU model + * @blockers: where to store the list of features + * + * Get a list of features that prevent @cpu from being usable. The pointer= to + * the list will be stored in @blockers and the caller must not free it. T= he + * pointer is valid as long as there is an active reference to @qemuCaps. + * + * Returns 0 on success, -1 when @cpu is not found in @qemuCaps. + */ +int +virQEMUCapsGetCPUBlockers(virQEMUCaps *qemuCaps, + virDomainVirtType type, + const char *cpu, + char ***blockers) +{ + qemuMonitorCPUDefs *defs; + size_t i; + + defs =3D virQEMUCapsGetAccel(qemuCaps, type)->cpuModels; + + if (!defs) + return -1; + + for (i =3D 0; i < defs->ncpus; i++) { + if (STREQ(defs->cpus[i].name, cpu)) { + *blockers =3D defs->cpus[i].blockers; + return 0; + } + } + + return -1; +} + + bool virQEMUCapsIsMachineDeprecated(virQEMUCaps *qemuCaps, virDomainVirtType type, diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 284b07b64e..54c7e30903 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -795,6 +795,10 @@ bool virQEMUCapsIsCPUDeprecated(virQEMUCaps *qemuCaps, bool virQEMUCapsIsCPUUsable(virQEMUCaps *qemuCaps, virDomainVirtType type, virCPUDef *cpu); +int virQEMUCapsGetCPUBlockers(virQEMUCaps *qemuCaps, + virDomainVirtType type, + const char *cpu, + char ***blockers); bool virQEMUCapsIsMachineDeprecated(virQEMUCaps *qemuCaps, virDomainVirtType type, const char *machine); --=20 2.47.0