spapr: Clean up local variable shadowing in spapr_dt_cpus()
[qemu/kevin.git] / include / sysemu / runstate.h
blob08afb97695bd6a7c7f1fb852f475be710eb4ac35
1 #ifndef SYSEMU_RUNSTATE_H
2 #define SYSEMU_RUNSTATE_H
4 #include "qapi/qapi-types-run-state.h"
5 #include "qemu/notify.h"
7 bool runstate_check(RunState state);
8 void runstate_set(RunState new_state);
9 RunState runstate_get(void);
10 bool runstate_is_running(void);
11 bool runstate_needs_reset(void);
13 typedef void VMChangeStateHandler(void *opaque, bool running, RunState state);
15 VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
16 void *opaque);
17 VMChangeStateEntry *qemu_add_vm_change_state_handler_prio(
18 VMChangeStateHandler *cb, void *opaque, int priority);
19 VMChangeStateEntry *
20 qemu_add_vm_change_state_handler_prio_full(VMChangeStateHandler *cb,
21 VMChangeStateHandler *prepare_cb,
22 void *opaque, int priority);
23 VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
24 VMChangeStateHandler *cb,
25 void *opaque);
26 VMChangeStateEntry *qdev_add_vm_change_state_handler_full(
27 DeviceState *dev, VMChangeStateHandler *cb,
28 VMChangeStateHandler *prepare_cb, void *opaque);
29 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
30 /**
31 * vm_state_notify: Notify the state of the VM
33 * @running: whether the VM is running or not.
34 * @state: the #RunState of the VM.
36 void vm_state_notify(bool running, RunState state);
38 static inline bool shutdown_caused_by_guest(ShutdownCause cause)
40 return cause >= SHUTDOWN_CAUSE_GUEST_SHUTDOWN;
43 void vm_start(void);
45 /**
46 * vm_prepare_start: Prepare for starting/resuming the VM
48 * @step_pending: whether any of the CPUs is about to be single-stepped by gdb
50 int vm_prepare_start(bool step_pending);
51 int vm_stop(RunState state);
52 int vm_stop_force_state(RunState state);
53 int vm_shutdown(void);
55 typedef enum WakeupReason {
56 /* Always keep QEMU_WAKEUP_REASON_NONE = 0 */
57 QEMU_WAKEUP_REASON_NONE = 0,
58 QEMU_WAKEUP_REASON_RTC,
59 QEMU_WAKEUP_REASON_PMTIMER,
60 QEMU_WAKEUP_REASON_OTHER,
61 } WakeupReason;
63 void qemu_system_reset_request(ShutdownCause reason);
64 void qemu_system_suspend_request(void);
65 void qemu_register_suspend_notifier(Notifier *notifier);
66 bool qemu_wakeup_suspend_enabled(void);
67 void qemu_system_wakeup_request(WakeupReason reason, Error **errp);
68 void qemu_system_wakeup_enable(WakeupReason reason, bool enabled);
69 void qemu_register_wakeup_notifier(Notifier *notifier);
70 void qemu_register_wakeup_support(void);
71 void qemu_system_shutdown_request(ShutdownCause reason);
72 void qemu_system_powerdown_request(void);
73 void qemu_register_powerdown_notifier(Notifier *notifier);
74 void qemu_register_shutdown_notifier(Notifier *notifier);
75 void qemu_system_debug_request(void);
76 void qemu_system_vmstop_request(RunState reason);
77 void qemu_system_vmstop_request_prepare(void);
78 bool qemu_vmstop_requested(RunState *r);
79 ShutdownCause qemu_shutdown_requested_get(void);
80 ShutdownCause qemu_reset_requested_get(void);
81 void qemu_system_killed(int signal, pid_t pid);
82 void qemu_system_reset(ShutdownCause reason);
83 void qemu_system_guest_panicked(GuestPanicInformation *info);
84 void qemu_system_guest_crashloaded(GuestPanicInformation *info);
85 bool qemu_system_dump_in_progress(void);
87 #endif