exec: Rework of various headers (user focused)
Subsystems (2)
cover exec: Rework of various headers (user focused)
Hi,
These patches are extracted from a bigger work where "exec/{exec,cpu,translate}-all.h" are split in various specific APIs. This helped:
- differenciate/build:
. user VS system
. target-specific VS generic
which is necessary for heterogeneous build
- reduced header pressure
- clarify APIs
This series is focused on user (vs system) cleanups. More useful changes will come after.
Regards,
Phil.
Philippe Mathieu-Daudé (24):
exec: Include 'cpu.h' before validating CPUArchState placement
exec: Expose 'target_page.h' API to user emulation
target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h'
accel: Include missing 'exec/cpu_ldst.h' header semihosting/uaccess: Avoid including 'cpu.h' semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header host/load-extract: Include missing 'qemu/atomic.h' and 'qemu/int128.h' host/atomic128: Include missing 'qemu/atomic.h' header hw/ppc/spapr_hcall: Remove unused 'exec/exec-all.h' included header hw/misc/mips_itu: Remove unnecessary 'exec/exec-all.h' header hw/s390x/ipl: Remove unused 'exec/exec-all.h' included header target/i386: Include missing 'exec/exec-all.h' header accel/tcg: Include missing 'hw/core/cpu.h' header
gdbstub: Include missing 'hw/core/cpu.h' header exec/cpu-all: Remove unused headers
exec/cpu-all: Reduce 'qemu/rcu.h' header inclusion target/ppc/excp_helper: Avoid 'abi_ptr' in system emulation accel/tcg: Un-inline retaddr helpers to 'user-retaddr.h' exec/user: Do not include 'cpu.h' in 'abitypes.h'
exec: Declare abi_ptr type in its own 'tcg/abi_ptr.h' header exec/cpu_ldst: Avoid including 'cpu.h'
exec/cpu-all: Restrict inclusion of 'exec/user/guest-base.h' exec/cpu-all: Extract page-protection definitions to
page-prot-common.h
target: Restrict 'sysemu/reset.h' to system emulation
meson.build | 2 +- accel/tcg/user-retaddr.h | 28 ++++++++++ bsd-user/bsd-mem.h | 1 + bsd-user/qemu.h | 1 + host/include/generic/host/atomic128-cas.h | 2 + host/include/generic/host/atomic128-ldst.h | 2 + .../generic/host/load-extract-al16-al8.h | 3 ++ include/exec/cpu-all.h | 50 +++--------------- include/exec/cpu_ldst.h | 51 ++++--------------- include/exec/exec-all.h | 1 + include/exec/page-prot-common.h | 38 ++++++++++++++ include/exec/ram_addr.h | 1 + include/exec/translator.h | 5 +- include/exec/user/abitypes.h | 9 +++- include/exec/user/guest-base.h | 6 +++ include/semihosting/uaccess.h | 3 +- include/tcg/abi_ptr.h | 32 ++++++++++++ target/alpha/cpu-param.h | 3 ++ target/alpha/cpu.h | 3 -- target/arm/cpu-param.h | 8 +-- target/arm/cpu.h | 4 +- target/avr/cpu-param.h | 2 + target/avr/cpu.h | 2 - target/hppa/cpu-param.h | 6 +++ target/hppa/cpu.h | 6 --- target/i386/cpu-param.h | 3 ++ target/i386/cpu.h | 3 -- target/loongarch/cpu-param.h | 2 + target/loongarch/cpu.h | 2 - target/microblaze/cpu-param.h | 3 ++ target/microblaze/cpu.h | 3 -- target/mips/cpu-param.h | 2 + target/mips/cpu.h | 2 - target/openrisc/cpu-param.h | 2 + target/openrisc/cpu.h | 2 - target/ppc/cpu-param.h | 2 + target/ppc/cpu.h | 2 - target/ppc/internal.h | 1 + target/ppc/mmu-radix64.h | 2 + target/riscv/cpu-param.h | 2 + target/riscv/cpu.h | 2 - target/s390x/cpu-param.h | 6 +++ target/s390x/cpu.h | 3 -- target/sparc/cpu-param.h | 23 +++++++++ target/sparc/cpu.h | 23 --------- target/xtensa/cpu-param.h | 3 ++ target/xtensa/cpu.h | 3 -- accel/tcg/cpu-exec.c | 3 ++ accel/tcg/cputlb.c | 2 + accel/tcg/tb-maint.c | 1 + accel/tcg/tcg-accel-ops.c | 2 + accel/tcg/translator.c | 1 + accel/tcg/user-exec.c | 2 + bsd-user/main.c | 1 + bsd-user/mmap.c | 1 + bsd-user/signal.c | 1 + cpu-target.c | 1 + gdbstub/gdbstub.c | 1 + hw/misc/mips_itu.c | 3 +- hw/ppc/ppc440_bamboo.c | 1 + hw/ppc/sam460ex.c | 1 + hw/ppc/spapr_hcall.c | 1 - hw/ppc/virtex_ml507.c | 1 + hw/s390x/ipl.c | 1 - linux-user/arm/cpu_loop.c | 1 + linux-user/elfload.c | 2 + linux-user/main.c | 1 + linux-user/mmap.c | 1 + linux-user/nios2/cpu_loop.c | 1 + linux-user/signal.c | 1 + linux-user/syscall.c | 1 + page-target.c | 43 ++++++++++++++++ semihosting/guestfd.c | 1 - system/physmem.c | 36 +------------ target/alpha/helper.c | 1 + target/arm/ptw.c | 1 + target/arm/tcg/m_helper.c | 1 + target/arm/tcg/mte_helper.c | 1 + target/arm/tcg/sve_helper.c | 1 + target/avr/helper.c | 1 + target/cris/mmu.c | 1 + target/hexagon/translate.c | 1 + target/hppa/mem_helper.c | 1 + target/hppa/translate.c | 1 + target/i386/cpu.c | 2 +- target/i386/tcg/fpu_helper.c | 1 + target/i386/tcg/sysemu/excp_helper.c | 1 + target/loongarch/cpu.c | 2 + target/loongarch/tlb_helper.c | 1 + target/m68k/helper.c | 1 + target/microblaze/cpu.c | 1 + target/microblaze/helper.c | 1 + target/microblaze/mmu.c | 1 + target/microblaze/translate.c | 1 + target/mips/sysemu/physaddr.c | 1 + target/mips/tcg/sysemu/tlb_helper.c | 1 + target/nios2/helper.c | 1 + target/nios2/mmu.c | 1 + target/nios2/translate.c | 1 + target/openrisc/mmu.c | 1 + target/ppc/excp_helper.c | 2 +- target/ppc/mmu-hash32.c | 1 + target/ppc/mmu-hash64.c | 1 + target/ppc/mmu-radix64.c | 1 + target/ppc/mmu_common.c | 1 + target/ppc/mmu_helper.c | 1 + target/riscv/cpu_helper.c | 1 + target/riscv/pmp.c | 1 + target/riscv/vector_helper.c | 1 + target/rx/cpu.c | 1 + target/s390x/mmu_helper.c | 1 + target/s390x/tcg/mem_helper.c | 1 + target/sh4/helper.c | 1 + target/sparc/ldst_helper.c | 1 + target/sparc/mmu_helper.c | 1 + target/tricore/helper.c | 1 + target/xtensa/mmu_helper.c | 1 + target/xtensa/op_helper.c | 1 + 118 files changed, 332 insertions(+), 192 deletions(-) create mode 100644 accel/tcg/user-retaddr.h create mode 100644 include/exec/page-prot-common.h create mode 100644 include/tcg/abi_ptr.h create mode 100644 page-target.c
Signature · 1 line
2.41.0
PATCH 1/24 exec: Include 'cpu.h' before validating CPUArchState placement
CPUArchState 'env' field is defined within the ArchCPU structure, so we need to include each target "cpu.h" header which defines it.
--- include/exec/cpu-all.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
include/exec/cpu-all.h +5 -4
@@ -411,10 +411,6 @@ static inline bool tlb_hit(uint64_t tlb_addr, vaddr addr)/* accel/tcg/cpu-exec.c */ int cpu_exec (CPUState *cpu); -/* Validate correct placement of CPUArchState. */ -QEMU_BUILD_BUG_ON (offsetof(ArchCPU , parent_obj) !=0 ); -QEMU_BUILD_BUG_ON (offsetof(ArchCPU , env) !=sizeof (CPUState)); -/** * env_archcpu(env) * @env: The architecture environment
@@ -437,4 +433,9 @@ static inline CPUState *env_cpu(CPUArchState *env) return (void *)env - sizeof(CPUState); } +/* Validate correct placement of CPUArchState. */ +#include "cpu.h" +QEMU_BUILD_BUG_ON (offsetof(ArchCPU , parent_obj) !=0 ); +QEMU_BUILD_BUG_ON (offsetof(ArchCPU , env) !=sizeof (CPUState)); +#endif /* CPU_ALL_H */
Signature · 1 line
2.41.0
Re: [PATCH 01/24] exec: Include 'cpu.h' before validating CPUArchState placement
Quoted 8 lines · Philippe Mathieu-Daudé
CPUArchState 'env' field is defined within the ArchCPU structure, so we need to include each target "
cpu.h" header which defines it.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-all.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
Warner Losh
Reviewed-byRe: [PATCH 01/24] exec: Include 'cpu.h' before validating CPUArchState placement
Quoted 8 lines · Warner Losh
Quoted 3 lines · Philippe Mathieu-Daudé
CPUArchState 'env' field is defined within the ArchCPU structure, so we need to include each target "
cpu.h" header which defines it.
Quoted 8 lines
Quoted 5 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-all.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)Signed-off-by Warner Losh <[email protected]>
Brain f**** I meant:
PATCH 2/24 exec: Expose 'target_page.h' API to user emulation
In reply to Philippe Mathieu-DaudéUser-only objects might benefit from the "exec/target_page.h" API, which allows to build some objects once for all targets.
--- meson.build | 2 +- page-target.c | 43 +++++++++++++++++++++++++++++++++++++++++++ system/physmem.c | 35 ----------------------------------- 3 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 page-target.c
meson.build +1 -1
@@ -3488,7 +3488,7 @@ if get_option('b_lto') pagevary = declare_dependency(link_with: pagevary) endif common_ss.add(pagevary) -specific_ss.add(files('page-vary-target.c')) +specific_ss.add(files('page-target.c', 'page-vary-target.c')) subdir('backends') subdir('disas')
page-target.c new file +43 -0
43 lines not on this page · raw message
system/physmem.c +0 -35
@@ -3422,41 +3422,6 @@ int cpu_memory_rw_debug(CPUState *cpu, vaddr addr,return 0 ; } -/* -* Allows code that needs to deal with migration bitmaps etc to still be built -* target independent. -*/ -size_t qemu_target_page_size (void ) -{ -return TARGET_PAGE_SIZE ; -} - -int qemu_target_page_mask (void ) -{ -return TARGET_PAGE_MASK ; -} - -int qemu_target_page_bits (void ) -{ -return TARGET_PAGE_BITS ; -} - -int qemu_target_page_bits_min (void ) -{ -return TARGET_PAGE_BITS_MIN ; -} - -/* Convert target pages to MiB (2**20). */ -size_t qemu_target_pages_to_MiB (size_t pages) -{ -int page_bits =TARGET_PAGE_BITS ; - -/* So far, the largest (non-huge) page size is 64k, i.e. 16 bits. */ -g_assert (page_bits <20 ); - -return pages >> (20 - page_bits); -} -bool cpu_physical_memory_is_io (hwaddr phys_addr) {MemoryRegion *mr;
Signature · 1 line
2.41.0
Re: [PATCH 02/24] exec: Expose 'target_page.h' API to user emulation
Quoted 11 lines · Philippe Mathieu-Daudé
User-only objects might benefit from the "
exec/target_page.h" API, which allows to build some objects once for all targets.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- meson.build | 2 +- page-target.c | 43 +++++++++++++++++++++++++++++++++++++++++++ system/physmem.c | 35 ----------------------------------- 3 files changed, 44 insertions(+), 36 deletions(-) create mode 100644 page-target.c
Re: [PATCH 02/24] exec: Expose 'target_page.h' API to user emulation
In reply to Philippe Mathieu-DaudéQuoted 10 lines · Philippe Mathieu-Daudé
User-only objects might benefit from the "
exec/target_page.h" API, which allows to build some objects once for all targets.Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- meson.build | 2 +- page-target.c | 43 +++++++++++++++++++++++++++++++++++++++++++ system/physmem.c | 35 ----------------------------------- 3 files changed, 44 insertions(+), 36 deletions(-)create mode 100644
page-target.c
r~
PATCH 3/24 target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h'
In reply to Philippe Mathieu-Daudéaccel/tcg/ files requires the following definitions:
- TARGET_LONG_BITS
- TARGET_PAGE_BITS
- TARGET_PHYS_ADDR_SPACE_BITS
- TCG_GUEST_DEFAULT_MO
The first 3 are defined in "cpu-param.h". The last one in "cpu.h", with a bunch of definitions irrelevant for TCG. By moving the TCG_GUEST_DEFAULT_MO definition to "cpu-param.h", we can simplify various accel/tcg includes.
--- target/alpha/cpu-param.h | 3 +++ target/alpha/cpu.h | 3 --- target/arm/cpu-param.h | 8 +++++--- target/arm/cpu.h | 3 --- target/avr/cpu-param.h | 2 ++ target/avr/cpu.h | 2 -- target/hppa/cpu-param.h | 6 ++++++ target/hppa/cpu.h | 6 ------ target/i386/cpu-param.h | 3 +++ target/i386/cpu.h | 3 --- target/loongarch/cpu-param.h | 2 ++ target/loongarch/cpu.h | 2 -- target/microblaze/cpu-param.h | 3 +++ target/microblaze/cpu.h | 3 --- target/mips/cpu-param.h | 2 ++ target/mips/cpu.h | 2 -- target/openrisc/cpu-param.h | 2 ++ target/openrisc/cpu.h | 2 -- target/ppc/cpu-param.h | 2 ++ target/ppc/cpu.h | 2 -- target/riscv/cpu-param.h | 2 ++ target/riscv/cpu.h | 2 -- target/s390x/cpu-param.h | 6 ++++++ target/s390x/cpu.h | 3 --- target/sparc/cpu-param.h | 23 +++++++++++++++++++++++ target/sparc/cpu.h | 23 ----------------------- target/xtensa/cpu-param.h | 3 +++ target/xtensa/cpu.h | 3 --- 28 files changed, 64 insertions(+), 62 deletions(-)
target/alpha/cpu-param.h +3 -0
@@ -15,4 +15,7 @@#define TARGET_PHYS_ADDR_SPACE_BITS 44#define TARGET_VIRT_ADDR_SPACE_BITS (30 + TARGET_PAGE_BITS) +/* Alpha processors have a weak memory model */ +#define TCG_GUEST_DEFAULT_MO (0) +#endif
target/alpha/cpu.h +0 -3
@@ -24,9 +24,6 @@#include "exec/cpu-defs.h" #include "qemu/cpu-float.h" -/* Alpha processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) -#define ICACHE_LINE_SIZE 32#define DCACHE_LINE_SIZE 32
target/arm/cpu-param.h +5 -3
@@ -23,14 +23,16 @@# ifdef TARGET_AARCH64 # define TARGET_TAGGED_ADDRESSES # endif -#else +#else /* !CONFIG_USER_ONLY */ /* * ARMv7 and later CPUs have 4K pages minimum, but ARMv5 and v6 * have to support 1K tiny pages. */ # define TARGET_PAGE_BITS_VARY # define TARGET_PAGE_BITS_MIN 10 - -#endif +#endif /* !CONFIG_USER_ONLY */ + +/* ARM processors have a weak memory model */ +#define TCG_GUEST_DEFAULT_MO (0)#endif
target/arm/cpu.h +0 -3
@@ -27,9 +27,6 @@#include "exec/cpu-defs.h" #include "qapi/qapi-types-common.h" -/* ARM processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) -#ifdef TARGET_AARCH64 #define KVM_HAVE_MCE_INJECTION 1#endif
target/avr/cpu-param.h +2 -0
@@ -32,4 +32,6 @@#define TARGET_PHYS_ADDR_SPACE_BITS 24#define TARGET_VIRT_ADDR_SPACE_BITS 24 +#define TCG_GUEST_DEFAULT_MO 0 +#endif
target/avr/cpu.h +0 -2
@@ -30,8 +30,6 @@#define CPU_RESOLVING_TYPE TYPE_AVR_CPU -#define TCG_GUEST_DEFAULT_MO 0 -/* * AVR has two memory spaces, data & code. * e.g. both have 0 address
target/hppa/cpu-param.h +6 -0
@@ -21,4 +21,10 @@#define TARGET_PAGE_BITS 12 +/* PA-RISC 1.x processors have a strong memory model. */ +/* ??? While we do not yet implement PA-RISC 2.0, those processors have +a weak memory model, but with TLB bits that force ordering on a per-page +basis. It's probably easier to fall back to a strong memory model. */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
target/hppa/cpu.h +0 -6
@@ -25,12 +25,6 @@#include "qemu/cpu-float.h" #include "qemu/interval-tree.h" -/* PA-RISC 1.x processors have a strong memory model. */ -/* ??? While we do not yet implement PA-RISC 2.0, those processors have -a weak memory model, but with TLB bits that force ordering on a per-page -basis. It's probably easier to fall back to a strong memory model. */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#define MMU_ABS_W_IDX 6#define MMU_ABS_IDX 7#define MMU_KERNEL_IDX 8
target/i386/cpu-param.h +3 -0
@@ -24,4 +24,7 @@#endif #define TARGET_PAGE_BITS 12 +/* The x86 has a strong memory model with some store-after-load re-ordering */ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) +#endif
target/i386/cpu.h +0 -3
@@ -30,9 +30,6 @@#define XEN_NR_VIRQS 24 -/* The x86 has a strong memory model with some store-after-load re-ordering */ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#define KVM_HAVE_MCE_INJECTION 1/* support for self modifying code even if the modified instruction is
target/loongarch/cpu-param.h +2 -0
@@ -14,4 +14,6 @@#define TARGET_PAGE_BITS 12 +#define TCG_GUEST_DEFAULT_MO (0) +#endif
target/loongarch/cpu.h +0 -2
@@ -39,8 +39,6 @@#define IOCSR_MEM_SIZE 0x428 -#define TCG_GUEST_DEFAULT_MO (0) -#define FCSR0_M1 0x1f/* FCSR1 mask, Enables */ #define FCSR0_M2 0x1f1f0000/* FCSR2 mask, Cause and Flags */ #define FCSR0_M3 0x300/* FCSR3 mask, Round Mode */
target/microblaze/cpu-param.h +3 -0
@@ -29,4 +29,7 @@/* FIXME: MB uses variable pages down to 1K but linux only uses 4k. */ #define TARGET_PAGE_BITS 12 +/* MicroBlaze is always in-order. */ +#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif
target/microblaze/cpu.h +0 -3
@@ -24,9 +24,6 @@#include "exec/cpu-defs.h" #include "qemu/cpu-float.h" -/* MicroBlaze is always in-order. */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -typedef struct CPUArchState CPUMBState ;#if !defined(CONFIG_USER_ONLY )#include "mmu.h"
target/mips/cpu-param.h +2 -0
@@ -30,4 +30,6 @@#define TARGET_PAGE_BITS_MIN 12#endif +#define TCG_GUEST_DEFAULT_MO (0) +#endif
target/mips/cpu.h +0 -2
@@ -10,8 +10,6 @@#include "hw/clock.h" #include "mips-defs.h" -#define TCG_GUEST_DEFAULT_MO (0) -typedef struct CPUMIPSTLBContext CPUMIPSTLBContext ;/* MSA Context */
target/openrisc/cpu-param.h +2 -0
@@ -13,4 +13,6 @@#define TARGET_PHYS_ADDR_SPACE_BITS 32#define TARGET_VIRT_ADDR_SPACE_BITS 32 +#define TCG_GUEST_DEFAULT_MO (0) +#endif
target/openrisc/cpu.h +0 -2
@@ -24,8 +24,6 @@#include "exec/cpu-defs.h" #include "fpu/softfloat-types.h" -#define TCG_GUEST_DEFAULT_MO (0) -/** * OpenRISCCPUClass: * @parent_realize: The parent class' realize handler.
target/ppc/cpu-param.h +2 -0
@@ -33,4 +33,6 @@#endif #define TARGET_PAGE_BITS 12 +#define TCG_GUEST_DEFAULT_MO 0 +#endif
target/ppc/cpu.h +0 -2
@@ -29,8 +29,6 @@#define CPU_RESOLVING_TYPE TYPE_POWERPC_CPU -#define TCG_GUEST_DEFAULT_MO 0 -#define TARGET_PAGE_BITS_64K 16#define TARGET_PAGE_BITS_16M 24
target/riscv/cpu-param.h +2 -0
@@ -28,4 +28,6 @@* - M mode HLV/HLVX/HSV 0b111 */ +#define TCG_GUEST_DEFAULT_MO 0 +#endif
target/riscv/cpu.h +0 -2
@@ -42,8 +42,6 @@ typedef struct CPUArchState CPURISCVState;# define TYPE_RISCV_CPU_BASE TYPE_RISCV_CPU_BASE64#endif -#define TCG_GUEST_DEFAULT_MO 0 -/* * RISC-V-specific extra insn start words: * 1: Original instruction opcode
target/s390x/cpu-param.h +6 -0
@@ -13,4 +13,10 @@#define TARGET_PHYS_ADDR_SPACE_BITS 64#define TARGET_VIRT_ADDR_SPACE_BITS 64 +/* +* The z/Architecture has a strong memory model with some +* store-after-load re-ordering. +*/ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) +#endif
target/s390x/cpu.h +0 -3
@@ -33,9 +33,6 @@#define ELF_MACHINE_UNAME "S390X" -/* The z/Architecture has a strong memory model with some store-after-load re-ordering */ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD) -#define TARGET_HAS_PRECISE_SMC #define TARGET_INSN_START_EXTRA_WORDS 2
target/sparc/cpu-param.h +23 -0
@@ -23,4 +23,27 @@# define TARGET_VIRT_ADDR_SPACE_BITS 32#endif +/* +* From Oracle SPARC Architecture 2015: +* +* Compatibility notes: The PSO memory model described in SPARC V8 and +* SPARC V9 compatibility architecture specifications was never implemented +* in a SPARC V9 implementation and is not included in the Oracle SPARC +* Architecture specification. +* +* The RMO memory model described in the SPARC V9 specification was +* implemented in some non-Sun SPARC V9 implementations, but is not +* directly supported in Oracle SPARC Architecture 2015 implementations. +* +* Therefore always use TSO in QEMU. +* +* D.5 Specification of Partial Store Order (PSO) +* ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. +* +* D.6 Specification of Total Store Order (TSO) +* ... PSO with the additional requirement that all [stores] are followed +* by an implied MEMBAR #StoreStore. +*/ +#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) +#endif
target/sparc/cpu.h +0 -23
@@ -6,29 +6,6 @@#include "exec/cpu-defs.h" #include "qemu/cpu-float.h" -/* -* From Oracle SPARC Architecture 2015: -* -* Compatibility notes: The PSO memory model described in SPARC V8 and -* SPARC V9 compatibility architecture specifications was never implemented -* in a SPARC V9 implementation and is not included in the Oracle SPARC -* Architecture specification. -* -* The RMO memory model described in the SPARC V9 specification was -* implemented in some non-Sun SPARC V9 implementations, but is not -* directly supported in Oracle SPARC Architecture 2015 implementations. -* -* Therefore always use TSO in QEMU. -* -* D.5 Specification of Partial Store Order (PSO) -* ... [loads] are followed by an implied MEMBAR #LoadLoad | #LoadStore. -* -* D.6 Specification of Total Store Order (TSO) -* ... PSO with the additional requirement that all [stores] are followed -* by an implied MEMBAR #StoreStore. -*/ -#define TCG_GUEST_DEFAULT_MO (TCG_MO_LD_LD | TCG_MO_LD_ST | TCG_MO_ST_ST) -#if !defined(TARGET_SPARC64 )#define TARGET_DPREGS 16#else
target/xtensa/cpu-param.h +3 -0
@@ -17,4 +17,7 @@#define TARGET_VIRT_ADDR_SPACE_BITS 32#endif +/* Xtensa processors have a weak memory model */ +#define TCG_GUEST_DEFAULT_MO (0) +#endif
target/xtensa/cpu.h +0 -3
@@ -34,9 +34,6 @@#include "hw/clock.h" #include "xtensa-isa.h" -/* Xtensa processors have a weak memory model */ -#define TCG_GUEST_DEFAULT_MO (0) -enum {/* Additional instructions */ XTENSA_OPTION_CODE_DENSITY ,
Signature · 1 line
2.41.0
Re: [PATCH 03/24] target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h'
Quoted 50 lines · Philippe Mathieu-Daudé
accel/tcg/ files requires the following definitions:
-
TARGET_LONG_BITS
-TARGET_PAGE_BITS
-TARGET_PHYS_ADDR_SPACE_BITS
-TCG_GUEST_DEFAULT_MOThe first 3 are defined in "
cpu-param.h". The last one in "cpu.h", with a bunch of definitions irrelevant for TCG. By moving theTCG_GUEST_DEFAULT_MOdefinition to "cpu-param.h", we can simplify various accel/tcg includes.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/alpha/cpu-param.h | 3 +++ target/alpha/cpu.h | 3 --- target/arm/cpu-param.h | 8 +++++--- target/arm/cpu.h | 3 --- target/avr/cpu-param.h | 2 ++ target/avr/cpu.h | 2 -- target/hppa/cpu-param.h | 6 ++++++ target/hppa/cpu.h | 6 ------ target/i386/cpu-param.h | 3 +++ target/i386/cpu.h | 3 --- target/loongarch/cpu-param.h | 2 ++ target/loongarch/cpu.h | 2 -- target/microblaze/cpu-param.h | 3 +++ target/microblaze/cpu.h | 3 --- target/mips/cpu-param.h | 2 ++ target/mips/cpu.h | 2 -- target/openrisc/cpu-param.h | 2 ++ target/openrisc/cpu.h | 2 -- target/ppc/cpu-param.h | 2 ++ target/ppc/cpu.h | 2 -- target/riscv/cpu-param.h | 2 ++ target/riscv/cpu.h | 2 -- target/s390x/cpu-param.h | 6 ++++++ target/s390x/cpu.h | 3 --- target/sparc/cpu-param.h | 23 +++++++++++++++++++++++ target/sparc/cpu.h | 23 ----------------------- target/xtensa/cpu-param.h | 3 +++ target/xtensa/cpu.h | 3 --- 28 files changed, 64 insertions(+), 62 deletions(-)target/hppa/cpu-param.h +0
-0
target/hppa/cpu-param.h line 27
Quoted 7 lines
target/hppa/cpu-param.h +4
-0@@ -21,4 +21,10 @@#define TARGET_PAGE_BITS 12 +/* PA-RISC 1.x processors have a strong memory model. */ +/* ??? While we do not yet implement PA-RISC 2.0, those processors have +a weak memory model, but with TLB bits that force ordering on a per-page +basis. It's probably easier to fall back to a strong memory model. */
Forgot to squash:
-- >8 --
@@ -24,5 +24,7 @@
/* PA-RISC 1.x processors have a strong memory model. */
-/* ??? While we do not yet implement PA-RISC 2.0, those processors have
- a weak memory model, but with TLB bits that force ordering on a per-page
- basis. It's probably easier to fall back to a strong memory model. */
+/*
+ * ??? While we do not yet implement PA-RISC 2.0, those processors have
+ * a weak memory model, but with TLB bits that force ordering on a per-page
+ * basis. It's probably easier to fall back to a strong memory model.
+ */
---
Quoted 20 lines
target/hppa/cpu-param.h +2
-0+#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL +#endif target/hppa/cpu.h +0
-6@@ -25,12 +25,6 @@#include "qemu/cpu-float.h" #include "qemu/interval-tree.h" -/* PA-RISC 1.x processors have a strong memory model. */ -/* ??? While we do not yet implement PA-RISC 2.0, those processors have -a weak memory model, but with TLB bits that force ordering on a per-page -basis. It's probably easier to fall back to a strong memory model. */ -#define TCG_GUEST_DEFAULT_MO TCG_MO_ALL -#define MMU_ABS_W_IDX 6#define MMU_ABS_IDX 7#define MMU_KERNEL_IDX 8
Re: [PATCH 03/24] target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h'
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
accel/tcg/ files requires the following definitions:
-
TARGET_LONG_BITS
-TARGET_PAGE_BITS
-TARGET_PHYS_ADDR_SPACE_BITS
-TCG_GUEST_DEFAULT_MO
Quoted 7 lines
The first 3 are defined in "
cpu-param.h". The last one in "cpu.h", with a bunch of definitions irrelevant for TCG. By moving theTCG_GUEST_DEFAULT_MOdefinition to "cpu-param.h", we can simplify various accel/tcg includes.Signed-off-by Philippe Mathieu-Daudé<[email protected]>---
r~
Re: [PATCH 03/24] target: Define TCG_GUEST_DEFAULT_MO in 'cpu-param.h'
In reply to Philippe Mathieu-DaudéQuoted 11 lines · Philippe Mathieu-Daudé
accel/tcg/ files requires the following definitions:
-
TARGET_LONG_BITS
-TARGET_PAGE_BITS
-TARGET_PHYS_ADDR_SPACE_BITS
-TCG_GUEST_DEFAULT_MOThe first 3 are defined in "
cpu-param.h". The last one in "cpu.h", with a bunch of definitions irrelevant for TCG. By moving theTCG_GUEST_DEFAULT_MOdefinition to "cpu-param.h", we can simplify various accel/tcg includes.
Thanks,
Nick
PATCH 4/24 accel: Include missing 'exec/cpu_ldst.h' header
In reply to Philippe Mathieu-DaudéTheses files call cpu_ldl_code() which is declared in "exec/cpu_ldst.h".
--- accel/tcg/translator.c | 1 + target/hexagon/translate.c | 1 + target/microblaze/cpu.c | 1 + target/microblaze/translate.c | 1 + target/nios2/translate.c | 1 + 5 files changed, 5 insertions(+)
accel/tcg/translator.c +1 -0
@@ -12,6 +12,7 @@#include "qemu/error-report.h" #include "exec/exec-all.h" #include "exec/translator.h" +#include "exec/cpu_ldst.h" #include "exec/plugin-gen.h" #include "tcg/tcg-op-common.h" #include "internal-target.h"
target/hexagon/translate.c +1 -0
@@ -23,6 +23,7 @@#include "exec/helper-gen.h" #include "exec/helper-proto.h" #include "exec/translation-block.h" +#include "exec/cpu_ldst.h" #include "exec/log.h" #include "internal.h" #include "attribs.h"
target/microblaze/cpu.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/module.h" #include "hw/qdev-properties.h" #include "exec/exec-all.h" +#include "exec/cpu_ldst.h" #include "exec/gdbstub.h" #include "fpu/softfloat-helpers.h" #include "tcg/tcg.h"
target/microblaze/translate.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "disas/disas.h" #include "exec/exec-all.h" +#include "exec/cpu_ldst.h" #include "tcg/tcg-op.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h"
target/nios2/translate.c +1 -0
@@ -25,6 +25,7 @@#include "cpu.h" #include "tcg/tcg-op.h" #include "exec/exec-all.h" +#include "exec/cpu_ldst.h" #include "disas/disas.h" #include "exec/helper-proto.h" #include "exec/helper-gen.h"
Signature · 1 line
2.41.0
Re: [PATCH 04/24] accel: Include missing 'exec/cpu_ldst.h' header
Quoted 11 lines · Philippe Mathieu-Daudé
Theses files call
cpu_ldl_code()which is declared in "exec/cpu_ldst.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- accel/tcg/translator.c | 1 + target/hexagon/translate.c | 1 + target/microblaze/cpu.c | 1 + target/microblaze/translate.c | 1 + target/nios2/translate.c | 1 + 5 files changed, 5 insertions(+)
r~
PATCH 5/24 semihosting/uaccess: Avoid including 'cpu.h'
In reply to Philippe Mathieu-Daudé"semihosting/uaccess.h" only requires declarations from "exec/cpu-defs.h". Avoid including the huge "cpu.h".
--- include/semihosting/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/semihosting/uaccess.h +1 -1
@@ -14,7 +14,7 @@#error Cannot include semihosting/uaccess.h from user emulation#endif -#include "cpu.h" +#include "exec/cpu-defs.h" #define get_user_u64 (val, addr) \ ({ uint64_t val_ = 0; \
Signature · 1 line
2.41.0
Re: [PATCH 05/24] semihosting/uaccess: Avoid including 'cpu.h'
Quoted 7 lines · Philippe Mathieu-Daudé
"
semihosting/uaccess.h" only requires declarations from "exec/cpu-defs.h". Avoid including the huge "cpu.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/semihosting/uaccess.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 6/24 semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header
In reply to Philippe Mathieu-DaudéNothing in guestfd.c requires "semihosting/uaccess.h".
--- semihosting/guestfd.c | 1 - 1 file changed, 1 deletion(-)
semihosting/guestfd.c +0 -1
@@ -15,7 +15,6 @@#ifdef CONFIG_USER_ONLY #include "qemu.h" #else -#include "semihosting/uaccess.h" #include CONFIG_DEVICES #endif
Signature · 1 line
2.41.0
Re: [PATCH 06/24] semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header
Quoted 12 lines · Philippe Mathieu-Daudé
Nothing in
guestfd.crequires "semihosting/uaccess.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- semihosting/guestfd.c | 1 - 1 file changed, 1 deletion(-)semihosting/guestfd.c +0
-0
semihosting/guestfd.c line 18
Quoted 4 lines
semihosting/guestfd.c +0
-1@@ -15,7 +15,6 @@#ifdef CONFIG_USER_ONLY #include "qemu.h" #else -#include "semihosting/uaccess.h"
Then I would be surprised if qemu.h is required either -- that's where uaccess is done for user-only.
r~
Re: [PATCH 06/24] semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header
Quoted 8 lines · Richard Henderson
Quoted 7 lines · Philippe Mathieu-Daudé
Nothing in
guestfd.crequires "semihosting/uaccess.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
semihosting/guestfd.c| 1 -1 file changed, 1 deletion(-)
Quoted 11 lines
semihosting/guestfd.c line 18
Quoted 9 lines
semihosting/guestfd.c +0
-1@@ -15,7 +15,6 @@ #ifdef CONFIG_USER_ONLY #include "qemu.h" #else -#include "semihosting/uaccess.h" Then I would be surprised if
qemu.his required either -- that's where uaccess is done for user-only.
Indeed we can remove it.
PATCH 7/24 host/load-extract: Include missing 'qemu/atomic.h' and 'qemu/int128.h'
In reply to Philippe Mathieu-Daudéint128_make128(), int128_getlo() and int128_urshift() are declared in "qemu/int128.h". qatomic_read__nocheck() is declared in "qemu/atomic.h".
--- host/include/generic/host/load-extract-al16-al8.h | 3 +++ 1 file changed, 3 insertions(+)
host/include/generic/host/load-extract-al16-al8.h +3 -0
@@ -8,6 +8,9 @@#ifndef HOST_LOAD_EXTRACT_AL16_AL8_H #define HOST_LOAD_EXTRACT_AL16_AL8_H +#include "qemu/atomic.h" +#include "qemu/int128.h" +/** * load_atom_extract_al16_or_al8: * @pv: host address
Signature · 1 line
2.41.0
PATCH 8/24 host/atomic128: Include missing 'qemu/atomic.h' header
In reply to Philippe Mathieu-Daudéqatomic_cmpxchg__nocheck(), qatomic_read__nocheck(), qatomic_set__nocheck() are defined in "qemu/atomic.h". Include it in order to avoid:
In file included from include/exec/helper-proto.h:10:
In file included from include/exec/helper-proto-common.h:10:
In file included from include/qemu/atomic128.h:61:
In file included from host/include/aarch64/host/atomic128-cas.h:16:
host/include/generic/host/atomic128-cas.h:23:11: error: call to undeclared function 'qatomic_cmpxchg__nocheck'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
r.i = qatomic_cmpxchg__nocheck(ptr_align, c.i, n.i);
^--- host/include/generic/host/atomic128-cas.h | 2 ++ host/include/generic/host/atomic128-ldst.h | 2 ++ 2 files changed, 4 insertions(+)
host/include/generic/host/atomic128-cas.h +2 -0
@@ -11,6 +11,8 @@#ifndef HOST_ATOMIC128_CAS_H #define HOST_ATOMIC128_CAS_H +#include "qemu/atomic.h" +#if defined(CONFIG_ATOMIC128 ) static inline Int128 ATTRIBUTE_ATOMIC128_OPTatomic16_cmpxchg (Int128 *ptr,Int128 cmp,Int128 new)
host/include/generic/host/atomic128-ldst.h +2 -0
@@ -11,6 +11,8 @@#ifndef HOST_ATOMIC128_LDST_H #define HOST_ATOMIC128_LDST_H +#include "qemu/atomic.h" +#if defined(CONFIG_ATOMIC128 )# define HAVE_ATOMIC128_RO 1# define HAVE_ATOMIC128_RW 1
Signature · 1 line
2.41.0
PATCH 9/24 hw/ppc/spapr_hcall: Remove unused 'exec/exec-all.h' included header
In reply to Philippe Mathieu-Daudé--- hw/ppc/spapr_hcall.c | 1 - 1 file changed, 1 deletion(-)
hw/ppc/spapr_hcall.c +0 -1
@@ -8,7 +8,6 @@#include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/error-report.h" -#include "exec/exec-all.h" #include "exec/tb-flush.h" #include "helper_regs.h" #include "hw/ppc/ppc.h"
Signature · 1 line
2.41.0
Re: [PATCH 09/24] hw/ppc/spapr_hcall: Remove unused 'exec/exec-all.h' included header
Quoted 1 line · Philippe Mathieu-Daudé
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 16 lines
--- hw/ppc/spapr_hcall.c | 1 - 1 file changed, 1 deletion(-)hw/ppc/spapr_hcall.c +0
-1@@ -8,7 +8,6 @@#include "qemu/main-loop.h" #include "qemu/module.h" #include "qemu/error-report.h" -#include "exec/exec-all.h" #include "exec/tb-flush.h" #include "helper_regs.h" #include "hw/ppc/ppc.h"
PATCH 10/24 hw/misc/mips_itu: Remove unnecessary 'exec/exec-all.h' header
In reply to Philippe Mathieu-Daudémips_itu.c only requires declarations from "hw/core/cpu.h" and "cpu.h". Avoid including the huge "exec/exec-all.h" header.
--- hw/misc/mips_itu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/misc/mips_itu.c +2 -1
@@ -22,9 +22,10 @@#include "qemu/log.h" #include "qemu/module.h" #include "qapi/error.h" -#include "exec/exec-all.h" +#include "hw/core/cpu.h" #include "hw/misc/mips_itu.h" #include "hw/qdev-properties.h" +#include "target/mips/cpu.h" #define ITC_TAG_ADDRSPACE_SZ (ITC_ADDRESSMAP_NUM * 8)/* Initialize as 4kB area to fit all 32 cells with default 128B grain.
Signature · 1 line
2.41.0
PATCH 11/24 hw/s390x/ipl: Remove unused 'exec/exec-all.h' included header
In reply to Philippe Mathieu-Daudé--- hw/s390x/ipl.c | 1 - 1 file changed, 1 deletion(-)
hw/s390x/ipl.c +0 -1
@@ -35,7 +35,6 @@#include "qemu/cutils.h" #include "qemu/option.h" #include "standard-headers/linux/virtio_ids.h" -#include "exec/exec-all.h" #define KERN_IMAGE_START 0x010000UL#define LINUX_MAGIC_ADDR 0x010008UL
Signature · 1 line
2.41.0
PATCH 12/24 target/i386: Include missing 'exec/exec-all.h' header
In reply to Philippe Mathieu-DaudéThe XRSTOR instruction ends calling tlb_flush(), declared in "exec/exec-all.h".
--- target/i386/tcg/fpu_helper.c | 1 + 1 file changed, 1 insertion(+)
target/i386/tcg/fpu_helper.c +1 -0
@@ -21,6 +21,7 @@#include <math.h> #include "cpu.h" #include "tcg-cpu.h" +#include "exec/exec-all.h" #include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h"
Signature · 1 line
2.41.0
Re: [PATCH 12/24] target/i386: Include missing 'exec/exec-all.h' header
Quoted 7 lines · Philippe Mathieu-Daudé
The XRSTOR instruction ends calling
tlb_flush(), declared in "exec/exec-all.h".Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/tcg/fpu_helper.c | 1 + 1 file changed, 1 insertion(+)
r~
PATCH 13/24 accel/tcg: Include missing 'hw/core/cpu.h' header
In reply to Philippe Mathieu-Daudétcg_cpu_init_cflags() accesses CPUState fields, so requires "hw/core/cpu.h" to get its structure definition.
--- accel/tcg/tcg-accel-ops.c | 2 ++ 1 file changed, 2 insertions(+)
accel/tcg/tcg-accel-ops.c +2 -0
@@ -37,6 +37,8 @@#include "exec/tb-flush.h" #include "exec/gdbstub.h" +#include "hw/core/cpu.h" +#include "tcg-accel-ops.h" #include "tcg-accel-ops-mttcg.h" #include "tcg-accel-ops-rr.h"
Signature · 1 line
2.41.0
PATCH 14/24 gdbstub: Include missing 'hw/core/cpu.h' header
In reply to Philippe Mathieu-DaudéFunctions such gdb_get_cpu_pid() dereference CPUState so require the structure declaration from "hw/core/cpu.h":
static uint32_t gdb_get_cpu_pid(CPUState *cpu)
{
...
return cpu->cluster_index + 1;
}--- gdbstub/gdbstub.c | 1 + 1 file changed, 1 insertion(+)
gdbstub/gdbstub.c +1 -0
@@ -37,6 +37,7 @@#include "hw/cpu/cluster.h" #include "hw/boards.h" #endif +#include "hw/core/cpu.h" #include "sysemu/hw_accel.h" #include "sysemu/runstate.h"
Signature · 1 line
2.41.0
Re: [PATCH 14/24] gdbstub: Include missing 'hw/core/cpu.h' header
Quoted 9 lines · Philippe Mathieu-Daudé
Functions such
gdb_get_cpu_pid()dereference CPUState so require the structure declaration from "hw/core/cpu.h":static uint32_t gdb_get_cpu_pid(CPUState *cpu) { ... return cpu->cluster_index + 1; }
Quoted 5 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- gdbstub/gdbstub.c | 1 + 1 file changed, 1 insertion(+)
(Forgot to Cc rev.ng folks)
Quoted 45 lines · Philippe Mathieu-Daudé
Hi,
These patches are extracted from a bigger work where "
exec/{exec,cpu,translate}-all.h" are split in various specific APIs. This helped:
- differenciate/build:
. user VS system
. target-specific VS generic
which is necessary for heterogeneous build
- reduced header pressure
- clarify APIsThis series is focused on user (vs system) cleanups. More useful changes will come after.
Regards,
Phil.
Philippe Mathieu-Daudé (24):
exec: Include 'cpu.h' before validating CPUArchState placement
exec: Expose 'target_page.h' API to user emulation
target: DefineTCG_GUEST_DEFAULT_MOin 'cpu-param.h'
accel: Include missing 'exec/cpu_ldst.h' header semihosting/uaccess: Avoid including 'cpu.h' semihosting/guestfd: Remove unused 'semihosting/uaccess.h' header host/load-extract: Include missing 'qemu/atomic.h' and 'qemu/int128.h' host/atomic128: Include missing 'qemu/atomic.h' header hw/ppc/spapr_hcall: Remove unused 'exec/exec-all.h' included header hw/misc/mips_itu: Remove unnecessary 'exec/exec-all.h' header hw/s390x/ipl: Remove unused 'exec/exec-all.h' included header target/i386: Include missing 'exec/exec-all.h' header accel/tcg: Include missing 'hw/core/cpu.h' header
gdbstub: Include missing 'hw/core/cpu.h' header exec/cpu-all: Remove unused headers
exec/cpu-all: Reduce 'qemu/rcu.h' header inclusion target/ppc/excp_helper: Avoid 'abi_ptr' in system emulation accel/tcg: Un-inline retaddr helpers to 'user-retaddr.h' exec/user: Do not include 'cpu.h' in 'abitypes.h'
exec: Declareabi_ptrtype in its own 'tcg/abi_ptr.h' header exec/cpu_ldst: Avoid including 'cpu.h'
exec/cpu-all: Restrict inclusion of 'exec/user/guest-base.h' exec/cpu-all: Extract page-protection definitions to
page-prot-common.h
target: Restrict 'sysemu/reset.h' to system emulation
PATCH 15/24 exec/cpu-all: Remove unused headers
In reply to Philippe Mathieu-DaudéNothing is required from the "qemu/thread.h" and
"hw/core/cpu.h" headers.
--- include/exec/cpu-all.h | 2 -- 1 file changed, 2 deletions(-)
include/exec/cpu-all.h +0 -2
@@ -22,8 +22,6 @@#include "exec/cpu-common.h" #include "exec/memory.h" #include "exec/tswap.h" -#include "qemu/thread.h" -#include "hw/core/cpu.h" #include "qemu/rcu.h" /* some important defines:
Signature · 1 line
2.41.0
Re: [PATCH 15/24] exec/cpu-all: Remove unused headers
Quoted 13 lines · Philippe Mathieu-Daudé
Nothing is required from the "
qemu/thread.h" and
"hw/core/cpu.h" headers.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-all.h | 2 -- 1 file changed, 2 deletions(-)include/exec/cpu-all.h +0
-0
include/exec/cpu-all.h line 26
Quoted 5 lines
include/exec/cpu-all.h +0
-2@@ -22,8 +22,6 @@#include "exec/cpu-common.h" #include "exec/memory.h" #include "exec/tswap.h" -#include "qemu/thread.h" -#include "hw/core/cpu.h"
While thread.h is fine, I'm not sure removing hw/core/cpu.h from cpu-all.h is a good idea, and would explain the rather surprising changes to add core/cpu.h to other files.
r~
Re: [PATCH 15/24] exec/cpu-all: Remove unused headers
Quoted 9 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
Nothing is required from the "
qemu/thread.h" and
"hw/core/cpu.h" headers.Signed-off-by Philippe Mathieu-Daudé <[email protected]>---
include/exec/cpu-all.h| 2 --1 file changed, 2 deletions(-)
Quoted 12 lines
include/exec/cpu-all.h line 26
Quoted 10 lines
include/exec/cpu-all.h +0
-2@@ -22,8 +22,6 @@ #include "exec/cpu-common.h" #include "exec/memory.h" #include "exec/tswap.h" -#include "qemu/thread.h" -#include "hw/core/cpu.h" While
thread.his fine, I'm not sure removinghw/core/cpu.hfromcpu-all.his a good idea, and would explain the rather surprising changes to addcore/cpu.hto other files.
"hw/core/cpu.h" defines the CPUState structure. Any code that deref CPUState needs to include its definition from "hw/core/cpu.h".
Similarly, files that don't deref CPUState/CPUClass/cpu_foo methods shouldn't be polluted by its declarations.
This series focuses on useremu, next comes sysemu and "exec/cpu-all.h" is split. I'll see if I can postpone this change.
PATCH 16/24 exec/cpu-all: Reduce 'qemu/rcu.h' header inclusion
In reply to Philippe Mathieu-Daudé"exec/cpu-all.h" doesn't need definitions from "qemu/rcu.h", however "exec/ram_addr.h" does.
--- include/exec/cpu-all.h | 1 - include/exec/ram_addr.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
include/exec/cpu-all.h +0 -1
@@ -22,7 +22,6 @@#include "exec/cpu-common.h" #include "exec/memory.h" #include "exec/tswap.h" -#include "qemu/rcu.h" /* some important defines: *
include/exec/ram_addr.h +1 -0
@@ -25,6 +25,7 @@#include "sysemu/tcg.h" #include "exec/ramlist.h" #include "exec/ramblock.h" +#include "qemu/rcu.h" extern uint64_t total_dirty_pages;
Signature · 1 line
2.41.0
Re: [PATCH 16/24] exec/cpu-all: Reduce 'qemu/rcu.h' header inclusion
Quoted 8 lines · Philippe Mathieu-Daudé
"
exec/cpu-all.h" doesn't need definitions from "qemu/rcu.h", however "exec/ram_addr.h" does.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu-all.h | 1 - include/exec/ram_addr.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
r~
PATCH 17/24 target/ppc/excp_helper: Avoid 'abi_ptr' in system emulation
In reply to Philippe Mathieu-Daudé'abi_ptr' is a user specific type. The system emulation equivalent is 'target_ulong'. Use it in ppc_ldl_code() to emphasis this is not an user emulation function.
--- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/ppc/excp_helper.c +1 -1
@@ -142,7 +142,7 @@ static inline bool insn_need_byteswap(CPUArchState *env)return !!(env->msr & ((target_ulong )1 <<MSR_LE )); } -static uint32_t ppc_ldl_code (CPUArchState *env,abi_ptr addr) +static uint32_t ppc_ldl_code (CPUArchState *env,target_ulong addr) {uint32_t insn =cpu_ldl_code (env, addr);
Signature · 1 line
2.41.0
Re: [PATCH 17/24] target/ppc/excp_helper: Avoid 'abi_ptr' in system emulation
Quoted 5 lines · Philippe Mathieu-Daudé
'
abi_ptr' is a user specific type. The system emulation equivalent is 'target_ulong'. Use it inppc_ldl_code()to emphasis this is not an user emulation function.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 17 lines
--- target/ppc/excp_helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/ppc/excp_helper.c +1
-1@@ -142,7 +142,7 @@ static inline bool insn_need_byteswap(CPUArchState *env)return !!(env->msr & ((target_ulong )1 <<MSR_LE )); } -static uint32_t ppc_ldl_code (CPUArchState *env,abi_ptr addr) +static uint32_t ppc_ldl_code (CPUArchState *env,target_ulong addr) {uint32_t insn =cpu_ldl_code (env, addr);
PATCH 18/24 accel/tcg: Un-inline retaddr helpers to 'user-retaddr.h'
In reply to Philippe Mathieu-Daudéset_helper_retaddr() is only used in accel/tcg/user-exec.c.
clear_helper_retaddr() is only used in accel/tcg/user-exec.c and accel/tcg/user-exec.c.
No need to expose their definitions to all user-emulation files including "exec/cpu_ldst.h", move them to a new "user-retaddr.h" header (restricted to accel/tcg/).
--- accel/tcg/user-retaddr.h | 28 ++++++++++++++++++++++++++++ include/exec/cpu_ldst.h | 28 ++-------------------------- accel/tcg/cpu-exec.c | 3 +++ accel/tcg/user-exec.c | 1 + 4 files changed, 34 insertions(+), 26 deletions(-) create mode 100644 accel/tcg/user-retaddr.h
accel/tcg/user-retaddr.h new file +28 -0
@@ -0,0 +1,28 @@ +#ifndef ACCEL_TCG_USER_RETADDR_H +#define ACCEL_TCG_USER_RETADDR_H + +#include "qemu/atomic.h" + +extern __threaduintptr_t helper_retaddr; + +static inline void set_helper_retaddr (uintptr_t ra) +{ + helper_retaddr = ra; +/* +* Ensure that this write is visible to the SIGSEGV handler that +* may be invoked due to a subsequent invalid memory operation. +*/ +signal_barrier (); +} + +static inline void clear_helper_retaddr (void ) +{ +/* +* Ensure that previous memory operations have succeeded before +* removing the data visible to the signal handler. +*/ +signal_barrier (); + helper_retaddr =0 ; +} + +#endif
include/exec/cpu_ldst.h +2 -26
@@ -300,31 +300,7 @@ Int128 cpu_atomic_cmpxchgo_be_mmu(CPUArchState *env, abi_ptr addr, Int128 cmpv, Int128 newv, MemOpIdx oi, uintptr_t retaddr); -#if defined(CONFIG_USER_ONLY ) - -extern __threaduintptr_t helper_retaddr; - -static inline void set_helper_retaddr (uintptr_t ra) -{ - helper_retaddr = ra; -/* -* Ensure that this write is visible to the SIGSEGV handler that -* may be invoked due to a subsequent invalid memory operation. -*/ -signal_barrier (); -} - -static inline void clear_helper_retaddr (void ) -{ -/* -* Ensure that previous memory operations have succeeded before -* removing the data visible to the signal handler. -*/ -signal_barrier (); - helper_retaddr =0 ; -} - -#else +#if !defined(CONFIG_USER_ONLY )#include "tcg/oversized-guest.h"
@@ -376,7 +352,7 @@ static inline CPUTLBEntry *tlb_entry(CPUState *cpu, uintptr_t mmu_idx, return &cpu->neg.tlb.f[mmu_idx].table[tlb_index(cpu, mmu_idx, addr)]; } -#endif /* defined(CONFIG_USER_ONLY) */ +#endif /* !defined(CONFIG_USER_ONLY) */ #if TARGET_BIG_ENDIAN # define cpu_lduw_data cpu_lduw_be_data
accel/tcg/cpu-exec.c +3 -0
@@ -44,6 +44,9 @@#include "tb-context.h" #include "internal-common.h" #include "internal-target.h" +#if defined(CONFIG_USER_ONLY ) +#include "user-retaddr.h" +#endif /* -icount align implementation. */
accel/tcg/user-exec.c +1 -0
@@ -31,6 +31,7 @@#include "tcg/tcg-ldst.h" #include "internal-common.h" #include "internal-target.h" +#include "user-retaddr.h" __threaduintptr_t helper_retaddr;
Signature · 1 line
2.41.0
Re: [PATCH 18/24] accel/tcg: Un-inline retaddr helpers to 'user-retaddr.h'
Quoted 10 lines · Philippe Mathieu-Daudé
set_helper_retaddr()is only used inaccel/tcg/user-exec.c.
clear_helper_retaddr()is only used inaccel/tcg/user-exec.candaccel/tcg/user-exec.c.No need to expose their definitions to all user-emulation files including "
exec/cpu_ldst.h", move them to a new "user-retaddr.h" header (restricted to accel/tcg/).Signed-off-by Philippe Mathieu-Daudé <[email protected]>
r~
PATCH 19/24 exec/user: Do not include 'cpu.h' in 'abitypes.h'
In reply to Philippe Mathieu-DaudéFirst, "exec/user/abitypes.h" is missing the following includes (they are included by "cpu.h"):
- "exec/target_long.h"
- "exec/cpu-all.h"
- "exec/tswap.h"
Second, it only requires the definitions from "cpu-param.h", not the huge "cpu.h".
In order to avoid "cpu.h", pick the minimum required headers.
Assert this user-specific header is only included from user emulation.
--- include/exec/user/abitypes.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
include/exec/user/abitypes.h +8 -1
@@ -1,7 +1,14 @@#ifndef EXEC_USER_ABITYPES_H #define EXEC_USER_ABITYPES_H -#include "cpu.h" +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif + +#include "cpu-param.h" +#include "exec/target_long.h" +#include "exec/cpu-all.h" +#include "exec/tswap.h" #ifdef TARGET_ABI32 #define TARGET_ABI_BITS 32
Signature · 1 line
2.41.0
Re: [PATCH 19/24] exec/user: Do not include 'cpu.h' in 'abitypes.h'
Quoted 8 lines · Philippe Mathieu-Daudé
First, "
exec/user/abitypes.h" is missing the following includes (they are included by "cpu.h"):
- "exec/target_long.h"
- "exec/cpu-all.h"
- "exec/tswap.h"
Second, it only requires the definitions from "cpu-param.h", not the huge "cpu.h".
Quoted 6 lines
In order to avoid "
cpu.h", pick the minimum required headers.Assert this user-specific header is only included from user emulation.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Why is cpu-all.h required?
r~
Re: [PATCH 19/24] exec/user: Do not include 'cpu.h' in 'abitypes.h'
Quoted 9 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
First, "
exec/user/abitypes.h" is missing the following includes (they are included by "cpu.h"):
- "exec/target_long.h"
- "exec/cpu-all.h"
- "exec/tswap.h"
Second, it only requires the definitions from "cpu-param.h", not the huge "cpu.h".
Quoted 8 lines
Quoted 6 lines
In order to avoid "
cpu.h", pick the minimum required headers.Assert this user-specific header is only included from user emulation.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Why is
cpu-all.hrequired?
include/exec/user/abitypes.h:85:12: error: implicit declaration of function ‘tswapl’; did you mean ‘tswapal’? [-Werror=implicit-function-declaration]
85 | return tswapl(v);
| ^~~~~~
| tswapal$ git grep -w tswapl include include/exec/cpu-all.h:40:#define tswapl(s) tswap32(s) include/exec/cpu-all.h:44:#define tswapl(s) tswap64(s) include/exec/user/abitypes.h:85: return tswapl(v);
OK, I'll move tswapl() declarations to exec/user/abitypes.h.
Re: [PATCH 19/24] exec/user: Do not include 'cpu.h' in 'abitypes.h'
Quoted 24 lines · Philippe Mathieu-Daudé
Quoted 9 lines · Richard Henderson
Quoted 8 lines · Philippe Mathieu-Daudé
First, "
exec/user/abitypes.h" is missing the following includes (they are included by "cpu.h"):
- "exec/target_long.h"
- "exec/cpu-all.h"
- "exec/tswap.h"
Second, it only requires the definitions from "cpu-param.h", not the huge "cpu.h".Quoted 8 lines
Quoted 6 lines
In order to avoid "
cpu.h", pick the minimum required headers.Assert this user-specific header is only included from user emulation.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Why is
cpu-all.hrequired?
include/exec/user/abitypes.h:85:12: error: implicit declaration of function ‘tswapl’; did you mean ‘tswapal’? [-Werror=implicit-function-declaration]
85 | return tswapl(v);
| ^~~~~~
| tswapal
Quoted 6 lines
$ git grep -w tswapl include include/exec/cpu-all.h:40:#define tswapl(s) tswap32(s) include/exec/cpu-all.h:44:#define tswapl(s) tswap64(s) include/exec/user/abitypes.h:85: return tswapl(v);OK, I'll move
tswapl()declarations toexec/user/abitypes.h.
Better, to a new header.
PATCH 20/24 exec: Declare abi_ptr type in its own 'tcg/abi_ptr.h' header
In reply to Philippe Mathieu-DaudéThe abi_ptr type is declared in "exec/cpu_ldst.h" with all the load/store helpers. Some source files requiring abi_ptr type don't need the load/store helpers. In order to simplify, create a new "tcg/abi_ptr.h" header.
--- include/exec/cpu_ldst.h | 17 +++-------------- include/exec/exec-all.h | 1 + include/exec/translator.h | 5 ++++- include/tcg/abi_ptr.h | 32 ++++++++++++++++++++++++++++++++ accel/tcg/cputlb.c | 1 + 5 files changed, 41 insertions(+), 15 deletions(-) create mode 100644 include/tcg/abi_ptr.h
include/exec/cpu_ldst.h +3 -14
@@ -65,18 +65,9 @@#include "exec/memopidx.h" #include "qemu/int128.h" #include "cpu.h" +#include "tcg/abi_ptr.h" #if defined(CONFIG_USER_ONLY ) -/* sparc32plus has 64bit long but 32bit space address -* this can make bad result with g2h() and h2g() -*/ -#if TARGET_VIRT_ADDR_SPACE_BITS <=32 -typedef uint32_t abi_ptr ; -#define TARGET_ABI_FMT_ptr "%x" -#else -typedef uint64_t abi_ptr ; -#define TARGET_ABI_FMT_ptr "%"PRIx64 -#endif #ifndef TARGET_TAGGED_ADDRESSES static inline abi_ptr cpu_untagged_addr (CPUState *cs,abi_ptr x)
@@ -120,10 +111,8 @@ static inline bool guest_range_valid_untagged(abi_ulong start, abi_ulong len)assert (h2g_valid (x)); \h2g_nocheck (x); \ }) -#else -typedef target_ulong abi_ptr ; -#define TARGET_ABI_FMT_ptr TARGET_FMT_lx -#endif + +#endif /* CONFIG_USER_ONLY */ uint32_t cpu_ldub_data (CPUArchState *env,abi_ptr ptr);int cpu_ldsb_data (CPUArchState *env,abi_ptr ptr);
include/exec/exec-all.h +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #if defined(CONFIG_USER_ONLY ) +#include "tcg/abi_ptr.h" #include "exec/cpu_ldst.h" #endif #include "exec/translation-block.h"
include/exec/translator.h +4 -1
@@ -19,7 +19,10 @@*/ #include "qemu/bswap.h" -#include "exec/cpu_ldst.h" /* for abi_ptr */ +#include "exec/cpu-common.h" +#include "exec/cpu-defs.h" +#include "cpu.h" +#include "tcg/abi_ptr.h" /** * gen_intermediate_code
include/tcg/abi_ptr.h new file +32 -0
@@ -0,0 +1,32 @@ +/* +* TCG abi_ptr type +* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ +#ifndef TCG_ABI_PTR_H +#define TCG_ABI_PTR_H + +#include "cpu-param.h" + +#if defined(CONFIG_USER_ONLY ) +/* sparc32plus has 64bit long but 32bit space address +* this can make bad result with g2h() and h2g() +*/ +#if TARGET_VIRT_ADDR_SPACE_BITS <=32 +typedef uint32_t abi_ptr ; +#define TARGET_ABI_FMT_ptr "%x" +#else +typedef uint64_t abi_ptr ; +#define TARGET_ABI_FMT_ptr "%"PRIx64 +#endif + +#else /* !CONFIG_USER_ONLY */ + +#include "exec/target_long.h" + +typedef target_ulong abi_ptr ; +#define TARGET_ABI_FMT_ptr TARGET_FMT_lx + +#endif /* !CONFIG_USER_ONLY */ + +#endif
accel/tcg/cputlb.c +1 -0
@@ -41,6 +41,7 @@#ifdef CONFIG_PLUGIN #include "qemu/plugin-memory.h" #endif +#include "tcg/abi_ptr.h" #include "tcg/tcg-ldst.h" #include "tcg/oversized-guest.h"
Signature · 1 line
2.41.0
Re: [PATCH 20/24] exec: Declare abi_ptr type in its own 'tcg/abi_ptr.h' header
Quoted 62 lines · Philippe Mathieu-Daudé
The
abi_ptrtype is declared in "exec/cpu_ldst.h" with all the load/store helpers. Some source files requiringabi_ptrtype don't need the load/store helpers. In order to simplify, create a new "tcg/abi_ptr.h" header.Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- include/exec/cpu_ldst.h | 17 +++-------------- include/exec/exec-all.h | 1 + include/exec/translator.h | 5 ++++- include/tcg/abi_ptr.h | 32 ++++++++++++++++++++++++++++++++ accel/tcg/cputlb.c | 1 + 5 files changed, 41 insertions(+), 15 deletions(-)create mode 100644
include/tcg/abi_ptr.hinclude/exec/cpu_ldst.h +3
-14@@ -65,18 +65,9 @@#include "exec/memopidx.h" #include "qemu/int128.h" #include "cpu.h" +#include "tcg/abi_ptr.h" #if defined(CONFIG_USER_ONLY ) -/* sparc32plus has 64bit long but 32bit space address -* this can make bad result with g2h() and h2g() -*/ -#if TARGET_VIRT_ADDR_SPACE_BITS <=32 -typedef uint32_t abi_ptr ; -#define TARGET_ABI_FMT_ptr "%x" -#else -typedef uint64_t abi_ptr ; -#define TARGET_ABI_FMT_ptr "%"PRIx64 -#endif #ifndef TARGET_TAGGED_ADDRESSES static inline abi_ptr cpu_untagged_addr (CPUState *cs,abi_ptr x)@@ -120,10 +111,8 @@ static inline bool guest_range_valid_untagged(abi_ulong start, abi_ulong len)assert (h2g_valid (x)); \h2g_nocheck (x); \ }) -#else -typedef target_ulong abi_ptr ; -#define TARGET_ABI_FMT_ptr TARGET_FMT_lx -#endif + +#endif /* CONFIG_USER_ONLY */ uint32_t cpu_ldub_data (CPUArchState *env,abi_ptr ptr);int cpu_ldsb_data (CPUArchState *env,abi_ptr ptr);include/tcg/abi_ptr.h new file +2
-0@@ -0,0 +1,32 @@ +/* +* TCG abi_ptr type
include/tcg/abi_ptr.h line 12
Quoted 10 lines
include/tcg/abi_ptr.h new file +10
-0+* +* SPDX-License-Identifier: LGPL-2.1-or-later +*/ +#ifndef TCG_ABI_PTR_H +#define TCG_ABI_PTR_H + +#include "cpu-param.h" + +#if defined(CONFIG_USER_ONLY ) +/* sparc32plus has 64bit long but 32bit space address
Forgot to squash:
-- >8 --
@@ -11,3 +11,4 @@
#if defined(CONFIG_USER_ONLY)
-/* sparc32plus has 64bit long but 32bit space address +/*
+ * sparc32plus has 64bit long but 32bit space address
* this can make bad result with g2h() and h2g()
---
Quoted 20 lines
include/tcg/abi_ptr.h new file +20
-0+* this can make bad result with g2h() and h2g() +*/ +#if TARGET_VIRT_ADDR_SPACE_BITS <=32 +typedef uint32_t abi_ptr ; +#define TARGET_ABI_FMT_ptr "%x" +#else +typedef uint64_t abi_ptr ; +#define TARGET_ABI_FMT_ptr "%"PRIx64 +#endif + +#else /* !CONFIG_USER_ONLY */ + +#include "exec/target_long.h" + +typedef target_ulong abi_ptr ; +#define TARGET_ABI_FMT_ptr TARGET_FMT_lx + +#endif /* !CONFIG_USER_ONLY */ + +#endif
Re: [PATCH 20/24] exec: Declare abi_ptr type in its own 'tcg/abi_ptr.h' header
In reply to Philippe Mathieu-DaudéQuoted 6 lines · Philippe Mathieu-Daudé
The
abi_ptrtype is declared in "exec/cpu_ldst.h" with all the load/store helpers. Some source files requiringabi_ptrtype don't need the load/store helpers. In order to simplify, create a new "tcg/abi_ptr.h" header.Signed-off-by Philippe Mathieu-Daudé <[email protected]>
Quoted 8 lines
--- include/exec/cpu_ldst.h | 17 +++-------------- include/exec/exec-all.h | 1 + include/exec/translator.h | 5 ++++- include/tcg/abi_ptr.h | 32 ++++++++++++++++++++++++++++++++ accel/tcg/cputlb.c | 1 + 5 files changed, 41 insertions(+), 15 deletions(-)create mode 100644
include/tcg/abi_ptr.h
I'm unconvinced about this being tcg related, per se. Leave it in include/exec/, with exec/user/abitypes.h.
With that,
r~
Re: [PATCH 20/24] exec: Declare abi_ptr type in its own 'tcg/abi_ptr.h' header
Quoted 16 lines · Richard Henderson
Quoted 6 lines · Philippe Mathieu-Daudé
The
abi_ptrtype is declared in "exec/cpu_ldst.h" with all the load/store helpers. Some source files requiringabi_ptrtype don't need the load/store helpers. In order to simplify, create a new "tcg/abi_ptr.h" header.Signed-off-by Philippe Mathieu-Daudé <[email protected]>Quoted 8 lines
---
include/exec/cpu_ldst.h | 17 +++-------------- include/exec/exec-all.h | 1 +include/exec/translator.h| 5 ++++- include/tcg/abi_ptr.h | 32 ++++++++++++++++++++++++++++++++ accel/tcg/cputlb.c | 1 +5 files changed, 41 insertions(+), 15 deletions(-)create mode 100644
include/tcg/abi_ptr.h
Quoted 1 line
I'm unconvinced about this being tcg related, per se.
Indeed:
$ git grep -w abi_ptr -- tcg $
Quoted 4 lines
Leave it in
include/exec/, withexec/user/abitypes.h.With that,
Reviewed-by Richard Henderson <[email protected]>
Thanks!
PATCH 21/24 exec/cpu_ldst: Avoid including 'cpu.h'
In reply to Philippe Mathieu-Daudé"exec/cpu_ldst.h" doesn't need to huge "cpu.h" header, but simply:
- exec/cpu-defs.h
- exec/tlb-common.h
- exec/user/abitypes.h
- exec/user/guest-base.h
--- include/exec/cpu_ldst.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/exec/cpu_ldst.h +5 -1
@@ -64,11 +64,15 @@#include "exec/memopidx.h" #include "qemu/int128.h" -#include "cpu.h" +#include "exec/cpu-defs.h" +#include "exec/tlb-common.h" #include "tcg/abi_ptr.h" #if defined(CONFIG_USER_ONLY) +#include "exec/user/abitypes.h" +#include "exec/user/guest-base.h" + #ifndef TARGET_TAGGED_ADDRESSES static inline abi_ptr cpu_untagged_addr(CPUState *cs, abi_ptr x) {
Signature · 1 line
2.41.0
PATCH 22/24 exec/cpu-all: Restrict inclusion of 'exec/user/guest-base.h'
In reply to Philippe Mathieu-DaudéDeclare 'have_guest_base' in "exec/user/guest-base.h". Very few files require this header, so explicitly include it there instead of "exec/cpu-all.h" which is used in many source files.
Assert this user-specific header is only included from user emulation.
--- include/exec/cpu-all.h | 3 --- include/exec/user/guest-base.h | 6 ++++++ bsd-user/main.c | 1 + linux-user/elfload.c | 1 + linux-user/main.c | 1 + 5 files changed, 9 insertions(+), 3 deletions(-)
include/exec/cpu-all.h +0 -3
@@ -74,9 +74,6 @@#if defined(CONFIG_USER_ONLY )#include "exec/user/abitypes.h" -#include "exec/user/guest-base.h" - -extern bool have_guest_base;/* * If non-zero, the guest virtual address space is a contiguous subset
include/exec/user/guest-base.h +6 -0
@@ -7,6 +7,12 @@#ifndef EXEC_USER_GUEST_BASE_H #define EXEC_USER_GUEST_BASE_H +#ifndef CONFIG_USER_ONLY +#error Cannot include this header from system emulation +#endif +extern uintptr_t guest_base; +extern bool have_guest_base; +#endif
bsd-user/main.c +1 -0
@@ -36,6 +36,7 @@#include "qemu/help_option.h" #include "qemu/module.h" #include "exec/exec-all.h" +#include "exec/user/guest-base.h" #include "tcg/startup.h" #include "qemu/timer.h" #include "qemu/envlist.h"
linux-user/elfload.c +1 -0
@@ -6,6 +6,7 @@#include <sys/shm.h> #include "qemu.h" +#include "exec/user/guest-base.h" #include "user-internals.h" #include "signal-common.h" #include "loader.h"
linux-user/main.c +1 -0
@@ -38,6 +38,7 @@#include "qemu/help_option.h" #include "qemu/module.h" #include "qemu/plugin.h" +#include "exec/user/guest-base.h" #include "exec/exec-all.h" #include "exec/gdbstub.h" #include "gdbstub/user.h"
Signature · 1 line
2.41.0
Re: [PATCH 22/24] exec/cpu-all: Restrict inclusion of 'exec/user/guest-base.h'
Quoted 7 lines · Philippe Mathieu-Daudé
Declare '
have_guest_base' in "exec/user/guest-base.h". Very few files require this header, so explicitly include it there instead of "exec/cpu-all.h" which is used in many source files.
Assert this user-specific header is only included from user emulation.
Quoted 8 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>--- include/exec/cpu-all.h | 3 --- include/exec/user/guest-base.h | 6 ++++++ bsd-user/main.c | 1 + linux-user/elfload.c | 1 + linux-user/main.c | 1 + 5 files changed, 9 insertions(+), 3 deletions(-)
r~
PATCH 23/24 exec/cpu-all: Extract page-protection definitions to page-prot-common.h
In reply to Philippe Mathieu-DaudéExtract page-protection definitions from "exec/cpu-all.h" to "exec/page-prot-common.h".
The list of files requiring the new header was generated using:
$ git grep -wE \ 'PAGE_(READ|WRITE|EXEC|BITS|VALID|ANON|RESERVED|TARGET_.|PASSTHROUGH)'
--- bsd-user/bsd-mem.h | 1 + bsd-user/qemu.h | 1 + include/exec/cpu-all.h | 35 +------------------------ include/exec/page-prot-common.h | 38 ++++++++++++++++++++++++++++ include/semihosting/uaccess.h | 1 + target/arm/cpu.h | 1 + target/ppc/internal.h | 1 + target/ppc/mmu-radix64.h | 2 ++ accel/tcg/cputlb.c | 1 + accel/tcg/tb-maint.c | 1 + accel/tcg/user-exec.c | 1 + bsd-user/mmap.c | 1 + bsd-user/signal.c | 1 + cpu-target.c | 1 + hw/ppc/ppc440_bamboo.c | 1 + hw/ppc/sam460ex.c | 1 + hw/ppc/virtex_ml507.c | 1 + linux-user/arm/cpu_loop.c | 1 + linux-user/elfload.c | 1 + linux-user/mmap.c | 1 + linux-user/nios2/cpu_loop.c | 1 + linux-user/signal.c | 1 + linux-user/syscall.c | 1 + system/physmem.c | 1 + target/alpha/helper.c | 1 + target/arm/ptw.c | 1 + target/arm/tcg/m_helper.c | 1 + target/arm/tcg/mte_helper.c | 1 + target/arm/tcg/sve_helper.c | 1 + target/avr/helper.c | 1 + target/cris/mmu.c | 1 + target/hppa/mem_helper.c | 1 + target/hppa/translate.c | 1 + target/i386/tcg/sysemu/excp_helper.c | 1 + target/loongarch/tlb_helper.c | 1 + target/m68k/helper.c | 1 + target/microblaze/helper.c | 1 + target/microblaze/mmu.c | 1 + target/mips/sysemu/physaddr.c | 1 + target/mips/tcg/sysemu/tlb_helper.c | 1 + target/nios2/helper.c | 1 + target/nios2/mmu.c | 1 + target/openrisc/mmu.c | 1 + target/ppc/mmu-hash32.c | 1 + target/ppc/mmu-hash64.c | 1 + target/ppc/mmu-radix64.c | 1 + target/ppc/mmu_common.c | 1 + target/ppc/mmu_helper.c | 1 + target/riscv/cpu_helper.c | 1 + target/riscv/pmp.c | 1 + target/riscv/vector_helper.c | 1 + target/rx/cpu.c | 1 + target/s390x/mmu_helper.c | 1 + target/s390x/tcg/mem_helper.c | 1 + target/sh4/helper.c | 1 + target/sparc/ldst_helper.c | 1 + target/sparc/mmu_helper.c | 1 + target/tricore/helper.c | 1 + target/xtensa/mmu_helper.c | 1 + target/xtensa/op_helper.c | 1 + 60 files changed, 98 insertions(+), 34 deletions(-) create mode 100644 include/exec/page-prot-common.h
bsd-user/bsd-mem.h +1 -0
@@ -56,6 +56,7 @@#include <fcntl.h> #include "qemu-bsd.h" +#include "exec/page-prot-common.h" extern struct bsd_shm_regions bsd_shm_regions[];extern abi_ulong target_brk;
bsd-user/qemu.h +1 -0
@@ -36,6 +36,7 @@ extern char **environ;#include "target_os_signal.h" #include "target.h" #include "exec/gdbstub.h" +#include "exec/page-prot-common.h" #include "qemu/clang-tsa.h" #include "qemu-os.h"
include/exec/cpu-all.h +1 -34
@@ -19,6 +19,7 @@#ifndef CPU_ALL_H #define CPU_ALL_H +#include "exec/page-prot-common.h" #include "exec/cpu-common.h" #include "exec/memory.h" #include "exec/tswap.h"
@@ -165,40 +166,6 @@ extern const TargetPageBits target_page;#define TARGET_PAGE_ALIGN (addr) ROUND_UP((addr), TARGET_PAGE_SIZE) -/* same as PROT_xxx */ -#define PAGE_READ 0x0001 -#define PAGE_WRITE 0x0002 -#define PAGE_EXEC 0x0004 -#define PAGE_BITS (PAGE_READ | PAGE_WRITE | PAGE_EXEC) -#define PAGE_VALID 0x0008 -/* -* Original state of the write flag (used when tracking self-modifying code) -*/ -#define PAGE_WRITE_ORG 0x0010 -/* -* Invalidate the TLB entry immediately, helpful for s390x -* Low-Address-Protection. Used with PAGE_WRITE in tlb_set_page_with_attrs() -*/ -#define PAGE_WRITE_INV 0x0020 -/* For use with page_set_flags: page is being replaced; target_data cleared. */ -#define PAGE_RESET 0x0040 -/* For linux-user, indicates that the page is MAP_ANON. */ -#define PAGE_ANON 0x0080 - -#if defined(CONFIG_BSD ) && defined(CONFIG_USER_ONLY ) -/* FIXME: Code that sets/uses this is broken and needs to go away. */ -#define PAGE_RESERVED 0x0100 -#endif -/* Target-specific bits that will be used via page_get_flags(). */ -#define PAGE_TARGET_1 0x0200 -#define PAGE_TARGET_2 0x0400 - -/* -* For linux-user, indicates that the page is mapped with the same semantics -* in both guest and host. -*/ -#define PAGE_PASSTHROUGH 0x0800 -#if defined(CONFIG_USER_ONLY )void page_dump (FILE *f);
include/exec/page-prot-common.h new file +38 -0
@@ -0,0 +1,38 @@ +#ifndef EXEC_PAGE_PROT_COMMON_H +#define EXEC_PAGE_PROT_COMMON_H + +/* same as PROT_xxx */ +#define PAGE_READ 0x0001 +#define PAGE_WRITE 0x0002 +#define PAGE_EXEC 0x0004 +#define PAGE_BITS (PAGE_READ | PAGE_WRITE | PAGE_EXEC) +#define PAGE_VALID 0x0008 +/* +* Original state of the write flag (used when tracking self-modifying code) +*/ +#define PAGE_WRITE_ORG 0x0010 +/* +* Invalidate the TLB entry immediately, helpful for s390x +* Low-Address-Protection. Used with PAGE_WRITE in tlb_set_page_with_attrs() +*/ +#define PAGE_WRITE_INV 0x0020 +/* For use with page_set_flags: page is being replaced; target_data cleared. */ +#define PAGE_RESET 0x0040 +/* For linux-user, indicates that the page is MAP_ANON. */ +#define PAGE_ANON 0x0080 + +#if defined(CONFIG_BSD ) && defined(CONFIG_USER_ONLY ) +/* FIXME: Code that sets/uses this is broken and needs to go away. */ +#define PAGE_RESERVED 0x0100 +#endif +/* Target-specific bits that will be used via page_get_flags(). */ +#define PAGE_TARGET_1 0x0200 +#define PAGE_TARGET_2 0x0400 + +/* +* For linux-user, indicates that the page is mapped with the same semantics +* in both guest and host. +*/ +#define PAGE_PASSTHROUGH 0x0800 + +#endif
include/semihosting/uaccess.h +1 -0
@@ -15,6 +15,7 @@#endif #include "exec/cpu-defs.h" +#include "exec/page-prot-common.h" #define get_user_u64 (val, addr) \ ({ uint64_t val_ = 0; \
target/arm/cpu.h +1 -0
@@ -25,6 +25,7 @@#include "hw/registerfields.h" #include "cpu-qom.h" #include "exec/cpu-defs.h" +#include "exec/page-prot-common.h" #include "qapi/qapi-types-common.h" #ifdef TARGET_AARCH64
target/ppc/internal.h +1 -0
@@ -19,6 +19,7 @@#define PPC_INTERNAL_H #include "hw/registerfields.h" +#include "exec/page-prot-common.h" /* PM instructions */ typedef enum {
target/ppc/mmu-radix64.h +2 -0
@@ -3,6 +3,8 @@#ifndef CONFIG_USER_ONLY +#include "exec/page-prot-common.h" +/* Radix Quadrants */ #define R_EADDR_MASK 0x3FFFFFFFFFFFFFFF#define R_EADDR_VALID_MASK 0xC00FFFFFFFFFFFFF
accel/tcg/cputlb.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/main-loop.h" #include "hw/core/tcg-cpu-ops.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/memory.h" #include "exec/cpu_ldst.h" #include "exec/cputlb.h"
accel/tcg/tb-maint.c +1 -0
@@ -23,6 +23,7 @@#include "exec/cputlb.h" #include "exec/log.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/tb-flush.h" #include "exec/translate-all.h" #include "sysemu/tcg.h"
accel/tcg/user-exec.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/rcu.h" #include "exec/cpu_ldst.h" #include "exec/translate-all.h" +#include "exec/page-prot-common.h" #include "exec/helper-proto.h" #include "qemu/atomic128.h" #include "trace/trace-root.h"
bsd-user/mmap.c +1 -0
@@ -17,6 +17,7 @@* along with this program; if not, see <http://www.gnu.org/licenses/>. */ #include "qemu/osdep.h" +#include "exec/page-prot-common.h" #include "qemu.h"
bsd-user/signal.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "qemu/log.h" #include "qemu.h" +#include "exec/page-prot-common.h" #include "gdbstub/user.h" #include "signal-common.h" #include "trace.h"
cpu-target.c +1 -0
@@ -21,6 +21,7 @@#include "qapi/error.h" #include "exec/target_page.h" +#include "exec/page-prot-common.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h" #include "qemu/error-report.h"
hw/ppc/ppc440_bamboo.c +1 -0
@@ -15,6 +15,7 @@#include "qemu/units.h" #include "qemu/datadir.h" #include "qemu/error-report.h" +#include "exec/page-prot-common.h" #include "net/net.h" #include "hw/pci/pci.h" #include "hw/boards.h"
hw/ppc/sam460ex.c +1 -0
@@ -21,6 +21,7 @@#include "kvm_ppc.h" #include "sysemu/device_tree.h" #include "sysemu/block-backend.h" +#include "exec/page-prot-common.h" #include "hw/loader.h" #include "elf.h" #include "exec/memory.h"
hw/ppc/virtex_ml507.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/osdep.h" #include "qemu/datadir.h" #include "qemu/units.h" +#include "exec/page-prot-common.h" #include "cpu.h" #include "hw/sysbus.h" #include "hw/char/serial.h"
linux-user/arm/cpu_loop.c +1 -0
@@ -24,6 +24,7 @@#include "cpu_loop-common.h" #include "signal-common.h" #include "semihosting/common-semi.h" +#include "exec/page-prot-common.h" #include "target/arm/syndrome.h" #define get_user_code_u32 (x, gaddr, env) \
linux-user/elfload.c +1 -0
@@ -7,6 +7,7 @@#include "qemu.h" #include "exec/user/guest-base.h" +#include "exec/page-prot-common.h" #include "user-internals.h" #include "signal-common.h" #include "loader.h"
linux-user/mmap.c +1 -0
@@ -20,6 +20,7 @@#include <sys/shm.h> #include "trace.h" #include "exec/log.h" +#include "exec/page-prot-common.h" #include "qemu.h" #include "user-internals.h" #include "user-mmap.h"
linux-user/nios2/cpu_loop.c +1 -0
@@ -22,6 +22,7 @@#include "user-internals.h" #include "cpu_loop-common.h" #include "signal-common.h" +#include "exec/page-prot-common.h" void cpu_loop (CPUNios2State *env) {
linux-user/signal.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "qemu/bitops.h" #include "gdbstub/user.h" +#include "exec/page-prot-common.h" #include "hw/core/tcg-cpu-ops.h" #include <sys/ucontext.h>
linux-user/syscall.c +1 -0
@@ -25,6 +25,7 @@#include "qemu/plugin.h" #include "tcg/startup.h" #include "target_mman.h" +#include "exec/page-prot-common.h" #include <elf.h> #include <endian.h> #include <grp.h>
system/physmem.c +1 -0
@@ -31,6 +31,7 @@#endif /* CONFIG_TCG */ #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/target_page.h" #include "hw/qdev-core.h" #include "hw/qdev-properties.h"
target/alpha/helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "fpu/softfloat-types.h" #include "exec/helper-proto.h" #include "qemu/qemu-print.h"
target/arm/ptw.c +1 -0
@@ -11,6 +11,7 @@#include "qemu/range.h" #include "qemu/main-loop.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "cpu.h" #include "internals.h" #include "cpu-features.h"
target/arm/tcg/m_helper.c +1 -0
@@ -16,6 +16,7 @@#include "qemu/bitops.h" #include "qemu/log.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #ifdef CONFIG_TCG #include "exec/cpu_ldst.h" #include "semihosting/common-semi.h"
target/arm/tcg/mte_helper.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "internals.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/ram_addr.h" #include "exec/cpu_ldst.h" #include "exec/helper-proto.h"
target/arm/tcg/sve_helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "internals.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/helper-proto.h" #include "tcg/tcg-gvec-desc.h" #include "fpu/softfloat.h"
target/avr/helper.c +1 -0
@@ -24,6 +24,7 @@#include "cpu.h" #include "hw/core/tcg-cpu-ops.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "exec/address-spaces.h" #include "exec/helper-proto.h"
target/cris/mmu.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "mmu.h" #ifdef DEBUG
target/hppa/mem_helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/helper-proto.h" #include "hw/core/cpu.h" #include "trace.h"
target/hppa/translate.c +1 -0
@@ -22,6 +22,7 @@#include "disas/disas.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "tcg/tcg-op.h" #include "tcg/tcg-op-gvec.h" #include "exec/helper-proto.h"
target/i386/tcg/sysemu/excp_helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "exec/cpu_ldst.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "tcg/helper-tcg.h" typedef struct TranslateParams {
target/loongarch/tlb_helper.c +1 -0
@@ -13,6 +13,7 @@#include "internals.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "exec/log.h" #include "cpu-csr.h"
target/m68k/helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/gdbstub.h" #include "exec/helper-proto.h" #include "gdbstub/helpers.h"
target/microblaze/helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "qemu/host-utils.h" #include "exec/log.h"
target/microblaze/mmu.c +1 -0
@@ -22,6 +22,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" static unsigned int tlb_decode_size (unsigned int f) {
target/mips/sysemu/physaddr.c +1 -0
@@ -19,6 +19,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "../internal.h" static int is_seg_am_mapped (unsigned int am,bool eu,int mmu_idx)
target/mips/tcg/sysemu/tlb_helper.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "internal.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "exec/log.h" #include "exec/helper-proto.h"
target/nios2/helper.c +1 -0
@@ -23,6 +23,7 @@#include "cpu.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "exec/log.h" #include "exec/helper-proto.h"
target/nios2/mmu.c +1 -0
@@ -22,6 +22,7 @@#include "qemu/qemu-print.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "mmu.h" #include "exec/helper-proto.h" #include "trace/trace-target_nios2.h"
target/openrisc/mmu.c +1 -0
@@ -22,6 +22,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "gdbstub/helpers.h" #include "qemu/host-utils.h" #include "hw/loader.h"
target/ppc/mmu-hash32.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "sysemu/kvm.h" #include "kvm_ppc.h" #include "internal.h"
target/ppc/mmu-hash64.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/units.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "qemu/error-report.h" #include "qemu/qemu-print.h" #include "sysemu/hw_accel.h"
target/ppc/mmu-radix64.c +1 -0
@@ -20,6 +20,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "qemu/error-report.h" #include "sysemu/kvm.h" #include "kvm_ppc.h"
target/ppc/mmu_common.c +1 -0
@@ -25,6 +25,7 @@#include "mmu-hash64.h" #include "mmu-hash32.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/log.h" #include "helper_regs.h" #include "qemu/error-report.h"
target/ppc/mmu_helper.c +1 -0
@@ -25,6 +25,7 @@#include "mmu-hash64.h" #include "mmu-hash32.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/log.h" #include "helper_regs.h" #include "qemu/error-report.h"
target/riscv/cpu_helper.c +1 -0
@@ -24,6 +24,7 @@#include "internals.h" #include "pmu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "instmap.h" #include "tcg/tcg-op.h" #include "trace.h"
target/riscv/pmp.c +1 -0
@@ -25,6 +25,7 @@#include "cpu.h" #include "trace.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" static bool pmp_write_cfg (CPURISCVState *env,uint32_t addr_index,uint8_t val);
target/riscv/vector_helper.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "exec/memop.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "exec/helper-proto.h" #include "fpu/softfloat.h"
target/rx/cpu.c +1 -0
@@ -22,6 +22,7 @@#include "cpu.h" #include "migration/vmstate.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "hw/loader.h" #include "fpu/softfloat.h" #include "tcg/debug-assert.h"
target/s390x/mmu_helper.c +1 -0
@@ -24,6 +24,7 @@#include "sysemu/kvm.h" #include "sysemu/tcg.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "trace.h" #include "hw/hw.h" #include "hw/s390x/storage-keys.h"
target/s390x/tcg/mem_helper.c +1 -0
@@ -25,6 +25,7 @@#include "tcg_s390x.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "hw/core/tcg-cpu-ops.h" #include "qemu/int128.h"
target/sh4/helper.c +1 -0
@@ -21,6 +21,7 @@#include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/log.h" #if !defined(CONFIG_USER_ONLY )
target/sparc/ldst_helper.c +1 -0
@@ -23,6 +23,7 @@#include "tcg/tcg.h" #include "exec/helper-proto.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "exec/cpu_ldst.h" #include "asi.h"
target/sparc/mmu_helper.c +1 -0
@@ -21,6 +21,7 @@#include "qemu/log.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "qemu/qemu-print.h" #include "trace.h"
target/tricore/helper.c +1 -0
@@ -20,6 +20,7 @@#include "hw/registerfields.h" #include "cpu.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #include "fpu/softfloat-helpers.h" #include "qemu/qemu-print.h"
target/xtensa/mmu_helper.c +1 -0
@@ -33,6 +33,7 @@#include "exec/helper-proto.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" +#include "exec/page-prot-common.h" #define XTENSA_MPU_SEGMENT_MASK 0x0000001f#define XTENSA_MPU_ACC_RIGHTS_MASK 0x00000f00
target/xtensa/op_helper.c +1 -0
@@ -28,6 +28,7 @@#include "qemu/osdep.h" #include "cpu.h" #include "exec/helper-proto.h" +#include "exec/page-prot-common.h" #include "qemu/host-utils.h" #include "exec/exec-all.h" #include "qemu/atomic.h"
Signature · 1 line
2.41.0
Re: [PATCH 23/24] exec/cpu-all: Extract page-protection definitions to page-prot-common.h
Quoted 8 lines · Philippe Mathieu-Daudé
Extract page-protection definitions from "
exec/cpu-all.h" to "exec/page-prot-common.h".The list of files requiring the new header was generated using:
$ git grep -wE \ 'PAGE_(READ|WRITE|EXEC|BITS|VALID|ANON|RESERVED|TARGET_.|PASSTHROUGH)'
Looks trivial for ppc, so fine. But what's the difference between -common.h and -all.h suffix?
Thanks,
Nick
Re: [PATCH 23/24] exec/cpu-all: Extract page-protection definitions to page-prot-common.h
Hi Nicholas,
Quoted 7 lines · Nicholas Piggin
Quoted 6 lines · Philippe Mathieu-Daudé
Extract page-protection definitions from "
exec/cpu-all.h" to "exec/page-prot-common.h".The list of files requiring the new header was generated using:
Quoted 7 lines
Quoted 2 lines
$ git grep -wE \ 'PAGE_(READ|WRITE|EXEC|BITS|VALID|ANON|RESERVED|TARGET_.|PASSTHROUGH)'Looks trivial for ppc, so fine. But what's the difference between
-common.hand-all.hsuffix?
We believe historically '-all' was used for target-specific headers. However then headers got massaged and some ended using this suffix, although not anymore target specific.
Today for clarity we prefer using '-common' for generic (target agnostic) headers, and '-target' for target-specific ones.
I tried to clarify that here:
https://lore.kernel.org/qemu-devel/[email protected]/
Thanks for your review,
Phil.
PATCH 24/24 target: Restrict 'sysemu/reset.h' to system emulation
In reply to Philippe Mathieu-DaudévCPU "reset" is only possible with system emulation.
--- target/i386/cpu.c | 2 +- target/loongarch/cpu.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
target/i386/cpu.c +1 -1
@@ -24,7 +24,6 @@#include "qemu/hw-version.h" #include "cpu.h" #include "tcg/helper-tcg.h" -#include "sysemu/reset.h" #include "sysemu/hvf.h" #include "hvf/hvf-i386.h" #include "kvm/kvm_i386.h"
@@ -37,6 +36,7 @@#include "hw/qdev-properties.h" #include "hw/i386/topology.h" #ifndef CONFIG_USER_ONLY +#include "sysemu/reset.h" #include "qapi/qapi-commands-machine-target.h" #include "exec/address-spaces.h" #include "hw/boards.h"
target/loongarch/cpu.c +2 -0
@@ -17,7 +17,9 @@#include "internals.h" #include "fpu/softfloat-helpers.h" #include "cpu-csr.h" +#ifndef CONFIG_USER_ONLY #include "sysemu/reset.h" +#endif #include "tcg/tcg.h" #include "vec.h"
Signature · 1 line
2.41.0
Re: [PATCH 24/24] target: Restrict 'sysemu/reset.h' to system emulation
Quoted 8 lines · Philippe Mathieu-Daudé
vCPU "reset" is only possible with system emulation.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.c | 2 +- target/loongarch/cpu.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
Re: [PATCH 24/24] target: Restrict 'sysemu/reset.h' to system emulation
In reply to Philippe Mathieu-DaudéQuoted 7 lines · Philippe Mathieu-Daudé
vCPU "reset" is only possible with system emulation.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- target/i386/cpu.c | 2 +- target/loongarch/cpu.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
Thanks.
Song Gao
Quoted 34 lines
target/i386/cpu.c +1
-1@@ -24,7 +24,6 @@#include "qemu/hw-version.h" #include "cpu.h" #include "tcg/helper-tcg.h" -#include "sysemu/reset.h" #include "sysemu/hvf.h" #include "hvf/hvf-i386.h" #include "kvm/kvm_i386.h" @@ -37,6 +36,7 @@#include "hw/qdev-properties.h" #include "hw/i386/topology.h" #ifndef CONFIG_USER_ONLY +#include "sysemu/reset.h" #include "qapi/qapi-commands-machine-target.h" #include "exec/address-spaces.h" #include "hw/boards.h" target/loongarch/cpu.c +2
-0@@ -17,7 +17,9 @@#include "internals.h" #include "fpu/softfloat-helpers.h" #include "cpu-csr.h" +#ifndef CONFIG_USER_ONLY #include "sysemu/reset.h" +#endif #include "tcg/tcg.h" #include "vec.h"