Message ID | 20250418005059.4436-12-philmd@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | single-binary: Make hw/arm/ common | expand |
On 4/17/25 17:50, Philippe Mathieu-Daudé wrote: > Now than Raspi machines can be filtered when running a > qemu-system-arm or qemu-system-aarch64 binary, we can > remove the TARGET_AARCH64 #ifdef'ry and compile the > aspeed.c file once, moving it from arm_ss[] source set > to arm_common_ss[]. Note, we expose the TYPE_BCM2837 > type to qemu-system-arm, but it is not user-creatable, > so not an issue. > > Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > hw/arm/bcm2836.c | 4 ---- > hw/arm/raspi.c | 4 ---- > hw/arm/meson.build | 8 ++++++-- > 3 files changed, 6 insertions(+), 10 deletions(-) > > diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c > index 95e16806fa1..7dd81e8e0f9 100644 > --- a/hw/arm/bcm2836.c > +++ b/hw/arm/bcm2836.c > @@ -195,7 +195,6 @@ static void bcm2836_class_init(ObjectClass *oc, void *data) > dc->realize = bcm2836_realize; > }; > > -#ifdef TARGET_AARCH64 > static void bcm2837_class_init(ObjectClass *oc, void *data) > { > DeviceClass *dc = DEVICE_CLASS(oc); > @@ -208,7 +207,6 @@ static void bcm2837_class_init(ObjectClass *oc, void *data) > bc->clusterid = 0x0; > dc->realize = bcm2836_realize; > }; > -#endif > > static const TypeInfo bcm283x_types[] = { > { > @@ -219,12 +217,10 @@ static const TypeInfo bcm283x_types[] = { > .name = TYPE_BCM2836, > .parent = TYPE_BCM283X, > .class_init = bcm2836_class_init, > -#ifdef TARGET_AARCH64 > }, { > .name = TYPE_BCM2837, > .parent = TYPE_BCM283X, > .class_init = bcm2837_class_init, > -#endif > }, { > .name = TYPE_BCM283X, > .parent = TYPE_BCM283X_BASE, > diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c > index 8a2da650087..980e4a14793 100644 > --- a/hw/arm/raspi.c > +++ b/hw/arm/raspi.c > @@ -367,7 +367,6 @@ static void raspi2b_machine_class_init(ObjectClass *oc, void *data) > raspi_machine_class_init(mc, rmc->board_rev); > }; > > -#ifdef TARGET_AARCH64 > static void raspi3ap_machine_class_init(ObjectClass *oc, void *data) > { > MachineClass *mc = MACHINE_CLASS(oc); > @@ -387,7 +386,6 @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data) > rmc->board_rev = 0xa02082; > raspi_machine_class_init(mc, rmc->board_rev); > }; > -#endif /* TARGET_AARCH64 */ > > static const TypeInfo raspi_machine_types[] = { > { > @@ -417,7 +415,6 @@ static const TypeInfo raspi_machine_types[] = { > { TYPE_TARGET_AARCH64_MACHINE }, > { }, > }, > -#ifdef TARGET_AARCH64 > }, { > .name = MACHINE_TYPE_NAME("raspi3ap"), > .parent = TYPE_RASPI_MACHINE, > @@ -434,7 +431,6 @@ static const TypeInfo raspi_machine_types[] = { > { TYPE_TARGET_AARCH64_MACHINE }, > { }, > }, > -#endif > }, { > .name = TYPE_RASPI_MACHINE, > .parent = TYPE_RASPI_BASE_MACHINE, > diff --git a/hw/arm/meson.build b/hw/arm/meson.build > index f76e7fb229f..f52034ff6a2 100644 > --- a/hw/arm/meson.build > +++ b/hw/arm/meson.build > @@ -27,8 +27,12 @@ arm_common_ss.add(when: 'CONFIG_OMAP', if_true: files('omap1.c')) > arm_common_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubieboard.c')) > arm_common_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c')) > arm_common_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c')) > -arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c')) > -arm_common_ss.add(when: ['CONFIG_RASPI', 'TARGET_AARCH64'], if_true: files('bcm2838.c', 'raspi4b.c')) > +arm_common_ss.add(when: 'CONFIG_RASPI', if_true: files( > + 'bcm2836.c', > + 'bcm2838.c', > + 'raspi.c', > + 'raspi4b.c', > +)) > arm_common_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c')) > arm_common_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c')) > arm_common_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c')) Great! Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c index 95e16806fa1..7dd81e8e0f9 100644 --- a/hw/arm/bcm2836.c +++ b/hw/arm/bcm2836.c @@ -195,7 +195,6 @@ static void bcm2836_class_init(ObjectClass *oc, void *data) dc->realize = bcm2836_realize; }; -#ifdef TARGET_AARCH64 static void bcm2837_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); @@ -208,7 +207,6 @@ static void bcm2837_class_init(ObjectClass *oc, void *data) bc->clusterid = 0x0; dc->realize = bcm2836_realize; }; -#endif static const TypeInfo bcm283x_types[] = { { @@ -219,12 +217,10 @@ static const TypeInfo bcm283x_types[] = { .name = TYPE_BCM2836, .parent = TYPE_BCM283X, .class_init = bcm2836_class_init, -#ifdef TARGET_AARCH64 }, { .name = TYPE_BCM2837, .parent = TYPE_BCM283X, .class_init = bcm2837_class_init, -#endif }, { .name = TYPE_BCM283X, .parent = TYPE_BCM283X_BASE, diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index 8a2da650087..980e4a14793 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -367,7 +367,6 @@ static void raspi2b_machine_class_init(ObjectClass *oc, void *data) raspi_machine_class_init(mc, rmc->board_rev); }; -#ifdef TARGET_AARCH64 static void raspi3ap_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc = MACHINE_CLASS(oc); @@ -387,7 +386,6 @@ static void raspi3b_machine_class_init(ObjectClass *oc, void *data) rmc->board_rev = 0xa02082; raspi_machine_class_init(mc, rmc->board_rev); }; -#endif /* TARGET_AARCH64 */ static const TypeInfo raspi_machine_types[] = { { @@ -417,7 +415,6 @@ static const TypeInfo raspi_machine_types[] = { { TYPE_TARGET_AARCH64_MACHINE }, { }, }, -#ifdef TARGET_AARCH64 }, { .name = MACHINE_TYPE_NAME("raspi3ap"), .parent = TYPE_RASPI_MACHINE, @@ -434,7 +431,6 @@ static const TypeInfo raspi_machine_types[] = { { TYPE_TARGET_AARCH64_MACHINE }, { }, }, -#endif }, { .name = TYPE_RASPI_MACHINE, .parent = TYPE_RASPI_BASE_MACHINE, diff --git a/hw/arm/meson.build b/hw/arm/meson.build index f76e7fb229f..f52034ff6a2 100644 --- a/hw/arm/meson.build +++ b/hw/arm/meson.build @@ -27,8 +27,12 @@ arm_common_ss.add(when: 'CONFIG_OMAP', if_true: files('omap1.c')) arm_common_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubieboard.c')) arm_common_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c')) arm_common_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c')) -arm_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2836.c', 'raspi.c')) -arm_common_ss.add(when: ['CONFIG_RASPI', 'TARGET_AARCH64'], if_true: files('bcm2838.c', 'raspi4b.c')) +arm_common_ss.add(when: 'CONFIG_RASPI', if_true: files( + 'bcm2836.c', + 'bcm2838.c', + 'raspi.c', + 'raspi4b.c', +)) arm_common_ss.add(when: 'CONFIG_STM32F100_SOC', if_true: files('stm32f100_soc.c')) arm_common_ss.add(when: 'CONFIG_STM32F205_SOC', if_true: files('stm32f205_soc.c')) arm_common_ss.add(when: 'CONFIG_STM32F405_SOC', if_true: files('stm32f405_soc.c'))
Now than Raspi machines can be filtered when running a qemu-system-arm or qemu-system-aarch64 binary, we can remove the TARGET_AARCH64 #ifdef'ry and compile the aspeed.c file once, moving it from arm_ss[] source set to arm_common_ss[]. Note, we expose the TYPE_BCM2837 type to qemu-system-arm, but it is not user-creatable, so not an issue. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/arm/bcm2836.c | 4 ---- hw/arm/raspi.c | 4 ---- hw/arm/meson.build | 8 ++++++-- 3 files changed, 6 insertions(+), 10 deletions(-)