exec: Rename NEED_CPU_H -> CONFIG_TARGET
Subsystems (2)
PATCH 1/1 exec: Rename NEED_CPU_H -> CONFIG_TARGET
'NEED_CPU_H' guard target-specific code; it is defined by meson altogether with the 'CONFIG_TARGET' definition. Since the latter name is more meaningful, directly use it.
---
Based-on: <[email protected]>
sysemu/kvm: Header cleanups around "cpu.h"
Based-on: <[email protected]>
target/i386: Header cleanups around "cpu.h"
--- include/disas/disas.h | 2 +- include/exec/cpu-defs.h | 2 +- include/exec/gdbstub.h | 4 ++-- include/exec/helper-head.h | 4 ++-- include/exec/memop.h | 6 +++--- include/exec/memory.h | 4 ++-- include/hw/core/cpu.h | 4 ++-- include/hw/core/tcg-cpu-ops.h | 4 ++-- include/qemu/osdep.h | 4 ++-- include/sysemu/hax.h | 4 ++-- include/sysemu/hvf.h | 4 ++-- include/sysemu/kvm.h | 8 ++++---- include/sysemu/nvmm.h | 4 ++-- include/sysemu/whpx.h | 4 ++-- include/sysemu/xen.h | 4 ++-- meson.build | 6 ++---- scripts/analyze-inclusions | 6 +++--- target/arm/kvm-consts.h | 2 +- 18 files changed, 37 insertions(+), 39 deletions(-)
include/disas/disas.h +1 -1
@@ -3,7 +3,7 @@#include "exec/hwaddr.h" -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #include "cpu.h" /* Disassemble this for me please... (debugging). */
include/exec/cpu-defs.h +1 -1
@@ -19,7 +19,7 @@#ifndef CPU_DEFS_H #define CPU_DEFS_H -#ifndef NEED_CPU_H +#ifndef CONFIG_TARGET #error cpu.h included from common code#endif
include/exec/gdbstub.h +2 -2
@@ -71,7 +71,7 @@ struct gdb_timeval {uint64_t tv_usec;/* microsecond */ }QEMU_PACKED ; -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #include "cpu.h" typedef void (*gdb_syscall_complete_cb )(CPUState *cpu,uint64_t ret,int err);
@@ -214,7 +214,7 @@ static inline uint8_t * gdb_get_reg_ptr(GByteArray *buf, int len)#define ldtul_p (addr) ldl_p(addr)#endif -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ /** * gdbserver_start: start the gdb server
include/exec/helper-head.h +2 -2
@@ -49,7 +49,7 @@#define dh_ctype_noreturn G_NORETURN void#define dh_ctype (t) dh_ctype_##t -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET # ifdef TARGET_LONG_BITS # if TARGET_LONG_BITS ==32 # define dh_alias_tl i32
@@ -63,7 +63,7 @@# define dh_alias_env ptr# define dh_ctype_env CPUArchState *# define dh_typecode_env dh_typecode_ptr -#endif +#endif /* CONFIG_TARGET */ /* We can't use glue() here because it falls foul of C preprocessor recursive expansion rules. */
include/exec/memop.h +3 -3
@@ -35,7 +35,7 @@ typedef enum MemOp { MO_LE = 0, MO_BE = MO_BSWAP,#endif -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #if TARGET_BIG_ENDIAN MO_TE = MO_BE,#else
@@ -65,7 +65,7 @@ typedef enum MemOp {*/ MO_ASHIFT = 5, MO_AMASK = 0x7 << MO_ASHIFT, -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #ifdef TARGET_ALIGNED_ONLY MO_ALIGN =0 , MO_UNALN = MO_AMASK,
@@ -107,7 +107,7 @@ typedef enum MemOp { MO_BESL = MO_BE | MO_SL, MO_BESQ = MO_BE | MO_SQ, -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET MO_TEUW =MO_TE |MO_UW ,MO_TEUL =MO_TE |MO_UL , MO_TEUQ = MO_TE | MO_UQ,
include/exec/memory.h +2 -2
@@ -2938,7 +2938,7 @@ address_space_write_cached(MemoryRegionCache *cache, hwaddr addr,MemTxResult address_space_set (AddressSpace *as,hwaddr addr,uint8_t c,hwaddr len,MemTxAttrs attrs); -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET /* enum device_endian to MemOp. */ static inline MemOp devend_memop (enum device_endian end) {
@@ -2956,7 +2956,7 @@ static inline MemOp devend_memop(enum device_endian end)return (end == non_host_endianness) ?MO_BSWAP :0 ; #endif } -#endif +#endif /* CONFIG_TARGET */ /* * Inhibit technologies that require discarding of pages in RAM blocks, e.g.,
include/hw/core/cpu.h +2 -2
@@ -1044,7 +1044,7 @@ bool target_words_bigendian(void);void page_size_init (void ); -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #ifdef CONFIG_SOFTMMU
@@ -1059,7 +1059,7 @@ extern const VMStateDescription vmstate_cpu_common; }#endif /* CONFIG_SOFTMMU */ -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ #define UNASSIGNED_CPU_INDEX -1#define UNASSIGNED_CLUSTER_INDEX -1
include/hw/core/tcg-cpu-ops.h +2 -2
@@ -49,7 +49,7 @@ struct TCGCPUOps {/** @debug_excp_handler: Callback for handling debug exceptions */ void (*debug_excp_handler)(CPUState *cpu); -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #if defined(CONFIG_USER_ONLY ) && defined(TARGET_I386 )/** * @fake_user_interrupt: Callback for 'fake exception' handling.
@@ -171,7 +171,7 @@ struct TCGCPUOps {void (*record_sigbus)(CPUState *cpu,vaddr addr,MMUAccessType access_type,uintptr_t ra);#endif /* CONFIG_SOFTMMU */ -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ };
include/qemu/osdep.h +2 -2
@@ -28,11 +28,11 @@#define QEMU_OSDEP_H #include "config-host.h" -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #include CONFIG_TARGET #else #include "exec/poison.h" -#endif +#endif /* CONFIG_TARGET */ /* * HOST_WORDS_BIGENDIAN was replaced with HOST_BIG_ENDIAN. Prevent it from
include/sysemu/hax.h +2 -2
@@ -24,11 +24,11 @@int hax_sync_vcpus (void ); -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET # ifdef CONFIG_HAX # define CONFIG_HAX_IS_POSSIBLE # endif -#else /* !NEED_CPU_H */ +#else /* !CONFIG_TARGET */ # define CONFIG_HAX_IS_POSSIBLE #endif
include/sysemu/hvf.h +2 -2
@@ -16,7 +16,7 @@#include "qemu/accel.h" #include "qom/object.h" -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #ifdef CONFIG_HVF uint32_t hvf_get_supported_cpuid(uint32_t func, uint32_t idx,
@@ -28,7 +28,7 @@ extern bool hvf_allowed;#define hvf_get_supported_cpuid (func, idx, reg) 0#endif /* !CONFIG_HVF */ -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ #define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
include/sysemu/kvm.h +4 -4
@@ -20,14 +20,14 @@#include "qemu/accel.h" #include "qom/object.h" -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET # ifdef CONFIG_KVM # include <linux/kvm.h> # define CONFIG_KVM_IS_POSSIBLE # endif #else # define CONFIG_KVM_IS_POSSIBLE -#endif +#endif /* CONFIG_TARGET */ #ifdef CONFIG_KVM_IS_POSSIBLE
@@ -407,7 +407,7 @@ void kvm_get_apic_state(DeviceState *d, struct kvm_lapic_state *kapic);struct kvm_guest_debug ;struct kvm_debug_exit_arch ; -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #include "cpu.h" struct kvm_sw_breakpoint {
@@ -443,7 +443,7 @@ uint64_t kvm_arch_get_supported_msr_feature(KVMState *s, uint32_t index);int kvm_physical_memory_addr_from_host (KVMState *s,void *ram_addr,hwaddr *phys_addr); -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ int kvm_check_extension (KVMState *s,unsigned int extension);
include/sysemu/nvmm.h +2 -2
@@ -10,7 +10,7 @@#ifndef QEMU_NVMM_H #define QEMU_NVMM_H -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #ifdef CONFIG_NVMM
@@ -22,6 +22,6 @@ int nvmm_enabled(void);#endif /* CONFIG_NVMM */ -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ #endif /* QEMU_NVMM_H */
include/sysemu/whpx.h +2 -2
@@ -13,7 +13,7 @@#ifndef QEMU_WHPX_H #define QEMU_WHPX_H -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #ifdef CONFIG_WHPX
@@ -27,6 +27,6 @@ bool whpx_apic_in_platform(void);#endif /* CONFIG_WHPX */ -#endif /* NEED_CPU_H */ +#endif /* CONFIG_TARGET */ #endif /* QEMU_WHPX_H */
include/sysemu/xen.h +2 -2
@@ -10,13 +10,13 @@#include "exec/cpu-common.h" -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET # ifdef CONFIG_XEN # define CONFIG_XEN_IS_POSSIBLE # endif #else # define CONFIG_XEN_IS_POSSIBLE -#endif +#endif /* CONFIG_TARGET */ #ifdef CONFIG_XEN_IS_POSSIBLE
meson.build +2 -4
@@ -3204,8 +3204,7 @@ foreach d, list : target_modules config_target = config_target_mak[target] config_target += config_host target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])] - c_args = ['-DNEED_CPU_H', - '-DCONFIG_TARGET="@[email protected]"'.format(target), + c_args = ['-DCONFIG_TARGET="@[email protected]"'.format(target), '-DCONFIG_DEVICES="@[email protected]"'.format(target)] target_module_ss = module_ss.apply(config_target, strict: false) if target_module_ss.sources() != []
@@ -3384,8 +3383,7 @@ foreach target : target_dirs target_base_arch = config_target['TARGET_BASE_ARCH'] arch_srcs = [config_target_h[target]] arch_deps = [] - c_args = ['-DNEED_CPU_H', - '-DCONFIG_TARGET="@[email protected]"'.format(target), + c_args = ['-DCONFIG_TARGET="@[email protected]"'.format(target), '-DCONFIG_DEVICES="@[email protected]"'.format(target)] link_args = emulator_link_args
scripts/analyze-inclusions +3 -3
@@ -92,7 +92,7 @@ echo trace/generated-tracers.h: analyze -include ../include/qemu/osdep.h trace/generated-tracers.h echo target/i386/cpu.h: -analyze -DNEED_CPU_H -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h +analyze -DCONFIG_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../target/i386/cpu.h -echo hw/hw.h + NEED_CPU_H: -analyze -DNEED_CPU_H -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h +echo hw/hw.h + CONFIG_TARGET: +analyze -DCONFIG_TARGET -I../target/i386 -Ii386-softmmu -include ../include/qemu/osdep.h ../include/hw/hw.h
target/arm/kvm-consts.h +1 -1
@@ -14,7 +14,7 @@#ifndef ARM_KVM_CONSTS_H #define ARM_KVM_CONSTS_H -#ifdef NEED_CPU_H +#ifdef CONFIG_TARGET #ifdef CONFIG_KVM #include <linux/kvm.h> #include <linux/psci.h>
Signature · 1 line
2.38.1
Quoted 7 lines · Philippe Mathieu-Daudé
'
NEED_CPU_H' guard target-specific code; it is defined by meson altogether with the 'CONFIG_TARGET' definition. Since the latter name is more meaningful, directly use it.Inspired-by Peter Maydell <[email protected]>Signed-off-by Philippe Mathieu-Daudé <[email protected]>
This feels to me like it's overloading the meaning of CONFIG_TARGET, which at the moment is "the string which names the header file with target-specific config definitions". I think I'd rather we just renamed NEED_CPU_H to something a bit clearer, like perhaps COMPILING_PER_TARGET (better suggestions welcome).
thanks
-- PMM