* [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-19 20:31 ` Andreas Färber
2019-06-20 8:31 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 02/17] Makefile: Don't add monitor/ twice to common-obj-y Markus Armbruster
` (15 subsequent siblings)
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: kwolf, Daniel P . Berrange, Eduardo Habkost, Paolo Bonzini,
Andreas Färber
From: Paolo Bonzini <pbonzini@redhat.com>
QOM is not a particularly active subsystem now: 51 commits in two years.
But, we need active maintainers to review and merge patches, and Git
shows the following top committers taking on QOM:
Markus Armbruster <armbru@redhat.com>
Eduardo Habkost <ehabkost@redhat.com>
Paolo Bonzini <pbonzini@redhat.com>
Marc-André Lureau <marcandre.lureau@redhat.com>
Eric Blake <eblake@redhat.com>
I volunteer myself, and also volunteer Eduardo and Daniel as reviewers
since they understand the code well.
Cc: Andreas Färber <afaerber@suse.de>
Cc: Daniel P. Berrange <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Suggested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-Id: <20190607113737.13473-1-pbonzini@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index d32c5c2313..63390eadb5 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2029,9 +2029,10 @@ F: docs/interop/qemu-ga-ref.texi
T: git https://github.com/mdroth/qemu.git qga
QOM
-M: Andreas Färber <afaerber@suse.de>
+M: Paolo Bonzini <pbonzini@redhat.com>
+R: Daniel P. Berrange <berrange@redhat.com>
+R: Eduardo Habkost <ehabkost@redhat.com>
S: Supported
-T: git https://github.com/afaerber/qemu-cpu.git qom-next
F: include/qom/
X: include/qom/cpu.h
F: qom/
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM
2019-06-19 20:10 ` [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM Markus Armbruster
@ 2019-06-19 20:31 ` Andreas Färber
2019-06-20 8:37 ` Paolo Bonzini
2019-06-24 11:07 ` Markus Armbruster
2019-06-20 8:31 ` Daniel P. Berrangé
1 sibling, 2 replies; 57+ messages in thread
From: Andreas Färber @ 2019-06-19 20:31 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: kwolf, Paolo Bonzini, Daniel P . Berrange, Eduardo Habkost
Am 19.06.19 um 22:10 schrieb Markus Armbruster:
> From: Paolo Bonzini <pbonzini@redhat.com>
>
> QOM is not a particularly active subsystem now: 51 commits in two years.
> But, we need active maintainers to review and merge patches, and Git
> shows the following top committers taking on QOM:
>
> Markus Armbruster <armbru@redhat.com>
> Eduardo Habkost <ehabkost@redhat.com>
> Paolo Bonzini <pbonzini@redhat.com>
> Marc-André Lureau <marcandre.lureau@redhat.com>
> Eric Blake <eblake@redhat.com>
>
> I volunteer myself, and also volunteer Eduardo and Daniel as reviewers
> since they understand the code well.
>
> Cc: Andreas Färber <afaerber@suse.de>
> Cc: Daniel P. Berrange <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-Id: <20190607113737.13473-1-pbonzini@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
I'm pretty sure I gave an Acked-by that's missing above?
Regards,
Andreas
--
SUSE Linux GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Felix Imendörffer, Mary Higgins, Sri Rasiah
HRB 21284 (AG Nürnberg)
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM
2019-06-19 20:31 ` Andreas Färber
@ 2019-06-20 8:37 ` Paolo Bonzini
2019-06-24 11:07 ` Markus Armbruster
1 sibling, 0 replies; 57+ messages in thread
From: Paolo Bonzini @ 2019-06-20 8:37 UTC (permalink / raw)
To: Andreas Färber, Markus Armbruster, qemu-devel
Cc: kwolf, Daniel P . Berrange, Eduardo Habkost
On 19/06/19 22:31, Andreas Färber wrote:
> Am 19.06.19 um 22:10 schrieb Markus Armbruster:
>> From: Paolo Bonzini <pbonzini@redhat.com>
>>
>> QOM is not a particularly active subsystem now: 51 commits in two years.
>> But, we need active maintainers to review and merge patches, and Git
>> shows the following top committers taking on QOM:
>>
>> Markus Armbruster <armbru@redhat.com>
>> Eduardo Habkost <ehabkost@redhat.com>
>> Paolo Bonzini <pbonzini@redhat.com>
>> Marc-André Lureau <marcandre.lureau@redhat.com>
>> Eric Blake <eblake@redhat.com>
>>
>> I volunteer myself, and also volunteer Eduardo and Daniel as reviewers
>> since they understand the code well.
>>
>> Cc: Andreas Färber <afaerber@suse.de>
>> Cc: Daniel P. Berrange <berrange@redhat.com>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> Suggested-by: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> Message-Id: <20190607113737.13473-1-pbonzini@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> I'm pretty sure I gave an Acked-by that's missing above?
Yes, and Markus even replied to it:
https://patchew.org/QEMU/20190607113737.13473-1-pbonzini@redhat.com/
Paolo
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM
2019-06-19 20:31 ` Andreas Färber
2019-06-20 8:37 ` Paolo Bonzini
@ 2019-06-24 11:07 ` Markus Armbruster
1 sibling, 0 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-24 11:07 UTC (permalink / raw)
To: Andreas Färber
Cc: kwolf, Paolo Bonzini, Daniel P . Berrange, qemu-devel, Eduardo Habkost
Andreas Färber <afaerber@suse.de> writes:
> Am 19.06.19 um 22:10 schrieb Markus Armbruster:
>> From: Paolo Bonzini <pbonzini@redhat.com>
>>
>> QOM is not a particularly active subsystem now: 51 commits in two years.
>> But, we need active maintainers to review and merge patches, and Git
>> shows the following top committers taking on QOM:
>>
>> Markus Armbruster <armbru@redhat.com>
>> Eduardo Habkost <ehabkost@redhat.com>
>> Paolo Bonzini <pbonzini@redhat.com>
>> Marc-André Lureau <marcandre.lureau@redhat.com>
>> Eric Blake <eblake@redhat.com>
>>
>> I volunteer myself, and also volunteer Eduardo and Daniel as reviewers
>> since they understand the code well.
>>
>> Cc: Andreas Färber <afaerber@suse.de>
>> Cc: Daniel P. Berrange <berrange@redhat.com>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> Suggested-by: Markus Armbruster <armbru@redhat.com>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> Message-Id: <20190607113737.13473-1-pbonzini@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>
> I'm pretty sure I gave an Acked-by that's missing above?
My fault. I'll make sure it's in v2 or else the pull request.
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM
2019-06-19 20:10 ` [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM Markus Armbruster
2019-06-19 20:31 ` Andreas Färber
@ 2019-06-20 8:31 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:31 UTC (permalink / raw)
To: Markus Armbruster
Cc: kwolf, Paolo Bonzini, qemu-devel, Andreas Färber, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:34PM +0200, Markus Armbruster wrote:
> From: Paolo Bonzini <pbonzini@redhat.com>
>
> QOM is not a particularly active subsystem now: 51 commits in two years.
> But, we need active maintainers to review and merge patches, and Git
> shows the following top committers taking on QOM:
>
> Markus Armbruster <armbru@redhat.com>
> Eduardo Habkost <ehabkost@redhat.com>
> Paolo Bonzini <pbonzini@redhat.com>
> Marc-André Lureau <marcandre.lureau@redhat.com>
> Eric Blake <eblake@redhat.com>
>
> I volunteer myself, and also volunteer Eduardo and Daniel as reviewers
> since they understand the code well.
>
> Cc: Andreas Färber <afaerber@suse.de>
> Cc: Daniel P. Berrange <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Suggested-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Message-Id: <20190607113737.13473-1-pbonzini@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 02/17] Makefile: Don't add monitor/ twice to common-obj-y
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
2019-06-19 20:10 ` [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:32 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/ Markus Armbruster
` (14 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
Both commit f1b3ccfaa68 "monitor: Move {hmp, qmp}.c to monitor/{hmp,
qmp}-cmds.c" and commit 7e3c0deab1b "monitor: Split out monitor/qmp.c"
added monitor/ to common-obj-y ifeq ($(CONFIG_SOFTMMU),y). Revert the
second addition.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
Makefile.objs | 1 -
1 file changed, 1 deletion(-)
diff --git a/Makefile.objs b/Makefile.objs
index 658cfc9d9f..7494d6143b 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -85,7 +85,6 @@ common-obj-$(CONFIG_FDT) += device_tree.o
# qapi
common-obj-y += qapi/
-common-obj-y += monitor/
endif
#######################################################################
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 02/17] Makefile: Don't add monitor/ twice to common-obj-y
2019-06-19 20:10 ` [Qemu-devel] [PATCH 02/17] Makefile: Don't add monitor/ twice to common-obj-y Markus Armbruster
@ 2019-06-20 8:32 ` Daniel P. Berrangé
0 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:32 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel
On Wed, Jun 19, 2019 at 10:10:35PM +0200, Markus Armbruster wrote:
> Both commit f1b3ccfaa68 "monitor: Move {hmp, qmp}.c to monitor/{hmp,
> qmp}-cmds.c" and commit 7e3c0deab1b "monitor: Split out monitor/qmp.c"
> added monitor/ to common-obj-y ifeq ($(CONFIG_SOFTMMU),y). Revert the
> second addition.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> Makefile.objs | 1 -
> 1 file changed, 1 deletion(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
2019-06-19 20:10 ` [Qemu-devel] [PATCH 01/17] MAINTAINERS: new maintainers for QOM Markus Armbruster
2019-06-19 20:10 ` [Qemu-devel] [PATCH 02/17] Makefile: Don't add monitor/ twice to common-obj-y Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:33 ` Daniel P. Berrangé
2019-06-20 9:48 ` Dr. David Alan Gilbert
2019-06-19 20:10 ` [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json Markus Armbruster
` (13 subsequent siblings)
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Dr. David Alan Gilbert
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hmp.h => include/monitor/hmp.h | 0
monitor/hmp-cmds.c | 2 +-
monitor/misc.c | 2 +-
target/i386/monitor.c | 2 +-
target/nios2/monitor.c | 2 +-
target/ppc/monitor.c | 2 +-
target/sh4/monitor.c | 2 +-
target/sparc/monitor.c | 2 +-
target/xtensa/monitor.c | 2 +-
9 files changed, 8 insertions(+), 8 deletions(-)
rename hmp.h => include/monitor/hmp.h (100%)
diff --git a/hmp.h b/include/monitor/hmp.h
similarity index 100%
rename from hmp.h
rename to include/monitor/hmp.h
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index c283dde0e9..5082fcd016 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -14,7 +14,7 @@
*/
#include "qemu/osdep.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
#include "net/net.h"
#include "net/eth.h"
#include "chardev/char.h"
diff --git a/monitor/misc.c b/monitor/misc.c
index bf9faceb86..2fb6896e84 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -56,13 +56,13 @@
#include "qom/object_interfaces.h"
#include "trace/control.h"
#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#ifdef CONFIG_TRACE_SIMPLE
#include "trace/simple.h"
#endif
#include "exec/memory.h"
#include "exec/exec-all.h"
#include "qemu/option.h"
-#include "hmp.h"
#include "qemu/thread.h"
#include "block/qapi.h"
#include "qapi/qapi-commands.h"
diff --git a/target/i386/monitor.c b/target/i386/monitor.c
index 56e2dbece7..1f3b532fc2 100644
--- a/target/i386/monitor.c
+++ b/target/i386/monitor.c
@@ -26,11 +26,11 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
+#include "monitor/hmp.h"
#include "qapi/qmp/qdict.h"
#include "hw/i386/pc.h"
#include "sysemu/kvm.h"
#include "sysemu/sev.h"
-#include "hmp.h"
#include "qapi/error.h"
#include "sev_i386.h"
#include "qapi/qapi-commands-misc.h"
diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c
index d5e3393716..6646836df5 100644
--- a/target/nios2/monitor.c
+++ b/target/nios2/monitor.c
@@ -25,7 +25,7 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
index 7f8360d903..a5a177d717 100644
--- a/target/ppc/monitor.c
+++ b/target/ppc/monitor.c
@@ -27,7 +27,7 @@
#include "monitor/monitor.h"
#include "qemu/ctype.h"
#include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
{
diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c
index 4c7f36c9cc..918a5ccfc6 100644
--- a/target/sh4/monitor.c
+++ b/target/sh4/monitor.c
@@ -25,7 +25,7 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
{
diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
index 3ec3b51a3d..a7ea287cbc 100644
--- a/target/sparc/monitor.c
+++ b/target/sparc/monitor.c
@@ -25,7 +25,7 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
index cf7957bb63..608173c238 100644
--- a/target/xtensa/monitor.c
+++ b/target/xtensa/monitor.c
@@ -25,7 +25,7 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "monitor/hmp-target.h"
-#include "hmp.h"
+#include "monitor/hmp.h"
void hmp_info_tlb(Monitor *mon, const QDict *qdict)
{
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/ Markus Armbruster
@ 2019-06-20 8:33 ` Daniel P. Berrangé
2019-06-20 9:48 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:33 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel, Dr. David Alan Gilbert
On Wed, Jun 19, 2019 at 10:10:36PM +0200, Markus Armbruster wrote:
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hmp.h => include/monitor/hmp.h | 0
> monitor/hmp-cmds.c | 2 +-
> monitor/misc.c | 2 +-
> target/i386/monitor.c | 2 +-
> target/nios2/monitor.c | 2 +-
> target/ppc/monitor.c | 2 +-
> target/sh4/monitor.c | 2 +-
> target/sparc/monitor.c | 2 +-
> target/xtensa/monitor.c | 2 +-
> 9 files changed, 8 insertions(+), 8 deletions(-)
> rename hmp.h => include/monitor/hmp.h (100%)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/ Markus Armbruster
2019-06-20 8:33 ` Daniel P. Berrangé
@ 2019-06-20 9:48 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 57+ messages in thread
From: Dr. David Alan Gilbert @ 2019-06-20 9:48 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel
* Markus Armbruster (armbru@redhat.com) wrote:
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hmp.h => include/monitor/hmp.h | 0
> monitor/hmp-cmds.c | 2 +-
> monitor/misc.c | 2 +-
> target/i386/monitor.c | 2 +-
> target/nios2/monitor.c | 2 +-
> target/ppc/monitor.c | 2 +-
> target/sh4/monitor.c | 2 +-
> target/sparc/monitor.c | 2 +-
> target/xtensa/monitor.c | 2 +-
> 9 files changed, 8 insertions(+), 8 deletions(-)
> rename hmp.h => include/monitor/hmp.h (100%)
>
> diff --git a/hmp.h b/include/monitor/hmp.h
> similarity index 100%
> rename from hmp.h
> rename to include/monitor/hmp.h
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index c283dde0e9..5082fcd016 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -14,7 +14,7 @@
> */
>
> #include "qemu/osdep.h"
> -#include "hmp.h"
> +#include "monitor/hmp.h"
> #include "net/net.h"
> #include "net/eth.h"
> #include "chardev/char.h"
> diff --git a/monitor/misc.c b/monitor/misc.c
> index bf9faceb86..2fb6896e84 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -56,13 +56,13 @@
> #include "qom/object_interfaces.h"
> #include "trace/control.h"
> #include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #ifdef CONFIG_TRACE_SIMPLE
> #include "trace/simple.h"
> #endif
> #include "exec/memory.h"
> #include "exec/exec-all.h"
> #include "qemu/option.h"
> -#include "hmp.h"
> #include "qemu/thread.h"
> #include "block/qapi.h"
> #include "qapi/qapi-commands.h"
> diff --git a/target/i386/monitor.c b/target/i386/monitor.c
> index 56e2dbece7..1f3b532fc2 100644
> --- a/target/i386/monitor.c
> +++ b/target/i386/monitor.c
> @@ -26,11 +26,11 @@
> #include "cpu.h"
> #include "monitor/monitor.h"
> #include "monitor/hmp-target.h"
> +#include "monitor/hmp.h"
> #include "qapi/qmp/qdict.h"
> #include "hw/i386/pc.h"
> #include "sysemu/kvm.h"
> #include "sysemu/sev.h"
> -#include "hmp.h"
> #include "qapi/error.h"
> #include "sev_i386.h"
> #include "qapi/qapi-commands-misc.h"
> diff --git a/target/nios2/monitor.c b/target/nios2/monitor.c
> index d5e3393716..6646836df5 100644
> --- a/target/nios2/monitor.c
> +++ b/target/nios2/monitor.c
> @@ -25,7 +25,7 @@
> #include "cpu.h"
> #include "monitor/monitor.h"
> #include "monitor/hmp-target.h"
> -#include "hmp.h"
> +#include "monitor/hmp.h"
>
> void hmp_info_tlb(Monitor *mon, const QDict *qdict)
> {
> diff --git a/target/ppc/monitor.c b/target/ppc/monitor.c
> index 7f8360d903..a5a177d717 100644
> --- a/target/ppc/monitor.c
> +++ b/target/ppc/monitor.c
> @@ -27,7 +27,7 @@
> #include "monitor/monitor.h"
> #include "qemu/ctype.h"
> #include "monitor/hmp-target.h"
> -#include "hmp.h"
> +#include "monitor/hmp.h"
>
> static target_long monitor_get_ccr(const struct MonitorDef *md, int val)
> {
> diff --git a/target/sh4/monitor.c b/target/sh4/monitor.c
> index 4c7f36c9cc..918a5ccfc6 100644
> --- a/target/sh4/monitor.c
> +++ b/target/sh4/monitor.c
> @@ -25,7 +25,7 @@
> #include "cpu.h"
> #include "monitor/monitor.h"
> #include "monitor/hmp-target.h"
> -#include "hmp.h"
> +#include "monitor/hmp.h"
>
> static void print_tlb(Monitor *mon, int idx, tlb_t *tlb)
> {
> diff --git a/target/sparc/monitor.c b/target/sparc/monitor.c
> index 3ec3b51a3d..a7ea287cbc 100644
> --- a/target/sparc/monitor.c
> +++ b/target/sparc/monitor.c
> @@ -25,7 +25,7 @@
> #include "cpu.h"
> #include "monitor/monitor.h"
> #include "monitor/hmp-target.h"
> -#include "hmp.h"
> +#include "monitor/hmp.h"
>
>
> void hmp_info_tlb(Monitor *mon, const QDict *qdict)
> diff --git a/target/xtensa/monitor.c b/target/xtensa/monitor.c
> index cf7957bb63..608173c238 100644
> --- a/target/xtensa/monitor.c
> +++ b/target/xtensa/monitor.c
> @@ -25,7 +25,7 @@
> #include "cpu.h"
> #include "monitor/monitor.h"
> #include "monitor/hmp-target.h"
> -#include "hmp.h"
> +#include "monitor/hmp.h"
>
> void hmp_info_tlb(Monitor *mon, const QDict *qdict)
> {
> --
> 2.21.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (2 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 03/17] hmp: Move hmp.h to include/monitor/ Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:34 ` Daniel P. Berrangé
2019-06-20 8:38 ` Paolo Bonzini
2019-06-19 20:10 ` [Qemu-devel] [PATCH 05/17] qom: Move QMP command handlers to qom/ Markus Armbruster
` (12 subsequent siblings)
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Paolo Bonzini, Daniel P. Berrange, Eduardo Habkost
Move commands object-add, object-del, qom-get, qom-list,
qom-list-properties, qom-list-types, and qom-set with their types from
misc.json to new qom.json. Add qom.json to MAINTAINERS section QOM.
Move commands device-list-properties, device_add, device-del, and
event DEVICE_DELETED from misc.json to new qdev.json. qdev.json
remains uncovered by MAINTAINERS, like the rest of qdev.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 1 +
hw/block/xen-block.c | 2 +-
hw/core/qdev.c | 2 +-
monitor/hmp-cmds.c | 1 +
monitor/qmp-cmds.c | 1 +
qapi/Makefile.objs | 5 +-
qapi/misc.json | 351 ------------------------------------------
qapi/qapi-schema.json | 2 +
qapi/qdev.json | 125 +++++++++++++++
qapi/qom.json | 244 +++++++++++++++++++++++++++++
qdev-monitor.c | 2 +-
11 files changed, 380 insertions(+), 356 deletions(-)
create mode 100644 qapi/qdev.json
create mode 100644 qapi/qom.json
diff --git a/MAINTAINERS b/MAINTAINERS
index 63390eadb5..1aef0afaf7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2035,6 +2035,7 @@ R: Eduardo Habkost <ehabkost@redhat.com>
S: Supported
F: include/qom/
X: include/qom/cpu.h
+F: qapi/qom.json
F: qom/
X: qom/cpu.c
F: tests/check-qom-interface.c
diff --git a/hw/block/xen-block.c b/hw/block/xen-block.c
index 4de537aef4..654b79f921 100644
--- a/hw/block/xen-block.c
+++ b/hw/block/xen-block.c
@@ -11,7 +11,7 @@
#include "qemu/option.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-block-core.h"
-#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-qom.h"
#include "qapi/qapi-visit-block-core.h"
#include "qapi/qobject-input-visitor.h"
#include "qapi/visitor.h"
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index f9b6efe509..94ebc0a4a1 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -29,7 +29,7 @@
#include "hw/qdev.h"
#include "sysemu/sysemu.h"
#include "qapi/error.h"
-#include "qapi/qapi-events-misc.h"
+#include "qapi/qapi-events-qdev.h"
#include "qapi/qmp/qerror.h"
#include "qapi/visitor.h"
#include "qemu/error-report.h"
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 5082fcd016..d94ab7563e 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -34,6 +34,7 @@
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-net.h"
+#include "qapi/qapi-commands-qdev.h"
#include "qapi/qapi-commands-rocker.h"
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-commands-tpm.h"
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index f1b1e4f08b..ae7f201dc0 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -34,6 +34,7 @@
#include "qapi/error.h"
#include "qapi/qapi-commands-block-core.h"
#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-qdev.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 729e5185c5..40b1dcffc4 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -6,8 +6,9 @@ util-obj-y += qmp-event.o
util-obj-y += qapi-util.o
QAPI_COMMON_MODULES = audio authz block-core block char common crypto
-QAPI_COMMON_MODULES += introspect job migration misc net rdma rocker
-QAPI_COMMON_MODULES += run-state sockets tpm trace transaction ui
+QAPI_COMMON_MODULES += introspect job migration misc net
+QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
+QAPI_COMMON_MODULES += trace transaction ui
QAPI_TARGET_MODULES = target
QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
diff --git a/qapi/misc.json b/qapi/misc.json
index dc4cf9da20..5fbda70ad8 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1342,140 +1342,6 @@
'data': {'command-line': 'str', '*cpu-index': 'int'},
'returns': 'str' }
-##
-# @ObjectPropertyInfo:
-#
-# @name: the name of the property
-#
-# @type: the type of the property. This will typically come in one of four
-# forms:
-#
-# 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
-# These types are mapped to the appropriate JSON type.
-#
-# 2) A child type in the form 'child<subtype>' where subtype is a qdev
-# device type name. Child properties create the composition tree.
-#
-# 3) A link type in the form 'link<subtype>' where subtype is a qdev
-# device type name. Link properties form the device model graph.
-#
-# @description: if specified, the description of the property.
-#
-# Since: 1.2
-##
-{ 'struct': 'ObjectPropertyInfo',
- 'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
-
-##
-# @qom-list:
-#
-# This command will list any properties of a object given a path in the object
-# model.
-#
-# @path: the path within the object model. See @qom-get for a description of
-# this parameter.
-#
-# Returns: a list of @ObjectPropertyInfo that describe the properties of the
-# object.
-#
-# Since: 1.2
-#
-# Example:
-#
-# -> { "execute": "qom-list",
-# "arguments": { "path": "/chardevs" } }
-# <- { "return": [ { "name": "type", "type": "string" },
-# { "name": "parallel0", "type": "child<chardev-vc>" },
-# { "name": "serial0", "type": "child<chardev-vc>" },
-# { "name": "mon0", "type": "child<chardev-stdio>" } ] }
-#
-##
-{ 'command': 'qom-list',
- 'data': { 'path': 'str' },
- 'returns': [ 'ObjectPropertyInfo' ],
- 'allow-preconfig': true }
-
-##
-# @qom-get:
-#
-# This command will get a property from a object model path and return the
-# value.
-#
-# @path: The path within the object model. There are two forms of supported
-# paths--absolute and partial paths.
-#
-# Absolute paths are derived from the root object and can follow child<>
-# or link<> properties. Since they can follow link<> properties, they
-# can be arbitrarily long. Absolute paths look like absolute filenames
-# and are prefixed with a leading slash.
-#
-# Partial paths look like relative filenames. They do not begin
-# with a prefix. The matching rules for partial paths are subtle but
-# designed to make specifying objects easy. At each level of the
-# composition tree, the partial path is matched as an absolute path.
-# The first match is not returned. At least two matches are searched
-# for. A successful result is only returned if only one match is
-# found. If more than one match is found, a flag is return to
-# indicate that the match was ambiguous.
-#
-# @property: The property name to read
-#
-# Returns: The property value. The type depends on the property
-# type. child<> and link<> properties are returned as #str
-# pathnames. All integer property types (u8, u16, etc) are
-# returned as #int.
-#
-# Since: 1.2
-#
-# Example:
-#
-# 1. Use absolute path
-#
-# -> { "execute": "qom-get",
-# "arguments": { "path": "/machine/unattached/device[0]",
-# "property": "hotplugged" } }
-# <- { "return": false }
-#
-# 2. Use partial path
-#
-# -> { "execute": "qom-get",
-# "arguments": { "path": "unattached/sysbus",
-# "property": "type" } }
-# <- { "return": "System" }
-#
-##
-{ 'command': 'qom-get',
- 'data': { 'path': 'str', 'property': 'str' },
- 'returns': 'any',
- 'allow-preconfig': true }
-
-##
-# @qom-set:
-#
-# This command will set a property from a object model path.
-#
-# @path: see @qom-get for a description of this parameter
-#
-# @property: the property name to set
-#
-# @value: a value who's type is appropriate for the property type. See @qom-get
-# for a description of type mapping.
-#
-# Since: 1.2
-#
-# Example:
-#
-# -> { "execute": "qom-set",
-# "arguments": { "path": "/machine",
-# "property": "graphics",
-# "value": false } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'qom-set',
- 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
- 'allow-preconfig': true }
-
##
# @change:
#
@@ -1524,80 +1390,6 @@
{ 'command': 'change',
'data': {'device': 'str', 'target': 'str', '*arg': 'str'} }
-##
-# @ObjectTypeInfo:
-#
-# This structure describes a search result from @qom-list-types
-#
-# @name: the type name found in the search
-#
-# @abstract: the type is abstract and can't be directly instantiated.
-# Omitted if false. (since 2.10)
-#
-# @parent: Name of parent type, if any (since 2.10)
-#
-# Since: 1.1
-##
-{ 'struct': 'ObjectTypeInfo',
- 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
-
-##
-# @qom-list-types:
-#
-# This command will return a list of types given search parameters
-#
-# @implements: if specified, only return types that implement this type name
-#
-# @abstract: if true, include abstract types in the results
-#
-# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
-#
-# Since: 1.1
-##
-{ 'command': 'qom-list-types',
- 'data': { '*implements': 'str', '*abstract': 'bool' },
- 'returns': [ 'ObjectTypeInfo' ],
- 'allow-preconfig': true }
-
-##
-# @device-list-properties:
-#
-# List properties associated with a device.
-#
-# @typename: the type name of a device
-#
-# Returns: a list of ObjectPropertyInfo describing a devices properties
-#
-# Note: objects can create properties at runtime, for example to describe
-# links between different devices and/or objects. These properties
-# are not included in the output of this command.
-#
-# Since: 1.2
-##
-{ 'command': 'device-list-properties',
- 'data': { 'typename': 'str'},
- 'returns': [ 'ObjectPropertyInfo' ] }
-
-##
-# @qom-list-properties:
-#
-# List properties associated with a QOM object.
-#
-# @typename: the type name of an object
-#
-# Note: objects can create properties at runtime, for example to describe
-# links between different devices and/or objects. These properties
-# are not included in the output of this command.
-#
-# Returns: a list of ObjectPropertyInfo describing object properties
-#
-# Since: 2.12
-##
-{ 'command': 'qom-list-properties',
- 'data': { 'typename': 'str'},
- 'returns': [ 'ObjectPropertyInfo' ],
- 'allow-preconfig': true }
-
##
# @xen-set-global-dirty-log:
#
@@ -1618,102 +1410,6 @@
##
{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
-##
-# @device_add:
-#
-# @driver: the name of the new device's driver
-#
-# @bus: the device's parent bus (device tree path)
-#
-# @id: the device's ID, must be unique
-#
-# Additional arguments depend on the type.
-#
-# Add a device.
-#
-# Notes:
-# 1. For detailed information about this command, please refer to the
-# 'docs/qdev-device-use.txt' file.
-#
-# 2. It's possible to list device properties by running QEMU with the
-# "-device DEVICE,help" command-line argument, where DEVICE is the
-# device's name
-#
-# Example:
-#
-# -> { "execute": "device_add",
-# "arguments": { "driver": "e1000", "id": "net1",
-# "bus": "pci.0",
-# "mac": "52:54:00:12:34:56" } }
-# <- { "return": {} }
-#
-# TODO: This command effectively bypasses QAPI completely due to its
-# "additional arguments" business. It shouldn't have been added to
-# the schema in this form. It should be qapified properly, or
-# replaced by a properly qapified command.
-#
-# Since: 0.13
-##
-{ 'command': 'device_add',
- 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
- 'gen': false } # so we can get the additional arguments
-
-##
-# @device_del:
-#
-# Remove a device from a guest
-#
-# @id: the device's ID or QOM path
-#
-# Returns: Nothing on success
-# If @id is not a valid device, DeviceNotFound
-#
-# Notes: When this command completes, the device may not be removed from the
-# guest. Hot removal is an operation that requires guest cooperation.
-# This command merely requests that the guest begin the hot removal
-# process. Completion of the device removal process is signaled with a
-# DEVICE_DELETED event. Guest reset will automatically complete removal
-# for all devices.
-#
-# Since: 0.14.0
-#
-# Example:
-#
-# -> { "execute": "device_del",
-# "arguments": { "id": "net1" } }
-# <- { "return": {} }
-#
-# -> { "execute": "device_del",
-# "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'device_del', 'data': {'id': 'str'} }
-
-##
-# @DEVICE_DELETED:
-#
-# Emitted whenever the device removal completion is acknowledged by the guest.
-# At this point, it's safe to reuse the specified device ID. Device removal can
-# be initiated by the guest or by HMP/QMP commands.
-#
-# @device: device name
-#
-# @path: device path
-#
-# Since: 1.5
-#
-# Example:
-#
-# <- { "event": "DEVICE_DELETED",
-# "data": { "device": "virtio-net-pci-0",
-# "path": "/machine/peripheral/virtio-net-pci-0" },
-# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
-#
-##
-{ 'event': 'DEVICE_DELETED',
- 'data': { '*device': 'str', 'path': 'str' } }
-
##
# @DumpGuestMemoryFormat:
#
@@ -1906,53 +1602,6 @@
{ 'command': 'query-dump-guest-memory-capability',
'returns': 'DumpGuestMemoryCapability' }
-##
-# @object-add:
-#
-# Create a QOM object.
-#
-# @qom-type: the class name for the object to be created
-#
-# @id: the name of the new object
-#
-# @props: a dictionary of properties to be passed to the backend
-#
-# Returns: Nothing on success
-# Error if @qom-type is not a valid class name
-#
-# Since: 2.0
-#
-# Example:
-#
-# -> { "execute": "object-add",
-# "arguments": { "qom-type": "rng-random", "id": "rng1",
-# "props": { "filename": "/dev/hwrng" } } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'object-add',
- 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
-
-##
-# @object-del:
-#
-# Remove a QOM object.
-#
-# @id: the name of the QOM object to remove
-#
-# Returns: Nothing on success
-# Error if @id is not a valid id for a QOM object
-#
-# Since: 2.0
-#
-# Example:
-#
-# -> { "execute": "object-del", "arguments": { "id": "rng1" } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'object-del', 'data': {'id': 'str'} }
-
##
# @getfd:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 4bd1223637..d6cf90a85a 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -97,6 +97,8 @@
{ 'include': 'transaction.json' }
{ 'include': 'trace.json' }
{ 'include': 'introspect.json' }
+{ 'include': 'qom.json' }
+{ 'include': 'qdev.json' }
{ 'include': 'misc.json' }
{ 'include': 'target.json' }
{ 'include': 'audio.json' }
diff --git a/qapi/qdev.json b/qapi/qdev.json
new file mode 100644
index 0000000000..c6d05032f4
--- /dev/null
+++ b/qapi/qdev.json
@@ -0,0 +1,125 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Device infrastructure (qdev)
+##
+
+{ 'include': 'qom.json' }
+
+##
+# @device-list-properties:
+#
+# List properties associated with a device.
+#
+# @typename: the type name of a device
+#
+# Returns: a list of ObjectPropertyInfo describing a devices properties
+#
+# Note: objects can create properties at runtime, for example to describe
+# links between different devices and/or objects. These properties
+# are not included in the output of this command.
+#
+# Since: 1.2
+##
+{ 'command': 'device-list-properties',
+ 'data': { 'typename': 'str'},
+ 'returns': [ 'ObjectPropertyInfo' ] }
+
+##
+# @device_add:
+#
+# @driver: the name of the new device's driver
+#
+# @bus: the device's parent bus (device tree path)
+#
+# @id: the device's ID, must be unique
+#
+# Additional arguments depend on the type.
+#
+# Add a device.
+#
+# Notes:
+# 1. For detailed information about this command, please refer to the
+# 'docs/qdev-device-use.txt' file.
+#
+# 2. It's possible to list device properties by running QEMU with the
+# "-device DEVICE,help" command-line argument, where DEVICE is the
+# device's name
+#
+# Example:
+#
+# -> { "execute": "device_add",
+# "arguments": { "driver": "e1000", "id": "net1",
+# "bus": "pci.0",
+# "mac": "52:54:00:12:34:56" } }
+# <- { "return": {} }
+#
+# TODO: This command effectively bypasses QAPI completely due to its
+# "additional arguments" business. It shouldn't have been added to
+# the schema in this form. It should be qapified properly, or
+# replaced by a properly qapified command.
+#
+# Since: 0.13
+##
+{ 'command': 'device_add',
+ 'data': {'driver': 'str', '*bus': 'str', '*id': 'str'},
+ 'gen': false } # so we can get the additional arguments
+
+##
+# @device_del:
+#
+# Remove a device from a guest
+#
+# @id: the device's ID or QOM path
+#
+# Returns: Nothing on success
+# If @id is not a valid device, DeviceNotFound
+#
+# Notes: When this command completes, the device may not be removed from the
+# guest. Hot removal is an operation that requires guest cooperation.
+# This command merely requests that the guest begin the hot removal
+# process. Completion of the device removal process is signaled with a
+# DEVICE_DELETED event. Guest reset will automatically complete removal
+# for all devices.
+#
+# Since: 0.14.0
+#
+# Example:
+#
+# -> { "execute": "device_del",
+# "arguments": { "id": "net1" } }
+# <- { "return": {} }
+#
+# -> { "execute": "device_del",
+# "arguments": { "id": "/machine/peripheral-anon/device[0]" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'device_del', 'data': {'id': 'str'} }
+
+##
+# @DEVICE_DELETED:
+#
+# Emitted whenever the device removal completion is acknowledged by the guest.
+# At this point, it's safe to reuse the specified device ID. Device removal can
+# be initiated by the guest or by HMP/QMP commands.
+#
+# @device: device name
+#
+# @path: device path
+#
+# Since: 1.5
+#
+# Example:
+#
+# <- { "event": "DEVICE_DELETED",
+# "data": { "device": "virtio-net-pci-0",
+# "path": "/machine/peripheral/virtio-net-pci-0" },
+# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } }
+#
+##
+{ 'event': 'DEVICE_DELETED',
+ 'data': { '*device': 'str', 'path': 'str' } }
diff --git a/qapi/qom.json b/qapi/qom.json
new file mode 100644
index 0000000000..32db96ffc4
--- /dev/null
+++ b/qapi/qom.json
@@ -0,0 +1,244 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = QEMU Object Model (QOM)
+##
+
+##
+# @ObjectPropertyInfo:
+#
+# @name: the name of the property
+#
+# @type: the type of the property. This will typically come in one of four
+# forms:
+#
+# 1) A primitive type such as 'u8', 'u16', 'bool', 'str', or 'double'.
+# These types are mapped to the appropriate JSON type.
+#
+# 2) A child type in the form 'child<subtype>' where subtype is a qdev
+# device type name. Child properties create the composition tree.
+#
+# 3) A link type in the form 'link<subtype>' where subtype is a qdev
+# device type name. Link properties form the device model graph.
+#
+# @description: if specified, the description of the property.
+#
+# Since: 1.2
+##
+{ 'struct': 'ObjectPropertyInfo',
+ 'data': { 'name': 'str', 'type': 'str', '*description': 'str' } }
+
+##
+# @qom-list:
+#
+# This command will list any properties of a object given a path in the object
+# model.
+#
+# @path: the path within the object model. See @qom-get for a description of
+# this parameter.
+#
+# Returns: a list of @ObjectPropertyInfo that describe the properties of the
+# object.
+#
+# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "qom-list",
+# "arguments": { "path": "/chardevs" } }
+# <- { "return": [ { "name": "type", "type": "string" },
+# { "name": "parallel0", "type": "child<chardev-vc>" },
+# { "name": "serial0", "type": "child<chardev-vc>" },
+# { "name": "mon0", "type": "child<chardev-stdio>" } ] }
+#
+##
+{ 'command': 'qom-list',
+ 'data': { 'path': 'str' },
+ 'returns': [ 'ObjectPropertyInfo' ],
+ 'allow-preconfig': true }
+
+##
+# @qom-get:
+#
+# This command will get a property from a object model path and return the
+# value.
+#
+# @path: The path within the object model. There are two forms of supported
+# paths--absolute and partial paths.
+#
+# Absolute paths are derived from the root object and can follow child<>
+# or link<> properties. Since they can follow link<> properties, they
+# can be arbitrarily long. Absolute paths look like absolute filenames
+# and are prefixed with a leading slash.
+#
+# Partial paths look like relative filenames. They do not begin
+# with a prefix. The matching rules for partial paths are subtle but
+# designed to make specifying objects easy. At each level of the
+# composition tree, the partial path is matched as an absolute path.
+# The first match is not returned. At least two matches are searched
+# for. A successful result is only returned if only one match is
+# found. If more than one match is found, a flag is return to
+# indicate that the match was ambiguous.
+#
+# @property: The property name to read
+#
+# Returns: The property value. The type depends on the property
+# type. child<> and link<> properties are returned as #str
+# pathnames. All integer property types (u8, u16, etc) are
+# returned as #int.
+#
+# Since: 1.2
+#
+# Example:
+#
+# 1. Use absolute path
+#
+# -> { "execute": "qom-get",
+# "arguments": { "path": "/machine/unattached/device[0]",
+# "property": "hotplugged" } }
+# <- { "return": false }
+#
+# 2. Use partial path
+#
+# -> { "execute": "qom-get",
+# "arguments": { "path": "unattached/sysbus",
+# "property": "type" } }
+# <- { "return": "System" }
+#
+##
+{ 'command': 'qom-get',
+ 'data': { 'path': 'str', 'property': 'str' },
+ 'returns': 'any',
+ 'allow-preconfig': true }
+
+##
+# @qom-set:
+#
+# This command will set a property from a object model path.
+#
+# @path: see @qom-get for a description of this parameter
+#
+# @property: the property name to set
+#
+# @value: a value who's type is appropriate for the property type. See @qom-get
+# for a description of type mapping.
+#
+# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "qom-set",
+# "arguments": { "path": "/machine",
+# "property": "graphics",
+# "value": false } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'qom-set',
+ 'data': { 'path': 'str', 'property': 'str', 'value': 'any' },
+ 'allow-preconfig': true }
+
+##
+# @ObjectTypeInfo:
+#
+# This structure describes a search result from @qom-list-types
+#
+# @name: the type name found in the search
+#
+# @abstract: the type is abstract and can't be directly instantiated.
+# Omitted if false. (since 2.10)
+#
+# @parent: Name of parent type, if any (since 2.10)
+#
+# Since: 1.1
+##
+{ 'struct': 'ObjectTypeInfo',
+ 'data': { 'name': 'str', '*abstract': 'bool', '*parent': 'str' } }
+
+##
+# @qom-list-types:
+#
+# This command will return a list of types given search parameters
+#
+# @implements: if specified, only return types that implement this type name
+#
+# @abstract: if true, include abstract types in the results
+#
+# Returns: a list of @ObjectTypeInfo or an empty list if no results are found
+#
+# Since: 1.1
+##
+{ 'command': 'qom-list-types',
+ 'data': { '*implements': 'str', '*abstract': 'bool' },
+ 'returns': [ 'ObjectTypeInfo' ],
+ 'allow-preconfig': true }
+
+##
+# @qom-list-properties:
+#
+# List properties associated with a QOM object.
+#
+# @typename: the type name of an object
+#
+# Note: objects can create properties at runtime, for example to describe
+# links between different devices and/or objects. These properties
+# are not included in the output of this command.
+#
+# Returns: a list of ObjectPropertyInfo describing object properties
+#
+# Since: 2.12
+##
+{ 'command': 'qom-list-properties',
+ 'data': { 'typename': 'str'},
+ 'returns': [ 'ObjectPropertyInfo' ],
+ 'allow-preconfig': true }
+
+##
+# @object-add:
+#
+# Create a QOM object.
+#
+# @qom-type: the class name for the object to be created
+#
+# @id: the name of the new object
+#
+# @props: a dictionary of properties to be passed to the backend
+#
+# Returns: Nothing on success
+# Error if @qom-type is not a valid class name
+#
+# Since: 2.0
+#
+# Example:
+#
+# -> { "execute": "object-add",
+# "arguments": { "qom-type": "rng-random", "id": "rng1",
+# "props": { "filename": "/dev/hwrng" } } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'object-add',
+ 'data': {'qom-type': 'str', 'id': 'str', '*props': 'any'} }
+
+##
+# @object-del:
+#
+# Remove a QOM object.
+#
+# @id: the name of the QOM object to remove
+#
+# Returns: Nothing on success
+# Error if @id is not a valid id for a QOM object
+#
+# Since: 2.0
+#
+# Example:
+#
+# -> { "execute": "object-del", "arguments": { "id": "rng1" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'object-del', 'data': {'id': 'str'} }
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 373b9ad445..63a87e9632 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -24,7 +24,7 @@
#include "monitor/qdev.h"
#include "sysemu/arch_init.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-qdev.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
#include "qemu/config-file.h"
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json Markus Armbruster
@ 2019-06-20 8:34 ` Daniel P. Berrangé
2019-06-20 8:38 ` Paolo Bonzini
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:34 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Paolo Bonzini, qemu-devel, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:37PM +0200, Markus Armbruster wrote:
> Move commands object-add, object-del, qom-get, qom-list,
> qom-list-properties, qom-list-types, and qom-set with their types from
> misc.json to new qom.json. Add qom.json to MAINTAINERS section QOM.
>
> Move commands device-list-properties, device_add, device-del, and
> event DEVICE_DELETED from misc.json to new qdev.json. qdev.json
> remains uncovered by MAINTAINERS, like the rest of qdev.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 1 +
> hw/block/xen-block.c | 2 +-
> hw/core/qdev.c | 2 +-
> monitor/hmp-cmds.c | 1 +
> monitor/qmp-cmds.c | 1 +
> qapi/Makefile.objs | 5 +-
> qapi/misc.json | 351 ------------------------------------------
> qapi/qapi-schema.json | 2 +
> qapi/qdev.json | 125 +++++++++++++++
> qapi/qom.json | 244 +++++++++++++++++++++++++++++
> qdev-monitor.c | 2 +-
> 11 files changed, 380 insertions(+), 356 deletions(-)
> create mode 100644 qapi/qdev.json
> create mode 100644 qapi/qom.json
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 63390eadb5..1aef0afaf7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2035,6 +2035,7 @@ R: Eduardo Habkost <ehabkost@redhat.com>
> S: Supported
> F: include/qom/
> X: include/qom/cpu.h
> +F: qapi/qom.json
> F: qom/
> X: qom/cpu.c
> F: tests/check-qom-interface.c
So we don't have any designated "qdev" maintainers i see.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json Markus Armbruster
2019-06-20 8:34 ` Daniel P. Berrangé
@ 2019-06-20 8:38 ` Paolo Bonzini
2019-06-24 11:19 ` Markus Armbruster
1 sibling, 1 reply; 57+ messages in thread
From: Paolo Bonzini @ 2019-06-20 8:38 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: kwolf, Daniel P. Berrange, Eduardo Habkost
On 19/06/19 22:10, Markus Armbruster wrote:
> Move commands device-list-properties, device_add, device-del, and
> event DEVICE_DELETED from misc.json to new qdev.json. qdev.json
> remains uncovered by MAINTAINERS, like the rest of qdev.
qdev should be added to either QOM or machine core. QOM would be fine
for me as the (newly,self)-appointed maintainer.
Paolo
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json
2019-06-20 8:38 ` Paolo Bonzini
@ 2019-06-24 11:19 ` Markus Armbruster
2019-06-24 11:45 ` Daniel P. Berrangé
0 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-24 11:19 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: kwolf, Daniel P. Berrange, qemu-devel, Eduardo Habkost
Paolo Bonzini <pbonzini@redhat.com> writes:
> On 19/06/19 22:10, Markus Armbruster wrote:
>> Move commands device-list-properties, device_add, device-del, and
>> event DEVICE_DELETED from misc.json to new qdev.json. qdev.json
>> remains uncovered by MAINTAINERS, like the rest of qdev.
>
> qdev should be added to either QOM or machine core. QOM would be fine
> for me as the (newly,self)-appointed maintainer.
Awesome! Daniel, Eduardo, any objections?
I figure these are the files to add:
diff --git a/MAINTAINERS b/MAINTAINERS
index 63390eadb5..e2cb1726dd 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2033,12 +2033,18 @@ M: Paolo Bonzini <pbonzini@redhat.com>
R: Daniel P. Berrange <berrange@redhat.com>
R: Eduardo Habkost <ehabkost@redhat.com>
S: Supported
+F: docs/qdev-device-use.txt
+F: hw/core/qdev*
+F: include/hw/qdev*
+F: include/monitor/qdev.h
F: include/qom/
X: include/qom/cpu.h
+F: qdev-monitor.c
F: qom/
X: qom/cpu.c
F: tests/check-qom-interface.c
F: tests/check-qom-proplist.c
+F: tests/test-qdev-global-props.c
QMP
M: Markus Armbruster <armbru@redhat.com>
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json
2019-06-24 11:19 ` Markus Armbruster
@ 2019-06-24 11:45 ` Daniel P. Berrangé
0 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-24 11:45 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Paolo Bonzini, qemu-devel, Eduardo Habkost
On Mon, Jun 24, 2019 at 01:19:33PM +0200, Markus Armbruster wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
>
> > On 19/06/19 22:10, Markus Armbruster wrote:
> >> Move commands device-list-properties, device_add, device-del, and
> >> event DEVICE_DELETED from misc.json to new qdev.json. qdev.json
> >> remains uncovered by MAINTAINERS, like the rest of qdev.
> >
> > qdev should be added to either QOM or machine core. QOM would be fine
> > for me as the (newly,self)-appointed maintainer.
>
> Awesome! Daniel, Eduardo, any objections?
>
> I figure these are the files to add:
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 63390eadb5..e2cb1726dd 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2033,12 +2033,18 @@ M: Paolo Bonzini <pbonzini@redhat.com>
> R: Daniel P. Berrange <berrange@redhat.com>
> R: Eduardo Habkost <ehabkost@redhat.com>
> S: Supported
> +F: docs/qdev-device-use.txt
> +F: hw/core/qdev*
> +F: include/hw/qdev*
> +F: include/monitor/qdev.h
> F: include/qom/
> X: include/qom/cpu.h
> +F: qdev-monitor.c
> F: qom/
> X: qom/cpu.c
> F: tests/check-qom-interface.c
> F: tests/check-qom-proplist.c
> +F: tests/test-qdev-global-props.c
>
> QMP
> M: Markus Armbruster <armbru@redhat.com>
For this addition
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 05/17] qom: Move QMP command handlers to qom/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (3 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 04/17] qapi: Split qom.json and qdev.json off misc.json Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:35 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 06/17] qom: Move HMP " Markus Armbruster
` (11 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Paolo Bonzini, Daniel P. Berrange, Eduardo Habkost
The handlers for qapi/qom.json's QMP commands are in
monitor/qmp-cmds.c. Move them to new qom/qom-qmp-cmds.c, where they
are covered by MAINTAINERS section QOM, just like qapi/qom.json.
Move along qmp_device_list_properties() even though it's specified in
qapi/qdev.json, because it's so similar to qmp_qom_list_properties().
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
monitor/qmp-cmds.c | 303 ------------------------------------------
qom/Makefile.objs | 1 +
qom/qom-qmp-cmds.c | 323 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 324 insertions(+), 303 deletions(-)
create mode 100644 qom/qom-qmp-cmds.c
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index ae7f201dc0..884eeaab80 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -27,20 +27,14 @@
#include "ui/vnc.h"
#include "sysemu/kvm.h"
#include "sysemu/arch_init.h"
-#include "hw/qdev.h"
#include "sysemu/blockdev.h"
#include "sysemu/block-backend.h"
-#include "qom/qom-qobject.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-block-core.h"
#include "qapi/qapi-commands-misc.h"
-#include "qapi/qapi-commands-qdev.h"
#include "qapi/qapi-commands-ui.h"
-#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
-#include "qapi/qobject-input-visitor.h"
#include "hw/boards.h"
-#include "qom/object_interfaces.h"
#include "hw/mem/memory-device.h"
#include "hw/acpi/acpi_dev_interface.h"
@@ -197,69 +191,6 @@ void qmp_system_wakeup(Error **errp)
qemu_system_wakeup_request(QEMU_WAKEUP_REASON_OTHER, errp);
}
-ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
-{
- Object *obj;
- bool ambiguous = false;
- ObjectPropertyInfoList *props = NULL;
- ObjectProperty *prop;
- ObjectPropertyIterator iter;
-
- obj = object_resolve_path(path, &ambiguous);
- if (obj == NULL) {
- if (ambiguous) {
- error_setg(errp, "Path '%s' is ambiguous", path);
- } else {
- error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Device '%s' not found", path);
- }
- return NULL;
- }
-
- object_property_iter_init(&iter, obj);
- while ((prop = object_property_iter_next(&iter))) {
- ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
-
- entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
- entry->next = props;
- props = entry;
-
- entry->value->name = g_strdup(prop->name);
- entry->value->type = g_strdup(prop->type);
- }
-
- return props;
-}
-
-void qmp_qom_set(const char *path, const char *property, QObject *value,
- Error **errp)
-{
- Object *obj;
-
- obj = object_resolve_path(path, NULL);
- if (!obj) {
- error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Device '%s' not found", path);
- return;
- }
-
- object_property_set_qobject(obj, value, property, errp);
-}
-
-QObject *qmp_qom_get(const char *path, const char *property, Error **errp)
-{
- Object *obj;
-
- obj = object_resolve_path(path, NULL);
- if (!obj) {
- error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Device '%s' not found", path);
- return NULL;
- }
-
- return object_property_get_qobject(obj, property, errp);
-}
-
void qmp_set_password(const char *protocol, const char *password,
bool has_connected, const char *connected, Error **errp)
{
@@ -408,208 +339,6 @@ void qmp_change(const char *device, const char *target,
}
}
-static void qom_list_types_tramp(ObjectClass *klass, void *data)
-{
- ObjectTypeInfoList *e, **pret = data;
- ObjectTypeInfo *info;
- ObjectClass *parent = object_class_get_parent(klass);
-
- info = g_malloc0(sizeof(*info));
- info->name = g_strdup(object_class_get_name(klass));
- info->has_abstract = info->abstract = object_class_is_abstract(klass);
- if (parent) {
- info->has_parent = true;
- info->parent = g_strdup(object_class_get_name(parent));
- }
-
- e = g_malloc0(sizeof(*e));
- e->value = info;
- e->next = *pret;
- *pret = e;
-}
-
-ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
- const char *implements,
- bool has_abstract,
- bool abstract,
- Error **errp)
-{
- ObjectTypeInfoList *ret = NULL;
-
- object_class_foreach(qom_list_types_tramp, implements, abstract, &ret);
-
- return ret;
-}
-
-/* Return a DevicePropertyInfo for a qdev property.
- *
- * If a qdev property with the given name does not exist, use the given default
- * type. If the qdev property info should not be shown, return NULL.
- *
- * The caller must free the return value.
- */
-static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
- const char *name,
- const char *default_type,
- const char *description)
-{
- ObjectPropertyInfo *info;
- Property *prop;
-
- do {
- for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
- if (strcmp(name, prop->name) != 0) {
- continue;
- }
-
- /*
- * TODO Properties without a parser are just for dirty hacks.
- * qdev_prop_ptr is the only such PropertyInfo. It's marked
- * for removal. This conditional should be removed along with
- * it.
- */
- if (!prop->info->set && !prop->info->create) {
- return NULL; /* no way to set it, don't show */
- }
-
- info = g_malloc0(sizeof(*info));
- info->name = g_strdup(prop->name);
- info->type = default_type ? g_strdup(default_type)
- : g_strdup(prop->info->name);
- info->has_description = !!prop->info->description;
- info->description = g_strdup(prop->info->description);
- return info;
- }
- klass = object_class_get_parent(klass);
- } while (klass != object_class_by_name(TYPE_DEVICE));
-
- /* Not a qdev property, use the default type */
- info = g_malloc0(sizeof(*info));
- info->name = g_strdup(name);
- info->type = g_strdup(default_type);
- info->has_description = !!description;
- info->description = g_strdup(description);
-
- return info;
-}
-
-ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
- Error **errp)
-{
- ObjectClass *klass;
- Object *obj;
- ObjectProperty *prop;
- ObjectPropertyIterator iter;
- ObjectPropertyInfoList *prop_list = NULL;
-
- klass = object_class_by_name(typename);
- if (klass == NULL) {
- error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Device '%s' not found", typename);
- return NULL;
- }
-
- klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
- if (klass == NULL) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE);
- return NULL;
- }
-
- if (object_class_is_abstract(klass)) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
- "non-abstract device type");
- return NULL;
- }
-
- obj = object_new(typename);
-
- object_property_iter_init(&iter, obj);
- while ((prop = object_property_iter_next(&iter))) {
- ObjectPropertyInfo *info;
- ObjectPropertyInfoList *entry;
-
- /* Skip Object and DeviceState properties */
- if (strcmp(prop->name, "type") == 0 ||
- strcmp(prop->name, "realized") == 0 ||
- strcmp(prop->name, "hotpluggable") == 0 ||
- strcmp(prop->name, "hotplugged") == 0 ||
- strcmp(prop->name, "parent_bus") == 0) {
- continue;
- }
-
- /* Skip legacy properties since they are just string versions of
- * properties that we already list.
- */
- if (strstart(prop->name, "legacy-", NULL)) {
- continue;
- }
-
- info = make_device_property_info(klass, prop->name, prop->type,
- prop->description);
- if (!info) {
- continue;
- }
-
- entry = g_malloc0(sizeof(*entry));
- entry->value = info;
- entry->next = prop_list;
- prop_list = entry;
- }
-
- object_unref(obj);
-
- return prop_list;
-}
-
-ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
- Error **errp)
-{
- ObjectClass *klass;
- Object *obj = NULL;
- ObjectProperty *prop;
- ObjectPropertyIterator iter;
- ObjectPropertyInfoList *prop_list = NULL;
-
- klass = object_class_by_name(typename);
- if (klass == NULL) {
- error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Class '%s' not found", typename);
- return NULL;
- }
-
- klass = object_class_dynamic_cast(klass, TYPE_OBJECT);
- if (klass == NULL) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT);
- return NULL;
- }
-
- if (object_class_is_abstract(klass)) {
- object_class_property_iter_init(&iter, klass);
- } else {
- obj = object_new(typename);
- object_property_iter_init(&iter, obj);
- }
- while ((prop = object_property_iter_next(&iter))) {
- ObjectPropertyInfo *info;
- ObjectPropertyInfoList *entry;
-
- info = g_malloc0(sizeof(*info));
- info->name = g_strdup(prop->name);
- info->type = g_strdup(prop->type);
- info->has_description = !!prop->description;
- info->description = g_strdup(prop->description);
-
- entry = g_malloc0(sizeof(*entry));
- entry->value = info;
- entry->next = prop_list;
- prop_list = entry;
- }
-
- object_unref(obj);
-
- return prop_list;
-}
-
void qmp_add_client(const char *protocol, const char *fdname,
bool has_skipauth, bool skipauth, bool has_tls, bool tls,
Error **errp)
@@ -654,38 +383,6 @@ void qmp_add_client(const char *protocol, const char *fdname,
}
-void qmp_object_add(const char *type, const char *id,
- bool has_props, QObject *props, Error **errp)
-{
- QDict *pdict;
- Visitor *v;
- Object *obj;
-
- if (props) {
- pdict = qobject_to(QDict, props);
- if (!pdict) {
- error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
- return;
- }
- qobject_ref(pdict);
- } else {
- pdict = qdict_new();
- }
-
- v = qobject_input_visitor_new(QOBJECT(pdict));
- obj = user_creatable_add_type(type, id, pdict, v, errp);
- visit_free(v);
- if (obj) {
- object_unref(obj);
- }
- qobject_unref(pdict);
-}
-
-void qmp_object_del(const char *id, Error **errp)
-{
- user_creatable_del(id, errp);
-}
-
MemoryDeviceInfoList *qmp_query_memory_devices(Error **errp)
{
return qmp_memory_device_list();
diff --git a/qom/Makefile.objs b/qom/Makefile.objs
index 516349eec3..5fb43b842c 100644
--- a/qom/Makefile.objs
+++ b/qom/Makefile.objs
@@ -2,3 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o
qom-obj-y += object_interfaces.o
common-obj-y = cpu.o
+common-obj-$(CONFIG_SOFTMMU) += qom-qmp-cmds.o
diff --git a/qom/qom-qmp-cmds.c b/qom/qom-qmp-cmds.c
new file mode 100644
index 0000000000..e046a0f190
--- /dev/null
+++ b/qom/qom-qmp-cmds.c
@@ -0,0 +1,323 @@
+/*
+ * QMP commands related to QOM
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "hw/qdev.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-qdev.h"
+#include "qapi/qapi-commands-qom.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/qmp/qerror.h"
+#include "qapi/qobject-input-visitor.h"
+#include "qemu/cutils.h"
+#include "qom/object_interfaces.h"
+#include "qom/qom-qobject.h"
+
+ObjectPropertyInfoList *qmp_qom_list(const char *path, Error **errp)
+{
+ Object *obj;
+ bool ambiguous = false;
+ ObjectPropertyInfoList *props = NULL;
+ ObjectProperty *prop;
+ ObjectPropertyIterator iter;
+
+ obj = object_resolve_path(path, &ambiguous);
+ if (obj == NULL) {
+ if (ambiguous) {
+ error_setg(errp, "Path '%s' is ambiguous", path);
+ } else {
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
+ }
+ return NULL;
+ }
+
+ object_property_iter_init(&iter, obj);
+ while ((prop = object_property_iter_next(&iter))) {
+ ObjectPropertyInfoList *entry = g_malloc0(sizeof(*entry));
+
+ entry->value = g_malloc0(sizeof(ObjectPropertyInfo));
+ entry->next = props;
+ props = entry;
+
+ entry->value->name = g_strdup(prop->name);
+ entry->value->type = g_strdup(prop->type);
+ }
+
+ return props;
+}
+
+void qmp_qom_set(const char *path, const char *property, QObject *value,
+ Error **errp)
+{
+ Object *obj;
+
+ obj = object_resolve_path(path, NULL);
+ if (!obj) {
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
+ return;
+ }
+
+ object_property_set_qobject(obj, value, property, errp);
+}
+
+QObject *qmp_qom_get(const char *path, const char *property, Error **errp)
+{
+ Object *obj;
+
+ obj = object_resolve_path(path, NULL);
+ if (!obj) {
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
+ return NULL;
+ }
+
+ return object_property_get_qobject(obj, property, errp);
+}
+
+static void qom_list_types_tramp(ObjectClass *klass, void *data)
+{
+ ObjectTypeInfoList *e, **pret = data;
+ ObjectTypeInfo *info;
+ ObjectClass *parent = object_class_get_parent(klass);
+
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(object_class_get_name(klass));
+ info->has_abstract = info->abstract = object_class_is_abstract(klass);
+ if (parent) {
+ info->has_parent = true;
+ info->parent = g_strdup(object_class_get_name(parent));
+ }
+
+ e = g_malloc0(sizeof(*e));
+ e->value = info;
+ e->next = *pret;
+ *pret = e;
+}
+
+ObjectTypeInfoList *qmp_qom_list_types(bool has_implements,
+ const char *implements,
+ bool has_abstract,
+ bool abstract,
+ Error **errp)
+{
+ ObjectTypeInfoList *ret = NULL;
+
+ object_class_foreach(qom_list_types_tramp, implements, abstract, &ret);
+
+ return ret;
+}
+
+/* Return a DevicePropertyInfo for a qdev property.
+ *
+ * If a qdev property with the given name does not exist, use the given default
+ * type. If the qdev property info should not be shown, return NULL.
+ *
+ * The caller must free the return value.
+ */
+static ObjectPropertyInfo *make_device_property_info(ObjectClass *klass,
+ const char *name,
+ const char *default_type,
+ const char *description)
+{
+ ObjectPropertyInfo *info;
+ Property *prop;
+
+ do {
+ for (prop = DEVICE_CLASS(klass)->props; prop && prop->name; prop++) {
+ if (strcmp(name, prop->name) != 0) {
+ continue;
+ }
+
+ /*
+ * TODO Properties without a parser are just for dirty hacks.
+ * qdev_prop_ptr is the only such PropertyInfo. It's marked
+ * for removal. This conditional should be removed along with
+ * it.
+ */
+ if (!prop->info->set && !prop->info->create) {
+ return NULL; /* no way to set it, don't show */
+ }
+
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(prop->name);
+ info->type = default_type ? g_strdup(default_type)
+ : g_strdup(prop->info->name);
+ info->has_description = !!prop->info->description;
+ info->description = g_strdup(prop->info->description);
+ return info;
+ }
+ klass = object_class_get_parent(klass);
+ } while (klass != object_class_by_name(TYPE_DEVICE));
+
+ /* Not a qdev property, use the default type */
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(name);
+ info->type = g_strdup(default_type);
+ info->has_description = !!description;
+ info->description = g_strdup(description);
+
+ return info;
+}
+
+ObjectPropertyInfoList *qmp_device_list_properties(const char *typename,
+ Error **errp)
+{
+ ObjectClass *klass;
+ Object *obj;
+ ObjectProperty *prop;
+ ObjectPropertyIterator iter;
+ ObjectPropertyInfoList *prop_list = NULL;
+
+ klass = object_class_by_name(typename);
+ if (klass == NULL) {
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", typename);
+ return NULL;
+ }
+
+ klass = object_class_dynamic_cast(klass, TYPE_DEVICE);
+ if (klass == NULL) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_DEVICE);
+ return NULL;
+ }
+
+ if (object_class_is_abstract(klass)) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename",
+ "non-abstract device type");
+ return NULL;
+ }
+
+ obj = object_new(typename);
+
+ object_property_iter_init(&iter, obj);
+ while ((prop = object_property_iter_next(&iter))) {
+ ObjectPropertyInfo *info;
+ ObjectPropertyInfoList *entry;
+
+ /* Skip Object and DeviceState properties */
+ if (strcmp(prop->name, "type") == 0 ||
+ strcmp(prop->name, "realized") == 0 ||
+ strcmp(prop->name, "hotpluggable") == 0 ||
+ strcmp(prop->name, "hotplugged") == 0 ||
+ strcmp(prop->name, "parent_bus") == 0) {
+ continue;
+ }
+
+ /* Skip legacy properties since they are just string versions of
+ * properties that we already list.
+ */
+ if (strstart(prop->name, "legacy-", NULL)) {
+ continue;
+ }
+
+ info = make_device_property_info(klass, prop->name, prop->type,
+ prop->description);
+ if (!info) {
+ continue;
+ }
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = prop_list;
+ prop_list = entry;
+ }
+
+ object_unref(obj);
+
+ return prop_list;
+}
+
+ObjectPropertyInfoList *qmp_qom_list_properties(const char *typename,
+ Error **errp)
+{
+ ObjectClass *klass;
+ Object *obj = NULL;
+ ObjectProperty *prop;
+ ObjectPropertyIterator iter;
+ ObjectPropertyInfoList *prop_list = NULL;
+
+ klass = object_class_by_name(typename);
+ if (klass == NULL) {
+ error_set(errp, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Class '%s' not found", typename);
+ return NULL;
+ }
+
+ klass = object_class_dynamic_cast(klass, TYPE_OBJECT);
+ if (klass == NULL) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "typename", TYPE_OBJECT);
+ return NULL;
+ }
+
+ if (object_class_is_abstract(klass)) {
+ object_class_property_iter_init(&iter, klass);
+ } else {
+ obj = object_new(typename);
+ object_property_iter_init(&iter, obj);
+ }
+ while ((prop = object_property_iter_next(&iter))) {
+ ObjectPropertyInfo *info;
+ ObjectPropertyInfoList *entry;
+
+ info = g_malloc0(sizeof(*info));
+ info->name = g_strdup(prop->name);
+ info->type = g_strdup(prop->type);
+ info->has_description = !!prop->description;
+ info->description = g_strdup(prop->description);
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = prop_list;
+ prop_list = entry;
+ }
+
+ object_unref(obj);
+
+ return prop_list;
+}
+
+void qmp_object_add(const char *type, const char *id,
+ bool has_props, QObject *props, Error **errp)
+{
+ QDict *pdict;
+ Visitor *v;
+ Object *obj;
+
+ if (props) {
+ pdict = qobject_to(QDict, props);
+ if (!pdict) {
+ error_setg(errp, QERR_INVALID_PARAMETER_TYPE, "props", "dict");
+ return;
+ }
+ qobject_ref(pdict);
+ } else {
+ pdict = qdict_new();
+ }
+
+ v = qobject_input_visitor_new(QOBJECT(pdict));
+ obj = user_creatable_add_type(type, id, pdict, v, errp);
+ visit_free(v);
+ if (obj) {
+ object_unref(obj);
+ }
+ qobject_unref(pdict);
+}
+
+void qmp_object_del(const char *id, Error **errp)
+{
+ user_creatable_del(id, errp);
+}
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 05/17] qom: Move QMP command handlers to qom/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 05/17] qom: Move QMP command handlers to qom/ Markus Armbruster
@ 2019-06-20 8:35 ` Daniel P. Berrangé
0 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:35 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Paolo Bonzini, qemu-devel, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:38PM +0200, Markus Armbruster wrote:
> The handlers for qapi/qom.json's QMP commands are in
> monitor/qmp-cmds.c. Move them to new qom/qom-qmp-cmds.c, where they
> are covered by MAINTAINERS section QOM, just like qapi/qom.json.
>
> Move along qmp_device_list_properties() even though it's specified in
> qapi/qdev.json, because it's so similar to qmp_qom_list_properties().
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> monitor/qmp-cmds.c | 303 ------------------------------------------
> qom/Makefile.objs | 1 +
> qom/qom-qmp-cmds.c | 323 +++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 324 insertions(+), 303 deletions(-)
> create mode 100644 qom/qom-qmp-cmds.c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 06/17] qom: Move HMP command handlers to qom/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (4 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 05/17] qom: Move QMP command handlers to qom/ Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:39 ` Daniel P. Berrangé
` (2 more replies)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core Markus Armbruster
` (10 subsequent siblings)
16 siblings, 3 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel
Cc: kwolf, Daniel P. Berrange, Eduardo Habkost,
Dr. David Alan Gilbert, Paolo Bonzini
There are just two HMP commands related to QOM: qom-list and qom-set.
Move their handlers from monitor/hmp-cmds.c to new qom/qom-hmp-cmds.c,
where they are covered by MAINTAINERS section QOM.
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
include/monitor/hmp.h | 2 ++
monitor/hmp-cmds.c | 50 +---------------------------------
qom/Makefile.objs | 2 +-
qom/qom-hmp-cmds.c | 62 +++++++++++++++++++++++++++++++++++++++++++
4 files changed, 66 insertions(+), 50 deletions(-)
create mode 100644 qom/qom-hmp-cmds.c
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 1d095d5837..f46ccdaa35 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -16,6 +16,8 @@
#include "qemu/readline.h"
+void hmp_handle_error(Monitor *mon, Error **errp);
+
void hmp_info_name(Monitor *mon, const QDict *qdict);
void hmp_info_version(Monitor *mon, const QDict *qdict);
void hmp_info_kvm(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index d94ab7563e..5641036dc3 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -60,7 +60,7 @@
#include <spice/enums.h>
#endif
-static void hmp_handle_error(Monitor *mon, Error **errp)
+void hmp_handle_error(Monitor *mon, Error **errp)
{
assert(errp);
if (*errp) {
@@ -2714,54 +2714,6 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
qapi_free_IOThreadInfoList(info_list);
}
-void hmp_qom_list(Monitor *mon, const QDict *qdict)
-{
- const char *path = qdict_get_try_str(qdict, "path");
- ObjectPropertyInfoList *list;
- Error *err = NULL;
-
- if (path == NULL) {
- monitor_printf(mon, "/\n");
- return;
- }
-
- list = qmp_qom_list(path, &err);
- if (err == NULL) {
- ObjectPropertyInfoList *start = list;
- while (list != NULL) {
- ObjectPropertyInfo *value = list->value;
-
- monitor_printf(mon, "%s (%s)\n",
- value->name, value->type);
- list = list->next;
- }
- qapi_free_ObjectPropertyInfoList(start);
- }
- hmp_handle_error(mon, &err);
-}
-
-void hmp_qom_set(Monitor *mon, const QDict *qdict)
-{
- const char *path = qdict_get_str(qdict, "path");
- const char *property = qdict_get_str(qdict, "property");
- const char *value = qdict_get_str(qdict, "value");
- Error *err = NULL;
- bool ambiguous = false;
- Object *obj;
-
- obj = object_resolve_path(path, &ambiguous);
- if (obj == NULL) {
- error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
- "Device '%s' not found", path);
- } else {
- if (ambiguous) {
- monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
- }
- object_property_parse(obj, value, property, &err);
- }
- hmp_handle_error(mon, &err);
-}
-
void hmp_rocker(Monitor *mon, const QDict *qdict)
{
const char *name = qdict_get_str(qdict, "name");
diff --git a/qom/Makefile.objs b/qom/Makefile.objs
index 5fb43b842c..aae478fc21 100644
--- a/qom/Makefile.objs
+++ b/qom/Makefile.objs
@@ -2,4 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o
qom-obj-y += object_interfaces.o
common-obj-y = cpu.o
-common-obj-$(CONFIG_SOFTMMU) += qom-qmp-cmds.o
+common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o
diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c
new file mode 100644
index 0000000000..2028a21052
--- /dev/null
+++ b/qom/qom-hmp-cmds.c
@@ -0,0 +1,62 @@
+/*
+ * HMP commands related to QOM
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or
+ * later. See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/hmp.h"
+#include "qapi/qapi-commands-qom.h"
+#include "qapi/qmp/qdict.h"
+#include "monitor/monitor.h"
+#include "qom/object.h"
+#include "qapi/error.h"
+
+void hmp_qom_list(Monitor *mon, const QDict *qdict)
+{
+ const char *path = qdict_get_try_str(qdict, "path");
+ ObjectPropertyInfoList *list;
+ Error *err = NULL;
+
+ if (path == NULL) {
+ monitor_printf(mon, "/\n");
+ return;
+ }
+
+ list = qmp_qom_list(path, &err);
+ if (err == NULL) {
+ ObjectPropertyInfoList *start = list;
+ while (list != NULL) {
+ ObjectPropertyInfo *value = list->value;
+
+ monitor_printf(mon, "%s (%s)\n",
+ value->name, value->type);
+ list = list->next;
+ }
+ qapi_free_ObjectPropertyInfoList(start);
+ }
+ hmp_handle_error(mon, &err);
+}
+
+void hmp_qom_set(Monitor *mon, const QDict *qdict)
+{
+ const char *path = qdict_get_str(qdict, "path");
+ const char *property = qdict_get_str(qdict, "property");
+ const char *value = qdict_get_str(qdict, "value");
+ Error *err = NULL;
+ bool ambiguous = false;
+ Object *obj;
+
+ obj = object_resolve_path(path, &ambiguous);
+ if (obj == NULL) {
+ error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
+ "Device '%s' not found", path);
+ } else {
+ if (ambiguous) {
+ monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
+ }
+ object_property_parse(obj, value, property, &err);
+ }
+ hmp_handle_error(mon, &err);
+}
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 06/17] qom: Move HMP command handlers to qom/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 06/17] qom: Move HMP " Markus Armbruster
@ 2019-06-20 8:39 ` Daniel P. Berrangé
2019-06-20 9:51 ` Dr. David Alan Gilbert
2019-07-02 5:08 ` Markus Armbruster
2 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:39 UTC (permalink / raw)
To: Markus Armbruster
Cc: kwolf, Eduardo Habkost, qemu-devel, Dr. David Alan Gilbert,
Paolo Bonzini
On Wed, Jun 19, 2019 at 10:10:39PM +0200, Markus Armbruster wrote:
> There are just two HMP commands related to QOM: qom-list and qom-set.
> Move their handlers from monitor/hmp-cmds.c to new qom/qom-hmp-cmds.c,
> where they are covered by MAINTAINERS section QOM.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> include/monitor/hmp.h | 2 ++
> monitor/hmp-cmds.c | 50 +---------------------------------
> qom/Makefile.objs | 2 +-
> qom/qom-hmp-cmds.c | 62 +++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 66 insertions(+), 50 deletions(-)
> create mode 100644 qom/qom-hmp-cmds.c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 06/17] qom: Move HMP command handlers to qom/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 06/17] qom: Move HMP " Markus Armbruster
2019-06-20 8:39 ` Daniel P. Berrangé
@ 2019-06-20 9:51 ` Dr. David Alan Gilbert
2019-07-02 5:08 ` Markus Armbruster
2 siblings, 0 replies; 57+ messages in thread
From: Dr. David Alan Gilbert @ 2019-06-20 9:51 UTC (permalink / raw)
To: Markus Armbruster
Cc: kwolf, Daniel P. Berrange, Eduardo Habkost, qemu-devel, Paolo Bonzini
* Markus Armbruster (armbru@redhat.com) wrote:
> There are just two HMP commands related to QOM: qom-list and qom-set.
> Move their handlers from monitor/hmp-cmds.c to new qom/qom-hmp-cmds.c,
> where they are covered by MAINTAINERS section QOM.
>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
I look forward to those gaining the qom_get at some stage!
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> include/monitor/hmp.h | 2 ++
> monitor/hmp-cmds.c | 50 +---------------------------------
> qom/Makefile.objs | 2 +-
> qom/qom-hmp-cmds.c | 62 +++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 66 insertions(+), 50 deletions(-)
> create mode 100644 qom/qom-hmp-cmds.c
>
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 1d095d5837..f46ccdaa35 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -16,6 +16,8 @@
>
> #include "qemu/readline.h"
>
> +void hmp_handle_error(Monitor *mon, Error **errp);
> +
> void hmp_info_name(Monitor *mon, const QDict *qdict);
> void hmp_info_version(Monitor *mon, const QDict *qdict);
> void hmp_info_kvm(Monitor *mon, const QDict *qdict);
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index d94ab7563e..5641036dc3 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -60,7 +60,7 @@
> #include <spice/enums.h>
> #endif
>
> -static void hmp_handle_error(Monitor *mon, Error **errp)
> +void hmp_handle_error(Monitor *mon, Error **errp)
> {
> assert(errp);
> if (*errp) {
> @@ -2714,54 +2714,6 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
> qapi_free_IOThreadInfoList(info_list);
> }
>
> -void hmp_qom_list(Monitor *mon, const QDict *qdict)
> -{
> - const char *path = qdict_get_try_str(qdict, "path");
> - ObjectPropertyInfoList *list;
> - Error *err = NULL;
> -
> - if (path == NULL) {
> - monitor_printf(mon, "/\n");
> - return;
> - }
> -
> - list = qmp_qom_list(path, &err);
> - if (err == NULL) {
> - ObjectPropertyInfoList *start = list;
> - while (list != NULL) {
> - ObjectPropertyInfo *value = list->value;
> -
> - monitor_printf(mon, "%s (%s)\n",
> - value->name, value->type);
> - list = list->next;
> - }
> - qapi_free_ObjectPropertyInfoList(start);
> - }
> - hmp_handle_error(mon, &err);
> -}
> -
> -void hmp_qom_set(Monitor *mon, const QDict *qdict)
> -{
> - const char *path = qdict_get_str(qdict, "path");
> - const char *property = qdict_get_str(qdict, "property");
> - const char *value = qdict_get_str(qdict, "value");
> - Error *err = NULL;
> - bool ambiguous = false;
> - Object *obj;
> -
> - obj = object_resolve_path(path, &ambiguous);
> - if (obj == NULL) {
> - error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
> - "Device '%s' not found", path);
> - } else {
> - if (ambiguous) {
> - monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
> - }
> - object_property_parse(obj, value, property, &err);
> - }
> - hmp_handle_error(mon, &err);
> -}
> -
> void hmp_rocker(Monitor *mon, const QDict *qdict)
> {
> const char *name = qdict_get_str(qdict, "name");
> diff --git a/qom/Makefile.objs b/qom/Makefile.objs
> index 5fb43b842c..aae478fc21 100644
> --- a/qom/Makefile.objs
> +++ b/qom/Makefile.objs
> @@ -2,4 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o
> qom-obj-y += object_interfaces.o
>
> common-obj-y = cpu.o
> -common-obj-$(CONFIG_SOFTMMU) += qom-qmp-cmds.o
> +common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o
> diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c
> new file mode 100644
> index 0000000000..2028a21052
> --- /dev/null
> +++ b/qom/qom-hmp-cmds.c
> @@ -0,0 +1,62 @@
> +/*
> + * HMP commands related to QOM
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> + * later. See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "monitor/hmp.h"
> +#include "qapi/qapi-commands-qom.h"
> +#include "qapi/qmp/qdict.h"
> +#include "monitor/monitor.h"
> +#include "qom/object.h"
> +#include "qapi/error.h"
> +
> +void hmp_qom_list(Monitor *mon, const QDict *qdict)
> +{
> + const char *path = qdict_get_try_str(qdict, "path");
> + ObjectPropertyInfoList *list;
> + Error *err = NULL;
> +
> + if (path == NULL) {
> + monitor_printf(mon, "/\n");
> + return;
> + }
> +
> + list = qmp_qom_list(path, &err);
> + if (err == NULL) {
> + ObjectPropertyInfoList *start = list;
> + while (list != NULL) {
> + ObjectPropertyInfo *value = list->value;
> +
> + monitor_printf(mon, "%s (%s)\n",
> + value->name, value->type);
> + list = list->next;
> + }
> + qapi_free_ObjectPropertyInfoList(start);
> + }
> + hmp_handle_error(mon, &err);
> +}
> +
> +void hmp_qom_set(Monitor *mon, const QDict *qdict)
> +{
> + const char *path = qdict_get_str(qdict, "path");
> + const char *property = qdict_get_str(qdict, "property");
> + const char *value = qdict_get_str(qdict, "value");
> + Error *err = NULL;
> + bool ambiguous = false;
> + Object *obj;
> +
> + obj = object_resolve_path(path, &ambiguous);
> + if (obj == NULL) {
> + error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
> + "Device '%s' not found", path);
> + } else {
> + if (ambiguous) {
> + monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
> + }
> + object_property_parse(obj, value, property, &err);
> + }
> + hmp_handle_error(mon, &err);
> +}
> --
> 2.21.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 06/17] qom: Move HMP command handlers to qom/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 06/17] qom: Move HMP " Markus Armbruster
2019-06-20 8:39 ` Daniel P. Berrangé
2019-06-20 9:51 ` Dr. David Alan Gilbert
@ 2019-07-02 5:08 ` Markus Armbruster
2 siblings, 0 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-07-02 5:08 UTC (permalink / raw)
To: qemu-devel
Cc: kwolf, Daniel P. Berrange, Eduardo Habkost,
Dr. David Alan Gilbert, Paolo Bonzini
Markus Armbruster <armbru@redhat.com> writes:
> There are just two HMP commands related to QOM: qom-list and qom-set.
> Move their handlers from monitor/hmp-cmds.c to new qom/qom-hmp-cmds.c,
> where they are covered by MAINTAINERS section QOM.
Actually three: hmp_info_qom_tree(). I'm squashing the obvious movement
into this patch (appended), updating the commit message to
Move the HMP command handlers related to QOM handlers from
monitor/hmp-cmds.c and qdev-monitor.c to new qom/qom-hmp-cmds.c, where
they are covered by MAINTAINERS section QOM.
Hope that's okay.
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: "Daniel P. Berrange" <berrange@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> include/monitor/hmp.h | 2 ++
> monitor/hmp-cmds.c | 50 +---------------------------------
> qom/Makefile.objs | 2 +-
> qom/qom-hmp-cmds.c | 62 +++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 66 insertions(+), 50 deletions(-)
> create mode 100644 qom/qom-hmp-cmds.c
>
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index 1d095d5837..f46ccdaa35 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -16,6 +16,8 @@
>
> #include "qemu/readline.h"
>
> +void hmp_handle_error(Monitor *mon, Error **errp);
> +
> void hmp_info_name(Monitor *mon, const QDict *qdict);
> void hmp_info_version(Monitor *mon, const QDict *qdict);
> void hmp_info_kvm(Monitor *mon, const QDict *qdict);
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index d94ab7563e..5641036dc3 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -60,7 +60,7 @@
> #include <spice/enums.h>
> #endif
>
> -static void hmp_handle_error(Monitor *mon, Error **errp)
> +void hmp_handle_error(Monitor *mon, Error **errp)
> {
> assert(errp);
> if (*errp) {
> @@ -2714,54 +2714,6 @@ void hmp_info_iothreads(Monitor *mon, const QDict *qdict)
> qapi_free_IOThreadInfoList(info_list);
> }
>
> -void hmp_qom_list(Monitor *mon, const QDict *qdict)
> -{
> - const char *path = qdict_get_try_str(qdict, "path");
> - ObjectPropertyInfoList *list;
> - Error *err = NULL;
> -
> - if (path == NULL) {
> - monitor_printf(mon, "/\n");
> - return;
> - }
> -
> - list = qmp_qom_list(path, &err);
> - if (err == NULL) {
> - ObjectPropertyInfoList *start = list;
> - while (list != NULL) {
> - ObjectPropertyInfo *value = list->value;
> -
> - monitor_printf(mon, "%s (%s)\n",
> - value->name, value->type);
> - list = list->next;
> - }
> - qapi_free_ObjectPropertyInfoList(start);
> - }
> - hmp_handle_error(mon, &err);
> -}
> -
> -void hmp_qom_set(Monitor *mon, const QDict *qdict)
> -{
> - const char *path = qdict_get_str(qdict, "path");
> - const char *property = qdict_get_str(qdict, "property");
> - const char *value = qdict_get_str(qdict, "value");
> - Error *err = NULL;
> - bool ambiguous = false;
> - Object *obj;
> -
> - obj = object_resolve_path(path, &ambiguous);
> - if (obj == NULL) {
> - error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
> - "Device '%s' not found", path);
> - } else {
> - if (ambiguous) {
> - monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
> - }
> - object_property_parse(obj, value, property, &err);
> - }
> - hmp_handle_error(mon, &err);
> -}
> -
> void hmp_rocker(Monitor *mon, const QDict *qdict)
> {
> const char *name = qdict_get_str(qdict, "name");
> diff --git a/qom/Makefile.objs b/qom/Makefile.objs
> index 5fb43b842c..aae478fc21 100644
> --- a/qom/Makefile.objs
> +++ b/qom/Makefile.objs
> @@ -2,4 +2,4 @@ qom-obj-y = object.o container.o qom-qobject.o
> qom-obj-y += object_interfaces.o
>
> common-obj-y = cpu.o
> -common-obj-$(CONFIG_SOFTMMU) += qom-qmp-cmds.o
> +common-obj-$(CONFIG_SOFTMMU) += qom-hmp-cmds.o qom-qmp-cmds.o
> diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c
> new file mode 100644
> index 0000000000..2028a21052
> --- /dev/null
> +++ b/qom/qom-hmp-cmds.c
> @@ -0,0 +1,62 @@
> +/*
> + * HMP commands related to QOM
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or
> + * later. See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "monitor/hmp.h"
> +#include "qapi/qapi-commands-qom.h"
> +#include "qapi/qmp/qdict.h"
> +#include "monitor/monitor.h"
> +#include "qom/object.h"
> +#include "qapi/error.h"
> +
> +void hmp_qom_list(Monitor *mon, const QDict *qdict)
> +{
> + const char *path = qdict_get_try_str(qdict, "path");
> + ObjectPropertyInfoList *list;
> + Error *err = NULL;
> +
> + if (path == NULL) {
> + monitor_printf(mon, "/\n");
> + return;
> + }
> +
> + list = qmp_qom_list(path, &err);
> + if (err == NULL) {
> + ObjectPropertyInfoList *start = list;
> + while (list != NULL) {
> + ObjectPropertyInfo *value = list->value;
> +
> + monitor_printf(mon, "%s (%s)\n",
> + value->name, value->type);
> + list = list->next;
> + }
> + qapi_free_ObjectPropertyInfoList(start);
> + }
> + hmp_handle_error(mon, &err);
> +}
> +
> +void hmp_qom_set(Monitor *mon, const QDict *qdict)
> +{
> + const char *path = qdict_get_str(qdict, "path");
> + const char *property = qdict_get_str(qdict, "property");
> + const char *value = qdict_get_str(qdict, "value");
> + Error *err = NULL;
> + bool ambiguous = false;
> + Object *obj;
> +
> + obj = object_resolve_path(path, &ambiguous);
> + if (obj == NULL) {
> + error_set(&err, ERROR_CLASS_DEVICE_NOT_FOUND,
> + "Device '%s' not found", path);
> + } else {
> + if (ambiguous) {
> + monitor_printf(mon, "Warning: Path '%s' is ambiguous\n", path);
> + }
> + object_property_parse(obj, value, property, &err);
> + }
> + hmp_handle_error(mon, &err);
> +}
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 9d558e9d78..a0e9511440 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -121,6 +121,7 @@ void hmp_info_numa(Monitor *mon, const QDict *qdict);
void hmp_info_memory_devices(Monitor *mon, const QDict *qdict);
void hmp_qom_list(Monitor *mon, const QDict *qdict);
void hmp_qom_set(Monitor *mon, const QDict *qdict);
+void hmp_info_qom_tree(Monitor *mon, const QDict *dict);
void object_add_completion(ReadLineState *rs, int nb_args, const char *str);
void object_del_completion(ReadLineState *rs, int nb_args, const char *str);
void device_add_completion(ReadLineState *rs, int nb_args, const char *str);
diff --git a/include/monitor/qdev.h b/include/monitor/qdev.h
index 0ff3331284..084799e4d9 100644
--- a/include/monitor/qdev.h
+++ b/include/monitor/qdev.h
@@ -7,7 +7,6 @@
void hmp_info_qtree(Monitor *mon, const QDict *qdict);
void hmp_info_qdm(Monitor *mon, const QDict *qdict);
-void hmp_info_qom_tree(Monitor *mon, const QDict *dict);
void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp);
int qdev_device_help(QemuOpts *opts);
diff --git a/qdev-monitor.c b/qdev-monitor.c
index 63a87e9632..58222c2211 100644
--- a/qdev-monitor.c
+++ b/qdev-monitor.c
@@ -739,63 +739,6 @@ void hmp_info_qdm(Monitor *mon, const QDict *qdict)
qdev_print_devinfos(true);
}
-typedef struct QOMCompositionState {
- Monitor *mon;
- int indent;
-} QOMCompositionState;
-
-static void print_qom_composition(Monitor *mon, Object *obj, int indent);
-
-static int print_qom_composition_child(Object *obj, void *opaque)
-{
- QOMCompositionState *s = opaque;
-
- print_qom_composition(s->mon, obj, s->indent);
-
- return 0;
-}
-
-static void print_qom_composition(Monitor *mon, Object *obj, int indent)
-{
- QOMCompositionState s = {
- .mon = mon,
- .indent = indent + 2,
- };
- char *name;
-
- if (obj == object_get_root()) {
- name = g_strdup("");
- } else {
- name = object_get_canonical_path_component(obj);
- }
- monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name,
- object_get_typename(obj));
- g_free(name);
- object_child_foreach(obj, print_qom_composition_child, &s);
-}
-
-void hmp_info_qom_tree(Monitor *mon, const QDict *dict)
-{
- const char *path = qdict_get_try_str(dict, "path");
- Object *obj;
- bool ambiguous = false;
-
- if (path) {
- obj = object_resolve_path(path, &ambiguous);
- if (!obj) {
- monitor_printf(mon, "Path '%s' could not be resolved.\n", path);
- return;
- }
- if (ambiguous) {
- monitor_printf(mon, "Warning: Path '%s' is ambiguous.\n", path);
- return;
- }
- } else {
- obj = qdev_get_machine();
- }
- print_qom_composition(mon, obj, 0);
-}
-
void qmp_device_add(QDict *qdict, QObject **ret_data, Error **errp)
{
Error *local_err = NULL;
diff --git a/qom/qom-hmp-cmds.c b/qom/qom-hmp-cmds.c
index 2028a21052..a268e01eb4 100644
--- a/qom/qom-hmp-cmds.c
+++ b/qom/qom-hmp-cmds.c
@@ -6,12 +6,13 @@
*/
#include "qemu/osdep.h"
+#include "hw/qdev-core.h"
#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "qapi/error.h"
#include "qapi/qapi-commands-qom.h"
#include "qapi/qmp/qdict.h"
-#include "monitor/monitor.h"
#include "qom/object.h"
-#include "qapi/error.h"
void hmp_qom_list(Monitor *mon, const QDict *qdict)
{
@@ -60,3 +61,60 @@ void hmp_qom_set(Monitor *mon, const QDict *qdict)
}
hmp_handle_error(mon, &err);
}
+
+typedef struct QOMCompositionState {
+ Monitor *mon;
+ int indent;
+} QOMCompositionState;
+
+static void print_qom_composition(Monitor *mon, Object *obj, int indent);
+
+static int print_qom_composition_child(Object *obj, void *opaque)
+{
+ QOMCompositionState *s = opaque;
+
+ print_qom_composition(s->mon, obj, s->indent);
+
+ return 0;
+}
+
+static void print_qom_composition(Monitor *mon, Object *obj, int indent)
+{
+ QOMCompositionState s = {
+ .mon = mon,
+ .indent = indent + 2,
+ };
+ char *name;
+
+ if (obj == object_get_root()) {
+ name = g_strdup("");
+ } else {
+ name = object_get_canonical_path_component(obj);
+ }
+ monitor_printf(mon, "%*s/%s (%s)\n", indent, "", name,
+ object_get_typename(obj));
+ g_free(name);
+ object_child_foreach(obj, print_qom_composition_child, &s);
+}
+
+void hmp_info_qom_tree(Monitor *mon, const QDict *dict)
+{
+ const char *path = qdict_get_try_str(dict, "path");
+ Object *obj;
+ bool ambiguous = false;
+
+ if (path) {
+ obj = object_resolve_path(path, &ambiguous);
+ if (!obj) {
+ monitor_printf(mon, "Path '%s' could not be resolved.\n", path);
+ return;
+ }
+ if (ambiguous) {
+ monitor_printf(mon, "Warning: Path '%s' is ambiguous.\n", path);
+ return;
+ }
+ } else {
+ obj = qdev_get_machine();
+ }
+ print_qom_composition(mon, obj, 0);
+}
^ permalink raw reply related [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (5 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 06/17] qom: Move HMP " Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:41 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 08/17] qapi: Split machine.json off misc.json Markus Armbruster
` (9 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Paolo Bonzini, Eduardo Habkost
Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index 1aef0afaf7..f18fddbbbb 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1268,8 +1268,12 @@ S: Supported
F: hw/core/machine.c
F: hw/core/null-machine.c
F: hw/cpu/cluster.c
+F: numa.c
+F: qom/cpu.c
F: include/hw/boards.h
F: include/hw/cpu/cluster.h
+F: include/qom/cpu.h
+F: include/sysemu/numa.h
T: git https://github.com/ehabkost/qemu.git machine-next
Xtensa Machines
@@ -1833,11 +1837,6 @@ M: Markus Armbruster <armbru@redhat.com>
S: Supported
F: scripts/coverity-model.c
-CPU
-S: Supported
-F: qom/cpu.c
-F: include/qom/cpu.h
-
Device Tree
M: Alistair Francis <alistair.francis@wdc.com>
R: David Gibson <david@gibson.dropbear.id.au>
@@ -1945,13 +1944,6 @@ W: http://info.iet.unipi.it/~luigi/netmap/
S: Maintained
F: net/netmap.c
-NUMA
-M: Eduardo Habkost <ehabkost@redhat.com>
-S: Maintained
-F: numa.c
-F: include/sysemu/numa.h
-T: git https://github.com/ehabkost/qemu.git machine-next
-
Host Memory Backends
M: Eduardo Habkost <ehabkost@redhat.com>
M: Igor Mammedov <imammedo@redhat.com>
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core
2019-06-19 20:10 ` [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core Markus Armbruster
@ 2019-06-20 8:41 ` Daniel P. Berrangé
2019-06-24 11:22 ` Markus Armbruster
0 siblings, 1 reply; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:41 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Paolo Bonzini, qemu-devel, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:40PM +0200, Markus Armbruster wrote:
> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 16 ++++------------
> 1 file changed, 4 insertions(+), 12 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1aef0afaf7..f18fddbbbb 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1268,8 +1268,12 @@ S: Supported
> F: hw/core/machine.c
> F: hw/core/null-machine.c
> F: hw/cpu/cluster.c
> +F: numa.c
> +F: qom/cpu.c
Not a blocker for this patch, but as a later patch, I'd encourage you to
move qom/cpu.c somewhere else. Pretty much anywhere else would be better
than under qom/ IMHO :-)
> F: include/hw/boards.h
> F: include/hw/cpu/cluster.h
> +F: include/qom/cpu.h
Likewise
> +F: include/sysemu/numa.h
> T: git https://github.com/ehabkost/qemu.git machine-next
>
> Xtensa Machines
> @@ -1833,11 +1837,6 @@ M: Markus Armbruster <armbru@redhat.com>
> S: Supported
> F: scripts/coverity-model.c
>
> -CPU
> -S: Supported
> -F: qom/cpu.c
> -F: include/qom/cpu.h
> -
> Device Tree
> M: Alistair Francis <alistair.francis@wdc.com>
> R: David Gibson <david@gibson.dropbear.id.au>
> @@ -1945,13 +1944,6 @@ W: http://info.iet.unipi.it/~luigi/netmap/
> S: Maintained
> F: net/netmap.c
>
> -NUMA
> -M: Eduardo Habkost <ehabkost@redhat.com>
> -S: Maintained
> -F: numa.c
> -F: include/sysemu/numa.h
> -T: git https://github.com/ehabkost/qemu.git machine-next
> -
> Host Memory Backends
> M: Eduardo Habkost <ehabkost@redhat.com>
> M: Igor Mammedov <imammedo@redhat.com>
> --
> 2.21.0
>
>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core
2019-06-20 8:41 ` Daniel P. Berrangé
@ 2019-06-24 11:22 ` Markus Armbruster
2019-07-08 22:54 ` Eduardo Habkost
0 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-24 11:22 UTC (permalink / raw)
To: Daniel P. Berrangé; +Cc: kwolf, Paolo Bonzini, qemu-devel, Eduardo Habkost
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Wed, Jun 19, 2019 at 10:10:40PM +0200, Markus Armbruster wrote:
>> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> MAINTAINERS | 16 ++++------------
>> 1 file changed, 4 insertions(+), 12 deletions(-)
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 1aef0afaf7..f18fddbbbb 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1268,8 +1268,12 @@ S: Supported
>> F: hw/core/machine.c
>> F: hw/core/null-machine.c
>> F: hw/cpu/cluster.c
>> +F: numa.c
>> +F: qom/cpu.c
>
> Not a blocker for this patch, but as a later patch, I'd encourage you to
> move qom/cpu.c somewhere else. Pretty much anywhere else would be better
> than under qom/ IMHO :-)
Eduardo, any ideas?
>> F: include/hw/boards.h
>> F: include/hw/cpu/cluster.h
>> +F: include/qom/cpu.h
>
> Likewise
>
>> +F: include/sysemu/numa.h
>> T: git https://github.com/ehabkost/qemu.git machine-next
>>
>> Xtensa Machines
[...]
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core
2019-06-24 11:22 ` Markus Armbruster
@ 2019-07-08 22:54 ` Eduardo Habkost
2019-07-09 6:36 ` Markus Armbruster
0 siblings, 1 reply; 57+ messages in thread
From: Eduardo Habkost @ 2019-07-08 22:54 UTC (permalink / raw)
To: Markus Armbruster
Cc: kwolf, Paolo Bonzini, Daniel P. Berrangé, qemu-devel
On Mon, Jun 24, 2019 at 01:22:07PM +0200, Markus Armbruster wrote:
> Daniel P. Berrangé <berrange@redhat.com> writes:
>
> > On Wed, Jun 19, 2019 at 10:10:40PM +0200, Markus Armbruster wrote:
> >> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
> >> Cc: Eduardo Habkost <ehabkost@redhat.com>
> >> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> >> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> >> ---
> >> MAINTAINERS | 16 ++++------------
> >> 1 file changed, 4 insertions(+), 12 deletions(-)
> >
> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> >
> >>
> >> diff --git a/MAINTAINERS b/MAINTAINERS
> >> index 1aef0afaf7..f18fddbbbb 100644
> >> --- a/MAINTAINERS
> >> +++ b/MAINTAINERS
> >> @@ -1268,8 +1268,12 @@ S: Supported
> >> F: hw/core/machine.c
> >> F: hw/core/null-machine.c
> >> F: hw/cpu/cluster.c
> >> +F: numa.c
> >> +F: qom/cpu.c
> >
> > Not a blocker for this patch, but as a later patch, I'd encourage you to
> > move qom/cpu.c somewhere else. Pretty much anywhere else would be better
> > than under qom/ IMHO :-)
>
> Eduardo, any ideas?
Sorry for the late reply. I suggest hw/core/cpu.c.
--
Eduardo
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core
2019-07-08 22:54 ` Eduardo Habkost
@ 2019-07-09 6:36 ` Markus Armbruster
0 siblings, 0 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-07-09 6:36 UTC (permalink / raw)
To: Eduardo Habkost; +Cc: kwolf, Paolo Bonzini, Daniel P. Berrangé, qemu-devel
Eduardo Habkost <ehabkost@redhat.com> writes:
> On Mon, Jun 24, 2019 at 01:22:07PM +0200, Markus Armbruster wrote:
>> Daniel P. Berrangé <berrange@redhat.com> writes:
>>
>> > On Wed, Jun 19, 2019 at 10:10:40PM +0200, Markus Armbruster wrote:
>> >> Suggested-by: Paolo Bonzini <pbonzini@redhat.com>
>> >> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> >> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> >> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> >> ---
>> >> MAINTAINERS | 16 ++++------------
>> >> 1 file changed, 4 insertions(+), 12 deletions(-)
>> >
>> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
>> >
>> >>
>> >> diff --git a/MAINTAINERS b/MAINTAINERS
>> >> index 1aef0afaf7..f18fddbbbb 100644
>> >> --- a/MAINTAINERS
>> >> +++ b/MAINTAINERS
>> >> @@ -1268,8 +1268,12 @@ S: Supported
>> >> F: hw/core/machine.c
>> >> F: hw/core/null-machine.c
>> >> F: hw/cpu/cluster.c
>> >> +F: numa.c
>> >> +F: qom/cpu.c
>> >
>> > Not a blocker for this patch, but as a later patch, I'd encourage you to
>> > move qom/cpu.c somewhere else. Pretty much anywhere else would be better
>> > than under qom/ IMHO :-)
>>
>> Eduardo, any ideas?
>
> Sorry for the late reply. I suggest hw/core/cpu.c.
Can do. Also: include/qom/cpu.h -> include/hw/core/cpu.h.
There's also hw/cpu/ and include/hw/cpu/. I presume they are less
suited than hw/core and include/hw/core/.
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 08/17] qapi: Split machine.json off misc.json
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (6 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 07/17] MAINTAINERS: Merge sections CPU, NUMA into Machine core Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:45 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 09/17] hw/core: Move numa.c to hw/core/ Markus Armbruster
` (8 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Eduardo Habkost
Move commands cpu-add, query-cpus, query-cpus-fast,
query-current-machine, query-hotpluggable-cpus, query-machines,
query-memdev, and set-numa-node with their types from misc.json to new
machine.json. Also move types X86CPURegister32 and
X86CPUFeatureWordInfo. Add machine.json to MAINTAINERS section
"Machine core".
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 1 +
cpus.c | 1 +
include/hw/boards.h | 1 +
include/sysemu/hostmem.h | 2 +-
monitor/hmp-cmds.c | 1 +
monitor/qmp-cmds.c | 1 +
numa.c | 4 +-
qapi/Makefile.objs | 2 +-
qapi/machine.json | 697 +++++++++++++++++++++++++++++++++++++++
qapi/misc.json | 687 --------------------------------------
qapi/qapi-schema.json | 1 +
target/i386/cpu.c | 2 +-
target/s390x/cpu.c | 2 +-
target/s390x/sigp.c | 2 +-
vl.c | 2 +-
15 files changed, 711 insertions(+), 695 deletions(-)
create mode 100644 qapi/machine.json
diff --git a/MAINTAINERS b/MAINTAINERS
index f18fddbbbb..9b488c5151 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1269,6 +1269,7 @@ F: hw/core/machine.c
F: hw/core/null-machine.c
F: hw/cpu/cluster.c
F: numa.c
+F: qapi/machine.json
F: qom/cpu.c
F: include/hw/boards.h
F: include/hw/cpu/cluster.h
diff --git a/cpus.c b/cpus.c
index dde3b7b981..f5e677b2c4 100644
--- a/cpus.c
+++ b/cpus.c
@@ -28,6 +28,7 @@
#include "cpu.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
+#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-events-run-state.h"
#include "qapi/qmp/qerror.h"
diff --git a/include/hw/boards.h b/include/hw/boards.h
index b7362af3f1..0c1cc510b5 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -6,6 +6,7 @@
#include "sysemu/blockdev.h"
#include "sysemu/accel.h"
#include "hw/qdev.h"
+#include "qapi/qapi-types-machine.h"
#include "qemu/module.h"
#include "qom/object.h"
#include "qom/cpu.h"
diff --git a/include/sysemu/hostmem.h b/include/sysemu/hostmem.h
index a023b372a4..92fa0e458c 100644
--- a/include/sysemu/hostmem.h
+++ b/include/sysemu/hostmem.h
@@ -14,7 +14,7 @@
#define SYSEMU_HOSTMEM_H
#include "sysemu/sysemu.h" /* for MAX_NODES */
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-machine.h"
#include "qom/object.h"
#include "exec/memory.h"
#include "qemu/bitmap.h"
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 5641036dc3..789f763938 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -31,6 +31,7 @@
#include "qapi/qapi-builtin-visit.h"
#include "qapi/qapi-commands-block.h"
#include "qapi/qapi-commands-char.h"
+#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-net.h"
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 884eeaab80..58b54db033 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -31,6 +31,7 @@
#include "sysemu/block-backend.h"
#include "qapi/error.h"
#include "qapi/qapi-commands-block-core.h"
+#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qerror.h"
diff --git a/numa.c b/numa.c
index 955ec0c830..6f85407c46 100644
--- a/numa.c
+++ b/numa.c
@@ -31,8 +31,8 @@
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
-#include "qapi/qapi-commands-misc.h"
-#include "qapi/qapi-visit-misc.h"
+#include "qapi/qapi-commands-machine.h"
+#include "qapi/qapi-visit-machine.h"
#include "hw/boards.h"
#include "sysemu/hostmem.h"
#include "hw/mem/pc-dimm.h"
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 40b1dcffc4..01dced01aa 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -6,7 +6,7 @@ util-obj-y += qmp-event.o
util-obj-y += qapi-util.o
QAPI_COMMON_MODULES = audio authz block-core block char common crypto
-QAPI_COMMON_MODULES += introspect job migration misc net
+QAPI_COMMON_MODULES += introspect job machine migration misc net
QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
QAPI_COMMON_MODULES += trace transaction ui
QAPI_TARGET_MODULES = target
diff --git a/qapi/machine.json b/qapi/machine.json
new file mode 100644
index 0000000000..81849acb3a
--- /dev/null
+++ b/qapi/machine.json
@@ -0,0 +1,697 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Machines
+##
+
+{ 'include': 'common.json' }
+
+##
+# @CpuInfoArch:
+#
+# An enumeration of cpu types that enable additional information during
+# @query-cpus and @query-cpus-fast.
+#
+# @s390: since 2.12
+#
+# @riscv: since 2.12
+#
+# Since: 2.6
+##
+{ 'enum': 'CpuInfoArch',
+ 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] }
+
+##
+# @CpuInfo:
+#
+# Information about a virtual CPU
+#
+# @CPU: the index of the virtual CPU
+#
+# @current: this only exists for backwards compatibility and should be ignored
+#
+# @halted: true if the virtual CPU is in the halt state. Halt usually refers
+# to a processor specific low power mode.
+#
+# @qom_path: path to the CPU object in the QOM tree (since 2.4)
+#
+# @thread_id: ID of the underlying host thread
+#
+# @props: properties describing to which node/socket/core/thread
+# virtual CPU belongs to, provided if supported by board (since 2.10)
+#
+# @arch: architecture of the cpu, which determines which additional fields
+# will be listed (since 2.6)
+#
+# Since: 0.14.0
+#
+# Notes: @halted is a transient state that changes frequently. By the time the
+# data is sent to the client, the guest may no longer be halted.
+##
+{ 'union': 'CpuInfo',
+ 'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
+ 'qom_path': 'str', 'thread_id': 'int',
+ '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' },
+ 'discriminator': 'arch',
+ 'data': { 'x86': 'CpuInfoX86',
+ 'sparc': 'CpuInfoSPARC',
+ 'ppc': 'CpuInfoPPC',
+ 'mips': 'CpuInfoMIPS',
+ 'tricore': 'CpuInfoTricore',
+ 's390': 'CpuInfoS390',
+ 'riscv': 'CpuInfoRISCV' } }
+
+##
+# @CpuInfoX86:
+#
+# Additional information about a virtual i386 or x86_64 CPU
+#
+# @pc: the 64-bit instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } }
+
+##
+# @CpuInfoSPARC:
+#
+# Additional information about a virtual SPARC CPU
+#
+# @pc: the PC component of the instruction pointer
+#
+# @npc: the NPC component of the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } }
+
+##
+# @CpuInfoPPC:
+#
+# Additional information about a virtual PPC CPU
+#
+# @nip: the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } }
+
+##
+# @CpuInfoMIPS:
+#
+# Additional information about a virtual MIPS CPU
+#
+# @PC: the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } }
+
+##
+# @CpuInfoTricore:
+#
+# Additional information about a virtual Tricore CPU
+#
+# @PC: the instruction pointer
+#
+# Since: 2.6
+##
+{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } }
+
+##
+# @CpuInfoRISCV:
+#
+# Additional information about a virtual RISCV CPU
+#
+# @pc: the instruction pointer
+#
+# Since 2.12
+##
+{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } }
+
+##
+# @CpuS390State:
+#
+# An enumeration of cpu states that can be assumed by a virtual
+# S390 CPU
+#
+# Since: 2.12
+##
+{ 'enum': 'CpuS390State',
+ 'prefix': 'S390_CPU_STATE',
+ 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
+
+##
+# @CpuInfoS390:
+#
+# Additional information about a virtual S390 CPU
+#
+# @cpu-state: the virtual CPU's state
+#
+# Since: 2.12
+##
+{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
+
+##
+# @query-cpus:
+#
+# Returns a list of information about each virtual CPU.
+#
+# This command causes vCPU threads to exit to userspace, which causes
+# a small interruption to guest CPU execution. This will have a negative
+# impact on realtime guests and other latency sensitive guest workloads.
+# It is recommended to use @query-cpus-fast instead of this command to
+# avoid the vCPU interruption.
+#
+# Returns: a list of @CpuInfo for each virtual CPU
+#
+# Since: 0.14.0
+#
+# Example:
+#
+# -> { "execute": "query-cpus" }
+# <- { "return": [
+# {
+# "CPU":0,
+# "current":true,
+# "halted":false,
+# "qom_path":"/machine/unattached/device[0]",
+# "arch":"x86",
+# "pc":3227107138,
+# "thread_id":3134
+# },
+# {
+# "CPU":1,
+# "current":false,
+# "halted":true,
+# "qom_path":"/machine/unattached/device[2]",
+# "arch":"x86",
+# "pc":7108165,
+# "thread_id":3135
+# }
+# ]
+# }
+#
+# Notes: This interface is deprecated (since 2.12.0), and it is strongly
+# recommended that you avoid using it. Use @query-cpus-fast to
+# obtain information about virtual CPUs.
+#
+##
+{ 'command': 'query-cpus', 'returns': ['CpuInfo'] }
+
+##
+# @CpuInfoFast:
+#
+# Information about a virtual CPU
+#
+# @cpu-index: index of the virtual CPU
+#
+# @qom-path: path to the CPU object in the QOM tree
+#
+# @thread-id: ID of the underlying host thread
+#
+# @props: properties describing to which node/socket/core/thread
+# virtual CPU belongs to, provided if supported by board
+#
+# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor
+# of @target
+#
+# @target: the QEMU system emulation target, which determines which
+# additional fields will be listed (since 3.0)
+#
+# Since: 2.12
+#
+##
+{ 'union' : 'CpuInfoFast',
+ 'base' : { 'cpu-index' : 'int',
+ 'qom-path' : 'str',
+ 'thread-id' : 'int',
+ '*props' : 'CpuInstanceProperties',
+ 'arch' : 'CpuInfoArch',
+ 'target' : 'SysEmuTarget' },
+ 'discriminator' : 'target',
+ 'data' : { 's390x' : 'CpuInfoS390' } }
+
+##
+# @query-cpus-fast:
+#
+# Returns information about all virtual CPUs. This command does not
+# incur a performance penalty and should be used in production
+# instead of query-cpus.
+#
+# Returns: list of @CpuInfoFast
+#
+# Since: 2.12
+#
+# Example:
+#
+# -> { "execute": "query-cpus-fast" }
+# <- { "return": [
+# {
+# "thread-id": 25627,
+# "props": {
+# "core-id": 0,
+# "thread-id": 0,
+# "socket-id": 0
+# },
+# "qom-path": "/machine/unattached/device[0]",
+# "arch":"x86",
+# "target":"x86_64",
+# "cpu-index": 0
+# },
+# {
+# "thread-id": 25628,
+# "props": {
+# "core-id": 0,
+# "thread-id": 0,
+# "socket-id": 1
+# },
+# "qom-path": "/machine/unattached/device[2]",
+# "arch":"x86",
+# "target":"x86_64",
+# "cpu-index": 1
+# }
+# ]
+# }
+##
+{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
+
+##
+# @cpu-add:
+#
+# Adds CPU with specified ID.
+#
+# @id: ID of CPU to be created, valid values [0..max_cpus)
+#
+# Returns: Nothing on success
+#
+# Since: 1.5
+#
+# Note: This command is deprecated. The `device_add` command should be
+# used instead. See the `query-hotpluggable-cpus` command for
+# details.
+#
+# Example:
+#
+# -> { "execute": "cpu-add", "arguments": { "id": 2 } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'cpu-add', 'data': {'id': 'int'} }
+
+##
+# @MachineInfo:
+#
+# Information describing a machine.
+#
+# @name: the name of the machine
+#
+# @alias: an alias for the machine name
+#
+# @is-default: whether the machine is default
+#
+# @cpu-max: maximum number of CPUs supported by the machine type
+# (since 1.5.0)
+#
+# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
+#
+# Since: 1.2.0
+##
+{ 'struct': 'MachineInfo',
+ 'data': { 'name': 'str', '*alias': 'str',
+ '*is-default': 'bool', 'cpu-max': 'int',
+ 'hotpluggable-cpus': 'bool'} }
+
+##
+# @query-machines:
+#
+# Return a list of supported machines
+#
+# Returns: a list of MachineInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
+
+##
+# @CurrentMachineParams:
+#
+# Information describing the running machine parameters.
+#
+# @wakeup-suspend-support: true if the machine supports wake up from
+# suspend
+#
+# Since: 4.0
+##
+{ 'struct': 'CurrentMachineParams',
+ 'data': { 'wakeup-suspend-support': 'bool'} }
+
+##
+# @query-current-machine:
+#
+# Return information on the current virtual machine.
+#
+# Returns: CurrentMachineParams
+#
+# Since: 4.0
+##
+{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
+
+##
+# @NumaOptionsType:
+#
+# @node: NUMA nodes configuration
+#
+# @dist: NUMA distance configuration (since 2.10)
+#
+# @cpu: property based CPU(s) to node mapping (Since: 2.10)
+#
+# Since: 2.1
+##
+{ 'enum': 'NumaOptionsType',
+ 'data': [ 'node', 'dist', 'cpu' ] }
+
+##
+# @NumaOptions:
+#
+# A discriminated record of NUMA options. (for OptsVisitor)
+#
+# Since: 2.1
+##
+{ 'union': 'NumaOptions',
+ 'base': { 'type': 'NumaOptionsType' },
+ 'discriminator': 'type',
+ 'data': {
+ 'node': 'NumaNodeOptions',
+ 'dist': 'NumaDistOptions',
+ 'cpu': 'NumaCpuOptions' }}
+
+##
+# @NumaNodeOptions:
+#
+# Create a guest NUMA node. (for OptsVisitor)
+#
+# @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
+#
+# @cpus: VCPUs belonging to this node (assign VCPUS round-robin
+# if omitted)
+#
+# @mem: memory size of this node; mutually exclusive with @memdev.
+# Equally divide total memory among nodes if both @mem and @memdev are
+# omitted.
+#
+# @memdev: memory backend object. If specified for one node,
+# it must be specified for all nodes.
+#
+# Since: 2.1
+##
+{ 'struct': 'NumaNodeOptions',
+ 'data': {
+ '*nodeid': 'uint16',
+ '*cpus': ['uint16'],
+ '*mem': 'size',
+ '*memdev': 'str' }}
+
+##
+# @NumaDistOptions:
+#
+# Set the distance between 2 NUMA nodes.
+#
+# @src: source NUMA node.
+#
+# @dst: destination NUMA node.
+#
+# @val: NUMA distance from source node to destination node.
+# When a node is unreachable from another node, set the distance
+# between them to 255.
+#
+# Since: 2.10
+##
+{ 'struct': 'NumaDistOptions',
+ 'data': {
+ 'src': 'uint16',
+ 'dst': 'uint16',
+ 'val': 'uint8' }}
+
+##
+# @X86CPURegister32:
+#
+# A X86 32-bit register
+#
+# Since: 1.5
+##
+{ 'enum': 'X86CPURegister32',
+ 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
+
+##
+# @X86CPUFeatureWordInfo:
+#
+# Information about a X86 CPU feature word
+#
+# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
+#
+# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
+# feature word
+#
+# @cpuid-register: Output register containing the feature bits
+#
+# @features: value of output register, containing the feature bits
+#
+# Since: 1.5
+##
+{ 'struct': 'X86CPUFeatureWordInfo',
+ 'data': { 'cpuid-input-eax': 'int',
+ '*cpuid-input-ecx': 'int',
+ 'cpuid-register': 'X86CPURegister32',
+ 'features': 'int' } }
+
+##
+# @DummyForceArrays:
+#
+# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
+#
+# Since: 2.5
+##
+{ 'struct': 'DummyForceArrays',
+ 'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
+
+##
+# @NumaCpuOptions:
+#
+# Option "-numa cpu" overrides default cpu to node mapping.
+# It accepts the same set of cpu properties as returned by
+# query-hotpluggable-cpus[].props, where node-id could be used to
+# override default node mapping.
+#
+# Since: 2.10
+##
+{ 'struct': 'NumaCpuOptions',
+ 'base': 'CpuInstanceProperties',
+ 'data' : {} }
+
+##
+# @HostMemPolicy:
+#
+# Host memory policy types
+#
+# @default: restore default policy, remove any nondefault policy
+#
+# @preferred: set the preferred host nodes for allocation
+#
+# @bind: a strict policy that restricts memory allocation to the
+# host nodes specified
+#
+# @interleave: memory allocations are interleaved across the set
+# of host nodes specified
+#
+# Since: 2.1
+##
+{ 'enum': 'HostMemPolicy',
+ 'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
+
+##
+# @Memdev:
+#
+# Information about memory backend
+#
+# @id: backend's ID if backend has 'id' property (since 2.9)
+#
+# @size: memory backend size
+#
+# @merge: enables or disables memory merge support
+#
+# @dump: includes memory backend's memory in a core dump or not
+#
+# @prealloc: enables or disables memory preallocation
+#
+# @host-nodes: host nodes for its memory policy
+#
+# @policy: memory policy of memory backend
+#
+# Since: 2.1
+##
+{ 'struct': 'Memdev',
+ 'data': {
+ '*id': 'str',
+ 'size': 'size',
+ 'merge': 'bool',
+ 'dump': 'bool',
+ 'prealloc': 'bool',
+ 'host-nodes': ['uint16'],
+ 'policy': 'HostMemPolicy' }}
+
+##
+# @query-memdev:
+#
+# Returns information for all memory backends.
+#
+# Returns: a list of @Memdev.
+#
+# Since: 2.1
+#
+# Example:
+#
+# -> { "execute": "query-memdev" }
+# <- { "return": [
+# {
+# "id": "mem1",
+# "size": 536870912,
+# "merge": false,
+# "dump": true,
+# "prealloc": false,
+# "host-nodes": [0, 1],
+# "policy": "bind"
+# },
+# {
+# "size": 536870912,
+# "merge": false,
+# "dump": true,
+# "prealloc": true,
+# "host-nodes": [2, 3],
+# "policy": "preferred"
+# }
+# ]
+# }
+#
+##
+{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
+
+##
+# @CpuInstanceProperties:
+#
+# List of properties to be used for hotplugging a CPU instance,
+# it should be passed by management with device_add command when
+# a CPU is being hotplugged.
+#
+# @node-id: NUMA node ID the CPU belongs to
+# @socket-id: socket number within node/board the CPU belongs to
+# @core-id: core number within socket the CPU belongs to
+# @thread-id: thread number within core the CPU belongs to
+#
+# Note: currently there are 4 properties that could be present
+# but management should be prepared to pass through other
+# properties with device_add command to allow for future
+# interface extension. This also requires the filed names to be kept in
+# sync with the properties passed to -device/device_add.
+#
+# Since: 2.7
+##
+{ 'struct': 'CpuInstanceProperties',
+ 'data': { '*node-id': 'int',
+ '*socket-id': 'int',
+ '*core-id': 'int',
+ '*thread-id': 'int'
+ }
+}
+
+##
+# @HotpluggableCPU:
+#
+# @type: CPU object type for usage with device_add command
+# @props: list of properties to be used for hotplugging CPU
+# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
+# @qom-path: link to existing CPU object if CPU is present or
+# omitted if CPU is not present.
+#
+# Since: 2.7
+##
+{ 'struct': 'HotpluggableCPU',
+ 'data': { 'type': 'str',
+ 'vcpus-count': 'int',
+ 'props': 'CpuInstanceProperties',
+ '*qom-path': 'str'
+ }
+}
+
+##
+# @query-hotpluggable-cpus:
+#
+# TODO: Better documentation; currently there is none.
+#
+# Returns: a list of HotpluggableCPU objects.
+#
+# Since: 2.7
+#
+# Example:
+#
+# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
+#
+# -> { "execute": "query-hotpluggable-cpus" }
+# <- {"return": [
+# { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
+# "vcpus-count": 1 },
+# { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
+# "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
+# ]}'
+#
+# For pc machine type started with -smp 1,maxcpus=2:
+#
+# -> { "execute": "query-hotpluggable-cpus" }
+# <- {"return": [
+# {
+# "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
+# "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
+# },
+# {
+# "qom-path": "/machine/unattached/device[0]",
+# "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
+# "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
+# }
+# ]}
+#
+# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
+# (Since: 2.11):
+#
+# -> { "execute": "query-hotpluggable-cpus" }
+# <- {"return": [
+# {
+# "type": "qemu-s390x-cpu", "vcpus-count": 1,
+# "props": { "core-id": 1 }
+# },
+# {
+# "qom-path": "/machine/unattached/device[0]",
+# "type": "qemu-s390x-cpu", "vcpus-count": 1,
+# "props": { "core-id": 0 }
+# }
+# ]}
+#
+##
+{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
+ 'allow-preconfig': true }
+
+##
+# @set-numa-node:
+#
+# Runtime equivalent of '-numa' CLI option, available at
+# preconfigure stage to configure numa mapping before initializing
+# machine.
+#
+# Since 3.0
+##
+{ 'command': 'set-numa-node', 'boxed': true,
+ 'data': 'NumaOptions',
+ 'allow-preconfig': true
+}
diff --git a/qapi/misc.json b/qapi/misc.json
index 5fbda70ad8..b4f8c658b7 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -342,276 +342,6 @@
##
{ 'command': 'query-events', 'returns': ['EventInfo'] }
-##
-# @CpuInfoArch:
-#
-# An enumeration of cpu types that enable additional information during
-# @query-cpus and @query-cpus-fast.
-#
-# @s390: since 2.12
-#
-# @riscv: since 2.12
-#
-# Since: 2.6
-##
-{ 'enum': 'CpuInfoArch',
- 'data': ['x86', 'sparc', 'ppc', 'mips', 'tricore', 's390', 'riscv', 'other' ] }
-
-##
-# @CpuInfo:
-#
-# Information about a virtual CPU
-#
-# @CPU: the index of the virtual CPU
-#
-# @current: this only exists for backwards compatibility and should be ignored
-#
-# @halted: true if the virtual CPU is in the halt state. Halt usually refers
-# to a processor specific low power mode.
-#
-# @qom_path: path to the CPU object in the QOM tree (since 2.4)
-#
-# @thread_id: ID of the underlying host thread
-#
-# @props: properties describing to which node/socket/core/thread
-# virtual CPU belongs to, provided if supported by board (since 2.10)
-#
-# @arch: architecture of the cpu, which determines which additional fields
-# will be listed (since 2.6)
-#
-# Since: 0.14.0
-#
-# Notes: @halted is a transient state that changes frequently. By the time the
-# data is sent to the client, the guest may no longer be halted.
-##
-{ 'union': 'CpuInfo',
- 'base': {'CPU': 'int', 'current': 'bool', 'halted': 'bool',
- 'qom_path': 'str', 'thread_id': 'int',
- '*props': 'CpuInstanceProperties', 'arch': 'CpuInfoArch' },
- 'discriminator': 'arch',
- 'data': { 'x86': 'CpuInfoX86',
- 'sparc': 'CpuInfoSPARC',
- 'ppc': 'CpuInfoPPC',
- 'mips': 'CpuInfoMIPS',
- 'tricore': 'CpuInfoTricore',
- 's390': 'CpuInfoS390',
- 'riscv': 'CpuInfoRISCV' } }
-
-##
-# @CpuInfoX86:
-#
-# Additional information about a virtual i386 or x86_64 CPU
-#
-# @pc: the 64-bit instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoX86', 'data': { 'pc': 'int' } }
-
-##
-# @CpuInfoSPARC:
-#
-# Additional information about a virtual SPARC CPU
-#
-# @pc: the PC component of the instruction pointer
-#
-# @npc: the NPC component of the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoSPARC', 'data': { 'pc': 'int', 'npc': 'int' } }
-
-##
-# @CpuInfoPPC:
-#
-# Additional information about a virtual PPC CPU
-#
-# @nip: the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoPPC', 'data': { 'nip': 'int' } }
-
-##
-# @CpuInfoMIPS:
-#
-# Additional information about a virtual MIPS CPU
-#
-# @PC: the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoMIPS', 'data': { 'PC': 'int' } }
-
-##
-# @CpuInfoTricore:
-#
-# Additional information about a virtual Tricore CPU
-#
-# @PC: the instruction pointer
-#
-# Since: 2.6
-##
-{ 'struct': 'CpuInfoTricore', 'data': { 'PC': 'int' } }
-
-##
-# @CpuInfoRISCV:
-#
-# Additional information about a virtual RISCV CPU
-#
-# @pc: the instruction pointer
-#
-# Since 2.12
-##
-{ 'struct': 'CpuInfoRISCV', 'data': { 'pc': 'int' } }
-
-##
-# @CpuS390State:
-#
-# An enumeration of cpu states that can be assumed by a virtual
-# S390 CPU
-#
-# Since: 2.12
-##
-{ 'enum': 'CpuS390State',
- 'prefix': 'S390_CPU_STATE',
- 'data': [ 'uninitialized', 'stopped', 'check-stop', 'operating', 'load' ] }
-
-##
-# @CpuInfoS390:
-#
-# Additional information about a virtual S390 CPU
-#
-# @cpu-state: the virtual CPU's state
-#
-# Since: 2.12
-##
-{ 'struct': 'CpuInfoS390', 'data': { 'cpu-state': 'CpuS390State' } }
-
-##
-# @query-cpus:
-#
-# Returns a list of information about each virtual CPU.
-#
-# This command causes vCPU threads to exit to userspace, which causes
-# a small interruption to guest CPU execution. This will have a negative
-# impact on realtime guests and other latency sensitive guest workloads.
-# It is recommended to use @query-cpus-fast instead of this command to
-# avoid the vCPU interruption.
-#
-# Returns: a list of @CpuInfo for each virtual CPU
-#
-# Since: 0.14.0
-#
-# Example:
-#
-# -> { "execute": "query-cpus" }
-# <- { "return": [
-# {
-# "CPU":0,
-# "current":true,
-# "halted":false,
-# "qom_path":"/machine/unattached/device[0]",
-# "arch":"x86",
-# "pc":3227107138,
-# "thread_id":3134
-# },
-# {
-# "CPU":1,
-# "current":false,
-# "halted":true,
-# "qom_path":"/machine/unattached/device[2]",
-# "arch":"x86",
-# "pc":7108165,
-# "thread_id":3135
-# }
-# ]
-# }
-#
-# Notes: This interface is deprecated (since 2.12.0), and it is strongly
-# recommended that you avoid using it. Use @query-cpus-fast to
-# obtain information about virtual CPUs.
-#
-##
-{ 'command': 'query-cpus', 'returns': ['CpuInfo'] }
-
-##
-# @CpuInfoFast:
-#
-# Information about a virtual CPU
-#
-# @cpu-index: index of the virtual CPU
-#
-# @qom-path: path to the CPU object in the QOM tree
-#
-# @thread-id: ID of the underlying host thread
-#
-# @props: properties describing to which node/socket/core/thread
-# virtual CPU belongs to, provided if supported by board
-#
-# @arch: base architecture of the cpu; deprecated since 3.0.0 in favor
-# of @target
-#
-# @target: the QEMU system emulation target, which determines which
-# additional fields will be listed (since 3.0)
-#
-# Since: 2.12
-#
-##
-{ 'union' : 'CpuInfoFast',
- 'base' : { 'cpu-index' : 'int',
- 'qom-path' : 'str',
- 'thread-id' : 'int',
- '*props' : 'CpuInstanceProperties',
- 'arch' : 'CpuInfoArch',
- 'target' : 'SysEmuTarget' },
- 'discriminator' : 'target',
- 'data' : { 's390x' : 'CpuInfoS390' } }
-
-##
-# @query-cpus-fast:
-#
-# Returns information about all virtual CPUs. This command does not
-# incur a performance penalty and should be used in production
-# instead of query-cpus.
-#
-# Returns: list of @CpuInfoFast
-#
-# Since: 2.12
-#
-# Example:
-#
-# -> { "execute": "query-cpus-fast" }
-# <- { "return": [
-# {
-# "thread-id": 25627,
-# "props": {
-# "core-id": 0,
-# "thread-id": 0,
-# "socket-id": 0
-# },
-# "qom-path": "/machine/unattached/device[0]",
-# "arch":"x86",
-# "target":"x86_64",
-# "cpu-index": 0
-# },
-# {
-# "thread-id": 25628,
-# "props": {
-# "core-id": 0,
-# "thread-id": 0,
-# "socket-id": 1
-# },
-# "qom-path": "/machine/unattached/device[2]",
-# "arch":"x86",
-# "target":"x86_64",
-# "cpu-index": 1
-# }
-# ]
-# }
-##
-{ 'command': 'query-cpus-fast', 'returns': [ 'CpuInfoFast' ] }
-
##
# @IOThreadInfo:
#
@@ -1105,29 +835,6 @@
##
{ 'command': 'system_powerdown' }
-##
-# @cpu-add:
-#
-# Adds CPU with specified ID.
-#
-# @id: ID of CPU to be created, valid values [0..max_cpus)
-#
-# Returns: Nothing on success
-#
-# Since: 1.5
-#
-# Note: This command is deprecated. The `device_add` command should be
-# used instead. See the `query-hotpluggable-cpus` command for
-# details.
-#
-# Example:
-#
-# -> { "execute": "cpu-add", "arguments": { "id": 2 } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'cpu-add', 'data': {'id': 'int'} }
-
##
# @memsave:
#
@@ -1647,64 +1354,6 @@
##
{ 'command': 'closefd', 'data': {'fdname': 'str'} }
-##
-# @MachineInfo:
-#
-# Information describing a machine.
-#
-# @name: the name of the machine
-#
-# @alias: an alias for the machine name
-#
-# @is-default: whether the machine is default
-#
-# @cpu-max: maximum number of CPUs supported by the machine type
-# (since 1.5.0)
-#
-# @hotpluggable-cpus: cpu hotplug via -device is supported (since 2.7.0)
-#
-# Since: 1.2.0
-##
-{ 'struct': 'MachineInfo',
- 'data': { 'name': 'str', '*alias': 'str',
- '*is-default': 'bool', 'cpu-max': 'int',
- 'hotpluggable-cpus': 'bool'} }
-
-##
-# @query-machines:
-#
-# Return a list of supported machines
-#
-# Returns: a list of MachineInfo
-#
-# Since: 1.2.0
-##
-{ 'command': 'query-machines', 'returns': ['MachineInfo'] }
-
-##
-# @CurrentMachineParams:
-#
-# Information describing the running machine parameters.
-#
-# @wakeup-suspend-support: true if the machine supports wake up from
-# suspend
-#
-# Since: 4.0
-##
-{ 'struct': 'CurrentMachineParams',
- 'data': { 'wakeup-suspend-support': 'bool'} }
-
-##
-# @query-current-machine:
-#
-# Return information on the current virtual machine.
-#
-# Returns: CurrentMachineParams
-#
-# Since: 4.0
-##
-{ 'command': 'query-current-machine', 'returns': 'CurrentMachineParams' }
-
##
# @MemoryInfo:
#
@@ -2132,226 +1781,6 @@
'returns': ['CommandLineOptionInfo'],
'allow-preconfig': true }
-##
-# @X86CPURegister32:
-#
-# A X86 32-bit register
-#
-# Since: 1.5
-##
-{ 'enum': 'X86CPURegister32',
- 'data': [ 'EAX', 'EBX', 'ECX', 'EDX', 'ESP', 'EBP', 'ESI', 'EDI' ] }
-
-##
-# @X86CPUFeatureWordInfo:
-#
-# Information about a X86 CPU feature word
-#
-# @cpuid-input-eax: Input EAX value for CPUID instruction for that feature word
-#
-# @cpuid-input-ecx: Input ECX value for CPUID instruction for that
-# feature word
-#
-# @cpuid-register: Output register containing the feature bits
-#
-# @features: value of output register, containing the feature bits
-#
-# Since: 1.5
-##
-{ 'struct': 'X86CPUFeatureWordInfo',
- 'data': { 'cpuid-input-eax': 'int',
- '*cpuid-input-ecx': 'int',
- 'cpuid-register': 'X86CPURegister32',
- 'features': 'int' } }
-
-##
-# @DummyForceArrays:
-#
-# Not used by QMP; hack to let us use X86CPUFeatureWordInfoList internally
-#
-# Since: 2.5
-##
-{ 'struct': 'DummyForceArrays',
- 'data': { 'unused': ['X86CPUFeatureWordInfo'] } }
-
-
-##
-# @NumaOptionsType:
-#
-# @node: NUMA nodes configuration
-#
-# @dist: NUMA distance configuration (since 2.10)
-#
-# @cpu: property based CPU(s) to node mapping (Since: 2.10)
-#
-# Since: 2.1
-##
-{ 'enum': 'NumaOptionsType',
- 'data': [ 'node', 'dist', 'cpu' ] }
-
-##
-# @NumaOptions:
-#
-# A discriminated record of NUMA options. (for OptsVisitor)
-#
-# Since: 2.1
-##
-{ 'union': 'NumaOptions',
- 'base': { 'type': 'NumaOptionsType' },
- 'discriminator': 'type',
- 'data': {
- 'node': 'NumaNodeOptions',
- 'dist': 'NumaDistOptions',
- 'cpu': 'NumaCpuOptions' }}
-
-##
-# @NumaNodeOptions:
-#
-# Create a guest NUMA node. (for OptsVisitor)
-#
-# @nodeid: NUMA node ID (increase by 1 from 0 if omitted)
-#
-# @cpus: VCPUs belonging to this node (assign VCPUS round-robin
-# if omitted)
-#
-# @mem: memory size of this node; mutually exclusive with @memdev.
-# Equally divide total memory among nodes if both @mem and @memdev are
-# omitted.
-#
-# @memdev: memory backend object. If specified for one node,
-# it must be specified for all nodes.
-#
-# Since: 2.1
-##
-{ 'struct': 'NumaNodeOptions',
- 'data': {
- '*nodeid': 'uint16',
- '*cpus': ['uint16'],
- '*mem': 'size',
- '*memdev': 'str' }}
-
-##
-# @NumaDistOptions:
-#
-# Set the distance between 2 NUMA nodes.
-#
-# @src: source NUMA node.
-#
-# @dst: destination NUMA node.
-#
-# @val: NUMA distance from source node to destination node.
-# When a node is unreachable from another node, set the distance
-# between them to 255.
-#
-# Since: 2.10
-##
-{ 'struct': 'NumaDistOptions',
- 'data': {
- 'src': 'uint16',
- 'dst': 'uint16',
- 'val': 'uint8' }}
-
-##
-# @NumaCpuOptions:
-#
-# Option "-numa cpu" overrides default cpu to node mapping.
-# It accepts the same set of cpu properties as returned by
-# query-hotpluggable-cpus[].props, where node-id could be used to
-# override default node mapping.
-#
-# Since: 2.10
-##
-{ 'struct': 'NumaCpuOptions',
- 'base': 'CpuInstanceProperties',
- 'data' : {} }
-
-##
-# @HostMemPolicy:
-#
-# Host memory policy types
-#
-# @default: restore default policy, remove any nondefault policy
-#
-# @preferred: set the preferred host nodes for allocation
-#
-# @bind: a strict policy that restricts memory allocation to the
-# host nodes specified
-#
-# @interleave: memory allocations are interleaved across the set
-# of host nodes specified
-#
-# Since: 2.1
-##
-{ 'enum': 'HostMemPolicy',
- 'data': [ 'default', 'preferred', 'bind', 'interleave' ] }
-
-##
-# @Memdev:
-#
-# Information about memory backend
-#
-# @id: backend's ID if backend has 'id' property (since 2.9)
-#
-# @size: memory backend size
-#
-# @merge: enables or disables memory merge support
-#
-# @dump: includes memory backend's memory in a core dump or not
-#
-# @prealloc: enables or disables memory preallocation
-#
-# @host-nodes: host nodes for its memory policy
-#
-# @policy: memory policy of memory backend
-#
-# Since: 2.1
-##
-{ 'struct': 'Memdev',
- 'data': {
- '*id': 'str',
- 'size': 'size',
- 'merge': 'bool',
- 'dump': 'bool',
- 'prealloc': 'bool',
- 'host-nodes': ['uint16'],
- 'policy': 'HostMemPolicy' }}
-
-##
-# @query-memdev:
-#
-# Returns information for all memory backends.
-#
-# Returns: a list of @Memdev.
-#
-# Since: 2.1
-#
-# Example:
-#
-# -> { "execute": "query-memdev" }
-# <- { "return": [
-# {
-# "id": "mem1",
-# "size": 536870912,
-# "merge": false,
-# "dump": true,
-# "prealloc": false,
-# "host-nodes": [0, 1],
-# "policy": "bind"
-# },
-# {
-# "size": 536870912,
-# "merge": false,
-# "dump": true,
-# "prealloc": true,
-# "host-nodes": [2, 3],
-# "policy": "preferred"
-# }
-# ]
-# }
-#
-##
-{ 'command': 'query-memdev', 'returns': ['Memdev'], 'allow-preconfig': true }
-
##
# @PCDIMMDeviceInfo:
#
@@ -2560,109 +1989,6 @@
##
{ 'command': 'xen-load-devices-state', 'data': {'filename': 'str'} }
-##
-# @CpuInstanceProperties:
-#
-# List of properties to be used for hotplugging a CPU instance,
-# it should be passed by management with device_add command when
-# a CPU is being hotplugged.
-#
-# @node-id: NUMA node ID the CPU belongs to
-# @socket-id: socket number within node/board the CPU belongs to
-# @core-id: core number within socket the CPU belongs to
-# @thread-id: thread number within core the CPU belongs to
-#
-# Note: currently there are 4 properties that could be present
-# but management should be prepared to pass through other
-# properties with device_add command to allow for future
-# interface extension. This also requires the filed names to be kept in
-# sync with the properties passed to -device/device_add.
-#
-# Since: 2.7
-##
-{ 'struct': 'CpuInstanceProperties',
- 'data': { '*node-id': 'int',
- '*socket-id': 'int',
- '*core-id': 'int',
- '*thread-id': 'int'
- }
-}
-
-##
-# @HotpluggableCPU:
-#
-# @type: CPU object type for usage with device_add command
-# @props: list of properties to be used for hotplugging CPU
-# @vcpus-count: number of logical VCPU threads @HotpluggableCPU provides
-# @qom-path: link to existing CPU object if CPU is present or
-# omitted if CPU is not present.
-#
-# Since: 2.7
-##
-{ 'struct': 'HotpluggableCPU',
- 'data': { 'type': 'str',
- 'vcpus-count': 'int',
- 'props': 'CpuInstanceProperties',
- '*qom-path': 'str'
- }
-}
-
-##
-# @query-hotpluggable-cpus:
-#
-# TODO: Better documentation; currently there is none.
-#
-# Returns: a list of HotpluggableCPU objects.
-#
-# Since: 2.7
-#
-# Example:
-#
-# For pseries machine type started with -smp 2,cores=2,maxcpus=4 -cpu POWER8:
-#
-# -> { "execute": "query-hotpluggable-cpus" }
-# <- {"return": [
-# { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core",
-# "vcpus-count": 1 },
-# { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core",
-# "vcpus-count": 1, "qom-path": "/machine/unattached/device[0]"}
-# ]}'
-#
-# For pc machine type started with -smp 1,maxcpus=2:
-#
-# -> { "execute": "query-hotpluggable-cpus" }
-# <- {"return": [
-# {
-# "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
-# "props": {"core-id": 0, "socket-id": 1, "thread-id": 0}
-# },
-# {
-# "qom-path": "/machine/unattached/device[0]",
-# "type": "qemu64-x86_64-cpu", "vcpus-count": 1,
-# "props": {"core-id": 0, "socket-id": 0, "thread-id": 0}
-# }
-# ]}
-#
-# For s390x-virtio-ccw machine type started with -smp 1,maxcpus=2 -cpu qemu
-# (Since: 2.11):
-#
-# -> { "execute": "query-hotpluggable-cpus" }
-# <- {"return": [
-# {
-# "type": "qemu-s390x-cpu", "vcpus-count": 1,
-# "props": { "core-id": 1 }
-# },
-# {
-# "qom-path": "/machine/unattached/device[0]",
-# "type": "qemu-s390x-cpu", "vcpus-count": 1,
-# "props": { "core-id": 0 }
-# }
-# ]}
-#
-##
-{ 'command': 'query-hotpluggable-cpus', 'returns': ['HotpluggableCPU'],
- 'allow-preconfig': true }
-
##
# @GuidInfo:
#
@@ -2683,16 +2009,3 @@
##
{ 'command': 'query-vm-generation-id', 'returns': 'GuidInfo' }
-##
-# @set-numa-node:
-#
-# Runtime equivalent of '-numa' CLI option, available at
-# preconfigure stage to configure numa mapping before initializing
-# machine.
-#
-# Since 3.0
-##
-{ 'command': 'set-numa-node', 'boxed': true,
- 'data': 'NumaOptions',
- 'allow-preconfig': true
-}
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index d6cf90a85a..31611191db 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -99,6 +99,7 @@
{ 'include': 'introspect.json' }
{ 'include': 'qom.json' }
{ 'include': 'qdev.json' }
+{ 'include': 'machine.json' }
{ 'include': 'misc.json' }
{ 'include': 'target.json' }
{ 'include': 'audio.json' }
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index fbed2eb804..cb50f05e7e 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -36,7 +36,7 @@
#include "qemu/option.h"
#include "qemu/config-file.h"
#include "qapi/error.h"
-#include "qapi/qapi-visit-misc.h"
+#include "qapi/qapi-visit-machine.h"
#include "qapi/qapi-visit-run-state.h"
#include "qapi/qmp/qdict.h"
#include "qapi/qmp/qerror.h"
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index f2d93644d5..8540e7a2cb 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -31,7 +31,7 @@
#include "qemu/module.h"
#include "trace.h"
#include "qapi/visitor.h"
-#include "qapi/qapi-visit-misc.h"
+#include "qapi/qapi-types-machine.h"
#include "qapi/qapi-visit-run-state.h"
#include "sysemu/hw_accel.h"
#include "hw/qdev-properties.h"
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index ce49a792fc..8348b7035e 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -17,7 +17,7 @@
#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "trace.h"
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-machine.h"
QemuMutex qemu_sigp_mutex;
diff --git a/vl.c b/vl.c
index 99a56b5556..0eb9b2c8bd 100644
--- a/vl.c
+++ b/vl.c
@@ -125,7 +125,7 @@ int main(int argc, char **argv)
#include "qapi/qapi-visit-block-core.h"
#include "qapi/qapi-visit-ui.h"
#include "qapi/qapi-commands-block-core.h"
-#include "qapi/qapi-commands-misc.h"
+#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qerror.h"
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 08/17] qapi: Split machine.json off misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 08/17] qapi: Split machine.json off misc.json Markus Armbruster
@ 2019-06-20 8:45 ` Daniel P. Berrangé
0 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:45 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:41PM +0200, Markus Armbruster wrote:
> Move commands cpu-add, query-cpus, query-cpus-fast,
> query-current-machine, query-hotpluggable-cpus, query-machines,
> query-memdev, and set-numa-node with their types from misc.json to new
> machine.json. Also move types X86CPURegister32 and
> X86CPUFeatureWordInfo. Add machine.json to MAINTAINERS section
> "Machine core".
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 1 +
> cpus.c | 1 +
> include/hw/boards.h | 1 +
> include/sysemu/hostmem.h | 2 +-
> monitor/hmp-cmds.c | 1 +
> monitor/qmp-cmds.c | 1 +
> numa.c | 4 +-
> qapi/Makefile.objs | 2 +-
> qapi/machine.json | 697 +++++++++++++++++++++++++++++++++++++++
> qapi/misc.json | 687 --------------------------------------
> qapi/qapi-schema.json | 1 +
> target/i386/cpu.c | 2 +-
> target/s390x/cpu.c | 2 +-
> target/s390x/sigp.c | 2 +-
> vl.c | 2 +-
> 15 files changed, 711 insertions(+), 695 deletions(-)
> create mode 100644 qapi/machine.json
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 09/17] hw/core: Move numa.c to hw/core/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (7 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 08/17] qapi: Split machine.json off misc.json Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:46 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 10/17] hw/core: Collect QMP command handlers in hw/core/ Markus Armbruster
` (7 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Eduardo Habkost
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 2 +-
Makefile.target | 2 +-
hw/core/Makefile.objs | 2 ++
numa.c => hw/core/numa.c | 0
4 files changed, 4 insertions(+), 2 deletions(-)
rename numa.c => hw/core/numa.c (100%)
diff --git a/MAINTAINERS b/MAINTAINERS
index 9b488c5151..96a72a999a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1267,8 +1267,8 @@ M: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
S: Supported
F: hw/core/machine.c
F: hw/core/null-machine.c
+F: hw/core/numa.c
F: hw/cpu/cluster.c
-F: numa.c
F: qapi/machine.json
F: qom/cpu.c
F: include/hw/boards.h
diff --git a/Makefile.target b/Makefile.target
index 72c267f7dc..167ae2174e 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -148,7 +148,7 @@ endif #CONFIG_BSD_USER
#########################################################
# System emulator target
ifdef CONFIG_SOFTMMU
-obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o numa.o
+obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o
obj-y += qtest.o
obj-y += hw/
obj-y += monitor/
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index a799c83815..e3a8307be6 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -22,3 +22,5 @@ common-obj-$(CONFIG_SOFTMMU) += split-irq.o
common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
common-obj-$(CONFIG_SOFTMMU) += generic-loader.o
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
+
+obj-$(CONFIG_SOFTMMU) += numa.o
diff --git a/numa.c b/hw/core/numa.c
similarity index 100%
rename from numa.c
rename to hw/core/numa.c
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 10/17] hw/core: Collect QMP command handlers in hw/core/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (8 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 09/17] hw/core: Move numa.c to hw/core/ Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:50 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP " Markus Armbruster
` (6 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Eduardo Habkost
The handlers for qapi/machine.json's QMP commands are spread over
cpus.c, hw/core/numa.c, monitor/misc.c, monitor/qmp-cmds.c, and vl.c.
Move them all to new hw/core/machine-qmp-cmds.c, where they are
covered by MAINTAINERS section "Machine core", just like
qapi/machine.json.
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 1 +
cpus.c | 188 ---------------------
hw/core/Makefile.objs | 1 +
hw/core/machine-qmp-cmds.c | 328 +++++++++++++++++++++++++++++++++++++
hw/core/numa.c | 62 -------
include/sysemu/numa.h | 2 +
monitor/misc.c | 13 --
monitor/qmp-cmds.c | 12 --
vl.c | 45 -----
9 files changed, 332 insertions(+), 320 deletions(-)
create mode 100644 hw/core/machine-qmp-cmds.c
diff --git a/MAINTAINERS b/MAINTAINERS
index 96a72a999a..0e6d0861ab 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1265,6 +1265,7 @@ Machine core
M: Eduardo Habkost <ehabkost@redhat.com>
M: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
S: Supported
+F: hw/core/machine-qmp-cmds.c
F: hw/core/machine.c
F: hw/core/null-machine.c
F: hw/core/numa.c
diff --git a/cpus.c b/cpus.c
index f5e677b2c4..1c4bc06e4c 100644
--- a/cpus.c
+++ b/cpus.c
@@ -25,16 +25,13 @@
#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/config-file.h"
-#include "cpu.h"
#include "monitor/monitor.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-events-run-state.h"
#include "qapi/qmp/qerror.h"
#include "qemu/error-report.h"
#include "qemu/qemu-print.h"
-#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "sysemu/block-backend.h"
#include "exec/gdbstub.h"
@@ -57,7 +54,6 @@
#include "tcg.h"
#include "hw/nmi.h"
#include "sysemu/replay.h"
-#include "hw/boards.h"
#ifdef CONFIG_LINUX
@@ -2202,190 +2198,6 @@ void list_cpus(const char *optarg)
#endif
}
-CpuInfoList *qmp_query_cpus(Error **errp)
-{
- MachineState *ms = MACHINE(qdev_get_machine());
- MachineClass *mc = MACHINE_GET_CLASS(ms);
- CpuInfoList *head = NULL, *cur_item = NULL;
- CPUState *cpu;
-
- CPU_FOREACH(cpu) {
- CpuInfoList *info;
-#if defined(TARGET_I386)
- X86CPU *x86_cpu = X86_CPU(cpu);
- CPUX86State *env = &x86_cpu->env;
-#elif defined(TARGET_PPC)
- PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu);
- CPUPPCState *env = &ppc_cpu->env;
-#elif defined(TARGET_SPARC)
- SPARCCPU *sparc_cpu = SPARC_CPU(cpu);
- CPUSPARCState *env = &sparc_cpu->env;
-#elif defined(TARGET_RISCV)
- RISCVCPU *riscv_cpu = RISCV_CPU(cpu);
- CPURISCVState *env = &riscv_cpu->env;
-#elif defined(TARGET_MIPS)
- MIPSCPU *mips_cpu = MIPS_CPU(cpu);
- CPUMIPSState *env = &mips_cpu->env;
-#elif defined(TARGET_TRICORE)
- TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu);
- CPUTriCoreState *env = &tricore_cpu->env;
-#elif defined(TARGET_S390X)
- S390CPU *s390_cpu = S390_CPU(cpu);
- CPUS390XState *env = &s390_cpu->env;
-#endif
-
- cpu_synchronize_state(cpu);
-
- info = g_malloc0(sizeof(*info));
- info->value = g_malloc0(sizeof(*info->value));
- info->value->CPU = cpu->cpu_index;
- info->value->current = (cpu == first_cpu);
- info->value->halted = cpu->halted;
- info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
- info->value->thread_id = cpu->thread_id;
-#if defined(TARGET_I386)
- info->value->arch = CPU_INFO_ARCH_X86;
- info->value->u.x86.pc = env->eip + env->segs[R_CS].base;
-#elif defined(TARGET_PPC)
- info->value->arch = CPU_INFO_ARCH_PPC;
- info->value->u.ppc.nip = env->nip;
-#elif defined(TARGET_SPARC)
- info->value->arch = CPU_INFO_ARCH_SPARC;
- info->value->u.q_sparc.pc = env->pc;
- info->value->u.q_sparc.npc = env->npc;
-#elif defined(TARGET_MIPS)
- info->value->arch = CPU_INFO_ARCH_MIPS;
- info->value->u.q_mips.PC = env->active_tc.PC;
-#elif defined(TARGET_TRICORE)
- info->value->arch = CPU_INFO_ARCH_TRICORE;
- info->value->u.tricore.PC = env->PC;
-#elif defined(TARGET_S390X)
- info->value->arch = CPU_INFO_ARCH_S390;
- info->value->u.s390.cpu_state = env->cpu_state;
-#elif defined(TARGET_RISCV)
- info->value->arch = CPU_INFO_ARCH_RISCV;
- info->value->u.riscv.pc = env->pc;
-#else
- info->value->arch = CPU_INFO_ARCH_OTHER;
-#endif
- info->value->has_props = !!mc->cpu_index_to_instance_props;
- if (info->value->has_props) {
- CpuInstanceProperties *props;
- props = g_malloc0(sizeof(*props));
- *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
- info->value->props = props;
- }
-
- /* XXX: waiting for the qapi to support GSList */
- if (!cur_item) {
- head = cur_item = info;
- } else {
- cur_item->next = info;
- cur_item = info;
- }
- }
-
- return head;
-}
-
-static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target)
-{
- /*
- * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the
- * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" script.
- */
- switch (target) {
- case SYS_EMU_TARGET_I386:
- case SYS_EMU_TARGET_X86_64:
- return CPU_INFO_ARCH_X86;
-
- case SYS_EMU_TARGET_PPC:
- case SYS_EMU_TARGET_PPC64:
- return CPU_INFO_ARCH_PPC;
-
- case SYS_EMU_TARGET_SPARC:
- case SYS_EMU_TARGET_SPARC64:
- return CPU_INFO_ARCH_SPARC;
-
- case SYS_EMU_TARGET_MIPS:
- case SYS_EMU_TARGET_MIPSEL:
- case SYS_EMU_TARGET_MIPS64:
- case SYS_EMU_TARGET_MIPS64EL:
- return CPU_INFO_ARCH_MIPS;
-
- case SYS_EMU_TARGET_TRICORE:
- return CPU_INFO_ARCH_TRICORE;
-
- case SYS_EMU_TARGET_S390X:
- return CPU_INFO_ARCH_S390;
-
- case SYS_EMU_TARGET_RISCV32:
- case SYS_EMU_TARGET_RISCV64:
- return CPU_INFO_ARCH_RISCV;
-
- default:
- return CPU_INFO_ARCH_OTHER;
- }
-}
-
-static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu)
-{
-#ifdef TARGET_S390X
- S390CPU *s390_cpu = S390_CPU(cpu);
- CPUS390XState *env = &s390_cpu->env;
-
- info->cpu_state = env->cpu_state;
-#else
- abort();
-#endif
-}
-
-/*
- * fast means: we NEVER interrupt vCPU threads to retrieve
- * information from KVM.
- */
-CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
-{
- MachineState *ms = MACHINE(qdev_get_machine());
- MachineClass *mc = MACHINE_GET_CLASS(ms);
- CpuInfoFastList *head = NULL, *cur_item = NULL;
- SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME,
- -1, &error_abort);
- CPUState *cpu;
-
- CPU_FOREACH(cpu) {
- CpuInfoFastList *info = g_malloc0(sizeof(*info));
- info->value = g_malloc0(sizeof(*info->value));
-
- info->value->cpu_index = cpu->cpu_index;
- info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
- info->value->thread_id = cpu->thread_id;
-
- info->value->has_props = !!mc->cpu_index_to_instance_props;
- if (info->value->has_props) {
- CpuInstanceProperties *props;
- props = g_malloc0(sizeof(*props));
- *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
- info->value->props = props;
- }
-
- info->value->arch = sysemu_target_to_cpuinfo_arch(target);
- info->value->target = target;
- if (target == SYS_EMU_TARGET_S390X) {
- cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu);
- }
-
- if (!cur_item) {
- head = cur_item = info;
- } else {
- cur_item->next = info;
- cur_item = info;
- }
- }
-
- return head;
-}
-
void qmp_memsave(int64_t addr, int64_t size, const char *filename,
bool has_cpu, int64_t cpu_index, Error **errp)
{
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index e3a8307be6..99e7abe982 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -23,4 +23,5 @@ common-obj-$(CONFIG_PLATFORM_BUS) += platform-bus.o
common-obj-$(CONFIG_SOFTMMU) += generic-loader.o
common-obj-$(CONFIG_SOFTMMU) += null-machine.o
+obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o
obj-$(CONFIG_SOFTMMU) += numa.o
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
new file mode 100644
index 0000000000..1e08252af7
--- /dev/null
+++ b/hw/core/machine-qmp-cmds.c
@@ -0,0 +1,328 @@
+/*
+ * QMP commands related to machines and CPUs
+ *
+ * Copyright (C) 2014 Red Hat Inc
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "hw/boards.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-machine.h"
+#include "qapi/qmp/qerror.h"
+#include "sysemu/hostmem.h"
+#include "sysemu/hw_accel.h"
+#include "sysemu/numa.h"
+#include "sysemu/sysemu.h"
+
+CpuInfoList *qmp_query_cpus(Error **errp)
+{
+ MachineState *ms = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
+ CpuInfoList *head = NULL, *cur_item = NULL;
+ CPUState *cpu;
+
+ CPU_FOREACH(cpu) {
+ CpuInfoList *info;
+#if defined(TARGET_I386)
+ X86CPU *x86_cpu = X86_CPU(cpu);
+ CPUX86State *env = &x86_cpu->env;
+#elif defined(TARGET_PPC)
+ PowerPCCPU *ppc_cpu = POWERPC_CPU(cpu);
+ CPUPPCState *env = &ppc_cpu->env;
+#elif defined(TARGET_SPARC)
+ SPARCCPU *sparc_cpu = SPARC_CPU(cpu);
+ CPUSPARCState *env = &sparc_cpu->env;
+#elif defined(TARGET_RISCV)
+ RISCVCPU *riscv_cpu = RISCV_CPU(cpu);
+ CPURISCVState *env = &riscv_cpu->env;
+#elif defined(TARGET_MIPS)
+ MIPSCPU *mips_cpu = MIPS_CPU(cpu);
+ CPUMIPSState *env = &mips_cpu->env;
+#elif defined(TARGET_TRICORE)
+ TriCoreCPU *tricore_cpu = TRICORE_CPU(cpu);
+ CPUTriCoreState *env = &tricore_cpu->env;
+#elif defined(TARGET_S390X)
+ S390CPU *s390_cpu = S390_CPU(cpu);
+ CPUS390XState *env = &s390_cpu->env;
+#endif
+
+ cpu_synchronize_state(cpu);
+
+ info = g_malloc0(sizeof(*info));
+ info->value = g_malloc0(sizeof(*info->value));
+ info->value->CPU = cpu->cpu_index;
+ info->value->current = (cpu == first_cpu);
+ info->value->halted = cpu->halted;
+ info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
+ info->value->thread_id = cpu->thread_id;
+#if defined(TARGET_I386)
+ info->value->arch = CPU_INFO_ARCH_X86;
+ info->value->u.x86.pc = env->eip + env->segs[R_CS].base;
+#elif defined(TARGET_PPC)
+ info->value->arch = CPU_INFO_ARCH_PPC;
+ info->value->u.ppc.nip = env->nip;
+#elif defined(TARGET_SPARC)
+ info->value->arch = CPU_INFO_ARCH_SPARC;
+ info->value->u.q_sparc.pc = env->pc;
+ info->value->u.q_sparc.npc = env->npc;
+#elif defined(TARGET_MIPS)
+ info->value->arch = CPU_INFO_ARCH_MIPS;
+ info->value->u.q_mips.PC = env->active_tc.PC;
+#elif defined(TARGET_TRICORE)
+ info->value->arch = CPU_INFO_ARCH_TRICORE;
+ info->value->u.tricore.PC = env->PC;
+#elif defined(TARGET_S390X)
+ info->value->arch = CPU_INFO_ARCH_S390;
+ info->value->u.s390.cpu_state = env->cpu_state;
+#elif defined(TARGET_RISCV)
+ info->value->arch = CPU_INFO_ARCH_RISCV;
+ info->value->u.riscv.pc = env->pc;
+#else
+ info->value->arch = CPU_INFO_ARCH_OTHER;
+#endif
+ info->value->has_props = !!mc->cpu_index_to_instance_props;
+ if (info->value->has_props) {
+ CpuInstanceProperties *props;
+ props = g_malloc0(sizeof(*props));
+ *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
+ info->value->props = props;
+ }
+
+ /* XXX: waiting for the qapi to support GSList */
+ if (!cur_item) {
+ head = cur_item = info;
+ } else {
+ cur_item->next = info;
+ cur_item = info;
+ }
+ }
+
+ return head;
+}
+
+static CpuInfoArch sysemu_target_to_cpuinfo_arch(SysEmuTarget target)
+{
+ /*
+ * The @SysEmuTarget -> @CpuInfoArch mapping below is based on the
+ * TARGET_ARCH -> TARGET_BASE_ARCH mapping in the "configure" script.
+ */
+ switch (target) {
+ case SYS_EMU_TARGET_I386:
+ case SYS_EMU_TARGET_X86_64:
+ return CPU_INFO_ARCH_X86;
+
+ case SYS_EMU_TARGET_PPC:
+ case SYS_EMU_TARGET_PPC64:
+ return CPU_INFO_ARCH_PPC;
+
+ case SYS_EMU_TARGET_SPARC:
+ case SYS_EMU_TARGET_SPARC64:
+ return CPU_INFO_ARCH_SPARC;
+
+ case SYS_EMU_TARGET_MIPS:
+ case SYS_EMU_TARGET_MIPSEL:
+ case SYS_EMU_TARGET_MIPS64:
+ case SYS_EMU_TARGET_MIPS64EL:
+ return CPU_INFO_ARCH_MIPS;
+
+ case SYS_EMU_TARGET_TRICORE:
+ return CPU_INFO_ARCH_TRICORE;
+
+ case SYS_EMU_TARGET_S390X:
+ return CPU_INFO_ARCH_S390;
+
+ case SYS_EMU_TARGET_RISCV32:
+ case SYS_EMU_TARGET_RISCV64:
+ return CPU_INFO_ARCH_RISCV;
+
+ default:
+ return CPU_INFO_ARCH_OTHER;
+ }
+}
+
+static void cpustate_to_cpuinfo_s390(CpuInfoS390 *info, const CPUState *cpu)
+{
+#ifdef TARGET_S390X
+ S390CPU *s390_cpu = S390_CPU(cpu);
+ CPUS390XState *env = &s390_cpu->env;
+
+ info->cpu_state = env->cpu_state;
+#else
+ abort();
+#endif
+}
+
+/*
+ * fast means: we NEVER interrupt vCPU threads to retrieve
+ * information from KVM.
+ */
+CpuInfoFastList *qmp_query_cpus_fast(Error **errp)
+{
+ MachineState *ms = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
+ CpuInfoFastList *head = NULL, *cur_item = NULL;
+ SysEmuTarget target = qapi_enum_parse(&SysEmuTarget_lookup, TARGET_NAME,
+ -1, &error_abort);
+ CPUState *cpu;
+
+ CPU_FOREACH(cpu) {
+ CpuInfoFastList *info = g_malloc0(sizeof(*info));
+ info->value = g_malloc0(sizeof(*info->value));
+
+ info->value->cpu_index = cpu->cpu_index;
+ info->value->qom_path = object_get_canonical_path(OBJECT(cpu));
+ info->value->thread_id = cpu->thread_id;
+
+ info->value->has_props = !!mc->cpu_index_to_instance_props;
+ if (info->value->has_props) {
+ CpuInstanceProperties *props;
+ props = g_malloc0(sizeof(*props));
+ *props = mc->cpu_index_to_instance_props(ms, cpu->cpu_index);
+ info->value->props = props;
+ }
+
+ info->value->arch = sysemu_target_to_cpuinfo_arch(target);
+ info->value->target = target;
+ if (target == SYS_EMU_TARGET_S390X) {
+ cpustate_to_cpuinfo_s390(&info->value->u.s390x, cpu);
+ }
+
+ if (!cur_item) {
+ head = cur_item = info;
+ } else {
+ cur_item->next = info;
+ cur_item = info;
+ }
+ }
+
+ return head;
+}
+
+MachineInfoList *qmp_query_machines(Error **errp)
+{
+ GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
+ MachineInfoList *mach_list = NULL;
+
+ for (el = machines; el; el = el->next) {
+ MachineClass *mc = el->data;
+ MachineInfoList *entry;
+ MachineInfo *info;
+
+ info = g_malloc0(sizeof(*info));
+ if (mc->is_default) {
+ info->has_is_default = true;
+ info->is_default = true;
+ }
+
+ if (mc->alias) {
+ info->has_alias = true;
+ info->alias = g_strdup(mc->alias);
+ }
+
+ info->name = g_strdup(mc->name);
+ info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
+ info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
+
+ entry = g_malloc0(sizeof(*entry));
+ entry->value = info;
+ entry->next = mach_list;
+ mach_list = entry;
+ }
+
+ g_slist_free(machines);
+ return mach_list;
+}
+
+CurrentMachineParams *qmp_query_current_machine(Error **errp)
+{
+ CurrentMachineParams *params = g_malloc0(sizeof(*params));
+ params->wakeup_suspend_support = qemu_wakeup_suspend_enabled();
+
+ return params;
+}
+
+HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
+{
+ MachineState *ms = MACHINE(qdev_get_machine());
+ MachineClass *mc = MACHINE_GET_CLASS(ms);
+
+ if (!mc->has_hotpluggable_cpus) {
+ error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus");
+ return NULL;
+ }
+
+ return machine_query_hotpluggable_cpus(ms);
+}
+
+void qmp_cpu_add(int64_t id, Error **errp)
+{
+ MachineClass *mc;
+
+ mc = MACHINE_GET_CLASS(current_machine);
+ if (mc->hot_add_cpu) {
+ mc->hot_add_cpu(id, errp);
+ } else {
+ error_setg(errp, "Not supported");
+ }
+}
+
+void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
+{
+ if (!runstate_check(RUN_STATE_PRECONFIG)) {
+ error_setg(errp, "The command is permitted only in '%s' state",
+ RunState_str(RUN_STATE_PRECONFIG));
+ return;
+ }
+
+ set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
+}
+
+static int query_memdev(Object *obj, void *opaque)
+{
+ MemdevList **list = opaque;
+ MemdevList *m = NULL;
+
+ if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
+ m = g_malloc0(sizeof(*m));
+
+ m->value = g_malloc0(sizeof(*m->value));
+
+ m->value->id = object_get_canonical_path_component(obj);
+ m->value->has_id = !!m->value->id;
+
+ m->value->size = object_property_get_uint(obj, "size",
+ &error_abort);
+ m->value->merge = object_property_get_bool(obj, "merge",
+ &error_abort);
+ m->value->dump = object_property_get_bool(obj, "dump",
+ &error_abort);
+ m->value->prealloc = object_property_get_bool(obj,
+ "prealloc",
+ &error_abort);
+ m->value->policy = object_property_get_enum(obj,
+ "policy",
+ "HostMemPolicy",
+ &error_abort);
+ object_property_get_uint16List(obj, "host-nodes",
+ &m->value->host_nodes,
+ &error_abort);
+
+ m->next = *list;
+ *list = m;
+ }
+
+ return 0;
+}
+
+MemdevList *qmp_query_memdev(Error **errp)
+{
+ Object *obj = object_get_objects_root();
+ MemdevList *list = NULL;
+
+ object_child_foreach(obj, query_memdev, &list);
+ return list;
+}
diff --git a/hw/core/numa.c b/hw/core/numa.c
index 6f85407c46..76c447f90a 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -27,14 +27,10 @@
#include "exec/cpu-common.h"
#include "exec/ramlist.h"
#include "qemu/bitmap.h"
-#include "qom/cpu.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/opts-visitor.h"
-#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-visit-machine.h"
-#include "hw/boards.h"
-#include "sysemu/hostmem.h"
#include "hw/mem/pc-dimm.h"
#include "hw/mem/memory-device.h"
#include "qemu/option.h"
@@ -174,7 +170,6 @@ static void parse_numa_distance(NumaDistOptions *dist, Error **errp)
have_numa_distance = true;
}
-static
void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp)
{
Error *err = NULL;
@@ -447,17 +442,6 @@ void parse_numa_opts(MachineState *ms)
qemu_opts_foreach(qemu_find_opts("numa"), parse_numa, ms, &error_fatal);
}
-void qmp_set_numa_node(NumaOptions *cmd, Error **errp)
-{
- if (!runstate_check(RUN_STATE_PRECONFIG)) {
- error_setg(errp, "The command is permitted only in '%s' state",
- RunState_str(RUN_STATE_PRECONFIG));
- return;
- }
-
- set_numa_options(MACHINE(qdev_get_machine()), cmd, errp);
-}
-
void numa_cpu_pre_plug(const CPUArchId *slot, DeviceState *dev, Error **errp)
{
int node_id = object_property_get_int(OBJECT(dev), "node-id", &error_abort);
@@ -592,52 +576,6 @@ void query_numa_node_mem(NumaNodeMem node_mem[])
}
}
-static int query_memdev(Object *obj, void *opaque)
-{
- MemdevList **list = opaque;
- MemdevList *m = NULL;
-
- if (object_dynamic_cast(obj, TYPE_MEMORY_BACKEND)) {
- m = g_malloc0(sizeof(*m));
-
- m->value = g_malloc0(sizeof(*m->value));
-
- m->value->id = object_get_canonical_path_component(obj);
- m->value->has_id = !!m->value->id;
-
- m->value->size = object_property_get_uint(obj, "size",
- &error_abort);
- m->value->merge = object_property_get_bool(obj, "merge",
- &error_abort);
- m->value->dump = object_property_get_bool(obj, "dump",
- &error_abort);
- m->value->prealloc = object_property_get_bool(obj,
- "prealloc",
- &error_abort);
- m->value->policy = object_property_get_enum(obj,
- "policy",
- "HostMemPolicy",
- &error_abort);
- object_property_get_uint16List(obj, "host-nodes",
- &m->value->host_nodes,
- &error_abort);
-
- m->next = *list;
- *list = m;
- }
-
- return 0;
-}
-
-MemdevList *qmp_query_memdev(Error **errp)
-{
- Object *obj = object_get_objects_root();
- MemdevList *list = NULL;
-
- object_child_foreach(obj, query_memdev, &list);
- return list;
-}
-
void ram_block_notifier_add(RAMBlockNotifier *n)
{
QLIST_INSERT_HEAD(&ram_list.ramblock_notifiers, n, next);
diff --git a/include/sysemu/numa.h b/include/sysemu/numa.h
index b6ac7de43e..01a263eba2 100644
--- a/include/sysemu/numa.h
+++ b/include/sysemu/numa.h
@@ -22,6 +22,8 @@ struct NumaNodeMem {
};
extern NodeInfo numa_info[MAX_NODES];
+
+void set_numa_options(MachineState *ms, NumaOptions *object, Error **errp);
void parse_numa_opts(MachineState *ms);
void numa_complete_configuration(MachineState *ms);
void query_numa_node_mem(NumaNodeMem node_mem[]);
diff --git a/monitor/misc.c b/monitor/misc.c
index 2fb6896e84..45f3f55a4d 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -2338,16 +2338,3 @@ void monitor_init_globals(void)
sortcmdlist();
qemu_mutex_init(&mon_fdsets_lock);
}
-
-HotpluggableCPUList *qmp_query_hotpluggable_cpus(Error **errp)
-{
- MachineState *ms = MACHINE(qdev_get_machine());
- MachineClass *mc = MACHINE_GET_CLASS(ms);
-
- if (!mc->has_hotpluggable_cpus) {
- error_setg(errp, QERR_FEATURE_DISABLED, "query-hotpluggable-cpus");
- return NULL;
- }
-
- return machine_query_hotpluggable_cpus(ms);
-}
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
index 58b54db033..8c55315839 100644
--- a/monitor/qmp-cmds.c
+++ b/monitor/qmp-cmds.c
@@ -114,18 +114,6 @@ void qmp_system_powerdown(Error **erp)
qemu_system_powerdown_request();
}
-void qmp_cpu_add(int64_t id, Error **errp)
-{
- MachineClass *mc;
-
- mc = MACHINE_GET_CLASS(current_machine);
- if (mc->hot_add_cpu) {
- mc->hot_add_cpu(id, errp);
- } else {
- error_setg(errp, "Not supported");
- }
-}
-
void qmp_x_exit_preconfig(Error **errp)
{
if (!runstate_check(RUN_STATE_PRECONFIG)) {
diff --git a/vl.c b/vl.c
index 0eb9b2c8bd..ddefa75c1d 100644
--- a/vl.c
+++ b/vl.c
@@ -55,7 +55,6 @@ int main(int argc, char **argv)
#include "qemu/error-report.h"
#include "qemu/sockets.h"
#include "hw/hw.h"
-#include "hw/boards.h"
#include "sysemu/accel.h"
#include "hw/usb.h"
#include "hw/isa/isa.h"
@@ -125,7 +124,6 @@ int main(int argc, char **argv)
#include "qapi/qapi-visit-block-core.h"
#include "qapi/qapi-visit-ui.h"
#include "qapi/qapi-commands-block-core.h"
-#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-run-state.h"
#include "qapi/qapi-commands-ui.h"
#include "qapi/qmp/qerror.h"
@@ -1406,41 +1404,6 @@ static MachineClass *find_default_machine(GSList *machines)
return NULL;
}
-MachineInfoList *qmp_query_machines(Error **errp)
-{
- GSList *el, *machines = object_class_get_list(TYPE_MACHINE, false);
- MachineInfoList *mach_list = NULL;
-
- for (el = machines; el; el = el->next) {
- MachineClass *mc = el->data;
- MachineInfoList *entry;
- MachineInfo *info;
-
- info = g_malloc0(sizeof(*info));
- if (mc->is_default) {
- info->has_is_default = true;
- info->is_default = true;
- }
-
- if (mc->alias) {
- info->has_alias = true;
- info->alias = g_strdup(mc->alias);
- }
-
- info->name = g_strdup(mc->name);
- info->cpu_max = !mc->max_cpus ? 1 : mc->max_cpus;
- info->hotpluggable_cpus = mc->has_hotpluggable_cpus;
-
- entry = g_malloc0(sizeof(*entry));
- entry->value = info;
- entry->next = mach_list;
- mach_list = entry;
- }
-
- g_slist_free(machines);
- return mach_list;
-}
-
static int machine_help_func(QemuOpts *opts, MachineState *machine)
{
ObjectProperty *prop;
@@ -1739,14 +1702,6 @@ bool qemu_wakeup_suspend_enabled(void)
return wakeup_suspend_enabled;
}
-CurrentMachineParams *qmp_query_current_machine(Error **errp)
-{
- CurrentMachineParams *params = g_malloc0(sizeof(*params));
- params->wakeup_suspend_support = qemu_wakeup_suspend_enabled();
-
- return params;
-}
-
void qemu_system_killed(int signal, pid_t pid)
{
shutdown_signal = signal;
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 10/17] hw/core: Collect QMP command handlers in hw/core/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 10/17] hw/core: Collect QMP command handlers in hw/core/ Markus Armbruster
@ 2019-06-20 8:50 ` Daniel P. Berrangé
0 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:50 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:43PM +0200, Markus Armbruster wrote:
> The handlers for qapi/machine.json's QMP commands are spread over
> cpus.c, hw/core/numa.c, monitor/misc.c, monitor/qmp-cmds.c, and vl.c.
> Move them all to new hw/core/machine-qmp-cmds.c, where they are
> covered by MAINTAINERS section "Machine core", just like
> qapi/machine.json.
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 1 +
> cpus.c | 188 ---------------------
> hw/core/Makefile.objs | 1 +
> hw/core/machine-qmp-cmds.c | 328 +++++++++++++++++++++++++++++++++++++
> hw/core/numa.c | 62 -------
> include/sysemu/numa.h | 2 +
> monitor/misc.c | 13 --
> monitor/qmp-cmds.c | 12 --
> vl.c | 45 -----
> 9 files changed, 332 insertions(+), 320 deletions(-)
> create mode 100644 hw/core/machine-qmp-cmds.c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP command handlers in hw/core/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (9 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 10/17] hw/core: Collect QMP command handlers in hw/core/ Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:51 ` Daniel P. Berrangé
2019-06-20 9:56 ` Dr. David Alan Gilbert
2019-06-19 20:10 ` [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json Markus Armbruster
` (5 subsequent siblings)
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Eduardo Habkost, Dr. David Alan Gilbert
Move the HMP handlers related to qapi/machine.json to
hw/core/machine-hmp-cmds.c, where they are covered by MAINTAINERS
section "Machine core", just like qapi/machine.json.
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/core/Makefile.objs | 1 +
hw/core/machine-hmp-cmds.c | 164 +++++++++++++++++++++++++++++++++++++
include/monitor/hmp.h | 1 +
monitor/hmp-cmds.c | 111 -------------------------
monitor/misc.c | 32 +-------
5 files changed, 168 insertions(+), 141 deletions(-)
create mode 100644 hw/core/machine-hmp-cmds.c
diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
index 99e7abe982..585b734358 100644
--- a/hw/core/Makefile.objs
+++ b/hw/core/Makefile.objs
@@ -25,3 +25,4 @@ common-obj-$(CONFIG_SOFTMMU) += null-machine.o
obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o
obj-$(CONFIG_SOFTMMU) += numa.o
+common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
new file mode 100644
index 0000000000..7fa6075f1e
--- /dev/null
+++ b/hw/core/machine-hmp-cmds.c
@@ -0,0 +1,164 @@
+/*
+ * HMP commands related to machines and CPUs
+ *
+ * Copyright IBM, Corp. 2011
+ *
+ * Authors:
+ * Anthony Liguori <aliguori@us.ibm.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ *
+ * Contributions after 2012-01-13 are licensed under the terms of the
+ * GNU GPL, version 2 or (at your option) any later version.
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "qapi/qapi-builtin-visit.h"
+#include "qapi/qapi-commands-machine.h"
+#include "qapi/qmp/qdict.h"
+#include "qapi/string-output-visitor.h"
+#include "qemu/error-report.h"
+#include "sysemu/numa.h"
+
+void hmp_info_cpus(Monitor *mon, const QDict *qdict)
+{
+ CpuInfoFastList *cpu_list, *cpu;
+
+ cpu_list = qmp_query_cpus_fast(NULL);
+
+ for (cpu = cpu_list; cpu; cpu = cpu->next) {
+ int active = ' ';
+
+ if (cpu->value->cpu_index == monitor_get_cpu_index()) {
+ active = '*';
+ }
+
+ monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
+ cpu->value->cpu_index);
+ monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
+ }
+
+ qapi_free_CpuInfoFastList(cpu_list);
+}
+
+void hmp_cpu_add(Monitor *mon, const QDict *qdict)
+{
+ int cpuid;
+ Error *err = NULL;
+
+ error_report("cpu_add is deprecated, please use device_add instead");
+
+ cpuid = qdict_get_int(qdict, "id");
+ qmp_cpu_add(cpuid, &err);
+ hmp_handle_error(mon, &err);
+}
+
+void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
+ HotpluggableCPUList *saved = l;
+ CpuInstanceProperties *c;
+
+ if (err != NULL) {
+ hmp_handle_error(mon, &err);
+ return;
+ }
+
+ monitor_printf(mon, "Hotpluggable CPUs:\n");
+ while (l) {
+ monitor_printf(mon, " type: \"%s\"\n", l->value->type);
+ monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n",
+ l->value->vcpus_count);
+ if (l->value->has_qom_path) {
+ monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path);
+ }
+
+ c = l->value->props;
+ monitor_printf(mon, " CPUInstance Properties:\n");
+ if (c->has_node_id) {
+ monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_id);
+ }
+ if (c->has_socket_id) {
+ monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->socket_id);
+ }
+ if (c->has_core_id) {
+ monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
+ }
+ if (c->has_thread_id) {
+ monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thread_id);
+ }
+
+ l = l->next;
+ }
+
+ qapi_free_HotpluggableCPUList(saved);
+}
+
+void hmp_info_memdev(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ MemdevList *memdev_list = qmp_query_memdev(&err);
+ MemdevList *m = memdev_list;
+ Visitor *v;
+ char *str;
+
+ while (m) {
+ v = string_output_visitor_new(false, &str);
+ visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
+ monitor_printf(mon, "memory backend: %s\n", m->value->id);
+ monitor_printf(mon, " size: %" PRId64 "\n", m->value->size);
+ monitor_printf(mon, " merge: %s\n",
+ m->value->merge ? "true" : "false");
+ monitor_printf(mon, " dump: %s\n",
+ m->value->dump ? "true" : "false");
+ monitor_printf(mon, " prealloc: %s\n",
+ m->value->prealloc ? "true" : "false");
+ monitor_printf(mon, " policy: %s\n",
+ HostMemPolicy_str(m->value->policy));
+ visit_complete(v, &str);
+ monitor_printf(mon, " host nodes: %s\n", str);
+
+ g_free(str);
+ visit_free(v);
+ m = m->next;
+ }
+
+ monitor_printf(mon, "\n");
+
+ qapi_free_MemdevList(memdev_list);
+ hmp_handle_error(mon, &err);
+}
+
+void hmp_info_numa(Monitor *mon, const QDict *qdict)
+{
+ int i;
+ NumaNodeMem *node_mem;
+ CpuInfoList *cpu_list, *cpu;
+
+ cpu_list = qmp_query_cpus(&error_abort);
+ node_mem = g_new0(NumaNodeMem, nb_numa_nodes);
+
+ query_numa_node_mem(node_mem);
+ monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
+ for (i = 0; i < nb_numa_nodes; i++) {
+ monitor_printf(mon, "node %d cpus:", i);
+ for (cpu = cpu_list; cpu; cpu = cpu->next) {
+ if (cpu->value->has_props && cpu->value->props->has_node_id &&
+ cpu->value->props->node_id == i) {
+ monitor_printf(mon, " %" PRIi64, cpu->value->CPU);
+ }
+ }
+ monitor_printf(mon, "\n");
+ monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
+ node_mem[i].node_mem >> 20);
+ monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i,
+ node_mem[i].node_plugged_mem >> 20);
+ }
+ qapi_free_CpuInfoList(cpu_list);
+ g_free(node_mem);
+}
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index f46ccdaa35..9d558e9d78 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -117,6 +117,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict);
void hmp_object_add(Monitor *mon, const QDict *qdict);
void hmp_object_del(Monitor *mon, const QDict *qdict);
void hmp_info_memdev(Monitor *mon, const QDict *qdict);
+void hmp_info_numa(Monitor *mon, const QDict *qdict);
void hmp_info_memory_devices(Monitor *mon, const QDict *qdict);
void hmp_qom_list(Monitor *mon, const QDict *qdict);
void hmp_qom_set(Monitor *mon, const QDict *qdict);
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 789f763938..ea8ae2966e 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -31,7 +31,6 @@
#include "qapi/qapi-builtin-visit.h"
#include "qapi/qapi-commands-block.h"
#include "qapi/qapi-commands-char.h"
-#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-net.h"
@@ -457,27 +456,6 @@ void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict)
qmp_query_migrate_cache_size(NULL) >> 10);
}
-void hmp_info_cpus(Monitor *mon, const QDict *qdict)
-{
- CpuInfoFastList *cpu_list, *cpu;
-
- cpu_list = qmp_query_cpus_fast(NULL);
-
- for (cpu = cpu_list; cpu; cpu = cpu->next) {
- int active = ' ';
-
- if (cpu->value->cpu_index == monitor_get_cpu_index()) {
- active = '*';
- }
-
- monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
- cpu->value->cpu_index);
- monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
- }
-
- qapi_free_CpuInfoFastList(cpu_list);
-}
-
static void print_block_info(Monitor *mon, BlockInfo *info,
BlockDeviceInfo *inserted, bool verbose)
{
@@ -2472,18 +2450,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
}
-void hmp_cpu_add(Monitor *mon, const QDict *qdict)
-{
- int cpuid;
- Error *err = NULL;
-
- error_report("cpu_add is deprecated, please use device_add instead");
-
- cpuid = qdict_get_int(qdict, "id");
- qmp_cpu_add(cpuid, &err);
- hmp_handle_error(mon, &err);
-}
-
void hmp_chardev_add(Monitor *mon, const QDict *qdict)
{
const char *args = qdict_get_str(qdict, "args");
@@ -2615,41 +2581,6 @@ void hmp_object_del(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
}
-void hmp_info_memdev(Monitor *mon, const QDict *qdict)
-{
- Error *err = NULL;
- MemdevList *memdev_list = qmp_query_memdev(&err);
- MemdevList *m = memdev_list;
- Visitor *v;
- char *str;
-
- while (m) {
- v = string_output_visitor_new(false, &str);
- visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
- monitor_printf(mon, "memory backend: %s\n", m->value->id);
- monitor_printf(mon, " size: %" PRId64 "\n", m->value->size);
- monitor_printf(mon, " merge: %s\n",
- m->value->merge ? "true" : "false");
- monitor_printf(mon, " dump: %s\n",
- m->value->dump ? "true" : "false");
- monitor_printf(mon, " prealloc: %s\n",
- m->value->prealloc ? "true" : "false");
- monitor_printf(mon, " policy: %s\n",
- HostMemPolicy_str(m->value->policy));
- visit_complete(v, &str);
- monitor_printf(mon, " host nodes: %s\n", str);
-
- g_free(str);
- visit_free(v);
- m = m->next;
- }
-
- monitor_printf(mon, "\n");
-
- qapi_free_MemdevList(memdev_list);
- hmp_handle_error(mon, &err);
-}
-
void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
@@ -3039,48 +2970,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict)
ram_block_dump(mon);
}
-void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
-{
- Error *err = NULL;
- HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
- HotpluggableCPUList *saved = l;
- CpuInstanceProperties *c;
-
- if (err != NULL) {
- hmp_handle_error(mon, &err);
- return;
- }
-
- monitor_printf(mon, "Hotpluggable CPUs:\n");
- while (l) {
- monitor_printf(mon, " type: \"%s\"\n", l->value->type);
- monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n",
- l->value->vcpus_count);
- if (l->value->has_qom_path) {
- monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path);
- }
-
- c = l->value->props;
- monitor_printf(mon, " CPUInstance Properties:\n");
- if (c->has_node_id) {
- monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_id);
- }
- if (c->has_socket_id) {
- monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->socket_id);
- }
- if (c->has_core_id) {
- monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
- }
- if (c->has_thread_id) {
- monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thread_id);
- }
-
- l = l->next;
- }
-
- qapi_free_HotpluggableCPUList(saved);
-}
-
void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
diff --git a/monitor/misc.c b/monitor/misc.c
index 45f3f55a4d..00338c002a 100644
--- a/monitor/misc.c
+++ b/monitor/misc.c
@@ -36,7 +36,6 @@
#include "net/slirp.h"
#include "chardev/char-mux.h"
#include "ui/qemu-spice.h"
-#include "sysemu/numa.h"
#include "qemu/config-file.h"
#include "qemu/ctype.h"
#include "ui/console.h"
@@ -48,6 +47,8 @@
#include "sysemu/hw_accel.h"
#include "authz/list.h"
#include "qapi/util.h"
+#include "sysemu/blockdev.h"
+#include "sysemu/sysemu.h"
#include "sysemu/tcg.h"
#include "sysemu/tpm.h"
#include "qapi/qmp/qdict.h"
@@ -1081,35 +1082,6 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)
mtree_info(flatview, dispatch_tree, owner);
}
-static void hmp_info_numa(Monitor *mon, const QDict *qdict)
-{
- int i;
- NumaNodeMem *node_mem;
- CpuInfoList *cpu_list, *cpu;
-
- cpu_list = qmp_query_cpus(&error_abort);
- node_mem = g_new0(NumaNodeMem, nb_numa_nodes);
-
- query_numa_node_mem(node_mem);
- monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
- for (i = 0; i < nb_numa_nodes; i++) {
- monitor_printf(mon, "node %d cpus:", i);
- for (cpu = cpu_list; cpu; cpu = cpu->next) {
- if (cpu->value->has_props && cpu->value->props->has_node_id &&
- cpu->value->props->node_id == i) {
- monitor_printf(mon, " %" PRIi64, cpu->value->CPU);
- }
- }
- monitor_printf(mon, "\n");
- monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
- node_mem[i].node_mem >> 20);
- monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i,
- node_mem[i].node_plugged_mem >> 20);
- }
- qapi_free_CpuInfoList(cpu_list);
- g_free(node_mem);
-}
-
#ifdef CONFIG_PROFILER
int64_t dev_time;
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP command handlers in hw/core/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP " Markus Armbruster
@ 2019-06-20 8:51 ` Daniel P. Berrangé
2019-06-20 9:56 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:51 UTC (permalink / raw)
To: Markus Armbruster
Cc: kwolf, qemu-devel, Dr. David Alan Gilbert, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:44PM +0200, Markus Armbruster wrote:
> Move the HMP handlers related to qapi/machine.json to
> hw/core/machine-hmp-cmds.c, where they are covered by MAINTAINERS
> section "Machine core", just like qapi/machine.json.
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> hw/core/Makefile.objs | 1 +
> hw/core/machine-hmp-cmds.c | 164 +++++++++++++++++++++++++++++++++++++
> include/monitor/hmp.h | 1 +
> monitor/hmp-cmds.c | 111 -------------------------
> monitor/misc.c | 32 +-------
> 5 files changed, 168 insertions(+), 141 deletions(-)
> create mode 100644 hw/core/machine-hmp-cmds.c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP command handlers in hw/core/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP " Markus Armbruster
2019-06-20 8:51 ` Daniel P. Berrangé
@ 2019-06-20 9:56 ` Dr. David Alan Gilbert
1 sibling, 0 replies; 57+ messages in thread
From: Dr. David Alan Gilbert @ 2019-06-20 9:56 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel, Eduardo Habkost
* Markus Armbruster (armbru@redhat.com) wrote:
> Move the HMP handlers related to qapi/machine.json to
> hw/core/machine-hmp-cmds.c, where they are covered by MAINTAINERS
> section "Machine core", just like qapi/machine.json.
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> hw/core/Makefile.objs | 1 +
> hw/core/machine-hmp-cmds.c | 164 +++++++++++++++++++++++++++++++++++++
> include/monitor/hmp.h | 1 +
> monitor/hmp-cmds.c | 111 -------------------------
> monitor/misc.c | 32 +-------
> 5 files changed, 168 insertions(+), 141 deletions(-)
> create mode 100644 hw/core/machine-hmp-cmds.c
>
> diff --git a/hw/core/Makefile.objs b/hw/core/Makefile.objs
> index 99e7abe982..585b734358 100644
> --- a/hw/core/Makefile.objs
> +++ b/hw/core/Makefile.objs
> @@ -25,3 +25,4 @@ common-obj-$(CONFIG_SOFTMMU) += null-machine.o
>
> obj-$(CONFIG_SOFTMMU) += machine-qmp-cmds.o
> obj-$(CONFIG_SOFTMMU) += numa.o
> +common-obj-$(CONFIG_SOFTMMU) += machine-hmp-cmds.o
> diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
> new file mode 100644
> index 0000000000..7fa6075f1e
> --- /dev/null
> +++ b/hw/core/machine-hmp-cmds.c
> @@ -0,0 +1,164 @@
> +/*
> + * HMP commands related to machines and CPUs
> + *
> + * Copyright IBM, Corp. 2011
> + *
> + * Authors:
> + * Anthony Liguori <aliguori@us.ibm.com>
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2. See
> + * the COPYING file in the top-level directory.
> + *
> + * Contributions after 2012-01-13 are licensed under the terms of the
> + * GNU GPL, version 2 or (at your option) any later version.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "monitor/hmp.h"
> +#include "monitor/monitor.h"
> +#include "qapi/error.h"
> +#include "qapi/qapi-builtin-visit.h"
> +#include "qapi/qapi-commands-machine.h"
> +#include "qapi/qmp/qdict.h"
> +#include "qapi/string-output-visitor.h"
> +#include "qemu/error-report.h"
> +#include "sysemu/numa.h"
> +
> +void hmp_info_cpus(Monitor *mon, const QDict *qdict)
> +{
> + CpuInfoFastList *cpu_list, *cpu;
> +
> + cpu_list = qmp_query_cpus_fast(NULL);
> +
> + for (cpu = cpu_list; cpu; cpu = cpu->next) {
> + int active = ' ';
> +
> + if (cpu->value->cpu_index == monitor_get_cpu_index()) {
> + active = '*';
> + }
> +
> + monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
> + cpu->value->cpu_index);
> + monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
> + }
> +
> + qapi_free_CpuInfoFastList(cpu_list);
> +}
> +
> +void hmp_cpu_add(Monitor *mon, const QDict *qdict)
> +{
> + int cpuid;
> + Error *err = NULL;
> +
> + error_report("cpu_add is deprecated, please use device_add instead");
> +
> + cpuid = qdict_get_int(qdict, "id");
> + qmp_cpu_add(cpuid, &err);
> + hmp_handle_error(mon, &err);
> +}
> +
> +void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
> +{
> + Error *err = NULL;
> + HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
> + HotpluggableCPUList *saved = l;
> + CpuInstanceProperties *c;
> +
> + if (err != NULL) {
> + hmp_handle_error(mon, &err);
> + return;
> + }
> +
> + monitor_printf(mon, "Hotpluggable CPUs:\n");
> + while (l) {
> + monitor_printf(mon, " type: \"%s\"\n", l->value->type);
> + monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n",
> + l->value->vcpus_count);
> + if (l->value->has_qom_path) {
> + monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path);
> + }
> +
> + c = l->value->props;
> + monitor_printf(mon, " CPUInstance Properties:\n");
> + if (c->has_node_id) {
> + monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_id);
> + }
> + if (c->has_socket_id) {
> + monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->socket_id);
> + }
> + if (c->has_core_id) {
> + monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
> + }
> + if (c->has_thread_id) {
> + monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thread_id);
> + }
> +
> + l = l->next;
> + }
> +
> + qapi_free_HotpluggableCPUList(saved);
> +}
> +
> +void hmp_info_memdev(Monitor *mon, const QDict *qdict)
> +{
> + Error *err = NULL;
> + MemdevList *memdev_list = qmp_query_memdev(&err);
> + MemdevList *m = memdev_list;
> + Visitor *v;
> + char *str;
> +
> + while (m) {
> + v = string_output_visitor_new(false, &str);
> + visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
> + monitor_printf(mon, "memory backend: %s\n", m->value->id);
> + monitor_printf(mon, " size: %" PRId64 "\n", m->value->size);
> + monitor_printf(mon, " merge: %s\n",
> + m->value->merge ? "true" : "false");
> + monitor_printf(mon, " dump: %s\n",
> + m->value->dump ? "true" : "false");
> + monitor_printf(mon, " prealloc: %s\n",
> + m->value->prealloc ? "true" : "false");
> + monitor_printf(mon, " policy: %s\n",
> + HostMemPolicy_str(m->value->policy));
> + visit_complete(v, &str);
> + monitor_printf(mon, " host nodes: %s\n", str);
> +
> + g_free(str);
> + visit_free(v);
> + m = m->next;
> + }
> +
> + monitor_printf(mon, "\n");
> +
> + qapi_free_MemdevList(memdev_list);
> + hmp_handle_error(mon, &err);
> +}
> +
> +void hmp_info_numa(Monitor *mon, const QDict *qdict)
> +{
> + int i;
> + NumaNodeMem *node_mem;
> + CpuInfoList *cpu_list, *cpu;
> +
> + cpu_list = qmp_query_cpus(&error_abort);
> + node_mem = g_new0(NumaNodeMem, nb_numa_nodes);
> +
> + query_numa_node_mem(node_mem);
> + monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
> + for (i = 0; i < nb_numa_nodes; i++) {
> + monitor_printf(mon, "node %d cpus:", i);
> + for (cpu = cpu_list; cpu; cpu = cpu->next) {
> + if (cpu->value->has_props && cpu->value->props->has_node_id &&
> + cpu->value->props->node_id == i) {
> + monitor_printf(mon, " %" PRIi64, cpu->value->CPU);
> + }
> + }
> + monitor_printf(mon, "\n");
> + monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
> + node_mem[i].node_mem >> 20);
> + monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i,
> + node_mem[i].node_plugged_mem >> 20);
> + }
> + qapi_free_CpuInfoList(cpu_list);
> + g_free(node_mem);
> +}
> diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
> index f46ccdaa35..9d558e9d78 100644
> --- a/include/monitor/hmp.h
> +++ b/include/monitor/hmp.h
> @@ -117,6 +117,7 @@ void hmp_cpu_add(Monitor *mon, const QDict *qdict);
> void hmp_object_add(Monitor *mon, const QDict *qdict);
> void hmp_object_del(Monitor *mon, const QDict *qdict);
> void hmp_info_memdev(Monitor *mon, const QDict *qdict);
> +void hmp_info_numa(Monitor *mon, const QDict *qdict);
> void hmp_info_memory_devices(Monitor *mon, const QDict *qdict);
> void hmp_qom_list(Monitor *mon, const QDict *qdict);
> void hmp_qom_set(Monitor *mon, const QDict *qdict);
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index 789f763938..ea8ae2966e 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -31,7 +31,6 @@
> #include "qapi/qapi-builtin-visit.h"
> #include "qapi/qapi-commands-block.h"
> #include "qapi/qapi-commands-char.h"
> -#include "qapi/qapi-commands-machine.h"
> #include "qapi/qapi-commands-migration.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/qapi-commands-net.h"
> @@ -457,27 +456,6 @@ void hmp_info_migrate_cache_size(Monitor *mon, const QDict *qdict)
> qmp_query_migrate_cache_size(NULL) >> 10);
> }
>
> -void hmp_info_cpus(Monitor *mon, const QDict *qdict)
> -{
> - CpuInfoFastList *cpu_list, *cpu;
> -
> - cpu_list = qmp_query_cpus_fast(NULL);
> -
> - for (cpu = cpu_list; cpu; cpu = cpu->next) {
> - int active = ' ';
> -
> - if (cpu->value->cpu_index == monitor_get_cpu_index()) {
> - active = '*';
> - }
> -
> - monitor_printf(mon, "%c CPU #%" PRId64 ":", active,
> - cpu->value->cpu_index);
> - monitor_printf(mon, " thread_id=%" PRId64 "\n", cpu->value->thread_id);
> - }
> -
> - qapi_free_CpuInfoFastList(cpu_list);
> -}
> -
> static void print_block_info(Monitor *mon, BlockInfo *info,
> BlockDeviceInfo *inserted, bool verbose)
> {
> @@ -2472,18 +2450,6 @@ void hmp_nbd_server_stop(Monitor *mon, const QDict *qdict)
> hmp_handle_error(mon, &err);
> }
>
> -void hmp_cpu_add(Monitor *mon, const QDict *qdict)
> -{
> - int cpuid;
> - Error *err = NULL;
> -
> - error_report("cpu_add is deprecated, please use device_add instead");
> -
> - cpuid = qdict_get_int(qdict, "id");
> - qmp_cpu_add(cpuid, &err);
> - hmp_handle_error(mon, &err);
> -}
> -
> void hmp_chardev_add(Monitor *mon, const QDict *qdict)
> {
> const char *args = qdict_get_str(qdict, "args");
> @@ -2615,41 +2581,6 @@ void hmp_object_del(Monitor *mon, const QDict *qdict)
> hmp_handle_error(mon, &err);
> }
>
> -void hmp_info_memdev(Monitor *mon, const QDict *qdict)
> -{
> - Error *err = NULL;
> - MemdevList *memdev_list = qmp_query_memdev(&err);
> - MemdevList *m = memdev_list;
> - Visitor *v;
> - char *str;
> -
> - while (m) {
> - v = string_output_visitor_new(false, &str);
> - visit_type_uint16List(v, NULL, &m->value->host_nodes, NULL);
> - monitor_printf(mon, "memory backend: %s\n", m->value->id);
> - monitor_printf(mon, " size: %" PRId64 "\n", m->value->size);
> - monitor_printf(mon, " merge: %s\n",
> - m->value->merge ? "true" : "false");
> - monitor_printf(mon, " dump: %s\n",
> - m->value->dump ? "true" : "false");
> - monitor_printf(mon, " prealloc: %s\n",
> - m->value->prealloc ? "true" : "false");
> - monitor_printf(mon, " policy: %s\n",
> - HostMemPolicy_str(m->value->policy));
> - visit_complete(v, &str);
> - monitor_printf(mon, " host nodes: %s\n", str);
> -
> - g_free(str);
> - visit_free(v);
> - m = m->next;
> - }
> -
> - monitor_printf(mon, "\n");
> -
> - qapi_free_MemdevList(memdev_list);
> - hmp_handle_error(mon, &err);
> -}
> -
> void hmp_info_memory_devices(Monitor *mon, const QDict *qdict)
> {
> Error *err = NULL;
> @@ -3039,48 +2970,6 @@ void hmp_info_ramblock(Monitor *mon, const QDict *qdict)
> ram_block_dump(mon);
> }
>
> -void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
> -{
> - Error *err = NULL;
> - HotpluggableCPUList *l = qmp_query_hotpluggable_cpus(&err);
> - HotpluggableCPUList *saved = l;
> - CpuInstanceProperties *c;
> -
> - if (err != NULL) {
> - hmp_handle_error(mon, &err);
> - return;
> - }
> -
> - monitor_printf(mon, "Hotpluggable CPUs:\n");
> - while (l) {
> - monitor_printf(mon, " type: \"%s\"\n", l->value->type);
> - monitor_printf(mon, " vcpus_count: \"%" PRIu64 "\"\n",
> - l->value->vcpus_count);
> - if (l->value->has_qom_path) {
> - monitor_printf(mon, " qom_path: \"%s\"\n", l->value->qom_path);
> - }
> -
> - c = l->value->props;
> - monitor_printf(mon, " CPUInstance Properties:\n");
> - if (c->has_node_id) {
> - monitor_printf(mon, " node-id: \"%" PRIu64 "\"\n", c->node_id);
> - }
> - if (c->has_socket_id) {
> - monitor_printf(mon, " socket-id: \"%" PRIu64 "\"\n", c->socket_id);
> - }
> - if (c->has_core_id) {
> - monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
> - }
> - if (c->has_thread_id) {
> - monitor_printf(mon, " thread-id: \"%" PRIu64 "\"\n", c->thread_id);
> - }
> -
> - l = l->next;
> - }
> -
> - qapi_free_HotpluggableCPUList(saved);
> -}
> -
> void hmp_info_vm_generation_id(Monitor *mon, const QDict *qdict)
> {
> Error *err = NULL;
> diff --git a/monitor/misc.c b/monitor/misc.c
> index 45f3f55a4d..00338c002a 100644
> --- a/monitor/misc.c
> +++ b/monitor/misc.c
> @@ -36,7 +36,6 @@
> #include "net/slirp.h"
> #include "chardev/char-mux.h"
> #include "ui/qemu-spice.h"
> -#include "sysemu/numa.h"
> #include "qemu/config-file.h"
> #include "qemu/ctype.h"
> #include "ui/console.h"
> @@ -48,6 +47,8 @@
> #include "sysemu/hw_accel.h"
> #include "authz/list.h"
> #include "qapi/util.h"
> +#include "sysemu/blockdev.h"
> +#include "sysemu/sysemu.h"
> #include "sysemu/tcg.h"
> #include "sysemu/tpm.h"
> #include "qapi/qmp/qdict.h"
> @@ -1081,35 +1082,6 @@ static void hmp_info_mtree(Monitor *mon, const QDict *qdict)
> mtree_info(flatview, dispatch_tree, owner);
> }
>
> -static void hmp_info_numa(Monitor *mon, const QDict *qdict)
> -{
> - int i;
> - NumaNodeMem *node_mem;
> - CpuInfoList *cpu_list, *cpu;
> -
> - cpu_list = qmp_query_cpus(&error_abort);
> - node_mem = g_new0(NumaNodeMem, nb_numa_nodes);
> -
> - query_numa_node_mem(node_mem);
> - monitor_printf(mon, "%d nodes\n", nb_numa_nodes);
> - for (i = 0; i < nb_numa_nodes; i++) {
> - monitor_printf(mon, "node %d cpus:", i);
> - for (cpu = cpu_list; cpu; cpu = cpu->next) {
> - if (cpu->value->has_props && cpu->value->props->has_node_id &&
> - cpu->value->props->node_id == i) {
> - monitor_printf(mon, " %" PRIi64, cpu->value->CPU);
> - }
> - }
> - monitor_printf(mon, "\n");
> - monitor_printf(mon, "node %d size: %" PRId64 " MB\n", i,
> - node_mem[i].node_mem >> 20);
> - monitor_printf(mon, "node %d plugged: %" PRId64 " MB\n", i,
> - node_mem[i].node_plugged_mem >> 20);
> - }
> - qapi_free_CpuInfoList(cpu_list);
> - g_free(node_mem);
> -}
> -
> #ifdef CONFIG_PROFILER
>
> int64_t dev_time;
> --
> 2.21.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (10 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 11/17] hw/core: Collect HMP " Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-19 20:18 ` Eric Blake
2019-06-20 8:53 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 13/17] qapi: Rename target.json to misc-target.json Markus Armbruster
` (4 subsequent siblings)
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Eduardo Habkost
Move commands query-cpu-definitions, query-cpu-model-baseline,
query-cpu-model-comparison, and query-cpu-model-expansion with their
types from target.json to machine-target.json. Also move typee
CpuModelInfo, CpuModelExpansionType, and CpuModelCompareResult from
misc.json there. Add machine-target.json to MAINTAINERS section
"Machine core".
Cc: Eduardo Habkost <ehabkost@redhat.com>
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 1 +
qapi/Makefile.objs | 2 +-
qapi/machine-target.json | 318 ++++++++++++++++++++++++++++++++
qapi/misc.json | 74 --------
qapi/qapi-schema.json | 1 +
qapi/target.json | 242 ------------------------
target/arm/helper.c | 2 +-
target/i386/cpu.c | 2 +-
target/mips/helper.c | 2 +-
target/ppc/translate_init.inc.c | 2 +-
target/s390x/cpu_models.c | 2 +-
11 files changed, 326 insertions(+), 322 deletions(-)
create mode 100644 qapi/machine-target.json
diff --git a/MAINTAINERS b/MAINTAINERS
index 0e6d0861ab..89e8c01cf3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1271,6 +1271,7 @@ F: hw/core/null-machine.c
F: hw/core/numa.c
F: hw/cpu/cluster.c
F: qapi/machine.json
+F: qapi/machine-target.json
F: qom/cpu.c
F: include/hw/boards.h
F: include/hw/cpu/cluster.h
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 01dced01aa..4e87bef6e1 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -9,7 +9,7 @@ QAPI_COMMON_MODULES = audio authz block-core block char common crypto
QAPI_COMMON_MODULES += introspect job machine migration misc net
QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
QAPI_COMMON_MODULES += trace transaction ui
-QAPI_TARGET_MODULES = target
+QAPI_TARGET_MODULES = machine-target target
QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
util-obj-y += qapi-builtin-types.o
diff --git a/qapi/machine-target.json b/qapi/machine-target.json
new file mode 100644
index 0000000000..5d7480f6ab
--- /dev/null
+++ b/qapi/machine-target.json
@@ -0,0 +1,318 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# @CpuModelInfo:
+#
+# Virtual CPU model.
+#
+# A CPU model consists of the name of a CPU definition, to which
+# delta changes are applied (e.g. features added/removed). Most magic values
+# that an architecture might require should be hidden behind the name.
+# However, if required, architectures can expose relevant properties.
+#
+# @name: the name of the CPU definition the model is based on
+# @props: a dictionary of QOM properties to be applied
+#
+# Since: 2.8.0
+##
+{ 'struct': 'CpuModelInfo',
+ 'data': { 'name': 'str',
+ '*props': 'any' } }
+
+##
+# @CpuModelExpansionType:
+#
+# An enumeration of CPU model expansion types.
+#
+# @static: Expand to a static CPU model, a combination of a static base
+# model name and property delta changes. As the static base model will
+# never change, the expanded CPU model will be the same, independent of
+# QEMU version, machine type, machine options, and accelerator options.
+# Therefore, the resulting model can be used by tooling without having
+# to specify a compatibility machine - e.g. when displaying the "host"
+# model. The @static CPU models are migration-safe.
+
+# @full: Expand all properties. The produced model is not guaranteed to be
+# migration-safe, but allows tooling to get an insight and work with
+# model details.
+#
+# Note: When a non-migration-safe CPU model is expanded in static mode, some
+# features enabled by the CPU model may be omitted, because they can't be
+# implemented by a static CPU model definition (e.g. cache info passthrough and
+# PMU passthrough in x86). If you need an accurate representation of the
+# features enabled by a non-migration-safe CPU model, use @full. If you need a
+# static representation that will keep ABI compatibility even when changing QEMU
+# version or machine-type, use @static (but keep in mind that some features may
+# be omitted).
+#
+# Since: 2.8.0
+##
+{ 'enum': 'CpuModelExpansionType',
+ 'data': [ 'static', 'full' ] }
+
+
+##
+# @CpuModelCompareResult:
+#
+# An enumeration of CPU model comparison results. The result is usually
+# calculated using e.g. CPU features or CPU generations.
+#
+# @incompatible: If model A is incompatible to model B, model A is not
+# guaranteed to run where model B runs and the other way around.
+#
+# @identical: If model A is identical to model B, model A is guaranteed to run
+# where model B runs and the other way around.
+#
+# @superset: If model A is a superset of model B, model B is guaranteed to run
+# where model A runs. There are no guarantees about the other way.
+#
+# @subset: If model A is a subset of model B, model A is guaranteed to run
+# where model B runs. There are no guarantees about the other way.
+#
+# Since: 2.8.0
+##
+{ 'enum': 'CpuModelCompareResult',
+ 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
+
+##
+# @CpuModelBaselineInfo:
+#
+# The result of a CPU model baseline.
+#
+# @model: the baselined CpuModelInfo.
+#
+# Since: 2.8.0
+##
+{ 'struct': 'CpuModelBaselineInfo',
+ 'data': { 'model': 'CpuModelInfo' },
+ 'if': 'defined(TARGET_S390X)' }
+
+##
+# @CpuModelCompareInfo:
+#
+# The result of a CPU model comparison.
+#
+# @result: The result of the compare operation.
+# @responsible-properties: List of properties that led to the comparison result
+# not being identical.
+#
+# @responsible-properties is a list of QOM property names that led to
+# both CPUs not being detected as identical. For identical models, this
+# list is empty.
+# If a QOM property is read-only, that means there's no known way to make the
+# CPU models identical. If the special property name "type" is included, the
+# models are by definition not identical and cannot be made identical.
+#
+# Since: 2.8.0
+##
+{ 'struct': 'CpuModelCompareInfo',
+ 'data': { 'result': 'CpuModelCompareResult',
+ 'responsible-properties': ['str'] },
+ 'if': 'defined(TARGET_S390X)' }
+
+##
+# @query-cpu-model-comparison:
+#
+# Compares two CPU models, returning how they compare in a specific
+# configuration. The results indicates how both models compare regarding
+# runnability. This result can be used by tooling to make decisions if a
+# certain CPU model will run in a certain configuration or if a compatible
+# CPU model has to be created by baselining.
+#
+# Usually, a CPU model is compared against the maximum possible CPU model
+# of a certain configuration (e.g. the "host" model for KVM). If that CPU
+# model is identical or a subset, it will run in that configuration.
+#
+# The result returned by this command may be affected by:
+#
+# * QEMU version: CPU models may look different depending on the QEMU version.
+# (Except for CPU models reported as "static" in query-cpu-definitions.)
+# * machine-type: CPU model may look different depending on the machine-type.
+# (Except for CPU models reported as "static" in query-cpu-definitions.)
+# * machine options (including accelerator): in some architectures, CPU models
+# may look different depending on machine and accelerator options. (Except for
+# CPU models reported as "static" in query-cpu-definitions.)
+# * "-cpu" arguments and global properties: arguments to the -cpu option and
+# global properties may affect expansion of CPU models. Using
+# query-cpu-model-expansion while using these is not advised.
+#
+# Some architectures may not support comparing CPU models. s390x supports
+# comparing CPU models.
+#
+# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU models is
+# not supported, if a model cannot be used, if a model contains
+# an unknown cpu definition name, unknown properties or properties
+# with wrong types.
+#
+# Note: this command isn't specific to s390x, but is only implemented
+# on this architecture currently.
+#
+# Since: 2.8.0
+##
+{ 'command': 'query-cpu-model-comparison',
+ 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
+ 'returns': 'CpuModelCompareInfo',
+ 'if': 'defined(TARGET_S390X)' }
+
+##
+# @query-cpu-model-baseline:
+#
+# Baseline two CPU models, creating a compatible third model. The created
+# model will always be a static, migration-safe CPU model (see "static"
+# CPU model expansion for details).
+#
+# This interface can be used by tooling to create a compatible CPU model out
+# two CPU models. The created CPU model will be identical to or a subset of
+# both CPU models when comparing them. Therefore, the created CPU model is
+# guaranteed to run where the given CPU models run.
+#
+# The result returned by this command may be affected by:
+#
+# * QEMU version: CPU models may look different depending on the QEMU version.
+# (Except for CPU models reported as "static" in query-cpu-definitions.)
+# * machine-type: CPU model may look different depending on the machine-type.
+# (Except for CPU models reported as "static" in query-cpu-definitions.)
+# * machine options (including accelerator): in some architectures, CPU models
+# may look different depending on machine and accelerator options. (Except for
+# CPU models reported as "static" in query-cpu-definitions.)
+# * "-cpu" arguments and global properties: arguments to the -cpu option and
+# global properties may affect expansion of CPU models. Using
+# query-cpu-model-expansion while using these is not advised.
+#
+# Some architectures may not support baselining CPU models. s390x supports
+# baselining CPU models.
+#
+# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU models is
+# not supported, if a model cannot be used, if a model contains
+# an unknown cpu definition name, unknown properties or properties
+# with wrong types.
+#
+# Note: this command isn't specific to s390x, but is only implemented
+# on this architecture currently.
+#
+# Since: 2.8.0
+##
+{ 'command': 'query-cpu-model-baseline',
+ 'data': { 'modela': 'CpuModelInfo',
+ 'modelb': 'CpuModelInfo' },
+ 'returns': 'CpuModelBaselineInfo',
+ 'if': 'defined(TARGET_S390X)' }
+
+##
+# @CpuModelExpansionInfo:
+#
+# The result of a cpu model expansion.
+#
+# @model: the expanded CpuModelInfo.
+#
+# Since: 2.8.0
+##
+{ 'struct': 'CpuModelExpansionInfo',
+ 'data': { 'model': 'CpuModelInfo' },
+ 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' }
+
+##
+# @query-cpu-model-expansion:
+#
+# Expands a given CPU model (or a combination of CPU model + additional options)
+# to different granularities, allowing tooling to get an understanding what a
+# specific CPU model looks like in QEMU under a certain configuration.
+#
+# This interface can be used to query the "host" CPU model.
+#
+# The data returned by this command may be affected by:
+#
+# * QEMU version: CPU models may look different depending on the QEMU version.
+# (Except for CPU models reported as "static" in query-cpu-definitions.)
+# * machine-type: CPU model may look different depending on the machine-type.
+# (Except for CPU models reported as "static" in query-cpu-definitions.)
+# * machine options (including accelerator): in some architectures, CPU models
+# may look different depending on machine and accelerator options. (Except for
+# CPU models reported as "static" in query-cpu-definitions.)
+# * "-cpu" arguments and global properties: arguments to the -cpu option and
+# global properties may affect expansion of CPU models. Using
+# query-cpu-model-expansion while using these is not advised.
+#
+# Some architectures may not support all expansion types. s390x supports
+# "full" and "static".
+#
+# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is
+# not supported, if the model cannot be expanded, if the model contains
+# an unknown CPU definition name, unknown properties or properties
+# with a wrong type. Also returns an error if an expansion type is
+# not supported.
+#
+# Since: 2.8.0
+##
+{ 'command': 'query-cpu-model-expansion',
+ 'data': { 'type': 'CpuModelExpansionType',
+ 'model': 'CpuModelInfo' },
+ 'returns': 'CpuModelExpansionInfo',
+ 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' }
+
+##
+# @CpuDefinitionInfo:
+#
+# Virtual CPU definition.
+#
+# @name: the name of the CPU definition
+#
+# @migration-safe: whether a CPU definition can be safely used for
+# migration in combination with a QEMU compatibility machine
+# when migrating between different QEMU versions and between
+# hosts with different sets of (hardware or software)
+# capabilities. If not provided, information is not available
+# and callers should not assume the CPU definition to be
+# migration-safe. (since 2.8)
+#
+# @static: whether a CPU definition is static and will not change depending on
+# QEMU version, machine type, machine options and accelerator options.
+# A static model is always migration-safe. (since 2.8)
+#
+# @unavailable-features: List of properties that prevent
+# the CPU model from running in the current
+# host. (since 2.8)
+# @typename: Type name that can be used as argument to @device-list-properties,
+# to introspect properties configurable using -cpu or -global.
+# (since 2.9)
+#
+# @unavailable-features is a list of QOM property names that
+# represent CPU model attributes that prevent the CPU from running.
+# If the QOM property is read-only, that means there's no known
+# way to make the CPU model run in the current host. Implementations
+# that choose not to provide specific information return the
+# property name "type".
+# If the property is read-write, it means that it MAY be possible
+# to run the CPU model in the current host if that property is
+# changed. Management software can use it as hints to suggest or
+# choose an alternative for the user, or just to generate meaningful
+# error messages explaining why the CPU model can't be used.
+# If @unavailable-features is an empty list, the CPU model is
+# runnable using the current host and machine-type.
+# If @unavailable-features is not present, runnability
+# information for the CPU is not available.
+#
+# Since: 1.2.0
+##
+{ 'struct': 'CpuDefinitionInfo',
+ 'data': { 'name': 'str',
+ '*migration-safe': 'bool',
+ 'static': 'bool',
+ '*unavailable-features': [ 'str' ],
+ 'typename': 'str' },
+ 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' }
+
+##
+# @query-cpu-definitions:
+#
+# Return a list of supported virtual CPU definitions
+#
+# Returns: a list of CpuDefInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
+ 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' }
diff --git a/qapi/misc.json b/qapi/misc.json
index b4f8c658b7..d7db863c81 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1387,80 +1387,6 @@
{ 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
-##
-# @CpuModelInfo:
-#
-# Virtual CPU model.
-#
-# A CPU model consists of the name of a CPU definition, to which
-# delta changes are applied (e.g. features added/removed). Most magic values
-# that an architecture might require should be hidden behind the name.
-# However, if required, architectures can expose relevant properties.
-#
-# @name: the name of the CPU definition the model is based on
-# @props: a dictionary of QOM properties to be applied
-#
-# Since: 2.8.0
-##
-{ 'struct': 'CpuModelInfo',
- 'data': { 'name': 'str',
- '*props': 'any' } }
-
-##
-# @CpuModelExpansionType:
-#
-# An enumeration of CPU model expansion types.
-#
-# @static: Expand to a static CPU model, a combination of a static base
-# model name and property delta changes. As the static base model will
-# never change, the expanded CPU model will be the same, independent of
-# QEMU version, machine type, machine options, and accelerator options.
-# Therefore, the resulting model can be used by tooling without having
-# to specify a compatibility machine - e.g. when displaying the "host"
-# model. The @static CPU models are migration-safe.
-
-# @full: Expand all properties. The produced model is not guaranteed to be
-# migration-safe, but allows tooling to get an insight and work with
-# model details.
-#
-# Note: When a non-migration-safe CPU model is expanded in static mode, some
-# features enabled by the CPU model may be omitted, because they can't be
-# implemented by a static CPU model definition (e.g. cache info passthrough and
-# PMU passthrough in x86). If you need an accurate representation of the
-# features enabled by a non-migration-safe CPU model, use @full. If you need a
-# static representation that will keep ABI compatibility even when changing QEMU
-# version or machine-type, use @static (but keep in mind that some features may
-# be omitted).
-#
-# Since: 2.8.0
-##
-{ 'enum': 'CpuModelExpansionType',
- 'data': [ 'static', 'full' ] }
-
-
-##
-# @CpuModelCompareResult:
-#
-# An enumeration of CPU model comparison results. The result is usually
-# calculated using e.g. CPU features or CPU generations.
-#
-# @incompatible: If model A is incompatible to model B, model A is not
-# guaranteed to run where model B runs and the other way around.
-#
-# @identical: If model A is identical to model B, model A is guaranteed to run
-# where model B runs and the other way around.
-#
-# @superset: If model A is a superset of model B, model B is guaranteed to run
-# where model A runs. There are no guarantees about the other way.
-#
-# @subset: If model A is a subset of model B, model A is guaranteed to run
-# where model B runs. There are no guarantees about the other way.
-#
-# Since: 2.8.0
-##
-{ 'enum': 'CpuModelCompareResult',
- 'data': [ 'incompatible', 'identical', 'superset', 'subset' ] }
-
##
# @AddfdInfo:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 31611191db..8dc82fde31 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -100,6 +100,7 @@
{ 'include': 'qom.json' }
{ 'include': 'qdev.json' }
{ 'include': 'machine.json' }
+{ 'include': 'machine-target.json' }
{ 'include': 'misc.json' }
{ 'include': 'target.json' }
{ 'include': 'audio.json' }
diff --git a/qapi/target.json b/qapi/target.json
index 1d4d54b600..e0a73581d8 100644
--- a/qapi/target.json
+++ b/qapi/target.json
@@ -5,8 +5,6 @@
# = Target-specific commands & events
##
-{ 'include': 'misc.json' }
-
##
# @RTC_CHANGE:
#
@@ -228,130 +226,6 @@
'data': { 'filename': 'str' },
'if': 'defined(TARGET_S390X)' }
-##
-# @CpuModelBaselineInfo:
-#
-# The result of a CPU model baseline.
-#
-# @model: the baselined CpuModelInfo.
-#
-# Since: 2.8.0
-##
-{ 'struct': 'CpuModelBaselineInfo',
- 'data': { 'model': 'CpuModelInfo' },
- 'if': 'defined(TARGET_S390X)' }
-
-##
-# @CpuModelCompareInfo:
-#
-# The result of a CPU model comparison.
-#
-# @result: The result of the compare operation.
-# @responsible-properties: List of properties that led to the comparison result
-# not being identical.
-#
-# @responsible-properties is a list of QOM property names that led to
-# both CPUs not being detected as identical. For identical models, this
-# list is empty.
-# If a QOM property is read-only, that means there's no known way to make the
-# CPU models identical. If the special property name "type" is included, the
-# models are by definition not identical and cannot be made identical.
-#
-# Since: 2.8.0
-##
-{ 'struct': 'CpuModelCompareInfo',
- 'data': { 'result': 'CpuModelCompareResult',
- 'responsible-properties': ['str'] },
- 'if': 'defined(TARGET_S390X)' }
-
-##
-# @query-cpu-model-comparison:
-#
-# Compares two CPU models, returning how they compare in a specific
-# configuration. The results indicates how both models compare regarding
-# runnability. This result can be used by tooling to make decisions if a
-# certain CPU model will run in a certain configuration or if a compatible
-# CPU model has to be created by baselining.
-#
-# Usually, a CPU model is compared against the maximum possible CPU model
-# of a certain configuration (e.g. the "host" model for KVM). If that CPU
-# model is identical or a subset, it will run in that configuration.
-#
-# The result returned by this command may be affected by:
-#
-# * QEMU version: CPU models may look different depending on the QEMU version.
-# (Except for CPU models reported as "static" in query-cpu-definitions.)
-# * machine-type: CPU model may look different depending on the machine-type.
-# (Except for CPU models reported as "static" in query-cpu-definitions.)
-# * machine options (including accelerator): in some architectures, CPU models
-# may look different depending on machine and accelerator options. (Except for
-# CPU models reported as "static" in query-cpu-definitions.)
-# * "-cpu" arguments and global properties: arguments to the -cpu option and
-# global properties may affect expansion of CPU models. Using
-# query-cpu-model-expansion while using these is not advised.
-#
-# Some architectures may not support comparing CPU models. s390x supports
-# comparing CPU models.
-#
-# Returns: a CpuModelBaselineInfo. Returns an error if comparing CPU models is
-# not supported, if a model cannot be used, if a model contains
-# an unknown cpu definition name, unknown properties or properties
-# with wrong types.
-#
-# Note: this command isn't specific to s390x, but is only implemented
-# on this architecture currently.
-#
-# Since: 2.8.0
-##
-{ 'command': 'query-cpu-model-comparison',
- 'data': { 'modela': 'CpuModelInfo', 'modelb': 'CpuModelInfo' },
- 'returns': 'CpuModelCompareInfo',
- 'if': 'defined(TARGET_S390X)' }
-
-##
-# @query-cpu-model-baseline:
-#
-# Baseline two CPU models, creating a compatible third model. The created
-# model will always be a static, migration-safe CPU model (see "static"
-# CPU model expansion for details).
-#
-# This interface can be used by tooling to create a compatible CPU model out
-# two CPU models. The created CPU model will be identical to or a subset of
-# both CPU models when comparing them. Therefore, the created CPU model is
-# guaranteed to run where the given CPU models run.
-#
-# The result returned by this command may be affected by:
-#
-# * QEMU version: CPU models may look different depending on the QEMU version.
-# (Except for CPU models reported as "static" in query-cpu-definitions.)
-# * machine-type: CPU model may look different depending on the machine-type.
-# (Except for CPU models reported as "static" in query-cpu-definitions.)
-# * machine options (including accelerator): in some architectures, CPU models
-# may look different depending on machine and accelerator options. (Except for
-# CPU models reported as "static" in query-cpu-definitions.)
-# * "-cpu" arguments and global properties: arguments to the -cpu option and
-# global properties may affect expansion of CPU models. Using
-# query-cpu-model-expansion while using these is not advised.
-#
-# Some architectures may not support baselining CPU models. s390x supports
-# baselining CPU models.
-#
-# Returns: a CpuModelBaselineInfo. Returns an error if baselining CPU models is
-# not supported, if a model cannot be used, if a model contains
-# an unknown cpu definition name, unknown properties or properties
-# with wrong types.
-#
-# Note: this command isn't specific to s390x, but is only implemented
-# on this architecture currently.
-#
-# Since: 2.8.0
-##
-{ 'command': 'query-cpu-model-baseline',
- 'data': { 'modela': 'CpuModelInfo',
- 'modelb': 'CpuModelInfo' },
- 'returns': 'CpuModelBaselineInfo',
- 'if': 'defined(TARGET_S390X)' }
-
##
# @GICCapability:
#
@@ -396,119 +270,3 @@
##
{ 'command': 'query-gic-capabilities', 'returns': ['GICCapability'],
'if': 'defined(TARGET_ARM)' }
-
-##
-# @CpuModelExpansionInfo:
-#
-# The result of a cpu model expansion.
-#
-# @model: the expanded CpuModelInfo.
-#
-# Since: 2.8.0
-##
-{ 'struct': 'CpuModelExpansionInfo',
- 'data': { 'model': 'CpuModelInfo' },
- 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' }
-
-##
-# @query-cpu-model-expansion:
-#
-# Expands a given CPU model (or a combination of CPU model + additional options)
-# to different granularities, allowing tooling to get an understanding what a
-# specific CPU model looks like in QEMU under a certain configuration.
-#
-# This interface can be used to query the "host" CPU model.
-#
-# The data returned by this command may be affected by:
-#
-# * QEMU version: CPU models may look different depending on the QEMU version.
-# (Except for CPU models reported as "static" in query-cpu-definitions.)
-# * machine-type: CPU model may look different depending on the machine-type.
-# (Except for CPU models reported as "static" in query-cpu-definitions.)
-# * machine options (including accelerator): in some architectures, CPU models
-# may look different depending on machine and accelerator options. (Except for
-# CPU models reported as "static" in query-cpu-definitions.)
-# * "-cpu" arguments and global properties: arguments to the -cpu option and
-# global properties may affect expansion of CPU models. Using
-# query-cpu-model-expansion while using these is not advised.
-#
-# Some architectures may not support all expansion types. s390x supports
-# "full" and "static".
-#
-# Returns: a CpuModelExpansionInfo. Returns an error if expanding CPU models is
-# not supported, if the model cannot be expanded, if the model contains
-# an unknown CPU definition name, unknown properties or properties
-# with a wrong type. Also returns an error if an expansion type is
-# not supported.
-#
-# Since: 2.8.0
-##
-{ 'command': 'query-cpu-model-expansion',
- 'data': { 'type': 'CpuModelExpansionType',
- 'model': 'CpuModelInfo' },
- 'returns': 'CpuModelExpansionInfo',
- 'if': 'defined(TARGET_S390X) || defined(TARGET_I386)' }
-
-##
-# @CpuDefinitionInfo:
-#
-# Virtual CPU definition.
-#
-# @name: the name of the CPU definition
-#
-# @migration-safe: whether a CPU definition can be safely used for
-# migration in combination with a QEMU compatibility machine
-# when migrating between different QEMU versions and between
-# hosts with different sets of (hardware or software)
-# capabilities. If not provided, information is not available
-# and callers should not assume the CPU definition to be
-# migration-safe. (since 2.8)
-#
-# @static: whether a CPU definition is static and will not change depending on
-# QEMU version, machine type, machine options and accelerator options.
-# A static model is always migration-safe. (since 2.8)
-#
-# @unavailable-features: List of properties that prevent
-# the CPU model from running in the current
-# host. (since 2.8)
-# @typename: Type name that can be used as argument to @device-list-properties,
-# to introspect properties configurable using -cpu or -global.
-# (since 2.9)
-#
-# @unavailable-features is a list of QOM property names that
-# represent CPU model attributes that prevent the CPU from running.
-# If the QOM property is read-only, that means there's no known
-# way to make the CPU model run in the current host. Implementations
-# that choose not to provide specific information return the
-# property name "type".
-# If the property is read-write, it means that it MAY be possible
-# to run the CPU model in the current host if that property is
-# changed. Management software can use it as hints to suggest or
-# choose an alternative for the user, or just to generate meaningful
-# error messages explaining why the CPU model can't be used.
-# If @unavailable-features is an empty list, the CPU model is
-# runnable using the current host and machine-type.
-# If @unavailable-features is not present, runnability
-# information for the CPU is not available.
-#
-# Since: 1.2.0
-##
-{ 'struct': 'CpuDefinitionInfo',
- 'data': { 'name': 'str',
- '*migration-safe': 'bool',
- 'static': 'bool',
- '*unavailable-features': [ 'str' ],
- 'typename': 'str' },
- 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' }
-
-##
-# @query-cpu-definitions:
-#
-# Return a list of supported virtual CPU definitions
-#
-# Returns: a list of CpuDefInfo
-#
-# Since: 1.2.0
-##
-{ 'command': 'query-cpu-definitions', 'returns': ['CpuDefinitionInfo'],
- 'if': 'defined(TARGET_PPC) || defined(TARGET_ARM) || defined(TARGET_I386) || defined(TARGET_S390X) || defined(TARGET_MIPS)' }
diff --git a/target/arm/helper.c b/target/arm/helper.c
index df4276f5f6..7caea52561 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -21,7 +21,7 @@
#include "sysemu/kvm.h"
#include "fpu/softfloat.h"
#include "qemu/range.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
#include "qapi/error.h"
#include "qemu/guest-random.h"
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index cb50f05e7e..4051066079 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -43,7 +43,7 @@
#include "qapi/visitor.h"
#include "qom/qom-qobject.h"
#include "sysemu/arch_init.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
#include "standard-headers/asm-x86/kvm_para.h"
diff --git a/target/mips/helper.c b/target/mips/helper.c
index 6e6a44292f..a2b6459b05 100644
--- a/target/mips/helper.c
+++ b/target/mips/helper.c
@@ -24,7 +24,7 @@
#include "exec/cpu_ldst.h"
#include "exec/log.h"
#include "hw/mips/cpudevs.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
enum {
TLBRET_XI = -6,
diff --git a/target/ppc/translate_init.inc.c b/target/ppc/translate_init.inc.c
index 03cb6d0521..86fc8f2e31 100644
--- a/target/ppc/translate_init.inc.c
+++ b/target/ppc/translate_init.inc.c
@@ -41,7 +41,7 @@
#include "qemu/cutils.h"
#include "disas/capstone.h"
#include "fpu/softfloat.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
/* #define PPC_DUMP_CPU */
/* #define PPC_DEBUG_SPR */
diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 19ebde14db..2cb09c0780 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -28,7 +28,7 @@
#include "sysemu/arch_init.h"
#include "hw/pci/pci.h"
#endif
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-machine-target.h"
#define CPUDEF_INIT(_type, _gen, _ec_ga, _mha_pow, _hmfai, _name, _desc) \
{ \
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json Markus Armbruster
@ 2019-06-19 20:18 ` Eric Blake
2019-06-24 11:33 ` Markus Armbruster
2019-06-20 8:53 ` Daniel P. Berrangé
1 sibling, 1 reply; 57+ messages in thread
From: Eric Blake @ 2019-06-19 20:18 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel; +Cc: kwolf, Eduardo Habkost
[-- Attachment #1.1: Type: text/plain, Size: 726 bytes --]
On 6/19/19 3:10 PM, Markus Armbruster wrote:
> Move commands query-cpu-definitions, query-cpu-model-baseline,
> query-cpu-model-comparison, and query-cpu-model-expansion with their
> types from target.json to machine-target.json. Also move typee
s/typee/types/
> CpuModelInfo, CpuModelExpansionType, and CpuModelCompareResult from
> misc.json there. Add machine-target.json to MAINTAINERS section
> "Machine core".
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json
2019-06-19 20:18 ` Eric Blake
@ 2019-06-24 11:33 ` Markus Armbruster
0 siblings, 0 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-24 11:33 UTC (permalink / raw)
To: Eric Blake; +Cc: kwolf, qemu-devel, Eduardo Habkost
Eric Blake <eblake@redhat.com> writes:
> On 6/19/19 3:10 PM, Markus Armbruster wrote:
>> Move commands query-cpu-definitions, query-cpu-model-baseline,
>> query-cpu-model-comparison, and query-cpu-model-expansion with their
>> types from target.json to machine-target.json. Also move typee
>
> s/typee/types/
Will fix. Thanks!
>> CpuModelInfo, CpuModelExpansionType, and CpuModelCompareResult from
>> misc.json there. Add machine-target.json to MAINTAINERS section
>> "Machine core".
>>
>> Cc: Eduardo Habkost <ehabkost@redhat.com>
>> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json Markus Armbruster
2019-06-19 20:18 ` Eric Blake
@ 2019-06-20 8:53 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:53 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, qemu-devel, Eduardo Habkost
On Wed, Jun 19, 2019 at 10:10:45PM +0200, Markus Armbruster wrote:
> Move commands query-cpu-definitions, query-cpu-model-baseline,
> query-cpu-model-comparison, and query-cpu-model-expansion with their
> types from target.json to machine-target.json. Also move typee
> CpuModelInfo, CpuModelExpansionType, and CpuModelCompareResult from
> misc.json there. Add machine-target.json to MAINTAINERS section
> "Machine core".
>
> Cc: Eduardo Habkost <ehabkost@redhat.com>
> Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 1 +
> qapi/Makefile.objs | 2 +-
> qapi/machine-target.json | 318 ++++++++++++++++++++++++++++++++
> qapi/misc.json | 74 --------
> qapi/qapi-schema.json | 1 +
> qapi/target.json | 242 ------------------------
> target/arm/helper.c | 2 +-
> target/i386/cpu.c | 2 +-
> target/mips/helper.c | 2 +-
> target/ppc/translate_init.inc.c | 2 +-
> target/s390x/cpu_models.c | 2 +-
> 11 files changed, 326 insertions(+), 322 deletions(-)
> create mode 100644 qapi/machine-target.json
With the typo fixed,
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 13/17] qapi: Rename target.json to misc-target.json
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (11 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 12/17] qapi: Split machine-target.json off target.json and misc.json Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-20 8:54 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json Markus Armbruster
` (3 subsequent siblings)
16 siblings, 1 reply; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/ppc/spapr_rtc.c | 2 +-
hw/s390x/s390-skeys.c | 2 +-
hw/timer/mc146818rtc.c | 4 ++--
qapi/Makefile.objs | 2 +-
qapi/{target.json => misc-target.json} | 4 ----
qapi/qapi-schema.json | 2 +-
target/arm/monitor.c | 2 +-
target/i386/sev_i386.h | 2 +-
8 files changed, 8 insertions(+), 12 deletions(-)
rename qapi/{target.json => misc-target.json} (99%)
diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c
index af1ef30a53..6cf0113b34 100644
--- a/hw/ppc/spapr_rtc.c
+++ b/hw/ppc/spapr_rtc.c
@@ -32,7 +32,7 @@
#include "sysemu/sysemu.h"
#include "hw/ppc/spapr.h"
#include "qapi/error.h"
-#include "qapi/qapi-events-target.h"
+#include "qapi/qapi-events-misc-target.h"
#include "qemu/cutils.h"
#include "qemu/module.h"
diff --git a/hw/s390x/s390-skeys.c b/hw/s390x/s390-skeys.c
index daac936698..e5bd92c0c7 100644
--- a/hw/s390x/s390-skeys.c
+++ b/hw/s390x/s390-skeys.c
@@ -14,7 +14,7 @@
#include "hw/boards.h"
#include "hw/s390x/storage-keys.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-misc-target.h"
#include "qapi/qmp/qdict.h"
#include "qemu/error-report.h"
#include "sysemu/kvm.h"
diff --git a/hw/timer/mc146818rtc.c b/hw/timer/mc146818rtc.c
index 0d79e000d2..ce4550b6f2 100644
--- a/hw/timer/mc146818rtc.c
+++ b/hw/timer/mc146818rtc.c
@@ -33,8 +33,8 @@
#include "sysemu/replay.h"
#include "hw/timer/mc146818rtc.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-target.h"
-#include "qapi/qapi-events-target.h"
+#include "qapi/qapi-commands-misc-target.h"
+#include "qapi/qapi-events-misc-target.h"
#include "qapi/visitor.h"
#include "exec/address-spaces.h"
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index 4e87bef6e1..c0be6fcd3e 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -9,7 +9,7 @@ QAPI_COMMON_MODULES = audio authz block-core block char common crypto
QAPI_COMMON_MODULES += introspect job machine migration misc net
QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
QAPI_COMMON_MODULES += trace transaction ui
-QAPI_TARGET_MODULES = machine-target target
+QAPI_TARGET_MODULES = machine-target misc-target
QAPI_MODULES = $(QAPI_COMMON_MODULES) $(QAPI_TARGET_MODULES)
util-obj-y += qapi-builtin-types.o
diff --git a/qapi/target.json b/qapi/misc-target.json
similarity index 99%
rename from qapi/target.json
rename to qapi/misc-target.json
index e0a73581d8..a00fd821eb 100644
--- a/qapi/target.json
+++ b/qapi/misc-target.json
@@ -1,10 +1,6 @@
# -*- Mode: Python -*-
#
-##
-# = Target-specific commands & events
-##
-
##
# @RTC_CHANGE:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index 8dc82fde31..bcfac85074 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -102,5 +102,5 @@
{ 'include': 'machine.json' }
{ 'include': 'machine-target.json' }
{ 'include': 'misc.json' }
-{ 'include': 'target.json' }
+{ 'include': 'misc-target.json' }
{ 'include': 'audio.json' }
diff --git a/target/arm/monitor.c b/target/arm/monitor.c
index 41b32b94b2..6ec6dd04ac 100644
--- a/target/arm/monitor.c
+++ b/target/arm/monitor.c
@@ -23,7 +23,7 @@
#include "qemu/osdep.h"
#include "hw/boards.h"
#include "kvm_arm.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-misc-target.h"
static GICCapability *gic_cap_new(int version)
{
diff --git a/target/i386/sev_i386.h b/target/i386/sev_i386.h
index c0f9373beb..55313441ae 100644
--- a/target/i386/sev_i386.h
+++ b/target/i386/sev_i386.h
@@ -19,7 +19,7 @@
#include "sysemu/kvm.h"
#include "sysemu/sev.h"
#include "qemu/error-report.h"
-#include "qapi/qapi-commands-target.h"
+#include "qapi/qapi-commands-misc-target.h"
#define SEV_POLICY_NODBG 0x1
#define SEV_POLICY_NOKS 0x2
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (12 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 13/17] qapi: Rename target.json to misc-target.json Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-19 23:36 ` Marc-André Lureau
2019-06-20 8:54 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/ Markus Armbruster
` (2 subsequent siblings)
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Marc-André Lureau
Move commands dump-guest-memory, query-dump,
query-dump-guest-memory-capability with their types from misc.json to
new dump.json. Add dump.json to MAINTAINERS section "Dump".
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 1 +
dump.c | 4 +-
include/sysemu/dump.h | 2 +-
monitor/hmp-cmds.c | 1 +
qapi/Makefile.objs | 2 +-
qapi/dump.json | 200 ++++++++++++++++++++++++++++++++++++++++++
qapi/misc.json | 192 ----------------------------------------
qapi/qapi-schema.json | 1 +
8 files changed, 207 insertions(+), 196 deletions(-)
create mode 100644 qapi/dump.json
diff --git a/MAINTAINERS b/MAINTAINERS
index 89e8c01cf3..ea110e99ca 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1855,6 +1855,7 @@ F: hw/misc/vmcoreinfo.c
F: include/hw/misc/vmcoreinfo.h
F: include/sysemu/dump-arch.h
F: include/sysemu/dump.h
+F: qapi/dump.json
F: scripts/dump-guest-memory.py
F: stubs/dump.c
diff --git a/dump.c b/dump.c
index e99554628c..c7b2301652 100644
--- a/dump.c
+++ b/dump.c
@@ -24,8 +24,8 @@
#include "sysemu/memory_mapping.h"
#include "sysemu/cpus.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-misc.h"
-#include "qapi/qapi-events-misc.h"
+#include "qapi/qapi-commands-dump.h"
+#include "qapi/qapi-events-dump.h"
#include "qapi/qmp/qerror.h"
#include "qemu/error-report.h"
#include "hw/misc/vmcoreinfo.h"
diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
index d824bc0941..250143cb5a 100644
--- a/include/sysemu/dump.h
+++ b/include/sysemu/dump.h
@@ -14,7 +14,7 @@
#ifndef DUMP_H
#define DUMP_H
-#include "qapi/qapi-types-misc.h"
+#include "qapi/qapi-types-dump.h"
#define MAKEDUMPFILE_SIGNATURE "makedumpfile"
#define MAX_SIZE_MDF_HEADER (4096) /* max size of makedumpfile_header */
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index ea8ae2966e..18ffeb7017 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -31,6 +31,7 @@
#include "qapi/qapi-builtin-visit.h"
#include "qapi/qapi-commands-block.h"
#include "qapi/qapi-commands-char.h"
+#include "qapi/qapi-commands-dump.h"
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-net.h"
diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
index c0be6fcd3e..c5a29e86e2 100644
--- a/qapi/Makefile.objs
+++ b/qapi/Makefile.objs
@@ -6,7 +6,7 @@ util-obj-y += qmp-event.o
util-obj-y += qapi-util.o
QAPI_COMMON_MODULES = audio authz block-core block char common crypto
-QAPI_COMMON_MODULES += introspect job machine migration misc net
+QAPI_COMMON_MODULES += dump introspect job machine migration misc net
QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
QAPI_COMMON_MODULES += trace transaction ui
QAPI_TARGET_MODULES = machine-target misc-target
diff --git a/qapi/dump.json b/qapi/dump.json
new file mode 100644
index 0000000000..2b35409a7b
--- /dev/null
+++ b/qapi/dump.json
@@ -0,0 +1,200 @@
+# -*- Mode: Python -*-
+#
+# This work is licensed under the terms of the GNU GPL, version 2 or later.
+# See the COPYING file in the top-level directory.
+
+##
+# = Dump guest memory
+##
+
+##
+# @DumpGuestMemoryFormat:
+#
+# An enumeration of guest-memory-dump's format.
+#
+# @elf: elf format
+#
+# @kdump-zlib: kdump-compressed format with zlib-compressed
+#
+# @kdump-lzo: kdump-compressed format with lzo-compressed
+#
+# @kdump-snappy: kdump-compressed format with snappy-compressed
+#
+# @win-dmp: Windows full crashdump format,
+# can be used instead of ELF converting (since 2.13)
+#
+# Since: 2.0
+##
+{ 'enum': 'DumpGuestMemoryFormat',
+ 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] }
+
+##
+# @dump-guest-memory:
+#
+# Dump guest's memory to vmcore. It is a synchronous operation that can take
+# very long depending on the amount of guest memory.
+#
+# @paging: if true, do paging to get guest's memory mapping. This allows
+# using gdb to process the core file.
+#
+# IMPORTANT: this option can make QEMU allocate several gigabytes
+# of RAM. This can happen for a large guest, or a
+# malicious guest pretending to be large.
+#
+# Also, paging=true has the following limitations:
+#
+# 1. The guest may be in a catastrophic state or can have corrupted
+# memory, which cannot be trusted
+# 2. The guest can be in real-mode even if paging is enabled. For
+# example, the guest uses ACPI to sleep, and ACPI sleep state
+# goes in real-mode
+# 3. Currently only supported on i386 and x86_64.
+#
+# @protocol: the filename or file descriptor of the vmcore. The supported
+# protocols are:
+#
+# 1. file: the protocol starts with "file:", and the following
+# string is the file's path.
+# 2. fd: the protocol starts with "fd:", and the following string
+# is the fd's name.
+#
+# @detach: if true, QMP will return immediately rather than
+# waiting for the dump to finish. The user can track progress
+# using "query-dump". (since 2.6).
+#
+# @begin: if specified, the starting physical address.
+#
+# @length: if specified, the memory size, in bytes. If you don't
+# want to dump all guest's memory, please specify the start @begin
+# and @length
+#
+# @format: if specified, the format of guest memory dump. But non-elf
+# format is conflict with paging and filter, ie. @paging, @begin and
+# @length is not allowed to be specified with non-elf @format at the
+# same time (since 2.0)
+#
+# Note: All boolean arguments default to false
+#
+# Returns: nothing on success
+#
+# Since: 1.2
+#
+# Example:
+#
+# -> { "execute": "dump-guest-memory",
+# "arguments": { "protocol": "fd:dump" } }
+# <- { "return": {} }
+#
+##
+{ 'command': 'dump-guest-memory',
+ 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
+ '*begin': 'int', '*length': 'int',
+ '*format': 'DumpGuestMemoryFormat'} }
+
+##
+# @DumpStatus:
+#
+# Describe the status of a long-running background guest memory dump.
+#
+# @none: no dump-guest-memory has started yet.
+#
+# @active: there is one dump running in background.
+#
+# @completed: the last dump has finished successfully.
+#
+# @failed: the last dump has failed.
+#
+# Since: 2.6
+##
+{ 'enum': 'DumpStatus',
+ 'data': [ 'none', 'active', 'completed', 'failed' ] }
+
+##
+# @DumpQueryResult:
+#
+# The result format for 'query-dump'.
+#
+# @status: enum of @DumpStatus, which shows current dump status
+#
+# @completed: bytes written in latest dump (uncompressed)
+#
+# @total: total bytes to be written in latest dump (uncompressed)
+#
+# Since: 2.6
+##
+{ 'struct': 'DumpQueryResult',
+ 'data': { 'status': 'DumpStatus',
+ 'completed': 'int',
+ 'total': 'int' } }
+
+##
+# @query-dump:
+#
+# Query latest dump status.
+#
+# Returns: A @DumpStatus object showing the dump status.
+#
+# Since: 2.6
+#
+# Example:
+#
+# -> { "execute": "query-dump" }
+# <- { "return": { "status": "active", "completed": 1024000,
+# "total": 2048000 } }
+#
+##
+{ 'command': 'query-dump', 'returns': 'DumpQueryResult' }
+
+##
+# @DUMP_COMPLETED:
+#
+# Emitted when background dump has completed
+#
+# @result: final dump status
+#
+# @error: human-readable error string that provides
+# hint on why dump failed. Only presents on failure. The
+# user should not try to interpret the error string.
+#
+# Since: 2.6
+#
+# Example:
+#
+# { "event": "DUMP_COMPLETED",
+# "data": {"result": {"total": 1090650112, "status": "completed",
+# "completed": 1090650112} } }
+#
+##
+{ 'event': 'DUMP_COMPLETED' ,
+ 'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
+
+##
+# @DumpGuestMemoryCapability:
+#
+# A list of the available formats for dump-guest-memory
+#
+# Since: 2.0
+##
+{ 'struct': 'DumpGuestMemoryCapability',
+ 'data': {
+ 'formats': ['DumpGuestMemoryFormat'] } }
+
+##
+# @query-dump-guest-memory-capability:
+#
+# Returns the available formats for dump-guest-memory
+#
+# Returns: A @DumpGuestMemoryCapability object listing available formats for
+# dump-guest-memory
+#
+# Since: 2.0
+#
+# Example:
+#
+# -> { "execute": "query-dump-guest-memory-capability" }
+# <- { "return": { "formats":
+# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
+#
+##
+{ 'command': 'query-dump-guest-memory-capability',
+ 'returns': 'DumpGuestMemoryCapability' }
diff --git a/qapi/misc.json b/qapi/misc.json
index d7db863c81..31427d45a6 100644
--- a/qapi/misc.json
+++ b/qapi/misc.json
@@ -1117,198 +1117,6 @@
##
{ 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
-##
-# @DumpGuestMemoryFormat:
-#
-# An enumeration of guest-memory-dump's format.
-#
-# @elf: elf format
-#
-# @kdump-zlib: kdump-compressed format with zlib-compressed
-#
-# @kdump-lzo: kdump-compressed format with lzo-compressed
-#
-# @kdump-snappy: kdump-compressed format with snappy-compressed
-#
-# @win-dmp: Windows full crashdump format,
-# can be used instead of ELF converting (since 2.13)
-#
-# Since: 2.0
-##
-{ 'enum': 'DumpGuestMemoryFormat',
- 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] }
-
-##
-# @dump-guest-memory:
-#
-# Dump guest's memory to vmcore. It is a synchronous operation that can take
-# very long depending on the amount of guest memory.
-#
-# @paging: if true, do paging to get guest's memory mapping. This allows
-# using gdb to process the core file.
-#
-# IMPORTANT: this option can make QEMU allocate several gigabytes
-# of RAM. This can happen for a large guest, or a
-# malicious guest pretending to be large.
-#
-# Also, paging=true has the following limitations:
-#
-# 1. The guest may be in a catastrophic state or can have corrupted
-# memory, which cannot be trusted
-# 2. The guest can be in real-mode even if paging is enabled. For
-# example, the guest uses ACPI to sleep, and ACPI sleep state
-# goes in real-mode
-# 3. Currently only supported on i386 and x86_64.
-#
-# @protocol: the filename or file descriptor of the vmcore. The supported
-# protocols are:
-#
-# 1. file: the protocol starts with "file:", and the following
-# string is the file's path.
-# 2. fd: the protocol starts with "fd:", and the following string
-# is the fd's name.
-#
-# @detach: if true, QMP will return immediately rather than
-# waiting for the dump to finish. The user can track progress
-# using "query-dump". (since 2.6).
-#
-# @begin: if specified, the starting physical address.
-#
-# @length: if specified, the memory size, in bytes. If you don't
-# want to dump all guest's memory, please specify the start @begin
-# and @length
-#
-# @format: if specified, the format of guest memory dump. But non-elf
-# format is conflict with paging and filter, ie. @paging, @begin and
-# @length is not allowed to be specified with non-elf @format at the
-# same time (since 2.0)
-#
-# Note: All boolean arguments default to false
-#
-# Returns: nothing on success
-#
-# Since: 1.2
-#
-# Example:
-#
-# -> { "execute": "dump-guest-memory",
-# "arguments": { "protocol": "fd:dump" } }
-# <- { "return": {} }
-#
-##
-{ 'command': 'dump-guest-memory',
- 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
- '*begin': 'int', '*length': 'int',
- '*format': 'DumpGuestMemoryFormat'} }
-
-##
-# @DumpStatus:
-#
-# Describe the status of a long-running background guest memory dump.
-#
-# @none: no dump-guest-memory has started yet.
-#
-# @active: there is one dump running in background.
-#
-# @completed: the last dump has finished successfully.
-#
-# @failed: the last dump has failed.
-#
-# Since: 2.6
-##
-{ 'enum': 'DumpStatus',
- 'data': [ 'none', 'active', 'completed', 'failed' ] }
-
-##
-# @DumpQueryResult:
-#
-# The result format for 'query-dump'.
-#
-# @status: enum of @DumpStatus, which shows current dump status
-#
-# @completed: bytes written in latest dump (uncompressed)
-#
-# @total: total bytes to be written in latest dump (uncompressed)
-#
-# Since: 2.6
-##
-{ 'struct': 'DumpQueryResult',
- 'data': { 'status': 'DumpStatus',
- 'completed': 'int',
- 'total': 'int' } }
-
-##
-# @query-dump:
-#
-# Query latest dump status.
-#
-# Returns: A @DumpStatus object showing the dump status.
-#
-# Since: 2.6
-#
-# Example:
-#
-# -> { "execute": "query-dump" }
-# <- { "return": { "status": "active", "completed": 1024000,
-# "total": 2048000 } }
-#
-##
-{ 'command': 'query-dump', 'returns': 'DumpQueryResult' }
-
-##
-# @DUMP_COMPLETED:
-#
-# Emitted when background dump has completed
-#
-# @result: final dump status
-#
-# @error: human-readable error string that provides
-# hint on why dump failed. Only presents on failure. The
-# user should not try to interpret the error string.
-#
-# Since: 2.6
-#
-# Example:
-#
-# { "event": "DUMP_COMPLETED",
-# "data": {"result": {"total": 1090650112, "status": "completed",
-# "completed": 1090650112} } }
-#
-##
-{ 'event': 'DUMP_COMPLETED' ,
- 'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
-
-##
-# @DumpGuestMemoryCapability:
-#
-# A list of the available formats for dump-guest-memory
-#
-# Since: 2.0
-##
-{ 'struct': 'DumpGuestMemoryCapability',
- 'data': {
- 'formats': ['DumpGuestMemoryFormat'] } }
-
-##
-# @query-dump-guest-memory-capability:
-#
-# Returns the available formats for dump-guest-memory
-#
-# Returns: A @DumpGuestMemoryCapability object listing available formats for
-# dump-guest-memory
-#
-# Since: 2.0
-#
-# Example:
-#
-# -> { "execute": "query-dump-guest-memory-capability" }
-# <- { "return": { "formats":
-# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
-#
-##
-{ 'command': 'query-dump-guest-memory-capability',
- 'returns': 'DumpGuestMemoryCapability' }
-
##
# @getfd:
#
diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
index bcfac85074..38af54d6b3 100644
--- a/qapi/qapi-schema.json
+++ b/qapi/qapi-schema.json
@@ -86,6 +86,7 @@
{ 'include': 'crypto.json' }
{ 'include': 'block.json' }
{ 'include': 'char.json' }
+{ 'include': 'dump.json' }
{ 'include': 'job.json' }
{ 'include': 'net.json' }
{ 'include': 'rdma.json' }
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json Markus Armbruster
@ 2019-06-19 23:36 ` Marc-André Lureau
2019-06-20 8:54 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Marc-André Lureau @ 2019-06-19 23:36 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Wolf, Kevin, qemu-devel
On Wed, Jun 19, 2019 at 10:10 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Move commands dump-guest-memory, query-dump,
> query-dump-guest-memory-capability with their types from misc.json to
> new dump.json. Add dump.json to MAINTAINERS section "Dump".
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> MAINTAINERS | 1 +
> dump.c | 4 +-
> include/sysemu/dump.h | 2 +-
> monitor/hmp-cmds.c | 1 +
> qapi/Makefile.objs | 2 +-
> qapi/dump.json | 200 ++++++++++++++++++++++++++++++++++++++++++
> qapi/misc.json | 192 ----------------------------------------
> qapi/qapi-schema.json | 1 +
> 8 files changed, 207 insertions(+), 196 deletions(-)
> create mode 100644 qapi/dump.json
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 89e8c01cf3..ea110e99ca 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1855,6 +1855,7 @@ F: hw/misc/vmcoreinfo.c
> F: include/hw/misc/vmcoreinfo.h
> F: include/sysemu/dump-arch.h
> F: include/sysemu/dump.h
> +F: qapi/dump.json
> F: scripts/dump-guest-memory.py
> F: stubs/dump.c
>
> diff --git a/dump.c b/dump.c
> index e99554628c..c7b2301652 100644
> --- a/dump.c
> +++ b/dump.c
> @@ -24,8 +24,8 @@
> #include "sysemu/memory_mapping.h"
> #include "sysemu/cpus.h"
> #include "qapi/error.h"
> -#include "qapi/qapi-commands-misc.h"
> -#include "qapi/qapi-events-misc.h"
> +#include "qapi/qapi-commands-dump.h"
> +#include "qapi/qapi-events-dump.h"
> #include "qapi/qmp/qerror.h"
> #include "qemu/error-report.h"
> #include "hw/misc/vmcoreinfo.h"
> diff --git a/include/sysemu/dump.h b/include/sysemu/dump.h
> index d824bc0941..250143cb5a 100644
> --- a/include/sysemu/dump.h
> +++ b/include/sysemu/dump.h
> @@ -14,7 +14,7 @@
> #ifndef DUMP_H
> #define DUMP_H
>
> -#include "qapi/qapi-types-misc.h"
> +#include "qapi/qapi-types-dump.h"
>
> #define MAKEDUMPFILE_SIGNATURE "makedumpfile"
> #define MAX_SIZE_MDF_HEADER (4096) /* max size of makedumpfile_header */
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index ea8ae2966e..18ffeb7017 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -31,6 +31,7 @@
> #include "qapi/qapi-builtin-visit.h"
> #include "qapi/qapi-commands-block.h"
> #include "qapi/qapi-commands-char.h"
> +#include "qapi/qapi-commands-dump.h"
> #include "qapi/qapi-commands-migration.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/qapi-commands-net.h"
> diff --git a/qapi/Makefile.objs b/qapi/Makefile.objs
> index c0be6fcd3e..c5a29e86e2 100644
> --- a/qapi/Makefile.objs
> +++ b/qapi/Makefile.objs
> @@ -6,7 +6,7 @@ util-obj-y += qmp-event.o
> util-obj-y += qapi-util.o
>
> QAPI_COMMON_MODULES = audio authz block-core block char common crypto
> -QAPI_COMMON_MODULES += introspect job machine migration misc net
> +QAPI_COMMON_MODULES += dump introspect job machine migration misc net
> QAPI_COMMON_MODULES += qdev qom rdma rocker run-state sockets tpm
> QAPI_COMMON_MODULES += trace transaction ui
> QAPI_TARGET_MODULES = machine-target misc-target
> diff --git a/qapi/dump.json b/qapi/dump.json
> new file mode 100644
> index 0000000000..2b35409a7b
> --- /dev/null
> +++ b/qapi/dump.json
> @@ -0,0 +1,200 @@
> +# -*- Mode: Python -*-
> +#
> +# This work is licensed under the terms of the GNU GPL, version 2 or later.
> +# See the COPYING file in the top-level directory.
> +
> +##
> +# = Dump guest memory
> +##
> +
> +##
> +# @DumpGuestMemoryFormat:
> +#
> +# An enumeration of guest-memory-dump's format.
> +#
> +# @elf: elf format
> +#
> +# @kdump-zlib: kdump-compressed format with zlib-compressed
> +#
> +# @kdump-lzo: kdump-compressed format with lzo-compressed
> +#
> +# @kdump-snappy: kdump-compressed format with snappy-compressed
> +#
> +# @win-dmp: Windows full crashdump format,
> +# can be used instead of ELF converting (since 2.13)
> +#
> +# Since: 2.0
> +##
> +{ 'enum': 'DumpGuestMemoryFormat',
> + 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] }
> +
> +##
> +# @dump-guest-memory:
> +#
> +# Dump guest's memory to vmcore. It is a synchronous operation that can take
> +# very long depending on the amount of guest memory.
> +#
> +# @paging: if true, do paging to get guest's memory mapping. This allows
> +# using gdb to process the core file.
> +#
> +# IMPORTANT: this option can make QEMU allocate several gigabytes
> +# of RAM. This can happen for a large guest, or a
> +# malicious guest pretending to be large.
> +#
> +# Also, paging=true has the following limitations:
> +#
> +# 1. The guest may be in a catastrophic state or can have corrupted
> +# memory, which cannot be trusted
> +# 2. The guest can be in real-mode even if paging is enabled. For
> +# example, the guest uses ACPI to sleep, and ACPI sleep state
> +# goes in real-mode
> +# 3. Currently only supported on i386 and x86_64.
> +#
> +# @protocol: the filename or file descriptor of the vmcore. The supported
> +# protocols are:
> +#
> +# 1. file: the protocol starts with "file:", and the following
> +# string is the file's path.
> +# 2. fd: the protocol starts with "fd:", and the following string
> +# is the fd's name.
> +#
> +# @detach: if true, QMP will return immediately rather than
> +# waiting for the dump to finish. The user can track progress
> +# using "query-dump". (since 2.6).
> +#
> +# @begin: if specified, the starting physical address.
> +#
> +# @length: if specified, the memory size, in bytes. If you don't
> +# want to dump all guest's memory, please specify the start @begin
> +# and @length
> +#
> +# @format: if specified, the format of guest memory dump. But non-elf
> +# format is conflict with paging and filter, ie. @paging, @begin and
> +# @length is not allowed to be specified with non-elf @format at the
> +# same time (since 2.0)
> +#
> +# Note: All boolean arguments default to false
> +#
> +# Returns: nothing on success
> +#
> +# Since: 1.2
> +#
> +# Example:
> +#
> +# -> { "execute": "dump-guest-memory",
> +# "arguments": { "protocol": "fd:dump" } }
> +# <- { "return": {} }
> +#
> +##
> +{ 'command': 'dump-guest-memory',
> + 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
> + '*begin': 'int', '*length': 'int',
> + '*format': 'DumpGuestMemoryFormat'} }
> +
> +##
> +# @DumpStatus:
> +#
> +# Describe the status of a long-running background guest memory dump.
> +#
> +# @none: no dump-guest-memory has started yet.
> +#
> +# @active: there is one dump running in background.
> +#
> +# @completed: the last dump has finished successfully.
> +#
> +# @failed: the last dump has failed.
> +#
> +# Since: 2.6
> +##
> +{ 'enum': 'DumpStatus',
> + 'data': [ 'none', 'active', 'completed', 'failed' ] }
> +
> +##
> +# @DumpQueryResult:
> +#
> +# The result format for 'query-dump'.
> +#
> +# @status: enum of @DumpStatus, which shows current dump status
> +#
> +# @completed: bytes written in latest dump (uncompressed)
> +#
> +# @total: total bytes to be written in latest dump (uncompressed)
> +#
> +# Since: 2.6
> +##
> +{ 'struct': 'DumpQueryResult',
> + 'data': { 'status': 'DumpStatus',
> + 'completed': 'int',
> + 'total': 'int' } }
> +
> +##
> +# @query-dump:
> +#
> +# Query latest dump status.
> +#
> +# Returns: A @DumpStatus object showing the dump status.
> +#
> +# Since: 2.6
> +#
> +# Example:
> +#
> +# -> { "execute": "query-dump" }
> +# <- { "return": { "status": "active", "completed": 1024000,
> +# "total": 2048000 } }
> +#
> +##
> +{ 'command': 'query-dump', 'returns': 'DumpQueryResult' }
> +
> +##
> +# @DUMP_COMPLETED:
> +#
> +# Emitted when background dump has completed
> +#
> +# @result: final dump status
> +#
> +# @error: human-readable error string that provides
> +# hint on why dump failed. Only presents on failure. The
> +# user should not try to interpret the error string.
> +#
> +# Since: 2.6
> +#
> +# Example:
> +#
> +# { "event": "DUMP_COMPLETED",
> +# "data": {"result": {"total": 1090650112, "status": "completed",
> +# "completed": 1090650112} } }
> +#
> +##
> +{ 'event': 'DUMP_COMPLETED' ,
> + 'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
> +
> +##
> +# @DumpGuestMemoryCapability:
> +#
> +# A list of the available formats for dump-guest-memory
> +#
> +# Since: 2.0
> +##
> +{ 'struct': 'DumpGuestMemoryCapability',
> + 'data': {
> + 'formats': ['DumpGuestMemoryFormat'] } }
> +
> +##
> +# @query-dump-guest-memory-capability:
> +#
> +# Returns the available formats for dump-guest-memory
> +#
> +# Returns: A @DumpGuestMemoryCapability object listing available formats for
> +# dump-guest-memory
> +#
> +# Since: 2.0
> +#
> +# Example:
> +#
> +# -> { "execute": "query-dump-guest-memory-capability" }
> +# <- { "return": { "formats":
> +# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> +#
> +##
> +{ 'command': 'query-dump-guest-memory-capability',
> + 'returns': 'DumpGuestMemoryCapability' }
> diff --git a/qapi/misc.json b/qapi/misc.json
> index d7db863c81..31427d45a6 100644
> --- a/qapi/misc.json
> +++ b/qapi/misc.json
> @@ -1117,198 +1117,6 @@
> ##
> { 'command': 'xen-set-global-dirty-log', 'data': { 'enable': 'bool' } }
>
> -##
> -# @DumpGuestMemoryFormat:
> -#
> -# An enumeration of guest-memory-dump's format.
> -#
> -# @elf: elf format
> -#
> -# @kdump-zlib: kdump-compressed format with zlib-compressed
> -#
> -# @kdump-lzo: kdump-compressed format with lzo-compressed
> -#
> -# @kdump-snappy: kdump-compressed format with snappy-compressed
> -#
> -# @win-dmp: Windows full crashdump format,
> -# can be used instead of ELF converting (since 2.13)
> -#
> -# Since: 2.0
> -##
> -{ 'enum': 'DumpGuestMemoryFormat',
> - 'data': [ 'elf', 'kdump-zlib', 'kdump-lzo', 'kdump-snappy', 'win-dmp' ] }
> -
> -##
> -# @dump-guest-memory:
> -#
> -# Dump guest's memory to vmcore. It is a synchronous operation that can take
> -# very long depending on the amount of guest memory.
> -#
> -# @paging: if true, do paging to get guest's memory mapping. This allows
> -# using gdb to process the core file.
> -#
> -# IMPORTANT: this option can make QEMU allocate several gigabytes
> -# of RAM. This can happen for a large guest, or a
> -# malicious guest pretending to be large.
> -#
> -# Also, paging=true has the following limitations:
> -#
> -# 1. The guest may be in a catastrophic state or can have corrupted
> -# memory, which cannot be trusted
> -# 2. The guest can be in real-mode even if paging is enabled. For
> -# example, the guest uses ACPI to sleep, and ACPI sleep state
> -# goes in real-mode
> -# 3. Currently only supported on i386 and x86_64.
> -#
> -# @protocol: the filename or file descriptor of the vmcore. The supported
> -# protocols are:
> -#
> -# 1. file: the protocol starts with "file:", and the following
> -# string is the file's path.
> -# 2. fd: the protocol starts with "fd:", and the following string
> -# is the fd's name.
> -#
> -# @detach: if true, QMP will return immediately rather than
> -# waiting for the dump to finish. The user can track progress
> -# using "query-dump". (since 2.6).
> -#
> -# @begin: if specified, the starting physical address.
> -#
> -# @length: if specified, the memory size, in bytes. If you don't
> -# want to dump all guest's memory, please specify the start @begin
> -# and @length
> -#
> -# @format: if specified, the format of guest memory dump. But non-elf
> -# format is conflict with paging and filter, ie. @paging, @begin and
> -# @length is not allowed to be specified with non-elf @format at the
> -# same time (since 2.0)
> -#
> -# Note: All boolean arguments default to false
> -#
> -# Returns: nothing on success
> -#
> -# Since: 1.2
> -#
> -# Example:
> -#
> -# -> { "execute": "dump-guest-memory",
> -# "arguments": { "protocol": "fd:dump" } }
> -# <- { "return": {} }
> -#
> -##
> -{ 'command': 'dump-guest-memory',
> - 'data': { 'paging': 'bool', 'protocol': 'str', '*detach': 'bool',
> - '*begin': 'int', '*length': 'int',
> - '*format': 'DumpGuestMemoryFormat'} }
> -
> -##
> -# @DumpStatus:
> -#
> -# Describe the status of a long-running background guest memory dump.
> -#
> -# @none: no dump-guest-memory has started yet.
> -#
> -# @active: there is one dump running in background.
> -#
> -# @completed: the last dump has finished successfully.
> -#
> -# @failed: the last dump has failed.
> -#
> -# Since: 2.6
> -##
> -{ 'enum': 'DumpStatus',
> - 'data': [ 'none', 'active', 'completed', 'failed' ] }
> -
> -##
> -# @DumpQueryResult:
> -#
> -# The result format for 'query-dump'.
> -#
> -# @status: enum of @DumpStatus, which shows current dump status
> -#
> -# @completed: bytes written in latest dump (uncompressed)
> -#
> -# @total: total bytes to be written in latest dump (uncompressed)
> -#
> -# Since: 2.6
> -##
> -{ 'struct': 'DumpQueryResult',
> - 'data': { 'status': 'DumpStatus',
> - 'completed': 'int',
> - 'total': 'int' } }
> -
> -##
> -# @query-dump:
> -#
> -# Query latest dump status.
> -#
> -# Returns: A @DumpStatus object showing the dump status.
> -#
> -# Since: 2.6
> -#
> -# Example:
> -#
> -# -> { "execute": "query-dump" }
> -# <- { "return": { "status": "active", "completed": 1024000,
> -# "total": 2048000 } }
> -#
> -##
> -{ 'command': 'query-dump', 'returns': 'DumpQueryResult' }
> -
> -##
> -# @DUMP_COMPLETED:
> -#
> -# Emitted when background dump has completed
> -#
> -# @result: final dump status
> -#
> -# @error: human-readable error string that provides
> -# hint on why dump failed. Only presents on failure. The
> -# user should not try to interpret the error string.
> -#
> -# Since: 2.6
> -#
> -# Example:
> -#
> -# { "event": "DUMP_COMPLETED",
> -# "data": {"result": {"total": 1090650112, "status": "completed",
> -# "completed": 1090650112} } }
> -#
> -##
> -{ 'event': 'DUMP_COMPLETED' ,
> - 'data': { 'result': 'DumpQueryResult', '*error': 'str' } }
> -
> -##
> -# @DumpGuestMemoryCapability:
> -#
> -# A list of the available formats for dump-guest-memory
> -#
> -# Since: 2.0
> -##
> -{ 'struct': 'DumpGuestMemoryCapability',
> - 'data': {
> - 'formats': ['DumpGuestMemoryFormat'] } }
> -
> -##
> -# @query-dump-guest-memory-capability:
> -#
> -# Returns the available formats for dump-guest-memory
> -#
> -# Returns: A @DumpGuestMemoryCapability object listing available formats for
> -# dump-guest-memory
> -#
> -# Since: 2.0
> -#
> -# Example:
> -#
> -# -> { "execute": "query-dump-guest-memory-capability" }
> -# <- { "return": { "formats":
> -# ["elf", "kdump-zlib", "kdump-lzo", "kdump-snappy"] }
> -#
> -##
> -{ 'command': 'query-dump-guest-memory-capability',
> - 'returns': 'DumpGuestMemoryCapability' }
> -
> ##
> # @getfd:
> #
> diff --git a/qapi/qapi-schema.json b/qapi/qapi-schema.json
> index bcfac85074..38af54d6b3 100644
> --- a/qapi/qapi-schema.json
> +++ b/qapi/qapi-schema.json
> @@ -86,6 +86,7 @@
> { 'include': 'crypto.json' }
> { 'include': 'block.json' }
> { 'include': 'char.json' }
> +{ 'include': 'dump.json' }
> { 'include': 'job.json' }
> { 'include': 'net.json' }
> { 'include': 'rdma.json' }
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json
2019-06-19 20:10 ` [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json Markus Armbruster
2019-06-19 23:36 ` Marc-André Lureau
@ 2019-06-20 8:54 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:54 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Marc-André Lureau, qemu-devel
On Wed, Jun 19, 2019 at 10:10:47PM +0200, Markus Armbruster wrote:
> Move commands dump-guest-memory, query-dump,
> query-dump-guest-memory-capability with their types from misc.json to
> new dump.json. Add dump.json to MAINTAINERS section "Dump".
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 1 +
> dump.c | 4 +-
> include/sysemu/dump.h | 2 +-
> monitor/hmp-cmds.c | 1 +
> qapi/Makefile.objs | 2 +-
> qapi/dump.json | 200 ++++++++++++++++++++++++++++++++++++++++++
> qapi/misc.json | 192 ----------------------------------------
> qapi/qapi-schema.json | 1 +
> 8 files changed, 207 insertions(+), 196 deletions(-)
> create mode 100644 qapi/dump.json
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (13 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 14/17] qapi: Split dump.json off misc.json Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-19 23:37 ` Marc-André Lureau
2019-06-20 8:55 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump" Markus Armbruster
2019-06-19 20:10 ` [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/ Markus Armbruster
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Marc-André Lureau
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 2 +-
Makefile.target | 3 +--
dump/Makefile.objs | 2 ++
dump.c => dump/dump.c | 0
win_dump.c => dump/win_dump.c | 0
win_dump.h => dump/win_dump.h | 0
6 files changed, 4 insertions(+), 3 deletions(-)
create mode 100644 dump/Makefile.objs
rename dump.c => dump/dump.c (100%)
rename win_dump.c => dump/win_dump.c (100%)
rename win_dump.h => dump/win_dump.h (100%)
diff --git a/MAINTAINERS b/MAINTAINERS
index ea110e99ca..a3fdda015f 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1850,7 +1850,7 @@ F: include/sysemu/device_tree.h
Dump
S: Supported
M: Marc-André Lureau <marcandre.lureau@redhat.com>
-F: dump.c
+F: dump/dump.c
F: hw/misc/vmcoreinfo.c
F: include/hw/misc/vmcoreinfo.h
F: include/sysemu/dump-arch.h
diff --git a/Makefile.target b/Makefile.target
index 167ae2174e..a6919e0caf 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -150,13 +150,12 @@ endif #CONFIG_BSD_USER
ifdef CONFIG_SOFTMMU
obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o
obj-y += qtest.o
+obj-y += dump/
obj-y += hw/
obj-y += monitor/
obj-y += qapi/
obj-y += memory.o
obj-y += memory_mapping.o
-obj-y += dump.o
-obj-$(TARGET_X86_64) += win_dump.o
obj-y += migration/ram.o
LIBS := $(libs_softmmu) $(LIBS)
diff --git a/dump/Makefile.objs b/dump/Makefile.objs
new file mode 100644
index 0000000000..ea6b074967
--- /dev/null
+++ b/dump/Makefile.objs
@@ -0,0 +1,2 @@
+obj-y += dump.o
+obj-$(TARGET_X86_64) += win_dump.o
diff --git a/dump.c b/dump/dump.c
similarity index 100%
rename from dump.c
rename to dump/dump.c
diff --git a/win_dump.c b/dump/win_dump.c
similarity index 100%
rename from win_dump.c
rename to dump/win_dump.c
diff --git a/win_dump.h b/dump/win_dump.h
similarity index 100%
rename from win_dump.h
rename to dump/win_dump.h
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/ Markus Armbruster
@ 2019-06-19 23:37 ` Marc-André Lureau
2019-06-20 8:55 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Marc-André Lureau @ 2019-06-19 23:37 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Wolf, Kevin, qemu-devel
On Wed, Jun 19, 2019 at 10:10 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> MAINTAINERS | 2 +-
> Makefile.target | 3 +--
> dump/Makefile.objs | 2 ++
> dump.c => dump/dump.c | 0
> win_dump.c => dump/win_dump.c | 0
> win_dump.h => dump/win_dump.h | 0
> 6 files changed, 4 insertions(+), 3 deletions(-)
> create mode 100644 dump/Makefile.objs
> rename dump.c => dump/dump.c (100%)
> rename win_dump.c => dump/win_dump.c (100%)
> rename win_dump.h => dump/win_dump.h (100%)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index ea110e99ca..a3fdda015f 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1850,7 +1850,7 @@ F: include/sysemu/device_tree.h
> Dump
> S: Supported
> M: Marc-André Lureau <marcandre.lureau@redhat.com>
> -F: dump.c
> +F: dump/dump.c
> F: hw/misc/vmcoreinfo.c
> F: include/hw/misc/vmcoreinfo.h
> F: include/sysemu/dump-arch.h
> diff --git a/Makefile.target b/Makefile.target
> index 167ae2174e..a6919e0caf 100644
> --- a/Makefile.target
> +++ b/Makefile.target
> @@ -150,13 +150,12 @@ endif #CONFIG_BSD_USER
> ifdef CONFIG_SOFTMMU
> obj-y += arch_init.o cpus.o gdbstub.o balloon.o ioport.o
> obj-y += qtest.o
> +obj-y += dump/
> obj-y += hw/
> obj-y += monitor/
> obj-y += qapi/
> obj-y += memory.o
> obj-y += memory_mapping.o
> -obj-y += dump.o
> -obj-$(TARGET_X86_64) += win_dump.o
> obj-y += migration/ram.o
> LIBS := $(libs_softmmu) $(LIBS)
>
> diff --git a/dump/Makefile.objs b/dump/Makefile.objs
> new file mode 100644
> index 0000000000..ea6b074967
> --- /dev/null
> +++ b/dump/Makefile.objs
> @@ -0,0 +1,2 @@
> +obj-y += dump.o
> +obj-$(TARGET_X86_64) += win_dump.o
> diff --git a/dump.c b/dump/dump.c
> similarity index 100%
> rename from dump.c
> rename to dump/dump.c
> diff --git a/win_dump.c b/dump/win_dump.c
> similarity index 100%
> rename from win_dump.c
> rename to dump/win_dump.c
> diff --git a/win_dump.h b/dump/win_dump.h
> similarity index 100%
> rename from win_dump.h
> rename to dump/win_dump.h
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/ Markus Armbruster
2019-06-19 23:37 ` Marc-André Lureau
@ 2019-06-20 8:55 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:55 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Marc-André Lureau, qemu-devel
On Wed, Jun 19, 2019 at 10:10:48PM +0200, Markus Armbruster wrote:
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 2 +-
> Makefile.target | 3 +--
> dump/Makefile.objs | 2 ++
> dump.c => dump/dump.c | 0
> win_dump.c => dump/win_dump.c | 0
> win_dump.h => dump/win_dump.h | 0
> 6 files changed, 4 insertions(+), 3 deletions(-)
> create mode 100644 dump/Makefile.objs
> rename dump.c => dump/dump.c (100%)
> rename win_dump.c => dump/win_dump.c (100%)
> rename win_dump.h => dump/win_dump.h (100%)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump"
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (14 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 15/17] dump: Move the code to dump/ Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-19 23:38 ` Marc-André Lureau
2019-06-20 8:56 ` Daniel P. Berrangé
2019-06-19 20:10 ` [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/ Markus Armbruster
16 siblings, 2 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Marc-André Lureau
Commit 2da91b54fe9 "dump: add Windows dump format to
dump-guest-memory" neglected to update MAINTAINERS. Do it now.
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
MAINTAINERS | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/MAINTAINERS b/MAINTAINERS
index a3fdda015f..327ad80ae4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1850,9 +1850,10 @@ F: include/sysemu/device_tree.h
Dump
S: Supported
M: Marc-André Lureau <marcandre.lureau@redhat.com>
-F: dump/dump.c
+F: dump/
F: hw/misc/vmcoreinfo.c
F: include/hw/misc/vmcoreinfo.h
+F: include/qemu/win_dump_defs
F: include/sysemu/dump-arch.h
F: include/sysemu/dump.h
F: qapi/dump.json
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump"
2019-06-19 20:10 ` [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump" Markus Armbruster
@ 2019-06-19 23:38 ` Marc-André Lureau
2019-06-20 8:56 ` Daniel P. Berrangé
1 sibling, 0 replies; 57+ messages in thread
From: Marc-André Lureau @ 2019-06-19 23:38 UTC (permalink / raw)
To: Markus Armbruster; +Cc: Wolf, Kevin, qemu-devel
On Wed, Jun 19, 2019 at 10:10 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Commit 2da91b54fe9 "dump: add Windows dump format to
> dump-guest-memory" neglected to update MAINTAINERS. Do it now.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
argh, I guess I will CC relevant people ;)
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> MAINTAINERS | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a3fdda015f..327ad80ae4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1850,9 +1850,10 @@ F: include/sysemu/device_tree.h
> Dump
> S: Supported
> M: Marc-André Lureau <marcandre.lureau@redhat.com>
> -F: dump/dump.c
> +F: dump/
> F: hw/misc/vmcoreinfo.c
> F: include/hw/misc/vmcoreinfo.h
> +F: include/qemu/win_dump_defs
> F: include/sysemu/dump-arch.h
> F: include/sysemu/dump.h
> F: qapi/dump.json
> --
> 2.21.0
>
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump"
2019-06-19 20:10 ` [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump" Markus Armbruster
2019-06-19 23:38 ` Marc-André Lureau
@ 2019-06-20 8:56 ` Daniel P. Berrangé
2019-06-24 11:31 ` Markus Armbruster
1 sibling, 1 reply; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:56 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Marc-André Lureau, qemu-devel
On Wed, Jun 19, 2019 at 10:10:49PM +0200, Markus Armbruster wrote:
> Commit 2da91b54fe9 "dump: add Windows dump format to
> dump-guest-memory" neglected to update MAINTAINERS. Do it now.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> MAINTAINERS | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index a3fdda015f..327ad80ae4 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1850,9 +1850,10 @@ F: include/sysemu/device_tree.h
> Dump
> S: Supported
> M: Marc-André Lureau <marcandre.lureau@redhat.com>
> -F: dump/dump.c
> +F: dump/
Isn't this better squashed in the previous patch in fact.
> F: hw/misc/vmcoreinfo.c
> F: include/hw/misc/vmcoreinfo.h
> +F: include/qemu/win_dump_defs
> F: include/sysemu/dump-arch.h
> F: include/sysemu/dump.h
> F: qapi/dump.json
Either way, the result is good so
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump"
2019-06-20 8:56 ` Daniel P. Berrangé
@ 2019-06-24 11:31 ` Markus Armbruster
0 siblings, 0 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-24 11:31 UTC (permalink / raw)
To: Daniel P. Berrangé; +Cc: kwolf, Marc-André Lureau, qemu-devel
Daniel P. Berrangé <berrange@redhat.com> writes:
> On Wed, Jun 19, 2019 at 10:10:49PM +0200, Markus Armbruster wrote:
>> Commit 2da91b54fe9 "dump: add Windows dump format to
>> dump-guest-memory" neglected to update MAINTAINERS. Do it now.
>>
>> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
>> MAINTAINERS | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index a3fdda015f..327ad80ae4 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1850,9 +1850,10 @@ F: include/sysemu/device_tree.h
>> Dump
>> S: Supported
>> M: Marc-André Lureau <marcandre.lureau@redhat.com>
>> -F: dump/dump.c
>> +F: dump/
>
> Isn't this better squashed in the previous patch in fact.
If I do that, the commit does two things: move code and improve
MAINTAINERS coverage. Okay in this case. We can just as well finish
the improvement job then, i.e. squash the entire commit into the
previous one.
>> F: hw/misc/vmcoreinfo.c
>> F: include/hw/misc/vmcoreinfo.h
>> +F: include/qemu/win_dump_defs
>> F: include/sysemu/dump-arch.h
>> F: include/sysemu/dump.h
>> F: qapi/dump.json
>
> Either way, the result is good so
>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Thanks!
^ permalink raw reply [flat|nested] 57+ messages in thread
* [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/
2019-06-19 20:10 [Qemu-devel] [PATCH 00/17] Move QOM, qdev, machine core and dump code Markus Armbruster
` (15 preceding siblings ...)
2019-06-19 20:10 ` [Qemu-devel] [PATCH 16/17] MAINTAINERS: Add Windows dump to section "Dump" Markus Armbruster
@ 2019-06-19 20:10 ` Markus Armbruster
2019-06-19 20:19 ` Eric Blake
` (2 more replies)
16 siblings, 3 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-19 20:10 UTC (permalink / raw)
To: qemu-devel; +Cc: kwolf, Marc-André Lureau, Dr. David Alan Gilbert
Move the HMP handlers related to qapi/dump.json to
dimp/dump-hmp-cmds.c, where they are covered by MAINTAINERS section
"Dump", just like qapi/dump.json.
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
Makefile.objs | 1 +
dump/Makefile.objs | 1 +
dump/dump-hmp-cmds.c | 88 ++++++++++++++++++++++++++++++++++++++++++++
monitor/hmp-cmds.c | 76 --------------------------------------
4 files changed, 90 insertions(+), 76 deletions(-)
create mode 100644 dump/dump-hmp-cmds.c
diff --git a/Makefile.objs b/Makefile.objs
index 7494d6143b..c93d731047 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -45,6 +45,7 @@ io-obj-y = io/
ifeq ($(CONFIG_SOFTMMU),y)
common-obj-y = blockdev.o blockdev-nbd.o block/
common-obj-y += bootdevice.o iothread.o
+common-obj-y += dump/
common-obj-y += job-qmp.o
common-obj-y += monitor/
common-obj-y += net/
diff --git a/dump/Makefile.objs b/dump/Makefile.objs
index ea6b074967..d2a5db3b81 100644
--- a/dump/Makefile.objs
+++ b/dump/Makefile.objs
@@ -1,2 +1,3 @@
obj-y += dump.o
+common-obj-y += dump-hmp-cmds.o
obj-$(TARGET_X86_64) += win_dump.o
diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c
new file mode 100644
index 0000000000..3dbf44372c
--- /dev/null
+++ b/dump/dump-hmp-cmds.c
@@ -0,0 +1,88 @@
+/*
+ * Human Monitor Interface commands
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include "qemu/osdep.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-dump.h"
+#include "qapi/qmp/qdict.h"
+
+void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
+{
+ Error *err = NULL;
+ bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
+ bool paging = qdict_get_try_bool(qdict, "paging", false);
+ bool zlib = qdict_get_try_bool(qdict, "zlib", false);
+ bool lzo = qdict_get_try_bool(qdict, "lzo", false);
+ bool snappy = qdict_get_try_bool(qdict, "snappy", false);
+ const char *file = qdict_get_str(qdict, "filename");
+ bool has_begin = qdict_haskey(qdict, "begin");
+ bool has_length = qdict_haskey(qdict, "length");
+ bool has_detach = qdict_haskey(qdict, "detach");
+ int64_t begin = 0;
+ int64_t length = 0;
+ bool detach = false;
+ enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
+ char *prot;
+
+ if (zlib + lzo + snappy + win_dmp > 1) {
+ error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
+ hmp_handle_error(mon, &err);
+ return;
+ }
+
+ if (win_dmp) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
+ }
+
+ if (zlib) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
+ }
+
+ if (lzo) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
+ }
+
+ if (snappy) {
+ dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
+ }
+
+ if (has_begin) {
+ begin = qdict_get_int(qdict, "begin");
+ }
+ if (has_length) {
+ length = qdict_get_int(qdict, "length");
+ }
+ if (has_detach) {
+ detach = qdict_get_bool(qdict, "detach");
+ }
+
+ prot = g_strconcat("file:", file, NULL);
+
+ qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
+ has_length, length, true, dump_format, &err);
+ hmp_handle_error(mon, &err);
+ g_free(prot);
+}
+
+void hmp_info_dump(Monitor *mon, const QDict *qdict)
+{
+ DumpQueryResult *result = qmp_query_dump(NULL);
+
+ assert(result && result->status < DUMP_STATUS__MAX);
+ monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
+
+ if (result->status == DUMP_STATUS_ACTIVE) {
+ float percent = 0;
+ assert(result->total != 0);
+ percent = 100.0 * result->completed / result->total;
+ monitor_printf(mon, "Finished: %.2f %%\n", percent);
+ }
+
+ qapi_free_DumpQueryResult(result);
+}
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 18ffeb7017..dc12ae6129 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -31,7 +31,6 @@
#include "qapi/qapi-builtin-visit.h"
#include "qapi/qapi-commands-block.h"
#include "qapi/qapi-commands-char.h"
-#include "qapi/qapi-commands-dump.h"
#include "qapi/qapi-commands-migration.h"
#include "qapi/qapi-commands-misc.h"
#include "qapi/qapi-commands-net.h"
@@ -2160,64 +2159,6 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
hmp_handle_error(mon, &err);
}
-void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
-{
- Error *err = NULL;
- bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
- bool paging = qdict_get_try_bool(qdict, "paging", false);
- bool zlib = qdict_get_try_bool(qdict, "zlib", false);
- bool lzo = qdict_get_try_bool(qdict, "lzo", false);
- bool snappy = qdict_get_try_bool(qdict, "snappy", false);
- const char *file = qdict_get_str(qdict, "filename");
- bool has_begin = qdict_haskey(qdict, "begin");
- bool has_length = qdict_haskey(qdict, "length");
- bool has_detach = qdict_haskey(qdict, "detach");
- int64_t begin = 0;
- int64_t length = 0;
- bool detach = false;
- enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
- char *prot;
-
- if (zlib + lzo + snappy + win_dmp > 1) {
- error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
- hmp_handle_error(mon, &err);
- return;
- }
-
- if (win_dmp) {
- dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
- }
-
- if (zlib) {
- dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
- }
-
- if (lzo) {
- dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
- }
-
- if (snappy) {
- dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
- }
-
- if (has_begin) {
- begin = qdict_get_int(qdict, "begin");
- }
- if (has_length) {
- length = qdict_get_int(qdict, "length");
- }
- if (has_detach) {
- detach = qdict_get_bool(qdict, "detach");
- }
-
- prot = g_strconcat("file:", file, NULL);
-
- qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
- has_length, length, true, dump_format, &err);
- hmp_handle_error(mon, &err);
- g_free(prot);
-}
-
void hmp_netdev_add(Monitor *mon, const QDict *qdict)
{
Error *err = NULL;
@@ -2949,23 +2890,6 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict)
qapi_free_RockerOfDpaGroupList(list);
}
-void hmp_info_dump(Monitor *mon, const QDict *qdict)
-{
- DumpQueryResult *result = qmp_query_dump(NULL);
-
- assert(result && result->status < DUMP_STATUS__MAX);
- monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
-
- if (result->status == DUMP_STATUS_ACTIVE) {
- float percent = 0;
- assert(result->total != 0);
- percent = 100.0 * result->completed / result->total;
- monitor_printf(mon, "Finished: %.2f %%\n", percent);
- }
-
- qapi_free_DumpQueryResult(result);
-}
-
void hmp_info_ramblock(Monitor *mon, const QDict *qdict)
{
ram_block_dump(mon);
--
2.21.0
^ permalink raw reply related [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/ Markus Armbruster
@ 2019-06-19 20:19 ` Eric Blake
2019-06-24 11:34 ` Markus Armbruster
2019-06-20 8:57 ` Daniel P. Berrangé
2019-06-20 9:57 ` Dr. David Alan Gilbert
2 siblings, 1 reply; 57+ messages in thread
From: Eric Blake @ 2019-06-19 20:19 UTC (permalink / raw)
To: Markus Armbruster, qemu-devel
Cc: kwolf, Marc-André Lureau, Dr. David Alan Gilbert
[-- Attachment #1.1: Type: text/plain, Size: 535 bytes --]
On 6/19/19 3:10 PM, Markus Armbruster wrote:
> Move the HMP handlers related to qapi/dump.json to
> dimp/dump-hmp-cmds.c, where they are covered by MAINTAINERS section
s/dimp/dump/
> "Dump", just like qapi/dump.json.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/
2019-06-19 20:19 ` Eric Blake
@ 2019-06-24 11:34 ` Markus Armbruster
0 siblings, 0 replies; 57+ messages in thread
From: Markus Armbruster @ 2019-06-24 11:34 UTC (permalink / raw)
To: Eric Blake
Cc: kwolf, Marc-André Lureau, qemu-devel, Dr. David Alan Gilbert
Eric Blake <eblake@redhat.com> writes:
> On 6/19/19 3:10 PM, Markus Armbruster wrote:
>> Move the HMP handlers related to qapi/dump.json to
>> dimp/dump-hmp-cmds.c, where they are covered by MAINTAINERS section
>
> s/dimp/dump/
Will fix. Thanks!
>> "Dump", just like qapi/dump.json.
>>
>> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>> Signed-off-by: Markus Armbruster <armbru@redhat.com>
>> ---
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/ Markus Armbruster
2019-06-19 20:19 ` Eric Blake
@ 2019-06-20 8:57 ` Daniel P. Berrangé
2019-06-20 9:57 ` Dr. David Alan Gilbert
2 siblings, 0 replies; 57+ messages in thread
From: Daniel P. Berrangé @ 2019-06-20 8:57 UTC (permalink / raw)
To: Markus Armbruster
Cc: kwolf, Marc-André Lureau, qemu-devel, Dr. David Alan Gilbert
On Wed, Jun 19, 2019 at 10:10:50PM +0200, Markus Armbruster wrote:
> Move the HMP handlers related to qapi/dump.json to
> dimp/dump-hmp-cmds.c, where they are covered by MAINTAINERS section
> "Dump", just like qapi/dump.json.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
> Makefile.objs | 1 +
> dump/Makefile.objs | 1 +
> dump/dump-hmp-cmds.c | 88 ++++++++++++++++++++++++++++++++++++++++++++
> monitor/hmp-cmds.c | 76 --------------------------------------
> 4 files changed, 90 insertions(+), 76 deletions(-)
> create mode 100644 dump/dump-hmp-cmds.c
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 57+ messages in thread
* Re: [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/
2019-06-19 20:10 ` [Qemu-devel] [PATCH 17/17] dump: Move HMP command handlers to dump/ Markus Armbruster
2019-06-19 20:19 ` Eric Blake
2019-06-20 8:57 ` Daniel P. Berrangé
@ 2019-06-20 9:57 ` Dr. David Alan Gilbert
2 siblings, 0 replies; 57+ messages in thread
From: Dr. David Alan Gilbert @ 2019-06-20 9:57 UTC (permalink / raw)
To: Markus Armbruster; +Cc: kwolf, Marc-André Lureau, qemu-devel
* Markus Armbruster (armbru@redhat.com) wrote:
> Move the HMP handlers related to qapi/dump.json to
> dimp/dump-hmp-cmds.c, where they are covered by MAINTAINERS section
> "Dump", just like qapi/dump.json.
>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
> Makefile.objs | 1 +
> dump/Makefile.objs | 1 +
> dump/dump-hmp-cmds.c | 88 ++++++++++++++++++++++++++++++++++++++++++++
> monitor/hmp-cmds.c | 76 --------------------------------------
> 4 files changed, 90 insertions(+), 76 deletions(-)
> create mode 100644 dump/dump-hmp-cmds.c
>
> diff --git a/Makefile.objs b/Makefile.objs
> index 7494d6143b..c93d731047 100644
> --- a/Makefile.objs
> +++ b/Makefile.objs
> @@ -45,6 +45,7 @@ io-obj-y = io/
> ifeq ($(CONFIG_SOFTMMU),y)
> common-obj-y = blockdev.o blockdev-nbd.o block/
> common-obj-y += bootdevice.o iothread.o
> +common-obj-y += dump/
> common-obj-y += job-qmp.o
> common-obj-y += monitor/
> common-obj-y += net/
> diff --git a/dump/Makefile.objs b/dump/Makefile.objs
> index ea6b074967..d2a5db3b81 100644
> --- a/dump/Makefile.objs
> +++ b/dump/Makefile.objs
> @@ -1,2 +1,3 @@
> obj-y += dump.o
> +common-obj-y += dump-hmp-cmds.o
> obj-$(TARGET_X86_64) += win_dump.o
> diff --git a/dump/dump-hmp-cmds.c b/dump/dump-hmp-cmds.c
> new file mode 100644
> index 0000000000..3dbf44372c
> --- /dev/null
> +++ b/dump/dump-hmp-cmds.c
> @@ -0,0 +1,88 @@
> +/*
> + * Human Monitor Interface commands
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include "qemu/osdep.h"
> +#include "monitor/hmp.h"
> +#include "monitor/monitor.h"
> +#include "qapi/error.h"
> +#include "qapi/qapi-commands-dump.h"
> +#include "qapi/qmp/qdict.h"
> +
> +void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
> +{
> + Error *err = NULL;
> + bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
> + bool paging = qdict_get_try_bool(qdict, "paging", false);
> + bool zlib = qdict_get_try_bool(qdict, "zlib", false);
> + bool lzo = qdict_get_try_bool(qdict, "lzo", false);
> + bool snappy = qdict_get_try_bool(qdict, "snappy", false);
> + const char *file = qdict_get_str(qdict, "filename");
> + bool has_begin = qdict_haskey(qdict, "begin");
> + bool has_length = qdict_haskey(qdict, "length");
> + bool has_detach = qdict_haskey(qdict, "detach");
> + int64_t begin = 0;
> + int64_t length = 0;
> + bool detach = false;
> + enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
> + char *prot;
> +
> + if (zlib + lzo + snappy + win_dmp > 1) {
> + error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
> + hmp_handle_error(mon, &err);
> + return;
> + }
> +
> + if (win_dmp) {
> + dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
> + }
> +
> + if (zlib) {
> + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
> + }
> +
> + if (lzo) {
> + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
> + }
> +
> + if (snappy) {
> + dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
> + }
> +
> + if (has_begin) {
> + begin = qdict_get_int(qdict, "begin");
> + }
> + if (has_length) {
> + length = qdict_get_int(qdict, "length");
> + }
> + if (has_detach) {
> + detach = qdict_get_bool(qdict, "detach");
> + }
> +
> + prot = g_strconcat("file:", file, NULL);
> +
> + qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
> + has_length, length, true, dump_format, &err);
> + hmp_handle_error(mon, &err);
> + g_free(prot);
> +}
> +
> +void hmp_info_dump(Monitor *mon, const QDict *qdict)
> +{
> + DumpQueryResult *result = qmp_query_dump(NULL);
> +
> + assert(result && result->status < DUMP_STATUS__MAX);
> + monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
> +
> + if (result->status == DUMP_STATUS_ACTIVE) {
> + float percent = 0;
> + assert(result->total != 0);
> + percent = 100.0 * result->completed / result->total;
> + monitor_printf(mon, "Finished: %.2f %%\n", percent);
> + }
> +
> + qapi_free_DumpQueryResult(result);
> +}
> diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
> index 18ffeb7017..dc12ae6129 100644
> --- a/monitor/hmp-cmds.c
> +++ b/monitor/hmp-cmds.c
> @@ -31,7 +31,6 @@
> #include "qapi/qapi-builtin-visit.h"
> #include "qapi/qapi-commands-block.h"
> #include "qapi/qapi-commands-char.h"
> -#include "qapi/qapi-commands-dump.h"
> #include "qapi/qapi-commands-migration.h"
> #include "qapi/qapi-commands-misc.h"
> #include "qapi/qapi-commands-net.h"
> @@ -2160,64 +2159,6 @@ void hmp_device_del(Monitor *mon, const QDict *qdict)
> hmp_handle_error(mon, &err);
> }
>
> -void hmp_dump_guest_memory(Monitor *mon, const QDict *qdict)
> -{
> - Error *err = NULL;
> - bool win_dmp = qdict_get_try_bool(qdict, "windmp", false);
> - bool paging = qdict_get_try_bool(qdict, "paging", false);
> - bool zlib = qdict_get_try_bool(qdict, "zlib", false);
> - bool lzo = qdict_get_try_bool(qdict, "lzo", false);
> - bool snappy = qdict_get_try_bool(qdict, "snappy", false);
> - const char *file = qdict_get_str(qdict, "filename");
> - bool has_begin = qdict_haskey(qdict, "begin");
> - bool has_length = qdict_haskey(qdict, "length");
> - bool has_detach = qdict_haskey(qdict, "detach");
> - int64_t begin = 0;
> - int64_t length = 0;
> - bool detach = false;
> - enum DumpGuestMemoryFormat dump_format = DUMP_GUEST_MEMORY_FORMAT_ELF;
> - char *prot;
> -
> - if (zlib + lzo + snappy + win_dmp > 1) {
> - error_setg(&err, "only one of '-z|-l|-s|-w' can be set");
> - hmp_handle_error(mon, &err);
> - return;
> - }
> -
> - if (win_dmp) {
> - dump_format = DUMP_GUEST_MEMORY_FORMAT_WIN_DMP;
> - }
> -
> - if (zlib) {
> - dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_ZLIB;
> - }
> -
> - if (lzo) {
> - dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_LZO;
> - }
> -
> - if (snappy) {
> - dump_format = DUMP_GUEST_MEMORY_FORMAT_KDUMP_SNAPPY;
> - }
> -
> - if (has_begin) {
> - begin = qdict_get_int(qdict, "begin");
> - }
> - if (has_length) {
> - length = qdict_get_int(qdict, "length");
> - }
> - if (has_detach) {
> - detach = qdict_get_bool(qdict, "detach");
> - }
> -
> - prot = g_strconcat("file:", file, NULL);
> -
> - qmp_dump_guest_memory(paging, prot, true, detach, has_begin, begin,
> - has_length, length, true, dump_format, &err);
> - hmp_handle_error(mon, &err);
> - g_free(prot);
> -}
> -
> void hmp_netdev_add(Monitor *mon, const QDict *qdict)
> {
> Error *err = NULL;
> @@ -2949,23 +2890,6 @@ void hmp_rocker_of_dpa_groups(Monitor *mon, const QDict *qdict)
> qapi_free_RockerOfDpaGroupList(list);
> }
>
> -void hmp_info_dump(Monitor *mon, const QDict *qdict)
> -{
> - DumpQueryResult *result = qmp_query_dump(NULL);
> -
> - assert(result && result->status < DUMP_STATUS__MAX);
> - monitor_printf(mon, "Status: %s\n", DumpStatus_str(result->status));
> -
> - if (result->status == DUMP_STATUS_ACTIVE) {
> - float percent = 0;
> - assert(result->total != 0);
> - percent = 100.0 * result->completed / result->total;
> - monitor_printf(mon, "Finished: %.2f %%\n", percent);
> - }
> -
> - qapi_free_DumpQueryResult(result);
> -}
> -
> void hmp_info_ramblock(Monitor *mon, const QDict *qdict)
> {
> ram_block_dump(mon);
> --
> 2.21.0
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 57+ messages in thread