From nobody Sun Feb 8 15:53:36 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 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=1572960613; cv=none; d=zoho.com; s=zohoarc; b=HmFfAPjUip9bTFxI5uoiRgs3jJGIZwhRuQzh0VtV6piT/KYDdx9Vpkc4XLhkupSlYkQBfzEI8dgn1rkL/bS92hLzrnwCDrLRBy5pOhGGh5DzYYHf/Sbga/7LF3jPSx87DqnXtlcqRJ9DT5+MejN6M4gU1Q4NbuiXMEHXe1IAccQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572960613; 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; bh=HQOK3yB8u2KvQ7M5b7I8zP6Eg2ZhAvczgwDtwygXWKM=; b=RanmYaaRcif+7mpd5Ojs4D05oizp6rSCwB6IPuzECIwcIu7A46plMP/aeoR5O/oiTXf2OfDkcEMDW4OXrcQnlFif6aYmsA0elZ2gqRH4ISU2q5wGkOrrS3cAiiXP6VbGsrEBUyPWxfwYizm0rNOYSWP4L2QkgwMDNBFwrt5m0SE= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1572960613683948.0153243258899; Tue, 5 Nov 2019 05:30:13 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-393-WfpeZj3TP-akZBD2BO64cg-1; Tue, 05 Nov 2019 08:29:03 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B71A180B72D; Tue, 5 Nov 2019 13:28:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 82157600C8; Tue, 5 Nov 2019 13:28:56 +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 338174E9EB; Tue, 5 Nov 2019 13:28:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA5DS490004143 for ; Tue, 5 Nov 2019 08:28:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 475E627065; Tue, 5 Nov 2019 13:28:04 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.188]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9FF4B27066 for ; Tue, 5 Nov 2019 13:28:02 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 50ADA105D85; Tue, 5 Nov 2019 14:27:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1572960612; h=from:from:sender:sender: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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=HQOK3yB8u2KvQ7M5b7I8zP6Eg2ZhAvczgwDtwygXWKM=; b=extq6AM7Kfls2hKVewL8fribH6A+cmyqrKliAPNK87CH24j6flx+VqX/WHcn6hYe+qEZtK JRjYcrqXWt9CcUuVUqrFyD5VwpbzEoAmDmNjaQrgRa6cujeXgkBnyz3oa+5G+hycrwQhgA 83nWg5zf2mpPPutHck6VBAmEOIgoRXQ= From: Jiri Denemark To: libvir-list@redhat.com Date: Tue, 5 Nov 2019 14:27:41 +0100 Message-Id: <441e64a07b7563423427ba3d14810c9729afdcce.1572958255.git.jdenemar@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 43/52] qemu: Probe for default CPU types 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-MC-Unique: WfpeZj3TP-akZBD2BO64cg-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" QEMU 4.2.0 will report default CPU types used by each machine type and we will want to start using it. Signed-off-by: Jiri Denemark Reviewed-by: J=C3=A1n Tomko --- Notes: Version 2: - no change except for updated test results =20 Version 3: - TCG and KVM are probed separately now src/qemu/qemu_capabilities.c | 8 + src/qemu/qemu_monitor.c | 1 + src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 12 ++ .../caps_4.2.0.aarch64.xml | 188 +++++++++--------- .../qemucapabilitiesdata/caps_4.2.0.ppc64.xml | 116 +++++------ .../qemucapabilitiesdata/caps_4.2.0.s390x.xml | 56 +++--- .../caps_4.2.0.x86_64.xml | 184 ++++++++--------- 8 files changed, 294 insertions(+), 272 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 1dedcbe5ad..dc2723d025 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -558,6 +558,7 @@ struct _virQEMUCapsMachineType { unsigned int maxCpus; bool hotplugCpus; bool qemuDefault; + char *defaultCPU; }; =20 typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData; @@ -1708,6 +1709,7 @@ virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccelPtr = dst, for (i =3D 0; i < src->nmachineTypes; i++) { dst->machineTypes[i].name =3D g_strdup(src->machineTypes[i].name); dst->machineTypes[i].alias =3D g_strdup(src->machineTypes[i].alias= ); + dst->machineTypes[i].defaultCPU =3D g_strdup(src->machineTypes[i].= defaultCPU); dst->machineTypes[i].maxCpus =3D src->machineTypes[i].maxCpus; dst->machineTypes[i].hotplugCpus =3D src->machineTypes[i].hotplugC= pus; dst->machineTypes[i].qemuDefault =3D src->machineTypes[i].qemuDefa= ult; @@ -1787,6 +1789,7 @@ virQEMUCapsAccelClear(virQEMUCapsAccelPtr caps) for (i =3D 0; i < caps->nmachineTypes; i++) { VIR_FREE(caps->machineTypes[i].name); VIR_FREE(caps->machineTypes[i].alias); + VIR_FREE(caps->machineTypes[i].defaultCPU); } VIR_FREE(caps->machineTypes); =20 @@ -2424,6 +2427,7 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCapsPtr qemuCa= ps, =20 mach->alias =3D g_strdup(machines[i]->alias); mach->name =3D g_strdup(machines[i]->name); + mach->defaultCPU =3D g_strdup(machines[i]->defaultCPU); =20 mach->maxCpus =3D machines[i]->maxCpus; mach->hotplugCpus =3D machines[i]->hotplugCpus; @@ -3642,6 +3646,8 @@ virQEMUCapsLoadMachines(virQEMUCapsAccelPtr caps, if (STREQ_NULLABLE(str, "yes")) caps->machineTypes[i].qemuDefault =3D true; VIR_FREE(str); + + caps->machineTypes[i].defaultCPU =3D virXMLPropString(nodes[i], "d= efaultCPU"); } =20 return 0; @@ -4082,6 +4088,8 @@ virQEMUCapsFormatMachines(virQEMUCapsAccelPtr caps, caps->machineTypes[i].maxCpus); if (caps->machineTypes[i].qemuDefault) virBufferAddLit(buf, " default=3D'yes'"); + virBufferEscapeString(buf, " defaultCPU=3D'%s'", + caps->machineTypes[i].defaultCPU); virBufferAddLit(buf, "/>\n"); } } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a1cdb19318..1f07b2aeae 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3547,6 +3547,7 @@ qemuMonitorMachineInfoFree(qemuMonitorMachineInfoPtr = machine) return; VIR_FREE(machine->name); VIR_FREE(machine->alias); + VIR_FREE(machine->defaultCPU); VIR_FREE(machine); } =20 diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 824b580344..912ff15738 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1096,6 +1096,7 @@ struct _qemuMonitorMachineInfo { char *alias; unsigned int maxCpus; bool hotplugCpus; + char *defaultCPU; }; =20 int qemuMonitorGetMachines(qemuMonitorPtr mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 3f3bfc1720..1680e3a5fe 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -5555,6 +5555,18 @@ int qemuMonitorJSONGetMachines(qemuMonitorPtr mon, =20 ignore_value(virJSONValueObjectGetBoolean(child, "hotpluggable-cpu= s", &info->hotplugCpus)); + + if (virJSONValueObjectHasKey(child, "default-cpu-type")) { + if (!(tmp =3D virJSONValueObjectGetString(child, "default-cpu-= type"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("query-machines reply has malformed " + "'default-cpu-type' data")); + goto cleanup; + } + + if (VIR_STRDUP(info->defaultCPU, tmp) < 0) + goto cleanup; + } } =20 ret =3D n; diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemu= capabilitiesdata/caps_4.2.0.aarch64.xml index 9a5bea3819..0acb9f9d66 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -209,76 +209,76 @@ - + - - - - + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + - + - - - + + + - + - - - - - - + + + + + + - + - - - - + + + + - + - + - + @@ -316,76 +316,76 @@ - + - - - - + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - + + + - - - - - - + + + + + + - + - - - + + + - + - - - - - - + + + + + + - + - - - - + + + + - + - + - + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.ppc64.xml index eca48b59d9..998e16ec6d 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.ppc64.xml @@ -616,37 +616,37 @@ - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + @@ -1084,35 +1084,35 @@ - + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemuca= pabilitiesdata/caps_4.2.0.s390x.xml index b291deab44..902672bf71 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -371,20 +371,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -3342,18 +3342,18 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_4.2.0.x86_64.xml index 39b9db63fd..465db243eb 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -841,52 +841,52 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1950,50 +1950,50 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list