On Mon, Apr 27, 2009 at 05:47:44PM +0800, Sheng Yang wrote:
> mt_mask is out of date, now it have only been used as a flag to indicate if 
> TDP
> enabled. Get rid of it and use tdp_enabled instead.

I realized this one break NPT on my way home... Would update the patches
soon.

-- 
regards
Yang, Sheng     |Intel Opensource Technology Center

> Signed-off-by: Sheng Yang <[email protected]>
> ---
>  arch/x86/include/asm/kvm_host.h |    2 +-
>  arch/x86/kvm/mmu.c              |    8 +++-----
>  arch/x86/kvm/vmx.c              |    3 +--
>  arch/x86/kvm/x86.c              |    2 +-
>  4 files changed, 6 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index cb306cf..ba6906f 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -537,7 +537,7 @@ int kvm_mmu_setup(struct kvm_vcpu *vcpu);
>  void kvm_mmu_set_nonpresent_ptes(u64 trap_pte, u64 notrap_pte);
>  void kvm_mmu_set_base_ptes(u64 base_pte);
>  void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
> -             u64 dirty_mask, u64 nx_mask, u64 x_mask, u64 mt_mask);
> +             u64 dirty_mask, u64 nx_mask, u64 x_mask);
>  
>  int kvm_mmu_reset_context(struct kvm_vcpu *vcpu);
>  void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot);
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index 5b79afa..55c6923 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -178,7 +178,6 @@ static u64 __read_mostly shadow_x_mask;   /* mutual 
> exclusive with nx_mask */
>  static u64 __read_mostly shadow_user_mask;
>  static u64 __read_mostly shadow_accessed_mask;
>  static u64 __read_mostly shadow_dirty_mask;
> -static u64 __read_mostly shadow_mt_mask;
>  
>  static inline u64 rsvd_bits(int s, int e)
>  {
> @@ -199,14 +198,13 @@ void kvm_mmu_set_base_ptes(u64 base_pte)
>  EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes);
>  
>  void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask,
> -             u64 dirty_mask, u64 nx_mask, u64 x_mask, u64 mt_mask)
> +             u64 dirty_mask, u64 nx_mask, u64 x_mask)
>  {
>       shadow_user_mask = user_mask;
>       shadow_accessed_mask = accessed_mask;
>       shadow_dirty_mask = dirty_mask;
>       shadow_nx_mask = nx_mask;
>       shadow_x_mask = x_mask;
> -     shadow_mt_mask = mt_mask;
>  }
>  EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes);
>  
> @@ -1670,7 +1668,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 
> *shadow_pte,
>  {
>       u64 spte;
>       int ret = 0;
> -     u64 mt_mask = shadow_mt_mask;
> +     u64 mt_mask;
>  
>       /*
>        * We don't set the accessed bit, since we sometimes want to see
> @@ -1690,7 +1688,7 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 
> *shadow_pte,
>               spte |= shadow_user_mask;
>       if (largepage)
>               spte |= PT_PAGE_SIZE_MASK;
> -     if (mt_mask) {
> +     if (tdp_enabled) {
>               if (!kvm_is_mmio_pfn(pfn)) {
>                       mt_mask = get_memory_type(vcpu, gfn) <<
>                               kvm_x86_ops->get_mt_mask_shift();
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index c6997c0..85db8b2 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -3796,8 +3796,7 @@ static int __init vmx_init(void)
>               kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK |
>                       VMX_EPT_WRITABLE_MASK);
>               kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull,
> -                             VMX_EPT_EXECUTABLE_MASK,
> -                             VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT);
> +                             VMX_EPT_EXECUTABLE_MASK);
>               kvm_enable_tdp();
>       } else
>               kvm_disable_tdp();
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 8cb8542..76adda4 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -2768,7 +2768,7 @@ int kvm_arch_init(void *opaque)
>       kvm_mmu_set_nonpresent_ptes(0ull, 0ull);
>       kvm_mmu_set_base_ptes(PT_PRESENT_MASK);
>       kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
> -                     PT_DIRTY_MASK, PT64_NX_MASK, 0, 0);
> +                     PT_DIRTY_MASK, PT64_NX_MASK, 0);
>  
>       for_each_possible_cpu(cpu)
>               per_cpu(cpu_tsc_khz, cpu) = tsc_khz;
> -- 
> 1.5.4.5
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to [email protected]
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to