-
Notifications
You must be signed in to change notification settings - Fork 0
refine: Refine device_manager #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| use std::sync::Arc; | ||
| use std::sync::Mutex; | ||
|
|
||
| use vm_core::arch::layout::MemoryLayout; | ||
| use vm_core::debug::gdbstub::GdbStub; | ||
|
|
@@ -49,18 +48,19 @@ impl VmBuilder { | |
| let mmio_layout = MmioLayout::new(layout.get_mmio_start(), layout.get_mmio_len()); | ||
|
|
||
| let irq_chip = if !self.devices.iter().any(Device::is_irq_chip) { | ||
| Some(virt.init_irq()?) | ||
| virt.init_irq()? | ||
| } else { | ||
| None | ||
| todo!() | ||
| }; | ||
|
Comment on lines
50
to
54
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
At Line 53, If helpful, I can draft the concrete error-handling + IRQ-chip extraction flow for this branch. 🤖 Prompt for AI Agents |
||
|
|
||
| let mut device_manager = DeviceManager::new(mmio_layout); | ||
| device_manager.init_devices(memory.clone(), self.devices, irq_chip)?; | ||
| device_manager.init_devices(memory.clone(), self.devices, irq_chip.clone())?; | ||
|
|
||
| let vm = Vm { | ||
| memory, | ||
| virt, | ||
| device_manager: Arc::new(Mutex::new(device_manager)), | ||
| irq_chip, | ||
| device_manager: Arc::new(device_manager), | ||
| gdb_stub: self.gdb_port.map(GdbStub::new), | ||
| }; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
init_devicescurrently drops the caller-provided device list.At Line 31,
devicesis changed to_devices, and none of the suppliedDeviceentries are consumed. This means VM-configured devices are silently ignored and never registered.Please either (1) consume and register
deviceshere, or (2) fail fast when non-empty input is provided to avoid silent misconfiguration.🤖 Prompt for AI Agents