* [PATCH v2 00/12] single-binary: compile target/arm twice
@ 2025-04-30 14:58 Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 01/12] target/arm: Replace target_ulong -> uint64_t for HWBreakpoint Pierrick Bouvier
` (11 more replies)
0 siblings, 12 replies; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
More work toward single-binary.
This series convert target/arm/cpu.c.
Built on {linux, windows, macos} x {x86_64, aarch64}
Fully tested on linux-x86_64
v2
--
- Remove duplication of kvm struct and constant (Alex)
- Use target_big_endian() (Anton)
Philippe Mathieu-Daudé (1):
target/arm: Replace target_ulong -> uint64_t for HWBreakpoint
Pierrick Bouvier (11):
include/system/hvf: missing vaddr include
meson: add common libs for target and target_system
target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h
target/arm/kvm-stub: add kvm_arm_reset_vcpu stub
target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c
accel/hvf: add hvf_enabled() for common code
target/arm/cpu: remove TARGET_BIG_ENDIAN dependency
target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state
common
target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features
target/arm/cpu: compile file twice (user, system) only
target/arm/cpu32-stubs.c: compile file twice (user, system)
meson.build | 78 +++++++++++++++++++++++++++--------
include/system/hvf.h | 15 ++++---
target/arm/internals.h | 6 +--
target/arm/kvm_arm.h | 83 +-------------------------------------
accel/hvf/hvf-stub.c | 3 ++
target/arm/cpu.c | 47 +---------------------
target/arm/cpu32-stubs.c | 24 +++++++++++
target/arm/hyp_gdbstub.c | 6 +--
target/arm/kvm-stub.c | 87 ++++++++++++++++++++++++++++++++++++++++
target/arm/kvm.c | 29 ++++++++++++++
accel/hvf/meson.build | 1 +
target/arm/meson.build | 15 +++++--
12 files changed, 237 insertions(+), 157 deletions(-)
create mode 100644 accel/hvf/hvf-stub.c
create mode 100644 target/arm/cpu32-stubs.c
--
2.47.2
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 01/12] target/arm: Replace target_ulong -> uint64_t for HWBreakpoint
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 02/12] include/system/hvf: missing vaddr include Pierrick Bouvier
` (10 subsequent siblings)
11 siblings, 0 replies; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
From: Philippe Mathieu-Daudé <philmd@linaro.org>
CPUARMState::pc is of type uint64_t.
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/internals.h | 6 +++---
target/arm/hyp_gdbstub.c | 6 +++---
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/target/arm/internals.h b/target/arm/internals.h
index 4d3d84ffebd..c30689c9fcd 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -1949,9 +1949,9 @@ extern GArray *hw_breakpoints, *hw_watchpoints;
#define get_hw_bp(i) (&g_array_index(hw_breakpoints, HWBreakpoint, i))
#define get_hw_wp(i) (&g_array_index(hw_watchpoints, HWWatchpoint, i))
-bool find_hw_breakpoint(CPUState *cpu, target_ulong pc);
-int insert_hw_breakpoint(target_ulong pc);
-int delete_hw_breakpoint(target_ulong pc);
+bool find_hw_breakpoint(CPUState *cpu, uint64_t pc);
+int insert_hw_breakpoint(uint64_t pc);
+int delete_hw_breakpoint(uint64_t pc);
bool check_watchpoint_in_range(int i, vaddr addr);
CPUWatchpoint *find_hw_watchpoint(CPUState *cpu, vaddr addr);
diff --git a/target/arm/hyp_gdbstub.c b/target/arm/hyp_gdbstub.c
index 0512d67f8cf..4d8fd933868 100644
--- a/target/arm/hyp_gdbstub.c
+++ b/target/arm/hyp_gdbstub.c
@@ -54,7 +54,7 @@ GArray *hw_breakpoints, *hw_watchpoints;
* here so future PC comparisons will work properly.
*/
-int insert_hw_breakpoint(target_ulong addr)
+int insert_hw_breakpoint(uint64_t addr)
{
HWBreakpoint brk = {
.bcr = 0x1, /* BCR E=1, enable */
@@ -80,7 +80,7 @@ int insert_hw_breakpoint(target_ulong addr)
* Delete a breakpoint and shuffle any above down
*/
-int delete_hw_breakpoint(target_ulong pc)
+int delete_hw_breakpoint(uint64_t pc)
{
int i;
for (i = 0; i < hw_breakpoints->len; i++) {
@@ -226,7 +226,7 @@ int delete_hw_watchpoint(vaddr addr, vaddr len, int type)
return -ENOENT;
}
-bool find_hw_breakpoint(CPUState *cpu, target_ulong pc)
+bool find_hw_breakpoint(CPUState *cpu, uint64_t pc)
{
int i;
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 02/12] include/system/hvf: missing vaddr include
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 01/12] target/arm: Replace target_ulong -> uint64_t for HWBreakpoint Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:28 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 03/12] meson: add common libs for target and target_system Pierrick Bouvier
` (9 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
On MacOS x86_64:
In file included from ../target/i386/hvf/x86_task.c:13:
/Users/runner/work/qemu/qemu/include/system/hvf.h:42:5: error: unknown type name 'vaddr'
vaddr pc;
^
/Users/runner/work/qemu/qemu/include/system/hvf.h:43:5: error: unknown type name 'vaddr'
vaddr saved_insn;
^
/Users/runner/work/qemu/qemu/include/system/hvf.h:45:5: error: type name requires a specifier or qualifier
QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
^
/Users/runner/work/qemu/qemu/include/system/hvf.h:45:18: error: a parameter list without types is only allowed in a function definition
QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
^
/Users/runner/work/qemu/qemu/include/system/hvf.h:45:36: error: expected ';' at end of declaration list
QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/system/hvf.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/system/hvf.h b/include/system/hvf.h
index 730f927f034..356fced63e3 100644
--- a/include/system/hvf.h
+++ b/include/system/hvf.h
@@ -15,6 +15,7 @@
#include "qemu/accel.h"
#include "qom/object.h"
+#include "exec/vaddr.h"
#ifdef COMPILING_PER_TARGET
#include "cpu.h"
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 03/12] meson: add common libs for target and target_system
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 01/12] target/arm: Replace target_ulong -> uint64_t for HWBreakpoint Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 02/12] include/system/hvf: missing vaddr include Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:36 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 04/12] target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h Pierrick Bouvier
` (8 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Following what we did for hw/, we need target specific common libraries
for target. We need 2 different libraries:
- code common to a base architecture
- system code common to a base architecture
For user code, it can stay compiled per target for now.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------
1 file changed, 61 insertions(+), 17 deletions(-)
diff --git a/meson.build b/meson.build
index 68d36ac140f..7b2cf3cd7d1 100644
--- a/meson.build
+++ b/meson.build
@@ -3684,6 +3684,8 @@ target_arch = {}
target_system_arch = {}
target_user_arch = {}
hw_common_arch = {}
+target_common_arch = {}
+target_common_system_arch = {}
# NOTE: the trace/ subdirectory needs the qapi_trace_events variable
# that is filled in by qapi/.
@@ -4087,29 +4089,59 @@ common_all = static_library('common',
# construct common libraries per base architecture
hw_common_arch_libs = {}
+target_common_arch_libs = {}
+target_common_system_arch_libs = {}
foreach target : target_dirs
config_target = config_target_mak[target]
target_base_arch = config_target['TARGET_BASE_ARCH']
+ target_inc = [include_directories('target' / target_base_arch)]
+ inc = [common_user_inc + target_inc]
- # check if already generated
- if target_base_arch in hw_common_arch_libs
- continue
- endif
+ # prevent common code to access cpu compile time definition,
+ # but still allow access to cpu.h
+ target_c_args = ['-DCPU_DEFS_H']
+ target_system_c_args = target_c_args + ['-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU']
if target_base_arch in hw_common_arch
- target_inc = [include_directories('target' / target_base_arch)]
- src = hw_common_arch[target_base_arch]
- lib = static_library(
- 'hw_' + target_base_arch,
- build_by_default: false,
- sources: src.all_sources() + genh,
- include_directories: common_user_inc + target_inc,
- implicit_include_directories: false,
- # prevent common code to access cpu compile time
- # definition, but still allow access to cpu.h
- c_args: ['-DCPU_DEFS_H', '-DCOMPILING_SYSTEM_VS_USER', '-DCONFIG_SOFTMMU'],
- dependencies: src.all_dependencies())
- hw_common_arch_libs += {target_base_arch: lib}
+ if target_base_arch not in hw_common_arch_libs
+ src = hw_common_arch[target_base_arch]
+ lib = static_library(
+ 'hw_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_system_c_args,
+ dependencies: src.all_dependencies())
+ hw_common_arch_libs += {target_base_arch: lib}
+ endif
+ endif
+
+ if target_base_arch in target_common_arch
+ if target_base_arch not in target_common_arch_libs
+ src = target_common_arch[target_base_arch]
+ lib = static_library(
+ 'target_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_c_args,
+ dependencies: src.all_dependencies())
+ target_common_arch_libs += {target_base_arch: lib}
+ endif
+ endif
+
+ if target_base_arch in target_common_system_arch
+ if target_base_arch not in target_common_system_arch_libs
+ src = target_common_system_arch[target_base_arch]
+ lib = static_library(
+ 'target_system_' + target_base_arch,
+ build_by_default: false,
+ sources: src.all_sources() + genh,
+ include_directories: inc,
+ c_args: target_system_c_args,
+ dependencies: src.all_dependencies())
+ target_common_system_arch_libs += {target_base_arch: lib}
+ endif
endif
endforeach
@@ -4282,12 +4314,24 @@ foreach target : target_dirs
target_common = common_ss.apply(config_target, strict: false)
objects = [common_all.extract_objects(target_common.sources())]
arch_deps += target_common.dependencies()
+ if target_base_arch in target_common_arch_libs
+ src = target_common_arch[target_base_arch].apply(config_target, strict: false)
+ lib = target_common_arch_libs[target_base_arch]
+ objects += lib.extract_objects(src.sources())
+ arch_deps += src.dependencies()
+ endif
if target_type == 'system' and target_base_arch in hw_common_arch_libs
src = hw_common_arch[target_base_arch].apply(config_target, strict: false)
lib = hw_common_arch_libs[target_base_arch]
objects += lib.extract_objects(src.sources())
arch_deps += src.dependencies()
endif
+ if target_type == 'system' and target_base_arch in target_common_system_arch_libs
+ src = target_common_system_arch[target_base_arch].apply(config_target, strict: false)
+ lib = target_common_system_arch_libs[target_base_arch]
+ objects += lib.extract_objects(src.sources())
+ arch_deps += src.dependencies()
+ endif
target_specific = specific_ss.apply(config_target, strict: false)
arch_srcs += target_specific.sources()
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 04/12] target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (2 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 03/12] meson: add common libs for target and target_system Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:38 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 05/12] target/arm/kvm-stub: add kvm_arm_reset_vcpu stub Pierrick Bouvier
` (7 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Add a forward decl for struct kvm_vcpu_init to avoid pulling all kvm
headers.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/kvm_arm.h | 83 +------------------------------------------
target/arm/kvm-stub.c | 77 +++++++++++++++++++++++++++++++++++++++
2 files changed, 78 insertions(+), 82 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 05c3de8cd46..7b9c7c4a148 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -94,7 +94,7 @@ void kvm_arm_cpu_post_load(ARMCPU *cpu);
*/
void kvm_arm_reset_vcpu(ARMCPU *cpu);
-#ifdef CONFIG_KVM
+struct kvm_vcpu_init;
/**
* kvm_arm_create_scratch_host_vcpu:
* @cpus_to_try: array of QEMU_KVM_ARM_TARGET_* values (terminated with
@@ -221,85 +221,4 @@ int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level);
void kvm_arm_enable_mte(Object *cpuobj, Error **errp);
-#else
-
-/*
- * It's safe to call these functions without KVM support.
- * They should either do nothing or return "not supported".
- */
-static inline bool kvm_arm_aarch32_supported(void)
-{
- return false;
-}
-
-static inline bool kvm_arm_pmu_supported(void)
-{
- return false;
-}
-
-static inline bool kvm_arm_sve_supported(void)
-{
- return false;
-}
-
-static inline bool kvm_arm_mte_supported(void)
-{
- return false;
-}
-
-/*
- * These functions should never actually be called without KVM support.
- */
-static inline void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
-{
- g_assert_not_reached();
-}
-
-static inline void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
-{
- g_assert_not_reached();
-}
-
-static inline int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
-{
- g_assert_not_reached();
-}
-
-static inline int kvm_arm_vgic_probe(void)
-{
- g_assert_not_reached();
-}
-
-static inline void kvm_arm_pmu_set_irq(ARMCPU *cpu, int irq)
-{
- g_assert_not_reached();
-}
-
-static inline void kvm_arm_pmu_init(ARMCPU *cpu)
-{
- g_assert_not_reached();
-}
-
-static inline void kvm_arm_pvtime_init(ARMCPU *cpu, uint64_t ipa)
-{
- g_assert_not_reached();
-}
-
-static inline void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp)
-{
- g_assert_not_reached();
-}
-
-static inline uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu)
-{
- g_assert_not_reached();
-}
-
-static inline void kvm_arm_enable_mte(Object *cpuobj, Error **errp)
-{
- g_assert_not_reached();
-}
-
-#endif
-
#endif
diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c
index 965a486b320..2b73d0598c1 100644
--- a/target/arm/kvm-stub.c
+++ b/target/arm/kvm-stub.c
@@ -22,3 +22,80 @@ bool write_list_to_kvmstate(ARMCPU *cpu, int level)
{
g_assert_not_reached();
}
+
+/*
+ * It's safe to call these functions without KVM support.
+ * They should either do nothing or return "not supported".
+ */
+bool kvm_arm_aarch32_supported(void)
+{
+ return false;
+}
+
+bool kvm_arm_pmu_supported(void)
+{
+ return false;
+}
+
+bool kvm_arm_sve_supported(void)
+{
+ return false;
+}
+
+bool kvm_arm_mte_supported(void)
+{
+ return false;
+}
+
+/*
+ * These functions should never actually be called without KVM support.
+ */
+void kvm_arm_set_cpu_features_from_host(ARMCPU *cpu)
+{
+ g_assert_not_reached();
+}
+
+void kvm_arm_add_vcpu_properties(ARMCPU *cpu)
+{
+ g_assert_not_reached();
+}
+
+int kvm_arm_get_max_vm_ipa_size(MachineState *ms, bool *fixed_ipa)
+{
+ g_assert_not_reached();
+}
+
+int kvm_arm_vgic_probe(void)
+{
+ g_assert_not_reached();
+}
+
+void kvm_arm_pmu_set_irq(ARMCPU *cpu, int irq)
+{
+ g_assert_not_reached();
+}
+
+void kvm_arm_pmu_init(ARMCPU *cpu)
+{
+ g_assert_not_reached();
+}
+
+void kvm_arm_pvtime_init(ARMCPU *cpu, uint64_t ipa)
+{
+ g_assert_not_reached();
+}
+
+void kvm_arm_steal_time_finalize(ARMCPU *cpu, Error **errp)
+{
+ g_assert_not_reached();
+}
+
+uint32_t kvm_arm_sve_get_vls(ARMCPU *cpu)
+{
+ g_assert_not_reached();
+}
+
+void kvm_arm_enable_mte(Object *cpuobj, Error **errp)
+{
+ g_assert_not_reached();
+}
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 05/12] target/arm/kvm-stub: add kvm_arm_reset_vcpu stub
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (3 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 04/12] target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:39 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 06/12] target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c Pierrick Bouvier
` (6 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Needed in target/arm/cpu.c once kvm is possible.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/kvm-stub.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c
index 2b73d0598c1..e34d3f5e6b4 100644
--- a/target/arm/kvm-stub.c
+++ b/target/arm/kvm-stub.c
@@ -99,3 +99,8 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp)
{
g_assert_not_reached();
}
+
+void kvm_arm_reset_vcpu(ARMCPU *cpu)
+{
+ g_assert_not_reached();
+}
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 06/12] target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (4 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 05/12] target/arm/kvm-stub: add kvm_arm_reset_vcpu stub Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:41 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code Pierrick Bouvier
` (5 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/kvm_arm.h | 2 ++
target/arm/cpu.c | 31 -------------------------------
target/arm/kvm-stub.c | 5 +++++
target/arm/kvm.c | 29 +++++++++++++++++++++++++++++
4 files changed, 36 insertions(+), 31 deletions(-)
diff --git a/target/arm/kvm_arm.h b/target/arm/kvm_arm.h
index 7b9c7c4a148..d156c790b66 100644
--- a/target/arm/kvm_arm.h
+++ b/target/arm/kvm_arm.h
@@ -221,4 +221,6 @@ int kvm_arm_set_irq(int cpu, int irqtype, int irq, int level);
void kvm_arm_enable_mte(Object *cpuobj, Error **errp);
+void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int level);
+
#endif
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 5e951675c60..07f279fec8c 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1099,37 +1099,6 @@ static void arm_cpu_set_irq(void *opaque, int irq, int level)
}
}
-static void arm_cpu_kvm_set_irq(void *opaque, int irq, int level)
-{
-#ifdef CONFIG_KVM
- ARMCPU *cpu = opaque;
- CPUARMState *env = &cpu->env;
- CPUState *cs = CPU(cpu);
- uint32_t linestate_bit;
- int irq_id;
-
- switch (irq) {
- case ARM_CPU_IRQ:
- irq_id = KVM_ARM_IRQ_CPU_IRQ;
- linestate_bit = CPU_INTERRUPT_HARD;
- break;
- case ARM_CPU_FIQ:
- irq_id = KVM_ARM_IRQ_CPU_FIQ;
- linestate_bit = CPU_INTERRUPT_FIQ;
- break;
- default:
- g_assert_not_reached();
- }
-
- if (level) {
- env->irq_line_state |= linestate_bit;
- } else {
- env->irq_line_state &= ~linestate_bit;
- }
- kvm_arm_set_irq(cs->cpu_index, KVM_ARM_IRQ_TYPE_CPU, irq_id, !!level);
-#endif
-}
-
static bool arm_cpu_virtio_is_big_endian(CPUState *cs)
{
ARMCPU *cpu = ARM_CPU(cs);
diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c
index e34d3f5e6b4..4806365cdc5 100644
--- a/target/arm/kvm-stub.c
+++ b/target/arm/kvm-stub.c
@@ -104,3 +104,8 @@ void kvm_arm_reset_vcpu(ARMCPU *cpu)
{
g_assert_not_reached();
}
+
+void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int level)
+{
+ g_assert_not_reached();
+}
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
index 97de8c7e939..8f68aa10298 100644
--- a/target/arm/kvm.c
+++ b/target/arm/kvm.c
@@ -2468,3 +2468,32 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp)
cpu->kvm_mte = true;
}
}
+
+void arm_cpu_kvm_set_irq(void *arm_cpu, int irq, int level)
+{
+ ARMCPU *cpu = arm_cpu;
+ CPUARMState *env = &cpu->env;
+ CPUState *cs = CPU(cpu);
+ uint32_t linestate_bit;
+ int irq_id;
+
+ switch (irq) {
+ case ARM_CPU_IRQ:
+ irq_id = KVM_ARM_IRQ_CPU_IRQ;
+ linestate_bit = CPU_INTERRUPT_HARD;
+ break;
+ case ARM_CPU_FIQ:
+ irq_id = KVM_ARM_IRQ_CPU_FIQ;
+ linestate_bit = CPU_INTERRUPT_FIQ;
+ break;
+ default:
+ g_assert_not_reached();
+ }
+
+ if (level) {
+ env->irq_line_state |= linestate_bit;
+ } else {
+ env->irq_line_state &= ~linestate_bit;
+ }
+ kvm_arm_set_irq(cs->cpu_index, KVM_ARM_IRQ_TYPE_CPU, irq_id, !!level);
+}
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (5 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 06/12] target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:43 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency Pierrick Bouvier
` (4 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Other accelerators define a CONFIG_{accel}_IS_POSSIBLE when
COMPILING_PER_TARGET is not defined, except hvf.
Without this change, target/arm/cpu.c can't find hvf_enabled.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
include/system/hvf.h | 14 +++++++++-----
accel/hvf/hvf-stub.c | 3 +++
accel/hvf/meson.build | 1 +
3 files changed, 13 insertions(+), 5 deletions(-)
create mode 100644 accel/hvf/hvf-stub.c
diff --git a/include/system/hvf.h b/include/system/hvf.h
index 356fced63e3..1ee2a4177d9 100644
--- a/include/system/hvf.h
+++ b/include/system/hvf.h
@@ -19,15 +19,19 @@
#ifdef COMPILING_PER_TARGET
#include "cpu.h"
+# ifdef CONFIG_HVF
+# define CONFIG_HVF_IS_POSSIBLE
+# endif
+#else
+# define CONFIG_HVF_IS_POSSIBLE
+#endif
-#ifdef CONFIG_HVF
+#ifdef CONFIG_HVF_IS_POSSIBLE
extern bool hvf_allowed;
#define hvf_enabled() (hvf_allowed)
-#else /* !CONFIG_HVF */
+#else
#define hvf_enabled() 0
-#endif /* !CONFIG_HVF */
-
-#endif /* COMPILING_PER_TARGET */
+#endif /* CONFIG_HVF_IS_POSSIBLE */
#define TYPE_HVF_ACCEL ACCEL_CLASS_NAME("hvf")
diff --git a/accel/hvf/hvf-stub.c b/accel/hvf/hvf-stub.c
new file mode 100644
index 00000000000..22e2f50c01d
--- /dev/null
+++ b/accel/hvf/hvf-stub.c
@@ -0,0 +1,3 @@
+#include "qemu/osdep.h"
+
+bool hvf_allowed;
diff --git a/accel/hvf/meson.build b/accel/hvf/meson.build
index fc52cb78433..7745b94e50f 100644
--- a/accel/hvf/meson.build
+++ b/accel/hvf/meson.build
@@ -5,3 +5,4 @@ hvf_ss.add(files(
))
specific_ss.add_all(when: 'CONFIG_HVF', if_true: hvf_ss)
+common_ss.add(when: 'CONFIG_HVF', if_false: files('hvf-stub.c'))
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (6 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:44 ` Richard Henderson
2025-04-30 23:49 ` Anton Johansson via
2025-04-30 14:58 ` [PATCH v2 09/12] target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state common Pierrick Bouvier
` (3 subsequent siblings)
11 siblings, 2 replies; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/cpu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 07f279fec8c..37b11e8866f 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -23,6 +23,7 @@
#include "qemu/timer.h"
#include "qemu/log.h"
#include "exec/page-vary.h"
+#include "exec/tswap.h"
#include "target/arm/idau.h"
#include "qemu/module.h"
#include "qapi/error.h"
@@ -1172,7 +1173,7 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
info->endian = BFD_ENDIAN_LITTLE;
if (bswap_code(sctlr_b)) {
- info->endian = TARGET_BIG_ENDIAN ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
+ info->endian = target_big_endian() ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
}
info->flags &= ~INSN_ARM_BE32;
#ifndef CONFIG_USER_ONLY
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 09/12] target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state common
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (7 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:45 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features Pierrick Bouvier
` (2 subsequent siblings)
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/cpu.c | 11 -----------
1 file changed, 11 deletions(-)
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 37b11e8866f..00ae2778058 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1183,8 +1183,6 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
#endif
}
-#ifdef TARGET_AARCH64
-
static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
{
ARMCPU *cpu = ARM_CPU(cs);
@@ -1342,15 +1340,6 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
}
}
-#else
-
-static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
-{
- g_assert_not_reached();
-}
-
-#endif
-
static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
{
ARMCPU *cpu = ARM_CPU(cs);
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (8 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 09/12] target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state common Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:47 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 12/12] target/arm/cpu32-stubs.c: compile file twice (user, system) Pierrick Bouvier
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Need to stub cpu64 finalize functions.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/cpu.c | 2 --
target/arm/cpu32-stubs.c | 24 ++++++++++++++++++++++++
target/arm/meson.build | 11 +++++++----
3 files changed, 31 insertions(+), 6 deletions(-)
create mode 100644 target/arm/cpu32-stubs.c
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 00ae2778058..c3a1e8e284d 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -1878,7 +1878,6 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp)
{
Error *local_err = NULL;
-#ifdef TARGET_AARCH64
if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) {
arm_cpu_sve_finalize(cpu, &local_err);
if (local_err != NULL) {
@@ -1914,7 +1913,6 @@ void arm_cpu_finalize_features(ARMCPU *cpu, Error **errp)
return;
}
}
-#endif
if (kvm_enabled()) {
kvm_arm_steal_time_finalize(cpu, &local_err);
diff --git a/target/arm/cpu32-stubs.c b/target/arm/cpu32-stubs.c
new file mode 100644
index 00000000000..fda7ccee4b5
--- /dev/null
+++ b/target/arm/cpu32-stubs.c
@@ -0,0 +1,24 @@
+#include "qemu/osdep.h"
+#include "target/arm/cpu.h"
+#include "target/arm/internals.h"
+#include <glib.h>
+
+void arm_cpu_sme_finalize(ARMCPU *cpu, Error **errp)
+{
+ g_assert_not_reached();
+}
+
+void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
+{
+ g_assert_not_reached();
+}
+
+void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp)
+{
+ g_assert_not_reached();
+}
+
+void arm_cpu_lpa2_finalize(ARMCPU *cpu, Error **errp)
+{
+ g_assert_not_reached();
+}
diff --git a/target/arm/meson.build b/target/arm/meson.build
index 3065081d241..c39ddc4427b 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -11,10 +11,13 @@ arm_ss.add(zlib)
arm_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'), if_false: files('kvm-stub.c'))
arm_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
-arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
- 'cpu64.c',
- 'gdbstub64.c',
-))
+arm_ss.add(when: 'TARGET_AARCH64',
+ if_true: files(
+ 'cpu64.c',
+ 'gdbstub64.c'),
+ if_false: files(
+ 'cpu32-stubs.c'),
+)
arm_system_ss = ss.source_set()
arm_system_ss.add(files(
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (9 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:50 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 12/12] target/arm/cpu32-stubs.c: compile file twice (user, system) Pierrick Bouvier
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/meson.build | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/target/arm/meson.build b/target/arm/meson.build
index c39ddc4427b..89e305eb56a 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -1,6 +1,6 @@
arm_ss = ss.source_set()
+arm_common_ss = ss.source_set()
arm_ss.add(files(
- 'cpu.c',
'debug_helper.c',
'gdbstub.c',
'helper.c',
@@ -20,6 +20,7 @@ arm_ss.add(when: 'TARGET_AARCH64',
)
arm_system_ss = ss.source_set()
+arm_common_system_ss = ss.source_set()
arm_system_ss.add(files(
'arch_dump.c',
'arm-powerctl.c',
@@ -30,6 +31,9 @@ arm_system_ss.add(files(
))
arm_user_ss = ss.source_set()
+arm_user_ss.add(files('cpu.c'))
+
+arm_common_system_ss.add(files('cpu.c'), capstone)
subdir('hvf')
@@ -42,3 +46,5 @@ endif
target_arch += {'arm': arm_ss}
target_system_arch += {'arm': arm_system_ss}
target_user_arch += {'arm': arm_user_ss}
+target_common_arch += {'arm': arm_common_ss}
+target_common_system_arch += {'arm': arm_common_system_ss}
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 12/12] target/arm/cpu32-stubs.c: compile file twice (user, system)
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
` (10 preceding siblings ...)
2025-04-30 14:58 ` [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only Pierrick Bouvier
@ 2025-04-30 14:58 ` Pierrick Bouvier
2025-04-30 18:51 ` Richard Henderson
11 siblings, 1 reply; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 14:58 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson, anjo,
Pierrick Bouvier
It could be squashed with commit introducing it, but I would prefer to
introduce target/arm/cpu.c first.
Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
---
target/arm/meson.build | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/target/arm/meson.build b/target/arm/meson.build
index 89e305eb56a..de214fe5d56 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -11,13 +11,9 @@ arm_ss.add(zlib)
arm_ss.add(when: 'CONFIG_KVM', if_true: files('hyp_gdbstub.c', 'kvm.c'), if_false: files('kvm-stub.c'))
arm_ss.add(when: 'CONFIG_HVF', if_true: files('hyp_gdbstub.c'))
-arm_ss.add(when: 'TARGET_AARCH64',
- if_true: files(
- 'cpu64.c',
- 'gdbstub64.c'),
- if_false: files(
- 'cpu32-stubs.c'),
-)
+arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
+ 'cpu64.c',
+ 'gdbstub64.c'))
arm_system_ss = ss.source_set()
arm_common_system_ss = ss.source_set()
@@ -32,8 +28,12 @@ arm_system_ss.add(files(
arm_user_ss = ss.source_set()
arm_user_ss.add(files('cpu.c'))
+arm_user_ss.add(when: 'TARGET_AARCH64', if_false: files(
+ 'cpu32-stubs.c'))
arm_common_system_ss.add(files('cpu.c'), capstone)
+arm_common_system_ss.add(when: 'TARGET_AARCH64', if_false: files(
+ 'cpu32-stubs.c'))
subdir('hvf')
--
2.47.2
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH v2 02/12] include/system/hvf: missing vaddr include
2025-04-30 14:58 ` [PATCH v2 02/12] include/system/hvf: missing vaddr include Pierrick Bouvier
@ 2025-04-30 18:28 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:28 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> On MacOS x86_64:
> In file included from ../target/i386/hvf/x86_task.c:13:
> /Users/runner/work/qemu/qemu/include/system/hvf.h:42:5: error: unknown type name 'vaddr'
> vaddr pc;
> ^
> /Users/runner/work/qemu/qemu/include/system/hvf.h:43:5: error: unknown type name 'vaddr'
> vaddr saved_insn;
> ^
> /Users/runner/work/qemu/qemu/include/system/hvf.h:45:5: error: type name requires a specifier or qualifier
> QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
> ^
> /Users/runner/work/qemu/qemu/include/system/hvf.h:45:18: error: a parameter list without types is only allowed in a function definition
> QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
> ^
> /Users/runner/work/qemu/qemu/include/system/hvf.h:45:36: error: expected ';' at end of declaration list
> QTAILQ_ENTRY(hvf_sw_breakpoint) entry;
>
> Reviewed-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
> include/system/hvf.h | 1 +
> 1 file changed, 1 insertion(+)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 03/12] meson: add common libs for target and target_system
2025-04-30 14:58 ` [PATCH v2 03/12] meson: add common libs for target and target_system Pierrick Bouvier
@ 2025-04-30 18:36 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:36 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> Following what we did for hw/, we need target specific common libraries
> for target. We need 2 different libraries:
> - code common to a base architecture
> - system code common to a base architecture
>
> For user code, it can stay compiled per target for now.
>
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
> meson.build | 78 +++++++++++++++++++++++++++++++++++++++++------------
> 1 file changed, 61 insertions(+), 17 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 04/12] target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h
2025-04-30 14:58 ` [PATCH v2 04/12] target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h Pierrick Bouvier
@ 2025-04-30 18:38 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:38 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> Add a forward decl for struct kvm_vcpu_init to avoid pulling all kvm
> headers.
>
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
> target/arm/kvm_arm.h | 83 +------------------------------------------
> target/arm/kvm-stub.c | 77 +++++++++++++++++++++++++++++++++++++++
> 2 files changed, 78 insertions(+), 82 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 05/12] target/arm/kvm-stub: add kvm_arm_reset_vcpu stub
2025-04-30 14:58 ` [PATCH v2 05/12] target/arm/kvm-stub: add kvm_arm_reset_vcpu stub Pierrick Bouvier
@ 2025-04-30 18:39 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:39 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> Needed in target/arm/cpu.c once kvm is possible.
>
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> target/arm/kvm-stub.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/target/arm/kvm-stub.c b/target/arm/kvm-stub.c
> index 2b73d0598c1..e34d3f5e6b4 100644
> --- a/target/arm/kvm-stub.c
> +++ b/target/arm/kvm-stub.c
> @@ -99,3 +99,8 @@ void kvm_arm_enable_mte(Object *cpuobj, Error **errp)
> {
> g_assert_not_reached();
> }
> +
> +void kvm_arm_reset_vcpu(ARMCPU *cpu)
> +{
> + g_assert_not_reached();
> +}
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 06/12] target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c
2025-04-30 14:58 ` [PATCH v2 06/12] target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c Pierrick Bouvier
@ 2025-04-30 18:41 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:41 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
> target/arm/kvm_arm.h | 2 ++
> target/arm/cpu.c | 31 -------------------------------
> target/arm/kvm-stub.c | 5 +++++
> target/arm/kvm.c | 29 +++++++++++++++++++++++++++++
> 4 files changed, 36 insertions(+), 31 deletions(-)
Nice.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code
2025-04-30 14:58 ` [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code Pierrick Bouvier
@ 2025-04-30 18:43 ` Richard Henderson
2025-04-30 19:06 ` Pierrick Bouvier
0 siblings, 1 reply; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:43 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> +++ b/accel/hvf/hvf-stub.c
> @@ -0,0 +1,3 @@
> +#include "qemu/osdep.h"
> +
> +bool hvf_allowed;
Even small files require license lines. Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency
2025-04-30 14:58 ` [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency Pierrick Bouvier
@ 2025-04-30 18:44 ` Richard Henderson
2025-04-30 23:49 ` Anton Johansson via
1 sibling, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:44 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> target/arm/cpu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 07f279fec8c..37b11e8866f 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -23,6 +23,7 @@
> #include "qemu/timer.h"
> #include "qemu/log.h"
> #include "exec/page-vary.h"
> +#include "exec/tswap.h"
> #include "target/arm/idau.h"
> #include "qemu/module.h"
> #include "qapi/error.h"
> @@ -1172,7 +1173,7 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
>
> info->endian = BFD_ENDIAN_LITTLE;
> if (bswap_code(sctlr_b)) {
> - info->endian = TARGET_BIG_ENDIAN ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
> + info->endian = target_big_endian() ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
> }
> info->flags &= ~INSN_ARM_BE32;
> #ifndef CONFIG_USER_ONLY
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 09/12] target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state common
2025-04-30 14:58 ` [PATCH v2 09/12] target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state common Pierrick Bouvier
@ 2025-04-30 18:45 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:45 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> target/arm/cpu.c | 11 -----------
> 1 file changed, 11 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 37b11e8866f..00ae2778058 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -1183,8 +1183,6 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
> #endif
> }
>
> -#ifdef TARGET_AARCH64
> -
> static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
> {
> ARMCPU *cpu = ARM_CPU(cs);
> @@ -1342,15 +1340,6 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
> }
> }
>
> -#else
> -
> -static inline void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags)
> -{
> - g_assert_not_reached();
> -}
> -
> -#endif
> -
> static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
> {
> ARMCPU *cpu = ARM_CPU(cs);
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features
2025-04-30 14:58 ` [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features Pierrick Bouvier
@ 2025-04-30 18:47 ` Richard Henderson
2025-04-30 19:06 ` Pierrick Bouvier
0 siblings, 1 reply; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:47 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> new file mode 100644
> index 00000000000..fda7ccee4b5
> --- /dev/null
> +++ b/target/arm/cpu32-stubs.c
> @@ -0,0 +1,24 @@
> +#include "qemu/osdep.h"
> +#include "target/arm/cpu.h"
Need license comment. Otherwise,
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only
2025-04-30 14:58 ` [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only Pierrick Bouvier
@ 2025-04-30 18:50 ` Richard Henderson
2025-04-30 19:06 ` Pierrick Bouvier
0 siblings, 1 reply; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:50 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> +arm_common_system_ss.add(files('cpu.c'), capstone)
I wonder if we should inherit these dependencies from common_ss or system_ss?
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 12/12] target/arm/cpu32-stubs.c: compile file twice (user, system)
2025-04-30 14:58 ` [PATCH v2 12/12] target/arm/cpu32-stubs.c: compile file twice (user, system) Pierrick Bouvier
@ 2025-04-30 18:51 ` Richard Henderson
0 siblings, 0 replies; 28+ messages in thread
From: Richard Henderson @ 2025-04-30 18:51 UTC (permalink / raw)
To: Pierrick Bouvier, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 07:58, Pierrick Bouvier wrote:
> It could be squashed with commit introducing it, but I would prefer to
> introduce target/arm/cpu.c first.
>
> Signed-off-by: Pierrick Bouvier<pierrick.bouvier@linaro.org>
> ---
> target/arm/meson.build | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only
2025-04-30 18:50 ` Richard Henderson
@ 2025-04-30 19:06 ` Pierrick Bouvier
0 siblings, 0 replies; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 19:06 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 11:50 AM, Richard Henderson wrote:
> On 4/30/25 07:58, Pierrick Bouvier wrote:
>> +arm_common_system_ss.add(files('cpu.c'), capstone)
>
> I wonder if we should inherit these dependencies from common_ss or system_ss?
>
I ran into the same issue when working on hw/arm [1], and didn't really
look for a way to do this from main meson.build.
I thought that it's a good thing to document those kind of dependencies
next to the sources who depend on them, so I didn't dig too much.
That said, I'm not opposed to it if you feel your approach is better.
[1] hw/arm/meson.build
-arm_ss.add(files('boot.c'))
+arm_common_ss.add(fdt, files('boot.c'))
-arm_ss.add(when: 'CONFIG_MUSICPAL', if_true: files('musicpal.c'))
+arm_common_ss.add(when: 'CONFIG_MUSICPAL', if_true: [pixman,
files('musicpal.c')])
>
> r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features
2025-04-30 18:47 ` Richard Henderson
@ 2025-04-30 19:06 ` Pierrick Bouvier
0 siblings, 0 replies; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 19:06 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 11:47 AM, Richard Henderson wrote:
> On 4/30/25 07:58, Pierrick Bouvier wrote:
>> new file mode 100644
>> index 00000000000..fda7ccee4b5
>> --- /dev/null
>> +++ b/target/arm/cpu32-stubs.c
>> @@ -0,0 +1,24 @@
>> +#include "qemu/osdep.h"
>> +#include "target/arm/cpu.h"
>
> Need license comment. Otherwise,
>
I'll add it, thanks.
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
> r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code
2025-04-30 18:43 ` Richard Henderson
@ 2025-04-30 19:06 ` Pierrick Bouvier
0 siblings, 0 replies; 28+ messages in thread
From: Pierrick Bouvier @ 2025-04-30 19:06 UTC (permalink / raw)
To: Richard Henderson, qemu-devel
Cc: qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, anjo
On 4/30/25 11:43 AM, Richard Henderson wrote:
> On 4/30/25 07:58, Pierrick Bouvier wrote:
>> +++ b/accel/hvf/hvf-stub.c
>> @@ -0,0 +1,3 @@
>> +#include "qemu/osdep.h"
>> +
>> +bool hvf_allowed;
>
> Even small files require license lines. Otherwise,
> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>
I'll add it, thanks.
> r~
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency
2025-04-30 14:58 ` [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency Pierrick Bouvier
2025-04-30 18:44 ` Richard Henderson
@ 2025-04-30 23:49 ` Anton Johansson via
1 sibling, 0 replies; 28+ messages in thread
From: Anton Johansson via @ 2025-04-30 23:49 UTC (permalink / raw)
To: Pierrick Bouvier
Cc: qemu-devel, qemu-arm, Paolo Bonzini, kvm, Peter Maydell,
Philippe Mathieu-Daudé, alex.bennee, richard.henderson
On 30/04/25, Pierrick Bouvier wrote:
> Signed-off-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
> ---
> target/arm/cpu.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/target/arm/cpu.c b/target/arm/cpu.c
> index 07f279fec8c..37b11e8866f 100644
> --- a/target/arm/cpu.c
> +++ b/target/arm/cpu.c
> @@ -23,6 +23,7 @@
> #include "qemu/timer.h"
> #include "qemu/log.h"
> #include "exec/page-vary.h"
> +#include "exec/tswap.h"
> #include "target/arm/idau.h"
> #include "qemu/module.h"
> #include "qapi/error.h"
> @@ -1172,7 +1173,7 @@ static void arm_disas_set_info(CPUState *cpu, disassemble_info *info)
>
> info->endian = BFD_ENDIAN_LITTLE;
> if (bswap_code(sctlr_b)) {
> - info->endian = TARGET_BIG_ENDIAN ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
> + info->endian = target_big_endian() ? BFD_ENDIAN_LITTLE : BFD_ENDIAN_BIG;
> }
> info->flags &= ~INSN_ARM_BE32;
> #ifndef CONFIG_USER_ONLY
> --
> 2.47.2
>
Reviewed-by: Anton Johansson <anjo@rev.ng>
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2025-04-30 23:48 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30 14:58 [PATCH v2 00/12] single-binary: compile target/arm twice Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 01/12] target/arm: Replace target_ulong -> uint64_t for HWBreakpoint Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 02/12] include/system/hvf: missing vaddr include Pierrick Bouvier
2025-04-30 18:28 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 03/12] meson: add common libs for target and target_system Pierrick Bouvier
2025-04-30 18:36 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 04/12] target/arm: move kvm stubs and remove CONFIG_KVM from kvm_arm.h Pierrick Bouvier
2025-04-30 18:38 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 05/12] target/arm/kvm-stub: add kvm_arm_reset_vcpu stub Pierrick Bouvier
2025-04-30 18:39 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 06/12] target/arm/cpu: move arm_cpu_kvm_set_irq to kvm.c Pierrick Bouvier
2025-04-30 18:41 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 07/12] accel/hvf: add hvf_enabled() for common code Pierrick Bouvier
2025-04-30 18:43 ` Richard Henderson
2025-04-30 19:06 ` Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 08/12] target/arm/cpu: remove TARGET_BIG_ENDIAN dependency Pierrick Bouvier
2025-04-30 18:44 ` Richard Henderson
2025-04-30 23:49 ` Anton Johansson via
2025-04-30 14:58 ` [PATCH v2 09/12] target/arm/cpu: remove TARGET_AARCH64 around aarch64_cpu_dump_state common Pierrick Bouvier
2025-04-30 18:45 ` Richard Henderson
2025-04-30 14:58 ` [PATCH v2 10/12] target/arm/cpu: remove TARGET_AARCH64 in arm_cpu_finalize_features Pierrick Bouvier
2025-04-30 18:47 ` Richard Henderson
2025-04-30 19:06 ` Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 11/12] target/arm/cpu: compile file twice (user, system) only Pierrick Bouvier
2025-04-30 18:50 ` Richard Henderson
2025-04-30 19:06 ` Pierrick Bouvier
2025-04-30 14:58 ` [PATCH v2 12/12] target/arm/cpu32-stubs.c: compile file twice (user, system) Pierrick Bouvier
2025-04-30 18:51 ` Richard Henderson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).