mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
devices: add debug-console device
This commit adds the debug-console (or debugcon) device to CHV. It is a very simple device on I/O port 0xe9 supported by QEMU and BOCHS. It is meant for printing information as easy as possible, without any necessary configuration from the guest at all. It is primarily interesting to OS/kernel and firmware developers as they can produce output as soon as the guest starts without any configuration of a serial device or similar. Furthermore, a kernel hacker might use this device for information of type B whereas information of type A are printed to the serial device. This device is not used by default by Linux, Windows, or any other "real" OS, but only by toy kernels and during firmware development. In the CLI, it can be configured similar to --console or --serial with the --debug-console parameter. Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
This commit is contained in:
committed by
Bo Chen
parent
8f90fba250
commit
e50a641126
+17
-2
@@ -801,6 +801,7 @@ impl Vmm {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Arc::clone(&self.original_termios_opt),
|
||||
Some(snapshot),
|
||||
)
|
||||
@@ -1244,6 +1245,7 @@ impl RequestHandler for Vmm {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Arc::clone(&self.original_termios_opt),
|
||||
None,
|
||||
None,
|
||||
@@ -1343,6 +1345,7 @@ impl RequestHandler for Vmm {
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
None,
|
||||
Arc::clone(&self.original_termios_opt),
|
||||
Some(snapshot),
|
||||
Some(source_url),
|
||||
@@ -1377,17 +1380,24 @@ impl RequestHandler for Vmm {
|
||||
|
||||
fn vm_reboot(&mut self) -> result::Result<(), VmError> {
|
||||
// First we stop the current VM
|
||||
let (config, serial_pty, console_pty, console_resize_pipe) =
|
||||
let (config, serial_pty, console_pty, debug_console_pty, console_resize_pipe) =
|
||||
if let Some(mut vm) = self.vm.take() {
|
||||
let config = vm.get_config();
|
||||
let serial_pty = vm.serial_pty();
|
||||
let console_pty = vm.console_pty();
|
||||
let debug_console_pty = vm.debug_console_pty();
|
||||
let console_resize_pipe = vm
|
||||
.console_resize_pipe()
|
||||
.as_ref()
|
||||
.map(|pipe| pipe.try_clone().unwrap());
|
||||
vm.shutdown()?;
|
||||
(config, serial_pty, console_pty, console_resize_pipe)
|
||||
(
|
||||
config,
|
||||
serial_pty,
|
||||
console_pty,
|
||||
debug_console_pty,
|
||||
console_resize_pipe,
|
||||
)
|
||||
} else {
|
||||
return Err(VmError::VmNotCreated);
|
||||
};
|
||||
@@ -1423,6 +1433,7 @@ impl RequestHandler for Vmm {
|
||||
activate_evt,
|
||||
serial_pty,
|
||||
console_pty,
|
||||
debug_console_pty,
|
||||
console_resize_pipe,
|
||||
Arc::clone(&self.original_termios_opt),
|
||||
None,
|
||||
@@ -2020,6 +2031,8 @@ const DEVICE_MANAGER_SNAPSHOT_ID: &str = "device-manager";
|
||||
#[cfg(test)]
|
||||
mod unit_tests {
|
||||
use super::*;
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
use crate::config::DebugConsoleConfig;
|
||||
use config::{
|
||||
ConsoleConfig, ConsoleOutputMode, CpusConfig, HotplugMethod, MemoryConfig, PayloadConfig,
|
||||
RngConfig, VmConfig,
|
||||
@@ -2094,6 +2107,8 @@ mod unit_tests {
|
||||
iommu: false,
|
||||
socket: None,
|
||||
},
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
debug_console: DebugConsoleConfig::default(),
|
||||
devices: None,
|
||||
user_devices: None,
|
||||
vdpa: None,
|
||||
|
||||
Reference in New Issue
Block a user