diff options
Diffstat (limited to 'crosvm_plugin/src/lib.rs')
-rw-r--r-- | crosvm_plugin/src/lib.rs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/crosvm_plugin/src/lib.rs b/crosvm_plugin/src/lib.rs index 13b3d9f..8695d41 100644 --- a/crosvm_plugin/src/lib.rs +++ b/crosvm_plugin/src/lib.rs @@ -166,6 +166,8 @@ pub enum Stat { DestroyConnection, GetShutdownEventFd, CheckExtentsion, + EnableVmCapability, + EnableVcpuCapability, GetSupportedCpuid, GetEmulatedCpuid, GetHypervCpuid, @@ -1289,6 +1291,13 @@ impl crosvm_vcpu { self.vcpu_transaction(&r)?; Ok(()) } + + fn enable_capability(&mut self, capability: u32) -> result::Result<(), c_int> { + let mut r = VcpuRequest::new(); + r.mut_enable_capability().capability = capability; + self.vcpu_transaction(&r)?; + Ok(()) + } } // crosvm API signals success as 0 and errors as negative values @@ -1371,6 +1380,17 @@ pub unsafe extern "C" fn crosvm_check_extension( } #[no_mangle] +pub unsafe extern "C" fn crosvm_enable_capability( + _self_: *mut crosvm, + _capability: u32, + _flags: u32, + _args: *const u64, +) -> c_int { + let _u = record(Stat::EnableVmCapability); + -EINVAL +} + +#[no_mangle] pub unsafe extern "C" fn crosvm_get_supported_cpuid( this: *mut crosvm, entry_count: u32, @@ -1896,6 +1916,25 @@ pub unsafe extern "C" fn crosvm_vcpu_set_cpuid( } #[no_mangle] +pub unsafe extern "C" fn crosvm_vcpu_enable_capability( + this: *mut crosvm_vcpu, + capability: u32, + flags: u32, + args: *const u64, +) -> c_int { + let _u = record(Stat::EnableVcpuCapability); + let this = &mut *this; + let args = slice::from_raw_parts(args, 4); + + if flags != 0 || args.iter().any(|v| *v != 0) { + return -EINVAL; + } + + let ret = this.enable_capability(capability); + to_crosvm_rc(ret) +} + +#[no_mangle] pub unsafe extern "C" fn crosvm_vcpu_get_lapic_state( this: *mut crosvm_vcpu, state: *mut kvm_lapic_state, |