Skip to content

Commit 55d27da

Browse files
committed
refactor: use setup_serial_device() on aarch64 restoration path
Have teh aarch64 serial device restoration path use the common serial device initialization code in setup_serial_device(). The only functional change here is that now we do set_stdou_nonblocking() on the restore path, although I would wager that not doing so in the past was actually an oversight, because we do it for all booted VMs, and for restored VMs on x86. Signed-off-by: Patrick Roy <[email protected]>
1 parent 6df46c9 commit 55d27da

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/vmm/src/device_manager/persist.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use super::mmio::*;
1616
use crate::arch::DeviceType;
1717
use crate::devices::acpi::vmgenid::{VMGenIDState, VMGenIdConstructorArgs, VmGenId, VmGenIdError};
1818
#[cfg(target_arch = "aarch64")]
19-
use crate::devices::legacy::serial::SerialOut;
20-
#[cfg(target_arch = "aarch64")]
21-
use crate::devices::legacy::{RTCDevice, SerialDevice};
19+
use crate::devices::legacy::RTCDevice;
2220
use crate::devices::virtio::balloon::persist::{BalloonConstructorArgs, BalloonState};
2321
use crate::devices::virtio::balloon::{Balloon, BalloonError};
2422
use crate::devices::virtio::block::BlockError;
@@ -358,13 +356,8 @@ impl<'a> Persist<'a> for MMIODeviceManager {
358356
{
359357
for state in &state.legacy_devices {
360358
if state.type_ == DeviceType::Serial {
361-
let serial = Arc::new(Mutex::new(SerialDevice::new(
362-
Some(std::io::stdin()),
363-
SerialOut::Stdout(std::io::stdout()),
364-
)?));
365-
constructor_args
366-
.event_manager
367-
.add_subscriber(serial.clone());
359+
let serial =
360+
crate::DeviceManager::setup_serial_device(constructor_args.event_manager)?;
368361

369362
dev_manager.register_mmio_serial(vm, serial, Some(state.device_info))?;
370363
}

0 commit comments

Comments
 (0)