feature: virtio console support (#1113)

feat(virtio): add virtio console driver support

- Implement virtio console driver with TTY interface
- Add HVC device support for console output
- Update devfs to handle HVC devices
- Fix virtio driver registration and initialization
- Improve virtio net driver interrupt handling
- Clean up block device naming implementation
- Add clippy lint checks to multiple crates
- Fix slab allocator alignment issues
- Update QEMU run script for virtio consoleagonOS.org>

---------

Signed-off-by: longjin <longjin@DragonOS.org>
This commit is contained in:
LoGin
2025-03-27 20:48:40 +08:00
committed by GitHub
parent 3d663af8a2
commit b6db20c072
31 changed files with 974 additions and 141 deletions

View File

@ -309,10 +309,16 @@ impl TtyDriver {
} else {
idx = self.ida.lock().alloc().ok_or(SystemError::EBUSY)?;
}
log::debug!("init_tty_device: create TtyCore");
let tty = TtyCore::new(self.self_ref(), idx);
log::debug!("init_tty_device: to driver_install_tty");
self.driver_install_tty(tty.clone())?;
log::debug!(
"init_tty_device: driver_install_tty done, index: {}, dev_name: {:?}",
idx,
tty.core().name(),
);
let core = tty.core();
@ -321,18 +327,20 @@ impl TtyDriver {
ports[core.index()].setup_internal_tty(Arc::downgrade(&tty));
tty.set_port(ports[core.index()].clone());
}
log::debug!("init_tty_device: to ldisc_setup");
TtyLdiscManager::ldisc_setup(tty.clone(), tty.core().link())?;
// 在devfs创建对应的文件
log::debug!("init_tty_device: to new tty device");
let device = TtyDevice::new(
core.name().clone(),
IdTable::new(self.tty_line_name(idx), Some(*core.device_number())),
super::tty_device::TtyType::Tty,
);
log::debug!("init_tty_device: to devfs_register");
devfs_register(device.name_ref(), device.clone())?;
log::debug!("init_tty_device: to device_register");
device_register(device)?;
Ok(tty)
}
@ -473,8 +481,8 @@ pub trait TtyOperation: Sync + Send + Debug {
fn flush_chars(&self, tty: &TtyCoreData);
fn put_char(&self, _tty: &TtyCoreData, _ch: u8) -> Result<(), SystemError> {
Err(SystemError::ENOSYS)
fn put_char(&self, tty: &TtyCoreData, ch: u8) -> Result<(), SystemError> {
self.write(tty, &[ch], 1).map(|_| ())
}
fn start(&self, _tty: &TtyCoreData) -> Result<(), SystemError> {