[PATCH 03/22] arm: switch boards to "default y"

Paolo Bonzini posted 22 patches 1 year, 9 months ago
Maintainers: Michael Rolnik <mrolnik@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Helge Deller <deller@gmx.de>, Paolo Bonzini <pbonzini@redhat.com>, Song Gao <gaosong@loongson.cn>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Thomas Huth <thuth@redhat.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Max Filippov <jcmvbkbc@gmail.com>, Peter Maydell <peter.maydell@linaro.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Eduardo Habkost <eduardo@habkost.net>, Stafford Horne <shorne@gmail.com>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <dbarboza@ventanamicro.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Nicholas Piggin <npiggin@gmail.com>
[PATCH 03/22] arm: switch boards to "default y"
Posted by Paolo Bonzini 1 year, 9 months ago
For ARM targets, boards that require TCG are already using "default y".
Switch ARM_VIRT to the same selection mechanism.

No changes to generated config-devices.mak file.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configs/devices/arm-softmmu/default.mak | 3 ++-
 hw/arm/Kconfig                          | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
index c1cfb3bcf75..31f77c20269 100644
--- a/configs/devices/arm-softmmu/default.mak
+++ b/configs/devices/arm-softmmu/default.mak
@@ -5,7 +5,8 @@
 # CONFIG_PCI_DEVICES=n
 # CONFIG_TEST_DEVICES=n
 
-CONFIG_ARM_VIRT=y
+# Boards are selected by default, uncomment to keep out of the build.
+# CONFIG_ARM_VIRT=n
 
 # These are selected by default when TCG is enabled, uncomment them to
 # keep out of the build.
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index 893a7bff66b..1e7cd01087f 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -1,5 +1,7 @@
 config ARM_VIRT
     bool
+    default y
+    depends on ARM
     imply PCI_DEVICES
     imply TEST_DEVICES
     imply VFIO_AMD_XGBE
-- 
2.44.0
Re: [PATCH 03/22] arm: switch boards to "default y"
Posted by Fabiano Rosas 1 year, 9 months ago
Paolo Bonzini <pbonzini@redhat.com> writes:

> For ARM targets, boards that require TCG are already using "default y".
> Switch ARM_VIRT to the same selection mechanism.
>
> No changes to generated config-devices.mak file.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configs/devices/arm-softmmu/default.mak | 3 ++-
>  hw/arm/Kconfig                          | 2 ++
>  2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
> index c1cfb3bcf75..31f77c20269 100644
> --- a/configs/devices/arm-softmmu/default.mak
> +++ b/configs/devices/arm-softmmu/default.mak
> @@ -5,7 +5,8 @@
>  # CONFIG_PCI_DEVICES=n
>  # CONFIG_TEST_DEVICES=n
>  
> -CONFIG_ARM_VIRT=y
> +# Boards are selected by default, uncomment to keep out of the build.
> +# CONFIG_ARM_VIRT=n
>  
>  # These are selected by default when TCG is enabled, uncomment them to
>  # keep out of the build.
> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
> index 893a7bff66b..1e7cd01087f 100644
> --- a/hw/arm/Kconfig
> +++ b/hw/arm/Kconfig
> @@ -1,5 +1,7 @@
>  config ARM_VIRT
>      bool
> +    default y
> +    depends on ARM
>      imply PCI_DEVICES

We lose pci.c when building --without-default-devices:

$ arch
aarch64
$ ../configure --target-list=aarch64-softmmu,arm-softmmu
--disable-linux-user --without-default-devices
$ make
...
libqemu-aarch64-softmmu.fa.p/target_arm_kvm.c.o: in function `kvm_arch_fixup_msi_route':
../target/arm/kvm.c:1548: undefined reference to `pci_device_iommu_address_space'

>      imply TEST_DEVICES
>      imply VFIO_AMD_XGBE
Re: [PATCH 03/22] arm: switch boards to "default y"
Posted by Philippe Mathieu-Daudé 1 year, 9 months ago
Hi Fabiano,

