Lines Matching full:cpu
2 * QEMU CPU model
44 * SECTION:cpu
45 * @section_id: QEMU-cpu
46 * @title: CPU Class
50 #define TYPE_CPU "cpu"
56 #define CPU(obj) ((CPUState *)(obj)) macro
66 DECLARE_CLASS_CHECKERS(CPUClass, CPU,
73 * @CPU_MODULE_OBJ_NAME: the CPU name in uppercase with underscore separators
75 * This macro is typically used in "cpu-qom.h" header file, and will:
77 * - create the typedefs for the CPU object and class structs
95 /* see accel-cpu.h */
98 /* see sysemu-cpu-ops.h */
103 * @class_by_name: Callback to map -cpu command line model name to an
104 * instantiatable CPU type.
115 * @get_arch_id: Callback for getting architecture-dependent CPU ID.
134 * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
144 * Represents a CPU family or model.
154 bool (*has_work)(CPUState *cpu);
155 int (*mmu_index)(CPUState *cpu, bool ifetch);
156 int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
158 void (*dump_state)(CPUState *cpu, FILE *, int flags);
159 void (*query_cpu_fast)(CPUState *cpu, CpuInfoFast *value);
160 int64_t (*get_arch_id)(CPUState *cpu);
161 void (*set_pc)(CPUState *cpu, vaddr value);
162 vaddr (*get_pc)(CPUState *cpu);
163 int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
164 int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
165 vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr);
168 const gchar * (*gdb_arch_name)(CPUState *cpu);
170 void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
223 * given by cpu_asidx_from_attrs(cpu, @attrs).
247 * This may be used to cache items from the guest cpu
308 * of the stats without interfering with the cpu.
332 * for this CPU and return to its top level loop (even in non-icount mode).
392 typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
399 * struct CPUState - common state of one CPU core or thread.
401 * @cpu_index: CPU index (informative).
402 * @cluster_index: Identifies which cluster this CPU is in.
405 * be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER
409 * @tcg_cflags: Pre-computed cflags for this cpu.
410 * @nr_cores: Number of cores within this CPU package.
411 * @nr_threads: Number of threads within this CPU core.
415 * @running: #true if CPU is currently running (lockless).
416 * @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end;
418 * @created: Indicates whether the CPU thread has been successfully created.
421 * @halted: Nonzero if the CPU is in suspended state.
423 * @stopped: Indicates the CPU has been artificially stopped.
424 * @unplug: Indicates a pending CPU unplug request.
425 * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU
429 * AddressSpaces this CPU has)
443 * @plugin_state: per-CPU plugin state
446 * CPU do_transaction_failed hook function.
447 * @kvm_dirty_gfns: Points to the KVM dirty ring for this CPU when KVM dirty
453 * which is allocated when an individual CPU instance is created. As
459 * some common TCG CPU variables which are accessed with a negative offset
484 /* Should CPU start in powered-off state? */
525 * we store some rarely used information in the CPU context.
539 /* Use by accel-block: CPU is executing an ioctl() */
555 /* Used to keep track of an outstanding cpu throttle thread for migration
585 static inline CPUArchState *cpu_env(CPUState *cpu) in cpu_env() argument
587 /* We validate that CPUArchState follows CPUState in cpu-all.h. */ in cpu_env()
588 return (CPUArchState *)(cpu + 1); in cpu_env()
595 #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) argument
596 #define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus_queue, node) argument
597 #define CPU_FOREACH_SAFE(cpu, next_cpu) \ argument
598 QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus_queue, node, next_cpu)
613 * @cpu: The CPU whose state is to be inspected.
617 bool cpu_paging_enabled(const CPUState *cpu);
621 * @cpu: The CPU whose memory mappings are to be obtained.
627 bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
635 * @cpu: The CPU whose memory is to be dumped
636 * @cpuid: ID number of the CPU
639 int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
645 * @cpu: The CPU whose memory is to be dumped
646 * @cpuid: ID number of the CPU
649 int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
655 * @cpu: The CPU whose memory is to be dumped
656 * @cpuid: ID number of the CPU
659 int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
665 * @cpu: The CPU whose memory is to be dumped
666 * @cpuid: ID number of the CPU
669 int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
674 * @cpu: The CPU to get crash information for
679 GuestPanicInformation *cpu_get_crash_info(CPUState *cpu);
699 * @cpu: The CPU whose state is to be dumped.
702 * Dumps CPU state.
704 void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
709 * @cpu: The CPU to obtain the physical page address for.
720 hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
725 * @cpu: The CPU to obtain the physical page address for.
733 hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
736 * @cpu: CPU
739 * Returns the address space index specifying the CPU AddressSpace
742 int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);
746 * @cpu: CPU
748 * Returns %true if a CPU which supports runtime configurable endianness
751 bool cpu_virtio_is_big_endian(CPUState *cpu);
757 * @cpu: The CPU to be added to the list of CPUs.
759 void cpu_list_add(CPUState *cpu);
763 * @cpu: The CPU to be removed from the list of CPUs.
765 void cpu_list_remove(CPUState *cpu);
769 * @cpu: The CPU whose state is to be reset.
771 void cpu_reset(CPUState *cpu);
775 * @typename: The CPU base type.
778 * Looks up a concrete CPU #ObjectClass matching name @cpu_model.
787 * @typename: The CPU type name
789 * Extract the CPU model name from the CPU type name. The
790 * CPU type name is either the combination of the CPU model
791 * name and suffix, or same to the CPU model name.
793 * Returns: CPU model name or NULL if the CPU class doesn't exist
800 * @typename: The CPU type.
802 * Instantiates a CPU and realizes the CPU.
810 * @cpu_option: The -cpu option including optional parameters.
814 * Returns: type of CPU to create or prints error and terminates process
821 * @cpu: The vCPU to check.
823 * Checks whether the CPU has work to do.
825 * Returns: %true if the CPU has work, %false otherwise.
827 static inline bool cpu_has_work(CPUState *cpu) in cpu_has_work() argument
829 CPUClass *cc = CPU_GET_CLASS(cpu); in cpu_has_work()
832 return cc->has_work(cpu); in cpu_has_work()
837 * @cpu: The vCPU to check against.
841 * Returns: %true if called from @cpu's thread, %false otherwise.
843 bool qemu_cpu_is_self(CPUState *cpu);
847 * @cpu: The vCPU to kick.
849 * Kicks @cpu's thread.
851 void qemu_cpu_kick(CPUState *cpu);
855 * @cpu: The CPU to check.
857 * Checks whether the CPU is stopped.
862 bool cpu_is_stopped(CPUState *cpu);
866 * @cpu: The vCPU to run on.
873 void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data,
878 * @cpu: The vCPU to run on.
882 * Schedules the function @func for execution on the vCPU @cpu.
884 void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
888 * @cpu: The vCPU to run on.
892 * Schedules the function @func for execution on the vCPU @cpu asynchronously.
894 void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
898 * @cpu: The vCPU to run on.
902 * Schedules the function @func for execution on the vCPU @cpu asynchronously,
908 void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
912 * @cpu: The vCPU to check
914 * Returns true if @cpu is an exclusive context, for example running
917 static inline bool cpu_in_exclusive_context(const CPUState *cpu) in cpu_in_exclusive_context() argument
919 return cpu->exclusive_context_count; in cpu_in_exclusive_context()
924 * @index: The CPUState@cpu_index value of the CPU to obtain.
926 * Gets a CPU matching @index.
928 * Returns: The CPU or %NULL if there is no matching CPU.
934 * @id: Guest-exposed CPU ID to lookup.
936 * Search for CPU with specified ID.
938 * Returns: %true - CPU is found, %false - CPU isn't found.
944 * @id: Guest-exposed CPU ID of the CPU to obtain.
946 * Get a CPU with matching @id.
948 * Returns: The CPU or %NULL if there is no matching CPU.
954 * @cpu: The CPU to set an interrupt on.
960 void cpu_interrupt(CPUState *cpu, int mask);
964 * @cpu: The CPU to set the program counter for.
967 * Sets the program counter for a CPU.
969 static inline void cpu_set_pc(CPUState *cpu, vaddr addr) in cpu_set_pc() argument
971 CPUClass *cc = CPU_GET_CLASS(cpu); in cpu_set_pc()
973 cc->set_pc(cpu, addr); in cpu_set_pc()
978 * @cpu: The CPU to clear the interrupt on.
981 * Resets interrupts on the vCPU @cpu.
983 void cpu_reset_interrupt(CPUState *cpu, int mask);
987 * @cpu: The CPU to exit.
989 * Requests the CPU @cpu to exit execution.
991 void cpu_exit(CPUState *cpu);
995 * @cpu: The CPU to pause.
997 * Pauses CPU, i.e. puts CPU into stopped state.
999 void cpu_pause(CPUState *cpu);
1003 * @cpu: The CPU to resume.
1005 * Resumes CPU, i.e. puts CPU into runnable state.
1007 void cpu_resume(CPUState *cpu);
1011 * @cpu: The CPU to remove.
1013 * Requests the CPU to be removed and waits till it is removed.
1015 void cpu_remove_sync(CPUState *cpu);
1018 * free_queued_cpu_work() - free all items on CPU work queue
1019 * @cpu: The CPU which work queue to free.
1021 void free_queued_cpu_work(CPUState *cpu);
1024 * process_queued_cpu_work() - process all items on CPU work queue
1025 * @cpu: The CPU which work queue to process.
1027 void process_queued_cpu_work(CPUState *cpu);
1031 * @cpu: The CPU for the current thread.
1033 * Record that a CPU has started execution and can be interrupted with
1036 void cpu_exec_start(CPUState *cpu);
1040 * @cpu: The CPU for the current thread.
1042 * Record that a CPU has stopped execution and exclusive sections
1045 void cpu_exec_end(CPUState *cpu);
1054 * during the exclusive section go to sleep until this CPU calls
1068 * @cpu: The vCPU to initialize.
1072 void qemu_init_vcpu(CPUState *cpu);
1080 * @cpu: CPU to the flags for.
1083 * Enables or disables single-stepping for @cpu.
1085 void cpu_single_step(CPUState *cpu, int enabled);
1101 int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
1103 int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
1104 void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint);
1105 void cpu_breakpoint_remove_all(CPUState *cpu, int mask);
1108 static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask) in cpu_breakpoint_test() argument
1112 if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { in cpu_breakpoint_test()
1113 QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { in cpu_breakpoint_test()
1123 static inline int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len, in cpu_watchpoint_insert() argument
1129 static inline int cpu_watchpoint_remove(CPUState *cpu, vaddr addr, in cpu_watchpoint_remove() argument
1135 static inline void cpu_watchpoint_remove_by_ref(CPUState *cpu, in cpu_watchpoint_remove_by_ref() argument
1140 static inline void cpu_watchpoint_remove_all(CPUState *cpu, int mask) in cpu_watchpoint_remove_all() argument
1144 int cpu_watchpoint_insert(CPUState *cpu, vaddr addr, vaddr len,
1146 int cpu_watchpoint_remove(CPUState *cpu, vaddr addr,
1148 void cpu_watchpoint_remove_by_ref(CPUState *cpu, CPUWatchpoint *watchpoint);
1149 void cpu_watchpoint_remove_all(CPUState *cpu, int mask);
1154 * @cpu: CPU to get address space from
1157 * Return the requested address space of this CPU. @asidx
1160 AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
1162 G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
1165 /* $(top_srcdir)/cpu.c */
1167 void cpu_exec_initfn(CPUState *cpu);
1168 bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
1169 void cpu_exec_unrealizefn(CPUState *cpu);
1170 void cpu_exec_reset_hold(CPUState *cpu);