From nobody Fri Nov 7 02:19:10 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1545652457783785.3176315814273; Mon, 24 Dec 2018 03:54:17 -0800 (PST) Received: from localhost ([127.0.0.1]:36512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbOoE-0004M1-A1 for importer@patchew.org; Mon, 24 Dec 2018 06:54:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45910) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gbOms-0002xw-Ua for qemu-devel@nongnu.org; Mon, 24 Dec 2018 06:52:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gbOmn-0001VC-O7 for qemu-devel@nongnu.org; Mon, 24 Dec 2018 06:52:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54978) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gbOmn-0001TX-GN for qemu-devel@nongnu.org; Mon, 24 Dec 2018 06:52:41 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0ED0881DF3; Mon, 24 Dec 2018 11:52:40 +0000 (UTC) Received: from virtlab501.virt.lab.eng.bos.redhat.com (virtlab501.virt.lab.eng.bos.redhat.com [10.19.152.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7AA415D965; Mon, 24 Dec 2018 11:52:39 +0000 (UTC) From: Wainer dos Santos Moschetta To: qemu-devel@nongnu.org Date: Mon, 24 Dec 2018 06:52:35 -0500 Message-Id: <20181224115235.16881-2-wainersm@redhat.com> In-Reply-To: <20181224115235.16881-1-wainersm@redhat.com> References: <20181224115235.16881-1-wainersm@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 24 Dec 2018 11:52:40 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [RFC PATCH 1/1] hw/core: add qom getter for kernel-irqchip property X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peterx@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" Allows to access the kernel-irqchip property of a Machine Class object via QOM get method. Before this patch the property cannot be read although it is listed by qom-list: qemu-system-x86_64 -M q35,accel=3Dkvm,kernel-irqchip=3Dsplit (...) -> {"execute": "qom-list", "arguments": {"path": "/machine"}} <- {"return": [{"name": "type", "type": "string"}, (...) , {"name": "kernel= -irqchip", "type": "on|off|split"} (...)} -> {"execute": "qom-get", "arguments": {"path": "/machine", "property": "ke= rnel-irqchip"}} <- {"error": {"class": "GenericError", "desc": "Insufficient permission to = perform this operation"}} It is implemented the machine_get_kernel_irqchip() method, which evaluates the kernel_irqchip_allowed, *_required, and *_split fields to determine the value of kernel-irqchip. Note: we assume there is not inconsistency on the value of those fields. Then with this change in place, it works as expected: qemu-system-x86_64 -M q35,accel=3Dkvm,kernel-irqchip=3Dsplit (...) -> {"execute": "qom-get", "arguments": {"path": "/machine", "property": "ke= rnel-irqchip"}} <- {"return": "split"} Signed-off-by: Wainer dos Santos Moschetta --- hw/core/machine.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/hw/core/machine.c b/hw/core/machine.c index c51423b647..f61003f8f2 100644 --- a/hw/core/machine.c +++ b/hw/core/machine.c @@ -37,6 +37,21 @@ static void machine_set_accel(Object *obj, const char *v= alue, Error **errp) ms->accel =3D g_strdup(value); } =20 +static void machine_get_kernel_irqchip(Object *obj, Visitor *v, + const char *name, void *opaque, + Error **errp) +{ + MachineState *ms =3D MACHINE(obj); + OnOffSplit mode; + + if (ms->kernel_irqchip_split) { + mode =3D ON_OFF_SPLIT_SPLIT; + } else { + mode =3D (ms->kernel_irqchip_allowed && ms->kernel_irqchip_require= d) ? + ON_OFF_SPLIT_ON : ON_OFF_SPLIT_OFF; + } + visit_type_OnOffSplit(v, name, &mode, errp); +} static void machine_set_kernel_irqchip(Object *obj, Visitor *v, const char *name, void *opaque, Error **errp) @@ -540,7 +555,7 @@ static void machine_class_init(ObjectClass *oc, void *d= ata) "Accelerator list", &error_abort); =20 object_class_property_add(oc, "kernel-irqchip", "on|off|split", - NULL, machine_set_kernel_irqchip, + machine_get_kernel_irqchip, machine_set_kernel_irqchip, NULL, NULL, &error_abort); object_class_property_set_description(oc, "kernel-irqchip", "Configure KVM in-kernel irqchip", &error_abort); --=20 2.19.2