Projectname large_stringclasses 15
values | Filepath large_stringlengths 4 106 ⌀ | Function large_stringlengths 11 3.45k | Label list |
|---|---|---|---|
Linux Kernel | arch/x86/kvm/svm/svm.c |
void svm_vcpu_init_msrpm(struct kvm_vcpu *vcpu, u32 *msrpm) {
int i;
for (i = 0; direct_access_msrs[i].index != MSR_INVALID; i++) {
if (!direct_access_msrs[i].always)
continue;
set_msr_interception(vcpu, msrpm, direct_access_msrs[i].index, 1, 1);
}
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
void svm_set_x2apic_msr_interception(struct vcpu_svm *svm, bool intercept) {
int i;
if (intercept == svm->x2avic_msrs_intercepted)
return;
if (avic_mode != AVIC_MODE_X2 || !apic_x2apic_mode(svm->vcpu.arch.apic))
return;
for (i = 0; i < MAX_DIRECT_ACCESS_MSRS; i++) {
int index = direct_access_msr... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static int svm_get_lbr_msr(struct vcpu_svm *svm, u32 index) {
struct vmcb *vmcb = (svm->vmcb->control.virt_ext & LBR_CTL_ENABLE_MASK)
? svm->vmcb
: svm->vmcb01.ptr;
switch (index) {
case MSR_IA32_DEBUGCTLMSR:
return vmcb->save.dbgctl;
case MSR_IA32_LASTB... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void grow_ple_window(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
struct vmcb_control_area *control = &svm->vmcb->control;
int old = control->pause_filter_count;
if (kvm_pause_in_guest(vcpu->kvm))
return;
control->pause_filter_count = __grow_ple_window(
old, pause_filter_c... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static void init_seg(struct vmcb_seg *seg) {
seg->selector = 0;
seg->attrib =
SVM_SELECTOR_P_MASK | SVM_SELECTOR_S_MASK | SVM_SELECTOR_WRITE_MASK;
seg->limit = 0xffff;
seg->base = 0;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset) {
struct vcpu_svm *svm = to_svm(vcpu);
svm->vmcb01.ptr->control.tsc_offset = vcpu->arch.l1_tsc_offset;
svm->vmcb->control.tsc_offset = offset;
vmcb_mark_dirty(svm->vmcb, VMCB_INTERCEPTS);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_write_tsc_multiplier(struct kvm_vcpu *vcpu, u64 multiplier) {
__svm_write_tsc_multiplier(multiplier);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static inline void init_vmcb_after_set_cpuid(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
if (guest_cpuid_is_intel(vcpu)) {
svm_set_intercept(svm, INTERCEPT_VMLOAD);
svm_set_intercept(svm, INTERCEPT_VMSAVE);
svm->vmcb->control.virt_ext &= ~VIRTUAL_VMLOAD_VMSAVE_ENABLE_MASK;
set_m... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static void svm_vcpu_free(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
svm_clear_current_vmcb(svm->vmcb);
svm_leave_nested(vcpu);
svm_free_nested(svm);
sev_free_vcpu(vcpu);
__free_page(pfn_to_page(__sme_clr(svm->vmcb01.pa) >> PAGE_SHIFT));
__free_pages(virt_to_page(svm->msrpm), get_or... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static void svm_clear_vintr(struct vcpu_svm *svm) {
svm_clr_intercept(svm, INTERCEPT_VINTR);
svm->vmcb->control.int_ctl &= ~V_IRQ_INJECTION_BITS_MASK;
if (is_guest_mode(&svm->vcpu)) {
svm->vmcb01.ptr->control.int_ctl &= ~V_IRQ_INJECTION_BITS_MASK;
WARN_ON((svm->vmcb->control.int_ctl & V_TPR_MASK) !=
... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_get_gdt(struct kvm_vcpu *vcpu, struct desc_ptr *dt) {
struct vcpu_svm *svm = to_svm(vcpu);
dt->size = svm->vmcb->save.gdtr.limit;
dt->address = svm->vmcb->save.gdtr.base;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static void svm_set_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var,
int seg) {
struct vcpu_svm *svm = to_svm(vcpu);
struct vmcb_seg *s = svm_seg(vcpu, seg);
s->base = var->base;
s->limit = var->limit;
s->selector = var->selector;
s->attrib = (var->type & SVM_SELECTOR_TYP... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_set_dr7(struct kvm_vcpu *vcpu, unsigned long value) {
struct vcpu_svm *svm = to_svm(vcpu);
if (vcpu->arch.guest_state_protected)
return;
svm->vmcb->save.dr7 = value;
vmcb_mark_dirty(svm->vmcb, VMCB_DR);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int ac_interception(struct kvm_vcpu *vcpu) {
kvm_queue_exception_e(vcpu, AC_VECTOR, 0);
return 1;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int stgi_interception(struct kvm_vcpu *vcpu) {
int ret;
if (nested_svm_check_permissions(vcpu))
return 1;
ret = kvm_skip_emulated_instruction(vcpu);
svm_set_gif(to_svm(vcpu), true);
return ret;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int iret_interception(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
++vcpu->stat.nmi_window_exits;
vcpu->arch.hflags |= HF_IRET_MASK;
if (!sev_es_guest(vcpu->kvm)) {
svm_clr_intercept(svm, INTERCEPT_IRET);
svm->nmi_iret_rip = kvm_rip_read(vcpu);
}
kvm_make_request(KVM_REQ_EV... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static bool check_selective_cr0_intercepted(struct kvm_vcpu *vcpu,
unsigned long val) {
struct vcpu_svm *svm = to_svm(vcpu);
unsigned long cr0 = vcpu->arch.cr0;
bool ret = false;
if (!is_guest_mode(vcpu) ||
(!(vmcb12_is_intercept(&svm->nested.ctl, INTERCEPT_SE... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int svm_get_msr_feature(struct kvm_msr_entry *msr) {
msr->data = 0;
switch (msr->index) {
case MSR_AMD64_DE_CFG:
if (cpu_feature_enabled(X86_FEATURE_LFENCE_RDTSC))
msr->data |= MSR_AMD64_DE_CFG_LFENCE_SERIALIZE;
break;
case MSR_IA32_PERF_CAPABILITIES:
return 0;
default:
return K... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int svm_complete_emulated_msr(struct kvm_vcpu *vcpu, int err) {
struct vcpu_svm *svm = to_svm(vcpu);
if (!err || !sev_es_guest(vcpu->kvm) || WARN_ON_ONCE(!svm->sev_es.ghcb))
return kvm_complete_insn_gp(vcpu, err);
ghcb_set_sw_exit_info_1(svm->sev_es.ghcb, 1);
ghcb_set_sw_exit_info_2(
svm->sev... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static int svm_set_vm_cr(struct kvm_vcpu *vcpu, u64 data) {
struct vcpu_svm *svm = to_svm(vcpu);
int svm_dis, chg_mask;
if (data & ~SVM_VM_CR_VALID_MASK)
return 1;
chg_mask = SVM_VM_CR_VALID_MASK;
if (svm->nested.vm_cr_msr & SVM_VM_CR_SVM_DIS_MASK)
chg_mask &= ~(SVM_VM_CR_SVM_LOCK_MASK | SVM_VM_CR_... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_inject_nmi(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
svm->vmcb->control.event_inj = SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_NMI;
if (svm->nmi_l1_to_l2)
return;
vcpu->arch.hflags |= HF_NMI_MASK;
if (!sev_es_guest(vcpu->kvm))
svm_set_intercept(svm, INTERCEPT_IRET);
+... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_inject_irq(struct kvm_vcpu *vcpu, bool reinjected) {
struct vcpu_svm *svm = to_svm(vcpu);
u32 type;
if (vcpu->arch.interrupt.soft) {
if (svm_update_soft_interrupt_rip(vcpu))
return;
type = SVM_EVTINJ_TYPE_SOFT;
} else {
type = SVM_EVTINJ_TYPE_INTR;
}
trace_kvm_inj_virq(... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static void svm_update_cr8_intercept(struct kvm_vcpu *vcpu, int tpr, int irr) {
struct vcpu_svm *svm = to_svm(vcpu);
if (sev_es_guest(vcpu->kvm))
return;
if (nested_svm_virtualize_tpr(vcpu))
return;
svm_clr_intercept(svm, INTERCEPT_CR8_WRITE);
if (irr == -1)
return;
if (tpr >= irr)
svm_... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static bool svm_get_nmi_mask(struct kvm_vcpu *vcpu) {
return !!(vcpu->arch.hflags & HF_NMI_MASK);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static void svm_enable_nmi_window(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
if ((vcpu->arch.hflags & (HF_NMI_MASK | HF_IRET_MASK)) == HF_NMI_MASK)
return;
if (!gif_set(svm)) {
if (vgif)
svm_set_intercept(svm, INTERCEPT_STGI);
return; /* STGI will cause a vm exit */
}
/... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_flush_tlb_gva(struct kvm_vcpu *vcpu, gva_t gva) {
struct vcpu_svm *svm = to_svm(vcpu);
invlpga(gva, svm->vmcb->control.asid);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static inline void sync_cr8_to_lapic(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
if (nested_svm_virtualize_tpr(vcpu))
return;
if (!svm_is_intercept(svm, INTERCEPT_CR8_WRITE)) {
int cr8 = svm->vmcb->control.int_ctl & V_TPR_MASK;
kvm_set_cr8(vcpu, cr8);
}
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static inline void sync_lapic_to_cr8(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
u64 cr8;
if (nested_svm_virtualize_tpr(vcpu) || kvm_vcpu_apicv_active(vcpu))
return;
cr8 = kvm_get_cr8(vcpu);
svm->vmcb->control.int_ctl &= ~V_TPR_MASK;
svm->vmcb->control.int_ctl |= cr8 & V_TPR_MASK;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_cancel_injection(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
struct vmcb_control_area *control = &svm->vmcb->control;
control->exit_int_info = control->event_inj;
control->exit_int_info_err = control->event_inj_err;
control->event_inj = 0;
svm_complete_interrupts(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int svm_vcpu_pre_run(struct kvm_vcpu *vcpu) { return 1; } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static noinstr void svm_vcpu_enter_exit(struct kvm_vcpu *vcpu,
bool spec_ctrl_intercepted) {
struct vcpu_svm *svm = to_svm(vcpu);
guest_state_enter_irqoff();
if (sev_es_guest(vcpu->kvm))
__svm_sev_es_vcpu_run(svm, spec_ctrl_intercepted);
else
__svm_vcpu_run(svm... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static int __init svm_check_processor_compat(void) { return 0; } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_handle_exit_irqoff(struct kvm_vcpu *vcpu) {
if (to_svm(vcpu)->vmcb->control.exit_code == SVM_EXIT_INTR)
vcpu->arch.at_instruction_boundary = true;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static bool svm_apic_init_signal_blocked(struct kvm_vcpu *vcpu) {
struct vcpu_svm *svm = to_svm(vcpu);
return !gif_set(svm);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c |
static void svm_vm_destroy(struct kvm *kvm) {
avic_vm_destroy(kvm);
sev_vm_destroy(kvm);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static __init void svm_adjust_mmio_mask(void) {
unsigned int enc_bit, mask_bit;
u64 msr, mask;
if (cpuid_eax(0x80000000) < 0x8000001f)
return;
/* If memory encryption is not enabled, use existing mask */
rdmsrl(MSR_AMD64_SYSCFG, msr);
if (!(msr & MSR_AMD64_SYSCFG_MEM_ENCRYPT))
return;
enc_bit =... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.c | static __init void svm_set_cpu_caps(void) {
kvm_set_cpu_caps();
kvm_caps.supported_xss = 0;
if (nested) {
kvm_cpu_cap_set(X86_FEATURE_SVM);
kvm_cpu_cap_set(X86_FEATURE_VMCBCLEAN);
if (nrips)
kvm_cpu_cap_set(X86_FEATURE_NRIPS);
if (npt_enabled)
kvm_cpu_cap_set(X86_FEATURE_NPT);
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline void vmcb_mark_all_dirty(struct vmcb *vmcb) {
vmcb->control.clean = 0;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline bool vmcb_is_dirty(struct vmcb *vmcb, int bit) {
return !test_bit(bit, (unsigned long *)&vmcb->control.clean);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline bool vmcb12_is_intercept(struct vmcb_ctrl_area_cached *control,
u32 bit) {
WARN_ON_ONCE(bit >= 32 * MAX_INTERCEPT);
return test_bit(bit, (unsigned long *)&control->intercepts);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline void svm_clr_intercept(struct vcpu_svm *svm, int bit) {
struct vmcb *vmcb = svm->vmcb01.ptr;
vmcb_clr_intercept(&vmcb->control, bit);
recalc_intercepts(svm);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline void enable_gif(struct vcpu_svm *svm) {
struct vmcb *vmcb = get_vgif_vmcb(svm);
if (vmcb)
vmcb->control.int_ctl |= V_GIF_MASK;
else
svm->vcpu.arch.hflags |= HF_GIF_MASK;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline void disable_gif(struct vcpu_svm *svm) {
struct vmcb *vmcb = get_vgif_vmcb(svm);
if (vmcb)
vmcb->control.int_ctl &= ~V_GIF_MASK;
else
svm->vcpu.arch.hflags &= ~HF_GIF_MASK;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm.h |
static inline bool gif_set(struct vcpu_svm *svm) {
struct vmcb *vmcb = get_vgif_vmcb(svm);
if (vmcb)
return !!(vmcb->control.int_ctl & V_GIF_MASK);
else
return !!(svm->vcpu.arch.hflags & HF_GIF_MASK);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_onhyperv.c |
int svm_hv_enable_direct_tlbflush(struct kvm_vcpu *vcpu) {
struct hv_enlightenments *hve;
struct hv_partition_assist_pg **p_hv_pa_pg = &to_kvm_hv(vcpu->kvm)->hv_pa_pg;
if (!*p_hv_pa_pg)
*p_hv_pa_pg = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!*p_hv_pa_pg)
return -ENOMEM;
hve = (struct hv_enlightenments ... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_onhyperv.h |
static inline void svm_hv_init_vmcb(struct vmcb *vmcb) {
struct hv_enlightenments *hve =
(struct hv_enlightenments *)vmcb->control.reserved_sw;
if (npt_enabled && ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB)
hve->hv_enlightenments_control.enlightened_npt_tlb = 1;
if (ms_hyperv.nested_fe... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_onhyperv.h |
static inline void svm_hv_hardware_setup(void) {
if (npt_enabled &&
ms_hyperv.nested_features & HV_X64_NESTED_ENLIGHTENED_TLB) {
pr_info("kvm: Hyper-V enlightened NPT TLB flush enabled\n");
svm_x86_ops.tlb_remote_flush = hv_remote_flush_tlb;
svm_x86_ops.tlb_remote_flush_with_range = hv_remote_flush... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_onhyperv.h |
static inline void
svm_hv_vmcb_dirty_nested_enlightenments(struct kvm_vcpu *vcpu) {
struct vmcb *vmcb = to_svm(vcpu)->vmcb;
struct hv_enlightenments *hve =
(struct hv_enlightenments *)vmcb->control.reserved_sw;
if (hve->hv_enlightenments_control.msr_bitmap)
vmcb_mark_dirty(vmcb, VMCB_HV_NESTED_ENLIGHT... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_ops.h |
static inline void clgi(void) { svm_asm(clgi); } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_ops.h |
static inline void invlpga(unsigned long addr, u32 asid) {
svm_asm2(invlpga, "c"(asid), "a"(addr));
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/svm/svm_ops.h | static __always_inline void vmsave(unsigned long pa) {
svm_asm1(vmsave, "a"(pa), "memory");
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_virtual_nmis(void) {
return vmcs_config.pin_based_exec_ctrl & PIN_BASED_VIRTUAL_NMIS &&
vmcs_config.cpu_based_exec_ctrl & CPU_BASED_NMI_WINDOW_EXITING;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_load_ia32_efer(void) {
return vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_EFER;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_need_tpr_shadow(struct kvm_vcpu *vcpu) {
return cpu_has_vmx_tpr_shadow() && lapic_in_kernel(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_ept(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENABLE_EPT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool vmx_umip_emulated(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_DESC;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_rdtscp(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENABLE_RDTSCP;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_unrestricted_guest(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_UNRESTRICTED_GUEST;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_virtual_intr_delivery(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl &
SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_invpcid(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENABLE_INVPCID;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_encls_vmexit(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_ENCLS_EXITING;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_tsc_scaling(void) {
return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_TSC_SCALING;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_flexpriority(void) {
return cpu_has_vmx_tpr_shadow() && cpu_has_vmx_virtualize_apic_accesses();
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_ept_execute_only(void) {
return vmx_capability.ept & VMX_EPT_EXECUTE_ONLY_BIT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_ept_mt_wb(void) {
return vmx_capability.ept & VMX_EPTP_WB_BIT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline int ept_caps_to_lpage_level(u32 ept_caps) {
if (ept_caps & VMX_EPT_1GB_PAGE_BIT)
return PG_LEVEL_1G;
if (ept_caps & VMX_EPT_2MB_PAGE_BIT)
return PG_LEVEL_2M;
return PG_LEVEL_4K;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_invept_global(void) {
return vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_invvpid_individual_addr(void) {
return vmx_capability.vpid & VMX_VPID_EXTENT_INDIVIDUAL_ADDR_BIT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline bool cpu_has_vmx_invvpid_single(void) {
return vmx_capability.vpid & VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/capabilities.h |
static inline u64 vmx_get_perf_capabilities(void) {
u64 perf_cap = PMU_CAP_FW_WRITES;
struct x86_pmu_lbr lbr;
u64 host_perf_cap = 0;
if (!enable_pmu)
return 0;
if (boot_cpu_has(X86_FEATURE_PDCM))
rdmsrl(MSR_IA32_PERF_CAPABILITIES, host_perf_cap);
if (x86_perf_get_lbr(&lbr) >= 0 && lbr.nr)
pe... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/evmcs.c | void nested_evmcs_filter_control_msr(struct kvm_vcpu *vcpu, u32 msr_index,
u64 *pdata) {
u32 ctl_low = (u32)*pdata;
u32 ctl_high = (u32)(*pdata >> 32);
u32 unsupported_ctrls;
switch (msr_index) {
case MSR_IA32_VMX_EXIT_CTLS:
case MSR_IA32_VMX_TRUE_EXIT_CTLS:
unsuppo... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/evmcs.h |
static inline void evmcs_write16(unsigned long field, u16 value) {
u16 clean_field;
int offset = get_evmcs_offset(field, &clean_field);
if (offset < 0)
return;
*(u16 *)((char *)current_evmcs + offset) = value;
current_evmcs->hv_clean_fields &= ~clean_field;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/evmcs.h | static inline u64 evmcs_read64(unsigned long field) { return 0; } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/evmcs.h | static inline u32 evmcs_read32(unsigned long field) { return 0; } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/evmcs.h | static inline u16 evmcs_read16(unsigned long field) { return 0; } | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/evmcs.h | static inline void evmcs_load(u64 phys_addr) {} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static inline bool vmx_control_verify(u32 control, u32 low, u32 high) {
return fixed_bits_valid(control, low, high);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static void vmx_switch_vmcs(struct kvm_vcpu *vcpu, struct loaded_vmcs *vmcs) {
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct loaded_vmcs *prev;
int cpu;
if (WARN_ON_ONCE(vmx->loaded_vmcs == vmcs))
return;
cpu = get_cpu();
prev = vmx->loaded_vmcs;
vmx->loaded_vmcs = vmcs;
vmx_vcpu_load_vmcs(vcpu, cpu... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static void free_nested(struct kvm_vcpu *vcpu) {
struct vcpu_vmx *vmx = to_vmx(vcpu);
if (WARN_ON_ONCE(vmx->loaded_vmcs != &vmx->vmcs01))
vmx_switch_vmcs(vcpu, &vmx->vmcs01);
if (!vmx->nested.vmxon && !vmx->nested.smm.vmxon)
return;
kvm_clear_request(KVM_REQ_GET_NESTED_STATE_PAGES, vcpu);
vmx->nes... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | void nested_vmx_free_vcpu(struct kvm_vcpu *vcpu) {
vcpu_load(vcpu);
vmx_leave_nested(vcpu);
vcpu_put(vcpu);
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static void nested_ept_new_eptp(struct kvm_vcpu *vcpu) {
struct vcpu_vmx *vmx = to_vmx(vcpu);
bool execonly = vmx->nested.msrs.ept_caps & VMX_EPT_EXECUTE_ONLY_BIT;
int ept_lpage_level = ept_caps_to_lpage_level(vmx->nested.msrs.ept_caps);
kvm_init_shadow_ept_mmu(vcpu, execonly, ept_lpage_level,
... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static inline void enable_x2apic_msr_intercepts(unsigned long *msr_bitmap) {
int msr;
for (msr = 0x800; msr <= 0x8ff; msr += BITS_PER_LONG) {
unsigned word = msr / BITS_PER_LONG;
msr_bitmap[word] = ~0;
msr_bitmap[word + (0x800 / sizeof(long))] = ~0;
}
}
#define BUILD_NVMX_MSR_INTERCEPT_HELPER(rw) ... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static inline void nested_vmx_set_intercept_for_msr(
struct vcpu_vmx *vmx, unsigned long *msr_bitmap_l1,
unsigned long *msr_bitmap_l0, u32 msr, int types) {
if (types & MSR_TYPE_R)
nested_vmx_set_msr_read_intercept(vmx, msr_bitmap_l1, msr_bitmap_l0, msr);
if (types & MSR_TYPE_W)
nested_vmx_set_msr_... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static int nested_vmx_check_apic_access_controls(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12) {
if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) &&
CC(!page_address_valid(vcpu, vmcs12->apic_access_addr)))
return -EINVAL;
else
retur... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static int nested_vmx_check_msr_switch(struct kvm_vcpu *vcpu, u32 count,
u64 addr) {
if (count == 0)
return 0;
if (!kvm_vcpu_is_legal_aligned_gpa(vcpu, addr, 16) ||
!kvm_vcpu_is_legal_gpa(vcpu,
(addr + count * sizeof(struct vmx_msr_entr... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static int nested_vmx_check_exit_msr_switch_controls(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12) {
if (CC(nested_vmx_check_msr_switch(vcpu, vmcs12->vm_exit_msr_load_count,
vmcs12->vm_exit_msr_load_addr)) ||
CC(nested_vm... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static int nested_vmx_check_entry_msr_switch_controls(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12) {
if (CC(nested_vmx_check_msr_switch(vcpu, vmcs12->vm_entry_msr_load_count,
vmcs12->vm_entry_msr_load_addr)))
return -EINV... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static int nested_vmx_msr_check_common(struct kvm_vcpu *vcpu,
struct vmx_msr_entry *e) {
if (CC(vcpu->arch.apic_base & X2APIC_ENABLE && e->index >> 8 == 0x8))
return -EINVAL;
if (CC(e->index == MSR_IA32_UCODE_WRITE) || /* SDM Table 35-2 */
CC(e->index == MSR_IA32_UC... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static u32 nested_vmx_load_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count) {
u32 i;
struct vmx_msr_entry e;
u32 max_msr_list_size = nested_vmx_max_atomic_switch_msrs(vcpu);
for (i = 0; i < count; i++) {
if (unlikely(i >= max_msr_list_size))
goto fail;
if (kvm_vcpu_read_guest(vcpu, gpa + i * sizeo... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static void prepare_vmx_msr_autostore_list(struct kvm_vcpu *vcpu,
u32 msr_index) {
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct vmx_msrs *autostore = &vmx->msr_autostore.guest;
bool in_vmcs12_store_list;
int msr_autostore_slot;
bool in_autostore_list;
int last;
m... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static int vmx_restore_vmx_misc(struct vcpu_vmx *vmx, u64 data) {
const u64 feature_and_reserved_bits =
BIT_ULL(5) | GENMASK_ULL(8, 6) | BIT_ULL(14) | BIT_ULL(15) | BIT_ULL(28) |
BIT_ULL(29) | BIT_ULL(30) |
/* reserved */
GENMASK_ULL(13, 9) | BIT_ULL(31);
u64 vmx_misc = vmx_control_msr(vmcs... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static int vmx_restore_fixed0_msr(struct vcpu_vmx *vmx, u32 msr_index,
u64 data) {
const u64 *msr = vmx_get_fixed0_msr(&vmcs_config.nested, msr_index);
if (!is_bitwise_subset(data, *msr, -1ULL))
return -EINVAL;
*vmx_get_fixed0_msr(&vmx->nested.msrs, msr_index) = data;
ret... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static void prepare_vmcs02_early_rare(struct vcpu_vmx *vmx,
struct vmcs12 *vmcs12) {
prepare_vmcs02_constant_state(vmx);
vmcs_write64(VMCS_LINK_POINTER, INVALID_GPA);
if (enable_vpid) {
if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02)
vmcs_write16(VIRTUAL_P... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static int nested_vmx_check_address_space_size(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12) {
#ifdef CONFIG_X86_64
if (CC(!!(vmcs12->vm_exit_controls & VM_EXIT_HOST_ADDR_SPACE_SIZE) !=
!!(vcpu->arch.efer & EFER_LMA)))
return -EINVAL;
#endif
return 0;
} | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static int nested_vmx_check_vmcs_link_ptr(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12) {
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct gfn_to_hva_cache *ghc = &vmx->nested.shadow_vmcs12_cache;
struct vmcs_hdr hdr;
if (vmcs12->vmcs_link_pointer == INVALID_GPA)
retur... | [
1,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static inline unsigned long vmcs12_guest_cr4(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12) {
return (vmcs_readl(GUEST_CR4) & vcpu->arch.cr4_guest_owned_bits) |
/*2*/ (vmcs12->guest_cr4 & vmcs12->cr4_guest_host_mask) |
/*3*/
(vmcs_readl(CR4_READ_S... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static void vmcs12_save_pending_event(struct kvm_vcpu *vcpu,
struct vmcs12 *vmcs12, u32 vm_exit_reason,
u32 exit_intr_info) {
u32 idt_vectoring;
unsigned int nr;
if ((u16)vm_exit_reason == EXIT_REASON_TRIPLE_FAULT ||
((u16)vm_exit_... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static bool nested_vmx_preemption_timer_pending(struct kvm_vcpu *vcpu) {
return nested_cpu_has_preemption_timer(get_vmcs12(vcpu)) &&
to_vmx(vcpu)->nested.preemption_timer_expired;
} | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c |
static u32 vmx_get_preemption_timer_value(struct kvm_vcpu *vcpu) {
ktime_t remaining =
hrtimer_get_remaining(&to_vmx(vcpu)->nested.preemption_timer);
u64 value;
if (ktime_to_ns(remaining) <= 0)
return 0;
value = ktime_to_ns(remaining) * vcpu->arch.virtual_tsc_khz;
do_div(value, 1000000);
return... | [
0,
0
] |
Linux Kernel | arch/x86/kvm/vmx/nested.c | static inline void nested_release_vmcs12(struct kvm_vcpu *vcpu) {
struct vcpu_vmx *vmx = to_vmx(vcpu);
if (vmx->nested.current_vmptr == INVALID_GPA)
return;
copy_vmcs02_to_vmcs12_rare(vcpu, get_vmcs12(vcpu));
if (enable_shadow_vmcs) {
copy_shadow_to_vmcs12(vmx);
vmx_disable_shadow_vmcs(vmx);
}... | [
0,
0
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.