From 381d0b4372b9f9a521a0bd253a9a6bcdd1ee2306 Mon Sep 17 00:00:00 2001 From: Henry Wang Date: Fri, 4 Sep 2020 11:31:48 +0800 Subject: [PATCH] devices: remove the migration traits for the `Gic` struct Unlike x86_64, the "interrupt_controller" in the device manager for AArch64 is only a `Gic` object that implements the `InterruptController` to provide the interrupt delivery service. This is not the real GIC device so that we do not need to save its states. Also, we do not need to insert it to the device_tree. Signed-off-by: Henry Wang --- devices/src/gic.rs | 20 -------------------- vmm/src/device_manager.rs | 15 ++++----------- 2 files changed, 4 insertions(+), 31 deletions(-) diff --git a/devices/src/gic.rs b/devices/src/gic.rs index 2a67663a9..f421ef4a2 100644 --- a/devices/src/gic.rs +++ b/devices/src/gic.rs @@ -8,7 +8,6 @@ use std::sync::Arc; use vm_device::interrupt::{ InterruptIndex, InterruptManager, InterruptSourceGroup, MsiIrqGroupConfig, }; -use vm_migration::{Migratable, MigratableError, Pausable, Snapshot, Snapshottable, Transportable}; type Result = result::Result; @@ -63,22 +62,3 @@ impl InterruptController for Gic { Ok(()) } } - -const GIC_SNAPSHOT_ID: &str = "gic"; -impl Snapshottable for Gic { - fn id(&self) -> String { - GIC_SNAPSHOT_ID.to_string() - } - - fn snapshot(&mut self) -> std::result::Result { - unimplemented!(); - } - - fn restore(&mut self, _snapshot: Snapshot) -> std::result::Result<(), MigratableError> { - unimplemented!(); - } -} - -impl Pausable for Gic {} -impl Transportable for Gic {} -impl Migratable for Gic {} diff --git a/vmm/src/device_manager.rs b/vmm/src/device_manager.rs index f8196b675..85b641073 100644 --- a/vmm/src/device_manager.rs +++ b/vmm/src/device_manager.rs @@ -108,8 +108,6 @@ const VFIO_DEVICE_NAME_PREFIX: &str = "_vfio"; #[cfg(target_arch = "x86_64")] const IOAPIC_DEVICE_NAME: &str = "_ioapic"; -#[cfg(target_arch = "aarch64")] -const GIC_DEVICE_NAME: &str = "_gic"; const SERIAL_DEVICE_NAME_PREFIX: &str = "_serial"; @@ -1141,8 +1139,6 @@ impl DeviceManager { fn add_interrupt_controller( &mut self, ) -> DeviceManagerResult>> { - let id = String::from(GIC_DEVICE_NAME); - let interrupt_controller: Arc> = Arc::new(Mutex::new( gic::Gic::new( self.config.lock().unwrap().cpus.boot_vcpus, @@ -1153,13 +1149,10 @@ impl DeviceManager { self.interrupt_controller = Some(interrupt_controller.clone()); - // Fill the device tree with a new node. In case of restore, we - // know there is nothing to do, so we can simply override the - // existing entry. - self.device_tree - .lock() - .unwrap() - .insert(id.clone(), device_node!(id, interrupt_controller)); + // Unlike x86_64, the "interrupt_controller" here for AArch64 is only + // a `Gic` object that implements the `InterruptController` to provide + // interrupt delivery service. This is not the real GIC device so that + // we do not need to insert it to the device tree. Ok(interrupt_controller) }