kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
@ 2021-01-11 15:20 Philippe Mathieu-Daudé
  2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-11 15:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Huacai Chen, Greg Kurz, Michael S. Tsirkin, qemu-trivial,
	Amit Shah, Dmitry Fleytman, qemu-arm, John Snow, qemu-s390x,
	Paul Durrant, Anthony Perard, Eduardo Habkost,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Stefan Hajnoczi,
	Jiaxun Yang

Trivial prototype change to clarify the use of the 'running'\r
argument of VMChangeStateHandler.\r
\r
Green CI:\r
https://gitlab.com/philmd/qemu/-/pipelines/239497352\r
\r
Philippe Mathieu-Daudé (2):\r
  sysemu/runstate: Let runstate_is_running() return bool\r
  sysemu: Let VMChangeStateHandler take boolean 'running' argument\r
\r
 include/sysemu/runstate.h   | 12 +++++++++---\r
 target/arm/kvm_arm.h        |  2 +-\r
 target/ppc/cpu-qom.h        |  2 +-\r
 accel/xen/xen-all.c         |  2 +-\r
 audio/audio.c               |  2 +-\r
 block/block-backend.c       |  2 +-\r
 gdbstub.c                   |  2 +-\r
 hw/block/pflash_cfi01.c     |  2 +-\r
 hw/block/virtio-blk.c       |  2 +-\r
 hw/display/qxl.c            |  2 +-\r
 hw/i386/kvm/clock.c         |  2 +-\r
 hw/i386/kvm/i8254.c         |  2 +-\r
 hw/i386/kvmvapic.c          |  2 +-\r
 hw/i386/xen/xen-hvm.c       |  2 +-\r
 hw/ide/core.c               |  2 +-\r
 hw/intc/arm_gicv3_its_kvm.c |  2 +-\r
 hw/intc/arm_gicv3_kvm.c     |  2 +-\r
 hw/intc/spapr_xive_kvm.c    |  2 +-\r
 hw/misc/mac_via.c           |  2 +-\r
 hw/net/e1000e_core.c        |  2 +-\r
 hw/nvram/spapr_nvram.c      |  2 +-\r
 hw/ppc/ppc.c                |  2 +-\r
 hw/ppc/ppc_booke.c          |  2 +-\r
 hw/s390x/tod-kvm.c          |  2 +-\r
 hw/scsi/scsi-bus.c          |  2 +-\r
 hw/usb/hcd-ehci.c           |  2 +-\r
 hw/usb/host-libusb.c        |  2 +-\r
 hw/usb/redirect.c           |  2 +-\r
 hw/vfio/migration.c         |  2 +-\r
 hw/virtio/virtio-rng.c      |  2 +-\r
 hw/virtio/virtio.c          |  2 +-\r
 net/net.c                   |  2 +-\r
 softmmu/memory.c            |  2 +-\r
 softmmu/runstate.c          |  4 ++--\r
 target/arm/kvm.c            |  2 +-\r
 target/i386/kvm/kvm.c       |  2 +-\r
 target/i386/sev.c           |  2 +-\r
 target/i386/whpx/whpx-all.c |  2 +-\r
 target/mips/kvm.c           |  4 ++--\r
 ui/gtk.c                    |  2 +-\r
 ui/spice-core.c             |  2 +-\r
 41 files changed, 51 insertions(+), 45 deletions(-)\r
\r
-- \r
2.26.2\r
\r


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

