From nobody Sun Feb 8 12:42:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560937336; cv=none; d=zoho.com; s=zohoarc; b=PpAPDWqe/f+ZZ5LZQ0tijhxnzc/J8+RRjSJM/crlAtK5YeWkg2ezUp41aaPzCsSJOmJnA2+pIGs6DIlcCjcHiIQt2e1a4eTFHqHjwA4CcZD4NEQe6Cyiz4e0UEN/lxivuJXGFzr0R57wOw1zufNrfn7e/SBu36IsBUjnmSEYDB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560937336; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=IiTVpXmuTLaOfl8kd/CU4HQqe+7zySeYfZ5Y542mUC4=; b=KSjfWpgUbYT/iRwTVvIhvnBS8tFFpjgfVFVw3eZtHWc04Ufw6QiNtoga5TEa2Hq/KvIDN8OFbQ6N1Z69dLU5/GWaqIeiE+qfs6eTWGD+XiW1xhaEbXaJf4Z6TN3mqlhZhiHdbkG+KIss8Hu/zalDv91kXBjesEauf7YKZ8aLNuw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560937336308566.822245130919; Wed, 19 Jun 2019 02:42:16 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 34B5C8B288; Wed, 19 Jun 2019 09:42:14 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F36BC10190AD; Wed, 19 Jun 2019 09:42:13 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B39EC1806B1C; Wed, 19 Jun 2019 09:42:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5J9cV61024377 for ; Wed, 19 Jun 2019 05:38:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FF025C225; Wed, 19 Jun 2019 09:38:31 +0000 (UTC) Received: from orkuz.int.mamuti.net (ovpn-204-21.brq.redhat.com [10.40.204.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A8EA5C207 for ; Wed, 19 Jun 2019 09:38:31 +0000 (UTC) Received: by orkuz.int.mamuti.net (Postfix, from userid 500) id B41212A4126; Wed, 19 Jun 2019 11:38:23 +0200 (CEST) From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 19 Jun 2019 11:38:15 +0200 Message-Id: <21f503fab5f58f2e57930d7c8b29e0780dafdaf8.1560936842.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 18/24] qemu: Make qemuMonitorGetGuestCPU usable on x86 only X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 19 Jun 2019 09:42:14 +0000 (UTC) Content-Type: text/plain; charset="utf-8" It was never implemented or used for anything else anyway. Mainly because it uses CPUID features bits. The function is renamed as qemuMonitorGetGuestCPUx86 to make this explicit. Signed-off-by: Jiri Denemark --- src/qemu/qemu_monitor.c | 15 +++++------- src/qemu/qemu_monitor.h | 7 +++--- src/qemu/qemu_monitor_json.c | 47 +++++++++++++++--------------------- src/qemu/qemu_monitor_json.h | 7 +++--- src/qemu/qemu_process.c | 3 +-- tests/qemumonitorjsontest.c | 10 +++----- 6 files changed, 36 insertions(+), 53 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index d9d076633d..344aac09f0 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4080,9 +4080,8 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon, =20 =20 /** - * qemuMonitorJSONGetGuestCPU: + * qemuMonitorJSONGetGuestCPUx86: * @mon: Pointer to the monitor - * @arch: arch of the guest * @data: returns the cpu data * @disabled: returns the CPU data for features which were disabled by QEMU * @@ -4092,13 +4091,11 @@ qemuMonitorSetDomainLog(qemuMonitorPtr mon, * -1 on other errors. */ int -qemuMonitorGetGuestCPU(qemuMonitorPtr mon, - virArch arch, - virCPUDataPtr *data, - virCPUDataPtr *disabled) +qemuMonitorGetGuestCPUx86(qemuMonitorPtr mon, + virCPUDataPtr *data, + virCPUDataPtr *disabled) { - VIR_DEBUG("arch=3D%s data=3D%p disabled=3D%p", - virArchToString(arch), data, disabled); + VIR_DEBUG("data=3D%p disabled=3D%p", data, disabled); =20 QEMU_CHECK_MONITOR(mon); =20 @@ -4106,7 +4103,7 @@ qemuMonitorGetGuestCPU(qemuMonitorPtr mon, if (disabled) *disabled =3D NULL; =20 - return qemuMonitorJSONGetGuestCPU(mon, arch, data, disabled); + return qemuMonitorJSONGetGuestCPUx86(mon, data, disabled); } =20 =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index a19d6069c6..ac2499c22a 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1150,10 +1150,9 @@ void qemuMonitorSetDomainLog(qemuMonitorPtr mon, void *opaque, virFreeCallback destroy); =20 -int qemuMonitorGetGuestCPU(qemuMonitorPtr mon, - virArch arch, - virCPUDataPtr *data, - virCPUDataPtr *disabled); +int qemuMonitorGetGuestCPUx86(qemuMonitorPtr mon, + virCPUDataPtr *data, + virCPUDataPtr *disabled); =20 int qemuMonitorRTCResetReinjection(qemuMonitorPtr mon); =20 diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 2dcd65d86f..ffa1fb5d57 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -7319,9 +7319,8 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon) =20 =20 /** - * qemuMonitorJSONGetGuestCPU: + * qemuMonitorJSONGetGuestCPUx86: * @mon: Pointer to the monitor - * @arch: arch of the guest * @data: returns the cpu data of the guest * @disabled: returns the CPU data for features which were disabled by QEMU * @@ -7331,40 +7330,32 @@ qemuMonitorJSONCheckCPUx86(qemuMonitorPtr mon) * -1 on other errors. */ int -qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon, - virArch arch, - virCPUDataPtr *data, - virCPUDataPtr *disabled) +qemuMonitorJSONGetGuestCPUx86(qemuMonitorPtr mon, + virCPUDataPtr *data, + virCPUDataPtr *disabled) { virCPUDataPtr cpuEnabled =3D NULL; virCPUDataPtr cpuDisabled =3D NULL; int rc; =20 - if (ARCH_IS_X86(arch)) { - if ((rc =3D qemuMonitorJSONCheckCPUx86(mon)) < 0) - return -1; - else if (!rc) - return -2; + if ((rc =3D qemuMonitorJSONCheckCPUx86(mon)) < 0) + return -1; + else if (!rc) + return -2; =20 - if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words", - &cpuEnabled) < 0) - goto error; + if (qemuMonitorJSONGetCPUx86Data(mon, "feature-words", + &cpuEnabled) < 0) + goto error; =20 - if (disabled && - qemuMonitorJSONGetCPUx86Data(mon, "filtered-features", - &cpuDisabled) < 0) - goto error; + if (disabled && + qemuMonitorJSONGetCPUx86Data(mon, "filtered-features", + &cpuDisabled) < 0) + goto error; =20 - *data =3D cpuEnabled; - if (disabled) - *disabled =3D cpuDisabled; - return 0; - } - - virReportError(VIR_ERR_INTERNAL_ERROR, - _("CPU definition retrieval isn't supported for '%s'"), - virArchToString(arch)); - return -1; + *data =3D cpuEnabled; + if (disabled) + *disabled =3D cpuDisabled; + return 0; =20 error: virCPUDataFree(cpuEnabled); diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 2a881fbddd..424861b531 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -489,10 +489,9 @@ int qemuMonitorJSONGetCPUx86Data(qemuMonitorPtr mon, const char *property, virCPUDataPtr *cpudata); =20 -int qemuMonitorJSONGetGuestCPU(qemuMonitorPtr mon, - virArch arch, - virCPUDataPtr *data, - virCPUDataPtr *disabled); +int qemuMonitorJSONGetGuestCPUx86(qemuMonitorPtr mon, + virCPUDataPtr *data, + virCPUDataPtr *disabled); =20 int qemuMonitorJSONRTCResetReinjection(qemuMonitorPtr mon); =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 47e84e5ef0..db940b02a8 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4149,8 +4149,7 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0) goto error; =20 - rc =3D qemuMonitorGetGuestCPU(priv->mon, vm->def->os.arch, - &dataEnabled, &dataDisabled); + rc =3D qemuMonitorGetGuestCPUx86(priv->mon, &dataEnabled, &dataDisable= d); =20 if (qemuDomainObjExitMonitor(driver, vm) < 0) goto error; diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index e087d1c256..2ed9133c06 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2487,9 +2487,8 @@ testQemuMonitorJSONGetCPUData(const void *opaque) if (qemuMonitorTestAddItem(test, "qom-get", jsonStr) < 0) goto cleanup; =20 - if (qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test), - VIR_ARCH_X86_64, - &cpuData, NULL) < 0) + if (qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test), + &cpuData, NULL) < 0) goto cleanup; =20 if (!(actual =3D virCPUDataFormat(cpuData))) @@ -2530,9 +2529,8 @@ testQemuMonitorJSONGetNonExistingCPUData(const void *= opaque) "}") < 0) goto cleanup; =20 - rv =3D qemuMonitorJSONGetGuestCPU(qemuMonitorTestGetMonitor(test), - VIR_ARCH_X86_64, - &cpuData, NULL); + rv =3D qemuMonitorJSONGetGuestCPUx86(qemuMonitorTestGetMonitor(test), + &cpuData, NULL); if (rv !=3D -2) { virReportError(VIR_ERR_INTERNAL_ERROR, "Unexpected return value %d, expecting -2", rv); --=20 2.22.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list