From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: qemu-devel@nongnu.org
Cc: ehabkost@redhat.com, marcel.apfelbaum@gmail.com, peterx@redhat.com
Subject: [Qemu-devel] [RFC PATCH 1/1] hw/core: add qom getter for kernel-irqchip property
Date: Mon, 24 Dec 2018 06:52:35 -0500 [thread overview]
Message-ID: <20181224115235.16881-2-wainersm@redhat.com> (raw)
In-Reply-To: <20181224115235.16881-1-wainersm@redhat.com>
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=kvm,kernel-irqchip=split (...)
-> {"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": "kernel-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=kvm,kernel-irqchip=split (...)
-> {"execute": "qom-get", "arguments": {"path": "/machine", "property": "kernel-irqchip"}}
<- {"return": "split"}
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
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 *value, Error **errp)
ms->accel = g_strdup(value);
}
+static void machine_get_kernel_irqchip(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ MachineState *ms = MACHINE(obj);
+ OnOffSplit mode;
+
+ if (ms->kernel_irqchip_split) {
+ mode = ON_OFF_SPLIT_SPLIT;
+ } else {
+ mode = (ms->kernel_irqchip_allowed && ms->kernel_irqchip_required) ?
+ 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 *data)
"Accelerator list", &error_abort);
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);
--
2.19.2
next prev parent reply other threads:[~2018-12-24 11:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-24 11:52 [Qemu-devel] [RFC PATCH 0/1] qom-get access to kernel-irqchip property Wainer dos Santos Moschetta
2018-12-24 11:52 ` Wainer dos Santos Moschetta [this message]
2018-12-25 5:20 ` [Qemu-devel] [RFC PATCH 1/1] hw/core: add qom getter for " Peter Xu
2018-12-27 20:33 ` Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181224115235.16881-2-wainersm@redhat.com \
--to=wainersm@redhat.com \
--cc=ehabkost@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).