lkml.org 
[lkml]   [2022]   [Sep]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v9 051/105] KVM: VMX: Move setting of EPT MMU masks to common VT-x code
    Date
    From: Sean Christopherson <sean.j.christopherson@intel.com>

    EPT MMU masks are used commonly for VMX and TDX. The value needs to be
    initialized in common code before both VMX/TDX-specific initialization
    code.

    Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
    Signed-off-by: Isaku Yamahata <isaku.yamahata@intel.com>
    ---
    arch/x86/kvm/vmx/main.c | 5 +++++
    arch/x86/kvm/vmx/vmx.c | 4 ----
    2 files changed, 5 insertions(+), 4 deletions(-)

    diff --git a/arch/x86/kvm/vmx/main.c b/arch/x86/kvm/vmx/main.c
    index fe927aaee114..03fc1986227b 100644
    --- a/arch/x86/kvm/vmx/main.c
    +++ b/arch/x86/kvm/vmx/main.c
    @@ -4,6 +4,7 @@
    #include "x86_ops.h"
    #include "vmx.h"
    #include "nested.h"
    +#include "mmu.h"
    #include "pmu.h"
    #include "tdx.h"

    @@ -26,6 +27,10 @@ static __init int vt_hardware_setup(void)

    enable_tdx = enable_tdx && !tdx_hardware_setup(&vt_x86_ops);

    + if (enable_ept)
    + kvm_mmu_set_ept_masks(enable_ept_ad_bits,
    + cpu_has_vmx_ept_execute_only());
    +
    return 0;
    }

    diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
    index ec1570b151f5..d78f37e2e2af 100644
    --- a/arch/x86/kvm/vmx/vmx.c
    +++ b/arch/x86/kvm/vmx/vmx.c
    @@ -8259,10 +8259,6 @@ __init int vmx_hardware_setup(void)

    set_bit(0, vmx_vpid_bitmap); /* 0 is reserved for host */

    - if (enable_ept)
    - kvm_mmu_set_ept_masks(enable_ept_ad_bits,
    - cpu_has_vmx_ept_execute_only());
    -
    /*
    * Setup shadow_me_value/shadow_me_mask to include MKTME KeyID
    * bits to shadow_zero_check.
    --
    2.25.1
    \
     
     \ /
      Last update: 2022-09-30 12:26    [W:4.094 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site