[snapshot]: Kick mmio serial after restore
After resuming from snapshot, the console is unresponsive. This
issue is caused by the fact that we are not saving the serial
console state. After restore Received Data Available interrupt
was not set thus driver did not accept any input.
@@ -354,6 +354,8 @@ impl Vmm {
/// Sets RDA bit in serial console
pub fn emulate_serial_init(&self) -> Result<()> {
+ #[cfg(target_arch = "aarch64")]
+ use devices::legacy::SerialDevice;
#[cfg(target_arch = "x86_64")]
let mut serial = self
.pio_device_manager
@@ -361,6 +363,20 @@ impl Vmm {
.lock()
.expect("Poisoned lock");
+ #[cfg(target_arch = "aarch64")]
+ let serial_bus_device = self.get_bus_device(DeviceType::Serial, "Serial");
+ #[cfg(target_arch = "aarch64")]
+ if serial_bus_device.is_none() {
+ return Ok(());
+ }
+ #[cfg(target_arch = "aarch64")]
+ let mut serial_device_locked = serial_bus_device.unwrap().lock().expect("Poisoned lock");
+ #[cfg(target_arch = "aarch64")]
+ let serial = serial_device_locked
+ .as_mut_any()
+ .downcast_mut::<SerialDevice>()
+ .expect("Unexpected BusDeviceType");
+
// When restoring from a previously saved state, there is no serial
// driver initialization, therefore the RDA (Received Data Available)
// interrupt is not enabled. Because of that, the driver won't get
