target/cpu: System/User cleanups around hwaddr/vaddr
v3 cover target/cpu: System/User cleanups around hwaddr/vaddr
Missing review: #1
We are not supposed to use the 'hwaddr' type on user emulation.
This series is a preparatory cleanup before few refactors to isolate further System vs User code.
Since v1:
- only restrict SavedIOTLB in header (Alex)
- convert insert/remove_breakpoint implementations (Peter)
Since v2:
- added 'dump' patch
- collected R-b tags
Philippe Mathieu-Daudé (5):
dump: Include missing "cpu.h" header for tswap32/tswap64()
declarations
cputlb: Restrict SavedIOTLB to system emulation
gdbstub: Use vaddr type for generic insert/remove_breakpoint() API target/cpu: Restrict cpu_get_phys_page_debug() handlers to sysemu target/cpu: Restrict do_transaction_failed() handlers to sysemu
accel/kvm/kvm-all.c | 4 ++-- accel/kvm/kvm-cpus.h | 4 ++-- accel/tcg/tcg-accel-ops.c | 4 ++-- dump/dump.c | 1 + gdbstub/gdbstub.c | 1 - gdbstub/internals.h | 6 ++++-- gdbstub/softmmu.c | 5 ++--- gdbstub/user.c | 5 ++--- include/hw/core/cpu.h | 6 ++++-- include/sysemu/accel-ops.h | 6 +++--- target/alpha/cpu.h | 2 +- target/arm/cpu.h | 2 +- target/arm/internals.h | 2 ++ target/cris/cpu.h | 3 +-- target/hppa/cpu.h | 2 +- target/i386/cpu.h | 5 ++--- target/m68k/cpu.h | 4 +++- target/microblaze/cpu.h | 4 ++-- target/nios2/cpu.h | 2 +- target/openrisc/cpu.h | 3 ++- target/ppc/cpu.h | 2 +- target/riscv/cpu.h | 12 ++++++------ target/rx/cpu.h | 2 +- target/rx/helper.c | 4 ++-- target/sh4/cpu.h | 2 +- target/sparc/cpu.h | 3 ++- target/xtensa/cpu.h | 2 +- 27 files changed, 52 insertions(+), 46 deletions(-)
Signature · 1 line
2.38.1
PATCH v3 1/5 dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
--- dump/dump.c | 1 + 1 file changed, 1 insertion(+)
dump/dump.c +1 -0
@@ -29,6 +29,7 @@#include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" +#include "cpu.h" #ifdef TARGET_X86_64 #include "win_dump.h"
Signature · 1 line
2.38.1
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
Quoted 10 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- dump/dump.c | 1 + 1 file changed, 1 insertion(+)dump/dump.c +0
-0
dump/dump.c line 32
Quoted 4 lines
dump/dump.c +1
-0@@ -29,6 +29,7 @@#include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" +#include "cpu.h"
Does it work to include "exec/cpu-all.h" instead?
r~
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
Quoted 6 lines · Richard Henderson
Quoted 5 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
dump/dump.c| 1 +1 file changed, 1 insertion(+)
Quoted 11 lines
dump/dump.c line 32
Quoted 9 lines
dump/dump.c +1
-0@@ -29,6 +29,7 @@ #include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" +#include "cpu.h" Does it work to include "
exec/cpu-all.h" instead?
We get:
include/exec/cpu-all.h:110:5: warning: 'TARGET_LONG_SIZE' is not defined, evaluates to 0 [-Wundef]
#if TARGET_LONG_SIZE == 4
^TARGET_LONG_SIZE is defined in "exec/cpu-defs.h" which is target specific. If I add "exec/cpu-defs.h" to "exec/cpu-all.h" I get:
In file included from ../../dump/dump.c:18:include/exec/cpu-all.h:439:8: error: incomplete definition of type 'struct ArchCPU'
cpu->parent_obj.env_ptr = &cpu->env;
~~~^Is it worth extracting the few tswapX() declarations to "exec/tswap.h"?
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 3 lines
Quoted 1 line
+#include "
cpu.h"Does it work to include "
exec/cpu-all.h" instead?We get:
include/exec/cpu-all.h:110:5: warning: 'TARGET_LONG_SIZE' is not defined, evaluates to 0 [-Wundef] #ifTARGET_LONG_SIZE== 4
^
TARGET_LONG_SIZEis defined in "exec/cpu-defs.h" which is target specific. If I add "exec/cpu-defs.h" to "exec/cpu-all.h" I get:
Quoted 6 lines
In file included from
../../dump/dump.c:18:include/exec/cpu-all.h:439:8: error: incomplete definition of type 'struct ArchCPU'
cpu->parent_obj.env_ptr=&cpu->env;
~~~^Is it worth extracting the few
tswapX()declarations to "exec/tswap.h"?
That's probably worthwhile, using cpu-param.h directly, perhaps, rather than pulling in the rest of cpu stuff?
r~
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
Quoted 15 lines · Richard Henderson
Quoted 14 lines · Philippe Mathieu-Daudé
Quoted 3 lines
Quoted 1 line
+#include "
cpu.h"Does it work to include "
exec/cpu-all.h" instead?We get:
include/exec/cpu-all.h:110:5: warning: 'TARGET_LONG_SIZE' is not defined, evaluates to 0 [-Wundef] #ifTARGET_LONG_SIZE== 4
^
TARGET_LONG_SIZEis defined in "exec/cpu-defs.h" which is target specific. If I add "exec/cpu-defs.h" to "exec/cpu-all.h" I get:
Quoted 8 lines
Quoted 6 lines
In file included from
../../dump/dump.c:18:include/exec/cpu-all.h:439:8: error: incomplete definition of type 'struct ArchCPU'cpu->parent_obj.env_ptr=&cpu->env;
~~~^Is it worth extracting the few
tswapX()declarations to "exec/tswap.h"?That's probably worthwhile, using
cpu-param.hdirectly, perhaps, rather than pulling in the rest of cpu stuff?
TARGET_BIG_ENDIAN is only defined for target-specific objects, so this as is it will never work (dump.o must be compiled for each target).
For heterogeneous emulation we need to pass a CPU[Arch]State* to get the endianness of the CPU. As of today the endianness isn't runtime, so this field doesn't exist in the common CPUState (some arch might have some equivalent field).
This file uses tswap() 4 times in the same function: get_note_sizes(), so I could extract it to a dump-target.c unit.
I have no clue what that file is for, but this particularity is odd.
Looking further, we have in "hw/core/cpu.h":
int (SysemuCPUOps::write_elf32/64_note)(WriteCoreDumpFunction, ...
but no ReadCoreDumpFunction equivalent.
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
Quoted 3 lines · Philippe Mathieu-Daudé
This file uses
tswap()4 times in the same function:get_note_sizes(), so I could extract it to adump-target.cunit.
I have no clue what that file is for, but this particularity is odd.
All uses of tswap in that file are wrong, and should be using cpu_to_dumpN, which correctly tests the endianness of the output.
r~
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
Quoted 6 lines · Richard Henderson
Quoted 3 lines · Philippe Mathieu-Daudé
This file uses
tswap()4 times in the same function:get_note_sizes(), so I could extract it to adump-target.cunit.
I have no clue what that file is for, but this particularity is odd.All uses of tswap in that file are wrong, and should be using
cpu_to_dumpN, which correctly tests the endianness of the output.
Yes! Thank you :)
Re: [PATCH v3 1/5] dump: Include missing "cpu.h" header for tswap32/tswap64() declarations
In reply to Philippe Mathieu-DaudéQuoted 2 lines · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
Quoted 15 lines
dump/dump.c | 1 + 1 file changed, 1 insertion(+)dump/dump.c +1
-0@@ -29,6 +29,7 @@#include "qemu/main-loop.h" #include "hw/misc/vmcoreinfo.h" #include "migration/blocker.h" +#include "cpu.h" #ifdef TARGET_X86_64 #include "win_dump.h"
PATCH v3 2/5 cputlb: Restrict SavedIOTLB to system emulation
In reply to Philippe Mathieu-DaudéCommit 2f3a57ee47 ("cputlb: ensure we save the IOTLB data in case of reset") added the SavedIOTLB structure -- which is system emulation specific -- in the generic CPUState structure.
--- include/hw/core/cpu.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
include/hw/core/cpu.h +4 -2
@@ -222,7 +222,7 @@ struct CPUWatchpoint {QTAILQ_ENTRY (CPUWatchpoint) entry; }; -#ifdef CONFIG_PLUGIN +#if defined(CONFIG_PLUGIN ) && !defined(CONFIG_USER_ONLY )/* * For plugins we sometime need to save the resolved iotlb data before * the memory regions get moved around by io_writex.
@@ -406,9 +406,11 @@ struct CPUState {#ifdef CONFIG_PLUGIN GArray *plugin_mem_cbs; +#if !defined(CONFIG_USER_ONLY )/* saved iotlb data from io_writex */ SavedIOTLB saved_iotlb; -#endif +#endif /* !CONFIG_USER_ONLY */ +#endif /* CONFIG_PLUGIN */ /* TODO Move common fields from CPUArchState here. */ int cpu_index;
Signature · 1 line
2.38.1
PATCH v3 3/5 gdbstub: Use vaddr type for generic insert/remove_breakpoint() API
In reply to Philippe Mathieu-DaudéBoth insert/remove_breakpoint() handlers are used in system and user emulation. We can not use the 'hwaddr' type on user emulation, we have to use 'vaddr' which is defined as "wide enough to contain any #target_ulong virtual address".
gdbstub.c doesn't require to include "exec/hwaddr.h" anymore.
--- accel/kvm/kvm-all.c | 4 ++-- accel/kvm/kvm-cpus.h | 4 ++-- accel/tcg/tcg-accel-ops.c | 4 ++-- gdbstub/gdbstub.c | 1 - gdbstub/internals.h | 6 ++++-- gdbstub/softmmu.c | 5 ++--- gdbstub/user.c | 5 ++--- include/sysemu/accel-ops.h | 6 +++--- 8 files changed, 17 insertions(+), 18 deletions(-)
accel/kvm/kvm-all.c +2 -2
@@ -3219,7 +3219,7 @@ bool kvm_supports_guest_debug(void)return kvm_has_guest_debug; } -int kvm_insert_breakpoint (CPUState *cpu,int type,hwaddr addr,hwaddr len) +int kvm_insert_breakpoint (CPUState *cpu,int type,vaddr addr,vaddr len) {struct kvm_sw_breakpoint *bp;int err;
@@ -3257,7 +3257,7 @@ int kvm_insert_breakpoint(CPUState *cpu, int type, hwaddr addr, hwaddr len)return 0 ; } -int kvm_remove_breakpoint (CPUState *cpu,int type,hwaddr addr,hwaddr len) +int kvm_remove_breakpoint (CPUState *cpu,int type,vaddr addr,vaddr len) {struct kvm_sw_breakpoint *bp;int err;
accel/kvm/kvm-cpus.h +2 -2
@@ -19,8 +19,8 @@ void kvm_cpu_synchronize_post_reset(CPUState *cpu);void kvm_cpu_synchronize_post_init (CPUState *cpu);void kvm_cpu_synchronize_pre_loadvm (CPUState *cpu);bool kvm_supports_guest_debug (void ); -int kvm_insert_breakpoint (CPUState *cpu,int type,hwaddr addr,hwaddr len); -int kvm_remove_breakpoint (CPUState *cpu,int type,hwaddr addr,hwaddr len); +int kvm_insert_breakpoint (CPUState *cpu,int type,vaddr addr,vaddr len); +int kvm_remove_breakpoint (CPUState *cpu,int type,vaddr addr,vaddr len);void kvm_remove_all_breakpoints (CPUState *cpu);#endif /* KVM_CPUS_H */
accel/tcg/tcg-accel-ops.c +2 -2
@@ -116,7 +116,7 @@ static inline int xlat_gdb_type(CPUState *cpu, int gdbtype)return cputype; } -static int tcg_insert_breakpoint (CPUState *cs,int type,hwaddr addr,hwaddr len) +static int tcg_insert_breakpoint (CPUState *cs,int type,vaddr addr,vaddr len) {CPUState *cpu;int err =0 ;
@@ -147,7 +147,7 @@ static int tcg_insert_breakpoint(CPUState *cs, int type, hwaddr addr, hwaddr len } } -static int tcg_remove_breakpoint (CPUState *cs,int type,hwaddr addr,hwaddr len) +static int tcg_remove_breakpoint (CPUState *cs,int type,vaddr addr,vaddr len) {CPUState *cpu;int err =0 ;
gdbstub/gdbstub.c +0 -1
@@ -48,7 +48,6 @@#include "sysemu/runstate.h" #include "semihosting/semihost.h" #include "exec/exec-all.h" -#include "exec/hwaddr.h" #include "sysemu/replay.h" #include "internals.h"
gdbstub/internals.h +4 -2
@@ -9,9 +9,11 @@#ifndef _INTERNALS_H_#define _INTERNALS_H_ +#include "exec/cpu-common.h" +bool gdb_supports_guest_debug (void ); -int gdb_breakpoint_insert (CPUState *cs,int type,hwaddr addr,hwaddr len); -int gdb_breakpoint_remove (CPUState *cs,int type,hwaddr addr,hwaddr len); +int gdb_breakpoint_insert (CPUState *cs,int type,vaddr addr,vaddr len); +int gdb_breakpoint_remove (CPUState *cs,int type,vaddr addr,vaddr len);void gdb_breakpoint_remove_all (CPUState *cs);#endif /* _INTERNALS_H_ */
gdbstub/softmmu.c +2 -3
@@ -11,7 +11,6 @@#include "qemu/osdep.h" #include "exec/gdbstub.h" -#include "exec/hwaddr.h" #include "sysemu/cpus.h" #include "internals.h"
@@ -24,7 +23,7 @@ bool gdb_supports_guest_debug(void)return false; } -int gdb_breakpoint_insert (CPUState *cs,int type,hwaddr addr,hwaddr len) +int gdb_breakpoint_insert (CPUState *cs,int type,vaddr addr,vaddr len) {const AccelOpsClass *ops =cpus_get_accel ();if (ops->insert_breakpoint) {
@@ -33,7 +32,7 @@ int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len)return -ENOSYS ; } -int gdb_breakpoint_remove (CPUState *cs,int type,hwaddr addr,hwaddr len) +int gdb_breakpoint_remove (CPUState *cs,int type,vaddr addr,vaddr len) {const AccelOpsClass *ops =cpus_get_accel ();if (ops->remove_breakpoint) {
gdbstub/user.c +2 -3
@@ -9,7 +9,6 @@*/ #include "qemu/osdep.h" -#include "exec/hwaddr.h" #include "exec/gdbstub.h" #include "hw/core/cpu.h" #include "internals.h"
@@ -20,7 +19,7 @@ bool gdb_supports_guest_debug(void)return true; } -int gdb_breakpoint_insert (CPUState *cs,int type,hwaddr addr,hwaddr len) +int gdb_breakpoint_insert (CPUState *cs,int type,vaddr addr,vaddr len) {CPUState *cpu;int err =0 ;
@@ -41,7 +40,7 @@ int gdb_breakpoint_insert(CPUState *cs, int type, hwaddr addr, hwaddr len) } } -int gdb_breakpoint_remove (CPUState *cs,int type,hwaddr addr,hwaddr len) +int gdb_breakpoint_remove (CPUState *cs,int type,vaddr addr,vaddr len) {CPUState *cpu;int err =0 ;
include/sysemu/accel-ops.h +3 -3
@@ -10,7 +10,7 @@#ifndef ACCEL_OPS_H #define ACCEL_OPS_H -#include "exec/hwaddr.h" +#include "exec/cpu-common.h" #include "qom/object.h" #define ACCEL_OPS_SUFFIX "-ops"
@@ -48,8 +48,8 @@ struct AccelOpsClass {/* gdbstub hooks */ bool (*supports_guest_debug)(void ); -int (*insert_breakpoint)(CPUState *cpu,int type,hwaddr addr,hwaddr len); -int (*remove_breakpoint)(CPUState *cpu,int type,hwaddr addr,hwaddr len); +int (*insert_breakpoint)(CPUState *cpu,int type,vaddr addr,vaddr len); +int (*remove_breakpoint)(CPUState *cpu,int type,vaddr addr,vaddr len);void (*remove_all_breakpoints)(CPUState *cpu); };
Signature · 1 line
2.38.1
PATCH v3 4/5 target/cpu: Restrict cpu_get_phys_page_debug() handlers to sysemu
In reply to Philippe Mathieu-DaudéThe 'hwaddr' type is only available / meaningful on system emulation.
--- target/alpha/cpu.h | 2 +- target/arm/cpu.h | 2 +- target/cris/cpu.h | 3 +-- target/hppa/cpu.h | 2 +- target/i386/cpu.h | 5 ++--- target/m68k/cpu.h | 2 +- target/microblaze/cpu.h | 4 ++-- target/nios2/cpu.h | 2 +- target/openrisc/cpu.h | 3 ++- target/ppc/cpu.h | 2 +- target/riscv/cpu.h | 2 +- target/rx/cpu.h | 2 +- target/rx/helper.c | 4 ++-- target/sh4/cpu.h | 2 +- target/sparc/cpu.h | 3 ++- target/xtensa/cpu.h | 2 +- 16 files changed, 21 insertions(+), 21 deletions(-)
target/alpha/cpu.h +1 -1
@@ -276,9 +276,9 @@ extern const VMStateDescription vmstate_alpha_cpu;void alpha_cpu_do_interrupt (CPUState *cpu);bool alpha_cpu_exec_interrupt (CPUState *cpu,int int_req); +hwaddr alpha_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#endif /* !CONFIG_USER_ONLY */ void alpha_cpu_dump_state (CPUState *cs,FILE *f,int flags); -hwaddr alpha_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int alpha_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int alpha_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/arm/cpu.h +1 -1
@@ -1085,10 +1085,10 @@ extern const VMStateDescription vmstate_arm_cpu;void arm_cpu_do_interrupt (CPUState *cpu);void arm_v7m_cpu_do_interrupt (CPUState *cpu); -#endif /* !CONFIG_USER_ONLY */ hwaddr arm_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr,MemTxAttrs *attrs); +#endif /* !CONFIG_USER_ONLY */ int arm_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int arm_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/cris/cpu.h +1 -2
@@ -193,12 +193,11 @@ bool cris_cpu_exec_interrupt(CPUState *cpu, int int_req);bool cris_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr); +hwaddr cris_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#endif void cris_cpu_dump_state (CPUState *cs,FILE *f,int flags); -hwaddr cris_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); -int crisv10_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int cris_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int cris_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/hppa/cpu.h +1 -1
@@ -322,11 +322,11 @@ static inline void cpu_hppa_change_prot_id(CPUHPPAState *env) { }void cpu_hppa_change_prot_id (CPUHPPAState *env);#endif -hwaddr hppa_cpu_get_phys_page_debug (CPUState *cs,vaddr addr);int hppa_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int hppa_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);void hppa_cpu_dump_state (CPUState *cs,FILE *f,int );#ifndef CONFIG_USER_ONLY +hwaddr hppa_cpu_get_phys_page_debug (CPUState *cs,vaddr addr);bool hppa_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr);
target/i386/cpu.h +2 -3
@@ -1987,9 +1987,6 @@ void x86_cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,void x86_cpu_dump_state (CPUState *cs,FILE *f,int flags); -hwaddr x86_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr, -MemTxAttrs *attrs); -int x86_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int x86_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
@@ -1997,6 +1994,8 @@ void x86_cpu_list(void);int cpu_x86_support_mca_broadcast (CPUX86State *env);#ifndef CONFIG_USER_ONLY +hwaddr x86_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr, +MemTxAttrs *attrs);int cpu_get_pic_interrupt (CPUX86State *s);/* MSDOS compatibility mode FPU exception support */
target/m68k/cpu.h +1 -1
@@ -176,9 +176,9 @@ struct ArchCPU {#ifndef CONFIG_USER_ONLY void m68k_cpu_do_interrupt (CPUState *cpu);bool m68k_cpu_exec_interrupt (CPUState *cpu,int int_req); +hwaddr m68k_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#endif /* !CONFIG_USER_ONLY */ void m68k_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr m68k_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int m68k_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int m68k_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/microblaze/cpu.h +2 -2
@@ -358,13 +358,13 @@ struct ArchCPU {#ifndef CONFIG_USER_ONLY void mb_cpu_do_interrupt (CPUState *cs);bool mb_cpu_exec_interrupt (CPUState *cs,int int_req); +hwaddr mb_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr, +MemTxAttrs *attrs);#endif /* !CONFIG_USER_ONLY */ G_NORETURN void mb_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,MMUAccessType access_type,int mmu_idx,uintptr_t retaddr);void mb_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr mb_cpu_get_phys_page_attrs_debug (CPUState *cpu,vaddr addr, -MemTxAttrs *attrs);int mb_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int mb_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);
target/nios2/cpu.h +1 -1
@@ -262,7 +262,6 @@ void nios2_tcg_init(void);void nios2_cpu_do_interrupt (CPUState *cs);void dump_mmu (CPUNios2State *env);void nios2_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr nios2_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); G_NORETURN void nios2_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,MMUAccessType access_type,int mmu_idx,uintptr_t retaddr);
@@ -288,6 +287,7 @@ static inline int cpu_mmu_index(CPUNios2State *env, bool ifetch) }#ifndef CONFIG_USER_ONLY +hwaddr nios2_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);bool nios2_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr);
target/openrisc/cpu.h +2 -1
@@ -312,7 +312,6 @@ struct ArchCPU {void cpu_openrisc_list (void );void openrisc_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr openrisc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int openrisc_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int openrisc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);void openrisc_translate_init (void );
@@ -321,6 +320,8 @@ int print_insn_or1k(bfd_vma addr, disassemble_info *info);#define cpu_list cpu_openrisc_list#ifndef CONFIG_USER_ONLY +hwaddr openrisc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); +bool openrisc_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr);
target/ppc/cpu.h +1 -1
@@ -1346,12 +1346,12 @@ static inline bool vhyp_cpu_in_nested(PowerPCCPU *cpu)#endif /* CONFIG_USER_ONLY */ void ppc_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr ppc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int ppc_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int ppc_cpu_gdb_read_register_apple (CPUState *cpu,GByteArray *buf,int reg);int ppc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg);int ppc_cpu_gdb_write_register_apple (CPUState *cpu,uint8_t *buf,int reg);#ifndef CONFIG_USER_ONLY +hwaddr ppc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void ppc_gdb_gen_spr_xml (PowerPCCPU *cpu);const char *ppc_gdb_get_dynamic_xml (CPUState *cs,const char *xml_name);#endif
target/riscv/cpu.h +1 -1
@@ -553,7 +553,6 @@ bool riscv_cpu_virt_enabled(CPURISCVState *env);void riscv_cpu_set_virt_enabled (CPURISCVState *env,bool enable);bool riscv_cpu_two_stage_lookup (int mmu_idx);int riscv_cpu_mmu_index (CPURISCVState *env,bool ifetch); -hwaddr riscv_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr); G_NORETURN void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,MMUAccessType access_type,int mmu_idx,uintptr_t retaddr);
@@ -572,6 +571,7 @@ void riscv_cpu_list(void);#define cpu_mmu_index riscv_cpu_mmu_index#ifndef CONFIG_USER_ONLY +hwaddr riscv_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);bool riscv_cpu_exec_interrupt (CPUState *cs,int interrupt_request);void riscv_cpu_swap_hypervisor_regs (CPURISCVState *env);int riscv_cpu_claim_interrupts (RISCVCPU *cpu,uint64_t interrupts);
target/rx/cpu.h +1 -1
@@ -123,11 +123,11 @@ const char *rx_crname(uint8_t cr);#ifndef CONFIG_USER_ONLY void rx_cpu_do_interrupt (CPUState *cpu);bool rx_cpu_exec_interrupt (CPUState *cpu,int int_req); +hwaddr rx_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#endif /* !CONFIG_USER_ONLY */ void rx_cpu_dump_state (CPUState *cpu,FILE *f,int flags);int rx_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int rx_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); -hwaddr rx_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void rx_translate_init (void );void rx_cpu_list (void );
target/rx/helper.c +2 -2
@@ -144,9 +144,9 @@ bool rx_cpu_exec_interrupt(CPUState *cs, int interrupt_request) return false; } -#endif /* !CONFIG_USER_ONLY */ -hwaddr rx_cpu_get_phys_page_debug (CPUState *cs,vaddr addr) {return addr; } + +#endif /* !CONFIG_USER_ONLY */
target/sh4/cpu.h +1 -1
@@ -214,7 +214,6 @@ struct ArchCPU {void superh_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr superh_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int superh_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int superh_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); G_NORETURN void superh_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
@@ -225,6 +224,7 @@ void sh4_translate_init(void);void sh4_cpu_list (void );#if !defined(CONFIG_USER_ONLY ) +hwaddr superh_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);bool superh_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr);
target/sparc/cpu.h +2 -1
@@ -569,10 +569,11 @@ struct ArchCPU {#ifndef CONFIG_USER_ONLY extern const VMStateDescription vmstate_sparc_cpu; + +hwaddr sparc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#endif void sparc_cpu_do_interrupt (CPUState *cpu); -hwaddr sparc_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);int sparc_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);int sparc_cpu_gdb_write_register (CPUState *cpu,uint8_t *buf,int reg); G_NORETURN void sparc_cpu_do_unaligned_access(CPUState *cpu, vaddr addr,
target/xtensa/cpu.h +1 -1
@@ -576,9 +576,9 @@ void xtensa_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr, vaddr addr, unsigned size, MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr); +hwaddr xtensa_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);#endif void xtensa_cpu_dump_state (CPUState *cpu,FILE *f,int flags); -hwaddr xtensa_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);void xtensa_count_regs (const XtensaConfig *config,unsigned *n_regs,unsigned *n_core_regs);int xtensa_cpu_gdb_read_register (CPUState *cpu,GByteArray *buf,int reg);
Signature · 1 line
2.38.1
PATCH v3 5/5 target/cpu: Restrict do_transaction_failed() handlers to sysemu
In reply to Philippe Mathieu-DaudéThe 'hwaddr' type is only available / meaningful on system emulation.
--- target/arm/internals.h | 2 ++ target/m68k/cpu.h | 2 ++ target/riscv/cpu.h | 10 +++++----- 3 files changed, 9 insertions(+), 5 deletions(-)
target/arm/internals.h +2 -0
@@ -624,6 +624,7 @@ G_NORETURN void arm_cpu_do_unaligned_access(CPUState *cs, vaddr vaddr,MMUAccessType access_type, int mmu_idx, uintptr_t retaddr); +#ifndef CONFIG_USER_ONLY /* arm_cpu_do_transaction_failed: handle a memory system error response * (eg "no device/memory present at address") by raising an external abort * exception
@@ -633,6 +634,7 @@ void arm_cpu_do_transaction_failed(CPUState *cs, hwaddr physaddr,MMUAccessType access_type, int mmu_idx, MemTxAttrs attrs, MemTxResult response, uintptr_t retaddr); +#endif /* Call any registered EL change hooks */ static inline void arm_call_pre_el_change_hook (ARMCPU *cpu)
target/m68k/cpu.h +2 -0
@@ -581,10 +581,12 @@ static inline int cpu_mmu_index (CPUM68KState *env, bool ifetch)bool m68k_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr); +#ifndef CONFIG_USER_ONLY void m68k_cpu_transaction_failed (CPUState *cs,hwaddr physaddr,vaddr addr,unsigned size,MMUAccessType access_type,int mmu_idx,MemTxAttrs attrs,MemTxResult response,uintptr_t retaddr); +#endif #include "exec/cpu-all.h"
target/riscv/cpu.h +5 -5
@@ -559,11 +559,6 @@ G_NORETURN void riscv_cpu_do_unaligned_access(CPUState *cs, vaddr addr,bool riscv_cpu_tlb_fill (CPUState *cs,vaddr address,int size,MMUAccessType access_type,int mmu_idx,bool probe,uintptr_t retaddr); -void riscv_cpu_do_transaction_failed (CPUState *cs,hwaddr physaddr, -vaddr addr,unsigned size, -MMUAccessType access_type, -int mmu_idx,MemTxAttrs attrs, -MemTxResult response,uintptr_t retaddr);char *riscv_isa_string (RISCVCPU *cpu);void riscv_cpu_list (void );
@@ -571,6 +566,11 @@ void riscv_cpu_list(void);#define cpu_mmu_index riscv_cpu_mmu_index#ifndef CONFIG_USER_ONLY +void riscv_cpu_do_transaction_failed (CPUState *cs,hwaddr physaddr, +vaddr addr,unsigned size, +MMUAccessType access_type, +int mmu_idx,MemTxAttrs attrs, +MemTxResult response,uintptr_t retaddr);hwaddr riscv_cpu_get_phys_page_debug (CPUState *cpu,vaddr addr);bool riscv_cpu_exec_interrupt (CPUState *cs,int interrupt_request);void riscv_cpu_swap_hypervisor_regs (CPURISCVState *env);
Signature · 1 line
2.38.1