1 // SPDX-License-Identifier: GPL-2.0 1 2 #include <linux/moduleparam.h> 3 4 #include "x86_ops.h" 5 #include "vmx.h" 6 #include "nested.h" 7 #include "pmu.h" 8 #include "posted_intr.h" 9 10 #define VMX_REQUIRED_APICV_INHIBITS 11 (BIT(APICV_INHIBIT_REASON_DISABLED) | 12 BIT(APICV_INHIBIT_REASON_ABSENT) | 13 BIT(APICV_INHIBIT_REASON_HYPERV) | 14 BIT(APICV_INHIBIT_REASON_BLOCKIRQ) | 15 BIT(APICV_INHIBIT_REASON_PHYSICAL_ID_ 16 BIT(APICV_INHIBIT_REASON_APIC_ID_MODI 17 BIT(APICV_INHIBIT_REASON_APIC_BASE_MO 18 19 struct kvm_x86_ops vt_x86_ops __initdata = { 20 .name = KBUILD_MODNAME, 21 22 .check_processor_compatibility = vmx_c 23 24 .hardware_unsetup = vmx_hardware_unset 25 26 .enable_virtualization_cpu = vmx_enabl 27 .disable_virtualization_cpu = vmx_disa 28 .emergency_disable_virtualization_cpu 29 30 .has_emulated_msr = vmx_has_emulated_m 31 32 .vm_size = sizeof(struct kvm_vmx), 33 .vm_init = vmx_vm_init, 34 .vm_destroy = vmx_vm_destroy, 35 36 .vcpu_precreate = vmx_vcpu_precreate, 37 .vcpu_create = vmx_vcpu_create, 38 .vcpu_free = vmx_vcpu_free, 39 .vcpu_reset = vmx_vcpu_reset, 40 41 .prepare_switch_to_guest = vmx_prepare 42 .vcpu_load = vmx_vcpu_load, 43 .vcpu_put = vmx_vcpu_put, 44 45 .update_exception_bitmap = vmx_update_ 46 .get_feature_msr = vmx_get_feature_msr 47 .get_msr = vmx_get_msr, 48 .set_msr = vmx_set_msr, 49 .get_segment_base = vmx_get_segment_ba 50 .get_segment = vmx_get_segment, 51 .set_segment = vmx_set_segment, 52 .get_cpl = vmx_get_cpl, 53 .get_cs_db_l_bits = vmx_get_cs_db_l_bi 54 .is_valid_cr0 = vmx_is_valid_cr0, 55 .set_cr0 = vmx_set_cr0, 56 .is_valid_cr4 = vmx_is_valid_cr4, 57 .set_cr4 = vmx_set_cr4, 58 .set_efer = vmx_set_efer, 59 .get_idt = vmx_get_idt, 60 .set_idt = vmx_set_idt, 61 .get_gdt = vmx_get_gdt, 62 .set_gdt = vmx_set_gdt, 63 .set_dr7 = vmx_set_dr7, 64 .sync_dirty_debug_regs = vmx_sync_dirt 65 .cache_reg = vmx_cache_reg, 66 .get_rflags = vmx_get_rflags, 67 .set_rflags = vmx_set_rflags, 68 .get_if_flag = vmx_get_if_flag, 69 70 .flush_tlb_all = vmx_flush_tlb_all, 71 .flush_tlb_current = vmx_flush_tlb_cur 72 .flush_tlb_gva = vmx_flush_tlb_gva, 73 .flush_tlb_guest = vmx_flush_tlb_guest 74 75 .vcpu_pre_run = vmx_vcpu_pre_run, 76 .vcpu_run = vmx_vcpu_run, 77 .handle_exit = vmx_handle_exit, 78 .skip_emulated_instruction = vmx_skip_ 79 .update_emulated_instruction = vmx_upd 80 .set_interrupt_shadow = vmx_set_interr 81 .get_interrupt_shadow = vmx_get_interr 82 .patch_hypercall = vmx_patch_hypercall 83 .inject_irq = vmx_inject_irq, 84 .inject_nmi = vmx_inject_nmi, 85 .inject_exception = vmx_inject_excepti 86 .cancel_injection = vmx_cancel_injecti 87 .interrupt_allowed = vmx_interrupt_all 88 .nmi_allowed = vmx_nmi_allowed, 89 .get_nmi_mask = vmx_get_nmi_mask, 90 .set_nmi_mask = vmx_set_nmi_mask, 91 .enable_nmi_window = vmx_enable_nmi_wi 92 .enable_irq_window = vmx_enable_irq_wi 93 .update_cr8_intercept = vmx_update_cr8 94 95 .x2apic_icr_is_split = false, 96 .set_virtual_apic_mode = vmx_set_virtu 97 .set_apic_access_page_addr = vmx_set_a 98 .refresh_apicv_exec_ctrl = vmx_refresh 99 .load_eoi_exitmap = vmx_load_eoi_exitm 100 .apicv_pre_state_restore = vmx_apicv_p 101 .required_apicv_inhibits = VMX_REQUIRE 102 .hwapic_irr_update = vmx_hwapic_irr_up 103 .hwapic_isr_update = vmx_hwapic_isr_up 104 .sync_pir_to_irr = vmx_sync_pir_to_irr 105 .deliver_interrupt = vmx_deliver_inter 106 .dy_apicv_has_pending_interrupt = pi_h 107 108 .set_tss_addr = vmx_set_tss_addr, 109 .set_identity_map_addr = vmx_set_ident 110 .get_mt_mask = vmx_get_mt_mask, 111 112 .get_exit_info = vmx_get_exit_info, 113 114 .vcpu_after_set_cpuid = vmx_vcpu_after 115 116 .has_wbinvd_exit = cpu_has_vmx_wbinvd_ 117 118 .get_l2_tsc_offset = vmx_get_l2_tsc_of 119 .get_l2_tsc_multiplier = vmx_get_l2_ts 120 .write_tsc_offset = vmx_write_tsc_offs 121 .write_tsc_multiplier = vmx_write_tsc_ 122 123 .load_mmu_pgd = vmx_load_mmu_pgd, 124 125 .check_intercept = vmx_check_intercept 126 .handle_exit_irqoff = vmx_handle_exit_ 127 128 .cpu_dirty_log_size = PML_ENTITY_NUM, 129 .update_cpu_dirty_logging = vmx_update 130 131 .nested_ops = &vmx_nested_ops, 132 133 .pi_update_irte = vmx_pi_update_irte, 134 .pi_start_assignment = vmx_pi_start_as 135 136 #ifdef CONFIG_X86_64 137 .set_hv_timer = vmx_set_hv_timer, 138 .cancel_hv_timer = vmx_cancel_hv_timer 139 #endif 140 141 .setup_mce = vmx_setup_mce, 142 143 #ifdef CONFIG_KVM_SMM 144 .smi_allowed = vmx_smi_allowed, 145 .enter_smm = vmx_enter_smm, 146 .leave_smm = vmx_leave_smm, 147 .enable_smi_window = vmx_enable_smi_wi 148 #endif 149 150 .check_emulate_instruction = vmx_check 151 .apic_init_signal_blocked = vmx_apic_i 152 .migrate_timers = vmx_migrate_timers, 153 154 .msr_filter_changed = vmx_msr_filter_c 155 .complete_emulated_msr = kvm_complete_ 156 157 .vcpu_deliver_sipi_vector = kvm_vcpu_d 158 159 .get_untagged_addr = vmx_get_untagged_ 160 }; 161 162 struct kvm_x86_init_ops vt_init_ops __initdata 163 .hardware_setup = vmx_hardware_setup, 164 .handle_intel_pt_intr = NULL, 165 166 .runtime_ops = &vt_x86_ops, 167 .pmu_ops = &intel_pmu_ops, 168 }; 169
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.