arch/x86/kvm/vmx/hyperv.h
Source file repositories/reference/linux-study-clean/arch/x86/kvm/vmx/hyperv.h
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/kvm/vmx/hyperv.h- Extension
.h- Size
- 2153 bytes
- Lines
- 91
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kvm_host.hvmcs12.hvmx.h
Detected Declarations
enum nested_evmptrld_statusfunction evmptr_is_validfunction nested_vmx_is_evmptr12_validfunction evmptr_is_setfunction nested_vmx_is_evmptr12_setfunction guest_cpu_cap_has_evmcsfunction evmptr_is_validfunction nested_vmx_is_evmptr12_validfunction evmptr_is_setfunction nested_vmx_is_evmptr12_set
Annotated Snippet
#ifndef __KVM_X86_VMX_HYPERV_H
#define __KVM_X86_VMX_HYPERV_H
#include <linux/kvm_host.h>
#include "vmcs12.h"
#include "vmx.h"
#define EVMPTR_INVALID (-1ULL)
#define EVMPTR_MAP_PENDING (-2ULL)
enum nested_evmptrld_status {
EVMPTRLD_DISABLED,
EVMPTRLD_SUCCEEDED,
EVMPTRLD_VMFAIL,
EVMPTRLD_ERROR,
};
#ifdef CONFIG_KVM_HYPERV
static inline bool evmptr_is_valid(u64 evmptr)
{
return evmptr != EVMPTR_INVALID && evmptr != EVMPTR_MAP_PENDING;
}
static inline bool nested_vmx_is_evmptr12_valid(struct vcpu_vmx *vmx)
{
return evmptr_is_valid(vmx->nested.hv_evmcs_vmptr);
}
static inline bool evmptr_is_set(u64 evmptr)
{
return evmptr != EVMPTR_INVALID;
}
static inline bool nested_vmx_is_evmptr12_set(struct vcpu_vmx *vmx)
{
return evmptr_is_set(vmx->nested.hv_evmcs_vmptr);
}
static inline struct hv_enlightened_vmcs *nested_vmx_evmcs(struct vcpu_vmx *vmx)
{
return vmx->nested.hv_evmcs;
}
static inline bool guest_cpu_cap_has_evmcs(struct kvm_vcpu *vcpu)
{
/*
* eVMCS is exposed to the guest if Hyper-V is enabled in CPUID and
* eVMCS has been explicitly enabled by userspace.
*/
return vcpu->arch.hyperv_enabled &&
to_vmx(vcpu)->nested.enlightened_vmcs_enabled;
}
u64 nested_get_evmptr(struct kvm_vcpu *vcpu);
uint16_t nested_get_evmcs_version(struct kvm_vcpu *vcpu);
int nested_enable_evmcs(struct kvm_vcpu *vcpu,
uint16_t *vmcs_version);
void nested_evmcs_filter_control_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
int nested_evmcs_check_controls(struct vmcs12 *vmcs12);
bool nested_evmcs_l2_tlb_flush_enabled(struct kvm_vcpu *vcpu);
void vmx_hv_inject_synthetic_vmexit_post_tlb_flush(struct kvm_vcpu *vcpu);
#else
static inline bool evmptr_is_valid(u64 evmptr)
{
return false;
}
static inline bool nested_vmx_is_evmptr12_valid(struct vcpu_vmx *vmx)
{
return false;
}
static inline bool evmptr_is_set(u64 evmptr)
{
return false;
}
static inline bool nested_vmx_is_evmptr12_set(struct vcpu_vmx *vmx)
{
return false;
}
static inline struct hv_enlightened_vmcs *nested_vmx_evmcs(struct vcpu_vmx *vmx)
{
return NULL;
}
#endif
#endif /* __KVM_X86_VMX_HYPERV_H */
Annotation
- Immediate include surface: `linux/kvm_host.h`, `vmcs12.h`, `vmx.h`.
- Detected declarations: `enum nested_evmptrld_status`, `function evmptr_is_valid`, `function nested_vmx_is_evmptr12_valid`, `function evmptr_is_set`, `function nested_vmx_is_evmptr12_set`, `function guest_cpu_cap_has_evmcs`, `function evmptr_is_valid`, `function nested_vmx_is_evmptr12_valid`, `function evmptr_is_set`, `function nested_vmx_is_evmptr12_set`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.