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:
parent
a072b9a356
commit
df418a2153
2 changed files with 14 additions and 3 deletions
|
|
@ -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")]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue