2010-03-29 23:23:50 +04:00
|
|
|
#ifndef QEMU_CPUS_H
|
|
|
|
#define QEMU_CPUS_H
|
|
|
|
|
2017-03-03 14:01:16 +03:00
|
|
|
#include "qemu/timer.h"
|
|
|
|
|
2010-04-12 21:19:06 +04:00
|
|
|
/* cpus.c */
|
2020-07-31 13:23:42 +03:00
|
|
|
|
|
|
|
/* CPU execution threads */
|
|
|
|
|
|
|
|
typedef struct CpusAccel {
|
|
|
|
void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY */
|
|
|
|
void (*kick_vcpu_thread)(CPUState *cpu);
|
|
|
|
|
|
|
|
void (*synchronize_post_reset)(CPUState *cpu);
|
|
|
|
void (*synchronize_post_init)(CPUState *cpu);
|
|
|
|
void (*synchronize_state)(CPUState *cpu);
|
|
|
|
void (*synchronize_pre_loadvm)(CPUState *cpu);
|
|
|
|
|
2020-08-11 16:16:33 +03:00
|
|
|
void (*handle_interrupt)(CPUState *cpu, int mask);
|
|
|
|
|
2020-07-31 13:23:42 +03:00
|
|
|
int64_t (*get_virtual_clock)(void);
|
|
|
|
int64_t (*get_elapsed_ticks)(void);
|
|
|
|
} CpusAccel;
|
|
|
|
|
|
|
|
/* register accel-specific cpus interface implementation */
|
|
|
|
void cpus_register_accel(const CpusAccel *i);
|
|
|
|
|
2020-10-13 17:05:10 +03:00
|
|
|
/* Create a dummy vcpu for CpusAccel->create_vcpu_thread */
|
|
|
|
void dummy_start_vcpu_thread(CPUState *);
|
|
|
|
|
2020-07-31 13:23:42 +03:00
|
|
|
/* interface available for cpus accelerator threads */
|
|
|
|
|
|
|
|
/* For temporary buffers for forming a name */
|
|
|
|
#define VCPU_THREAD_NAME_SIZE 16
|
|
|
|
|
|
|
|
void cpus_kick_thread(CPUState *cpu);
|
|
|
|
bool cpu_work_list_empty(CPUState *cpu);
|
|
|
|
bool cpu_thread_is_idle(CPUState *cpu);
|
2020-08-19 14:17:19 +03:00
|
|
|
bool all_cpu_threads_idle(void);
|
2020-07-31 13:23:42 +03:00
|
|
|
bool cpu_can_run(CPUState *cpu);
|
|
|
|
void qemu_wait_io_event_common(CPUState *cpu);
|
|
|
|
void qemu_wait_io_event(CPUState *cpu);
|
|
|
|
void cpu_thread_signal_created(CPUState *cpu);
|
|
|
|
void cpu_thread_signal_destroyed(CPUState *cpu);
|
|
|
|
void cpu_handle_guest_debug(CPUState *cpu);
|
|
|
|
|
|
|
|
/* end interface for cpus accelerator threads */
|
|
|
|
|
2015-08-11 11:52:46 +03:00
|
|
|
bool qemu_in_vcpu_thread(void);
|
2011-09-13 12:30:52 +04:00
|
|
|
void qemu_init_cpu_loop(void);
|
2010-03-29 23:23:50 +04:00
|
|
|
void resume_all_vcpus(void);
|
|
|
|
void pause_all_vcpus(void);
|
2011-02-02 00:15:43 +03:00
|
|
|
void cpu_stop_current(void);
|
2016-03-15 18:47:38 +03:00
|
|
|
|
|
|
|
extern int icount_align_option;
|
|
|
|
|
|
|
|
/* Unblock cpu */
|
|
|
|
void qemu_cpu_kick_self(void);
|
2010-03-29 23:23:50 +04:00
|
|
|
|
2011-03-27 20:05:08 +04:00
|
|
|
void cpu_synchronize_all_states(void);
|
|
|
|
void cpu_synchronize_all_post_reset(void);
|
|
|
|
void cpu_synchronize_all_post_init(void);
|
2017-05-26 07:46:28 +03:00
|
|
|
void cpu_synchronize_all_pre_loadvm(void);
|
2011-03-27 20:05:08 +04:00
|
|
|
|
2013-01-23 00:25:05 +04:00
|
|
|
#ifndef CONFIG_USER_ONLY
|
2010-03-29 23:23:50 +04:00
|
|
|
/* vl.c */
|
2016-09-16 18:50:24 +03:00
|
|
|
/* *-user doesn't have configurable SMP topology */
|
2010-03-29 23:23:50 +04:00
|
|
|
extern int smp_cores;
|
|
|
|
extern int smp_threads;
|
2013-01-23 00:25:05 +04:00
|
|
|
#endif
|
|
|
|
|
2019-04-17 22:17:57 +03:00
|
|
|
void list_cpus(const char *optarg);
|
2010-03-29 23:23:50 +04:00
|
|
|
|
|
|
|
#endif
|