vmm: Remove enable_interrupt_controller()

After adding "get_interrupt_controller()" function in DeviceManager,
"enable_interrupt_controller()" became redundant, because the latter
one is the a simple wrapper on the interrupt controller.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao 2021-06-01 21:53:21 +08:00 committed by Rob Bradford
parent 9a5f3fc2a7
commit 7f3fa39d81
2 changed files with 16 additions and 11 deletions

View File

@ -1257,14 +1257,6 @@ impl DeviceManager {
self.interrupt_controller.as_ref()
}
#[cfg(target_arch = "aarch64")]
pub fn enable_interrupt_controller(&self) -> DeviceManagerResult<()> {
if let Some(interrupt_controller) = &self.interrupt_controller {
interrupt_controller.lock().unwrap().enable().unwrap();
}
Ok(())
}
#[cfg(target_arch = "x86_64")]
fn add_interrupt_controller(
&mut self,

View File

@ -75,6 +75,8 @@ use vmm_sys_util::terminal::Terminal;
use arch::aarch64::gic::gicv3::kvm::{KvmGicV3, GIC_V3_SNAPSHOT_ID};
#[cfg(target_arch = "aarch64")]
use arch::aarch64::gic::kvm::create_gic;
#[cfg(target_arch = "aarch64")]
use devices::interrupt_controller::{self, InterruptController};
/// Errors associated with VM management
#[derive(Debug)]
@ -104,7 +106,8 @@ pub enum Error {
ConfigureSystem(arch::Error),
/// Cannot enable interrupt controller
EnableInterruptController(device_manager::DeviceManagerError),
#[cfg(target_arch = "aarch64")]
EnableInterruptController(interrupt_controller::Error),
PoisonedState,
@ -1050,10 +1053,15 @@ impl Vm {
.unwrap()
.set_gic_device(Arc::new(Mutex::new(gic_device)));
// Activate gic device
self.device_manager
.lock()
.unwrap()
.enable_interrupt_controller()
.get_interrupt_controller()
.unwrap()
.lock()
.unwrap()
.enable()
.map_err(Error::EnableInterruptController)?;
Ok(())
@ -1933,10 +1941,15 @@ impl Vm {
return Err(MigratableError::Restore(anyhow!("Missing GICv3 snapshot")));
}
// Activate gic device
self.device_manager
.lock()
.unwrap()
.enable_interrupt_controller()
.get_interrupt_controller()
.unwrap()
.lock()
.unwrap()
.enable()
.map_err(|e| {
MigratableError::Restore(anyhow!(
"Could not enable interrupt controller routing: {:#?}",