Message ID | 20231122183048.17150-3-philmd@linaro.org |
---|---|
State | New |
Headers | show |
Series | hw/arm: Step toward building qemu-system-{arm, aarch64} altogether | expand |
On 22/11/23 19:30, Philippe Mathieu-Daudé wrote: > We want to build HW models once, but don't want to > register types when all prerequisites are satisfied. Add > the target_aarch64_available() to know at runtime whether > TARGET_AARCH64 is built-in. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > target/arm/cpu-qom.h | 2 ++ > target/arm/cpu.c | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h > index 02b914c876..bf6b3604ed 100644 > --- a/target/arm/cpu-qom.h > +++ b/target/arm/cpu-qom.h > @@ -33,4 +33,6 @@ typedef struct AArch64CPUClass AArch64CPUClass; > DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU, > TYPE_AARCH64_CPU) > > +bool target_aarch64_available(void); > + > #endif > diff --git a/target/arm/cpu.c b/target/arm/cpu.c > index 25e9d2ae7b..1990c04089 100644 > --- a/target/arm/cpu.c > +++ b/target/arm/cpu.c > @@ -2548,3 +2548,12 @@ static void arm_cpu_register_types(void) > } > > type_init(arm_cpu_register_types) > + > +bool target_aarch64_available(void) > +{ > +#ifdef TARGET_AARCH64 > + return true; > +#else > + return false; > +#endif > +} I forgot to precise here, what was discussed during the previous 2 years. Eventually qemu-system-arm is absorbed by qemu-system-aarch64, but to keep backward compatibility we add a new qemu-system-arm wrapper which simply calls 'qemu-system-aarch64 --32bit-only' (or better named option) forwarding the same command line. target_aarch64_available() then becomes: bool target_aarch64_available(void) { return option_32bit_only == false; }
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h index 02b914c876..bf6b3604ed 100644 --- a/target/arm/cpu-qom.h +++ b/target/arm/cpu-qom.h @@ -33,4 +33,6 @@ typedef struct AArch64CPUClass AArch64CPUClass; DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU, TYPE_AARCH64_CPU) +bool target_aarch64_available(void); + #endif diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 25e9d2ae7b..1990c04089 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -2548,3 +2548,12 @@ static void arm_cpu_register_types(void) } type_init(arm_cpu_register_types) + +bool target_aarch64_available(void) +{ +#ifdef TARGET_AARCH64 + return true; +#else + return false; +#endif +}
We want to build HW models once, but don't want to register types when all prerequisites are satisfied. Add the target_aarch64_available() to know at runtime whether TARGET_AARCH64 is built-in. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- target/arm/cpu-qom.h | 2 ++ target/arm/cpu.c | 9 +++++++++ 2 files changed, 11 insertions(+)