File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,8 @@ pub enum Cap {
140
140
S390UserSigp = KVM_CAP_S390_USER_SIGP ,
141
141
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
142
142
SplitIrqchip = KVM_CAP_SPLIT_IRQCHIP ,
143
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
144
+ DisableExits = KVM_CAP_X86_DISABLE_EXITS ,
143
145
ImmediateExit = KVM_CAP_IMMEDIATE_EXIT ,
144
146
ArmVmIPASize = KVM_CAP_ARM_VM_IPA_SIZE ,
145
147
MsiDevid = KVM_CAP_MSI_DEVID ,
Original file line number Diff line number Diff line change @@ -248,6 +248,26 @@ impl Kvm {
248
248
}
249
249
}
250
250
251
+ /// Gets the `KVM_CAP_X86_DISABLE_EXITS` capability.
252
+ ///
253
+ /// # Example
254
+ ///
255
+ /// ```
256
+ /// # use kvm_ioctls::Kvm;
257
+ /// let kvm = Kvm::new().unwrap();
258
+ /// assert!(kvm.get_disable_exits_cap() >= 0);
259
+ /// ```
260
+ ///
261
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
262
+ pub fn get_disable_exits_cap ( & self ) -> usize {
263
+ let x = self . check_extension_int ( Cap :: DisableExits ) ;
264
+ if x > 0 {
265
+ x as usize
266
+ } else {
267
+ 0
268
+ }
269
+ }
270
+
251
271
#[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
252
272
fn get_cpuid ( & self , kind : u64 , num_entries : usize ) -> Result < CpuId > {
253
273
if num_entries > KVM_MAX_CPUID_ENTRIES {
@@ -615,6 +635,13 @@ mod tests {
615
635
assert ! ( kvm. get_nr_memslots( ) >= 32 ) ;
616
636
}
617
637
638
+ #[ cfg( any( target_arch = "x86" , target_arch = "x86_64" ) ) ]
639
+ #[ test]
640
+ fn test_kvm_get_disable_exits ( ) {
641
+ let kvm = Kvm :: new ( ) . unwrap ( ) ;
642
+ let _disable_exits = kvm. get_disable_exits_cap ( ) ;
643
+ }
644
+
618
645
#[ test]
619
646
fn test_create_vm ( ) {
620
647
let kvm = Kvm :: new ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments