diff options
-rw-r--r-- | gdbstub.c | 26 | ||||
-rw-r--r-- | hw/ide/core.c | 2 | ||||
-rw-r--r-- | hw/scsi-disk.c | 2 | ||||
-rw-r--r-- | hw/virtio-blk.c | 2 | ||||
-rw-r--r-- | hw/watchdog.c | 2 | ||||
-rw-r--r-- | kvm-all.c | 2 | ||||
-rw-r--r-- | migration.c | 6 | ||||
-rw-r--r-- | monitor.c | 10 | ||||
-rw-r--r-- | savevm.c | 4 | ||||
-rw-r--r-- | sysemu.h | 28 | ||||
-rw-r--r-- | vl.c | 118 |
11 files changed, 101 insertions, 101 deletions
@@ -2385,7 +2385,7 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state) return; } switch (state) { - case RSTATE_DEBUG: + case RUN_STATE_DEBUG: if (env->watchpoint_hit) { switch (env->watchpoint_hit->flags & BP_MEM_ACCESS) { case BP_MEM_READ: @@ -2408,25 +2408,25 @@ static void gdb_vm_state_change(void *opaque, int running, RunState state) tb_flush(env); ret = GDB_SIGNAL_TRAP; break; - case RSTATE_PAUSED: + case RUN_STATE_PAUSED: ret = GDB_SIGNAL_INT; break; - case RSTATE_SHUTDOWN: + case RUN_STATE_SHUTDOWN: ret = GDB_SIGNAL_QUIT; break; - case RSTATE_IO_ERROR: + case RUN_STATE_IO_ERROR: ret = GDB_SIGNAL_IO; break; - case RSTATE_WATCHDOG: + case RUN_STATE_WATCHDOG: ret = GDB_SIGNAL_ALRM; break; - case RSTATE_PANICKED: + case RUN_STATE_INTERNAL_ERROR: ret = GDB_SIGNAL_ABRT; break; - case RSTATE_SAVEVM: - case RSTATE_RESTORE: + case RUN_STATE_SAVE_VM: + case RUN_STATE_RESTORE_VM: return; - case RSTATE_PRE_MIGRATE: + case RUN_STATE_FINISH_MIGRATE: ret = GDB_SIGNAL_XCPU; break; default: @@ -2463,7 +2463,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...) gdb_current_syscall_cb = cb; s->state = RS_SYSCALL; #ifndef CONFIG_USER_ONLY - vm_stop(RSTATE_DEBUG); + vm_stop(RUN_STATE_DEBUG); #endif s->state = RS_IDLE; va_start(va, fmt); @@ -2537,7 +2537,7 @@ static void gdb_read_byte(GDBState *s, int ch) if (runstate_is_running()) { /* when the CPU is running, we cannot do anything except stop it when receiving a char */ - vm_stop(RSTATE_PAUSED); + vm_stop(RUN_STATE_PAUSED); } else #endif { @@ -2799,7 +2799,7 @@ static void gdb_chr_event(void *opaque, int event) { switch (event) { case CHR_EVENT_OPENED: - vm_stop(RSTATE_PAUSED); + vm_stop(RUN_STATE_PAUSED); gdb_has_xml = 0; break; default: @@ -2840,7 +2840,7 @@ static int gdb_monitor_write(CharDriverState *chr, const uint8_t *buf, int len) static void gdb_sigterm_handler(int signal) { if (runstate_is_running()) { - vm_stop(RSTATE_PAUSED); + vm_stop(RUN_STATE_PAUSED); } } #endif diff --git a/hw/ide/core.c b/hw/ide/core.c index 4e76fc78d3..b71a356f39 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -527,7 +527,7 @@ static int ide_handle_rw_error(IDEState *s, int error, int op) s->bus->dma->ops->set_unit(s->bus->dma, s->unit); s->bus->error_status = op; bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); - vm_stop(RSTATE_IO_ERROR); + vm_stop(RUN_STATE_IO_ERROR); } else { if (op & BM_STATUS_DMA_RETRY) { dma_buf_commit(s, 0); diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index e843f712c2..4f681ef092 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -227,7 +227,7 @@ static int scsi_handle_rw_error(SCSIDiskReq *r, int error, int type) r->status |= SCSI_REQ_STATUS_RETRY | type; bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); - vm_stop(RSTATE_IO_ERROR); + vm_stop(RUN_STATE_IO_ERROR); } else { switch (error) { case ENOMEM: diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index daa8e42be7..03878bfc5e 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -77,7 +77,7 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error, req->next = s->rq; s->rq = req; bdrv_mon_event(s->bs, BDRV_ACTION_STOP, is_read); - vm_stop(RSTATE_IO_ERROR); + vm_stop(RUN_STATE_IO_ERROR); } else { virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR); bdrv_acct_done(s->bs, &req->acct); diff --git a/hw/watchdog.c b/hw/watchdog.c index 71c6c7df63..4c18965654 100644 --- a/hw/watchdog.c +++ b/hw/watchdog.c @@ -132,7 +132,7 @@ void watchdog_perform_action(void) case WDT_PAUSE: /* same as 'stop' command in monitor */ watchdog_mon_event("pause"); - vm_stop(RSTATE_WATCHDOG); + vm_stop(RUN_STATE_WATCHDOG); break; case WDT_DEBUG: @@ -1014,7 +1014,7 @@ int kvm_cpu_exec(CPUState *env) if (ret < 0) { cpu_dump_state(env, stderr, fprintf, CPU_DUMP_CODE); - vm_stop(RSTATE_PANICKED); + vm_stop(RUN_STATE_INTERNAL_ERROR); } env->exit_request = 0; diff --git a/migration.c b/migration.c index 7dd8f4eee9..77a51adc5b 100644 --- a/migration.c +++ b/migration.c @@ -73,7 +73,7 @@ void process_incoming_migration(QEMUFile *f) if (autostart) { vm_start(); } else { - runstate_set(RSTATE_PRE_LAUNCH); + runstate_set(RUN_STATE_PRELAUNCH); } } @@ -375,7 +375,7 @@ void migrate_fd_put_ready(void *opaque) int old_vm_running = runstate_is_running(); DPRINTF("done iterating\n"); - vm_stop(RSTATE_PRE_MIGRATE); + vm_stop(RUN_STATE_FINISH_MIGRATE); if ((qemu_savevm_state_complete(s->mon, s->file)) < 0) { if (old_vm_running) { @@ -392,7 +392,7 @@ void migrate_fd_put_ready(void *opaque) state = MIG_STATE_ERROR; } if (state == MIG_STATE_COMPLETED) { - runstate_set(RSTATE_POST_MIGRATE); + runstate_set(RUN_STATE_POSTMIGRATE); } s->state = state; notifier_list_notify(&migration_state_notifiers, NULL); @@ -1248,7 +1248,7 @@ static void do_singlestep(Monitor *mon, const QDict *qdict) */ static int do_stop(Monitor *mon, const QDict *qdict, QObject **ret_data) { - vm_stop(RSTATE_PAUSED); + vm_stop(RUN_STATE_PAUSED); return 0; } @@ -1266,11 +1266,11 @@ static int do_cont(Monitor *mon, const QDict *qdict, QObject **ret_data) { struct bdrv_iterate_context context = { mon, 0 }; - if (runstate_check(RSTATE_IN_MIGRATE)) { + if (runstate_check(RUN_STATE_INMIGRATE)) { qerror_report(QERR_MIGRATION_EXPECTED); return -1; - } else if (runstate_check(RSTATE_PANICKED) || - runstate_check(RSTATE_SHUTDOWN)) { + } else if (runstate_check(RUN_STATE_INTERNAL_ERROR) || + runstate_check(RUN_STATE_SHUTDOWN)) { qerror_report(QERR_RESET_REQUIRED); return -1; } @@ -2773,7 +2773,7 @@ static void do_loadvm(Monitor *mon, const QDict *qdict) int saved_vm_running = runstate_is_running(); const char *name = qdict_get_str(qdict, "name"); - vm_stop(RSTATE_RESTORE); + vm_stop(RUN_STATE_RESTORE_VM); if (load_vmstate(name) == 0 && saved_vm_running) { vm_start(); @@ -1603,7 +1603,7 @@ static int qemu_savevm_state(Monitor *mon, QEMUFile *f) int ret; saved_vm_running = runstate_is_running(); - vm_stop(RSTATE_SAVEVM); + vm_stop(RUN_STATE_SAVE_VM); if (qemu_savevm_state_blocked(mon)) { ret = -EINVAL; @@ -1932,7 +1932,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) } saved_vm_running = runstate_is_running(); - vm_stop(RSTATE_SAVEVM); + vm_stop(RUN_STATE_SAVE_VM); memset(sn, 0, sizeof(*sn)); @@ -11,20 +11,20 @@ /* vl.c */ typedef enum { - RSTATE_DEBUG, /* qemu is running under gdb */ - RSTATE_IN_MIGRATE, /* paused waiting for an incoming migration */ - RSTATE_PANICKED, /* paused due to an internal error */ - RSTATE_IO_ERROR, /* paused due to an I/O error */ - RSTATE_PAUSED, /* paused by the user (ie. the 'stop' command) */ - RSTATE_POST_MIGRATE, /* paused following a successful migration */ - RSTATE_PRE_LAUNCH, /* qemu was started with -S and haven't started */ - RSTATE_PRE_MIGRATE, /* paused preparing to finish migrate */ - RSTATE_RESTORE, /* paused restoring the VM state */ - RSTATE_RUNNING, /* qemu is running */ - RSTATE_SAVEVM, /* paused saving VM state */ - RSTATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */ - RSTATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */ - RSTATE_MAX + RUN_STATE_DEBUG, /* qemu is running under gdb */ + RUN_STATE_INMIGRATE, /* paused waiting for an incoming migration */ + RUN_STATE_INTERNAL_ERROR, /* paused due to an internal error */ + RUN_STATE_IO_ERROR, /* paused due to an I/O error */ + RUN_STATE_PAUSED, /* paused by the user (ie. the 'stop' command) */ + RUN_STATE_POSTMIGRATE, /* paused following a successful migration */ + RUN_STATE_PRELAUNCH, /* qemu was started with -S and haven't started */ + RUN_STATE_FINISH_MIGRATE, /* paused preparing to finish migrate */ + RUN_STATE_RESTORE_VM, /* paused restoring the VM state */ + RUN_STATE_RUNNING, /* qemu is running */ + RUN_STATE_SAVE_VM, /* paused saving VM state */ + RUN_STATE_SHUTDOWN, /* guest shut down and -no-shutdown is in use */ + RUN_STATE_WATCHDOG, /* watchdog fired and qemu is configured to pause */ + RUN_STATE_MAX } RunState; extern const char *bios_name; @@ -323,7 +323,7 @@ static int default_driver_check(QemuOpts *opts, void *opaque) /***********************************************************/ /* QEMU state */ -static RunState current_run_state = RSTATE_PRE_LAUNCH; +static RunState current_run_state = RUN_STATE_PRELAUNCH; typedef struct { RunState from; @@ -332,63 +332,63 @@ typedef struct { static const RunStateTransition runstate_transitions_def[] = { /* from -> to */ - { RSTATE_DEBUG, RSTATE_RUNNING }, + { RUN_STATE_DEBUG, RUN_STATE_RUNNING }, - { RSTATE_IN_MIGRATE, RSTATE_RUNNING }, - { RSTATE_IN_MIGRATE, RSTATE_PRE_LAUNCH }, + { RUN_STATE_INMIGRATE, RUN_STATE_RUNNING }, + { RUN_STATE_INMIGRATE, RUN_STATE_PRELAUNCH }, - { RSTATE_PANICKED, RSTATE_PAUSED }, + { RUN_STATE_INTERNAL_ERROR, RUN_STATE_PAUSED }, - { RSTATE_IO_ERROR, RSTATE_RUNNING }, + { RUN_STATE_IO_ERROR, RUN_STATE_RUNNING }, - { RSTATE_PAUSED, RSTATE_RUNNING }, + { RUN_STATE_PAUSED, RUN_STATE_RUNNING }, - { RSTATE_POST_MIGRATE, RSTATE_RUNNING }, + { RUN_STATE_POSTMIGRATE, RUN_STATE_RUNNING }, - { RSTATE_PRE_LAUNCH, RSTATE_RUNNING }, - { RSTATE_PRE_LAUNCH, RSTATE_IN_MIGRATE }, - { RSTATE_PRE_LAUNCH, RSTATE_POST_MIGRATE }, + { RUN_STATE_PRELAUNCH, RUN_STATE_RUNNING }, + { RUN_STATE_PRELAUNCH, RUN_STATE_INMIGRATE }, + { RUN_STATE_PRELAUNCH, RUN_STATE_POSTMIGRATE }, - { RSTATE_PRE_MIGRATE, RSTATE_RUNNING }, - { RSTATE_PRE_MIGRATE, RSTATE_POST_MIGRATE }, + { RUN_STATE_FINISH_MIGRATE, RUN_STATE_RUNNING }, + { RUN_STATE_FINISH_MIGRATE, RUN_STATE_POSTMIGRATE }, - { RSTATE_RESTORE, RSTATE_RUNNING }, + { RUN_STATE_RESTORE_VM, RUN_STATE_RUNNING }, - { RSTATE_RUNNING, RSTATE_DEBUG }, - { RSTATE_RUNNING, RSTATE_PANICKED }, - { RSTATE_RUNNING, RSTATE_IO_ERROR }, - { RSTATE_RUNNING, RSTATE_PAUSED }, - { RSTATE_RUNNING, RSTATE_PRE_MIGRATE }, - { RSTATE_RUNNING, RSTATE_RESTORE }, - { RSTATE_RUNNING, RSTATE_SAVEVM }, - { RSTATE_RUNNING, RSTATE_SHUTDOWN }, - { RSTATE_RUNNING, RSTATE_WATCHDOG }, + { RUN_STATE_RUNNING, RUN_STATE_DEBUG }, + { RUN_STATE_RUNNING, RUN_STATE_INTERNAL_ERROR }, + { RUN_STATE_RUNNING, RUN_STATE_IO_ERROR }, + { RUN_STATE_RUNNING, RUN_STATE_PAUSED }, + { RUN_STATE_RUNNING, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_RUNNING, RUN_STATE_RESTORE_VM }, + { RUN_STATE_RUNNING, RUN_STATE_SAVE_VM }, + { RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN }, + { RUN_STATE_RUNNING, RUN_STATE_WATCHDOG }, - { RSTATE_SAVEVM, RSTATE_RUNNING }, + { RUN_STATE_SAVE_VM, RUN_STATE_RUNNING }, - { RSTATE_SHUTDOWN, RSTATE_PAUSED }, + { RUN_STATE_SHUTDOWN, RUN_STATE_PAUSED }, - { RSTATE_WATCHDOG, RSTATE_RUNNING }, + { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, - { RSTATE_MAX, RSTATE_MAX }, + { RUN_STATE_MAX, RUN_STATE_MAX }, }; -static bool runstate_valid_transitions[RSTATE_MAX][RSTATE_MAX]; - -static const char *const runstate_name_tbl[RSTATE_MAX] = { - [RSTATE_DEBUG] = "debug", - [RSTATE_IN_MIGRATE] = "incoming-migration", - [RSTATE_PANICKED] = "internal-error", - [RSTATE_IO_ERROR] = "io-error", - [RSTATE_PAUSED] = "paused", - [RSTATE_POST_MIGRATE] = "post-migrate", - [RSTATE_PRE_LAUNCH] = "prelaunch", - [RSTATE_PRE_MIGRATE] = "finish-migrate", - [RSTATE_RESTORE] = "restore-vm", - [RSTATE_RUNNING] = "running", - [RSTATE_SAVEVM] = "save-vm", - [RSTATE_SHUTDOWN] = "shutdown", - [RSTATE_WATCHDOG] = "watchdog", +static bool runstate_valid_transitions[RUN_STATE_MAX][RUN_STATE_MAX]; + +static const char *const runstate_name_tbl[RUN_STATE_MAX] = { + [RUN_STATE_DEBUG] = "debug", + [RUN_STATE_INMIGRATE] = "incoming-migration", + [RUN_STATE_INTERNAL_ERROR] = "internal-error", + [RUN_STATE_IO_ERROR] = "io-error", + [RUN_STATE_PAUSED] = "paused", + [RUN_STATE_POSTMIGRATE] = "post-migrate", + [RUN_STATE_PRELAUNCH] = "prelaunch", + [RUN_STATE_FINISH_MIGRATE] = "finish-migrate", + [RUN_STATE_RESTORE_VM] = "restore-vm", + [RUN_STATE_RUNNING] = "running", + [RUN_STATE_SAVE_VM] = "save-vm", + [RUN_STATE_SHUTDOWN] = "shutdown", + [RUN_STATE_WATCHDOG] = "watchdog", }; bool runstate_check(RunState state) @@ -402,7 +402,7 @@ void runstate_init(void) memset(&runstate_valid_transitions, 0, sizeof(runstate_valid_transitions)); - for (p = &runstate_transitions_def[0]; p->from != RSTATE_MAX; p++) { + for (p = &runstate_transitions_def[0]; p->from != RUN_STATE_MAX; p++) { runstate_valid_transitions[p->from][p->to] = true; } } @@ -410,7 +410,7 @@ void runstate_init(void) /* This function will abort() on invalid state transitions */ void runstate_set(RunState new_state) { - if (new_state >= RSTATE_MAX || + if (new_state >= RUN_STATE_MAX || !runstate_valid_transitions[current_run_state][new_state]) { fprintf(stderr, "invalid runstate transition\n"); abort(); @@ -421,13 +421,13 @@ void runstate_set(RunState new_state) const char *runstate_as_string(void) { - assert(current_run_state < RSTATE_MAX); + assert(current_run_state < RUN_STATE_MAX); return runstate_name_tbl[current_run_state]; } int runstate_is_running(void) { - return runstate_check(RSTATE_RUNNING); + return runstate_check(RUN_STATE_RUNNING); } /***********************************************************/ @@ -1268,8 +1268,8 @@ void vm_start(void) { if (!runstate_is_running()) { cpu_enable_ticks(); - runstate_set(RSTATE_RUNNING); - vm_state_notify(1, RSTATE_RUNNING); + runstate_set(RUN_STATE_RUNNING); + vm_state_notify(1, RUN_STATE_RUNNING); resume_all_vcpus(); monitor_protocol_event(QEVENT_RESUME, NULL); } @@ -1290,7 +1290,7 @@ static int shutdown_requested, shutdown_signal = -1; static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; -static RunState vmstop_requested = RSTATE_MAX; +static RunState vmstop_requested = RUN_STATE_MAX; int qemu_shutdown_requested_get(void) { @@ -1346,12 +1346,12 @@ static int qemu_debug_requested(void) return r; } -/* We use RSTATE_MAX but any invalid value will do */ +/* We use RUN_STATE_MAX but any invalid value will do */ static bool qemu_vmstop_requested(RunState *r) { - if (vmstop_requested < RSTATE_MAX) { + if (vmstop_requested < RUN_STATE_MAX) { *r = vmstop_requested; - vmstop_requested = RSTATE_MAX; + vmstop_requested = RUN_STATE_MAX; return true; } @@ -1583,13 +1583,13 @@ static void main_loop(void) #endif if (qemu_debug_requested()) { - vm_stop(RSTATE_DEBUG); + vm_stop(RUN_STATE_DEBUG); } if (qemu_shutdown_requested()) { qemu_kill_report(); monitor_protocol_event(QEVENT_SHUTDOWN, NULL); if (no_shutdown) { - vm_stop(RSTATE_SHUTDOWN); + vm_stop(RUN_STATE_SHUTDOWN); } else break; } @@ -1598,9 +1598,9 @@ static void main_loop(void) cpu_synchronize_all_states(); qemu_system_reset(VMRESET_REPORT); resume_all_vcpus(); - if (runstate_check(RSTATE_PANICKED) || - runstate_check(RSTATE_SHUTDOWN)) { - runstate_set(RSTATE_PAUSED); + if (runstate_check(RUN_STATE_INTERNAL_ERROR) || + runstate_check(RUN_STATE_SHUTDOWN)) { + runstate_set(RUN_STATE_PAUSED); } } if (qemu_powerdown_requested()) { @@ -3557,7 +3557,7 @@ int main(int argc, char **argv, char **envp) } if (incoming) { - runstate_set(RSTATE_IN_MIGRATE); + runstate_set(RUN_STATE_INMIGRATE); int ret = qemu_start_incoming_migration(incoming); if (ret < 0) { fprintf(stderr, "Migration failed. Exit code %s(%d), exiting.\n", |