From nobody Mon Sep 8 17:04:32 2025 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=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756997468; cv=none; d=zohomail.com; s=zohoarc; b=CMuiwUyDhIVCKMIOPPbLcms0MG8p1wbQWVnZ0gHA8Cls5h9CE16rz6Qam/MDBrA9hOXcAd4D7ylQvzVmFTlluFNhTBSm0sxrU+dM3Ba1TX055LmrXUbjvPpg96tXWmu6LDndmJS5EQWj2BNWp2xJHho9l7UbECwWgLeg7vuxdpA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756997468; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=InZBlWaOkZOWdONNVRhARdGKm0pqzr8KcubGsoaxFys=; b=FR+JV/KyJzs4cU/yGsbJEiNLYjkLE3qIs17T6QbPdcr3Ns/sSCGMteQHIpCIwFg2pJPYF21rekLXUV2ZVtYLUHmp5Pk8W/5tnCGpibyoFhYp+6nytwvSdLpKdbjYm1qLIHPOYi+meobVySf4NRrpb26Gwgv6wAnIUwiNBVDIlc4= ARC-Authentication-Results: i=1; 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=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756997468400136.19147415999635; Thu, 4 Sep 2025 07:51:08 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 507A14465E; Thu, 4 Sep 2025 10:51:07 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 97403442DA; Thu, 4 Sep 2025 10:47:34 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 3165A442F1; Thu, 4 Sep 2025 10:47:24 -0400 (EDT) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 396D5442E5 for ; Thu, 4 Sep 2025 10:47:13 -0400 (EDT) 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-531-r6mJauHQNKGV0pd7haqRiA-1; Thu, 04 Sep 2025 10:47:08 -0400 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 ADF8719560AA for ; Thu, 4 Sep 2025 14:47:07 +0000 (UTC) Received: from orkuz (unknown [10.43.3.115]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 3BB713002D29 for ; Thu, 4 Sep 2025 14:47:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1756997232; 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=InZBlWaOkZOWdONNVRhARdGKm0pqzr8KcubGsoaxFys=; b=WfoJTaz6hO13JfjFecYD/qJm0m787BrS0TmIiZ+jg0K5V9GqQJ25K8B1L3wdXwk6kAOuTW uJJgN7Rxvsnv4FEmdCBqiuz8wqj6Hw1Oqehf/BF2oHCTQ7GA19cN8JXwGArFSIm6L1azls dUOd5FwtPa0tR46+IpsLeJptKswwM2o= X-MC-Unique: r6mJauHQNKGV0pd7haqRiA-1 X-Mimecast-MFC-AGG-ID: r6mJauHQNKGV0pd7haqRiA_1756997227 To: devel@lists.libvirt.org Subject: [PATCH 01/14] qemu: Drop legacy probing of CPU features Date: Thu, 4 Sep 2025 16:46:49 +0200 Message-ID: <54c04d506c5a9751e2fb858e2a0dc6ebb61c4b7f.1756996033.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: huGSSV-rrovCYyV_E8UfDBax6zjbPwpJasuq_DOAN9A_1756997227 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: BBI6A6XTCZHF2Q4Q7GCAM7Z3UIEV4UNL X-Message-ID-Hash: BBI6A6XTCZHF2Q4Q7GCAM7Z3UIEV4UNL X-MailFrom: jdenemar@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Jiri Denemark via Devel Reply-To: Jiri Denemark X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756997470468116600 Content-Type: text/plain; charset="utf-8" From: Jiri Denemark The legacy probing which reads CPUID registers from QEMU and interprets the individual bits is not used with any QEMU version currently supported by libvirt. Signed-off-by: Jiri Denemark Reviewed-by: Peter Krempa --- src/qemu/qemu_monitor.c | 30 --- src/qemu/qemu_monitor.h | 5 - src/qemu/qemu_monitor_json.c | 191 ------------------ src/qemu/qemu_process.c | 19 +- .../qemumonitorjson-getcpu-ecx.data | 7 - .../qemumonitorjson-getcpu-ecx.json | 57 ------ .../qemumonitorjson-getcpu-full.data | 5 - .../qemumonitorjson-getcpu-full.json | 46 ----- .../qemumonitorjson-getcpu-host.data | 6 - .../qemumonitorjson-getcpu-host.json | 45 ----- tests/qemumonitorjsontest.c | 116 ----------- 11 files changed, 6 insertions(+), 521 deletions(-) delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.da= ta delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.js= on delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.d= ata delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.j= son delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.d= ata delete mode 100644 tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.j= son diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 1f5b4ec215..0213bd5af8 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3669,36 +3669,6 @@ qemuMonitorSetDomainLog(qemuMonitor *mon, } =20 =20 -/** - * qemuMonitorJSONGetGuestCPUx86: - * @mon: Pointer to the monitor - * @cpuQOMPath: QOM path of a CPU to probe - * @data: returns the cpu data - * @disabled: returns the CPU data for features which were disabled by QEMU - * - * Retrieve the definition of the guest CPU from a running qemu instance. - * - * Returns 0 on success, -2 if the operation is not supported by the guest, - * -1 on other errors. - */ -int -qemuMonitorGetGuestCPUx86(qemuMonitor *mon, - const char *cpuQOMPath, - virCPUData **data, - virCPUData **disabled) -{ - VIR_DEBUG("cpuQOMPath=3D%s data=3D%p disabled=3D%p", cpuQOMPath, data,= disabled); - - QEMU_CHECK_MONITOR(mon); - - *data =3D NULL; - if (disabled) - *disabled =3D NULL; - - return qemuMonitorJSONGetGuestCPUx86(mon, cpuQOMPath, data, disabled); -} - - /** * qemuMonitorGetGuestCPU: * @mon: Pointer to the monitor diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index a2ba5882f6..689a587ec6 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1263,11 +1263,6 @@ void qemuMonitorSetDomainLog(qemuMonitor *mon, void *opaque, virFreeCallback destroy); =20 -int qemuMonitorGetGuestCPUx86(qemuMonitor *mon, - const char *cpuQOMPath, - virCPUData **data, - virCPUData **disabled); - typedef const char *(*qemuMonitorCPUFeatureTranslationCallback)(virArch ar= ch, const char= *name); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 0e5a9d3b4f..6402d18d37 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -6578,197 +6578,6 @@ qemuMonitorJSONGetDeviceAliases(qemuMonitor *mon, } =20 =20 -static int -qemuMonitorJSONParseCPUx86FeatureWord(virJSONValue *data, - virCPUx86CPUID *cpuid) -{ - const char *reg; - unsigned long long eax_in; - unsigned long long ecx_in =3D 0; - unsigned long long features; - - memset(cpuid, 0, sizeof(*cpuid)); - - if (!(reg =3D virJSONValueObjectGetString(data, "cpuid-register"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing cpuid-register in CPU data")); - return -1; - } - if (virJSONValueObjectGetNumberUlong(data, "cpuid-input-eax", &eax_in)= < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing or invalid cpuid-input-eax in CPU data")= ); - return -1; - } - ignore_value(virJSONValueObjectGetNumberUlong(data, "cpuid-input-ecx", - &ecx_in)); - if (virJSONValueObjectGetNumberUlong(data, "features", &features) < 0)= { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("missing or invalid features in CPU data")); - return -1; - } - - cpuid->eax_in =3D eax_in; - cpuid->ecx_in =3D ecx_in; - if (STREQ(reg, "EAX")) { - cpuid->eax =3D features; - } else if (STREQ(reg, "EBX")) { - cpuid->ebx =3D features; - } else if (STREQ(reg, "ECX")) { - cpuid->ecx =3D features; - } else if (STREQ(reg, "EDX")) { - cpuid->edx =3D features; - } else { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unknown CPU register '%1$s'"), reg); - return -1; - } - - return 0; -} - - -static virCPUData * -qemuMonitorJSONParseCPUx86Features(virJSONValue *data) -{ - g_autoptr(virCPUData) cpudata =3D NULL; - virCPUx86DataItem item =3D { 0 }; - size_t i; - - if (!(cpudata =3D virCPUDataNew(VIR_ARCH_X86_64))) - return NULL; - - item.type =3D VIR_CPU_X86_DATA_CPUID; - for (i =3D 0; i < virJSONValueArraySize(data); i++) { - if (qemuMonitorJSONParseCPUx86FeatureWord(virJSONValueArrayGet(dat= a, i), - &item.data.cpuid) < 0) { - return NULL; - } - - virCPUx86DataAdd(cpudata, &item); - } - - return g_steal_pointer(&cpudata); -} - - -static int -qemuMonitorJSONGetCPUx86Data(qemuMonitor *mon, - const char *cpuQOMPath, - const char *property, - virCPUData **cpudata) -{ - g_autoptr(virJSONValue) cmd =3D NULL; - g_autoptr(virJSONValue) reply =3D NULL; - virJSONValue *data; - - if (!(cmd =3D qemuMonitorJSONMakeCommand("qom-get", - "s:path", cpuQOMPath, - "s:property", property, - NULL))) - return -1; - - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - return -1; - - if (!(data =3D qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRAY= ))) - return -1; - - if (!(*cpudata =3D qemuMonitorJSONParseCPUx86Features(data))) - return -1; - - return 0; -} - - -/* - * Returns -1 on error, 0 if QEMU does not support reporting CPUID features - * of a guest CPU, and 1 if the feature is supported. - */ -static int -qemuMonitorJSONCheckCPUx86(qemuMonitor *mon, - const char *cpuQOMPath) -{ - g_autoptr(virJSONValue) cmd =3D NULL; - g_autoptr(virJSONValue) reply =3D NULL; - virJSONValue *data; - size_t i; - size_t n; - - if (!(cmd =3D qemuMonitorJSONMakeCommand("qom-list", - "s:path", cpuQOMPath, - NULL))) - return -1; - - if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) - return -1; - - if ((data =3D virJSONValueObjectGet(reply, "error"))) { - const char *klass =3D virJSONValueObjectGetString(data, "class"); - if (STREQ_NULLABLE(klass, "DeviceNotFound") || - STREQ_NULLABLE(klass, "CommandNotFound")) { - return 0; - } - } - - if (!(data =3D qemuMonitorJSONGetReply(cmd, reply, VIR_JSON_TYPE_ARRAY= ))) - return -1; - - n =3D virJSONValueArraySize(data); - - for (i =3D 0; i < n; i++) { - virJSONValue *element =3D virJSONValueArrayGet(data, i); - if (STREQ_NULLABLE(virJSONValueObjectGetString(element, "name"), - "feature-words")) - return 1; - } - - return 0; -} - - -/** - * qemuMonitorJSONGetGuestCPUx86: - * @mon: Pointer to the monitor - * @cpuQOMPath: QOM path of a CPU to probe - * @data: returns the cpu data of the guest - * @disabled: returns the CPU data for features which were disabled by QEMU - * - * Retrieve the definition of the guest CPU from a running qemu instance. - * - * Returns 0 on success, -2 if guest doesn't support this feature, - * -1 on other errors. - */ -int -qemuMonitorJSONGetGuestCPUx86(qemuMonitor *mon, - const char *cpuQOMPath, - virCPUData **data, - virCPUData **disabled) -{ - g_autoptr(virCPUData) cpuEnabled =3D NULL; - g_autoptr(virCPUData) cpuDisabled =3D NULL; - int rc; - - if ((rc =3D qemuMonitorJSONCheckCPUx86(mon, cpuQOMPath)) < 0) - return -1; - else if (!rc) - return -2; - - if (qemuMonitorJSONGetCPUx86Data(mon, cpuQOMPath, "feature-words", - &cpuEnabled) < 0) - return -1; - - if (disabled && - qemuMonitorJSONGetCPUx86Data(mon, cpuQOMPath, "filtered-features", - &cpuDisabled) < 0) - return -1; - - *data =3D g_steal_pointer(&cpuEnabled); - if (disabled) - *disabled =3D g_steal_pointer(&cpuDisabled); - return 0; -} - - static int qemuMonitorJSONGetCPUProperties(qemuMonitor *mon, const char *cpuQOMPath, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 059834648d..2988ffb157 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4579,29 +4579,22 @@ qemuProcessFetchGuestCPU(virDomainObj *vm, g_autoptr(virCPUData) dataEnabled =3D NULL; g_autoptr(virCPUData) dataDisabled =3D NULL; const char *cpuQOMPath =3D qemuProcessGetVCPUQOMPath(vm); - bool generic; int rc; =20 *enabled =3D NULL; *disabled =3D NULL; =20 - generic =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_F= EATURES); - - if (!generic && !ARCH_IS_X86(vm->def->os.arch)) + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CPU_UNAVAILABLE_FEATURES= )) return 0; =20 if (qemuDomainObjEnterMonitorAsync(vm, asyncJob) < 0) return -1; =20 - if (generic) { - rc =3D qemuMonitorGetGuestCPU(priv->mon, - vm->def->os.arch, - cpuQOMPath, - virQEMUCapsCPUFeatureFromQEMU, - &dataEnabled, &dataDisabled); - } else { - rc =3D qemuMonitorGetGuestCPUx86(priv->mon, cpuQOMPath, &dataEnabl= ed, &dataDisabled); - } + rc =3D qemuMonitorGetGuestCPU(priv->mon, + vm->def->os.arch, + cpuQOMPath, + virQEMUCapsCPUFeatureFromQEMU, + &dataEnabled, &dataDisabled); =20 qemuDomainObjExitMonitor(vm); =20 diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.data b/te= sts/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.data deleted file mode 100644 index 457bbbe339..0000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.data +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.json b/te= sts/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.json deleted file mode 100644 index 9eca2dec11..0000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-ecx.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "return": [ - { - "cpuid-register": "EAX", - "cpuid-input-ecx": 1, - "cpuid-input-eax": 13, - "features": 1 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483658, - "features": 0 - }, - { - "cpuid-register": "EAX", - "cpuid-input-eax": 1073741825, - "features": 16777467 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 3221225473, - "features": 0 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483655, - "features": 0 - }, - { - "cpuid-register": "ECX", - "cpuid-input-eax": 2147483649, - "features": 289 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483649, - "features": 739248128 - }, - { - "cpuid-register": "EBX", - "cpuid-input-ecx": 0, - "cpuid-input-eax": 7, - "features": 1839035 - }, - { - "cpuid-register": "ECX", - "cpuid-input-eax": 1, - "features": 4160369155 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 1, - "features": 260832255 - } - ], - "id": "feature-words" -} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data b/t= ests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data deleted file mode 100644 index b581821060..0000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.data +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.json b/t= ests/qemumonitorjsondata/qemumonitorjson-getcpu-full.json deleted file mode 100644 index 29c00b4c95..0000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-full.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "return": [ - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483658, - "features": 0 - }, - { - "cpuid-register": "EAX", - "cpuid-input-eax": 1073741825, - "features": 16777275 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 3221225473, - "features": 0 - }, - { - "cpuid-register": "ECX", - "cpuid-input-eax": 2147483649, - "features": 1 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483649, - "features": 672139264 - }, - { - "cpuid-register": "EBX", - "cpuid-input-ecx": 0, - "cpuid-input-eax": 7, - "features": 0 - }, - { - "cpuid-register": "ECX", - "cpuid-input-eax": 1, - "features": 2545558051 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 1, - "features": 126614525 - } - ], - "id": "libvirt-6" -} diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data b/t= ests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data deleted file mode 100644 index a4c503e201..0000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.data +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.json b/t= ests/qemumonitorjsondata/qemumonitorjson-getcpu-host.json deleted file mode 100644 index b5fb9f3778..0000000000 --- a/tests/qemumonitorjsondata/qemumonitorjson-getcpu-host.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "return": [ - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483658, - "features": 0 - }, - { - "cpuid-register": "EAX", - "cpuid-input-eax": 1073741825, - "features": 16777339 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 3221225473, - "features": 0 - }, - { - "cpuid-register": "ECX", - "cpuid-input-eax": 2147483649, - "features": 1 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 2147483649, - "features": 697564159 - }, - { - "cpuid-register": "EBX", - "cpuid-input-ecx": 0, - "cpuid-input-eax": 7, - "features": 2 - }, - { - "cpuid-register": "ECX", - "cpuid-input-eax": 1, - "features": 2545558051 - }, - { - "cpuid-register": "EDX", - "cpuid-input-eax": 1, - "features": 260832255 - } - ] -} diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 65b14ca318..7d128b6876 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -30,7 +30,6 @@ #include "qemu/qemu_alias.h" #include "qemu/qemu_chardev.h" #include "virerror.h" -#include "cpu/cpu.h" #include "qemu/qemu_monitor.h" #include "qemu/qemu_migration_params.h" #define LIBVIRT_QEMU_MIGRATION_PARAMSPRIV_H_ALLOW @@ -2109,108 +2108,6 @@ testQemuMonitorJSONqemuMonitorJSONGetDumpGuestMemor= yCapability(const void *opaqu return 0; } =20 -struct testCPUData { - const char *name; - virDomainXMLOption *xmlopt; - GHashTable *schema; -}; - - -static int -testQemuMonitorJSONGetCPUData(const void *opaque) -{ - const struct testCPUData *data =3D opaque; - g_autoptr(virCPUData) cpuData =3D NULL; - g_autofree char *jsonFile =3D NULL; - g_autofree char *dataFile =3D NULL; - g_autofree char *jsonStr =3D NULL; - g_autofree char *actual =3D NULL; - g_autoptr(qemuMonitorTest) test =3D NULL; - - if (!(test =3D qemuMonitorTestNewSchema(data->xmlopt, data->schema))) - return -1; - - jsonFile =3D g_strdup_printf("%s/qemumonitorjsondata/qemumonitorjson-g= etcpu-%s.json", - abs_srcdir, data->name); - dataFile =3D g_strdup_printf("%s/qemumonitorjsondata/qemumonitorjson-g= etcpu-%s.data", - abs_srcdir, data->name); - - if (virTestLoadFile(jsonFile, &jsonStr) < 0) - return -1; - - if (qemuMonitorTestAddItem(test, "qom-list", - "{" - " \"return\": [" - " {" - " \"name\": \"filtered-features\= "," - " \"type\": \"X86CPUFeatureWordI= nfo\"" - " }," - " {" - " \"name\": \"feature-words\"," - " \"type\": \"X86CPUFeatureWordI= nfo\"" - " }" - " ]," - " \"id\": \"libvirt-19\"" - "}") < 0) - return -1; - - if (qemuMonitorTestAddItem(test, "qom-get", jsonStr) < 0) - return -1; - - if (qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test), - "dummy", - &cpuData, NULL) < 0) - return -1; - - if (!(actual =3D virCPUDataFormat(cpuData))) - return -1; - - if (virTestCompareToFile(actual, dataFile) < 0) - return -1; - - return 0; -} - -static int -testQemuMonitorJSONGetNonExistingCPUData(const void *opaque) -{ - const testGenericData *data =3D opaque; - virDomainXMLOption *xmlopt =3D data->xmlopt; - g_autoptr(virCPUData) cpuData =3D NULL; - int rv; - g_autoptr(qemuMonitorTest) test =3D NULL; - - if (!(test =3D qemuMonitorTestNewSchema(xmlopt, data->schema))) - return -1; - - if (qemuMonitorTestAddItem(test, "qom-list", - "{" - " \"id\": \"libvirt-7\"," - " \"error\": {" - " \"class\": \"CommandNotFound\"," - " \"desc\": \"The command qom-list h= as not been found\"" - " }" - "}") < 0) - return -1; - - rv =3D qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test), - "dummy", - &cpuData, NULL); - if (rv !=3D -2) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "Unexpected return value %d, expecting -2", rv); - return -1; - } - - if (cpuData) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "Unexpected allocation of data =3D %p, expecting NU= LL", - cpuData); - return -1; - } - - return 0; -} =20 static int testQemuMonitorJSONGetIOThreads(const void *opaque) @@ -2924,14 +2821,6 @@ mymain(void) #define DO_TEST_GEN_DEPRECATED(name, removed, ...) \ DO_TEST_GEN_FULL(name, true, removed, __VA_ARGS__) =20 -#define DO_TEST_CPU_DATA(name) \ - do { \ - struct testCPUData data =3D { name, driver.xmlopt, qapiData.schema= }; \ - const char *label =3D "GetCPUData(" name ")"; \ - if (virTestRun(label, testQemuMonitorJSONGetCPUData, &data) < 0) \ - ret =3D -1; \ - } while (0) - #define DO_TEST_CPU_INFO(name, maxvcpus) \ do { \ struct testCPUInfoData data =3D {name, maxvcpus, driver.xmlopt, \ @@ -2953,7 +2842,6 @@ mymain(void) DO_TEST(SetObjectProperty); DO_TEST(GetDeviceAliases); DO_TEST(CPU); - DO_TEST(GetNonExistingCPUData); DO_TEST(GetIOThreads); DO_TEST(GetSEVInfo); DO_TEST(Transaction); @@ -3015,10 +2903,6 @@ mymain(void) DO_TEST(qemuMonitorJSONSnapshot); DO_TEST(qemuMonitorJSONBlockdevSetActive); =20 - DO_TEST_CPU_DATA("host"); - DO_TEST_CPU_DATA("full"); - DO_TEST_CPU_DATA("ecx"); - DO_TEST_CPU_INFO("x86-basic-pluggable", 8); DO_TEST_CPU_INFO("x86-full", 11); DO_TEST_CPU_INFO("x86-node-full", 8); --=20 2.51.0