]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
rust: Kconfig: Factor out whether HPET is Rust or C
authorPeter Maydell <peter.maydell@linaro.org>
Wed, 19 Mar 2025 19:31:10 +0000 (19:31 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 20 Mar 2025 08:23:24 +0000 (09:23 +0100)
Currently we require everywhere that wants to know if there
is an HPET device to check for "CONFIG_HPET || CONFIG_X_HPET_RUST".
Factor out whether the HPET device is Rust or C into a separate
Kconfig stanza, so that CONFIG_HPET means "there is an HPET",
and whether this has pulled in CONFIG_X_HPET_RUST or CONFIG_HPET_C
is something the rest of QEMU can ignore.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Link: https://lore.kernel.org/r/20250319193110.1565578-3-peter.maydell@linaro.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
configs/devices/i386-softmmu/default.mak
hw/i386/fw_cfg.c
hw/i386/pc.c
hw/timer/Kconfig
hw/timer/meson.build
rust/hw/timer/Kconfig
tests/qtest/meson.build

index 9ef343cace06c934230e9c696719aaddc542744f..4faf2f0315e25214029d2602cb393e862317f360 100644 (file)
@@ -6,7 +6,6 @@
 #CONFIG_APPLESMC=n
 #CONFIG_FDC=n
 #CONFIG_HPET=n
-#CONFIG_X_HPET_RUST=n
 #CONFIG_HYPERV=n
 #CONFIG_ISA_DEBUG=n
 #CONFIG_ISA_IPMI_BT=n
index a7f1b60b98c0e595996e0449a7cb13424768a691..5c0bcd5f8a9f88543b0188a7adc177dc794e19dc 100644 (file)
@@ -26,7 +26,7 @@
 #include CONFIG_DEVICES
 #include "target/i386/cpu.h"
 
-#if !defined(CONFIG_HPET) && !defined(CONFIG_X_HPET_RUST)
+#if !defined(CONFIG_HPET)
 struct hpet_fw_config hpet_fw_cfg = {.count = UINT8_MAX};
 #endif
 
index 63a96cd23f8410daf509a24f30781c74307155f7..01d0581f62a32c592ae38f55ffc7dcaa12b82dfd 100644 (file)
@@ -1704,7 +1704,7 @@ static void pc_machine_initfn(Object *obj)
     pcms->sata_enabled = true;
     pcms->i8042_enabled = true;
     pcms->max_fw_size = 8 * MiB;
-#if defined(CONFIG_HPET) || defined(CONFIG_X_HPET_RUST)
+#if defined(CONFIG_HPET)
     pcms->hpet_enabled = true;
 #endif
     pcms->fd_bootchk = true;
index 9ac0084534084ebd29db59d6439248d96335010d..b3d823ce2c394c0b3a2b23d9731b723cf2ed159a 100644 (file)
@@ -11,7 +11,13 @@ config A9_GTIMER
 
 config HPET
     bool
-    default y if PC && !HAVE_RUST
+    default y if PC
+    # The HPET has both a Rust and a C implementation
+    select HPET_C if !HAVE_RUST
+    select X_HPET_RUST if HAVE_RUST
+
+config HPET_C
+    bool
 
 config I8254
     bool
index f5f9eed2d0a9f060633cece4495ed6bd9ec23917..178321c029c8deaa2575494b3a6b55bb66271da9 100644 (file)
@@ -13,7 +13,7 @@ system_ss.add(when: 'CONFIG_DIGIC', if_true: files('digic-timer.c'))
 system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_mct.c'))
 system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210_pwm.c'))
 system_ss.add(when: 'CONFIG_GRLIB', if_true: files('grlib_gptimer.c'))
-system_ss.add(when: 'CONFIG_HPET', if_true: files('hpet.c'))
+system_ss.add(when: 'CONFIG_HPET_C', if_true: files('hpet.c'))
 system_ss.add(when: 'CONFIG_I8254', if_true: files('i8254_common.c', 'i8254.c'))
 system_ss.add(when: 'CONFIG_IMX', if_true: files('imx_epit.c'))
 system_ss.add(when: 'CONFIG_IMX', if_true: files('imx_gpt.c'))
index 42e421317a59fdd0b9ab01abd84a375b9794f85f..afd980335037b4c1d9e4201b0c70ac440601b108 100644 (file)
@@ -1,3 +1,2 @@
 config X_HPET_RUST
     bool
-    default y if PC && HAVE_RUST
index 5a8c1f102c2b3e4af14bde0b0c5545a1a791cfae..3136d15e0f813efcc21014732df60244768b0d6f 100644 (file)
@@ -103,8 +103,7 @@ qtests_i386 = \
    config_all_devices.has_key('CONFIG_VIRTIO_PCI') and                                      \
    slirp.found() ? ['virtio-net-failover'] : []) +                                          \
   (unpack_edk2_blobs and                                                                    \
-   (config_all_devices.has_key('CONFIG_HPET') or                                            \
-    config_all_devices.has_key('CONFIG_X_HPET_RUST')) and                                   \
+   config_all_devices.has_key('CONFIG_HPET') and                                            \
    config_all_devices.has_key('CONFIG_PARALLEL') ? ['bios-tables-test'] : []) +             \
   qtests_pci +                                                                              \
   qtests_cxl +                                                                              \