Lines Matching refs:vm
46 int vcpu_enable_evmcs(struct kvm_vm *vm, int vcpu_id) in vcpu_enable_evmcs() argument
55 vcpu_ioctl(vm, vcpu_id, KVM_ENABLE_CAP, &enable_evmcs_cap); in vcpu_enable_evmcs()
78 vcpu_alloc_vmx(struct kvm_vm *vm, vm_vaddr_t *p_vmx_gva) in vcpu_alloc_vmx() argument
80 vm_vaddr_t vmx_gva = vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
81 struct vmx_pages *vmx = addr_gva2hva(vm, vmx_gva); in vcpu_alloc_vmx()
84 vmx->vmxon = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
85 vmx->vmxon_hva = addr_gva2hva(vm, (uintptr_t)vmx->vmxon); in vcpu_alloc_vmx()
86 vmx->vmxon_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->vmxon); in vcpu_alloc_vmx()
89 vmx->vmcs = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
90 vmx->vmcs_hva = addr_gva2hva(vm, (uintptr_t)vmx->vmcs); in vcpu_alloc_vmx()
91 vmx->vmcs_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->vmcs); in vcpu_alloc_vmx()
94 vmx->msr = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
95 vmx->msr_hva = addr_gva2hva(vm, (uintptr_t)vmx->msr); in vcpu_alloc_vmx()
96 vmx->msr_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->msr); in vcpu_alloc_vmx()
100 vmx->shadow_vmcs = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
101 vmx->shadow_vmcs_hva = addr_gva2hva(vm, (uintptr_t)vmx->shadow_vmcs); in vcpu_alloc_vmx()
102 vmx->shadow_vmcs_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->shadow_vmcs); in vcpu_alloc_vmx()
105 vmx->vmread = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
106 vmx->vmread_hva = addr_gva2hva(vm, (uintptr_t)vmx->vmread); in vcpu_alloc_vmx()
107 vmx->vmread_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->vmread); in vcpu_alloc_vmx()
110 vmx->vmwrite = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in vcpu_alloc_vmx()
111 vmx->vmwrite_hva = addr_gva2hva(vm, (uintptr_t)vmx->vmwrite); in vcpu_alloc_vmx()
112 vmx->vmwrite_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->vmwrite); in vcpu_alloc_vmx()
116 vmx->vp_assist = (void *)vm_vaddr_alloc(vm, getpagesize(), in vcpu_alloc_vmx()
118 vmx->vp_assist_hva = addr_gva2hva(vm, (uintptr_t)vmx->vp_assist); in vcpu_alloc_vmx()
119 vmx->vp_assist_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->vp_assist); in vcpu_alloc_vmx()
122 vmx->enlightened_vmcs = (void *)vm_vaddr_alloc(vm, getpagesize(), in vcpu_alloc_vmx()
125 addr_gva2hva(vm, (uintptr_t)vmx->enlightened_vmcs); in vcpu_alloc_vmx()
127 addr_gva2gpa(vm, (uintptr_t)vmx->enlightened_vmcs); in vcpu_alloc_vmx()
397 void nested_pg_map(struct vmx_pages *vmx, struct kvm_vm *vm, in nested_pg_map() argument
403 TEST_ASSERT(vm->mode == VM_MODE_PXXV48_4K, "Attempt to use " in nested_pg_map()
404 "unknown or unsupported guest mode, mode: 0x%x", vm->mode); in nested_pg_map()
406 TEST_ASSERT((nested_paddr % vm->page_size) == 0, in nested_pg_map()
409 nested_paddr, vm->page_size); in nested_pg_map()
410 TEST_ASSERT((nested_paddr >> vm->page_shift) <= vm->max_gfn, in nested_pg_map()
413 paddr, vm->max_gfn, vm->page_size); in nested_pg_map()
414 TEST_ASSERT((paddr % vm->page_size) == 0, in nested_pg_map()
417 paddr, vm->page_size); in nested_pg_map()
418 TEST_ASSERT((paddr >> vm->page_shift) <= vm->max_gfn, in nested_pg_map()
421 paddr, vm->max_gfn, vm->page_size); in nested_pg_map()
431 pml4e[index[3]].address = vm_phy_page_alloc(vm, in nested_pg_map()
433 >> vm->page_shift; in nested_pg_map()
441 pdpe = addr_gpa2hva(vm, pml4e[index[3]].address * vm->page_size); in nested_pg_map()
443 pdpe[index[2]].address = vm_phy_page_alloc(vm, in nested_pg_map()
445 >> vm->page_shift; in nested_pg_map()
453 pde = addr_gpa2hva(vm, pdpe[index[2]].address * vm->page_size); in nested_pg_map()
455 pde[index[1]].address = vm_phy_page_alloc(vm, in nested_pg_map()
457 >> vm->page_shift; in nested_pg_map()
465 pte = addr_gpa2hva(vm, pde[index[1]].address * vm->page_size); in nested_pg_map()
466 pte[index[0]].address = paddr >> vm->page_shift; in nested_pg_map()
496 void nested_map(struct vmx_pages *vmx, struct kvm_vm *vm, in nested_map() argument
500 size_t page_size = vm->page_size; in nested_map()
507 nested_pg_map(vmx, vm, nested_paddr, paddr, eptp_memslot); in nested_map()
516 void nested_map_memslot(struct vmx_pages *vmx, struct kvm_vm *vm, in nested_map_memslot() argument
521 memslot2region(vm, memslot); in nested_map_memslot()
523 i = (region->region.guest_phys_addr >> vm->page_shift) - 1; in nested_map_memslot()
524 last = i + (region->region.memory_size >> vm->page_shift); in nested_map_memslot()
530 nested_map(vmx, vm, in nested_map_memslot()
531 (uint64_t)i << vm->page_shift, in nested_map_memslot()
532 (uint64_t)i << vm->page_shift, in nested_map_memslot()
533 1 << vm->page_shift, in nested_map_memslot()
538 void prepare_eptp(struct vmx_pages *vmx, struct kvm_vm *vm, in prepare_eptp() argument
541 vmx->eptp = (void *)vm_vaddr_alloc(vm, getpagesize(), 0x10000, 0, 0); in prepare_eptp()
542 vmx->eptp_hva = addr_gva2hva(vm, (uintptr_t)vmx->eptp); in prepare_eptp()
543 vmx->eptp_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->eptp); in prepare_eptp()
546 void prepare_virtualize_apic_accesses(struct vmx_pages *vmx, struct kvm_vm *vm, in prepare_virtualize_apic_accesses() argument
549 vmx->apic_access = (void *)vm_vaddr_alloc(vm, getpagesize(), in prepare_virtualize_apic_accesses()
551 vmx->apic_access_hva = addr_gva2hva(vm, (uintptr_t)vmx->apic_access); in prepare_virtualize_apic_accesses()
552 vmx->apic_access_gpa = addr_gva2gpa(vm, (uintptr_t)vmx->apic_access); in prepare_virtualize_apic_accesses()