- Re-org accel/ and softmmu/ to have more target-agnostic objects.
- Use CPUArchState as an abstract type, defined by each target
(CPUState is our interface with generic code, CPUArchState is
our interface with target-specific code).
-----BEGIN PGP SIGNATURE-----
iQIzBAABCAAdFiEE+qvnXhKRciHc/Wuy4+MsLN6twN4FAmIlQmcACgkQ4+MsLN6t
wN59LRAAv69CO8UQj3FJs3igxVFrygcoYb9ywHd69tShLPrBo3204dHph67xzYDw
yZwTAftpVvoLsveQGivrMIl76f0Sg2RmxNgcIWQsPwYC9PI4BPbnZpRA7s4o5eZA
kLsSMEdhQoEAwysunu6uQMpbz7ZB5w2opb+hB++63khgsz+tyoCnsbxn7DVIgmX8
qg3N/SqFxsptf7NVNIAR7S6LmuW2ii7FnkvG4pO4fqW22omgXsw2Cj/KL+j2vaPX
GSMEX2ugEh77AKROr9OiXkLmiLaaF2BWQOlgOEKLfUE3nGaTtqGl3Wd8fv3FYVgH
a4g9+ceEDnTzW+hLQoWn8XKAKuC00pXZNTh/4iqR7gkah+rIdxtVLSN6YEHu5dr+
EQRdNJdJqHUTjtuuq9UF7U9NZuDgESmOqloIpBMkgDfgd+PoWvjnc+kjy4x3Wfog
3+cV62Cb91oHVMzSVskeeO/TEDxUFI4Zl18SR3M6MLUBANFW1YPNDUqSqN8zLdmd
w0ehd6+PBplH7JlWcdd2cam+4chO9tv0MrBD7Ty1UitDiFEP1oSkEyRzoHa8cUcb
Rz7Aa9noQJ6jSjrYaVoYcENnQxtdJd9utcQFY28M8PtOJrw7HRMtS8WQi0nsRcWq
o6NJ/58EJ/SAGH1+qX+LTr/IUmnFiW1XhEWpJoUjb+lmmCfdtOM=
=bOxK
-----END PGP SIGNATURE-----
Merge remote-tracking branch 'remotes/philmd/tags/abstract-arch-cpu-20220307' into staging
- Re-org accel/ and softmmu/ to have more target-agnostic objects.
- Use CPUArchState as an abstract type, defined by each target
(CPUState is our interface with generic code, CPUArchState is
our interface with target-specific code).
# gpg: Signature made Sun 06 Mar 2022 23:23:19 GMT
# gpg: using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD 6BB2 E3E3 2C2C DEAD C0DE
* remotes/philmd/tags/abstract-arch-cpu-20220307: (33 commits)
accel/tcg: Remove pointless CPUArchState casts
target/i386: Remove pointless CPUArchState casts
target: Use ArchCPU as interface to target CPU
target: Introduce and use OBJECT_DECLARE_CPU_TYPE() macro
target: Use CPUArchState as interface to target-specific CPU state
target: Use forward declared type instead of structure type
target/hexagon: Add missing 'hw/core/cpu.h' include
target: Include missing 'cpu.h'
Hexagon (target/hexagon) convert to OBJECT_DECLARE_TYPE
target/i386/tcg/sysemu: Include missing 'exec/exec-all.h' header
cpu: Add missing 'exec/exec-all.h' and 'qemu/accel.h' headers
exec/cpu_ldst: Include 'cpu.h' to get target_ulong definition
meson: Display libfdt as disabled when system emulation is disabled
softmmu: Build target-agnostic objects once
softmmu: Add qemu_init_arch_modules()
exec/cpu: Make address_space_init/reloading_memory_map target agnostic
exec/gdbstub: Make gdb_exit() / gdb_set_stop_cpu() target agnostic
misc: Add missing "sysemu/cpu-timers.h" include
misc: Remove unnecessary "sysemu/cpu-timers.h" include
softmmu/cpu-timers: Remove unused 'exec/exec-all.h' header
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
99c4a9e68e
87 changed files with 371 additions and 402 deletions
|
|
@ -433,10 +433,6 @@ int cpu_exec(CPUState *cpu);
|
|||
void tcg_exec_realizefn(CPUState *cpu, Error **errp);
|
||||
void tcg_exec_unrealizefn(CPUState *cpu);
|
||||
|
||||
/* Returns: 0 on success, -1 on error */
|
||||
int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
|
||||
void *ptr, target_ulong len, bool is_write);
|
||||
|
||||
/**
|
||||
* cpu_set_cpustate_pointers(cpu)
|
||||
* @cpu: The cpu object
|
||||
|
|
|
|||
|
|
@ -7,6 +7,18 @@
|
|||
#include "exec/hwaddr.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* vaddr:
|
||||
* Type wide enough to contain any #target_ulong virtual address.
|
||||
*/
|
||||
typedef uint64_t vaddr;
|
||||
#define VADDR_PRId PRId64
|
||||
#define VADDR_PRIu PRIu64
|
||||
#define VADDR_PRIo PRIo64
|
||||
#define VADDR_PRIx PRIx64
|
||||
#define VADDR_PRIX PRIX64
|
||||
#define VADDR_MAX UINT64_MAX
|
||||
|
||||
/* Using intptr_t ensures that qemu_*_page_mask is sign-extended even
|
||||
* when intptr_t is 32-bit and we are aligning a long long.
|
||||
*/
|
||||
|
|
@ -78,6 +90,28 @@ void qemu_ram_unset_migratable(RAMBlock *rb);
|
|||
size_t qemu_ram_pagesize(RAMBlock *block);
|
||||
size_t qemu_ram_pagesize_largest(void);
|
||||
|
||||
/**
|
||||
* cpu_address_space_init:
|
||||
* @cpu: CPU to add this address space to
|
||||
* @asidx: integer index of this address space
|
||||
* @prefix: prefix to be used as name of address space
|
||||
* @mr: the root memory region of address space
|
||||
*
|
||||
* Add the specified address space to the CPU's cpu_ases list.
|
||||
* The address space added with @asidx 0 is the one used for the
|
||||
* convenience pointer cpu->as.
|
||||
* The target-specific code which registers ASes is responsible
|
||||
* for defining what semantics address space 0, 1, 2, etc have.
|
||||
*
|
||||
* Before the first call to this function, the caller must set
|
||||
* cpu->num_ases to the total number of address spaces it needs
|
||||
* to support.
|
||||
*
|
||||
* Note that with KVM only one address space is supported.
|
||||
*/
|
||||
void cpu_address_space_init(CPUState *cpu, int asidx,
|
||||
const char *prefix, MemoryRegion *mr);
|
||||
|
||||
void cpu_physical_memory_rw(hwaddr addr, void *buf,
|
||||
hwaddr len, bool is_write);
|
||||
static inline void cpu_physical_memory_read(hwaddr addr,
|
||||
|
|
@ -90,6 +124,7 @@ static inline void cpu_physical_memory_write(hwaddr addr,
|
|||
{
|
||||
cpu_physical_memory_rw(addr, (void *)buf, len, true);
|
||||
}
|
||||
void cpu_reloading_memory_map(void);
|
||||
void *cpu_physical_memory_map(hwaddr addr,
|
||||
hwaddr *plen,
|
||||
bool is_write);
|
||||
|
|
@ -116,6 +151,10 @@ int ram_block_discard_range(RAMBlock *rb, uint64_t start, size_t length);
|
|||
|
||||
#endif
|
||||
|
||||
/* Returns: 0 on success, -1 on error */
|
||||
int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,
|
||||
void *ptr, size_t len, bool is_write);
|
||||
|
||||
/* vl.c */
|
||||
extern int singlestep;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@
|
|||
|
||||
#include "exec/memopidx.h"
|
||||
#include "qemu/int128.h"
|
||||
#include "cpu.h"
|
||||
|
||||
#if defined(CONFIG_USER_ONLY)
|
||||
/* sparc32plus has 64bit long but 32bit space address
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@
|
|||
#ifdef CONFIG_TCG
|
||||
#include "exec/cpu_ldst.h"
|
||||
#endif
|
||||
#include "sysemu/cpu-timers.h"
|
||||
|
||||
/* allow to see translation results - the slowdown should be negligible, so we leave it */
|
||||
#define DEBUG_DISAS
|
||||
|
|
@ -81,31 +80,6 @@ static inline bool cpu_loop_exit_requested(CPUState *cpu)
|
|||
return (int32_t)qatomic_read(&cpu_neg(cpu)->icount_decr.u32) < 0;
|
||||
}
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY)
|
||||
void cpu_reloading_memory_map(void);
|
||||
/**
|
||||
* cpu_address_space_init:
|
||||
* @cpu: CPU to add this address space to
|
||||
* @asidx: integer index of this address space
|
||||
* @prefix: prefix to be used as name of address space
|
||||
* @mr: the root memory region of address space
|
||||
*
|
||||
* Add the specified address space to the CPU's cpu_ases list.
|
||||
* The address space added with @asidx 0 is the one used for the
|
||||
* convenience pointer cpu->as.
|
||||
* The target-specific code which registers ASes is responsible
|
||||
* for defining what semantics address space 0, 1, 2, etc have.
|
||||
*
|
||||
* Before the first call to this function, the caller must set
|
||||
* cpu->num_ases to the total number of address spaces it needs
|
||||
* to support.
|
||||
*
|
||||
* Note that with KVM only one address space is supported.
|
||||
*/
|
||||
void cpu_address_space_init(CPUState *cpu, int asidx,
|
||||
const char *prefix, MemoryRegion *mr);
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_USER_ONLY) && defined(CONFIG_TCG)
|
||||
/* cputlb.c */
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -45,17 +45,6 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...);
|
|||
*/
|
||||
void gdb_do_syscallv(gdb_syscall_complete_cb cb, const char *fmt, va_list va);
|
||||
int use_gdb_syscalls(void);
|
||||
void gdb_set_stop_cpu(CPUState *cpu);
|
||||
|
||||
/**
|
||||
* gdb_exit: exit gdb session, reporting inferior status
|
||||
* @code: exit code reported
|
||||
*
|
||||
* This closes the session and sends a final packet to GDB reporting
|
||||
* the exit status of the program. It also cleans up any connections
|
||||
* detritus before returning.
|
||||
*/
|
||||
void gdb_exit(int code);
|
||||
|
||||
#ifdef CONFIG_USER_ONLY
|
||||
/**
|
||||
|
|
@ -165,7 +154,7 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len)
|
|||
#define ldtul_p(addr) ldl_p(addr)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
#endif /* NEED_CPU_H */
|
||||
|
||||
/**
|
||||
* gdbserver_start: start the gdb server
|
||||
|
|
@ -177,6 +166,18 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len)
|
|||
*/
|
||||
int gdbserver_start(const char *port_or_device);
|
||||
|
||||
/**
|
||||
* gdb_exit: exit gdb session, reporting inferior status
|
||||
* @code: exit code reported
|
||||
*
|
||||
* This closes the session and sends a final packet to GDB reporting
|
||||
* the exit status of the program. It also cleans up any connections
|
||||
* detritus before returning.
|
||||
*/
|
||||
void gdb_exit(int code);
|
||||
|
||||
void gdb_set_stop_cpu(CPUState *cpu);
|
||||
|
||||
/**
|
||||
* gdb_has_xml:
|
||||
* This is an ugly hack to cope with both new and old gdb.
|
||||
|
|
|
|||
|
|
@ -51,8 +51,6 @@
|
|||
#pragma GCC poison TARGET_PAGE_BITS
|
||||
#pragma GCC poison TARGET_PAGE_ALIGN
|
||||
|
||||
#pragma GCC poison CPUArchState
|
||||
|
||||
#pragma GCC poison CPU_INTERRUPT_HARD
|
||||
#pragma GCC poison CPU_INTERRUPT_EXITTB
|
||||
#pragma GCC poison CPU_INTERRUPT_HALT
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "hw/qdev-core.h"
|
||||
#include "disas/dis-asm.h"
|
||||
#include "exec/cpu-common.h"
|
||||
#include "exec/hwaddr.h"
|
||||
#include "exec/memattrs.h"
|
||||
#include "qapi/qapi-types-run-state.h"
|
||||
|
|
@ -35,18 +36,6 @@
|
|||
typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size,
|
||||
void *opaque);
|
||||
|
||||
/**
|
||||
* vaddr:
|
||||
* Type wide enough to contain any #target_ulong virtual address.
|
||||
*/
|
||||
typedef uint64_t vaddr;
|
||||
#define VADDR_PRId PRId64
|
||||
#define VADDR_PRIu PRIu64
|
||||
#define VADDR_PRIo PRIo64
|
||||
#define VADDR_PRIx PRIx64
|
||||
#define VADDR_PRIX PRIX64
|
||||
#define VADDR_MAX UINT64_MAX
|
||||
|
||||
/**
|
||||
* SECTION:cpu
|
||||
* @section_id: QEMU-cpu
|
||||
|
|
@ -66,6 +55,24 @@ typedef struct CPUClass CPUClass;
|
|||
DECLARE_CLASS_CHECKERS(CPUClass, CPU,
|
||||
TYPE_CPU)
|
||||
|
||||
/**
|
||||
* OBJECT_DECLARE_CPU_TYPE:
|
||||
* @CpuInstanceType: instance struct name
|
||||
* @CpuClassType: class struct name
|
||||
* @CPU_MODULE_OBJ_NAME: the CPU name in uppercase with underscore separators
|
||||
*
|
||||
* This macro is typically used in "cpu-qom.h" header file, and will:
|
||||
*
|
||||
* - create the typedefs for the CPU object and class structs
|
||||
* - register the type for use with g_autoptr
|
||||
* - provide three standard type cast functions
|
||||
*
|
||||
* The object struct and class struct need to be declared manually.
|
||||
*/
|
||||
#define OBJECT_DECLARE_CPU_TYPE(CpuInstanceType, CpuClassType, CPU_MODULE_OBJ_NAME) \
|
||||
typedef struct ArchCPU CpuInstanceType; \
|
||||
OBJECT_DECLARE_TYPE(ArchCPU, CpuClassType, CPU_MODULE_OBJ_NAME);
|
||||
|
||||
typedef enum MMUAccessType {
|
||||
MMU_DATA_LOAD = 0,
|
||||
MMU_DATA_STORE = 1,
|
||||
|
|
@ -351,7 +358,7 @@ struct CPUState {
|
|||
AddressSpace *as;
|
||||
MemoryRegion *memory;
|
||||
|
||||
void *env_ptr; /* CPUArchState */
|
||||
CPUArchState *env_ptr;
|
||||
IcountDecr *icount_decr_ptr;
|
||||
|
||||
/* Accessed in parallel; all accesses must be atomic */
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ typedef struct AddressSpace AddressSpace;
|
|||
typedef struct AioContext AioContext;
|
||||
typedef struct Aml Aml;
|
||||
typedef struct AnnounceTimer AnnounceTimer;
|
||||
typedef struct ArchCPU ArchCPU;
|
||||
typedef struct BdrvDirtyBitmap BdrvDirtyBitmap;
|
||||
typedef struct BdrvDirtyBitmapIter BdrvDirtyBitmapIter;
|
||||
typedef struct BlockBackend BlockBackend;
|
||||
|
|
@ -39,6 +40,7 @@ typedef struct CompatProperty CompatProperty;
|
|||
typedef struct CoMutex CoMutex;
|
||||
typedef struct ConfidentialGuestSupport ConfidentialGuestSupport;
|
||||
typedef struct CPUAddressSpace CPUAddressSpace;
|
||||
typedef struct CPUArchState CPUArchState;
|
||||
typedef struct CPUState CPUState;
|
||||
typedef struct DeviceListener DeviceListener;
|
||||
typedef struct DeviceState DeviceState;
|
||||
|
|
|
|||
|
|
@ -28,8 +28,11 @@ struct AccelOpsClass {
|
|||
/* initialization function called when accel is chosen */
|
||||
void (*ops_init)(AccelOpsClass *ops);
|
||||
|
||||
bool (*cpus_are_resettable)(void);
|
||||
|
||||
void (*create_vcpu_thread)(CPUState *cpu); /* MANDATORY NON-NULL */
|
||||
void (*kick_vcpu_thread)(CPUState *cpu);
|
||||
bool (*cpu_thread_is_idle)(CPUState *cpu);
|
||||
|
||||
void (*synchronize_post_reset)(CPUState *cpu);
|
||||
void (*synchronize_post_init)(CPUState *cpu);
|
||||
|
|
|
|||
|
|
@ -28,4 +28,6 @@ enum {
|
|||
|
||||
extern const uint32_t arch_type;
|
||||
|
||||
void qemu_init_arch_modules(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -25,17 +25,23 @@
|
|||
int hax_sync_vcpus(void);
|
||||
|
||||
#ifdef NEED_CPU_H
|
||||
# ifdef CONFIG_HAX
|
||||
# define CONFIG_HAX_IS_POSSIBLE
|
||||
# endif
|
||||
#else /* !NEED_CPU_H */
|
||||
# define CONFIG_HAX_IS_POSSIBLE
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_HAX
|
||||
#ifdef CONFIG_HAX_IS_POSSIBLE
|
||||
|
||||
int hax_enabled(void);
|
||||
extern bool hax_allowed;
|
||||
|
||||
#else /* CONFIG_HAX */
|
||||
#define hax_enabled() (hax_allowed)
|
||||
|
||||
#define hax_enabled() (0)
|
||||
#else /* !CONFIG_HAX_IS_POSSIBLE */
|
||||
|
||||
#endif /* CONFIG_HAX */
|
||||
#define hax_enabled() (0)
|
||||
|
||||
#endif /* NEED_CPU_H */
|
||||
#endif /* CONFIG_HAX_IS_POSSIBLE */
|
||||
|
||||
#endif /* QEMU_HAX_H */
|
||||
|
|
|
|||
|
|
@ -23,9 +23,4 @@ void cpu_synchronize_post_reset(CPUState *cpu);
|
|||
void cpu_synchronize_post_init(CPUState *cpu);
|
||||
void cpu_synchronize_pre_loadvm(CPUState *cpu);
|
||||
|
||||
static inline bool cpu_check_are_resettable(void)
|
||||
{
|
||||
return kvm_enabled() ? kvm_cpu_check_are_resettable() : true;
|
||||
}
|
||||
|
||||
#endif /* QEMU_HW_ACCEL_H */
|
||||
|
|
|
|||
|
|
@ -249,6 +249,9 @@ int kvm_has_intx_set_mask(void);
|
|||
bool kvm_arm_supports_user_irq(void);
|
||||
|
||||
|
||||
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
|
||||
int kvm_on_sigbus(int code, void *addr);
|
||||
|
||||
#ifdef NEED_CPU_H
|
||||
#include "cpu.h"
|
||||
|
||||
|
|
@ -261,9 +264,6 @@ int kvm_remove_breakpoint(CPUState *cpu, target_ulong addr,
|
|||
void kvm_remove_all_breakpoints(CPUState *cpu);
|
||||
int kvm_update_guest_debug(CPUState *cpu, unsigned long reinject_trap);
|
||||
|
||||
int kvm_on_sigbus_vcpu(CPUState *cpu, int code, void *addr);
|
||||
int kvm_on_sigbus(int code, void *addr);
|
||||
|
||||
/* internal API */
|
||||
|
||||
int kvm_ioctl(KVMState *s, int type, ...);
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@
|
|||
#define MEMORY_MAPPING_H
|
||||
|
||||
#include "qemu/queue.h"
|
||||
#include "exec/cpu-defs.h"
|
||||
#include "exec/memory.h"
|
||||
#include "exec/cpu-common.h"
|
||||
|
||||
typedef struct GuestPhysBlock {
|
||||
/* visible to guest, reflects PCI hole, etc */
|
||||
|
|
@ -43,7 +42,7 @@ typedef struct GuestPhysBlockList {
|
|||
/* The physical and virtual address in the memory mapping are contiguous. */
|
||||
typedef struct MemoryMapping {
|
||||
hwaddr phys_addr;
|
||||
target_ulong virt_addr;
|
||||
vaddr virt_addr;
|
||||
ram_addr_t length;
|
||||
QTAILQ_ENTRY(MemoryMapping) next;
|
||||
} MemoryMapping;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue