1 // Copyright 2020 The ChromiumOS Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 use anyhow::anyhow; 6 use base::Result; 7 use hypervisor::DeviceKind; 8 9 use crate::IrqChip; 10 11 pub trait IrqChipAArch64: IrqChip { 12 // Clones this trait as a `Box` version of itself. try_box_clone(&self) -> Result<Box<dyn IrqChipAArch64>>13 fn try_box_clone(&self) -> Result<Box<dyn IrqChipAArch64>>; 14 15 // Get this as the super-trait IrqChip. as_irq_chip(&self) -> &dyn IrqChip16 fn as_irq_chip(&self) -> &dyn IrqChip; 17 18 // Get this as the mutable super-trait IrqChip. as_irq_chip_mut(&mut self) -> &mut dyn IrqChip19 fn as_irq_chip_mut(&mut self) -> &mut dyn IrqChip; 20 21 /// Get the version of VGIC that this chip is emulating. Currently KVM may either implement 22 /// VGIC version 2 or 3. get_vgic_version(&self) -> DeviceKind23 fn get_vgic_version(&self) -> DeviceKind; 24 25 /// Once all the VCPUs have been enabled, finalize the irq chip. finalize(&self) -> Result<()>26 fn finalize(&self) -> Result<()>; 27 28 // Snapshot irqchip. snapshot(&self, _cpus_num: usize) -> anyhow::Result<serde_json::Value>29 fn snapshot(&self, _cpus_num: usize) -> anyhow::Result<serde_json::Value> { 30 Err(anyhow!("Snapshot not yet implemented for AArch64")) 31 } 32 restore(&mut self, _data: serde_json::Value, _vcpus_num: usize) -> anyhow::Result<()>33 fn restore(&mut self, _data: serde_json::Value, _vcpus_num: usize) -> anyhow::Result<()> { 34 Err(anyhow!("Restore not yet implemented for AArch64")) 35 } 36 } 37