diff mbox series

[2/2] hw: Add a Kconfig switch for the TYPE_CPU_CLUSTER device

Message ID 20240412062042.105174-3-thuth@redhat.com
State New
Headers show
Series Improvements for switches in hw/cpu/Kconfig | expand

Commit Message

Thomas Huth April 12, 2024, 6:20 a.m. UTC
The cpu-cluster device is only needed for some few arm and riscv
machines. Let's avoid compiling and linking it if it is not really
necessary.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/arm/Kconfig     | 3 +++
 hw/cpu/Kconfig     | 3 +++
 hw/cpu/meson.build | 2 +-
 hw/riscv/Kconfig   | 2 ++
 4 files changed, 9 insertions(+), 1 deletion(-)

Comments

Thomas Huth April 12, 2024, 9:15 a.m. UTC | #1
On 12/04/2024 08.20, Thomas Huth wrote:
> The cpu-cluster device is only needed for some few arm and riscv
> machines. Let's avoid compiling and linking it if it is not really
> necessary.
> 
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/arm/Kconfig     | 3 +++
>   hw/cpu/Kconfig     | 3 +++
>   hw/cpu/meson.build | 2 +-
>   hw/riscv/Kconfig   | 2 ++
>   4 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
> index d97015c45c..5d4015b75a 100644
> --- a/hw/arm/Kconfig
> +++ b/hw/arm/Kconfig
> @@ -485,6 +485,7 @@ config XLNX_ZYNQMP_ARM
>       select AHCI
>       select ARM_GIC
>       select CADENCE
> +    select CPU_CLUSTER
>       select DDC
>       select DPCD
>       select SDHCI
> @@ -503,6 +504,7 @@ config XLNX_VERSAL
>       default y
>       depends on TCG && AARCH64
>       select ARM_GIC
> +    select CPU_CLUSTER
>       select PL011
>       select CADENCE
>       select VIRTIO_MMIO
> @@ -688,6 +690,7 @@ config ARMSSE
>       select CMSDK_APB_DUALTIMER
>       select CMSDK_APB_UART
>       select CMSDK_APB_WATCHDOG
> +    select CPU_CLUSTER
>       select IOTKIT_SECCTL
>       select IOTKIT_SYSCTL
>       select IOTKIT_SYSINFO
> diff --git a/hw/cpu/Kconfig b/hw/cpu/Kconfig
> index f776e884cd..baff478e1b 100644
> --- a/hw/cpu/Kconfig
> +++ b/hw/cpu/Kconfig
> @@ -12,3 +12,6 @@ config A15MPCORE
>   config ARM11MPCORE
>       bool
>       select ARM11SCU
> +
> +config CPU_CLUSTER
> +    bool
> diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build
> index 38cdcfbe57..43a34c4c6e 100644
> --- a/hw/cpu/meson.build
> +++ b/hw/cpu/meson.build
> @@ -1,4 +1,4 @@
> -system_ss.add(files('core.c', 'cluster.c'))
> +system_ss.add(when: 'CONFIG_CPU_CLUSTER', if_true: files('core.c', 'cluster.c'))

Oops, sorry, the switch should only be used for cluster.c, not for core.c. 
I'll change it in v2 ...

  Thomas
Philippe Mathieu-Daudé April 13, 2024, 9:50 a.m. UTC | #2
On 12/4/24 11:15, Thomas Huth wrote:
> On 12/04/2024 08.20, Thomas Huth wrote:
>> The cpu-cluster device is only needed for some few arm and riscv
>> machines. Let's avoid compiling and linking it if it is not really
>> necessary.

I expect clustering become the new default for heterogeneous machines,
but we are not there yet.

>> Signed-off-by: Thomas Huth <thuth@redhat.com>
>> ---
>>   hw/arm/Kconfig     | 3 +++
>>   hw/cpu/Kconfig     | 3 +++
>>   hw/cpu/meson.build | 2 +-
>>   hw/riscv/Kconfig   | 2 ++
>>   4 files changed, 9 insertions(+), 1 deletion(-)

>> diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build
>> index 38cdcfbe57..43a34c4c6e 100644
>> --- a/hw/cpu/meson.build
>> +++ b/hw/cpu/meson.build
>> @@ -1,4 +1,4 @@
>> -system_ss.add(files('core.c', 'cluster.c'))
>> +system_ss.add(when: 'CONFIG_CPU_CLUSTER', if_true: files('core.c', 
>> 'cluster.c'))
> 
> Oops, sorry, the switch should only be used for cluster.c, not for 
> core.c. I'll change it in v2 ...

For v2:
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
diff mbox series

Patch

diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
index d97015c45c..5d4015b75a 100644
--- a/hw/arm/Kconfig
+++ b/hw/arm/Kconfig
@@ -485,6 +485,7 @@  config XLNX_ZYNQMP_ARM
     select AHCI
     select ARM_GIC
     select CADENCE
+    select CPU_CLUSTER
     select DDC
     select DPCD
     select SDHCI
@@ -503,6 +504,7 @@  config XLNX_VERSAL
     default y
     depends on TCG && AARCH64
     select ARM_GIC
+    select CPU_CLUSTER
     select PL011
     select CADENCE
     select VIRTIO_MMIO
@@ -688,6 +690,7 @@  config ARMSSE
     select CMSDK_APB_DUALTIMER
     select CMSDK_APB_UART
     select CMSDK_APB_WATCHDOG
+    select CPU_CLUSTER
     select IOTKIT_SECCTL
     select IOTKIT_SYSCTL
     select IOTKIT_SYSINFO
diff --git a/hw/cpu/Kconfig b/hw/cpu/Kconfig
index f776e884cd..baff478e1b 100644
--- a/hw/cpu/Kconfig
+++ b/hw/cpu/Kconfig
@@ -12,3 +12,6 @@  config A15MPCORE
 config ARM11MPCORE
     bool
     select ARM11SCU
+
+config CPU_CLUSTER
+    bool
diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build
index 38cdcfbe57..43a34c4c6e 100644
--- a/hw/cpu/meson.build
+++ b/hw/cpu/meson.build
@@ -1,4 +1,4 @@ 
-system_ss.add(files('core.c', 'cluster.c'))
+system_ss.add(when: 'CONFIG_CPU_CLUSTER', if_true: files('core.c', 'cluster.c'))
 
 system_ss.add(when: 'CONFIG_ARM11MPCORE', if_true: files('arm11mpcore.c'))
 system_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview_mpcore.c'))
diff --git a/hw/riscv/Kconfig b/hw/riscv/Kconfig
index 5d644eb7b1..fc72ef0379 100644
--- a/hw/riscv/Kconfig
+++ b/hw/riscv/Kconfig
@@ -9,6 +9,7 @@  config IBEX
 config MICROCHIP_PFSOC
     bool
     select CADENCE_SDHCI
+    select CPU_CLUSTER
     select MCHP_PFSOC_DMC
     select MCHP_PFSOC_IOSCB
     select MCHP_PFSOC_MMUART
@@ -68,6 +69,7 @@  config SIFIVE_E
 config SIFIVE_U
     bool
     select CADENCE
+    select CPU_CLUSTER
     select RISCV_ACLINT
     select SIFIVE_GPIO
     select SIFIVE_PDMA