1 #ifndef QEMU_CPUS_H 2 #define QEMU_CPUS_H 3 4 #include "qemu/timer.h" 5 6 /* cpus.c */ 7 8 /* CPU execution threads */ 9 10 typedef struct CpusAccel { 11 void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY */ 12 void (*kick_vcpu_thread)(CPUState *cpu); 13 14 void (*synchronize_post_reset)(CPUState *cpu); 15 void (*synchronize_post_init)(CPUState *cpu); 16 void (*synchronize_state)(CPUState *cpu); 17 void (*synchronize_pre_loadvm)(CPUState *cpu); 18 19 int64_t (*get_virtual_clock)(void); 20 int64_t (*get_elapsed_ticks)(void); 21 } CpusAccel; 22 23 /* register accel-specific cpus interface implementation */ 24 void cpus_register_accel(const CpusAccel *i); 25 26 /* interface available for cpus accelerator threads */ 27 28 /* For temporary buffers for forming a name */ 29 #define VCPU_THREAD_NAME_SIZE 16 30 31 void cpus_kick_thread(CPUState *cpu); 32 bool cpu_work_list_empty(CPUState *cpu); 33 bool cpu_thread_is_idle(CPUState *cpu); 34 bool all_cpu_threads_idle(void); 35 bool cpu_can_run(CPUState *cpu); 36 void qemu_wait_io_event_common(CPUState *cpu); 37 void qemu_wait_io_event(CPUState *cpu); 38 void cpu_thread_signal_created(CPUState *cpu); 39 void cpu_thread_signal_destroyed(CPUState *cpu); 40 void cpu_handle_guest_debug(CPUState *cpu); 41 42 /* end interface for cpus accelerator threads */ 43 44 bool qemu_in_vcpu_thread(void); 45 void qemu_init_cpu_loop(void); 46 void resume_all_vcpus(void); 47 void pause_all_vcpus(void); 48 void cpu_stop_current(void); 49 50 extern int icount_align_option; 51 52 /* Unblock cpu */ 53 void qemu_cpu_kick_self(void); 54 55 void cpu_synchronize_all_states(void); 56 void cpu_synchronize_all_post_reset(void); 57 void cpu_synchronize_all_post_init(void); 58 void cpu_synchronize_all_pre_loadvm(void); 59 60 #ifndef CONFIG_USER_ONLY 61 /* vl.c */ 62 /* *-user doesn't have configurable SMP topology */ 63 extern int smp_cores; 64 extern int smp_threads; 65 #endif 66 67 void list_cpus(const char *optarg); 68 69 #endif 70