diff mbox series

[PULL,23/27] i386: enable rust hpet for pc when rust is enabled

Message ID 20250213160054.3937012-24-pbonzini@redhat.com (mailing list archive)
State New
Headers show
Series [PULL,01/27] rust: docs: document naming convention | expand

Commit Message

Paolo Bonzini Feb. 13, 2025, 4 p.m. UTC
From: Zhao Liu <zhao1.liu@intel.com>

Add HPET configuration in PC's Kconfig options, and select HPET device
(Rust version) if Rust is supported.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Link: https://lore.kernel.org/r/20250210030051.2562726-11-zhao1.liu@intel.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configs/devices/i386-softmmu/default.mak | 1 +
 hw/i386/pc.c                             | 2 +-
 hw/timer/Kconfig                         | 2 +-
 rust/hw/Kconfig                          | 1 +
 rust/hw/timer/Kconfig                    | 2 ++
 tests/qtest/meson.build                  | 3 ++-
 6 files changed, 8 insertions(+), 3 deletions(-)
 create mode 100644 rust/hw/timer/Kconfig

Comments

Zhao Liu Feb. 17, 2025, 11:03 a.m. UTC | #1
Hi Paolo,

> --- a/hw/timer/Kconfig
> +++ b/hw/timer/Kconfig
> @@ -11,7 +11,7 @@ config A9_GTIMER
>  
>  config HPET
>      bool
> -    default y if PC
> +    default y if PC && !HAVE_RUST

+
+config X_HPET_RUST
+    bool
+    default y if PC && HAVE_RUST

>  config I8254
>      bool

This patch doesn't enable the configuration option of Rust HPET for PC.

Is it because the Rust HPET would break live migration, so we have to
disable it?

Thanks,
Zhao
Paolo Bonzini Feb. 17, 2025, 1:15 p.m. UTC | #2
On 2/17/25 12:03, Zhao Liu wrote:
> Hi Paolo,
> 
>> --- a/hw/timer/Kconfig
>> +++ b/hw/timer/Kconfig
>> @@ -11,7 +11,7 @@ config A9_GTIMER
>>   
>>   config HPET
>>       bool
>> -    default y if PC
>> +    default y if PC && !HAVE_RUST
> 
> +
> +config X_HPET_RUST
> +    bool
> +    default y if PC && HAVE_RUST
> 
>>   config I8254
>>       bool
> 
> This patch doesn't enable the configuration option of Rust HPET for PC.
> 
> Is it because the Rust HPET would break live migration, so we have to
> disable it?

No, something like this is missing:

diff --git a/rust/hw/timer/Kconfig b/rust/hw/timer/Kconfig
index afd98033503..42e421317a5 100644
--- a/rust/hw/timer/Kconfig
+++ b/rust/hw/timer/Kconfig
@@ -1,2 +1,3 @@
  config X_HPET_RUST
      bool
+    default y if PC && HAVE_RUST

I haven't checked if this passes CI yet.

Paolo
diff mbox series

Patch

diff --git a/configs/devices/i386-softmmu/default.mak b/configs/devices/i386-softmmu/default.mak
index 4faf2f0315e..9ef343cace0 100644
--- a/configs/devices/i386-softmmu/default.mak
+++ b/configs/devices/i386-softmmu/default.mak
@@ -6,6 +6,7 @@ 
 #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
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0eb52d315bb..22641e6ddca 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1701,7 +1701,7 @@  static void pc_machine_initfn(Object *obj)
     pcms->sata_enabled = true;
     pcms->i8042_enabled = true;
     pcms->max_fw_size = 8 * MiB;
-#ifdef CONFIG_HPET
+#if defined(CONFIG_HPET) || defined(CONFIG_X_HPET_RUST)
     pcms->hpet_enabled = true;
 #endif
     pcms->fd_bootchk = true;
diff --git a/hw/timer/Kconfig b/hw/timer/Kconfig
index c96fd5d97ae..9ac00845340 100644
--- a/hw/timer/Kconfig
+++ b/hw/timer/Kconfig
@@ -11,7 +11,7 @@  config A9_GTIMER
 
 config HPET
     bool
-    default y if PC
+    default y if PC && !HAVE_RUST
 
 config I8254
     bool
diff --git a/rust/hw/Kconfig b/rust/hw/Kconfig
index 4d934f30afe..36f92ec0287 100644
--- a/rust/hw/Kconfig
+++ b/rust/hw/Kconfig
@@ -1,2 +1,3 @@ 
 # devices Kconfig
 source char/Kconfig
+source timer/Kconfig
diff --git a/rust/hw/timer/Kconfig b/rust/hw/timer/Kconfig
new file mode 100644
index 00000000000..afd98033503
--- /dev/null
+++ b/rust/hw/timer/Kconfig
@@ -0,0 +1,2 @@ 
+config X_HPET_RUST
+    bool
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 68316dbdc1a..8a6243382a1 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -103,7 +103,8 @@  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') 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_PARALLEL') ? ['bios-tables-test'] : []) +             \
   qtests_pci +                                                                              \
   qtests_cxl +                                                                              \