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