mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-09 05:01:31 +00:00
vmm: Implement InterruptSourceGroup and InterruptManager skeleton
This commit introduces an empty implementation of both InterruptManager and InterruptSourceGroup traits, as a proper basis for further implementation. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
11d4d57c06
commit
0f727127d5
48
vmm/src/interrupt.rs
Normal file
48
vmm/src/interrupt.rs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
// Copyright © 2019 Intel Corporation
|
||||||
|
//
|
||||||
|
// SPDX-License-Identifier: Apache-2.0 AND BSD-3-Clause
|
||||||
|
//
|
||||||
|
|
||||||
|
use std::sync::Arc;
|
||||||
|
use vm_device::interrupt::{
|
||||||
|
InterruptIndex, InterruptManager, InterruptSourceConfig, InterruptSourceGroup, InterruptType,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Reuse std::io::Result to simplify interoperability among crates.
|
||||||
|
pub type Result<T> = std::io::Result<T>;
|
||||||
|
|
||||||
|
pub struct MsiInterruptGroup {}
|
||||||
|
|
||||||
|
impl MsiInterruptGroup {
|
||||||
|
fn new() -> Self {
|
||||||
|
MsiInterruptGroup {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InterruptSourceGroup for MsiInterruptGroup {
|
||||||
|
fn trigger(&self, _index: InterruptIndex) -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn update(&self, _index: InterruptIndex, _config: InterruptSourceConfig) -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct KvmInterruptManager {}
|
||||||
|
|
||||||
|
impl InterruptManager for KvmInterruptManager {
|
||||||
|
fn create_group(
|
||||||
|
&self,
|
||||||
|
_interrupt_type: InterruptType,
|
||||||
|
_base: InterruptIndex,
|
||||||
|
_count: InterruptIndex,
|
||||||
|
) -> Result<Arc<Box<dyn InterruptSourceGroup>>> {
|
||||||
|
let interrupt_source_group = MsiInterruptGroup::new();
|
||||||
|
Ok(Arc::new(Box::new(interrupt_source_group)))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn destroy_group(&self, _group: Arc<Box<dyn InterruptSourceGroup>>) -> Result<()> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
@ -30,6 +30,7 @@ pub mod api;
|
|||||||
pub mod config;
|
pub mod config;
|
||||||
pub mod cpu;
|
pub mod cpu;
|
||||||
pub mod device_manager;
|
pub mod device_manager;
|
||||||
|
pub mod interrupt;
|
||||||
pub mod memory_manager;
|
pub mod memory_manager;
|
||||||
pub mod vm;
|
pub mod vm;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user