* [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool
  2021-01-11 15:20 [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
@ 2021-01-11 15:20 ` Philippe Mathieu-Daudé
  2021-01-11 16:08   ` David Hildenbrand
                     ` (2 more replies)
  2021-01-11 15:20 ` [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-11 15:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Huacai Chen, Greg Kurz, Michael S. Tsirkin, qemu-trivial,
	Amit Shah, Dmitry Fleytman, qemu-arm, John Snow, qemu-s390x,
	Paul Durrant, Anthony Perard, Eduardo Habkost,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Stefan Hajnoczi,
	Jiaxun Yang

runstate_check() returns a boolean. runstate_is_running()
returns what runstate_check() returns, also a boolean.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/sysemu/runstate.h | 2 +-
 softmmu/runstate.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index e557f470d42..3ab35a039a0 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -6,7 +6,7 @@
 
 bool runstate_check(RunState state);
 void runstate_set(RunState new_state);
-int runstate_is_running(void);
+bool runstate_is_running(void);
 bool runstate_needs_reset(void);
 bool runstate_store(char *str, size_t size);
 
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index 636aab0addb..c7a67147d17 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -217,7 +217,7 @@ void runstate_set(RunState new_state)
     current_run_state = new_state;
 }
 
-int runstate_is_running(void)
+bool runstate_is_running(void)
 {
     return runstate_check(RUN_STATE_RUNNING);
 }
-- 
2.26.2


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

* [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-01-11 15:20 [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
  2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
@ 2021-01-11 15:20 ` Philippe Mathieu-Daudé
  2021-01-11 17:48   ` Alex Bennée
                     ` (2 more replies)
  2021-01-12 10:30 ` [PATCH 0/2] " Stefan Hajnoczi
  2021-02-22 14:34 ` Philippe Mathieu-Daudé
  3 siblings, 3 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-01-11 15:20 UTC (permalink / raw)
  To: qemu-devel
  Cc: Huacai Chen, Greg Kurz, Michael S. Tsirkin, qemu-trivial,
	Amit Shah, Dmitry Fleytman, qemu-arm, John Snow, qemu-s390x,
	Paul Durrant, Anthony Perard, Eduardo Habkost,
	Philippe Mathieu-Daudé,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Stefan Hajnoczi,
	Jiaxun Yang

The 'running' argument from VMChangeStateHandler does not require
other value than 0 / 1. Make it a plain boolean.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 include/sysemu/runstate.h   | 10 ++++++++--
 target/arm/kvm_arm.h        |  2 +-
 target/ppc/cpu-qom.h        |  2 +-
 accel/xen/xen-all.c         |  2 +-
 audio/audio.c               |  2 +-
 block/block-backend.c       |  2 +-
 gdbstub.c                   |  2 +-
 hw/block/pflash_cfi01.c     |  2 +-
 hw/block/virtio-blk.c       |  2 +-
 hw/display/qxl.c            |  2 +-
 hw/i386/kvm/clock.c         |  2 +-
 hw/i386/kvm/i8254.c         |  2 +-
 hw/i386/kvmvapic.c          |  2 +-
 hw/i386/xen/xen-hvm.c       |  2 +-
 hw/ide/core.c               |  2 +-
 hw/intc/arm_gicv3_its_kvm.c |  2 +-
 hw/intc/arm_gicv3_kvm.c     |  2 +-
 hw/intc/spapr_xive_kvm.c    |  2 +-
 hw/misc/mac_via.c           |  2 +-
 hw/net/e1000e_core.c        |  2 +-
 hw/nvram/spapr_nvram.c      |  2 +-
 hw/ppc/ppc.c                |  2 +-
 hw/ppc/ppc_booke.c          |  2 +-
 hw/s390x/tod-kvm.c          |  2 +-
 hw/scsi/scsi-bus.c          |  2 +-
 hw/usb/hcd-ehci.c           |  2 +-
 hw/usb/host-libusb.c        |  2 +-
 hw/usb/redirect.c           |  2 +-
 hw/vfio/migration.c         |  2 +-
 hw/virtio/virtio-rng.c      |  2 +-
 hw/virtio/virtio.c          |  2 +-
 net/net.c                   |  2 +-
 softmmu/memory.c            |  2 +-
 softmmu/runstate.c          |  2 +-
 target/arm/kvm.c            |  2 +-
 target/i386/kvm/kvm.c       |  2 +-
 target/i386/sev.c           |  2 +-
 target/i386/whpx/whpx-all.c |  2 +-
 target/mips/kvm.c           |  4 ++--
 ui/gtk.c                    |  2 +-
 ui/spice-core.c             |  2 +-
 41 files changed, 49 insertions(+), 43 deletions(-)

diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
index 3ab35a039a0..a5356915734 100644
--- a/include/sysemu/runstate.h
+++ b/include/sysemu/runstate.h
@@ -10,7 +10,7 @@ bool runstate_is_running(void);
 bool runstate_needs_reset(void);
 bool runstate_store(char *str, size_t size);
 
-typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
+typedef void VMChangeStateHandler(void *opaque, bool running, RunState state);
 
 VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
                                                      void *opaque);
@@ -20,7 +20,13 @@ VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
                                                      VMChangeStateHandler *cb,
                                                      void *opaque);
 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
-void vm_state_notify(int running, RunState state);
+/**
+ * vm_state_notify: Notify the state of the VM
+ *
+ * @running: whether the VM is running or not.
+ * @state: the #RunState of the VM.
+ */
+void vm_state_notify(bool running, RunState state);
 
 static inline bool shutdown_caused_by_guest(ShutdownCause cause)
 {
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index eb81b7059eb..68ec970c4f4 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs);
  */
 void kvm_arm_put_virtual_time(CPUState *cs);
 
-void kvm_arm_vm_state_change(void *opaque, int running, RunState state);
+void kvm_arm_vm_state_change(void *opaque, bool running, RunState state);
 
 int kvm_arm_vgic_probe(void);
 
diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
index 63b9e8632ca..118baf8d41f 100644
--- a/target/ppc/cpu-qom.h
+++ b/target/ppc/cpu-qom.h
@@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase;
     .offset     = vmstate_offset_value(_state, _field, PPCTimebase),  \
 }
 
-void cpu_ppc_clock_vm_state_change(void *opaque, int running,
+void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
                                    RunState state);
 #endif
 
diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
index 878a4089d97..3756aca27be 100644
--- a/accel/xen/xen-all.c
+++ b/accel/xen/xen-all.c
@@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
 }
 
 
-static void xen_change_state_handler(void *opaque, int running,
+static void xen_change_state_handler(void *opaque, bool running,
                                      RunState state)
 {
     if (running) {
diff --git a/audio/audio.c b/audio/audio.c
index b48471bb3f6..f2d56e7e57d 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -1549,7 +1549,7 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv,
     }
 }
 
-static void audio_vm_change_state_handler (void *opaque, int running,
+static void audio_vm_change_state_handler (void *opaque, bool running,
                                            RunState state)
 {
     AudioState *s = opaque;
diff --git a/block/block-backend.c b/block/block-backend.c
index ce78d30794a..9175eb237a2 100644
--- a/block/block-backend.c
+++ b/block/block-backend.c
@@ -163,7 +163,7 @@ static const char *blk_root_get_name(BdrvChild *child)
     return blk_name(child->opaque);
 }
 
-static void blk_vm_state_changed(void *opaque, int running, RunState state)
+static void blk_vm_state_changed(void *opaque, bool running, RunState state)
 {
     Error *local_err = NULL;
     BlockBackend *blk = opaque;
diff --git a/gdbstub.c b/gdbstub.c
index d99bc0bf2ea..9f2998f8d03 100644
--- a/gdbstub.c
+++ b/gdbstub.c
@@ -2691,7 +2691,7 @@ void gdb_set_stop_cpu(CPUState *cpu)
 }
 
 #ifndef CONFIG_USER_ONLY
-static void gdb_vm_state_change(void *opaque, int running, RunState state)
+static void gdb_vm_state_change(void *opaque, bool running, RunState state)
 {
     CPUState *cpu = gdbserver_state.c_cpu;
     g_autoptr(GString) buf = g_string_new(NULL);
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index ccf326793db..badcbccf012 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -1014,7 +1014,7 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo)
     loc_pop(&loc);
 }
 
-static void postload_update_cb(void *opaque, int running, RunState state)
+static void postload_update_cb(void *opaque, bool running, RunState state)
 {
     PFlashCFI01 *pfl = opaque;
 
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index bac2d6fa2b2..5207ef617f0 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -870,7 +870,7 @@ static void virtio_blk_dma_restart_bh(void *opaque)
     virtio_blk_process_queued_requests(s, true);
 }
 
-static void virtio_blk_dma_restart_cb(void *opaque, int running,
+static void virtio_blk_dma_restart_cb(void *opaque, bool running,
                                       RunState state)
 {
     VirtIOBlock *s = opaque;
diff --git a/hw/display/qxl.c b/hw/display/qxl.c
index 431c1070967..d22e84ba13e 100644
--- a/hw/display/qxl.c
+++ b/hw/display/qxl.c
@@ -1992,7 +1992,7 @@ static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
     }
 }
 
-static void qxl_vm_change_state_handler(void *opaque, int running,
+static void qxl_vm_change_state_handler(void *opaque, bool running,
                                         RunState state)
 {
     PCIQXLDevice *qxl = opaque;
diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
index 2d8a3663693..51872dd84c0 100644
--- a/hw/i386/kvm/clock.c
+++ b/hw/i386/kvm/clock.c
@@ -162,7 +162,7 @@ static void do_kvmclock_ctrl(CPUState *cpu, run_on_cpu_data data)
     }
 }
 
-static void kvmclock_vm_state_change(void *opaque, int running,
+static void kvmclock_vm_state_change(void *opaque, bool running,
                                      RunState state)
 {
     KVMClockState *s = opaque;
diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
index c73254e8866..c558893961b 100644
--- a/hw/i386/kvm/i8254.c
+++ b/hw/i386/kvm/i8254.c
@@ -239,7 +239,7 @@ static void kvm_pit_irq_control(void *opaque, int n, int enable)
     kvm_pit_put(pit);
 }
 
-static void kvm_pit_vm_state_change(void *opaque, int running,
+static void kvm_pit_vm_state_change(void *opaque, bool running,
                                     RunState state)
 {
     KVMPITState *s = opaque;
diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
index 2c1898032e4..46315445d22 100644
--- a/hw/i386/kvmvapic.c
+++ b/hw/i386/kvmvapic.c
@@ -748,7 +748,7 @@ static void do_vapic_enable(CPUState *cs, run_on_cpu_data data)
     s->state = VAPIC_ACTIVE;
 }
 
-static void kvmvapic_vm_state_change(void *opaque, int running,
+static void kvmvapic_vm_state_change(void *opaque, bool running,
                                      RunState state)
 {
     MachineState *ms = MACHINE(qdev_get_machine());
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 68821d90f52..7ce672e5a5c 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -1235,7 +1235,7 @@ static void xen_main_loop_prepare(XenIOState *state)
 }
 
 
-static void xen_hvm_change_state_handler(void *opaque, int running,
+static void xen_hvm_change_state_handler(void *opaque, bool running,
                                          RunState rstate)
 {
     XenIOState *state = opaque;
diff --git a/hw/ide/core.c b/hw/ide/core.c
index b49e4cfbc6c..b5c6e967b2e 100644
--- a/hw/ide/core.c
+++ b/hw/ide/core.c
@@ -2677,7 +2677,7 @@ static void ide_restart_bh(void *opaque)
     }
 }
 
-static void ide_restart_cb(void *opaque, int running, RunState state)
+static void ide_restart_cb(void *opaque, bool running, RunState state)
 {
     IDEBus *bus = opaque;
 
diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
index 057cb53f13c..b554d2ede0a 100644
--- a/hw/intc/arm_gicv3_its_kvm.c
+++ b/hw/intc/arm_gicv3_its_kvm.c
@@ -71,7 +71,7 @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid)
  *
  * The tables get flushed to guest RAM whenever the VM gets stopped.
  */
-static void vm_change_state_handler(void *opaque, int running,
+static void vm_change_state_handler(void *opaque, bool running,
                                     RunState state)
 {
     GICv3ITSState *s = (GICv3ITSState *)opaque;
diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
index d040a5d1e99..65a4c880a35 100644
--- a/hw/intc/arm_gicv3_kvm.c
+++ b/hw/intc/arm_gicv3_kvm.c
@@ -743,7 +743,7 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = {
  *
  * The tables get flushed to guest RAM whenever the VM gets stopped.
  */
-static void vm_change_state_handler(void *opaque, int running,
+static void vm_change_state_handler(void *opaque, bool running,
                                     RunState state)
 {
     GICv3State *s = (GICv3State *)opaque;
diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
index acc8c3650c4..c0083311607 100644
--- a/hw/intc/spapr_xive_kvm.c
+++ b/hw/intc/spapr_xive_kvm.c
@@ -504,7 +504,7 @@ static int kvmppc_xive_get_queues(SpaprXive *xive, Error **errp)
  * runs again. If an interrupt was queued while the VM was stopped,
  * simply generate a trigger.
  */
-static void kvmppc_xive_change_state_handler(void *opaque, int running,
+static void kvmppc_xive_change_state_handler(void *opaque, bool running,
                                              RunState state)
 {
     SpaprXive *xive = opaque;
diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
index 488d086a17c..ca2f939dd58 100644
--- a/hw/misc/mac_via.c
+++ b/hw/misc/mac_via.c
@@ -1098,7 +1098,7 @@ static void mac_via_init(Object *obj)
                         TYPE_ADB_BUS, DEVICE(obj), "adb.0");
 }
 
-static void postload_update_cb(void *opaque, int running, RunState state)
+static void postload_update_cb(void *opaque, bool running, RunState state)
 {
     MacVIAState *m = MAC_VIA(opaque);
 
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
index 4dcb92d966b..b75f2ab8fc1 100644
--- a/hw/net/e1000e_core.c
+++ b/hw/net/e1000e_core.c
@@ -3298,7 +3298,7 @@ e1000e_autoneg_resume(E1000ECore *core)
 }
 
 static void
-e1000e_vm_state_change(void *opaque, int running, RunState state)
+e1000e_vm_state_change(void *opaque, bool running, RunState state)
 {
     E1000ECore *core = opaque;
 
diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
index 9e51bc82ae4..01f77520146 100644
--- a/hw/nvram/spapr_nvram.c
+++ b/hw/nvram/spapr_nvram.c
@@ -217,7 +217,7 @@ static int spapr_nvram_pre_load(void *opaque)
     return 0;
 }
 
-static void postload_update_cb(void *opaque, int running, RunState state)
+static void postload_update_cb(void *opaque, bool running, RunState state)
 {
     SpaprNvram *nvram = opaque;
 
diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
index 5cbbff1f8d0..bf28d6bfc8d 100644
--- a/hw/ppc/ppc.c
+++ b/hw/ppc/ppc.c
@@ -1059,7 +1059,7 @@ static void timebase_load(PPCTimebase *tb)
     }
 }
 
-void cpu_ppc_clock_vm_state_change(void *opaque, int running,
+void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
                                    RunState state)
 {
     PPCTimebase *tb = opaque;
diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
index 652a21b8064..974c0c8a752 100644
--- a/hw/ppc/ppc_booke.c
+++ b/hw/ppc/ppc_booke.c
@@ -317,7 +317,7 @@ static void ppc_booke_timer_reset_handle(void *opaque)
  * action will be taken. To avoid this we always clear the watchdog state when
  * state changes to running.
  */
-static void cpu_state_change_handler(void *opaque, int running, RunState state)
+static void cpu_state_change_handler(void *opaque, bool running, RunState state)
 {
     PowerPCCPU *cpu = opaque;
     CPUPPCState *env = &cpu->env;
diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
index 6e21d83181d..0b944774861 100644
--- a/hw/s390x/tod-kvm.c
+++ b/hw/s390x/tod-kvm.c
@@ -78,7 +78,7 @@ static void kvm_s390_tod_set(S390TODState *td, const S390TOD *tod, Error **errp)
     }
 }
 
-static void kvm_s390_tod_vm_state_change(void *opaque, int running,
+static void kvm_s390_tod_vm_state_change(void *opaque, bool running,
                                          RunState state)
 {
     S390TODState *td = opaque;
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index c349fb7f2d1..f990d5b3b03 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -181,7 +181,7 @@ void scsi_req_retry(SCSIRequest *req)
     req->retry = true;
 }
 
-static void scsi_dma_restart_cb(void *opaque, int running, RunState state)
+static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
 {
     SCSIDevice *s = opaque;
 
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
index aca018d8b5f..98d08c325ea 100644
--- a/hw/usb/hcd-ehci.c
+++ b/hw/usb/hcd-ehci.c
@@ -2436,7 +2436,7 @@ static int usb_ehci_post_load(void *opaque, int version_id)
     return 0;
 }
 
-static void usb_ehci_vm_state_change(void *opaque, int running, RunState state)
+static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state)
 {
     EHCIState *ehci = opaque;
 
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index b950501d100..ecbf3f66f42 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -1755,7 +1755,7 @@ type_init(usb_host_register_types)
 static QEMUTimer *usb_auto_timer;
 static VMChangeStateEntry *usb_vmstate;
 
-static void usb_host_vm_state(void *unused, int running, RunState state)
+static void usb_host_vm_state(void *unused, bool running, RunState state)
 {
     if (running) {
         usb_host_auto_check(unused);
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index 7e9e3fecbfe..17f06f34179 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1395,7 +1395,7 @@ static void usbredir_chardev_event(void *opaque, QEMUChrEvent event)
  * init + destroy
  */
 
-static void usbredir_vm_state_change(void *priv, int running, RunState state)
+static void usbredir_vm_state_change(void *priv, bool running, RunState state)
 {
     USBRedirDevice *dev = priv;
 
diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
index 00daa50ed81..134bdccc4f8 100644
--- a/hw/vfio/migration.c
+++ b/hw/vfio/migration.c
@@ -727,7 +727,7 @@ static SaveVMHandlers savevm_vfio_handlers = {
 
 /* ---------------------------------------------------------------------- */
 
-static void vfio_vmstate_change(void *opaque, int running, RunState state)
+static void vfio_vmstate_change(void *opaque, bool running, RunState state)
 {
     VFIODevice *vbasedev = opaque;
     VFIOMigration *migration = vbasedev->migration;
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
index 76ce9376931..cc8e9f775d8 100644
--- a/hw/virtio/virtio-rng.c
+++ b/hw/virtio/virtio-rng.c
@@ -133,7 +133,7 @@ static uint64_t get_features(VirtIODevice *vdev, uint64_t f, Error **errp)
     return f;
 }
 
-static void virtio_rng_vm_state_change(void *opaque, int running,
+static void virtio_rng_vm_state_change(void *opaque, bool running,
                                        RunState state)
 {
     VirtIORNG *vrng = opaque;
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index b308026596f..38dc623c89e 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -3208,7 +3208,7 @@ void virtio_cleanup(VirtIODevice *vdev)
     qemu_del_vm_change_state_handler(vdev->vmstate);
 }
 
-static void virtio_vmstate_change(void *opaque, int running, RunState state)
+static void virtio_vmstate_change(void *opaque, bool running, RunState state)
 {
     VirtIODevice *vdev = opaque;
     BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
diff --git a/net/net.c b/net/net.c
index e1035f21d18..8a85d1e3f7b 100644
--- a/net/net.c
+++ b/net/net.c
@@ -1341,7 +1341,7 @@ void qmp_set_link(const char *name, bool up, Error **errp)
     }
 }
 
-static void net_vm_change_state_handler(void *opaque, int running,
+static void net_vm_change_state_handler(void *opaque, bool running,
                                         RunState state)
 {
     NetClientState *nc;
diff --git a/softmmu/memory.c b/softmmu/memory.c
index 333e1ed7b05..ab7f2e5aa07 100644
--- a/softmmu/memory.c
+++ b/softmmu/memory.c
@@ -2675,7 +2675,7 @@ static void memory_global_dirty_log_do_stop(void)
     MEMORY_LISTENER_CALL_GLOBAL(log_global_stop, Reverse);
 }
 
-static void memory_vm_change_state_handler(void *opaque, int running,
+static void memory_vm_change_state_handler(void *opaque, bool running,
                                            RunState state)
 {
     if (running) {
diff --git a/softmmu/runstate.c b/softmmu/runstate.c
index c7a67147d17..cb07a65925c 100644
--- a/softmmu/runstate.c
+++ b/softmmu/runstate.c
@@ -316,7 +316,7 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
     g_free(e);
 }
 
-void vm_state_notify(int running, RunState state)
+void vm_state_notify(bool running, RunState state)
 {
     VMChangeStateEntry *e, *next;
 
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index ffe186de8d1..53d6c4a17eb 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -844,7 +844,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
     return MEMTXATTRS_UNSPECIFIED;
 }
 
-void kvm_arm_vm_state_change(void *opaque, int running, RunState state)
+void kvm_arm_vm_state_change(void *opaque, bool running, RunState state)
 {
     CPUState *cs = opaque;
     ARMCPU *cpu = ARM_CPU(cs);
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index 6dc1ee052d5..170ad55c09c 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -690,7 +690,7 @@ static int kvm_inject_mce_oldstyle(X86CPU *cpu)
     return 0;
 }
 
-static void cpu_update_state(void *opaque, int running, RunState state)
+static void cpu_update_state(void *opaque, bool running, RunState state)
 {
     CPUX86State *env = opaque;
 
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 15466068118..e7890f61906 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -670,7 +670,7 @@ sev_launch_finish(SevGuestState *sev)
 }
 
 static void
-sev_vm_state_change(void *opaque, int running, RunState state)
+sev_vm_state_change(void *opaque, bool running, RunState state)
 {
     SevGuestState *sev = opaque;
 
diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
index 3b824fc9d7c..850dfe72e75 100644
--- a/target/i386/whpx/whpx-all.c
+++ b/target/i386/whpx/whpx-all.c
@@ -1318,7 +1318,7 @@ void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu)
 
 static Error *whpx_migration_blocker;
 
-static void whpx_cpu_update_state(void *opaque, int running, RunState state)
+static void whpx_cpu_update_state(void *opaque, bool running, RunState state)
 {
     CPUX86State *env = opaque;
 
diff --git a/target/mips/kvm.c b/target/mips/kvm.c
index 477692566a4..09945ad2455 100644
--- a/target/mips/kvm.c
+++ b/target/mips/kvm.c
@@ -37,7 +37,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
     KVM_CAP_LAST_INFO
 };
 
-static void kvm_mips_update_state(void *opaque, int running, RunState state);
+static void kvm_mips_update_state(void *opaque, bool running, RunState state);
 
 unsigned long kvm_arch_vcpu_id(CPUState *cs)
 {
@@ -552,7 +552,7 @@ static int kvm_mips_restore_count(CPUState *cs)
 /*
  * Handle the VM clock being started or stopped
  */
-static void kvm_mips_update_state(void *opaque, int running, RunState state)
+static void kvm_mips_update_state(void *opaque, bool running, RunState state)
 {
     CPUState *cs = opaque;
     int ret;
diff --git a/ui/gtk.c b/ui/gtk.c
index a752aa22be0..a5bf8ed8429 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -672,7 +672,7 @@ static const DisplayChangeListenerOps dcl_egl_ops = {
 
 /** QEMU Events **/
 
-static void gd_change_runstate(void *opaque, int running, RunState state)
+static void gd_change_runstate(void *opaque, bool running, RunState state)
 {
     GtkDisplayState *s = opaque;
 
diff --git a/ui/spice-core.c b/ui/spice-core.c
index 5746d0aae7c..22c77c04151 100644
--- a/ui/spice-core.c
+++ b/ui/spice-core.c
@@ -622,7 +622,7 @@ static int add_channel(void *opaque, const char *name, const char *value,
     return 0;
 }
 
-static void vm_change_state_handler(void *opaque, int running,
+static void vm_change_state_handler(void *opaque, bool running,
                                     RunState state)
 {
     if (running) {
-- 
2.26.2


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

* Re: [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool
  2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
@ 2021-01-11 16:08   ` David Hildenbrand
  2021-01-11 17:46   ` Alex Bennée
  2021-03-09 22:13   ` Laurent Vivier
  2 siblings, 0 replies; 12+ messages in thread
From: David Hildenbrand @ 2021-01-11 16:08 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Huacai Chen, Greg Kurz, Michael S. Tsirkin, qemu-trivial,
	Amit Shah, Dmitry Fleytman, qemu-arm, John Snow, qemu-s390x,
	Paul Durrant, Anthony Perard, Eduardo Habkost, Gerd Hoffmann,
	Kevin Wolf, Marcelo Tosatti, Max Reitz, Alex Williamson,
	Aurelien Jarno, Aleksandar Rikalo, Marcel Apfelbaum, Jason Wang,
	Peter Maydell, Cédric Le Goater, Halil Pasic, Fam Zheng,
	qemu-ppc, Paolo Bonzini, kvm, Stefano Stabellini, xen-devel,
	Cornelia Huck, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Stefan Hajnoczi,
	Jiaxun Yang

On 11.01.21 16:20, Philippe Mathieu-Daudé wrote:
> runstate_check() returns a boolean. runstate_is_running()
> returns what runstate_check() returns, also a boolean.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/sysemu/runstate.h | 2 +-
>  softmmu/runstate.c        | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
> index e557f470d42..3ab35a039a0 100644
> --- a/include/sysemu/runstate.h
> +++ b/include/sysemu/runstate.h
> @@ -6,7 +6,7 @@
>  
>  bool runstate_check(RunState state);
>  void runstate_set(RunState new_state);
> -int runstate_is_running(void);
> +bool runstate_is_running(void);
>  bool runstate_needs_reset(void);
>  bool runstate_store(char *str, size_t size);
>  
> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> index 636aab0addb..c7a67147d17 100644
> --- a/softmmu/runstate.c
> +++ b/softmmu/runstate.c
> @@ -217,7 +217,7 @@ void runstate_set(RunState new_state)
>      current_run_state = new_state;
>  }
>  
> -int runstate_is_running(void)
> +bool runstate_is_running(void)
>  {
>      return runstate_check(RUN_STATE_RUNNING);
>  }
> 

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Thanks,

David / dhildenb


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

* Re: [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool
  2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
  2021-01-11 16:08   ` David Hildenbrand
@ 2021-01-11 17:46   ` Alex Bennée
  2021-03-09 22:13   ` Laurent Vivier
  2 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2021-01-11 17:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Huacai Chen, Greg Kurz, Michael S. Tsirkin,
	qemu-trivial, Amit Shah, Dmitry Fleytman, qemu-arm, John Snow,
	qemu-s390x, Paul Durrant, Anthony Perard, Eduardo Habkost,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Laurent Vivier, Thomas Huth, Stefan Hajnoczi, Jiaxun Yang


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> runstate_check() returns a boolean. runstate_is_running()
> returns what runstate_check() returns, also a boolean.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée

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

* Re: [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-01-11 15:20 ` [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
@ 2021-01-11 17:48   ` Alex Bennée
  2021-01-12  0:17   ` David Gibson
  2021-03-09 22:14   ` Laurent Vivier
  2 siblings, 0 replies; 12+ messages in thread
From: Alex Bennée @ 2021-01-11 17:48 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Huacai Chen, Greg Kurz, Michael S. Tsirkin,
	qemu-trivial, Amit Shah, Dmitry Fleytman, qemu-arm, John Snow,
	qemu-s390x, Paul Durrant, Anthony Perard, Eduardo Habkost,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Laurent Vivier, Thomas Huth, Stefan Hajnoczi, Jiaxun Yang


Philippe Mathieu-Daudé <philmd@redhat.com> writes:

> The 'running' argument from VMChangeStateHandler does not require
> other value than 0 / 1. Make it a plain boolean.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Seems reasonable

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>

-- 
Alex Bennée

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

* Re: [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-01-11 15:20 ` [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
  2021-01-11 17:48   ` Alex Bennée
@ 2021-01-12  0:17   ` David Gibson
  2021-03-09 22:14   ` Laurent Vivier
  2 siblings, 0 replies; 12+ messages in thread
From: David Gibson @ 2021-01-12  0:17 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Huacai Chen, Greg Kurz, Michael S. Tsirkin,
	qemu-trivial, Amit Shah, Dmitry Fleytman, qemu-arm, John Snow,
	qemu-s390x, Paul Durrant, Anthony Perard, Eduardo Habkost,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, Richard Henderson, Alex Bennée,
	Laurent Vivier, Thomas Huth, Stefan Hajnoczi, Jiaxun Yang

[-- Attachment #1: Type: text/plain, Size: 24133 bytes --]

On Mon, Jan 11, 2021 at 04:20:20PM +0100, Philippe Mathieu-Daudé wrote:
> The 'running' argument from VMChangeStateHandler does not require
> other value than 0 / 1. Make it a plain boolean.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>

ppc parts
Acked-by: David Gibson <david@gibson.dropbear.id.au>

> ---
>  include/sysemu/runstate.h   | 10 ++++++++--
>  target/arm/kvm_arm.h        |  2 +-
>  target/ppc/cpu-qom.h        |  2 +-
>  accel/xen/xen-all.c         |  2 +-
>  audio/audio.c               |  2 +-
>  block/block-backend.c       |  2 +-
>  gdbstub.c                   |  2 +-
>  hw/block/pflash_cfi01.c     |  2 +-
>  hw/block/virtio-blk.c       |  2 +-
>  hw/display/qxl.c            |  2 +-
>  hw/i386/kvm/clock.c         |  2 +-
>  hw/i386/kvm/i8254.c         |  2 +-
>  hw/i386/kvmvapic.c          |  2 +-
>  hw/i386/xen/xen-hvm.c       |  2 +-
>  hw/ide/core.c               |  2 +-
>  hw/intc/arm_gicv3_its_kvm.c |  2 +-
>  hw/intc/arm_gicv3_kvm.c     |  2 +-
>  hw/intc/spapr_xive_kvm.c    |  2 +-
>  hw/misc/mac_via.c           |  2 +-
>  hw/net/e1000e_core.c        |  2 +-
>  hw/nvram/spapr_nvram.c      |  2 +-
>  hw/ppc/ppc.c                |  2 +-
>  hw/ppc/ppc_booke.c          |  2 +-
>  hw/s390x/tod-kvm.c          |  2 +-
>  hw/scsi/scsi-bus.c          |  2 +-
>  hw/usb/hcd-ehci.c           |  2 +-
>  hw/usb/host-libusb.c        |  2 +-
>  hw/usb/redirect.c           |  2 +-
>  hw/vfio/migration.c         |  2 +-
>  hw/virtio/virtio-rng.c      |  2 +-
>  hw/virtio/virtio.c          |  2 +-
>  net/net.c                   |  2 +-
>  softmmu/memory.c            |  2 +-
>  softmmu/runstate.c          |  2 +-
>  target/arm/kvm.c            |  2 +-
>  target/i386/kvm/kvm.c       |  2 +-
>  target/i386/sev.c           |  2 +-
>  target/i386/whpx/whpx-all.c |  2 +-
>  target/mips/kvm.c           |  4 ++--
>  ui/gtk.c                    |  2 +-
>  ui/spice-core.c             |  2 +-
>  41 files changed, 49 insertions(+), 43 deletions(-)
> 
> diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
> index 3ab35a039a0..a5356915734 100644
> --- a/include/sysemu/runstate.h
> +++ b/include/sysemu/runstate.h
> @@ -10,7 +10,7 @@ bool runstate_is_running(void);
>  bool runstate_needs_reset(void);
>  bool runstate_store(char *str, size_t size);
>  
> -typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
> +typedef void VMChangeStateHandler(void *opaque, bool running, RunState state);
>  
>  VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
>                                                       void *opaque);
> @@ -20,7 +20,13 @@ VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
>                                                       VMChangeStateHandler *cb,
>                                                       void *opaque);
>  void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
> -void vm_state_notify(int running, RunState state);
> +/**
> + * vm_state_notify: Notify the state of the VM
> + *
> + * @running: whether the VM is running or not.
> + * @state: the #RunState of the VM.
> + */
> +void vm_state_notify(bool running, RunState state);
>  
>  static inline bool shutdown_caused_by_guest(ShutdownCause cause)
>  {
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index eb81b7059eb..68ec970c4f4 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs);
>   */
>  void kvm_arm_put_virtual_time(CPUState *cs);
>  
> -void kvm_arm_vm_state_change(void *opaque, int running, RunState state);
> +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state);
>  
>  int kvm_arm_vgic_probe(void);
>  
> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
> index 63b9e8632ca..118baf8d41f 100644
> --- a/target/ppc/cpu-qom.h
> +++ b/target/ppc/cpu-qom.h
> @@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase;
>      .offset     = vmstate_offset_value(_state, _field, PPCTimebase),  \
>  }
>  
> -void cpu_ppc_clock_vm_state_change(void *opaque, int running,
> +void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
>                                     RunState state);
>  #endif
>  
> diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
> index 878a4089d97..3756aca27be 100644
> --- a/accel/xen/xen-all.c
> +++ b/accel/xen/xen-all.c
> @@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
>  }
>  
>  
> -static void xen_change_state_handler(void *opaque, int running,
> +static void xen_change_state_handler(void *opaque, bool running,
>                                       RunState state)
>  {
>      if (running) {
> diff --git a/audio/audio.c b/audio/audio.c
> index b48471bb3f6..f2d56e7e57d 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -1549,7 +1549,7 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv,
>      }
>  }
>  
> -static void audio_vm_change_state_handler (void *opaque, int running,
> +static void audio_vm_change_state_handler (void *opaque, bool running,
>                                             RunState state)
>  {
>      AudioState *s = opaque;
> diff --git a/block/block-backend.c b/block/block-backend.c
> index ce78d30794a..9175eb237a2 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -163,7 +163,7 @@ static const char *blk_root_get_name(BdrvChild *child)
>      return blk_name(child->opaque);
>  }
>  
> -static void blk_vm_state_changed(void *opaque, int running, RunState state)
> +static void blk_vm_state_changed(void *opaque, bool running, RunState state)
>  {
>      Error *local_err = NULL;
>      BlockBackend *blk = opaque;
> diff --git a/gdbstub.c b/gdbstub.c
> index d99bc0bf2ea..9f2998f8d03 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2691,7 +2691,7 @@ void gdb_set_stop_cpu(CPUState *cpu)
>  }
>  
>  #ifndef CONFIG_USER_ONLY
> -static void gdb_vm_state_change(void *opaque, int running, RunState state)
> +static void gdb_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      CPUState *cpu = gdbserver_state.c_cpu;
>      g_autoptr(GString) buf = g_string_new(NULL);
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index ccf326793db..badcbccf012 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -1014,7 +1014,7 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo)
>      loc_pop(&loc);
>  }
>  
> -static void postload_update_cb(void *opaque, int running, RunState state)
> +static void postload_update_cb(void *opaque, bool running, RunState state)
>  {
>      PFlashCFI01 *pfl = opaque;
>  
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index bac2d6fa2b2..5207ef617f0 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -870,7 +870,7 @@ static void virtio_blk_dma_restart_bh(void *opaque)
>      virtio_blk_process_queued_requests(s, true);
>  }
>  
> -static void virtio_blk_dma_restart_cb(void *opaque, int running,
> +static void virtio_blk_dma_restart_cb(void *opaque, bool running,
>                                        RunState state)
>  {
>      VirtIOBlock *s = opaque;
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index 431c1070967..d22e84ba13e 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -1992,7 +1992,7 @@ static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
>      }
>  }
>  
> -static void qxl_vm_change_state_handler(void *opaque, int running,
> +static void qxl_vm_change_state_handler(void *opaque, bool running,
>                                          RunState state)
>  {
>      PCIQXLDevice *qxl = opaque;
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 2d8a3663693..51872dd84c0 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -162,7 +162,7 @@ static void do_kvmclock_ctrl(CPUState *cpu, run_on_cpu_data data)
>      }
>  }
>  
> -static void kvmclock_vm_state_change(void *opaque, int running,
> +static void kvmclock_vm_state_change(void *opaque, bool running,
>                                       RunState state)
>  {
>      KVMClockState *s = opaque;
> diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
> index c73254e8866..c558893961b 100644
> --- a/hw/i386/kvm/i8254.c
> +++ b/hw/i386/kvm/i8254.c
> @@ -239,7 +239,7 @@ static void kvm_pit_irq_control(void *opaque, int n, int enable)
>      kvm_pit_put(pit);
>  }
>  
> -static void kvm_pit_vm_state_change(void *opaque, int running,
> +static void kvm_pit_vm_state_change(void *opaque, bool running,
>                                      RunState state)
>  {
>      KVMPITState *s = opaque;
> diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
> index 2c1898032e4..46315445d22 100644
> --- a/hw/i386/kvmvapic.c
> +++ b/hw/i386/kvmvapic.c
> @@ -748,7 +748,7 @@ static void do_vapic_enable(CPUState *cs, run_on_cpu_data data)
>      s->state = VAPIC_ACTIVE;
>  }
>  
> -static void kvmvapic_vm_state_change(void *opaque, int running,
> +static void kvmvapic_vm_state_change(void *opaque, bool running,
>                                       RunState state)
>  {
>      MachineState *ms = MACHINE(qdev_get_machine());
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index 68821d90f52..7ce672e5a5c 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -1235,7 +1235,7 @@ static void xen_main_loop_prepare(XenIOState *state)
>  }
>  
>  
> -static void xen_hvm_change_state_handler(void *opaque, int running,
> +static void xen_hvm_change_state_handler(void *opaque, bool running,
>                                           RunState rstate)
>  {
>      XenIOState *state = opaque;
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index b49e4cfbc6c..b5c6e967b2e 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -2677,7 +2677,7 @@ static void ide_restart_bh(void *opaque)
>      }
>  }
>  
> -static void ide_restart_cb(void *opaque, int running, RunState state)
> +static void ide_restart_cb(void *opaque, bool running, RunState state)
>  {
>      IDEBus *bus = opaque;
>  
> diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
> index 057cb53f13c..b554d2ede0a 100644
> --- a/hw/intc/arm_gicv3_its_kvm.c
> +++ b/hw/intc/arm_gicv3_its_kvm.c
> @@ -71,7 +71,7 @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid)
>   *
>   * The tables get flushed to guest RAM whenever the VM gets stopped.
>   */
> -static void vm_change_state_handler(void *opaque, int running,
> +static void vm_change_state_handler(void *opaque, bool running,
>                                      RunState state)
>  {
>      GICv3ITSState *s = (GICv3ITSState *)opaque;
> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> index d040a5d1e99..65a4c880a35 100644
> --- a/hw/intc/arm_gicv3_kvm.c
> +++ b/hw/intc/arm_gicv3_kvm.c
> @@ -743,7 +743,7 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = {
>   *
>   * The tables get flushed to guest RAM whenever the VM gets stopped.
>   */
> -static void vm_change_state_handler(void *opaque, int running,
> +static void vm_change_state_handler(void *opaque, bool running,
>                                      RunState state)
>  {
>      GICv3State *s = (GICv3State *)opaque;
> diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
> index acc8c3650c4..c0083311607 100644
> --- a/hw/intc/spapr_xive_kvm.c
> +++ b/hw/intc/spapr_xive_kvm.c
> @@ -504,7 +504,7 @@ static int kvmppc_xive_get_queues(SpaprXive *xive, Error **errp)
>   * runs again. If an interrupt was queued while the VM was stopped,
>   * simply generate a trigger.
>   */
> -static void kvmppc_xive_change_state_handler(void *opaque, int running,
> +static void kvmppc_xive_change_state_handler(void *opaque, bool running,
>                                               RunState state)
>  {
>      SpaprXive *xive = opaque;
> diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
> index 488d086a17c..ca2f939dd58 100644
> --- a/hw/misc/mac_via.c
> +++ b/hw/misc/mac_via.c
> @@ -1098,7 +1098,7 @@ static void mac_via_init(Object *obj)
>                          TYPE_ADB_BUS, DEVICE(obj), "adb.0");
>  }
>  
> -static void postload_update_cb(void *opaque, int running, RunState state)
> +static void postload_update_cb(void *opaque, bool running, RunState state)
>  {
>      MacVIAState *m = MAC_VIA(opaque);
>  
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index 4dcb92d966b..b75f2ab8fc1 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -3298,7 +3298,7 @@ e1000e_autoneg_resume(E1000ECore *core)
>  }
>  
>  static void
> -e1000e_vm_state_change(void *opaque, int running, RunState state)
> +e1000e_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      E1000ECore *core = opaque;
>  
> diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
> index 9e51bc82ae4..01f77520146 100644
> --- a/hw/nvram/spapr_nvram.c
> +++ b/hw/nvram/spapr_nvram.c
> @@ -217,7 +217,7 @@ static int spapr_nvram_pre_load(void *opaque)
>      return 0;
>  }
>  
> -static void postload_update_cb(void *opaque, int running, RunState state)
> +static void postload_update_cb(void *opaque, bool running, RunState state)
>  {
>      SpaprNvram *nvram = opaque;
>  
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 5cbbff1f8d0..bf28d6bfc8d 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -1059,7 +1059,7 @@ static void timebase_load(PPCTimebase *tb)
>      }
>  }
>  
> -void cpu_ppc_clock_vm_state_change(void *opaque, int running,
> +void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
>                                     RunState state)
>  {
>      PPCTimebase *tb = opaque;
> diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
> index 652a21b8064..974c0c8a752 100644
> --- a/hw/ppc/ppc_booke.c
> +++ b/hw/ppc/ppc_booke.c
> @@ -317,7 +317,7 @@ static void ppc_booke_timer_reset_handle(void *opaque)
>   * action will be taken. To avoid this we always clear the watchdog state when
>   * state changes to running.
>   */
> -static void cpu_state_change_handler(void *opaque, int running, RunState state)
> +static void cpu_state_change_handler(void *opaque, bool running, RunState state)
>  {
>      PowerPCCPU *cpu = opaque;
>      CPUPPCState *env = &cpu->env;
> diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
> index 6e21d83181d..0b944774861 100644
> --- a/hw/s390x/tod-kvm.c
> +++ b/hw/s390x/tod-kvm.c
> @@ -78,7 +78,7 @@ static void kvm_s390_tod_set(S390TODState *td, const S390TOD *tod, Error **errp)
>      }
>  }
>  
> -static void kvm_s390_tod_vm_state_change(void *opaque, int running,
> +static void kvm_s390_tod_vm_state_change(void *opaque, bool running,
>                                           RunState state)
>  {
>      S390TODState *td = opaque;
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index c349fb7f2d1..f990d5b3b03 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -181,7 +181,7 @@ void scsi_req_retry(SCSIRequest *req)
>      req->retry = true;
>  }
>  
> -static void scsi_dma_restart_cb(void *opaque, int running, RunState state)
> +static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
>  {
>      SCSIDevice *s = opaque;
>  
> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
> index aca018d8b5f..98d08c325ea 100644
> --- a/hw/usb/hcd-ehci.c
> +++ b/hw/usb/hcd-ehci.c
> @@ -2436,7 +2436,7 @@ static int usb_ehci_post_load(void *opaque, int version_id)
>      return 0;
>  }
>  
> -static void usb_ehci_vm_state_change(void *opaque, int running, RunState state)
> +static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      EHCIState *ehci = opaque;
>  
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index b950501d100..ecbf3f66f42 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -1755,7 +1755,7 @@ type_init(usb_host_register_types)
>  static QEMUTimer *usb_auto_timer;
>  static VMChangeStateEntry *usb_vmstate;
>  
> -static void usb_host_vm_state(void *unused, int running, RunState state)
> +static void usb_host_vm_state(void *unused, bool running, RunState state)
>  {
>      if (running) {
>          usb_host_auto_check(unused);
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 7e9e3fecbfe..17f06f34179 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -1395,7 +1395,7 @@ static void usbredir_chardev_event(void *opaque, QEMUChrEvent event)
>   * init + destroy
>   */
>  
> -static void usbredir_vm_state_change(void *priv, int running, RunState state)
> +static void usbredir_vm_state_change(void *priv, bool running, RunState state)
>  {
>      USBRedirDevice *dev = priv;
>  
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 00daa50ed81..134bdccc4f8 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -727,7 +727,7 @@ static SaveVMHandlers savevm_vfio_handlers = {
>  
>  /* ---------------------------------------------------------------------- */
>  
> -static void vfio_vmstate_change(void *opaque, int running, RunState state)
> +static void vfio_vmstate_change(void *opaque, bool running, RunState state)
>  {
>      VFIODevice *vbasedev = opaque;
>      VFIOMigration *migration = vbasedev->migration;
> diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
> index 76ce9376931..cc8e9f775d8 100644
> --- a/hw/virtio/virtio-rng.c
> +++ b/hw/virtio/virtio-rng.c
> @@ -133,7 +133,7 @@ static uint64_t get_features(VirtIODevice *vdev, uint64_t f, Error **errp)
>      return f;
>  }
>  
> -static void virtio_rng_vm_state_change(void *opaque, int running,
> +static void virtio_rng_vm_state_change(void *opaque, bool running,
>                                         RunState state)
>  {
>      VirtIORNG *vrng = opaque;
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index b308026596f..38dc623c89e 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -3208,7 +3208,7 @@ void virtio_cleanup(VirtIODevice *vdev)
>      qemu_del_vm_change_state_handler(vdev->vmstate);
>  }
>  
> -static void virtio_vmstate_change(void *opaque, int running, RunState state)
> +static void virtio_vmstate_change(void *opaque, bool running, RunState state)
>  {
>      VirtIODevice *vdev = opaque;
>      BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
> diff --git a/net/net.c b/net/net.c
> index e1035f21d18..8a85d1e3f7b 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1341,7 +1341,7 @@ void qmp_set_link(const char *name, bool up, Error **errp)
>      }
>  }
>  
> -static void net_vm_change_state_handler(void *opaque, int running,
> +static void net_vm_change_state_handler(void *opaque, bool running,
>                                          RunState state)
>  {
>      NetClientState *nc;
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index 333e1ed7b05..ab7f2e5aa07 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -2675,7 +2675,7 @@ static void memory_global_dirty_log_do_stop(void)
>      MEMORY_LISTENER_CALL_GLOBAL(log_global_stop, Reverse);
>  }
>  
> -static void memory_vm_change_state_handler(void *opaque, int running,
> +static void memory_vm_change_state_handler(void *opaque, bool running,
>                                             RunState state)
>  {
>      if (running) {
> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> index c7a67147d17..cb07a65925c 100644
> --- a/softmmu/runstate.c
> +++ b/softmmu/runstate.c
> @@ -316,7 +316,7 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
>      g_free(e);
>  }
>  
> -void vm_state_notify(int running, RunState state)
> +void vm_state_notify(bool running, RunState state)
>  {
>      VMChangeStateEntry *e, *next;
>  
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index ffe186de8d1..53d6c4a17eb 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -844,7 +844,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
>      return MEMTXATTRS_UNSPECIFIED;
>  }
>  
> -void kvm_arm_vm_state_change(void *opaque, int running, RunState state)
> +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      CPUState *cs = opaque;
>      ARMCPU *cpu = ARM_CPU(cs);
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index 6dc1ee052d5..170ad55c09c 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -690,7 +690,7 @@ static int kvm_inject_mce_oldstyle(X86CPU *cpu)
>      return 0;
>  }
>  
> -static void cpu_update_state(void *opaque, int running, RunState state)
> +static void cpu_update_state(void *opaque, bool running, RunState state)
>  {
>      CPUX86State *env = opaque;
>  
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 15466068118..e7890f61906 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -670,7 +670,7 @@ sev_launch_finish(SevGuestState *sev)
>  }
>  
>  static void
> -sev_vm_state_change(void *opaque, int running, RunState state)
> +sev_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      SevGuestState *sev = opaque;
>  
> diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
> index 3b824fc9d7c..850dfe72e75 100644
> --- a/target/i386/whpx/whpx-all.c
> +++ b/target/i386/whpx/whpx-all.c
> @@ -1318,7 +1318,7 @@ void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu)
>  
>  static Error *whpx_migration_blocker;
>  
> -static void whpx_cpu_update_state(void *opaque, int running, RunState state)
> +static void whpx_cpu_update_state(void *opaque, bool running, RunState state)
>  {
>      CPUX86State *env = opaque;
>  
> diff --git a/target/mips/kvm.c b/target/mips/kvm.c
> index 477692566a4..09945ad2455 100644
> --- a/target/mips/kvm.c
> +++ b/target/mips/kvm.c
> @@ -37,7 +37,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
>      KVM_CAP_LAST_INFO
>  };
>  
> -static void kvm_mips_update_state(void *opaque, int running, RunState state);
> +static void kvm_mips_update_state(void *opaque, bool running, RunState state);
>  
>  unsigned long kvm_arch_vcpu_id(CPUState *cs)
>  {
> @@ -552,7 +552,7 @@ static int kvm_mips_restore_count(CPUState *cs)
>  /*
>   * Handle the VM clock being started or stopped
>   */
> -static void kvm_mips_update_state(void *opaque, int running, RunState state)
> +static void kvm_mips_update_state(void *opaque, bool running, RunState state)
>  {
>      CPUState *cs = opaque;
>      int ret;
> diff --git a/ui/gtk.c b/ui/gtk.c
> index a752aa22be0..a5bf8ed8429 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -672,7 +672,7 @@ static const DisplayChangeListenerOps dcl_egl_ops = {
>  
>  /** QEMU Events **/
>  
> -static void gd_change_runstate(void *opaque, int running, RunState state)
> +static void gd_change_runstate(void *opaque, bool running, RunState state)
>  {
>      GtkDisplayState *s = opaque;
>  
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 5746d0aae7c..22c77c04151 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -622,7 +622,7 @@ static int add_channel(void *opaque, const char *name, const char *value,
>      return 0;
>  }
>  
> -static void vm_change_state_handler(void *opaque, int running,
> +static void vm_change_state_handler(void *opaque, bool running,
>                                      RunState state)
>  {
>      if (running) {

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-01-11 15:20 [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
  2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
  2021-01-11 15:20 ` [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
@ 2021-01-12 10:30 ` Stefan Hajnoczi
  2021-02-22 14:34 ` Philippe Mathieu-Daudé
  3 siblings, 0 replies; 12+ messages in thread
From: Stefan Hajnoczi @ 2021-01-12 10:30 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé
  Cc: qemu-devel, Huacai Chen, Greg Kurz, Michael S. Tsirkin,
	qemu-trivial, Amit Shah, Dmitry Fleytman, qemu-arm, John Snow,
	qemu-s390x, Paul Durrant, Anthony Perard, Eduardo Habkost,
	Gerd Hoffmann, Kevin Wolf, Marcelo Tosatti, Max Reitz,
	Alex Williamson, Aurelien Jarno, Aleksandar Rikalo,
	Marcel Apfelbaum, Jason Wang, Peter Maydell,
	Cédric Le Goater, Halil Pasic, Fam Zheng, qemu-ppc,
	Paolo Bonzini, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Jiaxun Yang

[-- Attachment #1: Type: text/plain, Size: 2209 bytes --]

On Mon, Jan 11, 2021 at 04:20:18PM +0100, Philippe Mathieu-Daudé wrote:
> Trivial prototype change to clarify the use of the 'running'
> argument of VMChangeStateHandler.
> 
> Green CI:
> https://gitlab.com/philmd/qemu/-/pipelines/239497352
> 
> Philippe Mathieu-Daudé (2):
>   sysemu/runstate: Let runstate_is_running() return bool
>   sysemu: Let VMChangeStateHandler take boolean 'running' argument
> 
>  include/sysemu/runstate.h   | 12 +++++++++---
>  target/arm/kvm_arm.h        |  2 +-
>  target/ppc/cpu-qom.h        |  2 +-
>  accel/xen/xen-all.c         |  2 +-
>  audio/audio.c               |  2 +-
>  block/block-backend.c       |  2 +-
>  gdbstub.c                   |  2 +-
>  hw/block/pflash_cfi01.c     |  2 +-
>  hw/block/virtio-blk.c       |  2 +-
>  hw/display/qxl.c            |  2 +-
>  hw/i386/kvm/clock.c         |  2 +-
>  hw/i386/kvm/i8254.c         |  2 +-
>  hw/i386/kvmvapic.c          |  2 +-
>  hw/i386/xen/xen-hvm.c       |  2 +-
>  hw/ide/core.c               |  2 +-
>  hw/intc/arm_gicv3_its_kvm.c |  2 +-
>  hw/intc/arm_gicv3_kvm.c     |  2 +-
>  hw/intc/spapr_xive_kvm.c    |  2 +-
>  hw/misc/mac_via.c           |  2 +-
>  hw/net/e1000e_core.c        |  2 +-
>  hw/nvram/spapr_nvram.c      |  2 +-
>  hw/ppc/ppc.c                |  2 +-
>  hw/ppc/ppc_booke.c          |  2 +-
>  hw/s390x/tod-kvm.c          |  2 +-
>  hw/scsi/scsi-bus.c          |  2 +-
>  hw/usb/hcd-ehci.c           |  2 +-
>  hw/usb/host-libusb.c        |  2 +-
>  hw/usb/redirect.c           |  2 +-
>  hw/vfio/migration.c         |  2 +-
>  hw/virtio/virtio-rng.c      |  2 +-
>  hw/virtio/virtio.c          |  2 +-
>  net/net.c                   |  2 +-
>  softmmu/memory.c            |  2 +-
>  softmmu/runstate.c          |  4 ++--
>  target/arm/kvm.c            |  2 +-
>  target/i386/kvm/kvm.c       |  2 +-
>  target/i386/sev.c           |  2 +-
>  target/i386/whpx/whpx-all.c |  2 +-
>  target/mips/kvm.c           |  4 ++--
>  ui/gtk.c                    |  2 +-
>  ui/spice-core.c             |  2 +-
>  41 files changed, 51 insertions(+), 45 deletions(-)
> 
> -- 
> 2.26.2
> 
> 

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-01-11 15:20 [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2021-01-12 10:30 ` [PATCH 0/2] " Stefan Hajnoczi
@ 2021-02-22 14:34 ` Philippe Mathieu-Daudé
  2021-03-09 22:08   ` Philippe Mathieu-Daudé
  3 siblings, 1 reply; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-02-22 14:34 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini
  Cc: Huacai Chen, Greg Kurz, Michael S. Tsirkin, qemu-trivial,
	Amit Shah, Dmitry Fleytman, qemu-arm, John Snow, qemu-s390x,
	Paul Durrant, Anthony Perard, Eduardo Habkost, Gerd Hoffmann,
	Kevin Wolf, Marcelo Tosatti, Max Reitz, Alex Williamson,
	Aurelien Jarno, Aleksandar Rikalo, Marcel Apfelbaum, Jason Wang,
	Peter Maydell, Cédric Le Goater, Halil Pasic, Fam Zheng,
	qemu-ppc, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Stefan Hajnoczi,
	Jiaxun Yang

Paolo, this series is fully reviewed, can it go via your
misc tree?

On 1/11/21 4:20 PM, Philippe Mathieu-Daudé wrote:
> Trivial prototype change to clarify the use of the 'running'
> argument of VMChangeStateHandler.
> 
> Green CI:
> https://gitlab.com/philmd/qemu/-/pipelines/239497352
> 
> Philippe Mathieu-Daudé (2):
>   sysemu/runstate: Let runstate_is_running() return bool
>   sysemu: Let VMChangeStateHandler take boolean 'running' argument
> 
>  include/sysemu/runstate.h   | 12 +++++++++---
>  target/arm/kvm_arm.h        |  2 +-
>  target/ppc/cpu-qom.h        |  2 +-
>  accel/xen/xen-all.c         |  2 +-
>  audio/audio.c               |  2 +-
>  block/block-backend.c       |  2 +-
>  gdbstub.c                   |  2 +-
>  hw/block/pflash_cfi01.c     |  2 +-
>  hw/block/virtio-blk.c       |  2 +-
>  hw/display/qxl.c            |  2 +-
>  hw/i386/kvm/clock.c         |  2 +-
>  hw/i386/kvm/i8254.c         |  2 +-
>  hw/i386/kvmvapic.c          |  2 +-
>  hw/i386/xen/xen-hvm.c       |  2 +-
>  hw/ide/core.c               |  2 +-
>  hw/intc/arm_gicv3_its_kvm.c |  2 +-
>  hw/intc/arm_gicv3_kvm.c     |  2 +-
>  hw/intc/spapr_xive_kvm.c    |  2 +-
>  hw/misc/mac_via.c           |  2 +-
>  hw/net/e1000e_core.c        |  2 +-
>  hw/nvram/spapr_nvram.c      |  2 +-
>  hw/ppc/ppc.c                |  2 +-
>  hw/ppc/ppc_booke.c          |  2 +-
>  hw/s390x/tod-kvm.c          |  2 +-
>  hw/scsi/scsi-bus.c          |  2 +-
>  hw/usb/hcd-ehci.c           |  2 +-
>  hw/usb/host-libusb.c        |  2 +-
>  hw/usb/redirect.c           |  2 +-
>  hw/vfio/migration.c         |  2 +-
>  hw/virtio/virtio-rng.c      |  2 +-
>  hw/virtio/virtio.c          |  2 +-
>  net/net.c                   |  2 +-
>  softmmu/memory.c            |  2 +-
>  softmmu/runstate.c          |  4 ++--
>  target/arm/kvm.c            |  2 +-
>  target/i386/kvm/kvm.c       |  2 +-
>  target/i386/sev.c           |  2 +-
>  target/i386/whpx/whpx-all.c |  2 +-
>  target/mips/kvm.c           |  4 ++--
>  ui/gtk.c                    |  2 +-
>  ui/spice-core.c             |  2 +-
>  41 files changed, 51 insertions(+), 45 deletions(-)
> 


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

* Re: [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-02-22 14:34 ` Philippe Mathieu-Daudé
@ 2021-03-09 22:08   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-03-09 22:08 UTC (permalink / raw)
  To: qemu-devel, Paolo Bonzini, QEMU Trivial
  Cc: Huacai Chen, Greg Kurz, Michael S. Tsirkin, qemu-trivial,
	Amit Shah, Dmitry Fleytman, qemu-arm, John Snow, qemu-s390x,
	Paul Durrant, Anthony Perard, Eduardo Habkost, Gerd Hoffmann,
	Kevin Wolf, Marcelo Tosatti, Max Reitz, Alex Williamson,
	Aurelien Jarno, Aleksandar Rikalo, Marcel Apfelbaum, Jason Wang,
	Peter Maydell, Cédric Le Goater, Halil Pasic, Fam Zheng,
	qemu-ppc, kvm, Stefano Stabellini, xen-devel, Cornelia Huck,
	David Hildenbrand, qemu-block, Christian Borntraeger,
	Sunil Muthuswamy, David Gibson, Richard Henderson,
	Alex Bennée, Laurent Vivier, Thomas Huth, Stefan Hajnoczi,
	Jiaxun Yang

ping, qemu-trivial maybe?

On 2/22/21 3:34 PM, Philippe Mathieu-Daudé wrote:
> Paolo, this series is fully reviewed, can it go via your
> misc tree?
> 
> On 1/11/21 4:20 PM, Philippe Mathieu-Daudé wrote:
>> Trivial prototype change to clarify the use of the 'running'
>> argument of VMChangeStateHandler.
>>
>> Green CI:
>> https://gitlab.com/philmd/qemu/-/pipelines/239497352
>>
>> Philippe Mathieu-Daudé (2):
>>   sysemu/runstate: Let runstate_is_running() return bool
>>   sysemu: Let VMChangeStateHandler take boolean 'running' argument
>>
>>  include/sysemu/runstate.h   | 12 +++++++++---
>>  target/arm/kvm_arm.h        |  2 +-
>>  target/ppc/cpu-qom.h        |  2 +-
>>  accel/xen/xen-all.c         |  2 +-
>>  audio/audio.c               |  2 +-
>>  block/block-backend.c       |  2 +-
>>  gdbstub.c                   |  2 +-
>>  hw/block/pflash_cfi01.c     |  2 +-
>>  hw/block/virtio-blk.c       |  2 +-
>>  hw/display/qxl.c            |  2 +-
>>  hw/i386/kvm/clock.c         |  2 +-
>>  hw/i386/kvm/i8254.c         |  2 +-
>>  hw/i386/kvmvapic.c          |  2 +-
>>  hw/i386/xen/xen-hvm.c       |  2 +-
>>  hw/ide/core.c               |  2 +-
>>  hw/intc/arm_gicv3_its_kvm.c |  2 +-
>>  hw/intc/arm_gicv3_kvm.c     |  2 +-
>>  hw/intc/spapr_xive_kvm.c    |  2 +-
>>  hw/misc/mac_via.c           |  2 +-
>>  hw/net/e1000e_core.c        |  2 +-
>>  hw/nvram/spapr_nvram.c      |  2 +-
>>  hw/ppc/ppc.c                |  2 +-
>>  hw/ppc/ppc_booke.c          |  2 +-
>>  hw/s390x/tod-kvm.c          |  2 +-
>>  hw/scsi/scsi-bus.c          |  2 +-
>>  hw/usb/hcd-ehci.c           |  2 +-
>>  hw/usb/host-libusb.c        |  2 +-
>>  hw/usb/redirect.c           |  2 +-
>>  hw/vfio/migration.c         |  2 +-
>>  hw/virtio/virtio-rng.c      |  2 +-
>>  hw/virtio/virtio.c          |  2 +-
>>  net/net.c                   |  2 +-
>>  softmmu/memory.c            |  2 +-
>>  softmmu/runstate.c          |  4 ++--
>>  target/arm/kvm.c            |  2 +-
>>  target/i386/kvm/kvm.c       |  2 +-
>>  target/i386/sev.c           |  2 +-
>>  target/i386/whpx/whpx-all.c |  2 +-
>>  target/mips/kvm.c           |  4 ++--
>>  ui/gtk.c                    |  2 +-
>>  ui/spice-core.c             |  2 +-
>>  41 files changed, 51 insertions(+), 45 deletions(-)
>>
> 


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

* Re: [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool
  2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
  2021-01-11 16:08   ` David Hildenbrand
  2021-01-11 17:46   ` Alex Bennée
@ 2021-03-09 22:13   ` Laurent Vivier
  2 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2021-03-09 22:13 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Fam Zheng, Peter Maydell, Dmitry Fleytman, kvm, Paul Durrant,
	Jason Wang, David Hildenbrand, Thomas Huth, Jiaxun Yang,
	Gerd Hoffmann, Stefano Stabellini, qemu-block, qemu-trivial,
	Alex Bennée, Huacai Chen, Halil Pasic,
	Christian Borntraeger, Marcel Apfelbaum, Anthony Perard,
	qemu-ppc, Aleksandar Rikalo, Eduardo Habkost, Amit Shah,
	Richard Henderson, Greg Kurz, Alex Williamson, qemu-arm,
	Cédric Le Goater, Stefan Hajnoczi, xen-devel,
	Sunil Muthuswamy, John Snow, David Gibson, Kevin Wolf,
	Marcelo Tosatti, qemu-s390x, Max Reitz, Michael S. Tsirkin,
	Cornelia Huck, Paolo Bonzini, Aurelien Jarno

Le 11/01/2021 à 16:20, Philippe Mathieu-Daudé a écrit :
> runstate_check() returns a boolean. runstate_is_running()
> returns what runstate_check() returns, also a boolean.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/sysemu/runstate.h | 2 +-
>  softmmu/runstate.c        | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
> index e557f470d42..3ab35a039a0 100644
> --- a/include/sysemu/runstate.h
> +++ b/include/sysemu/runstate.h
> @@ -6,7 +6,7 @@
>  
>  bool runstate_check(RunState state);
>  void runstate_set(RunState new_state);
> -int runstate_is_running(void);
> +bool runstate_is_running(void);
>  bool runstate_needs_reset(void);
>  bool runstate_store(char *str, size_t size);
>  
> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> index 636aab0addb..c7a67147d17 100644
> --- a/softmmu/runstate.c
> +++ b/softmmu/runstate.c
> @@ -217,7 +217,7 @@ void runstate_set(RunState new_state)
>      current_run_state = new_state;
>  }
>  
> -int runstate_is_running(void)
> +bool runstate_is_running(void)
>  {
>      return runstate_check(RUN_STATE_RUNNING);
>  }
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


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

* Re: [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument
  2021-01-11 15:20 ` [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
  2021-01-11 17:48   ` Alex Bennée
  2021-01-12  0:17   ` David Gibson
@ 2021-03-09 22:14   ` Laurent Vivier
  2 siblings, 0 replies; 12+ messages in thread
From: Laurent Vivier @ 2021-03-09 22:14 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Fam Zheng, Peter Maydell, Dmitry Fleytman, kvm, Paul Durrant,
	Jason Wang, David Hildenbrand, Thomas Huth, Jiaxun Yang,
	Gerd Hoffmann, Stefano Stabellini, qemu-block, qemu-trivial,
	Alex Bennée, Huacai Chen, Halil Pasic,
	Christian Borntraeger, Marcel Apfelbaum, Anthony Perard,
	qemu-ppc, Aleksandar Rikalo, Eduardo Habkost, Amit Shah,
	Richard Henderson, Greg Kurz, Alex Williamson, qemu-arm,
	Cédric Le Goater, Stefan Hajnoczi, xen-devel,
	Sunil Muthuswamy, John Snow, David Gibson, Kevin Wolf,
	Marcelo Tosatti, qemu-s390x, Max Reitz, Michael S. Tsirkin,
	Cornelia Huck, Paolo Bonzini, Aurelien Jarno

Le 11/01/2021 à 16:20, Philippe Mathieu-Daudé a écrit :
> The 'running' argument from VMChangeStateHandler does not require
> other value than 0 / 1. Make it a plain boolean.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  include/sysemu/runstate.h   | 10 ++++++++--
>  target/arm/kvm_arm.h        |  2 +-
>  target/ppc/cpu-qom.h        |  2 +-
>  accel/xen/xen-all.c         |  2 +-
>  audio/audio.c               |  2 +-
>  block/block-backend.c       |  2 +-
>  gdbstub.c                   |  2 +-
>  hw/block/pflash_cfi01.c     |  2 +-
>  hw/block/virtio-blk.c       |  2 +-
>  hw/display/qxl.c            |  2 +-
>  hw/i386/kvm/clock.c         |  2 +-
>  hw/i386/kvm/i8254.c         |  2 +-
>  hw/i386/kvmvapic.c          |  2 +-
>  hw/i386/xen/xen-hvm.c       |  2 +-
>  hw/ide/core.c               |  2 +-
>  hw/intc/arm_gicv3_its_kvm.c |  2 +-
>  hw/intc/arm_gicv3_kvm.c     |  2 +-
>  hw/intc/spapr_xive_kvm.c    |  2 +-
>  hw/misc/mac_via.c           |  2 +-
>  hw/net/e1000e_core.c        |  2 +-
>  hw/nvram/spapr_nvram.c      |  2 +-
>  hw/ppc/ppc.c                |  2 +-
>  hw/ppc/ppc_booke.c          |  2 +-
>  hw/s390x/tod-kvm.c          |  2 +-
>  hw/scsi/scsi-bus.c          |  2 +-
>  hw/usb/hcd-ehci.c           |  2 +-
>  hw/usb/host-libusb.c        |  2 +-
>  hw/usb/redirect.c           |  2 +-
>  hw/vfio/migration.c         |  2 +-
>  hw/virtio/virtio-rng.c      |  2 +-
>  hw/virtio/virtio.c          |  2 +-
>  net/net.c                   |  2 +-
>  softmmu/memory.c            |  2 +-
>  softmmu/runstate.c          |  2 +-
>  target/arm/kvm.c            |  2 +-
>  target/i386/kvm/kvm.c       |  2 +-
>  target/i386/sev.c           |  2 +-
>  target/i386/whpx/whpx-all.c |  2 +-
>  target/mips/kvm.c           |  4 ++--
>  ui/gtk.c                    |  2 +-
>  ui/spice-core.c             |  2 +-
>  41 files changed, 49 insertions(+), 43 deletions(-)
> 
> diff --git a/include/sysemu/runstate.h b/include/sysemu/runstate.h
> index 3ab35a039a0..a5356915734 100644
> --- a/include/sysemu/runstate.h
> +++ b/include/sysemu/runstate.h
> @@ -10,7 +10,7 @@ bool runstate_is_running(void);
>  bool runstate_needs_reset(void);
>  bool runstate_store(char *str, size_t size);
>  
> -typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
> +typedef void VMChangeStateHandler(void *opaque, bool running, RunState state);
>  
>  VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
>                                                       void *opaque);
> @@ -20,7 +20,13 @@ VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
>                                                       VMChangeStateHandler *cb,
>                                                       void *opaque);
>  void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
> -void vm_state_notify(int running, RunState state);
> +/**
> + * vm_state_notify: Notify the state of the VM
> + *
> + * @running: whether the VM is running or not.
> + * @state: the #RunState of the VM.
> + */
> +void vm_state_notify(bool running, RunState state);
>  
>  static inline bool shutdown_caused_by_guest(ShutdownCause cause)
>  {
> diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
> index eb81b7059eb..68ec970c4f4 100644
> --- a/target/arm/kvm_arm.h
> +++ b/target/arm/kvm_arm.h
> @@ -352,7 +352,7 @@ void kvm_arm_get_virtual_time(CPUState *cs);
>   */
>  void kvm_arm_put_virtual_time(CPUState *cs);
>  
> -void kvm_arm_vm_state_change(void *opaque, int running, RunState state);
> +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state);
>  
>  int kvm_arm_vgic_probe(void);
>  
> diff --git a/target/ppc/cpu-qom.h b/target/ppc/cpu-qom.h
> index 63b9e8632ca..118baf8d41f 100644
> --- a/target/ppc/cpu-qom.h
> +++ b/target/ppc/cpu-qom.h
> @@ -218,7 +218,7 @@ extern const VMStateDescription vmstate_ppc_timebase;
>      .offset     = vmstate_offset_value(_state, _field, PPCTimebase),  \
>  }
>  
> -void cpu_ppc_clock_vm_state_change(void *opaque, int running,
> +void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
>                                     RunState state);
>  #endif
>  
> diff --git a/accel/xen/xen-all.c b/accel/xen/xen-all.c
> index 878a4089d97..3756aca27be 100644
> --- a/accel/xen/xen-all.c
> +++ b/accel/xen/xen-all.c
> @@ -122,7 +122,7 @@ static void xenstore_record_dm_state(struct xs_handle *xs, const char *state)
>  }
>  
>  
> -static void xen_change_state_handler(void *opaque, int running,
> +static void xen_change_state_handler(void *opaque, bool running,
>                                       RunState state)
>  {
>      if (running) {
> diff --git a/audio/audio.c b/audio/audio.c
> index b48471bb3f6..f2d56e7e57d 100644
> --- a/audio/audio.c
> +++ b/audio/audio.c
> @@ -1549,7 +1549,7 @@ static int audio_driver_init(AudioState *s, struct audio_driver *drv,
>      }
>  }
>  
> -static void audio_vm_change_state_handler (void *opaque, int running,
> +static void audio_vm_change_state_handler (void *opaque, bool running,
>                                             RunState state)
>  {
>      AudioState *s = opaque;
> diff --git a/block/block-backend.c b/block/block-backend.c
> index ce78d30794a..9175eb237a2 100644
> --- a/block/block-backend.c
> +++ b/block/block-backend.c
> @@ -163,7 +163,7 @@ static const char *blk_root_get_name(BdrvChild *child)
>      return blk_name(child->opaque);
>  }
>  
> -static void blk_vm_state_changed(void *opaque, int running, RunState state)
> +static void blk_vm_state_changed(void *opaque, bool running, RunState state)
>  {
>      Error *local_err = NULL;
>      BlockBackend *blk = opaque;
> diff --git a/gdbstub.c b/gdbstub.c
> index d99bc0bf2ea..9f2998f8d03 100644
> --- a/gdbstub.c
> +++ b/gdbstub.c
> @@ -2691,7 +2691,7 @@ void gdb_set_stop_cpu(CPUState *cpu)
>  }
>  
>  #ifndef CONFIG_USER_ONLY
> -static void gdb_vm_state_change(void *opaque, int running, RunState state)
> +static void gdb_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      CPUState *cpu = gdbserver_state.c_cpu;
>      g_autoptr(GString) buf = g_string_new(NULL);
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index ccf326793db..badcbccf012 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -1014,7 +1014,7 @@ void pflash_cfi01_legacy_drive(PFlashCFI01 *fl, DriveInfo *dinfo)
>      loc_pop(&loc);
>  }
>  
> -static void postload_update_cb(void *opaque, int running, RunState state)
> +static void postload_update_cb(void *opaque, bool running, RunState state)
>  {
>      PFlashCFI01 *pfl = opaque;
>  
> diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
> index bac2d6fa2b2..5207ef617f0 100644
> --- a/hw/block/virtio-blk.c
> +++ b/hw/block/virtio-blk.c
> @@ -870,7 +870,7 @@ static void virtio_blk_dma_restart_bh(void *opaque)
>      virtio_blk_process_queued_requests(s, true);
>  }
>  
> -static void virtio_blk_dma_restart_cb(void *opaque, int running,
> +static void virtio_blk_dma_restart_cb(void *opaque, bool running,
>                                        RunState state)
>  {
>      VirtIOBlock *s = opaque;
> diff --git a/hw/display/qxl.c b/hw/display/qxl.c
> index 431c1070967..d22e84ba13e 100644
> --- a/hw/display/qxl.c
> +++ b/hw/display/qxl.c
> @@ -1992,7 +1992,7 @@ static void qxl_dirty_surfaces(PCIQXLDevice *qxl)
>      }
>  }
>  
> -static void qxl_vm_change_state_handler(void *opaque, int running,
> +static void qxl_vm_change_state_handler(void *opaque, bool running,
>                                          RunState state)
>  {
>      PCIQXLDevice *qxl = opaque;
> diff --git a/hw/i386/kvm/clock.c b/hw/i386/kvm/clock.c
> index 2d8a3663693..51872dd84c0 100644
> --- a/hw/i386/kvm/clock.c
> +++ b/hw/i386/kvm/clock.c
> @@ -162,7 +162,7 @@ static void do_kvmclock_ctrl(CPUState *cpu, run_on_cpu_data data)
>      }
>  }
>  
> -static void kvmclock_vm_state_change(void *opaque, int running,
> +static void kvmclock_vm_state_change(void *opaque, bool running,
>                                       RunState state)
>  {
>      KVMClockState *s = opaque;
> diff --git a/hw/i386/kvm/i8254.c b/hw/i386/kvm/i8254.c
> index c73254e8866..c558893961b 100644
> --- a/hw/i386/kvm/i8254.c
> +++ b/hw/i386/kvm/i8254.c
> @@ -239,7 +239,7 @@ static void kvm_pit_irq_control(void *opaque, int n, int enable)
>      kvm_pit_put(pit);
>  }
>  
> -static void kvm_pit_vm_state_change(void *opaque, int running,
> +static void kvm_pit_vm_state_change(void *opaque, bool running,
>                                      RunState state)
>  {
>      KVMPITState *s = opaque;
> diff --git a/hw/i386/kvmvapic.c b/hw/i386/kvmvapic.c
> index 2c1898032e4..46315445d22 100644
> --- a/hw/i386/kvmvapic.c
> +++ b/hw/i386/kvmvapic.c
> @@ -748,7 +748,7 @@ static void do_vapic_enable(CPUState *cs, run_on_cpu_data data)
>      s->state = VAPIC_ACTIVE;
>  }
>  
> -static void kvmvapic_vm_state_change(void *opaque, int running,
> +static void kvmvapic_vm_state_change(void *opaque, bool running,
>                                       RunState state)
>  {
>      MachineState *ms = MACHINE(qdev_get_machine());
> diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> index 68821d90f52..7ce672e5a5c 100644
> --- a/hw/i386/xen/xen-hvm.c
> +++ b/hw/i386/xen/xen-hvm.c
> @@ -1235,7 +1235,7 @@ static void xen_main_loop_prepare(XenIOState *state)
>  }
>  
>  
> -static void xen_hvm_change_state_handler(void *opaque, int running,
> +static void xen_hvm_change_state_handler(void *opaque, bool running,
>                                           RunState rstate)
>  {
>      XenIOState *state = opaque;
> diff --git a/hw/ide/core.c b/hw/ide/core.c
> index b49e4cfbc6c..b5c6e967b2e 100644
> --- a/hw/ide/core.c
> +++ b/hw/ide/core.c
> @@ -2677,7 +2677,7 @@ static void ide_restart_bh(void *opaque)
>      }
>  }
>  
> -static void ide_restart_cb(void *opaque, int running, RunState state)
> +static void ide_restart_cb(void *opaque, bool running, RunState state)
>  {
>      IDEBus *bus = opaque;
>  
> diff --git a/hw/intc/arm_gicv3_its_kvm.c b/hw/intc/arm_gicv3_its_kvm.c
> index 057cb53f13c..b554d2ede0a 100644
> --- a/hw/intc/arm_gicv3_its_kvm.c
> +++ b/hw/intc/arm_gicv3_its_kvm.c
> @@ -71,7 +71,7 @@ static int kvm_its_send_msi(GICv3ITSState *s, uint32_t value, uint16_t devid)
>   *
>   * The tables get flushed to guest RAM whenever the VM gets stopped.
>   */
> -static void vm_change_state_handler(void *opaque, int running,
> +static void vm_change_state_handler(void *opaque, bool running,
>                                      RunState state)
>  {
>      GICv3ITSState *s = (GICv3ITSState *)opaque;
> diff --git a/hw/intc/arm_gicv3_kvm.c b/hw/intc/arm_gicv3_kvm.c
> index d040a5d1e99..65a4c880a35 100644
> --- a/hw/intc/arm_gicv3_kvm.c
> +++ b/hw/intc/arm_gicv3_kvm.c
> @@ -743,7 +743,7 @@ static const ARMCPRegInfo gicv3_cpuif_reginfo[] = {
>   *
>   * The tables get flushed to guest RAM whenever the VM gets stopped.
>   */
> -static void vm_change_state_handler(void *opaque, int running,
> +static void vm_change_state_handler(void *opaque, bool running,
>                                      RunState state)
>  {
>      GICv3State *s = (GICv3State *)opaque;
> diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
> index acc8c3650c4..c0083311607 100644
> --- a/hw/intc/spapr_xive_kvm.c
> +++ b/hw/intc/spapr_xive_kvm.c
> @@ -504,7 +504,7 @@ static int kvmppc_xive_get_queues(SpaprXive *xive, Error **errp)
>   * runs again. If an interrupt was queued while the VM was stopped,
>   * simply generate a trigger.
>   */
> -static void kvmppc_xive_change_state_handler(void *opaque, int running,
> +static void kvmppc_xive_change_state_handler(void *opaque, bool running,
>                                               RunState state)
>  {
>      SpaprXive *xive = opaque;
> diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c
> index 488d086a17c..ca2f939dd58 100644
> --- a/hw/misc/mac_via.c
> +++ b/hw/misc/mac_via.c
> @@ -1098,7 +1098,7 @@ static void mac_via_init(Object *obj)
>                          TYPE_ADB_BUS, DEVICE(obj), "adb.0");
>  }
>  
> -static void postload_update_cb(void *opaque, int running, RunState state)
> +static void postload_update_cb(void *opaque, bool running, RunState state)
>  {
>      MacVIAState *m = MAC_VIA(opaque);
>  
> diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
> index 4dcb92d966b..b75f2ab8fc1 100644
> --- a/hw/net/e1000e_core.c
> +++ b/hw/net/e1000e_core.c
> @@ -3298,7 +3298,7 @@ e1000e_autoneg_resume(E1000ECore *core)
>  }
>  
>  static void
> -e1000e_vm_state_change(void *opaque, int running, RunState state)
> +e1000e_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      E1000ECore *core = opaque;
>  
> diff --git a/hw/nvram/spapr_nvram.c b/hw/nvram/spapr_nvram.c
> index 9e51bc82ae4..01f77520146 100644
> --- a/hw/nvram/spapr_nvram.c
> +++ b/hw/nvram/spapr_nvram.c
> @@ -217,7 +217,7 @@ static int spapr_nvram_pre_load(void *opaque)
>      return 0;
>  }
>  
> -static void postload_update_cb(void *opaque, int running, RunState state)
> +static void postload_update_cb(void *opaque, bool running, RunState state)
>  {
>      SpaprNvram *nvram = opaque;
>  
> diff --git a/hw/ppc/ppc.c b/hw/ppc/ppc.c
> index 5cbbff1f8d0..bf28d6bfc8d 100644
> --- a/hw/ppc/ppc.c
> +++ b/hw/ppc/ppc.c
> @@ -1059,7 +1059,7 @@ static void timebase_load(PPCTimebase *tb)
>      }
>  }
>  
> -void cpu_ppc_clock_vm_state_change(void *opaque, int running,
> +void cpu_ppc_clock_vm_state_change(void *opaque, bool running,
>                                     RunState state)
>  {
>      PPCTimebase *tb = opaque;
> diff --git a/hw/ppc/ppc_booke.c b/hw/ppc/ppc_booke.c
> index 652a21b8064..974c0c8a752 100644
> --- a/hw/ppc/ppc_booke.c
> +++ b/hw/ppc/ppc_booke.c
> @@ -317,7 +317,7 @@ static void ppc_booke_timer_reset_handle(void *opaque)
>   * action will be taken. To avoid this we always clear the watchdog state when
>   * state changes to running.
>   */
> -static void cpu_state_change_handler(void *opaque, int running, RunState state)
> +static void cpu_state_change_handler(void *opaque, bool running, RunState state)
>  {
>      PowerPCCPU *cpu = opaque;
>      CPUPPCState *env = &cpu->env;
> diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c
> index 6e21d83181d..0b944774861 100644
> --- a/hw/s390x/tod-kvm.c
> +++ b/hw/s390x/tod-kvm.c
> @@ -78,7 +78,7 @@ static void kvm_s390_tod_set(S390TODState *td, const S390TOD *tod, Error **errp)
>      }
>  }
>  
> -static void kvm_s390_tod_vm_state_change(void *opaque, int running,
> +static void kvm_s390_tod_vm_state_change(void *opaque, bool running,
>                                           RunState state)
>  {
>      S390TODState *td = opaque;
> diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
> index c349fb7f2d1..f990d5b3b03 100644
> --- a/hw/scsi/scsi-bus.c
> +++ b/hw/scsi/scsi-bus.c
> @@ -181,7 +181,7 @@ void scsi_req_retry(SCSIRequest *req)
>      req->retry = true;
>  }
>  
> -static void scsi_dma_restart_cb(void *opaque, int running, RunState state)
> +static void scsi_dma_restart_cb(void *opaque, bool running, RunState state)
>  {
>      SCSIDevice *s = opaque;
>  
> diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
> index aca018d8b5f..98d08c325ea 100644
> --- a/hw/usb/hcd-ehci.c
> +++ b/hw/usb/hcd-ehci.c
> @@ -2436,7 +2436,7 @@ static int usb_ehci_post_load(void *opaque, int version_id)
>      return 0;
>  }
>  
> -static void usb_ehci_vm_state_change(void *opaque, int running, RunState state)
> +static void usb_ehci_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      EHCIState *ehci = opaque;
>  
> diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
> index b950501d100..ecbf3f66f42 100644
> --- a/hw/usb/host-libusb.c
> +++ b/hw/usb/host-libusb.c
> @@ -1755,7 +1755,7 @@ type_init(usb_host_register_types)
>  static QEMUTimer *usb_auto_timer;
>  static VMChangeStateEntry *usb_vmstate;
>  
> -static void usb_host_vm_state(void *unused, int running, RunState state)
> +static void usb_host_vm_state(void *unused, bool running, RunState state)
>  {
>      if (running) {
>          usb_host_auto_check(unused);
> diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
> index 7e9e3fecbfe..17f06f34179 100644
> --- a/hw/usb/redirect.c
> +++ b/hw/usb/redirect.c
> @@ -1395,7 +1395,7 @@ static void usbredir_chardev_event(void *opaque, QEMUChrEvent event)
>   * init + destroy
>   */
>  
> -static void usbredir_vm_state_change(void *priv, int running, RunState state)
> +static void usbredir_vm_state_change(void *priv, bool running, RunState state)
>  {
>      USBRedirDevice *dev = priv;
>  
> diff --git a/hw/vfio/migration.c b/hw/vfio/migration.c
> index 00daa50ed81..134bdccc4f8 100644
> --- a/hw/vfio/migration.c
> +++ b/hw/vfio/migration.c
> @@ -727,7 +727,7 @@ static SaveVMHandlers savevm_vfio_handlers = {
>  
>  /* ---------------------------------------------------------------------- */
>  
> -static void vfio_vmstate_change(void *opaque, int running, RunState state)
> +static void vfio_vmstate_change(void *opaque, bool running, RunState state)
>  {
>      VFIODevice *vbasedev = opaque;
>      VFIOMigration *migration = vbasedev->migration;
> diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
> index 76ce9376931..cc8e9f775d8 100644
> --- a/hw/virtio/virtio-rng.c
> +++ b/hw/virtio/virtio-rng.c
> @@ -133,7 +133,7 @@ static uint64_t get_features(VirtIODevice *vdev, uint64_t f, Error **errp)
>      return f;
>  }
>  
> -static void virtio_rng_vm_state_change(void *opaque, int running,
> +static void virtio_rng_vm_state_change(void *opaque, bool running,
>                                         RunState state)
>  {
>      VirtIORNG *vrng = opaque;
> diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
> index b308026596f..38dc623c89e 100644
> --- a/hw/virtio/virtio.c
> +++ b/hw/virtio/virtio.c
> @@ -3208,7 +3208,7 @@ void virtio_cleanup(VirtIODevice *vdev)
>      qemu_del_vm_change_state_handler(vdev->vmstate);
>  }
>  
> -static void virtio_vmstate_change(void *opaque, int running, RunState state)
> +static void virtio_vmstate_change(void *opaque, bool running, RunState state)
>  {
>      VirtIODevice *vdev = opaque;
>      BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
> diff --git a/net/net.c b/net/net.c
> index e1035f21d18..8a85d1e3f7b 100644
> --- a/net/net.c
> +++ b/net/net.c
> @@ -1341,7 +1341,7 @@ void qmp_set_link(const char *name, bool up, Error **errp)
>      }
>  }
>  
> -static void net_vm_change_state_handler(void *opaque, int running,
> +static void net_vm_change_state_handler(void *opaque, bool running,
>                                          RunState state)
>  {
>      NetClientState *nc;
> diff --git a/softmmu/memory.c b/softmmu/memory.c
> index 333e1ed7b05..ab7f2e5aa07 100644
> --- a/softmmu/memory.c
> +++ b/softmmu/memory.c
> @@ -2675,7 +2675,7 @@ static void memory_global_dirty_log_do_stop(void)
>      MEMORY_LISTENER_CALL_GLOBAL(log_global_stop, Reverse);
>  }
>  
> -static void memory_vm_change_state_handler(void *opaque, int running,
> +static void memory_vm_change_state_handler(void *opaque, bool running,
>                                             RunState state)
>  {
>      if (running) {
> diff --git a/softmmu/runstate.c b/softmmu/runstate.c
> index c7a67147d17..cb07a65925c 100644
> --- a/softmmu/runstate.c
> +++ b/softmmu/runstate.c
> @@ -316,7 +316,7 @@ void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
>      g_free(e);
>  }
>  
> -void vm_state_notify(int running, RunState state)
> +void vm_state_notify(bool running, RunState state)
>  {
>      VMChangeStateEntry *e, *next;
>  
> diff --git a/target/arm/kvm.c b/target/arm/kvm.c
> index ffe186de8d1..53d6c4a17eb 100644
> --- a/target/arm/kvm.c
> +++ b/target/arm/kvm.c
> @@ -844,7 +844,7 @@ MemTxAttrs kvm_arch_post_run(CPUState *cs, struct kvm_run *run)
>      return MEMTXATTRS_UNSPECIFIED;
>  }
>  
> -void kvm_arm_vm_state_change(void *opaque, int running, RunState state)
> +void kvm_arm_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      CPUState *cs = opaque;
>      ARMCPU *cpu = ARM_CPU(cs);
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index 6dc1ee052d5..170ad55c09c 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -690,7 +690,7 @@ static int kvm_inject_mce_oldstyle(X86CPU *cpu)
>      return 0;
>  }
>  
> -static void cpu_update_state(void *opaque, int running, RunState state)
> +static void cpu_update_state(void *opaque, bool running, RunState state)
>  {
>      CPUX86State *env = opaque;
>  
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 15466068118..e7890f61906 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -670,7 +670,7 @@ sev_launch_finish(SevGuestState *sev)
>  }
>  
>  static void
> -sev_vm_state_change(void *opaque, int running, RunState state)
> +sev_vm_state_change(void *opaque, bool running, RunState state)
>  {
>      SevGuestState *sev = opaque;
>  
> diff --git a/target/i386/whpx/whpx-all.c b/target/i386/whpx/whpx-all.c
> index 3b824fc9d7c..850dfe72e75 100644
> --- a/target/i386/whpx/whpx-all.c
> +++ b/target/i386/whpx/whpx-all.c
> @@ -1318,7 +1318,7 @@ void whpx_cpu_synchronize_pre_loadvm(CPUState *cpu)
>  
>  static Error *whpx_migration_blocker;
>  
> -static void whpx_cpu_update_state(void *opaque, int running, RunState state)
> +static void whpx_cpu_update_state(void *opaque, bool running, RunState state)
>  {
>      CPUX86State *env = opaque;
>  
> diff --git a/target/mips/kvm.c b/target/mips/kvm.c
> index 477692566a4..09945ad2455 100644
> --- a/target/mips/kvm.c
> +++ b/target/mips/kvm.c
> @@ -37,7 +37,7 @@ const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
>      KVM_CAP_LAST_INFO
>  };
>  
> -static void kvm_mips_update_state(void *opaque, int running, RunState state);
> +static void kvm_mips_update_state(void *opaque, bool running, RunState state);
>  
>  unsigned long kvm_arch_vcpu_id(CPUState *cs)
>  {
> @@ -552,7 +552,7 @@ static int kvm_mips_restore_count(CPUState *cs)
>  /*
>   * Handle the VM clock being started or stopped
>   */
> -static void kvm_mips_update_state(void *opaque, int running, RunState state)
> +static void kvm_mips_update_state(void *opaque, bool running, RunState state)
>  {
>      CPUState *cs = opaque;
>      int ret;
> diff --git a/ui/gtk.c b/ui/gtk.c
> index a752aa22be0..a5bf8ed8429 100644
> --- a/ui/gtk.c
> +++ b/ui/gtk.c
> @@ -672,7 +672,7 @@ static const DisplayChangeListenerOps dcl_egl_ops = {
>  
>  /** QEMU Events **/
>  
> -static void gd_change_runstate(void *opaque, int running, RunState state)
> +static void gd_change_runstate(void *opaque, bool running, RunState state)
>  {
>      GtkDisplayState *s = opaque;
>  
> diff --git a/ui/spice-core.c b/ui/spice-core.c
> index 5746d0aae7c..22c77c04151 100644
> --- a/ui/spice-core.c
> +++ b/ui/spice-core.c
> @@ -622,7 +622,7 @@ static int add_channel(void *opaque, const char *name, const char *value,
>      return 0;
>  }
>  
> -static void vm_change_state_handler(void *opaque, int running,
> +static void vm_change_state_handler(void *opaque, bool running,
>                                      RunState state)
>  {
>      if (running) {
> 

Applied to my trivial-patches branch.

Thanks,
Laurent


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

end of thread, other threads:[~2021-03-09 22:15 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-11 15:20 [PATCH 0/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
2021-01-11 15:20 ` [PATCH 1/2] sysemu/runstate: Let runstate_is_running() return bool Philippe Mathieu-Daudé
2021-01-11 16:08   ` David Hildenbrand
2021-01-11 17:46   ` Alex Bennée
2021-03-09 22:13   ` Laurent Vivier
2021-01-11 15:20 ` [PATCH 2/2] sysemu: Let VMChangeStateHandler take boolean 'running' argument Philippe Mathieu-Daudé
2021-01-11 17:48   ` Alex Bennée
2021-01-12  0:17   ` David Gibson
2021-03-09 22:14   ` Laurent Vivier
2021-01-12 10:30 ` [PATCH 0/2] " Stefan Hajnoczi
2021-02-22 14:34 ` Philippe Mathieu-Daudé
2021-03-09 22:08   ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).