* [PATCH v2 01/16] hexagon: Remove unnecessary 'monitor/monitor.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 02/16] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
` (14 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Brian Cain,
Pierrick Bouvier
The Monitor type is used in these 2 files, as a pointer.
Since the type is forward-declared in "qemu/typedefs.h",
which all source files include via "qemu/osdep.h", we do
not need to include it.
Do however include "exec/hwaddr.h" and "exec/mmu-access-type.h"
which declare the types used by hex_tlb_find_match prototype:
extern bool hex_tlb_find_match(CPUHexagonState *env, uint32_t VA,
MMUAccessType access_type, hwaddr *PA, int *prot,
^^^^^^^^^^^^^ ^^^^^^
uint64_t *size, int32_t *excp, int mmu_idx);
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/hw/hexagon/hexagon_tlb.h | 2 +-
target/hexagon/hex_mmu.h | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/hw/hexagon/hexagon_tlb.h b/include/hw/hexagon/hexagon_tlb.h
index 90d9ed84043..760dc1ea811 100644
--- a/include/hw/hexagon/hexagon_tlb.h
+++ b/include/hw/hexagon/hexagon_tlb.h
@@ -12,7 +12,7 @@
#include "qom/object.h"
#include "exec/hwaddr.h"
#include "exec/mmu-access-type.h"
-#include "monitor/monitor.h"
+
#define TYPE_HEXAGON_TLB "hexagon-tlb"
OBJECT_DECLARE_SIMPLE_TYPE(HexagonTLBState, HEXAGON_TLB)
diff --git a/target/hexagon/hex_mmu.h b/target/hexagon/hex_mmu.h
index 4f556c715a9..6aa450b9413 100644
--- a/target/hexagon/hex_mmu.h
+++ b/target/hexagon/hex_mmu.h
@@ -7,8 +7,9 @@
#ifndef HEXAGON_MMU_H
#define HEXAGON_MMU_H
+#include "exec/hwaddr.h"
+#include "exec/mmu-access-type.h"
#include "cpu.h"
-#include "monitor/monitor.h"
extern void hex_tlbw(CPUHexagonState *env, uint32_t index, uint64_t value);
extern uint32_t hex_tlb_lookup(CPUHexagonState *env, uint32_t ssr, uint32_t VA);
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 01/16] hexagon: Remove unnecessary 'monitor/monitor.h' header
2026-08-12 13:11 ` [PATCH v2 01/16] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson,
Brian Cain, Pierrick Bouvier
On Wed, 12 Aug 2026 15:11:32 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> The Monitor type is used in these 2 files, as a pointer.
> Since the type is forward-declared in "qemu/typedefs.h",
> which all source files include via "qemu/osdep.h", we do
> not need to include it.
>
> Do however include "exec/hwaddr.h" and "exec/mmu-access-type.h"
> which declare the types used by hex_tlb_find_match prototype:
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 02/16] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
2026-08-12 13:11 ` [PATCH v2 01/16] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 03/16] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
` (13 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
test-util-sockets.c calls qemu_init_main_loop(), itself declared in
the "qemu/main-loop.h" header. Include the latter to avoid when
refactoring unrelated headers:
../tests/unit/test-util-sockets.c:553:5: error: call to undeclared function 'qemu_init_main_loop'
553 | qemu_init_main_loop(&error_abort);
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
tests/unit/test-util-sockets.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tests/unit/test-util-sockets.c b/tests/unit/test-util-sockets.c
index ee66d727c38..ab3f39c3efb 100644
--- a/tests/unit/test-util-sockets.c
+++ b/tests/unit/test-util-sockets.c
@@ -19,6 +19,7 @@
*/
#include "qemu/osdep.h"
+#include "qemu/main-loop.h"
#include "qemu/sockets.h"
#include "qapi/error.h"
#include "socket-helpers.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 02/16] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c
2026-08-12 13:11 ` [PATCH v2 02/16] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson
On Wed, 12 Aug 2026 15:11:33 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> test-util-sockets.c calls qemu_init_main_loop(), itself declared in
> the "qemu/main-loop.h" header. Include the latter to avoid when
> refactoring unrelated headers:
>
> ../tests/unit/test-util-sockets.c:553:5: error: call to undeclared function 'qemu_init_main_loop'
> 553 | qemu_init_main_loop(&error_abort);
> | ^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 03/16] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h'
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
2026-08-12 13:11 ` [PATCH v2 01/16] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 13:11 ` [PATCH v2 02/16] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 04/16] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
` (12 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Michael Roth
qmp-dispatch.c calls aio_wait_kick() and monitor_cur(). Include the
header declaring them in order to avoid the following build failure
when refactoring unrelated headers:
../qapi/qmp-dispatch.c:126:12: error: call to undeclared function 'monitor_cur'
126 | assert(monitor_cur() == NULL);
| ^
../qapi/qmp-dispatch.c:141:5: error: call to undeclared function 'aio_wait_kick'
141 | aio_wait_kick();
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
qapi/qmp-dispatch.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c
index e3897d51977..965cad64998 100644
--- a/qapi/qmp-dispatch.c
+++ b/qapi/qmp-dispatch.c
@@ -14,6 +14,7 @@
#include "qemu/osdep.h"
#include "qemu/aio.h"
+#include "qemu/aio-wait.h"
#include "qapi/compat-policy.h"
#include "qapi/error.h"
#include "qapi/qmp-registry.h"
@@ -24,6 +25,7 @@
#include "qobject/qbool.h"
#include "qemu/coroutine.h"
#include "qemu/main-loop.h"
+#include "monitor/monitor.h"
Visitor *qobject_input_visitor_new_qmp(QObject *obj)
{
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 03/16] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h'
2026-08-12 13:11 ` [PATCH v2 03/16] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson,
Michael Roth
On Wed, 12 Aug 2026 15:11:34 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> qmp-dispatch.c calls aio_wait_kick() and monitor_cur(). Include the
> header declaring them in order to avoid the following build failure
> when refactoring unrelated headers:
>
> ../qapi/qmp-dispatch.c:126:12: error: call to undeclared function 'monitor_cur'
> 126 | assert(monitor_cur() == NULL);
> | ^
> ../qapi/qmp-dispatch.c:141:5: error: call to undeclared function 'aio_wait_kick'
> 141 | aio_wait_kick();
> | ^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 04/16] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 03/16] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 05/16] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
` (11 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Michael Roth
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/qapi/qmp-registry.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/qapi/qmp-registry.h b/include/qapi/qmp-registry.h
index e0ee1ad3ac6..6146306a3a1 100644
--- a/include/qapi/qmp-registry.h
+++ b/include/qapi/qmp-registry.h
@@ -14,7 +14,6 @@
#ifndef QAPI_QMP_DISPATCH_H
#define QAPI_QMP_DISPATCH_H
-#include "monitor/monitor.h"
#include "qemu/queue.h"
typedef void (QmpCommandFunc)(QDict *, QObject **, Error **);
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* [PATCH v2 05/16] migration/hmp-cmds: Include 'block/block-global-state.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (3 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 04/16] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 06/16] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
` (10 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Peter Xu,
Fabiano Rosas
migration-hmp-cmds.c uses types / methods declared in
"block/block-global-state.h". Include the latter otherwise
we get when refactoring unrelated headers:
../migration/migration-hmp-cmds.c:911:5: error: use of undeclared identifier 'BdrvNextIterator'
911 | BdrvNextIterator it;
| ^
../migration/migration-hmp-cmds.c:918:15: error: call to undeclared function 'bdrv_first'
918 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
migration/migration-hmp-cmds.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/migration/migration-hmp-cmds.c b/migration/migration-hmp-cmds.c
index b04fc4489f4..351512942af 100644
--- a/migration/migration-hmp-cmds.c
+++ b/migration/migration-hmp-cmds.c
@@ -15,6 +15,7 @@
#include "qemu/osdep.h"
#include "block/qapi.h"
+#include "block/block-global-state.h"
#include "migration/snapshot.h"
#include "monitor/hmp.h"
#include "monitor/hmp-completion.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 05/16] migration/hmp-cmds: Include 'block/block-global-state.h' header
2026-08-12 13:11 ` [PATCH v2 05/16] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson, Peter Xu,
Fabiano Rosas
On Wed, 12 Aug 2026 15:11:36 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> migration-hmp-cmds.c uses types / methods declared in
> "block/block-global-state.h". Include the latter otherwise
> we get when refactoring unrelated headers:
>
> ../migration/migration-hmp-cmds.c:911:5: error: use of undeclared identifier 'BdrvNextIterator'
> 911 | BdrvNextIterator it;
> | ^
> ../migration/migration-hmp-cmds.c:918:15: error: call to undeclared function 'bdrv_first'
> 918 | for (bs = bdrv_first(&it); bs; bs = bdrv_next(&it)) {
> | ^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 06/16] monitor: Include missing 'qemu/aio-wait.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (4 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 05/16] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 07/16] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
` (9 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
Both monitor.c and qmp.c use types / methods declared in
"qemu/aio-wait.h". Include the latter to avoid the following
errors when refactoring unrelated headers:
../monitor/monitor.c:648:5: error: call to undeclared function 'AIO_WAIT_WHILE_UNLOCKED'
648 | AIO_WAIT_WHILE_UNLOCKED(NULL,
| ^
../monitor/qmp.c:792:9: error: call to undeclared function 'aio_wait_bh_oneshot'
792 | aio_wait_bh_oneshot(iothread_get_aio_context(mon_iothread),
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
monitor/monitor.c | 1 +
monitor/qmp.c | 2 +-
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/monitor/monitor.c b/monitor/monitor.c
index ed195fd97bb..c75ae815343 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -30,6 +30,7 @@
#include "qapi/qapi-visit-control.h"
#include "qobject/qdict.h"
#include "qom/object_interfaces.h"
+#include "qemu/aio-wait.h"
#include "qemu/error-report.h"
#include "qemu/option.h"
#include "system/qtest.h"
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 338d37cb7e5..6ae1098d39f 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -23,7 +23,7 @@
*/
#include "qemu/osdep.h"
-
+#include "qemu/aio-wait.h"
#include "chardev/char-io.h"
#include "monitor-internal.h"
#include "qapi/error.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 06/16] monitor: Include missing 'qemu/aio-wait.h' header
2026-08-12 13:11 ` [PATCH v2 06/16] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson
On Wed, 12 Aug 2026 15:11:37 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> Both monitor.c and qmp.c use types / methods declared in
> "qemu/aio-wait.h". Include the latter to avoid the following
> errors when refactoring unrelated headers:
>
> ../monitor/monitor.c:648:5: error: call to undeclared function 'AIO_WAIT_WHILE_UNLOCKED'
> 648 | AIO_WAIT_WHILE_UNLOCKED(NULL,
> | ^
> ../monitor/qmp.c:792:9: error: call to undeclared function 'aio_wait_bh_oneshot'
> 792 | aio_wait_bh_oneshot(iothread_get_aio_context(mon_iothread),
> | ^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 07/16] monitor: Include missing 'qemu/lockable.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (5 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 06/16] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 08/16] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
` (8 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
Files in monitor/ use the QEMU_LOCK_GUARD() macros, which
are declared in "qemu/lockable.h". Include the latter to
avoid when refactoring unrelated headers:
../monitor/fds.c:146:5: error: call to undeclared function 'QEMU_LOCK_GUARD'
146 | QEMU_LOCK_GUARD(&mon->mon_lock);
| ^
../monitor/monitor.c:176:5: error: call to undeclared function 'QEMU_LOCK_GUARD'
176 | QEMU_LOCK_GUARD(&mon->mon_lock);
| ^
../monitor/qmp.c:164:5: error: call to undeclared function 'WITH_QEMU_LOCK_GUARD'
164 | WITH_QEMU_LOCK_GUARD(&mon->mon_lock) {
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
monitor/fds.c | 1 +
monitor/monitor.c | 1 +
monitor/qmp.c | 1 +
3 files changed, 3 insertions(+)
diff --git a/monitor/fds.c b/monitor/fds.c
index cc35d2ec334..abe5f13487d 100644
--- a/monitor/fds.c
+++ b/monitor/fds.c
@@ -29,6 +29,7 @@
#include "qapi/qmp/qerror.h"
#include "qemu/ctype.h"
#include "qemu/cutils.h"
+#include "qemu/lockable.h"
#include "system/runstate.h"
/* file descriptors passed via SCM_RIGHTS */
diff --git a/monitor/monitor.c b/monitor/monitor.c
index c75ae815343..6af09f2f6ea 100644
--- a/monitor/monitor.c
+++ b/monitor/monitor.c
@@ -32,6 +32,7 @@
#include "qom/object_interfaces.h"
#include "qemu/aio-wait.h"
#include "qemu/error-report.h"
+#include "qemu/lockable.h"
#include "qemu/option.h"
#include "system/qtest.h"
#include "trace.h"
diff --git a/monitor/qmp.c b/monitor/qmp.c
index 6ae1098d39f..aec03157750 100644
--- a/monitor/qmp.c
+++ b/monitor/qmp.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "qemu/aio-wait.h"
+#include "qemu/lockable.h"
#include "chardev/char-io.h"
#include "monitor-internal.h"
#include "qapi/error.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 07/16] monitor: Include missing 'qemu/lockable.h' header
2026-08-12 13:11 ` [PATCH v2 07/16] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson
On Wed, 12 Aug 2026 15:11:38 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> Files in monitor/ use the QEMU_LOCK_GUARD() macros, which
> are declared in "qemu/lockable.h". Include the latter to
> avoid when refactoring unrelated headers:
>
> ../monitor/fds.c:146:5: error: call to undeclared function 'QEMU_LOCK_GUARD'
> 146 | QEMU_LOCK_GUARD(&mon->mon_lock);
> | ^
> ../monitor/monitor.c:176:5: error: call to undeclared function 'QEMU_LOCK_GUARD'
> 176 | QEMU_LOCK_GUARD(&mon->mon_lock);
> | ^
> ../monitor/qmp.c:164:5: error: call to undeclared function 'WITH_QEMU_LOCK_GUARD'
> 164 | WITH_QEMU_LOCK_GUARD(&mon->mon_lock) {
> | ^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 08/16] monitor: Include missing 'qemu/coroutine-core.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (6 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 07/16] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 09/16] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
` (7 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
"monitor/monitor.h" declares monitor_set_cur() which use the
'Coroutine' type, itself declared in "qemu/coroutine-core.h".
Include the latter to avoid when refactoring unrelated headers:
In file included from ../../target/sh4/monitor.c:26:
qemu/include/monitor/monitor.h:32:26: error: unknown type name 'Coroutine'
32 | Monitor *monitor_set_cur(Coroutine *co, Monitor *mon);
| ^
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/monitor/monitor.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index 890497b0d22..efdd2165aa9 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -4,6 +4,7 @@
#include "block/block.h"
#include "qapi/qapi-types-misc.h"
#include "qapi/qapi-emit-events.h"
+#include "qemu/coroutine-core.h"
#include "qemu/readline.h"
#include "exec/hwaddr.h"
#include "qom/object.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 08/16] monitor: Include missing 'qemu/coroutine-core.h' header
2026-08-12 13:11 ` [PATCH v2 08/16] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson
On Wed, 12 Aug 2026 15:11:39 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> "monitor/monitor.h" declares monitor_set_cur() which use the
> 'Coroutine' type, itself declared in "qemu/coroutine-core.h".
> Include the latter to avoid when refactoring unrelated headers:
>
> In file included from ../../target/sh4/monitor.c:26:
> qemu/include/monitor/monitor.h:32:26: error: unknown type name 'Coroutine'
> 32 | Monitor *monitor_set_cur(Coroutine *co, Monitor *mon);
> | ^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 09/16] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (7 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 08/16] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
` (6 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
"monitor/monitor.h" don't use anything declared in the generated
"qapi/qapi-emit-events.h" header.
However the "monitor/monitor-internal.h" do:
107 struct MonitorClass {
...
116 /*
117 * If non-NULL, the monitor is able to send event
118 * notifications back to the client
119 */
120 void (*emit_event)(Monitor *mon, QAPIEvent event, QDict *qdict);
^^^^^^^^^
Move the header inclusion to "monitor/monitor-internal.h" to
avoid including / re-exposing unnecessary declarations in the
global "monitor/monitor.h" header.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/monitor/monitor.h | 1 -
monitor/monitor-internal.h | 1 +
2 files changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index efdd2165aa9..fa9f4a8a75a 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -3,7 +3,6 @@
#include "block/block.h"
#include "qapi/qapi-types-misc.h"
-#include "qapi/qapi-emit-events.h"
#include "qemu/coroutine-core.h"
#include "qemu/readline.h"
#include "exec/hwaddr.h"
diff --git a/monitor/monitor-internal.h b/monitor/monitor-internal.h
index 23829f32f9a..bc0932c425a 100644
--- a/monitor/monitor-internal.h
+++ b/monitor/monitor-internal.h
@@ -27,6 +27,7 @@
#include "chardev/char-fe.h"
#include "monitor/monitor.h"
+#include "qapi/qapi-emit-events.h"
#include "qapi/qapi-types-control.h"
#include "qapi/qapi-types-qom.h"
#include "qapi/qmp-registry.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 09/16] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header
2026-08-12 13:11 ` [PATCH v2 09/16] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson
On Wed, 12 Aug 2026 15:11:40 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> "monitor/monitor.h" don't use anything declared in the generated
> "qapi/qapi-emit-events.h" header.
> However the "monitor/monitor-internal.h" do:
>
> 107 struct MonitorClass {
> ...
> 116 /*
> 117 * If non-NULL, the monitor is able to send event
> 118 * notifications back to the client
> 119 */
> 120 void (*emit_event)(Monitor *mon, QAPIEvent event, QDict *qdict);
> ^^^^^^^^^
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (8 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 09/16] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:00 ` Marc-André Lureau
2026-08-12 13:11 ` [PATCH v2 11/16] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
` (5 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
Nothing here requires declarations from "block/block.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/monitor/monitor.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index fa9f4a8a75a..fd98ee2c71d 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -1,7 +1,6 @@
#ifndef MONITOR_H
#define MONITOR_H
-#include "block/block.h"
#include "qapi/qapi-types-misc.h"
#include "qemu/coroutine-core.h"
#include "qemu/readline.h"
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header
2026-08-12 13:11 ` [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
@ 2026-08-12 14:00 ` Marc-André Lureau
2026-08-12 16:05 ` Philippe Mathieu-Daudé
0 siblings, 1 reply; 34+ messages in thread
From: Marc-André Lureau @ 2026-08-12 14:00 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: qemu-devel, Markus Armbruster, David Gibson,
Dr. David Alan Gilbert, Richard Henderson
Hi
On Wed, Aug 12, 2026 at 5:38 PM Philippe Mathieu-Daudé
<philmd@oss.qualcomm.com> wrote:
>
> Nothing here requires declarations from "block/block.h".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
breaks for me:
[38/286] Compiling C object libsystem.a.p/net_vhost-vdpa.c.o
FAILED: [code=1] libsystem.a.p/net_vhost-vdpa.c.o
cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/libvduse
-I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
-I/usr/include/p11-kit-1 -I/usr/include/libpng16
-I/usr/include/pixman-1 -I/usr/include/spice-1 -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -I/usr/include/libmount
-I/usr/include/blkid -I/usr/include/sysprof-6
-I/usr/include/gio-unix-2.0 -I/usr/include/spice-server
-I/usr/include/opus -I/usr/include/cacard -I/usr/include/nss3
-I/usr/include/nspr4 -I/usr/include/PCSC -I/usr/include/gstreamer-1.0
-I/usr/include/libdrm -I/usr/include/orc-0.4 -I/usr/include/slirp
-I/usr/local/include -I/usr/include/libusb-1.0 -I/usr/include/SDL2
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0
-I/usr/include/cloudproviders -I/usr/include/cairo
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glycin-2
-I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0
-I/usr/include/atk-1.0 -I/usr/lib64/pkgconfig/../../include/dbus-1.0
-I/usr/lib64/pkgconfig/../../lib64/dbus-1.0/include
-I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/harfbuzz
-I/usr/include/freetype2 -I/usr/include/vte-2.91 -I/usr/include/rav1e
-I/usr/include/svt-av1 -I/usr/include/libvmaf -I/usr/include/webp
-I/usr/include/virgl -I/usr/include/fuse3 -I/usr/include/pipewire-0.3
-I/usr/include/spa-0.2 -fdiagnostics-color=auto -Wall -Winvalid-pch
-Werror -std=gnu11 -O2 -g -mcx16 -msse2 -fno-link-libatomic
-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
-fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
-fzero-init-padding-bits=all -fzero-call-used-regs=used-gpr
-fsanitize=address -fstack-protector-strong -fno-omit-frame-pointer
-Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2
-Wformat-security -Wformat-y2k -Wignored-qualifiers
-Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute
-Wmissing-prototypes -Wnested-externs -Wold-style-declaration
-Wold-style-definition -Wredundant-decls -Wshadow=local
-Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
-Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value
-isystem /home/elmarco/src/qemu.nmi/linux-headers -isystem
linux-headers -iquote . -iquote /home/elmarco/src/qemu.nmi -iquote
/home/elmarco/src/qemu.nmi/include -iquote
/home/elmarco/src/qemu.nmi/host/include/x86_64 -iquote
/home/elmarco/src/qemu.nmi/host/include/generic -iquote
/home/elmarco/src/qemu.nmi/tcg/x86_64 -pthread -fPIE
-fno-strict-aliasing -fno-strict-overflow -DHWY_SHARED_DEFINE
-DAVIF_DLL -DEB_DLL -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
-DNCURSES_WIDECHAR=1 -D_GNU_SOURCE=1 -D_REENTRANT
-DSTRUCT_IOVEC_DEFINED -DWITH_GZFILEOP -DCONFIG_SOFTMMU
-DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/net_vhost-vdpa.c.o
-MF libsystem.a.p/net_vhost-vdpa.c.o.d -o
libsystem.a.p/net_vhost-vdpa.c.o -c ../net/vhost-vdpa.c
../net/vhost-vdpa.c: In function ‘vhost_vdpa_net_load_cmd’:
../net/vhost-vdpa.c:714:24: error: implicit declaration of function
‘iov_size’ [-Wimplicit-function-declaration]
714 | size_t data_size = iov_size(data_sg, data_num), cmd_size;
| ^~~~~~~~
../net/vhost-vdpa.c:714:24: error: nested extern declaration of
‘iov_size’ [-Werror=nested-externs]
../net/vhost-vdpa.c:742:5: error: implicit declaration of function
‘iov_from_buf’ [-Wimplicit-function-declaration]
742 | iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl));
| ^~~~~~~~~~~~
../net/vhost-vdpa.c:742:5: error: nested extern declaration of
‘iov_from_buf’ [-Werror=nested-externs]
../net/vhost-vdpa.c:744:5: error: implicit declaration of function
‘iov_to_buf’ [-Wimplicit-function-declaration]
744 | iov_to_buf(data_sg, data_num, 0,
| ^~~~~~~~~~
../net/vhost-vdpa.c:744:5: error: nested extern declaration of
‘iov_to_buf’ [-Werror=nested-externs]
../net/vhost-vdpa.c:748:5: error: implicit declaration of function
‘iov_copy’; did you mean ‘error_copy’?
[-Wimplicit-function-declaration]
748 | iov_copy(&out, 1, out_cursor, 1, 0, cmd_size);
| ^~~~~~~~
| error_copy
../net/vhost-vdpa.c:748:5: error: nested extern declaration of
‘iov_copy’ [-Werror=nested-externs]
../net/vhost-vdpa.c:760:5: error: implicit declaration of function
‘iov_discard_front’ [-Wimplicit-function-declaration]
760 | iov_discard_front(&out_cursor, &dummy_cursor_iov_cnt, cmd_size);
| ^~~~~~~~~~~~~~~~~
../net/vhost-vdpa.c:760:5: error: nested extern declaration of
‘iov_discard_front’ [-Werror=nested-externs]
cc1: all warnings being treated as errors
[55/286] Compiling C object libsystem.a.p/system_physmem.c.o
ninja: build stopped: subcommand failed.
> ---
> include/monitor/monitor.h | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
> index fa9f4a8a75a..fd98ee2c71d 100644
> --- a/include/monitor/monitor.h
> +++ b/include/monitor/monitor.h
> @@ -1,7 +1,6 @@
> #ifndef MONITOR_H
> #define MONITOR_H
>
> -#include "block/block.h"
> #include "qapi/qapi-types-misc.h"
> #include "qemu/coroutine-core.h"
> #include "qemu/readline.h"
> --
> 2.53.0
>
>
^ permalink raw reply [flat|nested] 34+ messages in thread* Re: [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header
2026-08-12 14:00 ` Marc-André Lureau
@ 2026-08-12 16:05 ` Philippe Mathieu-Daudé
0 siblings, 0 replies; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 16:05 UTC (permalink / raw)
To: Marc-André Lureau
Cc: qemu-devel, Markus Armbruster, David Gibson,
Dr. David Alan Gilbert, Richard Henderson
On 2026-08-12 16:00, Marc-André Lureau wrote:
> Hi
>
> On Wed, Aug 12, 2026 at 5:38 PM Philippe Mathieu-Daudé
> <philmd@oss.qualcomm.com> wrote:
>>
>> Nothing here requires declarations from "block/block.h".
>>
>> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
>
> breaks for me:
> [38/286] Compiling C object libsystem.a.p/net_vhost-vdpa.c.o
> FAILED: [code=1] libsystem.a.p/net_vhost-vdpa.c.o
> cc -m64 -Ilibsystem.a.p -I. -I.. -Isubprojects/libvduse
> -I../subprojects/libvduse -Iui -Iqapi -Itrace -Iui/shader
> -I/usr/include/p11-kit-1 -I/usr/include/libpng16
> -I/usr/include/pixman-1 -I/usr/include/spice-1 -I/usr/include/glib-2.0
> -I/usr/lib64/glib-2.0/include -I/usr/include/libmount
> -I/usr/include/blkid -I/usr/include/sysprof-6
> -I/usr/include/gio-unix-2.0 -I/usr/include/spice-server
> -I/usr/include/opus -I/usr/include/cacard -I/usr/include/nss3
> -I/usr/include/nspr4 -I/usr/include/PCSC -I/usr/include/gstreamer-1.0
> -I/usr/include/libdrm -I/usr/include/orc-0.4 -I/usr/include/slirp
> -I/usr/local/include -I/usr/include/libusb-1.0 -I/usr/include/SDL2
> -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0
> -I/usr/include/cloudproviders -I/usr/include/cairo
> -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/glycin-2
> -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0
> -I/usr/include/atk-1.0 -I/usr/lib64/pkgconfig/../../include/dbus-1.0
> -I/usr/lib64/pkgconfig/../../lib64/dbus-1.0/include
> -I/usr/include/fribidi -I/usr/include/libxml2 -I/usr/include/harfbuzz
> -I/usr/include/freetype2 -I/usr/include/vte-2.91 -I/usr/include/rav1e
> -I/usr/include/svt-av1 -I/usr/include/libvmaf -I/usr/include/webp
> -I/usr/include/virgl -I/usr/include/fuse3 -I/usr/include/pipewire-0.3
> -I/usr/include/spa-0.2 -fdiagnostics-color=auto -Wall -Winvalid-pch
> -Werror -std=gnu11 -O2 -g -mcx16 -msse2 -fno-link-libatomic
> -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
> -fno-strict-aliasing -fno-common -fwrapv -ftrivial-auto-var-init=zero
> -fzero-init-padding-bits=all -fzero-call-used-regs=used-gpr
> -fsanitize=address -fstack-protector-strong -fno-omit-frame-pointer
> -Wempty-body -Wendif-labels -Wexpansion-to-defined -Wformat-overflow=2
> -Wformat-security -Wformat-y2k -Wignored-qualifiers
> -Wimplicit-fallthrough=2 -Winit-self -Wmissing-format-attribute
> -Wmissing-prototypes -Wnested-externs -Wold-style-declaration
> -Wold-style-definition -Wredundant-decls -Wshadow=local
> -Wstrict-prototypes -Wtype-limits -Wundef -Wvla -Wwrite-strings
> -Wno-missing-include-dirs -Wno-psabi -Wno-shift-negative-value
> -isystem /home/elmarco/src/qemu.nmi/linux-headers -isystem
> linux-headers -iquote . -iquote /home/elmarco/src/qemu.nmi -iquote
> /home/elmarco/src/qemu.nmi/include -iquote
> /home/elmarco/src/qemu.nmi/host/include/x86_64 -iquote
> /home/elmarco/src/qemu.nmi/host/include/generic -iquote
> /home/elmarco/src/qemu.nmi/tcg/x86_64 -pthread -fPIE
> -fno-strict-aliasing -fno-strict-overflow -DHWY_SHARED_DEFINE
> -DAVIF_DLL -DEB_DLL -D_DEFAULT_SOURCE -D_XOPEN_SOURCE=600
> -DNCURSES_WIDECHAR=1 -D_GNU_SOURCE=1 -D_REENTRANT
> -DSTRUCT_IOVEC_DEFINED -DWITH_GZFILEOP -DCONFIG_SOFTMMU
> -DCOMPILING_SYSTEM_VS_USER -MD -MQ libsystem.a.p/net_vhost-vdpa.c.o
> -MF libsystem.a.p/net_vhost-vdpa.c.o.d -o
> libsystem.a.p/net_vhost-vdpa.c.o -c ../net/vhost-vdpa.c
> ../net/vhost-vdpa.c: In function ‘vhost_vdpa_net_load_cmd’:
> ../net/vhost-vdpa.c:714:24: error: implicit declaration of function
> ‘iov_size’ [-Wimplicit-function-declaration]
> 714 | size_t data_size = iov_size(data_sg, data_num), cmd_size;
> | ^~~~~~~~
> ../net/vhost-vdpa.c:714:24: error: nested extern declaration of
> ‘iov_size’ [-Werror=nested-externs]
> ../net/vhost-vdpa.c:742:5: error: implicit declaration of function
> ‘iov_from_buf’ [-Wimplicit-function-declaration]
> 742 | iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl));
> | ^~~~~~~~~~~~
> ../net/vhost-vdpa.c:742:5: error: nested extern declaration of
> ‘iov_from_buf’ [-Werror=nested-externs]
> ../net/vhost-vdpa.c:744:5: error: implicit declaration of function
> ‘iov_to_buf’ [-Wimplicit-function-declaration]
> 744 | iov_to_buf(data_sg, data_num, 0,
> | ^~~~~~~~~~
> ../net/vhost-vdpa.c:744:5: error: nested extern declaration of
> ‘iov_to_buf’ [-Werror=nested-externs]
> ../net/vhost-vdpa.c:748:5: error: implicit declaration of function
> ‘iov_copy’; did you mean ‘error_copy’?
> [-Wimplicit-function-declaration]
> 748 | iov_copy(&out, 1, out_cursor, 1, 0, cmd_size);
> | ^~~~~~~~
> | error_copy
> ../net/vhost-vdpa.c:748:5: error: nested extern declaration of
> ‘iov_copy’ [-Werror=nested-externs]
> ../net/vhost-vdpa.c:760:5: error: implicit declaration of function
> ‘iov_discard_front’ [-Wimplicit-function-declaration]
> 760 | iov_discard_front(&out_cursor, &dummy_cursor_iov_cnt, cmd_size);
> | ^~~~~~~~~~~~~~~~~
> ../net/vhost-vdpa.c:760:5: error: nested extern declaration of
> ‘iov_discard_front’ [-Werror=nested-externs]
> cc1: all warnings being treated as errors
> [55/286] Compiling C object libsystem.a.p/system_physmem.c.o
> ninja: build stopped: subcommand failed.
TIL monitor_fd_param().
Anyway thanks, consider the following as "PATCH 9.5/16":
-- >8 --
Author: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
Date: Wed Aug 12 18:03:10 2026 +0200
net/vhost-vdpa: Include missing 'qemu/iov.h' header
vhost-vdpa.c uses methods declared in the "qemu/iov." header.
Include it otherwise we get when refactoring unrelated headers:
../net/vhost-vdpa.c: In function ‘vhost_vdpa_net_load_cmd’:
../net/vhost-vdpa.c:714:24: error: implicit declaration of
function ‘iov_size’
714 | size_t data_size = iov_size(data_sg, data_num), cmd_size;
| ^~~~~~~~
../net/vhost-vdpa.c:714:24: error: nested extern declaration of
‘iov_size’
../net/vhost-vdpa.c:742:5: error: implicit declaration of
function ‘iov_from_buf’
742 | iov_from_buf(out_cursor, 1, 0, &ctrl, sizeof(ctrl));
| ^~~~~~~~~~~~
../net/vhost-vdpa.c:742:5: error: nested extern declaration of
‘iov_from_buf’
../net/vhost-vdpa.c:744:5: error: implicit declaration of
function ‘iov_to_buf’
744 | iov_to_buf(data_sg, data_num, 0,
| ^~~~~~~~~~
../net/vhost-vdpa.c:744:5: error: nested extern declaration of
‘iov_to_buf’
../net/vhost-vdpa.c:748:5: error: implicit declaration of
function ‘iov_copy’
748 | iov_copy(&out, 1, out_cursor, 1, 0, cmd_size);
| ^~~~~~~~
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c
index c526c2b2dc..1052361a4a 100644
--- a/net/vhost-vdpa.c
+++ b/net/vhost-vdpa.c
@@ -17,6 +17,7 @@
#include "hw/virtio/vhost-vdpa.h"
#include "qemu/config-file.h"
#include "qemu/error-report.h"
+#include "qemu/iov.h"
#include "qemu/log.h"
#include "qemu/memalign.h"
#include "qemu/option.h"
---
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH v2 11/16] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (9 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 10/16] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 12/16] system: " Philippe Mathieu-Daudé
` (4 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé
Nothing here requires declarations from "monitor/monitor.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
include/monitor/hmp.h | 1 -
1 file changed, 1 deletion(-)
diff --git a/include/monitor/hmp.h b/include/monitor/hmp.h
index 9258a049bff..9be7fe28988 100644
--- a/include/monitor/hmp.h
+++ b/include/monitor/hmp.h
@@ -16,7 +16,6 @@
#include "qemu/readline.h"
#include "qapi/qapi-types-common.h"
-#include "monitor/monitor.h"
#define HMP_STUB(cmd) \
void hmp_##cmd(Monitor *mon, const QDict *qdict) \
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* [PATCH v2 12/16] system: Remove unnecessary 'monitor/monitor.h' header
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (10 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 11/16] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 13/16] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c Philippe Mathieu-Daudé
` (3 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Alistair Francis,
Paolo Bonzini, Peter Xu, Philippe Mathieu-Daudé
No code in device_tree.c or physmem.c require declarations
from "monitor/monitor.h".
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
system/device_tree.c | 1 -
system/physmem.c | 2 --
2 files changed, 3 deletions(-)
diff --git a/system/device_tree.c b/system/device_tree.c
index 1ea19629841..48365435ea0 100644
--- a/system/device_tree.c
+++ b/system/device_tree.c
@@ -29,7 +29,6 @@
#include "qemu/config-file.h"
#include "qapi/qapi-commands-machine.h"
#include "qobject/qdict.h"
-#include "monitor/hmp.h"
#include <libfdt.h>
diff --git a/system/physmem.c b/system/physmem.c
index c21ea929153..21614e1c4d0 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -84,8 +84,6 @@
#include "qemu/mmap-alloc.h"
#endif
-#include "monitor/monitor.h"
-
#ifdef CONFIG_LIBDAXCTL
#include <daxctl/libdaxctl.h>
#endif
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 12/16] system: Remove unnecessary 'monitor/monitor.h' header
2026-08-12 13:11 ` [PATCH v2 12/16] system: " Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson,
Alistair Francis, Paolo Bonzini, Peter Xu,
Philippe Mathieu-Daudé
On Wed, 12 Aug 2026 15:11:43 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> No code in device_tree.c or physmem.c require declarations
> from "monitor/monitor.h".
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 13/16] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (11 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 12/16] system: " Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 14/16] system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c Philippe Mathieu-Daudé
` (2 subsequent siblings)
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Hyman Huang
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
system/dirtylimit-hmp-cmds.c | 74 ++++++++++++++++++++++++++++++++++++
system/dirtylimit.c | 60 -----------------------------
system/meson.build | 1 +
3 files changed, 75 insertions(+), 60 deletions(-)
create mode 100644 system/dirtylimit-hmp-cmds.c
diff --git a/system/dirtylimit-hmp-cmds.c b/system/dirtylimit-hmp-cmds.c
new file mode 100644
index 00000000000..4928d57cc8e
--- /dev/null
+++ b/system/dirtylimit-hmp-cmds.c
@@ -0,0 +1,74 @@
+/*
+ * HMP commands related to migration dirty page rate limit
+ *
+ * Copyright (c) 2022 CHINA TELECOM CO.,LTD.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-migration.h"
+#include "qobject/qdict.h"
+#include "monitor/hmp.h"
+#include "monitor/monitor.h"
+#include "system/dirtylimit.h"
+
+void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
+{
+ int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
+ Error *err = NULL;
+
+ qmp_cancel_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, &err);
+ if (err) {
+ hmp_handle_error(mon, err);
+ return;
+ }
+
+ monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query "
+ "dirty limit for virtual CPU]\n");
+}
+
+void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
+{
+ int64_t dirty_rate = qdict_get_int(qdict, "dirty_rate");
+ int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
+ Error *err = NULL;
+
+ if (dirty_rate < 0) {
+ error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate);
+ goto out;
+ }
+
+ qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
+
+out:
+ hmp_handle_error(mon, err);
+}
+
+void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
+{
+ DirtyLimitInfoList *info;
+ g_autoptr(DirtyLimitInfoList) head = NULL;
+ Error *err = NULL;
+
+ if (!dirtylimit_in_service()) {
+ monitor_printf(mon, "Dirty page limit not enabled!\n");
+ return;
+ }
+
+ head = qmp_query_vcpu_dirty_limit(&err);
+ if (err) {
+ hmp_handle_error(mon, err);
+ return;
+ }
+
+ for (info = head; info != NULL; info = info->next) {
+ monitor_printf(mon, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (MB/s),"
+ " current rate %"PRIi64 " (MB/s)\n",
+ info->value->cpu_index,
+ info->value->limit_rate,
+ info->value->current_rate);
+ }
+}
diff --git a/system/dirtylimit.c b/system/dirtylimit.c
index 50fa67f3d6a..70bb7bac2d0 100644
--- a/system/dirtylimit.c
+++ b/system/dirtylimit.c
@@ -17,8 +17,6 @@
#include "qapi/error.h"
#include "system/dirtyrate.h"
#include "system/dirtylimit.h"
-#include "monitor/hmp.h"
-#include "monitor/monitor.h"
#include "system/memory.h"
#include "exec/target_page.h"
#include "hw/core/boards.h"
@@ -491,21 +489,6 @@ void qmp_cancel_vcpu_dirty_limit(bool has_cpu_index,
dirtylimit_state_unlock();
}
-void hmp_cancel_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
-{
- int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
- Error *err = NULL;
-
- qmp_cancel_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, &err);
- if (err) {
- hmp_handle_error(mon, err);
- return;
- }
-
- monitor_printf(mon, "[Please use 'info vcpu_dirty_limit' to query "
- "dirty limit for virtual CPU]\n");
-}
-
void qmp_set_vcpu_dirty_limit(bool has_cpu_index,
int64_t cpu_index,
uint64_t dirty_rate,
@@ -548,23 +531,6 @@ void qmp_set_vcpu_dirty_limit(bool has_cpu_index,
dirtylimit_state_unlock();
}
-void hmp_set_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
-{
- int64_t dirty_rate = qdict_get_int(qdict, "dirty_rate");
- int64_t cpu_index = qdict_get_try_int(qdict, "cpu_index", -1);
- Error *err = NULL;
-
- if (dirty_rate < 0) {
- error_setg(&err, "invalid dirty page limit %" PRId64, dirty_rate);
- goto out;
- }
-
- qmp_set_vcpu_dirty_limit(!!(cpu_index != -1), cpu_index, dirty_rate, &err);
-
-out:
- hmp_handle_error(mon, err);
-}
-
/* Return the max throttle time of each virtual CPU */
uint64_t dirtylimit_throttle_time_per_round(void)
{
@@ -646,29 +612,3 @@ struct DirtyLimitInfoList *qmp_query_vcpu_dirty_limit(Error **errp)
{
return dirtylimit_query_all();
}
-
-void hmp_info_vcpu_dirty_limit(Monitor *mon, const QDict *qdict)
-{
- DirtyLimitInfoList *info;
- g_autoptr(DirtyLimitInfoList) head = NULL;
- Error *err = NULL;
-
- if (!dirtylimit_in_service()) {
- monitor_printf(mon, "Dirty page limit not enabled!\n");
- return;
- }
-
- head = qmp_query_vcpu_dirty_limit(&err);
- if (err) {
- hmp_handle_error(mon, err);
- return;
- }
-
- for (info = head; info != NULL; info = info->next) {
- monitor_printf(mon, "vcpu[%"PRIi64"], limit rate %"PRIi64 " (MB/s),"
- " current rate %"PRIi64 " (MB/s)\n",
- info->value->cpu_index,
- info->value->limit_rate,
- info->value->current_rate);
- }
-}
diff --git a/system/meson.build b/system/meson.build
index cd3193d170b..377adce8035 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -9,6 +9,7 @@ system_ss.add(files(
'cpus.c',
'cpu-timers.c',
'dirtylimit.c',
+ 'dirtylimit-hmp-cmds.c',
'dma-helpers.c',
'exit-with-parent.c',
'globals.c',
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* [PATCH v2 14/16] system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (12 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 13/16] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 15/16] system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c Philippe Mathieu-Daudé
2026-08-12 13:11 ` [PATCH v2 16/16] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé,
Philippe Mathieu-Daudé, Zhao Liu, Paolo Bonzini
We figured NMI relates to machines (for their machine-specific
handling), so move the 'inject-nmi' QMP handler with the rest
of machine ones, in hw/core/machine-qmp-cmds.c.
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
hw/core/machine-qmp-cmds.c | 6 ++++++
system/cpus.c | 8 --------
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/hw/core/machine-qmp-cmds.c b/hw/core/machine-qmp-cmds.c
index e62cb4ec888..1aa5f262298 100644
--- a/hw/core/machine-qmp-cmds.c
+++ b/hw/core/machine-qmp-cmds.c
@@ -10,6 +10,7 @@
#include "qemu/osdep.h"
#include "hw/acpi/vmgenid.h"
#include "hw/core/boards.h"
+#include "hw/core/nmi.h"
#include "hw/intc/intc.h"
#include "hw/mem/memory-device.h"
#include "qapi/error.h"
@@ -448,3 +449,8 @@ void qmp_dump_skeys(const char *filename, Error **errp)
}
DUMP_SKEYS_INTERFACE_CLASS(oc)->qmp_dump_skeys(filename, errp);
}
+
+void qmp_inject_nmi(Error **errp)
+{
+ nmi_inject(errp);
+}
diff --git a/system/cpus.c b/system/cpus.c
index 9758cda4636..aa2510bf8fc 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -26,7 +26,6 @@
#include "qemu/coroutine-tls.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 "exec/gdbstub.h"
@@ -38,7 +37,6 @@
#include "qemu/plugin.h"
#include "system/cpus.h"
#include "qemu/guest-random.h"
-#include "hw/core/nmi.h"
#include "system/physmem.h"
#include "system/replay.h"
#include "system/runstate.h"
@@ -922,9 +920,3 @@ void qmp_pmemsave(uint64_t addr, uint64_t size, const char *filename,
exit:
fclose(f);
}
-
-void qmp_inject_nmi(Error **errp)
-{
- nmi_inject(errp);
-}
-
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 14/16] system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c
2026-08-12 13:11 ` [PATCH v2 14/16] system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson,
Philippe Mathieu-Daudé, Zhao Liu, Paolo Bonzini
On Wed, 12 Aug 2026 15:11:45 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> We figured NMI relates to machines (for their machine-specific
> handling), so move the 'inject-nmi' QMP handler with the rest
> of machine ones, in hw/core/machine-qmp-cmds.c.
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 15/16] system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (13 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 14/16] system: Move qmp_inject_nmi() to hw/core/machine-qmp-cmds.c Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
2026-08-12 13:11 ` [PATCH v2 16/16] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Paolo Bonzini,
Philippe Mathieu-Daudé
Keep cpus.c related to vCPU scheduling, move the QMP handlers
related to dumping physical memory to file to their own unit.
Fix a pair of checkpatch.pl errors doing so:
ERROR: braces {} are necessary for all arms of this statement
#185: FILE: system/physmem-qmp-cmds.c:51:
+ if (l > size)
[...]
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
system/cpus.c | 92 --------------------------------
system/physmem-qmp-cmds.c | 107 ++++++++++++++++++++++++++++++++++++++
system/meson.build | 1 +
3 files changed, 108 insertions(+), 92 deletions(-)
create mode 100644 system/physmem-qmp-cmds.c
diff --git a/system/cpus.c b/system/cpus.c
index aa2510bf8fc..43ff10cf008 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -25,9 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/coroutine-tls.h"
#include "qapi/error.h"
-#include "qapi/qapi-commands-machine.h"
#include "qapi/qapi-events-run-state.h"
-#include "qapi/qmp/qerror.h"
#include "exec/gdbstub.h"
#include "accel/accel-cpu-ops.h"
#include "system/hw_accel.h"
@@ -40,7 +38,6 @@
#include "system/physmem.h"
#include "system/replay.h"
#include "system/runstate.h"
-#include "migration/misc.h"
#include "system/cpu-timers.h"
#include "system/whpx.h"
#include "hw/core/boards.h"
@@ -831,92 +828,3 @@ int vm_stop_force_state(RunState state)
return ret;
}
}
-
-void qmp_memsave(uint64_t addr, uint64_t size, const char *filename,
- bool has_cpu, int64_t cpu_index, Error **errp)
-{
- FILE *f;
- uint64_t l;
- CPUState *cpu;
- uint8_t buf[1024];
- uint64_t orig_addr = addr, orig_size = size;
-
- if (migration_guest_ram_loading()) {
- error_setg(errp, "Guest memory access not allowed during migration");
- return;
- }
-
- if (!has_cpu) {
- cpu_index = 0;
- }
-
- cpu = qemu_get_cpu(cpu_index);
- if (cpu == NULL) {
- error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
- "a CPU number");
- return;
- }
-
- f = fopen(filename, "wb");
- if (!f) {
- error_setg_file_open(errp, errno, filename);
- return;
- }
-
- while (size != 0) {
- l = sizeof(buf);
- if (l > size)
- l = size;
- if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
- error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRIu64
- " specified", orig_addr, orig_size);
- goto exit;
- }
- if (fwrite(buf, 1, l, f) != l) {
- error_setg(errp, "writing memory to '%s' failed",
- filename);
- goto exit;
- }
- addr += l;
- size -= l;
- }
-
-exit:
- fclose(f);
-}
-
-void qmp_pmemsave(uint64_t addr, uint64_t size, const char *filename,
- Error **errp)
-{
- FILE *f;
- uint64_t l;
- uint8_t buf[1024];
-
- if (migration_guest_ram_loading()) {
- error_setg(errp, "Guest memory access not allowed during migration");
- return;
- }
-
- f = fopen(filename, "wb");
- if (!f) {
- error_setg_file_open(errp, errno, filename);
- return;
- }
-
- while (size != 0) {
- l = sizeof(buf);
- if (l > size)
- l = size;
- physical_memory_read(addr, buf, l);
- if (fwrite(buf, 1, l, f) != l) {
- error_setg(errp, "writing memory to '%s' failed",
- filename);
- goto exit;
- }
- addr += l;
- size -= l;
- }
-
-exit:
- fclose(f);
-}
diff --git a/system/physmem-qmp-cmds.c b/system/physmem-qmp-cmds.c
new file mode 100644
index 00000000000..d85430357d5
--- /dev/null
+++ b/system/physmem-qmp-cmds.c
@@ -0,0 +1,107 @@
+/*
+ * QMP commands to dump physical memory
+ *
+ * Copyright (c) 2003-2008 Fabrice Bellard
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qapi/qapi-commands-machine.h"
+#include "qapi/qmp/qerror.h"
+#include "hw/core/cpu.h"
+#include "system/physmem.h"
+#include "migration/misc.h"
+
+void qmp_memsave(uint64_t addr, uint64_t size, const char *filename,
+ bool has_cpu, int64_t cpu_index, Error **errp)
+{
+ FILE *f;
+ uint64_t l;
+ CPUState *cpu;
+ uint8_t buf[1024];
+ uint64_t orig_addr = addr, orig_size = size;
+
+ if (migration_guest_ram_loading()) {
+ error_setg(errp, "Guest memory access not allowed during migration");
+ return;
+ }
+
+ if (!has_cpu) {
+ cpu_index = 0;
+ }
+
+ cpu = qemu_get_cpu(cpu_index);
+ if (cpu == NULL) {
+ error_setg(errp, QERR_INVALID_PARAMETER_VALUE, "cpu-index",
+ "a CPU number");
+ return;
+ }
+
+ f = fopen(filename, "wb");
+ if (!f) {
+ error_setg_file_open(errp, errno, filename);
+ return;
+ }
+
+ while (size != 0) {
+ l = sizeof(buf);
+ if (l > size) {
+ l = size;
+ }
+ if (cpu_memory_rw_debug(cpu, addr, buf, l, 0) != 0) {
+ error_setg(errp, "Invalid addr 0x%016" PRIx64 "/size %" PRIu64
+ " specified", orig_addr, orig_size);
+ goto exit;
+ }
+ if (fwrite(buf, 1, l, f) != l) {
+ error_setg(errp, "writing memory to '%s' failed",
+ filename);
+ goto exit;
+ }
+ addr += l;
+ size -= l;
+ }
+
+exit:
+ fclose(f);
+}
+
+void qmp_pmemsave(uint64_t addr, uint64_t size, const char *filename,
+ Error **errp)
+{
+ FILE *f;
+ uint64_t l;
+ uint8_t buf[1024];
+
+ if (migration_guest_ram_loading()) {
+ error_setg(errp, "Guest memory access not allowed during migration");
+ return;
+ }
+
+ f = fopen(filename, "wb");
+ if (!f) {
+ error_setg_file_open(errp, errno, filename);
+ return;
+ }
+
+ while (size != 0) {
+ l = sizeof(buf);
+ if (l > size) {
+ l = size;
+ }
+ physical_memory_read(addr, buf, l);
+ if (fwrite(buf, 1, l, f) != l) {
+ error_setg(errp, "writing memory to '%s' failed",
+ filename);
+ goto exit;
+ }
+ addr += l;
+ size -= l;
+ }
+
+exit:
+ fclose(f);
+}
diff --git a/system/meson.build b/system/meson.build
index 377adce8035..64e06e7abcc 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -19,6 +19,7 @@ system_ss.add(files(
'memory_mapping.c',
'memory.c',
'physmem.c',
+ 'physmem-qmp-cmds.c',
'qdev-monitor.c',
'qtest.c',
'rtc.c',
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 15/16] system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c
2026-08-12 13:11 ` [PATCH v2 15/16] system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson,
Paolo Bonzini, Philippe Mathieu-Daudé
On Wed, 12 Aug 2026 15:11:46 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> Keep cpus.c related to vCPU scheduling, move the QMP handlers
> related to dumping physical memory to file to their own unit.
> Fix a pair of checkpatch.pl errors doing so:
>
> ERROR: braces {} are necessary for all arms of this statement
> #185: FILE: system/physmem-qmp-cmds.c:51:
> + if (l > size)
> [...]
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH v2 16/16] system: Move runstate-related code from cpus.c to runstate.c
2026-08-12 13:11 [PATCH v2 00/16] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
` (14 preceding siblings ...)
2026-08-12 13:11 ` [PATCH v2 15/16] system: Extract QMP memsave/pmemsave commands to physmem-qmp-cmds.c Philippe Mathieu-Daudé
@ 2026-08-12 13:11 ` Philippe Mathieu-Daudé
2026-08-12 14:05 ` marcandre.lureau
15 siblings, 1 reply; 34+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:11 UTC (permalink / raw)
To: Marc-André Lureau, qemu-devel
Cc: Markus Armbruster, David Gibson, Dr. David Alan Gilbert,
Richard Henderson, Philippe Mathieu-Daudé, Paolo Bonzini,
Philippe Mathieu-Daudé
Keep cpus.c focused on vCPUs handling, move code related to
VM state to runstate.c where similar code lives.
Fix few checkpatch.pl warnings:
WARNING: Block comments use a leading /* on a separate line
WARNING: Block comments use * on subsequent lines
#327: FILE: system/runstate.c:541:
+/* does a state transition even if the VM is already stopped,
+ current state is forgotten forever */
Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
system/cpus.c | 147 -------------------------------------------
system/runstate.c | 154 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 154 insertions(+), 147 deletions(-)
diff --git a/system/cpus.c b/system/cpus.c
index 43ff10cf008..f37e215c586 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -25,7 +25,6 @@
#include "qemu/osdep.h"
#include "qemu/coroutine-tls.h"
#include "qapi/error.h"
-#include "qapi/qapi-events-run-state.h"
#include "exec/gdbstub.h"
#include "accel/accel-cpu-ops.h"
#include "system/hw_accel.h"
@@ -272,58 +271,6 @@ void cpu_interrupt(CPUState *cpu, int mask)
cpus_accel->handle_interrupt(cpu, mask);
}
-/*
- * True if the vm was previously suspended, and has not been woken or reset.
- */
-static int vm_was_suspended;
-
-void vm_set_suspended(bool suspended)
-{
- vm_was_suspended = suspended;
-}
-
-bool vm_get_suspended(void)
-{
- return vm_was_suspended;
-}
-
-static int do_vm_stop(RunState state, bool send_stop)
-{
- int ret = 0;
- RunState oldstate = runstate_get();
-
- if (runstate_is_live(oldstate)) {
- vm_was_suspended = (oldstate == RUN_STATE_SUSPENDED);
- runstate_set(state);
- cpu_disable_ticks();
- if (oldstate == RUN_STATE_RUNNING) {
- pause_all_vcpus();
- }
- ret = vm_state_notify(0, state);
- if (send_stop) {
- qapi_event_send_stop();
- }
- }
-
- bdrv_drain_all();
- /*
- * Even if vm_state_notify() return failure,
- * it would be better to flush as before.
- */
- ret |= bdrv_flush_all();
- trace_vm_stop_flush_all(ret);
-
- return ret;
-}
-
-/* Special vm_stop() variant for terminating the process. Historically clients
- * did not expect a QMP STOP event and so we need to retain compatibility.
- */
-int vm_shutdown(void)
-{
- return do_vm_stop(RUN_STATE_SHUTDOWN, false);
-}
-
bool cpu_can_run(CPUState *cpu)
{
if (cpu->stop) {
@@ -734,97 +681,3 @@ void cpu_stop_current(void)
cpu_exit(current_cpu);
}
}
-
-int vm_stop(RunState state)
-{
- if (qemu_in_vcpu_thread()) {
- qemu_system_vmstop_request_prepare();
- qemu_system_vmstop_request(state);
- /*
- * FIXME: should not return to device code in case
- * vm_stop() has been requested.
- */
- cpu_stop_current();
- return 0;
- }
-
- return do_vm_stop(state, true);
-}
-
-/**
- * Prepare for (re)starting the VM.
- * Returns 0 if the vCPUs should be restarted, -1 on an error condition,
- * and 1 otherwise.
- */
-int vm_prepare_start(bool step_pending)
-{
- int ret = vm_was_suspended ? 1 : 0;
- RunState state = vm_was_suspended ? RUN_STATE_SUSPENDED : RUN_STATE_RUNNING;
- RunState requested;
-
- qemu_vmstop_requested(&requested);
- if (runstate_is_running() && requested == RUN_STATE__MAX) {
- return -1;
- }
-
- /* Ensure that a STOP/RESUME pair of events is emitted if a
- * vmstop request was pending. The BLOCK_IO_ERROR event, for
- * example, according to documentation is always followed by
- * the STOP event.
- */
- if (runstate_is_running()) {
- qapi_event_send_stop();
- qapi_event_send_resume();
- return -1;
- }
-
- /*
- * WHPX accelerator needs to know whether we are going to step
- * any CPUs, before starting the first one.
- */
- accel_pre_resume(MACHINE(qdev_get_machine()), step_pending);
-
- /* We are sending this now, but the CPUs will be resumed shortly later */
- qapi_event_send_resume();
-
- cpu_enable_ticks();
- runstate_set(state);
- vm_state_notify(1, state);
- vm_was_suspended = false;
- return ret;
-}
-
-void vm_start(void)
-{
- if (!vm_prepare_start(false)) {
- resume_all_vcpus();
- }
-}
-
-void vm_resume(RunState state)
-{
- if (runstate_is_live(state)) {
- vm_start();
- } else {
- runstate_set(state);
- }
-}
-
-/* does a state transition even if the VM is already stopped,
- current state is forgotten forever */
-int vm_stop_force_state(RunState state)
-{
- if (runstate_is_live(runstate_get())) {
- return vm_stop(state);
- } else {
- int ret;
- runstate_set(state);
-
- bdrv_drain_all();
- /* Make sure to return an error if the flush in a previous vm_stop()
- * failed. */
- ret = bdrv_flush_all();
- trace_vm_stop_flush_all(ret);
- return ret;
- }
-}
diff --git a/system/runstate.c b/system/runstate.c
index 08acf801b0e..d3e64d2b625 100644
--- a/system/runstate.c
+++ b/system/runstate.c
@@ -52,6 +52,7 @@
#include "qemu/thread.h"
#include "qom/object.h"
#include "qom/object_interfaces.h"
+#include "system/cpu-timers.h"
#include "system/cpus.h"
#include "system/qtest.h"
#include "system/replay.h"
@@ -408,6 +409,159 @@ int vm_state_notify(bool running, RunState state)
return ret;
}
+/*
+ * True if the vm was previously suspended, and has not been woken or reset.
+ */
+static int vm_was_suspended;
+
+void vm_set_suspended(bool suspended)
+{
+ vm_was_suspended = suspended;
+}
+
+bool vm_get_suspended(void)
+{
+ return vm_was_suspended;
+}
+
+static int do_vm_stop(RunState state, bool send_stop)
+{
+ int ret = 0;
+ RunState oldstate = runstate_get();
+
+ if (runstate_is_live(oldstate)) {
+ vm_was_suspended = (oldstate == RUN_STATE_SUSPENDED);
+ runstate_set(state);
+ cpu_disable_ticks();
+ if (oldstate == RUN_STATE_RUNNING) {
+ pause_all_vcpus();
+ }
+ ret = vm_state_notify(0, state);
+ if (send_stop) {
+ qapi_event_send_stop();
+ }
+ }
+
+ bdrv_drain_all();
+ /*
+ * Even if vm_state_notify() return failure,
+ * it would be better to flush as before.
+ */
+ ret |= bdrv_flush_all();
+ trace_vm_stop_flush_all(ret);
+
+ return ret;
+}
+
+/*
+ * Special vm_stop() variant for terminating the process. Historically clients
+ * did not expect a QMP STOP event and so we need to retain compatibility.
+ */
+int vm_shutdown(void)
+{
+ return do_vm_stop(RUN_STATE_SHUTDOWN, false);
+}
+
+
+int vm_stop(RunState state)
+{
+ if (qemu_in_vcpu_thread()) {
+ qemu_system_vmstop_request_prepare();
+ qemu_system_vmstop_request(state);
+ /*
+ * FIXME: should not return to device code in case
+ * vm_stop() has been requested.
+ */
+ cpu_stop_current();
+ return 0;
+ }
+
+ return do_vm_stop(state, true);
+}
+
+/**
+ * Prepare for (re)starting the VM.
+ * Returns 0 if the vCPUs should be restarted, -1 on an error condition,
+ * and 1 otherwise.
+ */
+int vm_prepare_start(bool step_pending)
+{
+ int ret = vm_was_suspended ? 1 : 0;
+ RunState state = vm_was_suspended ? RUN_STATE_SUSPENDED : RUN_STATE_RUNNING;
+ RunState requested;
+
+ qemu_vmstop_requested(&requested);
+ if (runstate_is_running() && requested == RUN_STATE__MAX) {
+ return -1;
+ }
+
+ /*
+ * Ensure that a STOP/RESUME pair of events is emitted if a
+ * vmstop request was pending. The BLOCK_IO_ERROR event, for
+ * example, according to documentation is always followed by
+ * the STOP event.
+ */
+ if (runstate_is_running()) {
+ qapi_event_send_stop();
+ qapi_event_send_resume();
+ return -1;
+ }
+
+ /*
+ * WHPX accelerator needs to know whether we are going to step
+ * any CPUs, before starting the first one.
+ */
+ accel_pre_resume(MACHINE(qdev_get_machine()), step_pending);
+
+ /* We are sending this now, but the CPUs will be resumed shortly later */
+ qapi_event_send_resume();
+
+ cpu_enable_ticks();
+ runstate_set(state);
+ vm_state_notify(1, state);
+ vm_was_suspended = false;
+ return ret;
+}
+
+void vm_start(void)
+{
+ if (!vm_prepare_start(false)) {
+ resume_all_vcpus();
+ }
+}
+
+void vm_resume(RunState state)
+{
+ if (runstate_is_live(state)) {
+ vm_start();
+ } else {
+ runstate_set(state);
+ }
+}
+
+/*
+ * does a state transition even if the VM is already stopped,
+ * current state is forgotten forever
+ */
+int vm_stop_force_state(RunState state)
+{
+ if (runstate_is_live(runstate_get())) {
+ return vm_stop(state);
+ } else {
+ int ret;
+ runstate_set(state);
+
+ bdrv_drain_all();
+ /*
+ * Make sure to return an error if the flush in a previous vm_stop()
+ * failed.
+ */
+ ret = bdrv_flush_all();
+ trace_vm_stop_flush_all(ret);
+ return ret;
+ }
+}
+
static ShutdownCause reset_requested;
static ShutdownCause shutdown_requested;
static int shutdown_exit_code = EXIT_SUCCESS;
--
2.53.0
^ permalink raw reply related [flat|nested] 34+ messages in thread* Re: [PATCH v2 16/16] system: Move runstate-related code from cpus.c to runstate.c
2026-08-12 13:11 ` [PATCH v2 16/16] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
@ 2026-08-12 14:05 ` marcandre.lureau
0 siblings, 0 replies; 34+ messages in thread
From: marcandre.lureau @ 2026-08-12 14:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé
Cc: Marc-André Lureau, qemu-devel, Markus Armbruster,
David Gibson, Dr. David Alan Gilbert, Richard Henderson,
Paolo Bonzini, Philippe Mathieu-Daudé
On Wed, 12 Aug 2026 15:11:47 +0200, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> Keep cpus.c focused on vCPUs handling, move code related to
> VM state to runstate.c where similar code lives.
>
> Fix few checkpatch.pl warnings:
>
> WARNING: Block comments use a leading /* on a separate line
> WARNING: Block comments use * on subsequent lines
> #327: FILE: system/runstate.c:541:
> +/* does a state transition even if the VM is already stopped,
> + current state is forgotten forever */
>
> [...]
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
--
Marc-André Lureau <marcandre.lureau@redhat.com>
^ permalink raw reply [flat|nested] 34+ messages in thread