aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kvm/mmu.c
diff options
context:
space:
mode:
authorXiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>2012-06-20 03:56:53 -0400
committerAvi Kivity <avi@redhat.com>2012-07-11 09:51:13 -0400
commit2f84569f978cd7d54970d893b4c4e68ef24dc1ec (patch)
treecd14dfd05c6196207024ae066ba4b6de86f6daab /arch/x86/kvm/mmu.c
parenta27685c33acccce91268ddef88d7896e3205fda5 (diff)
KVM: MMU: return bool in __rmap_write_protect
The reture value of __rmap_write_protect is either 1 or 0, use true/false instead of these Signed-off-by: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/x86/kvm/mmu.c')
-rw-r--r--arch/x86/kvm/mmu.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 569cd66ba24c..5dd22427251d 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -1050,11 +1050,12 @@ static void drop_spte(struct kvm *kvm, u64 *sptep)
1050 rmap_remove(kvm, sptep); 1050 rmap_remove(kvm, sptep);
1051} 1051}
1052 1052
1053static int __rmap_write_protect(struct kvm *kvm, unsigned long *rmapp, int level) 1053static bool
1054__rmap_write_protect(struct kvm *kvm, unsigned long *rmapp, int level)
1054{ 1055{
1055 u64 *sptep; 1056 u64 *sptep;
1056 struct rmap_iterator iter; 1057 struct rmap_iterator iter;
1057 int write_protected = 0; 1058 bool write_protected = false;
1058 1059
1059 for (sptep = rmap_get_first(*rmapp, &iter); sptep;) { 1060 for (sptep = rmap_get_first(*rmapp, &iter); sptep;) {
1060 BUG_ON(!(*sptep & PT_PRESENT_MASK)); 1061 BUG_ON(!(*sptep & PT_PRESENT_MASK));
@@ -1075,7 +1076,7 @@ static int __rmap_write_protect(struct kvm *kvm, unsigned long *rmapp, int level
1075 sptep = rmap_get_first(*rmapp, &iter); 1076 sptep = rmap_get_first(*rmapp, &iter);
1076 } 1077 }
1077 1078
1078 write_protected = 1; 1079 write_protected = true;
1079 } 1080 }
1080 1081
1081 return write_protected; 1082 return write_protected;
@@ -1106,12 +1107,12 @@ void kvm_mmu_write_protect_pt_masked(struct kvm *kvm,
1106 } 1107 }
1107} 1108}
1108 1109
1109static int rmap_write_protect(struct kvm *kvm, u64 gfn) 1110static bool rmap_write_protect(struct kvm *kvm, u64 gfn)
1110{ 1111{
1111 struct kvm_memory_slot *slot; 1112 struct kvm_memory_slot *slot;
1112 unsigned long *rmapp; 1113 unsigned long *rmapp;
1113 int i; 1114 int i;
1114 int write_protected = 0; 1115 bool write_protected = false;
1115 1116
1116 slot = gfn_to_memslot(kvm, gfn); 1117 slot = gfn_to_memslot(kvm, gfn);
1117 1118
@@ -1700,7 +1701,7 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
1700 1701
1701 kvm_mmu_pages_init(parent, &parents, &pages); 1702 kvm_mmu_pages_init(parent, &parents, &pages);
1702 while (mmu_unsync_walk(parent, &pages)) { 1703 while (mmu_unsync_walk(parent, &pages)) {
1703 int protected = 0; 1704 bool protected = false;
1704 1705
1705 for_each_sp(pages, sp, parents, i) 1706 for_each_sp(pages, sp, parents, i)
1706 protected |= rmap_write_protect(vcpu->kvm, sp->gfn); 1707 protected |= rmap_write_protect(vcpu->kvm, sp->gfn);