On 23/4/24 20:02, Fabiano Rosas wrote:
> Paolo Bonzini <pbonzini@redhat.com> writes:
> 
>> For ARM targets, boards that require TCG are already using "default y".
>> Switch ARM_VIRT to the same selection mechanism.
>>
>> No changes to generated config-devices.mak file.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> ---
>>   configs/devices/arm-softmmu/default.mak | 3 ++-
>>   hw/arm/Kconfig                          | 2 ++
>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
>> index c1cfb3bcf75..31f77c20269 100644
>> --- a/configs/devices/arm-softmmu/default.mak
>> +++ b/configs/devices/arm-softmmu/default.mak
>> @@ -5,7 +5,8 @@
>>   # CONFIG_PCI_DEVICES=n
>>   # CONFIG_TEST_DEVICES=n
>>   
>> -CONFIG_ARM_VIRT=y
>> +# Boards are selected by default, uncomment to keep out of the build.
>> +# CONFIG_ARM_VIRT=n
>>   
>>   # These are selected by default when TCG is enabled, uncomment them to
>>   # keep out of the build.
>> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
>> index 893a7bff66b..1e7cd01087f 100644
>> --- a/hw/arm/Kconfig
>> +++ b/hw/arm/Kconfig
>> @@ -1,5 +1,7 @@
>>   config ARM_VIRT
>>       bool
>> +    default y
>> +    depends on ARM
>>       imply PCI_DEVICES
> 
> We lose pci.c when building --without-default-devices:
> 
> $ arch
> aarch64
> $ ../configure --target-list=aarch64-softmmu,arm-softmmu
> --disable-linux-user --without-default-devices
> $ make
> ...
> libqemu-aarch64-softmmu.fa.p/target_arm_kvm.c.o: in function `kvm_arch_fixup_msi_route':
> ../target/arm/kvm.c:1548: undefined reference to `pci_device_iommu_address_space'

IIRC QEMU isn't yet ready to be built with --without-default-devices
but without any machine, you need to explicit at least one. For
example you can use --with-devices-aarch64=minimal, or define a
config with only the Virt machine.

Regards,

Phil.
Re: [PATCH 03/22] arm: switch boards to "default y"
Posted by Paolo Bonzini 1 year, 9 months ago
Il mar 23 apr 2024, 20:12 Philippe Mathieu-Daudé <philmd@linaro.org> ha
scritto:

> Hi Fabiano,
>
> On 23/4/24 20:02, Fabiano Rosas wrote:
> > Paolo Bonzini <pbonzini@redhat.com> writes:
> >
> >> For ARM targets, boards that require TCG are already using "default y".
> >> Switch ARM_VIRT to the same selection mechanism.
> >>
> >> No changes to generated config-devices.mak file.
> >>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >>   configs/devices/arm-softmmu/default.mak | 3 ++-
> >>   hw/arm/Kconfig                          | 2 ++
> >>   2 files changed, 4 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/configs/devices/arm-softmmu/default.mak
> b/configs/devices/arm-softmmu/default.mak
> >> index c1cfb3bcf75..31f77c20269 100644
> >> --- a/configs/devices/arm-softmmu/default.mak
> >> +++ b/configs/devices/arm-softmmu/default.mak
> >> @@ -5,7 +5,8 @@
> >>   # CONFIG_PCI_DEVICES=n
> >>   # CONFIG_TEST_DEVICES=n
> >>
> >> -CONFIG_ARM_VIRT=y
> >> +# Boards are selected by default, uncomment to keep out of the build.
> >> +# CONFIG_ARM_VIRT=n
> >>
> >>   # These are selected by default when TCG is enabled, uncomment them to
> >>   # keep out of the build.
> >> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
> >> index 893a7bff66b..1e7cd01087f 100644
> >> --- a/hw/arm/Kconfig
> >> +++ b/hw/arm/Kconfig
> >> @@ -1,5 +1,7 @@
> >>   config ARM_VIRT
> >>       bool
> >> +    default y
> >> +    depends on ARM
> >>       imply PCI_DEVICES
> >
> > We lose pci.c when building --without-default-devices:
> >
> > $ arch
> > aarch64
> > $ ../configure --target-list=aarch64-softmmu,arm-softmmu
> > --disable-linux-user --without-default-devices
> > $ make
> > ...
> > libqemu-aarch64-softmmu.fa.p/target_arm_kvm.c.o: in function
> `kvm_arch_fixup_msi_route':
> > ../target/arm/kvm.c:1548: undefined reference to
> `pci_device_iommu_address_space'
>

I guess we can add something like

config AARCH64
    select PCI if KVM

Paolo

IIRC QEMU isn't yet ready to be built with --without-default-devices
> but without any machine, you need to explicit at least one. For
> example you can use --with-devices-aarch64=minimal, or define a
> config with only the Virt machine.


Paolo


> Regards,
>
> Phil.
>
>
Re: [PATCH 03/22] arm: switch boards to "default y"
Posted by Fabiano Rosas 1 year, 9 months ago
Paolo Bonzini <pbonzini@redhat.com> writes:

