Thomas Huth <thuth@redhat.com> writes:
> On 02/05/2023 14.14, Peter Maydell wrote:
>> From: Fabiano Rosas <farosas@suse.de>
>>
>> Move all the CONFIG_FOO=y from default.mak into "default y if TCG"
>> statements in Kconfig. That way they won't be selected when
>> CONFIG_TCG=n.
>>
>> I'm leaving CONFIG_ARM_VIRT in default.mak because it allows us to
>> keep the two default.mak files not empty and keep aarch64-default.mak
>> including arm-default.mak. That way we don't surprise anyone that's
>> used to altering these files.
>>
>> With this change we can start building with --disable-tcg.
>>
>> Signed-off-by: Fabiano Rosas <farosas@suse.de>
>> Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
>> Message-id: 20230426180013.14814-12-farosas@suse.de
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> ---
>> configs/devices/aarch64-softmmu/default.mak | 4 --
>> configs/devices/arm-softmmu/default.mak | 37 ------------------
>> hw/arm/Kconfig | 42 ++++++++++++++++++++-
>> 3 files changed, 41 insertions(+), 42 deletions(-)
>>
>> diff --git a/configs/devices/aarch64-softmmu/default.mak b/configs/devices/aarch64-softmmu/default.mak
>> index cf43ac8da11..70e05a197dc 100644
>> --- a/configs/devices/aarch64-softmmu/default.mak
>> +++ b/configs/devices/aarch64-softmmu/default.mak
>> @@ -2,7 +2,3 @@
>>
>> # We support all the 32 bit boards so need all their config
>> include ../arm-softmmu/default.mak
>> -
>> -CONFIG_XLNX_ZYNQMP_ARM=y
>> -CONFIG_XLNX_VERSAL=y
>> -CONFIG_SBSA_REF=y
>> diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
>> index cb3e5aea657..647fbce88d3 100644
>> --- a/configs/devices/arm-softmmu/default.mak
>> +++ b/configs/devices/arm-softmmu/default.mak
>> @@ -4,40 +4,3 @@
>> # CONFIG_TEST_DEVICES=n
>>
>> CONFIG_ARM_VIRT=y
>> -CONFIG_CUBIEBOARD=y
>> -CONFIG_EXYNOS4=y
>> -CONFIG_HIGHBANK=y
>> -CONFIG_INTEGRATOR=y
>> -CONFIG_FSL_IMX31=y
>> -CONFIG_MUSICPAL=y
>> -CONFIG_MUSCA=y
>> -CONFIG_CHEETAH=y
>> -CONFIG_SX1=y
>> -CONFIG_NSERIES=y
>> -CONFIG_STELLARIS=y
>> -CONFIG_STM32VLDISCOVERY=y
>> -CONFIG_REALVIEW=y
>> -CONFIG_VERSATILE=y
>> -CONFIG_VEXPRESS=y
>> -CONFIG_ZYNQ=y
>> -CONFIG_MAINSTONE=y
>> -CONFIG_GUMSTIX=y
>> -CONFIG_SPITZ=y
>> -CONFIG_TOSA=y
>> -CONFIG_Z2=y
>> -CONFIG_NPCM7XX=y
>> -CONFIG_COLLIE=y
>> -CONFIG_ASPEED_SOC=y
>> -CONFIG_NETDUINO2=y
>> -CONFIG_NETDUINOPLUS2=y
>> -CONFIG_OLIMEX_STM32_H405=y
>> -CONFIG_MPS2=y
>> -CONFIG_RASPI=y
>> -CONFIG_DIGIC=y
>> -CONFIG_SABRELITE=y
>> -CONFIG_EMCRAFT_SF2=y
>> -CONFIG_MICROBIT=y
>> -CONFIG_FSL_IMX25=y
>> -CONFIG_FSL_IMX7=y
>> -CONFIG_FSL_IMX6UL=y
>> -CONFIG_ALLWINNER_H3=y
>> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
>> index 87c1a29c912..2d7c4579559 100644
>> --- a/hw/arm/Kconfig
>> +++ b/hw/arm/Kconfig
>> @@ -35,20 +35,24 @@ config ARM_VIRT
>>
>> config CHEETAH
>> bool
>> + default y if TCG && ARM
>> select OMAP
>> select TSC210X
>>
>> config CUBIEBOARD
>> bool
>> + default y if TCG && ARM
>> select ALLWINNER_A10
> ...
>
> Hi!
>
> Sorry for not noticing this earlier, but I have to say that I really dislike
> this change, since it very much changes the way we did our machine
> configuration so far.
> Until now, you could simply go to configs/devices/*-softmmu/*.mak and only
> select the machines you wanted to have with "...=y" and delete everything
> else. Now you have to know *all* the machines that you do *not* want to have
> in your build and disable them with "...=n" in that file. That's quite ugly,
> especially for the arm target that has so many machines. (ok, you could also
> do a "--without-default-devices" configuration to get rid of the machines,
> but that also disables all other kind of devices that you then have to
> specify manually).
>
Would leaving the CONFIGs as 'n', but commented out in the .mak files be
of any help? If I understand your use case, you were probably just
deleting the CONFIG=y for the boards you don't want. So now you'd be
uncommenting the CONFIG=n instead.
Yes, that would help—though it is likely to bitrot. I would also change the "if TCG" part to "depends on TCG && ARM", which will break loudly if someone sets the config to y with the wrong accelerator or in the wrong file.
Once this is done for ARM we can extend it to other .mak files for consistency.
Paolo
Alternatively, we could revert the .mak part of this change, convert
default.mak into tcg.mak and kvm.mak, and use those transparently
depending on whether --disable-tcg is present in the configure line.
But there's probably a better way still that I'm not seeing here, let's
see what others think.