Skip to content

Commit 0187cec

Browse files
AlexandruCihodaruluminitavoicu
authored andcommitted
[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. Signed-off-by: AlexandruCihodaru <[email protected]>
1 parent fba9c99 commit 0187cec

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/vmm/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -354,13 +354,29 @@ impl Vmm {
354354

355355
/// Sets RDA bit in serial console
356356
pub fn emulate_serial_init(&self) -> Result<()> {
357+
#[cfg(target_arch = "aarch64")]
358+
use devices::legacy::SerialDevice;
357359
#[cfg(target_arch = "x86_64")]
358360
let mut serial = self
359361
.pio_device_manager
360362
.stdio_serial
361363
.lock()
362364
.expect("Poisoned lock");
363365

366+
#[cfg(target_arch = "aarch64")]
367+
let serial_bus_device = self.get_bus_device(DeviceType::Serial, "Serial");
368+
#[cfg(target_arch = "aarch64")]
369+
if serial_bus_device.is_none() {
370+
return Ok(());
371+
}
372+
#[cfg(target_arch = "aarch64")]
373+
let mut serial_device_locked = serial_bus_device.unwrap().lock().expect("Poisoned lock");
374+
#[cfg(target_arch = "aarch64")]
375+
let serial = serial_device_locked
376+
.as_mut_any()
377+
.downcast_mut::<SerialDevice>()
378+
.expect("Unexpected BusDeviceType");
379+
364380
// When restoring from a previously saved state, there is no serial
365381
// driver initialization, therefore the RDA (Received Data Available)
366382
// interrupt is not enabled. Because of that, the driver won't get

0 commit comments

Comments
 (0)