1 /* 2 * Accelerator handlers 3 * 4 * SPDX-License-Identifier: GPL-2.0-or-later 5 */ 6 7 #ifndef ACCEL_OPS_H 8 #define ACCEL_OPS_H 9 10 #include "exec/hwaddr.h" 11 #include "qemu/accel.h" 12 #include "qom/object.h" 13 14 struct AccelState { 15 Object parent_obj; 16 }; 17 18 struct AccelClass { 19 ObjectClass parent_class; 20 21 const char *name; 22 /* Cached by accel_init_ops_interfaces() when created */ 23 AccelOpsClass *ops; 24 25 int (*init_machine)(AccelState *as, MachineState *ms); 26 bool (*cpu_common_realize)(CPUState *cpu, Error **errp); 27 void (*cpu_common_unrealize)(CPUState *cpu); 28 /* get_stats: Append statistics to @buf */ 29 void (*get_stats)(AccelState *as, GString *buf); 30 31 /* system related hooks */ 32 void (*setup_post)(AccelState *as); 33 void (*pre_resume_vm)(AccelState *as, bool step_pending); 34 bool (*has_memory)(AccelState *accel, AddressSpace *as, 35 hwaddr start_addr, hwaddr size); 36 37 /* gdbstub related hooks */ 38 int (*gdbstub_supported_sstep_flags)(AccelState *as); 39 40 bool *allowed; 41 /* 42 * Array of global properties that would be applied when specific 43 * accelerator is chosen. It works like MachineClass.compat_props 44 * but it's for accelerators not machines. Accelerator-provided 45 * global properties may be overridden by machine-type 46 * compat_props or user-provided global properties. 47 */ 48 GPtrArray *compat_props; 49 }; 50 51 #endif /* ACCEL_OPS_H */ 52