vmm: Remove GIC entity set/get from DeviceManager

Moved the set/get functions from vmm::DeviceManager to devices::Gic.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
This commit is contained in:
Michael Zhao
2021-06-01 20:03:05 +08:00
committed by Rob Bradford
parent 195eba188a
commit 7932cd22ca
3 changed files with 37 additions and 5 deletions

View File

@@ -1261,6 +1261,11 @@ impl DeviceManager {
Ok(interrupt_controller)
}
#[cfg(target_arch = "aarch64")]
pub fn get_interrupt_controller(&mut self) -> Option<&Arc<Mutex<gic::Gic>>> {
self.interrupt_controller.as_ref()
}
#[cfg(target_arch = "aarch64")]
pub fn set_gic_device_entity(&mut self, device_entity: Arc<Mutex<Box<dyn GicDevice>>>) {
self.gic_device_entity = Some(device_entity);

View File

@@ -1044,7 +1044,11 @@ impl Vm {
self.device_manager
.lock()
.unwrap()
.set_gic_device_entity(Arc::new(Mutex::new(gic_device)));
.get_interrupt_controller()
.unwrap()
.lock()
.unwrap()
.set_gic_device(Arc::new(Mutex::new(gic_device)));
self.device_manager
.lock()
@@ -1865,7 +1869,11 @@ impl Vm {
self.device_manager
.lock()
.unwrap()
.get_gic_device_entity()
.get_interrupt_controller()
.unwrap()
.lock()
.unwrap()
.get_gic_device()
.unwrap()
.lock()
.unwrap()
@@ -1898,7 +1906,11 @@ impl Vm {
self.device_manager
.lock()
.unwrap()
.set_gic_device_entity(Arc::new(Mutex::new(gic_device)));
.get_interrupt_controller()
.unwrap()
.lock()
.unwrap()
.set_gic_device(Arc::new(Mutex::new(gic_device)));
// Here we prepare the GICR_TYPER registers from the restored vCPU states.
self.device_manager
@@ -1911,7 +1923,11 @@ impl Vm {
self.device_manager
.lock()
.unwrap()
.get_gic_device_entity()
.get_interrupt_controller()
.unwrap()
.lock()
.unwrap()
.get_gic_device()
.unwrap()
.lock()
.unwrap()