Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nVMX: Advertise PML to L1 hypervisor

Advertise the PML bit in vmcs12 but don't try to enable
it in hardware when running L2 since L0 is emulating it. Also,
preserve L0's settings for PML since it may still
want to log writes.

Signed-off-by: Bandan Das <bsd@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

authored by

Bandan Das and committed by
Paolo Bonzini
03efce6f c5f983f6

+11 -5
+11 -5
arch/x86/kvm/vmx.c
··· 2766 2766 vmx->nested.nested_vmx_ept_caps |= VMX_EPT_EXTENT_GLOBAL_BIT | 2767 2767 VMX_EPT_EXTENT_CONTEXT_BIT | VMX_EPT_2MB_PAGE_BIT | 2768 2768 VMX_EPT_1GB_PAGE_BIT; 2769 - if (enable_ept_ad_bits) 2769 + if (enable_ept_ad_bits) { 2770 + vmx->nested.nested_vmx_secondary_ctls_high |= 2771 + SECONDARY_EXEC_ENABLE_PML; 2770 2772 vmx->nested.nested_vmx_ept_caps |= VMX_EPT_AD_BIT; 2773 + } 2771 2774 } else 2772 2775 vmx->nested.nested_vmx_ept_caps = 0; 2773 2776 ··· 8132 8129 case EXIT_REASON_PREEMPTION_TIMER: 8133 8130 return false; 8134 8131 case EXIT_REASON_PML_FULL: 8135 - /* We don't expose PML support to L1. */ 8132 + /* We emulate PML support to L1. */ 8136 8133 return false; 8137 8134 default: 8138 8135 return true; ··· 9927 9924 bool from_vmentry, u32 *entry_failure_code) 9928 9925 { 9929 9926 struct vcpu_vmx *vmx = to_vmx(vcpu); 9930 - u32 exec_control; 9927 + u32 exec_control, vmcs12_exec_ctrl; 9931 9928 9932 9929 vmcs_write16(GUEST_ES_SELECTOR, vmcs12->guest_es_selector); 9933 9930 vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector); ··· 10058 10055 SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | 10059 10056 SECONDARY_EXEC_APIC_REGISTER_VIRT); 10060 10057 if (nested_cpu_has(vmcs12, 10061 - CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)) 10062 - exec_control |= vmcs12->secondary_vm_exec_control; 10058 + CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)) { 10059 + vmcs12_exec_ctrl = vmcs12->secondary_vm_exec_control & 10060 + ~SECONDARY_EXEC_ENABLE_PML; 10061 + exec_control |= vmcs12_exec_ctrl; 10062 + } 10063 10063 10064 10064 if (exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) { 10065 10065 vmcs_write64(EOI_EXIT_BITMAP0,