mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Split device creation from interrupt controller creation
For MSHV guests, we would need interrupt controller to be initialized before the VM gets initialized. This is because we are registering the base address of GIC distributor with MSHV as part of interrupt controller initialization workflow. And MSHV mandates that this property is set before we initialize the VM. Signed-off-by: Jinank Jain <jinankjain@microsoft.com>
This commit is contained in:
@@ -1223,18 +1223,23 @@ impl DeviceManager {
|
||||
self.console_resize_pipe.clone()
|
||||
}
|
||||
|
||||
pub fn create_interrupt_controller(
|
||||
&mut self,
|
||||
) -> DeviceManagerResult<Arc<Mutex<dyn InterruptController>>> {
|
||||
self.add_interrupt_controller()
|
||||
}
|
||||
|
||||
pub fn create_devices(
|
||||
&mut self,
|
||||
console_info: Option<ConsoleInfo>,
|
||||
console_resize_pipe: Option<Arc<File>>,
|
||||
original_termios_opt: Arc<Mutex<Option<termios>>>,
|
||||
interrupt_controller: Arc<Mutex<dyn InterruptController>>,
|
||||
) -> DeviceManagerResult<()> {
|
||||
trace_scoped!("create_devices");
|
||||
|
||||
let mut virtio_devices: Vec<MetaVirtioDevice> = Vec::new();
|
||||
|
||||
let interrupt_controller = self.add_interrupt_controller()?;
|
||||
|
||||
self.cpu_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
|
||||
@@ -651,10 +651,16 @@ impl Vm {
|
||||
)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
|
||||
let ic = device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.create_interrupt_controller()
|
||||
.map_err(Error::DeviceManager)?;
|
||||
|
||||
device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.create_devices(console_info, console_resize_pipe, original_termios)
|
||||
.create_devices(console_info, console_resize_pipe, original_termios, ic)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
|
||||
#[cfg(feature = "tdx")]
|
||||
|
||||
Reference in New Issue
Block a user