Skip to content

Commit 88bb53a

Browse files
author
BillXiang
committed
riscv64: Handle KVM_EXIT_RISCV_SBI exit
Return riscv_sbi to VMM for further process. Signed-off-by: BillXiang <[email protected]>
1 parent 742c795 commit 88bb53a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kvm-ioctls/src/ioctls/vcpu.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,8 @@ pub enum VcpuExit<'a> {
184184
/// size
185185
size: u64,
186186
},
187+
/// Corresponds to KVM_EXIT_RISCV_SBI
188+
RiscvSbi(&'a mut kvm_run__bindgen_ty_1__bindgen_ty_24),
187189
/// Corresponds to an exit reason that is unknown from the current version
188190
/// of the kvm-ioctls crate. Let the consumer decide about what to do with
189191
/// it.
@@ -1641,6 +1643,13 @@ impl VcpuFd {
16411643
Ok(VcpuExit::IoapicEoi(eoi.vector))
16421644
}
16431645
KVM_EXIT_HYPERV => Ok(VcpuExit::Hyperv),
1646+
#[cfg(target_arch = "riscv64")]
1647+
KVM_EXIT_RISCV_SBI => {
1648+
// SAFETY: Safe because the exit_reason (which comes from the kernel) told us
1649+
// which union field to use.
1650+
let riscv_sbi = unsafe { &mut run.__bindgen_anon_1.riscv_sbi };
1651+
Ok(VcpuExit::RiscvSbi(riscv_sbi))
1652+
}
16441653
r => Ok(VcpuExit::Unsupported(r)),
16451654
}
16461655
} else {

0 commit comments

Comments
 (0)