Skip to content

Commit 8c9d468

Browse files
committed
vmclock ABI: add snapshot safety features
Add support for vm_generation_counter and notifications. Keep this separately for now, as a patch to the VMClock bindings, since currently upstream bindings don't include it. We will recreate this for Linux headers once they are released, at which point we will need to drop the bindgen patch. Signed-off-by: Babis Chalios <bchalios@amazon.es>
1 parent 9edd391 commit 8c9d468

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/vmm/src/devices/acpi/generated/vmclock_abi.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub const VMCLOCK_FLAG_PERIOD_MAXERROR_VALID: u64 = 16;
3838
pub const VMCLOCK_FLAG_TIME_ESTERROR_VALID: u64 = 32;
3939
pub const VMCLOCK_FLAG_TIME_MAXERROR_VALID: u64 = 64;
4040
pub const VMCLOCK_FLAG_TIME_MONOTONIC: u64 = 128;
41+
pub const VMCLOCK_FLAG_VM_GEN_COUNTER_PRESENT: u64 = 256;
42+
pub const VMCLOCK_FLAG_NOTIFICATION_PRESENT: u64 = 512;
4143
pub const VMCLOCK_STATUS_UNKNOWN: u8 = 0;
4244
pub const VMCLOCK_STATUS_INITIALIZING: u8 = 1;
4345
pub const VMCLOCK_STATUS_SYNCHRONIZED: u8 = 2;
@@ -153,10 +155,11 @@ pub struct vmclock_abi {
153155
pub time_frac_sec: __le64,
154156
pub time_esterror_nanosec: __le64,
155157
pub time_maxerror_nanosec: __le64,
158+
pub vm_generation_counter: __le64,
156159
}
157160
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
158161
const _: () = {
159-
["Size of vmclock_abi"][::std::mem::size_of::<vmclock_abi>() - 104usize];
162+
["Size of vmclock_abi"][::std::mem::size_of::<vmclock_abi>() - 112usize];
160163
["Alignment of vmclock_abi"][::std::mem::align_of::<vmclock_abi>() - 8usize];
161164
["Offset of field: vmclock_abi::magic"][::std::mem::offset_of!(vmclock_abi, magic) - 0usize];
162165
["Offset of field: vmclock_abi::size"][::std::mem::offset_of!(vmclock_abi, size) - 4usize];
@@ -198,4 +201,6 @@ const _: () = {
198201
[::std::mem::offset_of!(vmclock_abi, time_esterror_nanosec) - 88usize];
199202
["Offset of field: vmclock_abi::time_maxerror_nanosec"]
200203
[::std::mem::offset_of!(vmclock_abi, time_maxerror_nanosec) - 96usize];
204+
["Offset of field: vmclock_abi::vm_generation_counter"]
205+
[::std::mem::offset_of!(vmclock_abi, vm_generation_counter) - 104usize];
201206
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
diff --git a/src/vmm/src/devices/acpi/generated/vmclock_abi.rs b/src/vmm/src/devices/acpi/generated/vmclock_abi.rs
2+
index 134c8393f..80228ad84 100644
3+
--- a/src/vmm/src/devices/acpi/generated/vmclock_abi.rs
4+
+++ b/src/vmm/src/devices/acpi/generated/vmclock_abi.rs
5+
@@ -38,6 +38,8 @@ pub const VMCLOCK_FLAG_PERIOD_MAXERROR_VALID: u64 = 16;
6+
pub const VMCLOCK_FLAG_TIME_ESTERROR_VALID: u64 = 32;
7+
pub const VMCLOCK_FLAG_TIME_MAXERROR_VALID: u64 = 64;
8+
pub const VMCLOCK_FLAG_TIME_MONOTONIC: u64 = 128;
9+
+pub const VMCLOCK_FLAG_VM_GEN_COUNTER_PRESENT: u64 = 256;
10+
+pub const VMCLOCK_FLAG_NOTIFICATION_PRESENT: u64 = 512;
11+
pub const VMCLOCK_STATUS_UNKNOWN: u8 = 0;
12+
pub const VMCLOCK_STATUS_INITIALIZING: u8 = 1;
13+
pub const VMCLOCK_STATUS_SYNCHRONIZED: u8 = 2;
14+
@@ -153,10 +155,11 @@ pub struct vmclock_abi {
15+
pub time_frac_sec: __le64,
16+
pub time_esterror_nanosec: __le64,
17+
pub time_maxerror_nanosec: __le64,
18+
+ pub vm_generation_counter: __le64,
19+
}
20+
#[allow(clippy::unnecessary_operation, clippy::identity_op)]
21+
const _: () = {
22+
- ["Size of vmclock_abi"][::std::mem::size_of::<vmclock_abi>() - 104usize];
23+
+ ["Size of vmclock_abi"][::std::mem::size_of::<vmclock_abi>() - 112usize];
24+
["Alignment of vmclock_abi"][::std::mem::align_of::<vmclock_abi>() - 8usize];
25+
["Offset of field: vmclock_abi::magic"][::std::mem::offset_of!(vmclock_abi, magic) - 0usize];
26+
["Offset of field: vmclock_abi::size"][::std::mem::offset_of!(vmclock_abi, size) - 4usize];
27+
@@ -198,4 +201,6 @@ const _: () = {
28+
[::std::mem::offset_of!(vmclock_abi, time_esterror_nanosec) - 88usize];
29+
["Offset of field: vmclock_abi::time_maxerror_nanosec"]
30+
[::std::mem::offset_of!(vmclock_abi, time_maxerror_nanosec) - 96usize];
31+
+ ["Offset of field: vmclock_abi::vm_generation_counter"]
32+
+ [::std::mem::offset_of!(vmclock_abi, vm_generation_counter) - 104usize];
33+
};

0 commit comments

Comments
 (0)