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 <Henry.Wang@arm.com>
This commit is contained in:
Henry Wang 2020-09-04 11:31:48 +08:00 committed by Rob Bradford
parent 39c9583b48
commit 381d0b4372
2 changed files with 4 additions and 31 deletions

View File

@ -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<T> = result::Result<T, Error>;
@ -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<Snapshot, MigratableError> {
unimplemented!();
}
fn restore(&mut self, _snapshot: Snapshot) -> std::result::Result<(), MigratableError> {
unimplemented!();
}
}
impl Pausable for Gic {}
impl Transportable for Gic {}
impl Migratable for Gic {}

View File

@ -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<Arc<Mutex<dyn InterruptController>>> {
let id = String::from(GIC_DEVICE_NAME);
let interrupt_controller: Arc<Mutex<gic::Gic>> = 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)
}