• Home
  • Raw
  • Download

Lines Matching full:kvm

142 pub struct Kvm {  struct
143 kvm: SafeDescriptor, field
146 pub type KvmCap = kvm::Cap;
148 impl Kvm { argument
149 pub fn new_with_path(device_path: &Path) -> Result<Kvm> { in new_with_path() argument
159 let kvm = unsafe { SafeDescriptor::from_raw_descriptor(ret) }; in new_with_path() localVariable
163 let version = unsafe { ioctl(&kvm, KVM_GET_API_VERSION()) }; in new_with_path()
168 // Per the kernel KVM API documentation: "Applications should refuse to run if in new_with_path()
178 Ok(Kvm { kvm }) in new_with_path()
181 /// Opens `/dev/kvm/` and returns a Kvm object on success.
182 pub fn new() -> Result<Kvm> { in new()
183 Kvm::new_with_path(&PathBuf::from("/dev/kvm")) in new()
189 // Safe because we know that our file is a KVM fd and we verify the return result. in get_vcpu_mmap_size()
199 impl AsRawDescriptor for Kvm { implementation
201 self.kvm.as_raw_descriptor() in as_raw_descriptor()
205 impl Hypervisor for Kvm { implementation
207 Ok(Kvm { in try_clone()
208 kvm: self.kvm.try_clone()?, in try_clone()
215 // this ioctl is safe because we know this kvm descriptor is valid, in check_capability()
216 // and we are copying over the kvm capability (u32) as a c_ulong value. in check_capability()
225 /// A wrapper around creating and using a KVM VM.
227 kvm: Kvm, field
236 /// Constructs a new `KvmVm` using the given `Kvm` instance.
237 pub fn new(kvm: &Kvm, guest_mem: GuestMemory, cfg: Config) -> Result<KvmVm> { in new() argument
239 // Safe because we know kvm is a real kvm fd as this module is the only one that can make in new()
240 // Kvm objects. in new()
243 kvm, in new()
245 kvm.get_vm_type(cfg.protection_type)? as c_ulong, in new()
272 kvm: kvm.try_clone()?, in new()
283 let run_mmap_size = self.kvm.get_vcpu_mmap_size()?; in create_kvm_vcpu()
309 kvm: self.kvm.try_clone()?, in create_kvm_vcpu()
485 /// Checks whether a particular KVM-specific capability is available for this VM.
488 // Safe because we know that our file is a KVM fd, and if the cap is invalid KVM assumes in check_raw_capability()
506 /// Enables a KVM-specific capability for this VM, with the given arguments.
544 // No-op, when the guest attempts to access the pages again, Linux/KVM will provide them. in handle_deflate()
552 kvm: self.kvm.try_clone()?, in try_clone()
599 self.kvm.get_guest_phys_addr_bits() in get_guest_phys_addr_bits()
615 // KVM require to set the user memory region with page size aligned size. Safe to extend in add_memory_region()
775 // KVM delivers IO events in-kernel with ioeventfds, so this is a no-op in handle_io_events()
847 /// A wrapper around using a KVM Vcpu.
849 kvm: Kvm, field
863 kvm: self.kvm.try_clone()?, in try_clone()
899 // On KVM implementations that use a paravirtualized clock (e.g. x86), a flag must be set to in on_suspend()
1007 "Unknown KVM system event {} with flags {}", in run()
1062 r => panic!("unknown kvm exit reason: {}", r), in run()
1237 /// Note that KVM defines the call for both x86 and s390 but we do not expect anyone
1260 /// Note that KVM defines the call for both x86 and s390 but we do not expect anyone