xref: /openbmc/qemu/include/hw/core/sysemu-cpu-ops.h (revision 2b60b62e05893de9698aa4a2c27de244870f0a50)
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     void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
23                                Error **errp);
24     /**
25      * @get_phys_page_debug: Callback for obtaining a physical address.
26      */
27     hwaddr (*get_phys_page_debug)(CPUState *cpu, vaddr addr);
28     /**
29      * @get_phys_page_attrs_debug: Callback for obtaining a physical address
30      *       and the associated memory transaction attributes to use for the
31      *       access.
32      * CPUs which use memory transaction attributes should implement this
33      * instead of get_phys_page_debug.
34      */
35     hwaddr (*get_phys_page_attrs_debug)(CPUState *cpu, vaddr addr,
36                                         MemTxAttrs *attrs);
37     /**
38      * @asidx_from_attrs: Callback to return the CPU AddressSpace to use for
39      *       a memory access with the specified memory transaction attributes.
40      */
41     int (*asidx_from_attrs)(CPUState *cpu, MemTxAttrs attrs);
42     /**
43      * @get_crash_info: Callback for reporting guest crash information in
44      * GUEST_PANICKED events.
45      */
46     GuestPanicInformation* (*get_crash_info)(CPUState *cpu);
47     /**
48      * @write_elf32_note: Callback for writing a CPU-specific ELF note to a
49      * 32-bit VM coredump.
50      */
51     int (*write_elf32_note)(WriteCoreDumpFunction f, CPUState *cpu,
52                             int cpuid, void *opaque);
53     /**
54      * @write_elf64_note: Callback for writing a CPU-specific ELF note to a
55      * 64-bit VM coredump.
56      */
57     int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
58                             int cpuid, void *opaque);
59     /**
60      * @write_elf32_qemunote: Callback for writing a CPU- and QEMU-specific ELF
61      * note to a 32-bit VM coredump.
62      */
63     int (*write_elf32_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
64                                 void *opaque);
65     /**
66      * @write_elf64_qemunote: Callback for writing a CPU- and QEMU-specific ELF
67      * note to a 64-bit VM coredump.
68      */
69     int (*write_elf64_qemunote)(WriteCoreDumpFunction f, CPUState *cpu,
70                                 void *opaque);
71     /**
72      * @virtio_is_big_endian: Callback to return %true if a CPU which supports
73      * runtime configurable endianness is currently big-endian.
74      * Non-configurable CPUs can use the default implementation of this method.
75      * This method should not be used by any callers other than the pre-1.0
76      * virtio devices.
77      */
78     bool (*virtio_is_big_endian)(CPUState *cpu);
79 
80     /**
81      * @legacy_vmsd: Legacy state for migration.
82      *               Do not use in new targets, use #DeviceClass::vmsd instead.
83      */
84     const VMStateDescription *legacy_vmsd;
85 
86 } SysemuCPUOps;
87 
88 #endif /* SYSEMU_CPU_OPS_H */
89