Skip to content

Commit 1d2b5f9

Browse files
committed
update README with the save/restore state support
Signed-off-by: Laura Loghin <lauralg@amazon.com>
1 parent ce05bfd commit 1d2b5f9

File tree

1 file changed

+40
-4
lines changed

1 file changed

+40
-4
lines changed

README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
# vm-superio
22

33

4-
The `vm-superio` crate provides emulation for legacy devices. For now, it offers
5-
this support only for the
4+
`vm-superio` provides emulation for legacy devices. For now, it offers this
5+
support only for the
66
[Linux serial console](https://en.wikipedia.org/wiki/Linux_console), a minimal
77
[i8042 PS/2 Controller](https://wiki.osdev.org/%228042%22_PS/2_Controller) and
88
an
99
[ARM PL031 Real Time Clock](https://developer.arm.com/documentation/ddi0224/c/Programmers-model).
10+
To enable snapshot use cases, such as live migration, it also provides support
11+
for saving and restoring the state, and for persisting it (for now only for the
12+
Rtc device).
13+
In order to achieve this, and to keep a clear separation of concerns,
14+
`vm-superio` is a
15+
[workspace](https://doc.rust-lang.org/book/ch14-03-cargo-workspaces.html),
16+
containing the following crates:
17+
- `vm-superio` - which keeps the state of the component;
18+
- `vm-superio-ser` - which mirrors the state structure from `vm-superio` and
19+
adds the required version constraints on it, and derives/implements the
20+
required (de)serialization traits (i.e. `serde`'s `Serialize` and
21+
`Deserialize`; `Versionize`).
1022

1123
## Serial Console
1224

@@ -27,8 +39,8 @@ covered in this crate, the VMM needs to do the following operations:
2739
- event handling (optional)
2840

2941
The following UART registers are emulated via the
30-
[`Serial` structure](src/serial.rs): DLL, IER, DLH, IIR, LCR, LSR, MCR, MSR and
31-
SR (a brief, but nice presentation about these,
42+
[`Serial` structure](crates/vm-superio/src/serial.rs): DLL, IER, DLH, IIR, LCR,
43+
LSR, MCR, MSR and SR (a brief, but nice presentation about these,
3244
[here](https://www.lammertbies.nl/comm/info/serial-uart#regs)).
3345
The Fifo Control Register (FCR) is not emulated; there is no support yet for
3446
directly controlling the FIFOs (which, in this implementation, are always
@@ -108,6 +120,30 @@ writes on the Bus at the address where the device resides.
108120
|1 |A malicious guest writes invalid values in the Load Register to cause overflows on subsequent reads of the Data Register. |The arithmetic operations in the RTC are checked for overflows. When such a situation occurs, the state of the device is reset. |
109121
|2 |A malicious guest performs reads and writes from invalid offsets (that do not correspond to the RTC registers) to cause crashes or to get access to data. |Reads and writes of invalid offsets are denied by the emulation, and an `invalid_read/write` event is called. These events can be implemented by VMMs, and extend them to generate alarms (and for example stop the execution of the malicious guest). |
110122

123+
## Save/restore state support
124+
125+
This support is offered for now only for the `Rtc` device, by the following
126+
abstractions:
127+
- `RtcState` -> which keeps the hardware state of the `Rtc`;
128+
- `RtcStateSer` -> which can be used by customers who need an `RtcState` that
129+
is also `(De)Serialize` and/or `Versionize`. If the customers want a
130+
different state than the upstream one, then they can implement `From` (or
131+
similar mechanisms) in their products to convert the upstream state to the
132+
desired product state.
133+
134+
A detailed design document for the save/restore state support in rust-vmm can
135+
be found [here](https://github.com/rust-vmm/community/pull/118/files).
136+
137+
### Compatibility between `vm-superio` and `vm-superio-ser` versions
138+
139+
Each time there's a change in a state from `vm-superio`, that change needs to
140+
be propagated in the corresponding state from `vm-superio-ser`. To keep the
141+
compatibility between the release versions of these two crates, once we have a
142+
new release of `vm-superio` that implied a change in `vm-superio-ser`, we need
143+
to have a new release of `vm-superio-ser` as well.
144+
Therefore, the `vm-superio-ser` crate has an exact version of `vm-superio` as
145+
dependency.
146+
111147
## License
112148

113149
This project is licensed under either of

0 commit comments

Comments
 (0)