All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h'
@ 2026-08-12 12:23 Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 01/14] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	Richard Henderson, Philippe Mathieu-Daudé

Another HMP cleanup series to help [1] Marc-André with his
'Make HMP optional' series [2].

We could also remove "exec/hwaddr.h" by moving gpa2hva()
declaration elsewhere, and "qapi/qapi-types-misc.h" by
moving monitor_fdset_add_fd() out to some "monitor/fdset.h"
header.

[1] I expect his work to trivially rebase ;)
[2] 20260626-qemu-no-hmp-v2-0-8af31bc54c61@redhat.com
Based-on: <20260812121232.71958-1-philmd@oss.qualcomm.com>

Philippe Mathieu-Daudé (14):
  hexagon: Remove unnecessary 'monitor/monitor.h' header
  tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c
  qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h'
  qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header
  migration/hmp-cmds: Include 'block/block-global-state.h' header
  monitor: Include missing 'qemu/aio-wait.h' header
  monitor: Include missing 'qemu/lockable.h' header
  monitor: Include missing 'qemu/coroutine-core.h' header
  monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header
  monitor: Remove unnecessary 'block/block.h' header
  monitor/hmp: Remove unnecessary 'monitor/monitor.h' header
  system: Remove unnecessary 'monitor/monitor.h' header
  system: Move runstate-related code from cpus.c to runstate.c
  system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c

 include/hw/hexagon/hexagon_tlb.h |   2 +-
 include/monitor/hmp.h            |   1 -
 include/monitor/monitor.h        |   3 +-
 include/qapi/qmp-registry.h      |   1 -
 monitor/monitor-internal.h       |   1 +
 target/hexagon/hex_mmu.h         |   3 +-
 migration/migration-hmp-cmds.c   |   1 +
 monitor/fds.c                    |   1 +
 monitor/monitor.c                |   2 +
 monitor/qmp.c                    |   3 +-
 qapi/qmp-dispatch.c              |   2 +
 system/cpus.c                    | 146 ------------------------------
 system/device_tree.c             |   1 -
 system/dirtylimit-hmp-cmds.c     |  74 ++++++++++++++++
 system/dirtylimit.c              |  60 -------------
 system/physmem.c                 |   2 -
 system/runstate.c                | 148 +++++++++++++++++++++++++++++++
 tests/unit/test-util-sockets.c   |   1 +
 system/meson.build               |   1 +
 19 files changed, 237 insertions(+), 216 deletions(-)
 create mode 100644 system/dirtylimit-hmp-cmds.c

-- 
2.53.0



^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/14] hexagon: Remove unnecessary 'monitor/monitor.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 02/14] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 02/14] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 01/14] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 03/14] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 03/14] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h'
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 01/14] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 02/14] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 04/14] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 04/14] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 03/14] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 05/14] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 05/14] migration/hmp-cmds: Include 'block/block-global-state.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (3 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 04/14] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 06/14] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 06/14] monitor: Include missing 'qemu/aio-wait.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (4 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 05/14] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 07/14] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 07/14] monitor: Include missing 'qemu/lockable.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (5 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 06/14] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 08/14] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 08/14] monitor: Include missing 'qemu/coroutine-core.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (6 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 07/14] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 09/14] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 09/14] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (7 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 08/14] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 10/14] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 10/14] monitor: Remove unnecessary 'block/block.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (8 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 09/14] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 11/14] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 11/14] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (9 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 10/14] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 12/14] system: " Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* [PATCH 12/14] system: Remove unnecessary 'monitor/monitor.h' header
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (10 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 11/14] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 13/14] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 14/14] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c Philippe Mathieu-Daudé
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	Richard Henderson, Philippe Mathieu-Daudé, Alistair Francis,
	David Gibson, 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] 16+ messages in thread

* [PATCH 13/14] system: Move runstate-related code from cpus.c to runstate.c
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (11 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 12/14] system: " Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  2026-08-12 13:09   ` Philippe Mathieu-Daudé
  2026-08-12 12:23 ` [PATCH 14/14] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c Philippe Mathieu-Daudé
  13 siblings, 1 reply; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	Richard Henderson, Philippe Mathieu-Daudé, Paolo Bonzini,
	Philippe Mathieu-Daudé

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
 system/cpus.c     | 146 ---------------------------------------------
 system/runstate.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 148 insertions(+), 146 deletions(-)

diff --git a/system/cpus.c b/system/cpus.c
index 9758cda4636..f9f1b297d1c 100644
--- a/system/cpus.c
+++ b/system/cpus.c
@@ -277,58 +277,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) {
@@ -740,100 +688,6 @@ void cpu_stop_current(void)
     }
 }
 
-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;
-    }
-}
-
 void qmp_memsave(uint64_t addr, uint64_t size, const char *filename,
                  bool has_cpu, int64_t cpu_index, Error **errp)
 {
diff --git a/system/runstate.c b/system/runstate.c
index 08acf801b0e..79bf21d93e2 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,153 @@ 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] 16+ messages in thread

* [PATCH 14/14] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c
  2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
                   ` (12 preceding siblings ...)
  2026-08-12 12:23 ` [PATCH 13/14] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
@ 2026-08-12 12:23 ` Philippe Mathieu-Daudé
  13 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 12:23 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	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] 16+ messages in thread

* Re: [PATCH 13/14] system: Move runstate-related code from cpus.c to runstate.c
  2026-08-12 12:23 ` [PATCH 13/14] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
@ 2026-08-12 13:09   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2026-08-12 13:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: Dr. David Alan Gilbert, Markus Armbruster, Marc-André Lureau,
	Richard Henderson, Paolo Bonzini, Philippe Mathieu-Daudé

On 12/8/26 14:23, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
>   system/cpus.c     | 146 ---------------------------------------------
>   system/runstate.c | 148 ++++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 148 insertions(+), 146 deletions(-)

Wrong branch :/ This change will makes sense in v2.


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2026-08-12 13:11 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 12:23 [PATCH 00/14] monitor: Reduce headers included in 'monitor/monitor.h' Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 01/14] hexagon: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 02/14] tests/unit: Include 'qemu/main-loop.h' header in test-util-sockets.c Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 03/14] qapi/qmp-dispatch: Include 'qemu/aio-wait.h' and 'monitor/monitor.h' Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 04/14] qapi/qmp-registry: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 05/14] migration/hmp-cmds: Include 'block/block-global-state.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 06/14] monitor: Include missing 'qemu/aio-wait.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 07/14] monitor: Include missing 'qemu/lockable.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 08/14] monitor: Include missing 'qemu/coroutine-core.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 09/14] monitor: Reduce inclusion of 'qapi/qapi-emit-events.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 10/14] monitor: Remove unnecessary 'block/block.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 11/14] monitor/hmp: Remove unnecessary 'monitor/monitor.h' header Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 12/14] system: " Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 13/14] system: Move runstate-related code from cpus.c to runstate.c Philippe Mathieu-Daudé
2026-08-12 13:09   ` Philippe Mathieu-Daudé
2026-08-12 12:23 ` [PATCH 14/14] system/dirtylimit: Extract HMP code to dirtylimit-hmp-cmds.c Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.