Lines Matching full:vmcs
126 struct vmcs { struct
133 * Track a VMCS that may be loaded on a certain CPU. If it is (cpu!=-1), also
138 struct vmcs *vmcs; argument
153 * a VMCS structure, and vmcs12 is our emulated VMX's VMCS. This structure is
157 * nested_vmx_run() will use the data here to build a vmcs02: a VMCS for the
165 /* According to the Intel spec, a VMCS region must start with the
315 * VMPTRLD verifies that the VMCS region that L1 is loading contains this id.
321 * and any VMCS region. Although only sizeof(struct vmcs12) are used by the
341 /* The guest-physical address of the current VMCS L1 keeps for L2 */
377 * loaded_vmcs points to the VMCS currently used in this vcpu. For a
379 * guest (L2), it points to a different VMCS.
612 static DEFINE_PER_CPU(struct vmcs *, vmxarea);
613 static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
615 * We maintain a per-CPU linked-list of VMCS loaded on that CPU. This is needed
936 static void vmcs_clear(struct vmcs *vmcs) in vmcs_clear() argument
938 u64 phys_addr = __pa(vmcs); in vmcs_clear()
946 vmcs, phys_addr); in vmcs_clear()
951 vmcs_clear(loaded_vmcs->vmcs); in loaded_vmcs_init()
956 static void vmcs_load(struct vmcs *vmcs) in vmcs_load() argument
958 u64 phys_addr = __pa(vmcs); in vmcs_load()
966 vmcs, phys_addr); in vmcs_load()
976 if (per_cpu(current_vmcs, cpu) == loaded_vmcs->vmcs) in __loaded_vmcs_clear()
1486 if (per_cpu(current_vmcs, cpu) != vmx->loaded_vmcs->vmcs) { in vmx_vcpu_load()
1487 per_cpu(current_vmcs, cpu) = vmx->loaded_vmcs->vmcs; in vmx_vcpu_load()
1488 vmcs_load(vmx->loaded_vmcs->vmcs); in vmx_vcpu_load()
1660 /* Ensure that we clear the HLT state in the VMCS. We don't need to in vmx_clear_hlt()
1742 * Set up the vmcs to automatically save and restore system
2017 * guest, and the VMCS structure we give it - not about the in vmx_get_vmx_msr()
2477 /* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */ in setup_vmcs_config()
2487 /* Require Write-Back (WB) memory type for VMCS accesses. */ in setup_vmcs_config()
2546 static struct vmcs *alloc_vmcs_cpu(int cpu) in alloc_vmcs_cpu()
2550 struct vmcs *vmcs; in alloc_vmcs_cpu() local
2555 vmcs = page_address(pages); in alloc_vmcs_cpu()
2556 memset(vmcs, 0, vmcs_config.size); in alloc_vmcs_cpu()
2557 vmcs->revision_id = vmcs_config.revision_id; /* vmcs revision id */ in alloc_vmcs_cpu()
2558 return vmcs; in alloc_vmcs_cpu()
2561 static struct vmcs *alloc_vmcs(void) in alloc_vmcs()
2566 static void free_vmcs(struct vmcs *vmcs) in free_vmcs() argument
2568 free_pages((unsigned long)vmcs, vmcs_config.order); in free_vmcs()
2572 * Free a VMCS, but before that VMCLEAR it on the CPU where it was last loaded
2576 if (!loaded_vmcs->vmcs) in free_loaded_vmcs()
2579 free_vmcs(loaded_vmcs->vmcs); in free_loaded_vmcs()
2580 loaded_vmcs->vmcs = NULL; in free_loaded_vmcs()
2598 struct vmcs *vmcs; in alloc_kvm_area() local
2600 vmcs = alloc_vmcs_cpu(cpu); in alloc_kvm_area()
2601 if (!vmcs) { in alloc_kvm_area()
2606 per_cpu(vmxarea, cpu) = vmcs; in alloc_kvm_area()
3626 * Set up the vmcs's constant host-state fields, i.e., host-state fields that
3722 * Sets up the vmcs for emulated real mode.
4927 * We could reuse a single VMCS for all the L2 guests, but we also want the
4938 /* Get a VMCS from the pool to use as vmcs02 for the current vmcs12. */
4949 /* Recycle the least recently used VMCS. */ in nested_get_current_vmcs02()
4957 /* Create a new VMCS */ in nested_get_current_vmcs02()
4962 item->vmcs02.vmcs = alloc_vmcs(); in nested_get_current_vmcs02()
4963 if (!item->vmcs02.vmcs) { in nested_get_current_vmcs02()
5195 * failValid writes the error number to the current VMCS, which in nested_vmx_failValid()
5196 * can't be done there isn't a current VMCS. in nested_vmx_failValid()
6311 vmx->loaded_vmcs->vmcs = alloc_vmcs();
6312 if (!vmx->loaded_vmcs->vmcs)
6350 free_vmcs(vmx->loaded_vmcs->vmcs);
6447 * L2 guest. L1 has a vmcs for L2 (vmcs12), and this function "merges" it
6450 * needs. In addition to modifying the active vmcs (which is vmcs02), this
6596 * if we switch vmcs, and rather than hold a separate cache per vmcs,
6737 pr_warn_ratelimited("%s: VMCS MSR_{LOAD,STORE} unsupported\n",
6849 * and we want to prepare to run its L1 parent. L1 keeps a vmcs for L2 (vmcs12),
6853 * Note that we do not have to copy here all VMCS fields, just those that
6947 * This function should be called when the active VMCS is L1's (vmcs01).
6970 * to apply the same changes to L1's vmcs. We just set cr0 correctly,