vmx.c (d6b87f256591cf6be78825db6a09a5218666e539) vmx.c (e7b7bdea77f3277fe49f714c983d0f38f7cb0d86)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Kernel-based Virtual Machine driver for Linux
4 *
5 * This module enables machines with Intel VT-x extensions to run virtual
6 * machines without emulation or binary translation.
7 *
8 * Copyright (C) 2006 Qumranet, Inc.

--- 5429 unchanged lines hidden (view full) ---

5438
5439 if (vmx->ple_window != old) {
5440 vmx->ple_window_dirty = true;
5441 trace_kvm_ple_window_update(vcpu->vcpu_id,
5442 vmx->ple_window, old);
5443 }
5444}
5445
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Kernel-based Virtual Machine driver for Linux
4 *
5 * This module enables machines with Intel VT-x extensions to run virtual
6 * machines without emulation or binary translation.
7 *
8 * Copyright (C) 2006 Qumranet, Inc.

--- 5429 unchanged lines hidden (view full) ---

5438
5439 if (vmx->ple_window != old) {
5440 vmx->ple_window_dirty = true;
5441 trace_kvm_ple_window_update(vcpu->vcpu_id,
5442 vmx->ple_window, old);
5443 }
5444}
5445
5446static void vmx_enable_tdp(void)
5447{
5448 kvm_mmu_set_mask_ptes(VMX_EPT_READABLE_MASK,
5449 enable_ept_ad_bits ? VMX_EPT_ACCESS_BIT : 0ull,
5450 enable_ept_ad_bits ? VMX_EPT_DIRTY_BIT : 0ull,
5451 0ull, VMX_EPT_EXECUTABLE_MASK,
5452 cpu_has_vmx_ept_execute_only() ? 0ull : VMX_EPT_READABLE_MASK,
5453 VMX_EPT_RWX_MASK, 0ull);
5454
5455 /*
5456 * EPT Misconfigurations can be generated if the value of bits 2:0
5457 * of an EPT paging-structure entry is 110b (write/execute).
5458 */
5459 kvm_mmu_set_mmio_spte_mask(VMX_EPT_MISCONFIG_WX_VALUE,
5460 VMX_EPT_RWX_MASK, 0);
5461}
5462
5463/*
5464 * Indicate a busy-waiting vcpu in spinlock. We do not enable the PAUSE
5465 * exiting, so only get here on cpu with PAUSE-Loop-Exiting.
5466 */
5467static int handle_pause(struct kvm_vcpu *vcpu)
5468{
5469 if (!kvm_pause_in_guest(vcpu->kvm))
5470 grow_ple_window(vcpu);

--- 2312 unchanged lines hidden (view full) ---

7783 kvm_tsc_scaling_ratio_frac_bits = 48;
7784 }
7785
7786 kvm_has_bus_lock_exit = cpu_has_vmx_bus_lock_detection();
7787
7788 set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */
7789
7790 if (enable_ept)
5446/*
5447 * Indicate a busy-waiting vcpu in spinlock. We do not enable the PAUSE
5448 * exiting, so only get here on cpu with PAUSE-Loop-Exiting.
5449 */
5450static int handle_pause(struct kvm_vcpu *vcpu)
5451{
5452 if (!kvm_pause_in_guest(vcpu->kvm))
5453 grow_ple_window(vcpu);

--- 2312 unchanged lines hidden (view full) ---

7766 kvm_tsc_scaling_ratio_frac_bits = 48;
7767 }
7768
7769 kvm_has_bus_lock_exit = cpu_has_vmx_bus_lock_detection();
7770
7771 set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */
7772
7773 if (enable_ept)
7791 vmx_enable_tdp();
7774 kvm_mmu_set_ept_masks(enable_ept_ad_bits,
7775 cpu_has_vmx_ept_execute_only());
7792
7793 if (!enable_ept)
7794 ept_lpage_level = 0;
7795 else if (cpu_has_vmx_ept_1g_page())
7796 ept_lpage_level = PG_LEVEL_1G;
7797 else if (cpu_has_vmx_ept_2m_page())
7798 ept_lpage_level = PG_LEVEL_2M;
7799 else

--- 203 unchanged lines hidden ---
7776
7777 if (!enable_ept)
7778 ept_lpage_level = 0;
7779 else if (cpu_has_vmx_ept_1g_page())
7780 ept_lpage_level = PG_LEVEL_1G;
7781 else if (cpu_has_vmx_ept_2m_page())
7782 ept_lpage_level = PG_LEVEL_2M;
7783 else

--- 203 unchanged lines hidden ---