From: Zhao Liu <zhao1.liu@intel.com>
To: "Paolo Bonzini" <pbonzini@redhat.com>,
"Manos Pitsidianakis" <manos.pitsidianakis@linaro.org>,
"Junjie Mao" <junjie.mao@hotmail.com>,
"Alex Bennée" <alex.bennee@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Daniel P . Berrangé" <berrange@redhat.com>
Cc: qemu-devel@nongnu.org, qemu-rust@nongnu.org,
Zhao Liu <zhao1.liu@intel.com>
Subject: [PATCH v2 10/10] i386: enable rust hpet for pc when rust is enabled
Date: Mon, 10 Feb 2025 11:00:51 +0800 [thread overview]
Message-ID: <20250210030051.2562726-11-zhao1.liu@intel.com> (raw)
In-Reply-To: <20250210030051.2562726-1-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>
---
Changes since RFC:
* Fix rust hpet not being optional.
* Fix bios-tables-test missing rust hpet.
---
configs/devices/i386-softmmu/default.mak | 1 +
hw/i386/fw_cfg.c | 2 +-
hw/i386/pc.c | 2 +-
hw/timer/Kconfig | 6 +++++-
rust/hw/Kconfig | 1 +
rust/hw/timer/Kconfig | 2 ++
tests/qtest/meson.build | 3 ++-
7 files changed, 13 insertions(+), 4 deletions(-)
create mode 100644 rust/hw/timer/Kconfig
diff --git a/configs/devices/i386-softmmu/default.mak b/configs/devices/i386-softmmu/default.mak
index 4faf2f0315e2..9ef343cace06 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/fw_cfg.c b/hw/i386/fw_cfg.c
index 546de63123e6..a7d69a49edbf 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -147,7 +147,7 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,
#endif
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1);
-#ifdef CONFIG_HPET
+#if defined(CONFIG_HPET) || defined(CONFIG_X_HPET_RUST)
PCMachineState *pcms =
(PCMachineState *)object_dynamic_cast(OBJECT(ms), TYPE_PC_MACHINE);
if (pcms && pcms->hpet_enabled) {
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index b46975c8a4db..04554817e021 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 c96fd5d97ae8..c051597180f4 100644
--- a/hw/timer/Kconfig
+++ b/hw/timer/Kconfig
@@ -11,7 +11,11 @@ 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
diff --git a/rust/hw/Kconfig b/rust/hw/Kconfig
index 4d934f30afe1..36f92ec02874 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 000000000000..afd980335037
--- /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 5e062c752a7e..34c59107cf4f 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 + \
--
2.34.1
prev parent reply other threads:[~2025-02-10 2:42 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-10 3:00 [PATCH v2 00/10] rust: Add HPET timer device Zhao Liu
2025-02-10 3:00 ` [PATCH v2 01/10] i386/fw_cfg: move hpet_cfg definition to hpet.c Zhao Liu
2025-02-13 11:25 ` Paolo Bonzini
2025-02-16 11:47 ` Zhao Liu
2025-02-10 3:00 ` [PATCH v2 02/10] rust/qdev: add the macro to define bit property Zhao Liu
2025-02-10 3:00 ` [PATCH v2 03/10] rust/irq: Add a helper to convert [InterruptSource] to pointer Zhao Liu
2025-02-10 3:00 ` [PATCH v2 04/10] rust: add bindings for gpio_{in|out} initialization Zhao Liu
2025-02-10 3:00 ` [PATCH v2 05/10] rust: add bindings for memattrs Zhao Liu
2025-02-10 10:03 ` Zhao Liu
2025-02-10 3:00 ` [PATCH v2 06/10] rust: add bindings for timer Zhao Liu
2025-02-10 3:00 ` [PATCH v2 07/10] rust/timer/hpet: define hpet_fw_cfg Zhao Liu
2025-02-10 3:00 ` [PATCH v2 08/10] rust/timer/hpet: add basic HPET timer and HPETState Zhao Liu
2025-02-10 3:00 ` [PATCH v2 09/10] rust/timer/hpet: add qom and qdev APIs support Zhao Liu
2025-02-10 3:00 ` Zhao Liu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250210030051.2562726-11-zhao1.liu@intel.com \
--to=zhao1.liu@intel.com \
--cc=alex.bennee@linaro.org \
--cc=berrange@redhat.com \
--cc=junjie.mao@hotmail.com \
--cc=manos.pitsidianakis@linaro.org \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-rust@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).