> Il mar 23 apr 2024, 20:12 Philippe Mathieu-Daudé <philmd@linaro.org> ha
> scritto:
>
>> Hi Fabiano,
>>
>> On 23/4/24 20:02, Fabiano Rosas wrote:
>> > Paolo Bonzini <pbonzini@redhat.com> writes:
>> >
>> >> For ARM targets, boards that require TCG are already using "default y".
>> >> Switch ARM_VIRT to the same selection mechanism.
>> >>
>> >> No changes to generated config-devices.mak file.
>> >>
>> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> >> ---
>> >>   configs/devices/arm-softmmu/default.mak | 3 ++-
>> >>   hw/arm/Kconfig                          | 2 ++
>> >>   2 files changed, 4 insertions(+), 1 deletion(-)
>> >>
>> >> diff --git a/configs/devices/arm-softmmu/default.mak
>> b/configs/devices/arm-softmmu/default.mak
>> >> index c1cfb3bcf75..31f77c20269 100644
>> >> --- a/configs/devices/arm-softmmu/default.mak
>> >> +++ b/configs/devices/arm-softmmu/default.mak
>> >> @@ -5,7 +5,8 @@
>> >>   # CONFIG_PCI_DEVICES=n
>> >>   # CONFIG_TEST_DEVICES=n
>> >>
>> >> -CONFIG_ARM_VIRT=y
>> >> +# Boards are selected by default, uncomment to keep out of the build.
>> >> +# CONFIG_ARM_VIRT=n
>> >>
>> >>   # These are selected by default when TCG is enabled, uncomment them to
>> >>   # keep out of the build.
>> >> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
>> >> index 893a7bff66b..1e7cd01087f 100644
>> >> --- a/hw/arm/Kconfig
>> >> +++ b/hw/arm/Kconfig
>> >> @@ -1,5 +1,7 @@
>> >>   config ARM_VIRT
>> >>       bool
>> >> +    default y
>> >> +    depends on ARM
>> >>       imply PCI_DEVICES
>> >
>> > We lose pci.c when building --without-default-devices:
>> >
>> > $ arch
>> > aarch64
>> > $ ../configure --target-list=aarch64-softmmu,arm-softmmu
>> > --disable-linux-user --without-default-devices
>> > $ make
>> > ...
>> > libqemu-aarch64-softmmu.fa.p/target_arm_kvm.c.o: in function
>> `kvm_arch_fixup_msi_route':
>> > ../target/arm/kvm.c:1548: undefined reference to
>> `pci_device_iommu_address_space'
>>
>
> I guess we can add something like
>
> config AARCH64
>     select PCI if KVM

Yep, that fixes the build. With defaults disabled the tests are all
kinds of broken, but I guess that's expected. I see issues even in
master.

With the above included:

Tested-by: Fabiano Rosas <farosas@suse.de> # build-only on aarch64
Re: [PATCH 03/22] arm: switch boards to "default y"
Posted by Fabiano Rosas 1 year, 9 months ago
Philippe Mathieu-Daudé <philmd@linaro.org> writes:

> Hi Fabiano,
>
> On 23/4/24 20:02, Fabiano Rosas wrote:
>> Paolo Bonzini <pbonzini@redhat.com> writes:
>> 
>>> For ARM targets, boards that require TCG are already using "default y".
>>> Switch ARM_VIRT to the same selection mechanism.
>>>
>>> No changes to generated config-devices.mak file.
>>>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>>> ---
>>>   configs/devices/arm-softmmu/default.mak | 3 ++-
>>>   hw/arm/Kconfig                          | 2 ++
>>>   2 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
>>> index c1cfb3bcf75..31f77c20269 100644
>>> --- a/configs/devices/arm-softmmu/default.mak
>>> +++ b/configs/devices/arm-softmmu/default.mak
>>> @@ -5,7 +5,8 @@
>>>   # CONFIG_PCI_DEVICES=n
>>>   # CONFIG_TEST_DEVICES=n
>>>   
>>> -CONFIG_ARM_VIRT=y
>>> +# Boards are selected by default, uncomment to keep out of the build.
>>> +# CONFIG_ARM_VIRT=n
>>>   
>>>   # These are selected by default when TCG is enabled, uncomment them to
>>>   # keep out of the build.
>>> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
>>> index 893a7bff66b..1e7cd01087f 100644
>>> --- a/hw/arm/Kconfig
>>> +++ b/hw/arm/Kconfig
>>> @@ -1,5 +1,7 @@
>>>   config ARM_VIRT
>>>       bool
>>> +    default y
>>> +    depends on ARM
>>>       imply PCI_DEVICES
>> 
>> We lose pci.c when building --without-default-devices:
>> 
>> $ arch
>> aarch64
>> $ ../configure --target-list=aarch64-softmmu,arm-softmmu
>> --disable-linux-user --without-default-devices
>> $ make
>> ...
>> libqemu-aarch64-softmmu.fa.p/target_arm_kvm.c.o: in function `kvm_arch_fixup_msi_route':
>> ../target/arm/kvm.c:1548: undefined reference to `pci_device_iommu_address_space'
>
> IIRC QEMU isn't yet ready to be built with --without-default-devices
> but without any machine, you need to explicit at least one. For
> example you can use --with-devices-aarch64=minimal, or define a
> config with only the Virt machine.

Could we detect this kind of breakage somehow and report it properly to
the user? As in "you chose an impossible configuration, select a board
and try again".

I see this comes from kvm.c, perhaps on arm CONFIG_KVM needs to depend
on VIRT?

>
> Regards,
>
> Phil.