rust: Kconfig: Factor out whether PL011 is Rust or C

Currently every board that uses the PL011 duplicates the logic that
selects the Rust implementation if Rust was enabled and the C
implementation if it does not.  Factor this out into a separate
Kconfig stanza, so that boards can go back to simply doing "select
PL011" and get whichever implementation is correct for the build.

This fixes a compilation failure if CONFIG_VMAPPLE is enabled
in a Rust build, because hw/vmapple/Kconfig didn't have the
"pick the Rust PL011 if Rust is enabled" logic in it.

Fixes: 59f4d65584bd33 ("hw/vmapple/vmapple: Add vmapple machine type")
Reported-by: Tanish Desai <tanishdesai37@gmail.com>
Analyzed-by: Tanish Desai <tanishdesai37@gmail.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Link: https://lore.kernel.org/r/20250319193110.1565578-2-peter.maydell@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Peter Maydell 2025-03-19 19:31:09 +00:00 committed by Paolo Bonzini
parent 1dae461a91
commit f88c9cd804
3 changed files with 17 additions and 21 deletions

View File

@ -21,8 +21,7 @@ config ARM_VIRT
select PCI_EXPRESS select PCI_EXPRESS
select PCI_EXPRESS_GENERIC_BRIDGE select PCI_EXPRESS_GENERIC_BRIDGE
select PFLASH_CFI01 select PFLASH_CFI01
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL031 # RTC select PL031 # RTC
select PL061 # GPIO select PL061 # GPIO
select GPIO_PWR select GPIO_PWR
@ -75,8 +74,7 @@ config HIGHBANK
select AHCI_SYSBUS select AHCI_SYSBUS
select ARM_TIMER # sp804 select ARM_TIMER # sp804
select ARM_V7M select ARM_V7M
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL022 # SPI select PL022 # SPI
select PL031 # RTC select PL031 # RTC
select PL061 # GPIO select PL061 # GPIO
@ -89,8 +87,7 @@ config INTEGRATOR
depends on TCG && ARM depends on TCG && ARM
select ARM_TIMER select ARM_TIMER
select INTEGRATOR_DEBUG select INTEGRATOR_DEBUG
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL031 # RTC select PL031 # RTC
select PL041 # audio select PL041 # audio
select PL050 # keyboard/mouse select PL050 # keyboard/mouse
@ -108,8 +105,7 @@ config MUSCA
default y default y
depends on TCG && ARM depends on TCG && ARM
select ARMSSE select ARMSSE
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL031 select PL031
select SPLIT_IRQ select SPLIT_IRQ
select UNIMP select UNIMP
@ -173,8 +169,7 @@ config REALVIEW
select WM8750 # audio codec select WM8750 # audio codec
select LSI_SCSI_PCI select LSI_SCSI_PCI
select PCI select PCI
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL031 # RTC select PL031 # RTC
select PL041 # audio codec select PL041 # audio codec
select PL050 # keyboard/mouse select PL050 # keyboard/mouse
@ -199,8 +194,7 @@ config SBSA_REF
select PCI_EXPRESS select PCI_EXPRESS
select PCI_EXPRESS_GENERIC_BRIDGE select PCI_EXPRESS_GENERIC_BRIDGE
select PFLASH_CFI01 select PFLASH_CFI01
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL031 # RTC select PL031 # RTC
select PL061 # GPIO select PL061 # GPIO
select USB_XHCI_SYSBUS select USB_XHCI_SYSBUS
@ -224,8 +218,7 @@ config STELLARIS
select ARM_V7M select ARM_V7M
select CMSDK_APB_WATCHDOG select CMSDK_APB_WATCHDOG
select I2C select I2C
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL022 # SPI select PL022 # SPI
select PL061 # GPIO select PL061 # GPIO
select SSD0303 # OLED display select SSD0303 # OLED display
@ -285,8 +278,7 @@ config VEXPRESS
select ARM_TIMER # sp804 select ARM_TIMER # sp804
select LAN9118 select LAN9118
select PFLASH_CFI01 select PFLASH_CFI01
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select PL041 # audio codec select PL041 # audio codec
select PL181 # display select PL181 # display
select REALVIEW select REALVIEW
@ -371,8 +363,7 @@ config RASPI
default y default y
depends on TCG && ARM depends on TCG && ARM
select FRAMEBUFFER select FRAMEBUFFER
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select SDHCI select SDHCI
select USB_DWC2 select USB_DWC2
select BCM2835_SPI select BCM2835_SPI
@ -448,8 +439,7 @@ config XLNX_VERSAL
select ARM_GIC select ARM_GIC
select CPU_CLUSTER select CPU_CLUSTER
select DEVICE_TREE select DEVICE_TREE
select PL011 if !HAVE_RUST # UART select PL011 # UART
select X_PL011_RUST if HAVE_RUST # UART
select CADENCE select CADENCE
select VIRTIO_MMIO select VIRTIO_MMIO
select UNIMP select UNIMP

View File

@ -11,6 +11,12 @@ config PARALLEL
config PL011 config PL011
bool bool
# The PL011 has both a Rust and a C implementation
select PL011_C if !HAVE_RUST
select X_PL011_RUST if HAVE_RUST
config PL011_C
bool
config SERIAL config SERIAL
bool bool

View File

@ -9,7 +9,7 @@ system_ss.add(when: 'CONFIG_ISA_BUS', if_true: files('parallel-isa.c'))
system_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugcon.c')) system_ss.add(when: 'CONFIG_ISA_DEBUG', if_true: files('debugcon.c'))
system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_uart.c')) system_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_uart.c'))
system_ss.add(when: 'CONFIG_PARALLEL', if_true: files('parallel.c')) system_ss.add(when: 'CONFIG_PARALLEL', if_true: files('parallel.c'))
system_ss.add(when: 'CONFIG_PL011', if_true: files('pl011.c')) system_ss.add(when: 'CONFIG_PL011_C', if_true: files('pl011.c'))
system_ss.add(when: 'CONFIG_SCLPCONSOLE', if_true: files('sclpconsole.c', 'sclpconsole-lm.c')) system_ss.add(when: 'CONFIG_SCLPCONSOLE', if_true: files('sclpconsole.c', 'sclpconsole-lm.c'))
system_ss.add(when: 'CONFIG_SERIAL', if_true: files('serial.c')) system_ss.add(when: 'CONFIG_SERIAL', if_true: files('serial.c'))
system_ss.add(when: 'CONFIG_SERIAL_ISA', if_true: files('serial-isa.c')) system_ss.add(when: 'CONFIG_SERIAL_ISA', if_true: files('serial-isa.c'))