xref: /openbmc/qemu/include/hw/core/sysemu-cpu-ops.h (revision 1ff5f4d2)
1 /*
2  * CPU operations specific to system emulation
3  *
4  * Copyright (c) 2012 SUSE LINUX Products GmbH
5  *
6  * This work is licensed under the terms of the GNU GPL, version 2 or later.
7  * See the COPYING file in the top-level directory.
8  */
9 
10 #ifndef SYSEMU_CPU_OPS_H
11 #define SYSEMU_CPU_OPS_H
12 
13 #include "hw/core/cpu.h"
14 
15 /*
16  * struct SysemuCPUOps: System operations specific to a CPU class
17  */
18 typedef struct SysemuCPUOps {
19     /**
20      * @get_memory_mapping: Callback for obtaining the memory mappings.
21      */
22     bool (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
23                                Error **errp);
24     /**
25      * @get_paging_enabled: Callback for inquiring whether paging is enabled.
26      */
27     bool (*get_paging_enabled)(const CPUState *cpu);
28     /**
29      * @get_phys_page_debug: Callback for obtaining a physical address.
30      */
31     hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
32     /**
33      * @get_phys_page_attrs_debug: Callback for obtaining a physical address
34      *       and the associated memory transaction attributes to use for the
35      *       access.
36      * CPUs which use memory transaction attributes should implement this
37      * instead of get_phys_page_debug.
38      */
39     hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
40                                         MemTxAttrs *attrs);
41     /**
42      * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
43      *       a memory access with the specified memory transaction attributes.
44      */
45     int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
46     /**
47      * @get_crash_info: Callback for reporting guest crash information in
48      * GUEST_PANICKED events.
49      */
50     GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
51     /**
52      * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
53      * 32-bit VM coredump.
54      */
55     int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
56                             int cpuid, DumpState *s);
57     /**
58      * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
59      * 64-bit VM coredump.
60      */
61     int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
62                             int cpuid, DumpState *s);
63     /**
64      * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
65      * note to a 32-bit VM coredump.
66      */
67     int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
68                                 DumpState *s);
69     /**
70      * @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF
71      * note to a 64-bit VM coredump.
72      */
73     int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
74                                 DumpState *s);
75     /**
76      * @virtio_is_big_endian: Callback to return %true if a CPU which supports
77      * runtime configurable endianness is currently big-endian.
78      * Non-configurable CPUs can use the default implementation of this method.
79      * This method should not be used by any callers other than the pre-1.0
80      * virtio devices.
81      */
82     bool (*virtio_is_big_endian)(CPUState *cpu);
83 
84     /**
85      * @legacy_vmsd: Legacy state for migration.
86      *               Do not use in new targets, use #DeviceClass::vmsd instead.
87      */
88     const VMStateDescription *legacy_vmsd;
89 
90 } SysemuCPUOps;
91 
92 #endif /* SYSEMU_CPU_OPS_H */
93