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.
105 * @list_cpus: list available CPU models and flags.
113 * @get_arch_id: Callback for getting architecture-dependent CPU ID.
138 * @gdb_stop_before_watchpoint: Indicates whether GDB expects the CPU to stop
149 * Represents a CPU family or model.
160 int (*memory_rw_debug)(CPUState *cpu, vaddr addr,
162 void (*dump_state)(CPUState *cpu, FILE *, int flags);
163 void (*query_cpu_fast)(CPUState *cpu, CpuInfoFast *value);
164 int64_t (*get_arch_id)(CPUState *cpu);
165 void (*set_pc)(CPUState *cpu, vaddr value);
166 vaddr (*get_pc)(CPUState *cpu);
167 int (*gdb_read_register)(CPUState *cpu, GByteArray *buf, int reg);
168 int (*gdb_write_register)(CPUState *cpu, uint8_t *buf, int reg);
169 vaddr (*gdb_adjust_breakpoint)(CPUState *cpu, vaddr addr);
172 const gchar * (*gdb_arch_name)(CPUState *cpu);
173 const char * (*gdb_get_core_xml_file)(CPUState *cpu);
175 void (*disas_set_info)(CPUState *cpu, disassemble_info *info);
228 * given by cpu_asidx_from_attrs(cpu, @attrs).
252 * This may be used to cache items from the guest cpu
313 * of the stats without interfering with the cpu.
337 * for this CPU and return to its top level loop (even in non-icount mode).
397 typedef void (*run_on_cpu_func)(CPUState *cpu, run_on_cpu_data data);
404 * struct CPUState - common state of one CPU core or thread.
406 * @cpu_index: CPU index (informative).
407 * @cluster_index: Identifies which cluster this CPU is in.
410 * be the same as the cluster-id property of the CPU object's TYPE_CPU_CLUSTER
414 * @tcg_cflags: Pre-computed cflags for this cpu.
415 * @nr_threads: Number of threads within this CPU core.
419 * @running: #true if CPU is currently running (lockless).
420 * @has_waiter: #true if a CPU is currently waiting for the cpu_exec_end;
422 * @created: Indicates whether the CPU thread has been successfully created.
425 * @halted: Nonzero if the CPU is in suspended state.
427 * @stopped: Indicates the CPU has been artificially stopped.
428 * @unplug: Indicates a pending CPU unplug request.
429 * @crash_occurred: Indicates the OS reported a crash (panic) for this CPU
433 * AddressSpaces this CPU has)
447 * @plugin_state: per-CPU plugin state
450 * CPU do_transaction_failed hook function.
451 * @kvm_dirty_gfns: Points to the KVM dirty ring for this CPU when KVM dirty
457 * which is allocated when an individual CPU instance is created. As
463 * some common TCG CPU variables which are accessed with a negative offset
487 /* Should CPU start in powered-off state? */
528 * we store some rarely used information in the CPU context.
542 /* Use by accel-block: CPU is executing an ioctl() */
558 /* Used to keep track of an outstanding cpu throttle thread for migration
588 static inline CPUArchState *cpu_env(CPUState *cpu) in cpu_env() argument
590 /* We validate that CPUArchState follows CPUState in cpu-target.c */ in cpu_env()
591 return (CPUArchState *)(cpu + 1); in cpu_env()
598 #define CPU_NEXT(cpu) QTAILQ_NEXT_RCU(cpu, node) argument
599 #define CPU_FOREACH(cpu) QTAILQ_FOREACH_RCU(cpu, &cpus_queue, node) argument
600 #define CPU_FOREACH_SAFE(cpu, next_cpu) \ argument
601 QTAILQ_FOREACH_SAFE_RCU(cpu, &cpus_queue, node, next_cpu)
607 * @cpu: The CPU whose state is to be inspected.
611 bool cpu_paging_enabled(const CPUState *cpu);
615 * @cpu: The CPU whose memory mappings are to be obtained.
621 bool cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
627 * @cpu: The CPU whose memory is to be dumped
628 * @cpuid: ID number of the CPU
631 int cpu_write_elf64_note(WriteCoreDumpFunction f, CPUState *cpu,
637 * @cpu: The CPU whose memory is to be dumped
638 * @cpuid: ID number of the CPU
641 int cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
647 * @cpu: The CPU whose memory is to be dumped
648 * @cpuid: ID number of the CPU
651 int cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cpu,
657 * @cpu: The CPU whose memory is to be dumped
658 * @cpuid: ID number of the CPU
661 int cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu,
666 * @cpu: The CPU to get crash information for
671 GuestPanicInformation *cpu_get_crash_info(CPUState *cpu);
689 * @cpu: The CPU whose state is to be dumped.
692 * Dumps CPU state.
694 void cpu_dump_state(CPUState *cpu, FILE *f, int flags);
698 * @cpu: The CPU to obtain the physical page address for.
709 hwaddr cpu_get_phys_page_attrs_debug(CPUState *cpu, vaddr addr,
714 * @cpu: The CPU to obtain the physical page address for.
722 hwaddr cpu_get_phys_page_debug(CPUState *cpu, vaddr addr);
725 * @cpu: CPU
728 * Returns the address space index specifying the CPU AddressSpace
731 int cpu_asidx_from_attrs(CPUState *cpu, MemTxAttrs attrs);
735 * @cpu: CPU
737 * Returns %true if a CPU which supports runtime configurable endianness
740 bool cpu_virtio_is_big_endian(CPUState *cpu);
744 * @cpu: The vCPU to check.
746 * Checks whether the CPU has work to do.
748 * Returns: %true if the CPU has work, %false otherwise.
750 bool cpu_has_work(CPUState *cpu);
754 * @cpu: The CPU to be added to the list of CPUs.
756 void cpu_list_add(CPUState *cpu);
760 * @cpu: The CPU to be removed from the list of CPUs.
762 void cpu_list_remove(CPUState *cpu);
766 * @cpu: The CPU whose state is to be reset.
768 void cpu_reset(CPUState *cpu);
772 * @typename: The CPU base type.
775 * Looks up a concrete CPU #ObjectClass matching name @cpu_model.
784 * @typename: The CPU type name
786 * Extract the CPU model name from the CPU type name. The
787 * CPU type name is either the combination of the CPU model
788 * name and suffix, or same to the CPU model name.
790 * Returns: CPU model name or NULL if the CPU class doesn't exist
797 * @typename: The CPU type.
799 * Instantiates a CPU and realizes the CPU.
807 * @cpu_option: The -cpu option including optional parameters.
811 * Returns: type of CPU to create or prints error and terminates process
818 * @cpu: The vCPU to check against.
822 * Returns: %true if called from @cpu's thread, %false otherwise.
824 bool qemu_cpu_is_self(CPUState *cpu);
828 * @cpu: The vCPU to kick.
830 * Kicks @cpu's thread.
832 void qemu_cpu_kick(CPUState *cpu);
836 * @cpu: The CPU to check.
838 * Checks whether the CPU is stopped.
843 bool cpu_is_stopped(CPUState *cpu);
847 * @cpu: The vCPU to run on.
854 void do_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data,
859 * @cpu: The vCPU to run on.
863 * Schedules the function @func for execution on the vCPU @cpu.
865 void run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
869 * @cpu: The vCPU to run on.
873 * Schedules the function @func for execution on the vCPU @cpu asynchronously.
875 void async_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
879 * @cpu: The vCPU to run on.
883 * Schedules the function @func for execution on the vCPU @cpu asynchronously,
889 void async_safe_run_on_cpu(CPUState *cpu, run_on_cpu_func func, run_on_cpu_data data);
893 * @cpu: The vCPU to check
895 * Returns true if @cpu is an exclusive context, for example running
898 static inline bool cpu_in_exclusive_context(const CPUState *cpu) in cpu_in_exclusive_context() argument
900 return cpu->exclusive_context_count; in cpu_in_exclusive_context()
905 * @index: The CPUState@cpu_index value of the CPU to obtain.
907 * Gets a CPU matching @index.
909 * Returns: The CPU or %NULL if there is no matching CPU.
915 * @id: Guest-exposed CPU ID to lookup.
917 * Search for CPU with specified ID.
919 * Returns: %true - CPU is found, %false - CPU isn't found.
925 * @id: Guest-exposed CPU ID of the CPU to obtain.
927 * Get a CPU with matching @id.
929 * Returns: The CPU or %NULL if there is no matching CPU.
935 * @cpu: The CPU to set an interrupt on.
941 void cpu_interrupt(CPUState *cpu, int mask);
945 * @cpu: The CPU to set the program counter for.
948 * Sets the program counter for a CPU.
950 static inline void cpu_set_pc(CPUState *cpu, vaddr addr) in cpu_set_pc() argument
952 cpu->cc->set_pc(cpu, addr); in cpu_set_pc()
957 * @cpu: The CPU to clear the interrupt on.
960 * Resets interrupts on the vCPU @cpu.
962 void cpu_reset_interrupt(CPUState *cpu, int mask);
966 * @cpu: The CPU to exit.
968 * Requests the CPU @cpu to exit execution.
970 void cpu_exit(CPUState *cpu);
974 * @cpu: The CPU to pause.
976 * Pauses CPU, i.e. puts CPU into stopped state.
978 void cpu_pause(CPUState *cpu);
982 * @cpu: The CPU to resume.
984 * Resumes CPU, i.e. puts CPU into runnable state.
986 void cpu_resume(CPUState *cpu);
990 * @cpu: The CPU to remove.
992 * Requests the CPU to be removed and waits till it is removed.
994 void cpu_remove_sync(CPUState *cpu);
997 * free_queued_cpu_work() - free all items on CPU work queue
998 * @cpu: The CPU which work queue to free.
1000 void free_queued_cpu_work(CPUState *cpu);
1003 * process_queued_cpu_work() - process all items on CPU work queue
1004 * @cpu: The CPU which work queue to process.
1006 void process_queued_cpu_work(CPUState *cpu);
1010 * @cpu: The CPU for the current thread.
1012 * Record that a CPU has started execution and can be interrupted with
1015 void cpu_exec_start(CPUState *cpu);
1019 * @cpu: The CPU for the current thread.
1021 * Record that a CPU has stopped execution and exclusive sections
1024 void cpu_exec_end(CPUState *cpu);
1033 * during the exclusive section go to sleep until this CPU calls
1047 * @cpu: The vCPU to initialize.
1051 void qemu_init_vcpu(CPUState *cpu);
1059 * @cpu: CPU to the flags for.
1062 * Enables or disables single-stepping for @cpu.
1064 void cpu_single_step(CPUState *cpu, int enabled);
1080 int cpu_breakpoint_insert(CPUState *cpu, vaddr pc, int flags,
1082 int cpu_breakpoint_remove(CPUState *cpu, vaddr pc, int flags);
1083 void cpu_breakpoint_remove_by_ref(CPUState *cpu, CPUBreakpoint *breakpoint);
1084 void cpu_breakpoint_remove_all(CPUState *cpu, int mask);
1087 static inline bool cpu_breakpoint_test(CPUState *cpu, vaddr pc, int mask) in cpu_breakpoint_test() argument
1091 if (unlikely(!QTAILQ_EMPTY(&cpu->breakpoints))) { in cpu_breakpoint_test()
1092 QTAILQ_FOREACH(bp, &cpu->breakpoints, entry) { in cpu_breakpoint_test()
1103 * @cpu: CPU to get address space from
1106 * Return the requested address space of this CPU. @asidx
1109 AddressSpace *cpu_get_address_space(CPUState *cpu, int asidx);
1111 G_NORETURN void cpu_abort(CPUState *cpu, const char *fmt, ...)
1114 /* $(top_srcdir)/cpu.c */
1117 void cpu_exec_initfn(CPUState *cpu);
1118 void cpu_vmstate_register(CPUState *cpu);
1119 void cpu_vmstate_unregister(CPUState *cpu);
1120 bool cpu_exec_realizefn(CPUState *cpu, Error **errp);
1121 void cpu_exec_unrealizefn(CPUState *cpu);
1122 void cpu_exec_reset_hold(CPUState *cpu);