Skip to content

Commit 657ef62

Browse files
committed
add vmm::inject_interrupt_to_cpus
1 parent 39f4b5a commit 657ef62

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,4 @@ axvisor_api_proc = { path = "axvisor_api_proc", version = "0.2.0"}
2727
crate_interface = "0.2"
2828
memory_addr = "0.4"
2929
axaddrspace = "0.2.0"
30+
cpumask = "0.1.0"

src/vmm.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ pub type VCpuId = usize;
77
/// Interrupt vector.
88
pub type InterruptVector = u8;
99

10+
/// The maximum number of virtual CPUs supported in a virtual machine.
11+
pub const MAX_VCPU_NUM: usize = 64;
12+
13+
pub type VCpuSet = cpumask::CpuMask<MAX_VCPU_NUM>;
14+
1015
/// The API trait for virtual machine management functionalities.
1116
#[crate::api_def]
1217
pub trait VmmIf {
@@ -22,6 +27,8 @@ pub trait VmmIf {
2227
fn active_vcpus(vm_id: VMId) -> Option<usize>;
2328
/// Inject an interrupt to a virtual CPU.
2429
fn inject_interrupt(vm_id: VMId, vcpu_id: VCpuId, vector: InterruptVector);
30+
/// Inject an interrupt to a set of virtual CPUs.
31+
fn inject_interrupt_to_cpus(vm_id: VMId, vcpu_set: VCpuSet, vector: InterruptVector);
2532
/// Notify that a virtual CPU timer has expired.
2633
///
2734
/// TODO: determine whether we can skip this function.

0 commit comments

Comments
 (0)