1 // Copyright 2023 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 base::Result; 6 7 use crate::IrqChip; 8 9 pub trait IrqChipRiscv64: IrqChip { 10 /// Clones this trait as a `Box` version of itself. try_box_clone(&self) -> Result<Box<dyn IrqChipRiscv64>>11 fn try_box_clone(&self) -> Result<Box<dyn IrqChipRiscv64>>; 12 13 /// Returns self as the super-trait IrqChip. as_irq_chip(&self) -> &dyn IrqChip14 fn as_irq_chip(&self) -> &dyn IrqChip; 15 16 /// Returns self as the mutable super-trait IrqChip. as_irq_chip_mut(&mut self) -> &mut dyn IrqChip17 fn as_irq_chip_mut(&mut self) -> &mut dyn IrqChip; 18 19 /// Completes IrqChip setup. Must be called after Vcpus are created. finalize(&self) -> Result<()>20 fn finalize(&self) -> Result<()>; 21 22 /// Returns the number of ids and sources supported by this IrqChip(assuming it's AIA). get_num_ids_sources(&self) -> (usize, usize)23 fn get_num_ids_sources(&self) -> (usize, usize); 24 25 // Snapshot irqchip. snapshot(&self, _cpus_num: usize) -> anyhow::Result<serde_json::Value>26 fn snapshot(&self, _cpus_num: usize) -> anyhow::Result<serde_json::Value> { 27 anyhow::bail!("snapshot not yet implemented for riscv64") 28 } 29 restore(&mut self, _data: serde_json::Value, _vcpus_num: usize) -> anyhow::Result<()>30 fn restore(&mut self, _data: serde_json::Value, _vcpus_num: usize) -> anyhow::Result<()> { 31 anyhow::bail!("restore not yet implemented for riscv64") 32 } 33 } 34