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/mmu.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/mmu.c')
-rw-r--r-- | arch/x86/kvm/mmu.c | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 3592aea59ef7..bc614f91f5ba 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 */ | |||
178 | static u64 __read_mostly shadow_user_mask; | 178 | static u64 __read_mostly shadow_user_mask; |
179 | static u64 __read_mostly shadow_accessed_mask; | 179 | static u64 __read_mostly shadow_accessed_mask; |
180 | static u64 __read_mostly shadow_dirty_mask; | 180 | static u64 __read_mostly shadow_dirty_mask; |
181 | static u64 __read_mostly shadow_mt_mask; | ||
182 | 181 | ||
183 | static inline u64 rsvd_bits(int s, int e) | 182 | static inline u64 rsvd_bits(int s, int e) |
184 | { | 183 | { |
@@ -199,14 +198,13 @@ void kvm_mmu_set_base_ptes(u64 base_pte) | |||
199 | EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes); | 198 | EXPORT_SYMBOL_GPL(kvm_mmu_set_base_ptes); |
200 | 199 | ||
201 | void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, | 200 | void kvm_mmu_set_mask_ptes(u64 user_mask, u64 accessed_mask, |
202 | u64 dirty_mask, u64 nx_mask, u64 x_mask, u64 mt_mask) | 201 | u64 dirty_mask, u64 nx_mask, u64 x_mask) |
203 | { | 202 | { |
204 | shadow_user_mask = user_mask; | 203 | shadow_user_mask = user_mask; |
205 | shadow_accessed_mask = accessed_mask; | 204 | shadow_accessed_mask = accessed_mask; |
206 | shadow_dirty_mask = dirty_mask; | 205 | shadow_dirty_mask = dirty_mask; |
207 | shadow_nx_mask = nx_mask; | 206 | shadow_nx_mask = nx_mask; |
208 | shadow_x_mask = x_mask; | 207 | shadow_x_mask = x_mask; |
209 | shadow_mt_mask = mt_mask; | ||
210 | } | 208 | } |
211 | EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes); | 209 | EXPORT_SYMBOL_GPL(kvm_mmu_set_mask_ptes); |
212 | 210 | ||
@@ -1608,7 +1606,7 @@ static int get_mtrr_type(struct mtrr_state_type *mtrr_state, | |||
1608 | return mtrr_state->def_type; | 1606 | return mtrr_state->def_type; |
1609 | } | 1607 | } |
1610 | 1608 | ||
1611 | static u8 get_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) | 1609 | u8 kvm_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) |
1612 | { | 1610 | { |
1613 | u8 mtrr; | 1611 | u8 mtrr; |
1614 | 1612 | ||
@@ -1618,6 +1616,7 @@ static u8 get_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn) | |||
1618 | mtrr = MTRR_TYPE_WRBACK; | 1616 | mtrr = MTRR_TYPE_WRBACK; |
1619 | return mtrr; | 1617 | return mtrr; |
1620 | } | 1618 | } |
1619 | EXPORT_SYMBOL_GPL(kvm_get_guest_memory_type); | ||
1621 | 1620 | ||
1622 | static int kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) | 1621 | static int kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) |
1623 | { | 1622 | { |
@@ -1670,7 +1669,6 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
1670 | { | 1669 | { |
1671 | u64 spte; | 1670 | u64 spte; |
1672 | int ret = 0; | 1671 | int ret = 0; |
1673 | u64 mt_mask = shadow_mt_mask; | ||
1674 | 1672 | ||
1675 | /* | 1673 | /* |
1676 | * We don't set the accessed bit, since we sometimes want to see | 1674 | * We don't set the accessed bit, since we sometimes want to see |
@@ -1690,16 +1688,9 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *shadow_pte, | |||
1690 | spte |= shadow_user_mask; | 1688 | spte |= shadow_user_mask; |
1691 | if (largepage) | 1689 | if (largepage) |
1692 | spte |= PT_PAGE_SIZE_MASK; | 1690 | spte |= PT_PAGE_SIZE_MASK; |
1693 | if (mt_mask) { | 1691 | if (tdp_enabled) |
1694 | if (!kvm_is_mmio_pfn(pfn)) { | 1692 | spte |= kvm_x86_ops->get_mt_mask(vcpu, gfn, |
1695 | mt_mask = get_memory_type(vcpu, gfn) << | 1693 | kvm_is_mmio_pfn(pfn)); |
1696 | kvm_x86_ops->get_mt_mask_shift(); | ||
1697 | mt_mask |= VMX_EPT_IGMT_BIT; | ||
1698 | } else | ||
1699 | mt_mask = MTRR_TYPE_UNCACHABLE << | ||
1700 | kvm_x86_ops->get_mt_mask_shift(); | ||
1701 | spte |= mt_mask; | ||
1702 | } | ||
1703 | 1694 | ||
1704 | spte |= (u64)pfn << PAGE_SHIFT; | 1695 | spte |= (u64)pfn << PAGE_SHIFT; |
1705 | 1696 | ||