aboutsummaryrefslogtreecommitdiff
path: root/hw/i386/fw_cfg.c
diff options
context:
space:
mode:
authorZhao Liu <zhao1.liu@intel.com>2025-02-10 11:00:42 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2025-02-13 12:51:32 +0100
commitf32352ff9ea1ce3bdf432e29a587ccf84b1ec57a (patch)
tree860ae31003b8306f0c3a09c4da20c82085aba9e8 /hw/i386/fw_cfg.c
parent7630ca2a701a0f79728996e660cda06518c97b9b (diff)
downloadqemu-f32352ff9ea1ce3bdf432e29a587ccf84b1ec57a.zip
qemu-f32352ff9ea1ce3bdf432e29a587ccf84b1ec57a.tar.gz
qemu-f32352ff9ea1ce3bdf432e29a587ccf84b1ec57a.tar.bz2
i386/fw_cfg: move hpet_cfg definition to hpet.c
HPET device needs to access and update hpet_cfg variable, but now it is defined in hw/i386/fw_cfg.c and Rust code can't access it. Move hpet_cfg definition to hpet.c (and rename it to hpet_fw_cfg). This allows Rust HPET device implements its own global hpet_fw_cfg variable, and will further reduce the use of unsafe C code access and calls in the Rust HPET implementation. Signed-off-by: Zhao Liu <zhao1.liu@intel.com> Link: https://lore.kernel.org/r/20250210030051.2562726-2-zhao1.liu@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/fw_cfg.c')
-rw-r--r--hw/i386/fw_cfg.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hw/i386/fw_cfg.c b/hw/i386/fw_cfg.c
index 91bf1df..d08aefa 100644
--- a/hw/i386/fw_cfg.c
+++ b/hw/i386/fw_cfg.c
@@ -26,7 +26,9 @@
#include CONFIG_DEVICES
#include "target/i386/cpu.h"
-struct hpet_fw_config hpet_cfg = {.count = UINT8_MAX};
+#if !defined(CONFIG_HPET) && !defined(CONFIG_X_HPET_RUST)
+struct hpet_fw_config hpet_fw_cfg = {.count = UINT8_MAX};
+#endif
const char *fw_cfg_arch_key_name(uint16_t key)
{
@@ -149,7 +151,7 @@ FWCfgState *fw_cfg_arch_create(MachineState *ms,
#endif
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, 1);
- fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_cfg, sizeof(hpet_cfg));
+ fw_cfg_add_bytes(fw_cfg, FW_CFG_HPET, &hpet_fw_cfg, sizeof(hpet_fw_cfg));
/* allocate memory for the NUMA channel: one (64bit) word for the number
* of nodes, one word for each VCPU->node and one word for each node to
* hold the amount of memory.