From nobody Mon Feb 9 16:53:52 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 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=1677664506; cv=none; d=zohomail.com; s=zohoarc; b=cIWrG9yo6qXSNy54hRae+eUy/nDu7Le8VhlZoaG5rnf/H3aLD0o8dHpqymm+u9DWs3xtEKjAvUYzFqDGEx94fuSMZwP0phfYdgm4uIY/dAWFZjWStU64kVW9NSYyVaGcVLVnNxHarR9kM1CzoDfTgCNDXiMZuZ38nxSY/6pGjfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677664506; 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=AZOd6Fmjx9qKCISUl5oLJYLzSI9V6yiboHeZZDNyvu4=; b=DUrmHnYKE8ii9mBLwAU/vVCQa3/8gX5mO0RVRgUIjDKb4tpdgTnkuVbj7AZ/Z3SyYSZG3GKq6pGw2axLCvpQN1Z+FtPOTMuLt1sj9wBcP9ro6kMLBRDn3WA7BrWL2gZmU0M+V7aJSUYA2UeBc7El83KIbibALsWvoQuL+so+G0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1677664506332685.905895719756; Wed, 1 Mar 2023 01:55:06 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-424-2oIH4WtwMK-I4rUt0DJTyw-1; Wed, 01 Mar 2023 04:54:36 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 33DFD857F40; Wed, 1 Mar 2023 09:54:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 08EE040C6EC4; Wed, 1 Mar 2023 09:54:34 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id AFF7719472DA; Wed, 1 Mar 2023 09:54:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E07819465BC for ; Wed, 1 Mar 2023 09:54:18 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 23EC6112131B; Wed, 1 Mar 2023 09:54:18 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.7]) by smtp.corp.redhat.com (Postfix) with ESMTP id A30421121315 for ; Wed, 1 Mar 2023 09:54:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677664505; 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=AZOd6Fmjx9qKCISUl5oLJYLzSI9V6yiboHeZZDNyvu4=; b=Yva69QXIFOieed/3Fp7oail5eqvqz5jWfs0Qxja7ozn0kfAd7RcO97T0sAfV+Uz/CtRAVq +HxrNo9r+leostyEizpeBWMRWlfYLMa0NPLq1HyQlob1RvRl1/Mf8VlcOwO+MMnrX6b4DN hnN4Vc8d0AJGmZqmxsU8Y6pWc+Pjbho= X-MC-Unique: 2oIH4WtwMK-I4rUt0DJTyw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH RFCv2 2/5] qemu: capabilities: Extract whether machine type supports ACPI Date: Wed, 1 Mar 2023 10:54:11 +0100 Message-Id: <4f15ca742f3062c86d16f6d6d3b7cc45ee0b2760.1677664363.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677664506653100003 Content-Type: text/plain; charset="utf-8" The return data from 'query-machines' now contains an 'acpi' field. If the field is present we can use it to decide how to handle user's setting of '' domain feature. Add logic to extract the 'acpi' field and store it in machine type list along with other properties. --- src/qemu/qemu_capabilities.c | 19 ++++++++++++++++--- src/qemu/qemu_capspriv.h | 3 ++- src/qemu/qemu_monitor.h | 1 + src/qemu/qemu_monitor_json.c | 12 ++++++++++++ tests/testutilsqemu.c | 9 ++++++--- 5 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index ce0748ad6d..b387988b26 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -704,6 +704,7 @@ struct _virQEMUCapsMachineType { bool numaMemSupported; char *defaultRAMid; bool deprecated; + virTristateBool acpi; }; typedef struct _virQEMUCapsHostCPUData virQEMUCapsHostCPUData; @@ -1966,6 +1967,7 @@ virQEMUCapsAccelCopyMachineTypes(virQEMUCapsAccel *ds= t, dst->machineTypes[i].numaMemSupported =3D src->machineTypes[i].num= aMemSupported; dst->machineTypes[i].defaultRAMid =3D g_strdup(src->machineTypes[i= ].defaultRAMid); dst->machineTypes[i].deprecated =3D src->machineTypes[i].deprecate= d; + dst->machineTypes[i].acpi =3D src->machineTypes[i].acpi; } } @@ -2785,7 +2787,8 @@ virQEMUCapsAddMachine(virQEMUCaps *qemuCaps, bool isDefault, bool numaMemSupported, const char *defaultRAMid, - bool deprecated) + bool deprecated, + virTristateBool acpi) { virQEMUCapsAccel *accel =3D virQEMUCapsGetAccel(qemuCaps, virtType); virQEMUCapsMachineType *mach; @@ -2809,6 +2812,7 @@ virQEMUCapsAddMachine(virQEMUCaps *qemuCaps, mach->defaultRAMid =3D g_strdup(defaultRAMid); mach->deprecated =3D deprecated; + mach->acpi =3D acpi; } /** @@ -2859,7 +2863,8 @@ virQEMUCapsProbeQMPMachineTypes(virQEMUCaps *qemuCaps, machines[i]->isDefault, machines[i]->numaMemSupported, machines[i]->defaultRAMid, - machines[i]->deprecated); + machines[i]->deprecated, + machines[i]->acpi); if (preferredMachine && (STREQ_NULLABLE(machines[i]->alias, preferredMachine) || @@ -4216,6 +4221,9 @@ virQEMUCapsLoadMachines(virQEMUCapsAccel *caps, return -1; virTristateBoolToBool(tmp, &caps->machineTypes[i].deprecated); + + if (virXMLPropTristateBool(nodes[i], "acpi", VIR_XML_PROP_NONE, &c= aps->machineTypes[i].acpi) < 0) + return -1; } return 0; @@ -4909,6 +4917,11 @@ virQEMUCapsFormatMachines(virQEMUCapsAccel *caps, caps->machineTypes[i].defaultRAMid); if (caps->machineTypes[i].deprecated) virBufferAddLit(buf, " deprecated=3D'yes'"); + + if (caps->machineTypes[i].acpi !=3D VIR_TRISTATE_BOOL_ABSENT) + virBufferAsprintf(buf, " acpi=3D'%s'", + virTristateBoolTypeToString(caps->machineTyp= es[i].acpi)); + virBufferAddLit(buf, "/>\n"); } } @@ -6945,7 +6958,7 @@ virQEMUCapsStripMachineAliasesForVirtType(virQEMUCaps= *qemuCaps, virQEMUCapsAddMachine(qemuCaps, virtType, name, NULL, mach->de= faultCPU, mach->maxCpus, mach->hotplugCpus, mach->= qemuDefault, mach->numaMemSupported, mach->defaultRAM= id, - mach->deprecated); + mach->deprecated, mach->acpi); } } } diff --git a/src/qemu/qemu_capspriv.h b/src/qemu/qemu_capspriv.h index 87368536ea..720435f762 100644 --- a/src/qemu/qemu_capspriv.h +++ b/src/qemu/qemu_capspriv.h @@ -117,4 +117,5 @@ virQEMUCapsAddMachine(virQEMUCaps *qemuCaps, bool isDefault, bool numaMemSupported, const char *defaultRAMid, - bool deprecated); + bool deprecated, + virTristateBool acpi); diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 2fa06b99a3..72db0c0838 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1082,6 +1082,7 @@ struct _qemuMonitorMachineInfo { bool numaMemSupported; char *defaultRAMid; bool deprecated; + virTristateBool acpi; }; int qemuMonitorGetMachines(qemuMonitor *mon, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index d76fea8b00..583c7ed9a7 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -4822,6 +4822,18 @@ int qemuMonitorJSONGetMachines(qemuMonitor *mon, if (virJSONValueObjectHasKey(child, "deprecated") && virJSONValueObjectGetBoolean(child, "deprecated", &info->depre= cated) < 0) goto cleanup; + + if (virJSONValueObjectHasKey(child, "acpi")) { + bool acpi; + + if (virJSONValueObjectGetBoolean(child, "acpi", &acpi) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("qemu-machines reply has malformed 'acpi = data")); + goto cleanup; + } + + info->acpi =3D virTristateBoolFromBool(acpi); + } } ret =3D n; diff --git a/tests/testutilsqemu.c b/tests/testutilsqemu.c index 396803c40b..e47e93e8a6 100644 --- a/tests/testutilsqemu.c +++ b/tests/testutilsqemu.c @@ -458,7 +458,8 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, false, true, defaultRAMid, - false); + false, + VIR_TRISTATE_BOOL_ABSENT); virQEMUCapsSet(caps, QEMU_CAPS_TCG); } @@ -475,7 +476,8 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, false, true, defaultRAMid, - false); + false, + VIR_TRISTATE_BOOL_ABSENT); virQEMUCapsSet(caps, QEMU_CAPS_KVM); } } @@ -494,7 +496,8 @@ qemuTestCapsPopulateFakeMachines(virQEMUCaps *caps, false, true, defaultRAMid, - false); + false, + VIR_TRISTATE_BOOL_ABSENT); virQEMUCapsSet(caps, QEMU_CAPS_HVF); } } --=20 2.39.2