Home
last modified time | relevance | path

Searched refs:vcpu (Results 1 – 25 of 48) sorted by relevance

12

/external/linux-kselftest/tools/testing/selftests/kvm/lib/
Dkvm_util.c381 struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid) in vcpu_find()
383 struct vcpu *vcpup; in vcpu_find()
408 struct vcpu *vcpu = vcpu_find(vm, vcpuid); in vm_vcpu_rm() local
411 ret = munmap(vcpu->state, sizeof(*vcpu->state)); in vm_vcpu_rm()
414 close(vcpu->fd); in vm_vcpu_rm()
418 if (vcpu->next) in vm_vcpu_rm()
419 vcpu->next->prev = vcpu->prev; in vm_vcpu_rm()
420 if (vcpu->prev) in vm_vcpu_rm()
421 vcpu->prev->next = vcpu->next; in vm_vcpu_rm()
423 vm->vcpu_head = vcpu->next; in vm_vcpu_rm()
[all …]
Dkvm_util_internal.h37 struct vcpu { struct
38 struct vcpu *next, *prev; argument
55 struct vcpu *vcpu_head; argument
66 struct vcpu *vcpu_find(struct kvm_vm *vm, uint32_t vcpuid);
/external/crosvm/tests/
Dplugin_enable_cap.c126 int check_synic_access(struct crosvm_vcpu* vcpu, struct crosvm_vcpu_event *evt, in check_synic_access() argument
149 if (crosvm_vcpu_resume(vcpu) != 0) { in check_synic_access()
154 if (crosvm_vcpu_wait(vcpu, evt) != 0) { in check_synic_access()
218 struct crosvm_vcpu* vcpu = NULL; in main() local
219 ret = crosvm_get_vcpu(crosvm, 0, &vcpu); in main()
232 ret = crosvm_vcpu_wait(vcpu, &evt); in main()
249 ret = crosvm_vcpu_enable_capability(vcpu, KVM_CAP_HYPERV_SYNIC, 0, in main()
258 crosvm_vcpu_get_sregs(vcpu, &sregs); in main()
263 crosvm_vcpu_set_sregs(vcpu, &sregs); in main()
266 crosvm_vcpu_get_regs(vcpu, &regs); in main()
[all …]
Dmini_plugin_template.c48 struct crosvm_vcpu *vcpu; member
53 struct crosvm_vcpu *vcpu = ctx->vcpu; in vcpu_thread() local
56 while (crosvm_vcpu_wait(vcpu, &evt) == 0) {{ in vcpu_thread()
59 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
64 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
68 handle_vpcu_init(vcpu, &regs, &sregs); in vcpu_thread()
69 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
70 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
72 ret = handle_vpcu_evt(vcpu, evt); in vcpu_thread()
77 crosvm_vcpu_resume(vcpu); in vcpu_thread()
[all …]
Dplugin_vcpu_pause.c52 struct crosvm_vcpu *vcpu = arg; in vcpu_thread_fn() local
56 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread_fn()
59 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread_fn()
64 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread_fn()
67 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread_fn()
72 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread_fn()
101 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread_fn()
103 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread_fn()
111 crosvm_vcpu_resume(vcpu); in vcpu_thread_fn()
210 struct crosvm_vcpu *vcpu; in main() local
[all …]
Dplugin_hint.c43 struct crosvm_vcpu *vcpu = arg; in vcpu_thread() local
45 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread()
48 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
53 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
56 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
61 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
83 if (crosvm_vcpu_get_regs(vcpu, &regs)) { in vcpu_thread()
95 if (crosvm_vcpu_set_regs(vcpu, &regs)) { in vcpu_thread()
101 if (crosvm_vcpu_get_sregs(vcpu, &sregs)) { in vcpu_thread()
106 if (crosvm_vcpu_set_sregs(vcpu, &sregs)) { in vcpu_thread()
[all …]
Dplugin_irqfd.c76 struct crosvm_vcpu *vcpu; member
83 struct crosvm_vcpu *vcpu = ctx->vcpu; in vcpu_thread() local
88 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread()
91 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
98 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
101 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
106 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
122 crosvm_vcpu_resume(vcpu); in vcpu_thread()
194 ctxs[vcpu_count].vcpu = vcpus[vcpu_count]; in main()
Dplugin_supported_cpuid.c23 vcpu_function vcpu; member
65 struct crosvm_vcpu* vcpu = NULL; in main() local
66 ret = crosvm_get_vcpu(crosvm, 0, &vcpu); in main()
89 ret = crosvm_vcpu_wait(vcpu, &evt); in main()
99 funct.vcpu = crosvm_get_hyperv_cpuid; in main()
100 ret = test_cpuid(vcpu, funct, "crosvm_get_hyperv_cpuid"); in main()
Dplugin_async_write.c42 struct crosvm_vcpu *vcpu = arg; in vcpu_thread() local
44 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread()
47 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
52 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
55 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
60 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
73 ret = crosvm_vcpu_wait(vcpu, &evt); in vcpu_thread()
90 ret = crosvm_vcpu_wait(vcpu, &evt); in vcpu_thread()
122 crosvm_vcpu_resume(vcpu); in vcpu_thread()
Dplugin_dirty_log.c42 struct crosvm_vcpu *vcpu = arg; in vcpu_thread() local
45 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread()
48 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
53 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
56 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
61 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
76 crosvm_vcpu_resume(vcpu); in vcpu_thread()
Dplugin_ioevent.c41 struct crosvm_vcpu *vcpu = arg; in vcpu_thread() local
44 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread()
47 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
52 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
55 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
60 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
75 crosvm_vcpu_resume(vcpu); in vcpu_thread()
Dplugin_adder.c41 struct crosvm_vcpu *vcpu = arg; in vcpu_thread() local
44 while (crosvm_vcpu_wait(vcpu, &evt) == 0) { in vcpu_thread()
47 crosvm_vcpu_get_sregs(vcpu, &sregs); in vcpu_thread()
52 crosvm_vcpu_set_sregs(vcpu, &sregs); in vcpu_thread()
55 crosvm_vcpu_get_regs(vcpu, &regs); in vcpu_thread()
60 crosvm_vcpu_set_regs(vcpu, &regs); in vcpu_thread()
82 crosvm_vcpu_resume(vcpu); in vcpu_thread()
/external/crosvm/src/plugin/
Dvcpu.rs88 fn get_vcpu_state(vcpu: &Vcpu, state_set: VcpuRequest_StateSet) -> SysResult<Vec<u8>> { in get_vcpu_state()
90 VcpuRequest_StateSet::REGS => VcpuRegs(vcpu.get_regs()?).as_slice().to_vec(), in get_vcpu_state()
91 VcpuRequest_StateSet::SREGS => VcpuSregs(vcpu.get_sregs()?).as_slice().to_vec(), in get_vcpu_state()
92 VcpuRequest_StateSet::FPU => VcpuFpu(vcpu.get_fpu()?).as_slice().to_vec(), in get_vcpu_state()
93 VcpuRequest_StateSet::DEBUGREGS => VcpuDebugregs(vcpu.get_debugregs()?).as_slice().to_vec(), in get_vcpu_state()
94 VcpuRequest_StateSet::XCREGS => VcpuXcregs(vcpu.get_xcrs()?).as_slice().to_vec(), in get_vcpu_state()
95 VcpuRequest_StateSet::LAPIC => VcpuLapicState(vcpu.get_lapic()?).as_slice().to_vec(), in get_vcpu_state()
96 VcpuRequest_StateSet::MP => VcpuMpState(vcpu.get_mp_state()?).as_slice().to_vec(), in get_vcpu_state()
97 VcpuRequest_StateSet::EVENTS => VcpuEvents(vcpu.get_vcpu_events()?).as_slice().to_vec(), in get_vcpu_state()
101 fn set_vcpu_state(vcpu: &Vcpu, state_set: VcpuRequest_StateSet, state: &[u8]) -> SysResult<()> { in set_vcpu_state()
[all …]
Dmod.rs6 mod vcpu; module
40 use self::vcpu::*;
446 let vcpu = Vcpu::new(cpu_id as c_ulong, kvm, vm).map_err(Error::CreateVcpu)?; in run_vcpus() localVariable
455 vcpu.set_signal_mask(&[]) in run_vcpus()
464 let vcpu = vcpu in run_vcpus() localVariable
468 let res = vcpu_plugin.init(&vcpu); in run_vcpus()
475 let run_res = vcpu.run(); in run_vcpus()
484 vcpu_plugin.io_read(port as u64, &mut data[..size], &vcpu); in run_vcpus()
485 if let Err(e) = vcpu.set_data(&data[..size]) { in run_vcpus()
498 vcpu_plugin.io_write(port as u64, &data[..size], &vcpu); in run_vcpus()
[all …]
/external/crosvm/devices/src/irqchip/kvm/
Dmod.rs31 fn add_vcpu(&mut self, vcpu_id: usize, vcpu: &dyn Vcpu) -> Result<()> { in add_vcpu()
32 let vcpu: &KvmVcpu = vcpu in add_vcpu() localVariable
35 self.vcpus.lock()[vcpu_id] = Some(vcpu.try_clone()?); in add_vcpu()
133 Some(Some(vcpu)) => Ok(MPState::from(&vcpu.get_mp_state()?)), in get_mp_state()
141 Some(Some(vcpu)) => vcpu.set_mp_state(&kvm_mp_state::from(state)), in set_mp_state()
204 let vcpu = vm.create_vcpu(0).expect("failed to instantiate vcpu"); in create_kvm_kernel_irqchip() localVariable
205 chip.add_vcpu(0, vcpu.as_vcpu()) in create_kvm_kernel_irqchip()
218 let vcpu = vm.create_vcpu(0).expect("failed to instantiate vcpu"); in mp_state() localVariable
219 chip.add_vcpu(0, vcpu.as_vcpu()) in mp_state()
Dx86_64.rs107 Some(Some(vcpu)) => Ok(LapicState::from(&vcpu.get_lapic()?)), in get_lapic_state()
115 Some(Some(vcpu)) => vcpu.set_lapic(&kvm_lapic_state::from(state)), in set_lapic_state()
306 fn add_vcpu(&mut self, vcpu_id: usize, vcpu: &dyn Vcpu) -> Result<()> { in add_vcpu()
307 let vcpu: &KvmVcpu = vcpu in add_vcpu() localVariable
310 self.vcpus.lock()[vcpu_id] = Some(vcpu.try_clone()?); in add_vcpu()
468 fn inject_interrupts(&self, vcpu: &dyn Vcpu) -> Result<()> { in inject_interrupts()
469 let vcpu: &KvmVcpu = vcpu in inject_interrupts() localVariable
473 let vcpu_id = vcpu.id(); in inject_interrupts()
474 if !self.interrupt_requested(vcpu_id) || !vcpu.ready_for_interrupt() { in inject_interrupts()
479 vcpu.interrupt(vector)?; in inject_interrupts()
[all …]
/external/crosvm/x86_64/src/
Dtest_integration.rs213 let vcpu = *vm in simple_vm_test() localVariable
221 .add_vcpu(0, &vcpu) in simple_vm_test()
224 setup_cpuid(&hyp, &irq_chip, &vcpu, 0, 1, false).unwrap(); in simple_vm_test()
225 setup_msrs(&vcpu, END_ADDR_BEFORE_32BITS).unwrap(); in simple_vm_test()
228 &vcpu, in simple_vm_test()
235 let mut vcpu_regs = vcpu.get_regs().unwrap(); in simple_vm_test()
245 vcpu.set_regs(&vcpu_regs).expect("set regs failed"); in simple_vm_test()
247 setup_fpu(&vcpu).unwrap(); in simple_vm_test()
248 setup_sregs(&guest_mem, &vcpu).unwrap(); in simple_vm_test()
251 let run_handle = vcpu.take_run_handle(None).unwrap(); in simple_vm_test()
[all …]
Dregs.rs150 fn create_msr_entries(vcpu: &dyn VcpuX86_64, pci_start: u64) -> Vec<Register> { in create_msr_entries()
195 append_mtrr_entries(vcpu, pci_start, &mut entries); in create_msr_entries()
204 pub fn setup_msrs(vcpu: &dyn VcpuX86_64, pci_start: u64) -> Result<()> { in setup_msrs()
205 let msrs = create_msr_entries(vcpu, pci_start); in setup_msrs()
206 vcpu.set_msrs(&msrs).map_err(Error::MsrIoctlFailed) in setup_msrs()
214 pub fn setup_fpu(vcpu: &dyn VcpuX86_64) -> Result<()> { in setup_fpu()
221 vcpu.set_fpu(&fpu).map_err(Error::FpuIoctlFailed) in setup_fpu()
232 pub fn setup_regs(vcpu: &dyn VcpuX86_64, boot_ip: u64, boot_sp: u64, boot_si: u64) -> Result<()> { in setup_regs()
242 vcpu.set_regs(&regs).map_err(Error::SettingRegistersIoctl) in setup_regs()
346 pub fn setup_sregs(mem: &GuestMemory, vcpu: &dyn VcpuX86_64) -> Result<()> { in setup_sregs()
[all …]
Dlib.rs543 vcpu: &mut dyn VcpuX86_64, in configure_vcpu()
549 cpuid::setup_cpuid(hypervisor, irq_chip, vcpu, vcpu_id, num_cpus, no_smt) in configure_vcpu()
557 regs::setup_msrs(vcpu, END_ADDR_BEFORE_32BITS).map_err(Error::SetupMsrs)?; in configure_vcpu()
562 vcpu, in configure_vcpu()
568 regs::setup_fpu(vcpu).map_err(Error::SetupFpu)?; in configure_vcpu()
569 regs::setup_sregs(guest_mem, vcpu).map_err(Error::SetupSregs)?; in configure_vcpu()
576 fn debug_read_registers<T: VcpuX86_64>(vcpu: &T) -> Result<X86_64CoreRegs> { in debug_read_registers()
578 let gregs = vcpu.get_regs().map_err(Error::ReadRegs)?; in debug_read_registers()
590 let sregs = vcpu.get_sregs().map_err(Error::ReadRegs)?; in debug_read_registers()
610 fn debug_write_registers<T: VcpuX86_64>(vcpu: &T, regs: &X86_64CoreRegs) -> Result<()> { in debug_write_registers()
[all …]
/external/linux-kselftest/tools/testing/selftests/kvm/lib/x86_64/
Dprocessor.c785 struct vcpu *vcpu = vcpu_find(vm, vcpuid); in vcpu_set_cpuid() local
788 TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid); in vcpu_set_cpuid()
790 rc = ioctl(vcpu->fd, KVM_SET_CPUID2, cpuid); in vcpu_set_cpuid()
855 struct vcpu *vcpu = vcpu_find(vm, vcpuid); in vcpu_get_msr() local
862 TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid); in vcpu_get_msr()
865 r = ioctl(vcpu->fd, KVM_GET_MSRS, &buffer.header); in vcpu_get_msr()
889 struct vcpu *vcpu = vcpu_find(vm, vcpuid); in _vcpu_set_msr() local
896 TEST_ASSERT(vcpu != NULL, "vcpu not found, vcpuid: %u", vcpuid); in _vcpu_set_msr()
901 r = ioctl(vcpu->fd, KVM_SET_MSRS, &buffer.header); in _vcpu_set_msr()
1067 struct vcpu *vcpu = vcpu_find(vm, vcpuid); in vcpu_save_state() local
[all …]
/external/crosvm/kvm/tests/
Dreal_run_adder.rs31 let vcpu = Vcpu::new(0, &kvm, &vm).expect("new vcpu failed"); in test_run() localVariable
37 let mut vcpu_sregs = vcpu.get_sregs().expect("get sregs failed"); in test_run()
42 vcpu.set_sregs(&vcpu_sregs).expect("set sregs failed"); in test_run()
49 vcpu.set_regs(&vcpu_regs).expect("set regs failed"); in test_run()
52 let runnable_vcpu = vcpu.to_runnable(None).unwrap(); in test_run()
Ddirty_log.rs33 let vcpu = Vcpu::new(0, &kvm, &vm).expect("new vcpu failed"); in test_run() localVariable
34 let mut vcpu_sregs = vcpu.get_sregs().expect("get sregs failed"); in test_run()
37 vcpu.set_sregs(&vcpu_sregs).expect("set sregs failed"); in test_run()
45 vcpu.set_regs(&vcpu_regs).expect("set regs failed"); in test_run()
60 let runnable_vcpu = vcpu.to_runnable(None).unwrap(); in test_run()
Dread_only_memory.rs35 let vcpu = Vcpu::new(0, &kvm, &vm).expect("new vcpu failed"); in test_run() localVariable
36 let mut vcpu_sregs = vcpu.get_sregs().expect("get sregs failed"); in test_run()
41 vcpu.set_sregs(&vcpu_sregs).expect("set sregs failed"); in test_run()
48 vcpu.set_regs(&vcpu_regs).expect("set regs failed"); in test_run()
88 let runnable_vcpu = vcpu.to_runnable(None).unwrap(); in test_run()
/external/crosvm/kvm/src/
Dlib.rs943 vcpu: File, field
969 let vcpu = unsafe { File::from_raw_descriptor(vcpu_fd) }; in new() localVariable
972 .from_file(&vcpu) in new()
976 Ok(Vcpu { vcpu, run_mmap }) in new()
1009 vcpu: self, in to_runnable()
1483 self.vcpu.as_raw_descriptor() in as_raw_descriptor()
1491 vcpu: Vcpu, field
1636 &self.vcpu in deref()
1642 &mut self.vcpu in deref_mut()
1648 self.vcpu.as_raw_descriptor() in as_raw_descriptor()
[all …]
/external/crosvm/aarch64/src/
Dlib.rs269 let vcpu: Vcpu = *vm in build_vm() localVariable
274 Self::configure_vcpu_early(vm.get_memory(), &vcpu, vcpu_id, use_pmu, has_bios)?; in build_vm()
275 vcpus.push(vcpu); in build_vm()
281 for vcpu in &vcpus { in build_vm()
282 use_pmu &= vcpu.init_pmu(AARCH64_PMU_IRQ as u64 + 16).is_ok(); in build_vm()
485 vcpu: &dyn VcpuAArch64, in configure_vcpu_early()
498 vcpu.init(&features).map_err(Error::VcpuInit)?; in configure_vcpu_early()
502 vcpu.set_one_reg(arm64_core_reg!(pstate), pstate) in configure_vcpu_early()
512 vcpu.set_one_reg(arm64_core_reg!(pc), entry_addr) in configure_vcpu_early()
519 vcpu.set_one_reg(arm64_core_reg!(regs), fdt_addr) in configure_vcpu_early()

12