aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm
diff options
context:
space:
mode:
authorKai Huang <kai.huang@linux.intel.com>2015-01-27 21:54:23 -0500
committerPaolo Bonzini <pbonzini@redhat.com>2015-01-29 09:30:38 -0500
commit3b0f1d01e501792d8d89ab4371bc9e8cd2a10032 (patch)
treed9c509027636a5bb3ba2f811dada48bddb1245e7 /arch/x86/kvm
parentb0165f1b415daeedab78455aaac529aaec6007dd (diff)
KVM: Rename kvm_arch_mmu_write_protect_pt_masked to be more generic for log dirty
We don't have to write protect guest memory for dirty logging if architecture supports hardware dirty logging, such as PML on VMX, so rename it to be more generic. Signed-off-by: Kai Huang <kai.huang@linux.intel.com> Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'arch/x86/kvm')
-rw-r--r--arch/x86/kvm/mmu.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 0ed9f795e4f0..b18e65ce3683 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1216,7 +1216,7 @@ static bool __rmap_write_protect(struct kvm *kvm, unsigned long *rmapp,
1216} 1216}
1217 1217
1218/** 1218/**
1219 * kvm_arch_mmu_write_protect_pt_masked - write protect selected PT level pages 1219 * kvm_mmu_write_protect_pt_masked - write protect selected PT level pages
1220 * @kvm: kvm instance 1220 * @kvm: kvm instance
1221 * @slot: slot to protect 1221 * @slot: slot to protect
1222 * @gfn_offset: start of the BITS_PER_LONG pages we care about 1222 * @gfn_offset: start of the BITS_PER_LONG pages we care about
@@ -1225,7 +1225,7 @@ static bool __rmap_write_protect(struct kvm *kvm, unsigned long *rmapp,
1225 * Used when we do not need to care about huge page mappings: e.g. during dirty 1225 * Used when we do not need to care about huge page mappings: e.g. during dirty
1226 * logging we do not have any such mappings. 1226 * logging we do not have any such mappings.
1227 */ 1227 */
1228void kvm_arch_mmu_write_protect_pt_masked(struct kvm *kvm, 1228static void kvm_mmu_write_protect_pt_masked(struct kvm *kvm,
1229 struct kvm_memory_slot *slot, 1229 struct kvm_memory_slot *slot,
1230 gfn_t gfn_offset, unsigned long mask) 1230 gfn_t gfn_offset, unsigned long mask)
1231{ 1231{
@@ -1241,6 +1241,23 @@ void kvm_arch_mmu_write_protect_pt_masked(struct kvm *kvm,
1241 } 1241 }
1242} 1242}
1243 1243
1244/**
1245 * kvm_arch_mmu_enable_log_dirty_pt_masked - enable dirty logging for selected
1246 * PT level pages.
1247 *
1248 * It calls kvm_mmu_write_protect_pt_masked to write protect selected pages to
1249 * enable dirty logging for them.
1250 *
1251 * Used when we do not need to care about huge page mappings: e.g. during dirty
1252 * logging we do not have any such mappings.
1253 */
1254void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
1255 struct kvm_memory_slot *slot,
1256 gfn_t gfn_offset, unsigned long mask)
1257{
1258 kvm_mmu_write_protect_pt_masked(kvm, slot, gfn_offset, mask);
1259}
1260
1244static bool rmap_write_protect(struct kvm *kvm, u64 gfn) 1261static bool rmap_write_protect(struct kvm *kvm, u64 gfn)
1245{ 1262{
1246 struct kvm_memory_slot *slot; 1263 struct kvm_memory_slot *slot;