aboutsummaryrefslogtreecommitdiff
path: root/rust/hw/timer
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2025-09-08 12:49:51 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2025-09-17 19:00:57 +0200
commit4dff343d2312bfec25f95ab99ed1068511ddbebb (patch)
tree002f5384c218de0b334f806f13405ac586df0bfb /rust/hw/timer
parent59869b4d58854190f09a79c5392d60fdc0b55d45 (diff)
downloadqemu-4dff343d2312bfec25f95ab99ed1068511ddbebb.zip
qemu-4dff343d2312bfec25f95ab99ed1068511ddbebb.tar.gz
qemu-4dff343d2312bfec25f95ab99ed1068511ddbebb.tar.bz2
rust: split "migration" crate
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Link: https://lore.kernel.org/r/20250827104147.717203-11-marcandre.lureau@redhat.com Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'rust/hw/timer')
-rw-r--r--rust/hw/timer/hpet/Cargo.toml1
-rw-r--r--rust/hw/timer/hpet/meson.build1
-rw-r--r--rust/hw/timer/hpet/src/device.rs11
3 files changed, 8 insertions, 5 deletions
diff --git a/rust/hw/timer/hpet/Cargo.toml b/rust/hw/timer/hpet/Cargo.toml
index dd9a5ed..70acdf0 100644
--- a/rust/hw/timer/hpet/Cargo.toml
+++ b/rust/hw/timer/hpet/Cargo.toml
@@ -13,6 +13,7 @@ rust-version.workspace = true
[dependencies]
common = { path = "../../../common" }
util = { path = "../../../util" }
+migration = { path = "../../../migration" }
qemu_api = { path = "../../../qemu-api" }
qemu_api_macros = { path = "../../../qemu-api-macros" }
diff --git a/rust/hw/timer/hpet/meson.build b/rust/hw/timer/hpet/meson.build
index ca09660..8cd7009 100644
--- a/rust/hw/timer/hpet/meson.build
+++ b/rust/hw/timer/hpet/meson.build
@@ -7,6 +7,7 @@ _libhpet_rs = static_library(
common_rs,
qemu_api_rs,
util_rs,
+ migration_rs,
qemu_api_macros,
],
)
diff --git a/rust/hw/timer/hpet/src/device.rs b/rust/hw/timer/hpet/src/device.rs
index 2be180f..1c22534 100644
--- a/rust/hw/timer/hpet/src/device.rs
+++ b/rust/hw/timer/hpet/src/device.rs
@@ -11,13 +11,16 @@ use std::{
};
use common::{bitops::IntegerExt, uninit_field_mut};
+use migration::{
+ self, impl_vmstate_struct, vmstate_fields, vmstate_of, vmstate_subsections, vmstate_validate,
+ VMStateDescription, VMStateDescriptionBuilder,
+};
use qemu_api::{
bindings::{
address_space_memory, address_space_stl_le, qdev_prop_bit, qdev_prop_bool,
qdev_prop_uint32, qdev_prop_usize,
},
cell::{BqlCell, BqlRefCell},
- impl_vmstate_struct,
irq::InterruptSource,
memory::{
hwaddr, MemoryRegion, MemoryRegionOps, MemoryRegionOpsBuilder, MEMTXATTRS_UNSPECIFIED,
@@ -27,8 +30,6 @@ use qemu_api::{
qom::{ObjectImpl, ObjectType, ParentField, ParentInit},
qom_isa,
sysbus::{SysBusDevice, SysBusDeviceImpl},
- vmstate::{self, VMStateDescription, VMStateDescriptionBuilder},
- vmstate_fields, vmstate_of, vmstate_subsections, vmstate_validate,
};
use util::timer::{Timer, CLOCK_VIRTUAL, NANOSECONDS_PER_SECOND};
@@ -845,7 +846,7 @@ impl HPETState {
}
}
- fn pre_save(&self) -> Result<(), vmstate::Infallible> {
+ fn pre_save(&self) -> Result<(), migration::Infallible> {
if self.is_hpet_enabled() {
self.counter.set(self.get_ticks());
}
@@ -859,7 +860,7 @@ impl HPETState {
Ok(())
}
- fn post_load(&self, _version_id: u8) -> Result<(), vmstate::Infallible> {
+ fn post_load(&self, _version_id: u8) -> Result<(), migration::Infallible> {
for timer in self.timers.iter().take(self.num_timers) {
let mut t = timer.borrow_mut();