diff options
author | Sheng Yang <sheng@linux.intel.com> | 2009-04-27 08:35:42 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2009-06-10 04:48:49 -0400 |
commit | 4b12f0de33a64dfc624b2480f55b674f7fa23ef2 (patch) | |
tree | ed12e1230b777add7aae2b7d24fa82f8e4efbb34 /arch/x86/kvm/vmx.c | |
parent | 9b62e5b10ff0f98346bcbe4a4fe3a0ca8fa7be30 (diff) |
KVM: Replace get_mt_mask_shift with get_mt_mask
Shadow_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.
Also put memory type logical in kvm_x86_ops->get_mt_mask().
Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/vmx.c')
-rw-r--r-- | arch/x86/kvm/vmx.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 25be53aa5eef..59b080c262e8 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c | |||
@@ -3577,9 +3577,17 @@ static int get_ept_level(void) | |||
3577 | return VMX_EPT_DEFAULT_GAW + 1; | 3577 | return VMX_EPT_DEFAULT_GAW + 1; |
3578 | } | 3578 | } |
3579 | 3579 | ||
3580 | static int vmx_get_mt_mask_shift(void) | 3580 | static u64 vmx_get_mt_mask(struct kvm_vcpu *vcpu, gfn_t gfn, bool is_mmio) |
3581 | { | 3581 | { |
3582 | return VMX_EPT_MT_EPTE_SHIFT; | 3582 | u64 ret; |
3583 | |||
3584 | if (is_mmio) | ||
3585 | ret = MTRR_TYPE_UNCACHABLE << VMX_EPT_MT_EPTE_SHIFT; | ||
3586 | else | ||
3587 | ret = (kvm_get_guest_memory_type(vcpu, gfn) << | ||
3588 | VMX_EPT_MT_EPTE_SHIFT) | VMX_EPT_IGMT_BIT; | ||
3589 | |||
3590 | return ret; | ||
3583 | } | 3591 | } |
3584 | 3592 | ||
3585 | static struct kvm_x86_ops vmx_x86_ops = { | 3593 | static struct kvm_x86_ops vmx_x86_ops = { |
@@ -3639,7 +3647,7 @@ static struct kvm_x86_ops vmx_x86_ops = { | |||
3639 | 3647 | ||
3640 | .set_tss_addr = vmx_set_tss_addr, | 3648 | .set_tss_addr = vmx_set_tss_addr, |
3641 | .get_tdp_level = get_ept_level, | 3649 | .get_tdp_level = get_ept_level, |
3642 | .get_mt_mask_shift = vmx_get_mt_mask_shift, | 3650 | .get_mt_mask = vmx_get_mt_mask, |
3643 | }; | 3651 | }; |
3644 | 3652 | ||
3645 | static int __init vmx_init(void) | 3653 | static int __init vmx_init(void) |
@@ -3698,8 +3706,7 @@ static int __init vmx_init(void) | |||
3698 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | | 3706 | kvm_mmu_set_base_ptes(VMX_EPT_READABLE_MASK | |
3699 | VMX_EPT_WRITABLE_MASK); | 3707 | VMX_EPT_WRITABLE_MASK); |
3700 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, | 3708 | kvm_mmu_set_mask_ptes(0ull, 0ull, 0ull, 0ull, |
3701 | VMX_EPT_EXECUTABLE_MASK, | 3709 | VMX_EPT_EXECUTABLE_MASK); |
3702 | VMX_EPT_DEFAULT_MT << VMX_EPT_MT_EPTE_SHIFT); | ||
3703 | kvm_enable_tdp(); | 3710 | kvm_enable_tdp(); |
3704 | } else | 3711 | } else |
3705 | kvm_disable_tdp(); | 3712 | kvm_disable_tdp(); |