diff options
author | Avi Kivity <avi@qumranet.com> | 2007-05-01 07:16:52 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2007-07-16 05:05:38 -0400 |
commit | 09072daf37abbfe8e2d5018dd913f229c76190f7 (patch) | |
tree | dbccbe493a9412cb89bd48b7c0c8ec21f70cf091 /drivers/kvm/mmu.c | |
parent | 621358455ae043ab39bc3481f13b101bd6016c8d (diff) |
KVM: Unify kvm_mmu_pre_write() and kvm_mmu_post_write()
Instead of calling two functions and repeating expensive checks, call one
function and provide it with before/after information.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/mmu.c')
-rw-r--r-- | drivers/kvm/mmu.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/kvm/mmu.c b/drivers/kvm/mmu.c index 2277b7cd118c..b3a83ef2cf07 100644 --- a/drivers/kvm/mmu.c +++ b/drivers/kvm/mmu.c | |||
@@ -1118,7 +1118,7 @@ out: | |||
1118 | return r; | 1118 | return r; |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | static void mmu_pre_write_zap_pte(struct kvm_vcpu *vcpu, | 1121 | static void mmu_pte_write_zap_pte(struct kvm_vcpu *vcpu, |
1122 | struct kvm_mmu_page *page, | 1122 | struct kvm_mmu_page *page, |
1123 | u64 *spte) | 1123 | u64 *spte) |
1124 | { | 1124 | { |
@@ -1137,7 +1137,8 @@ static void mmu_pre_write_zap_pte(struct kvm_vcpu *vcpu, | |||
1137 | *spte = 0; | 1137 | *spte = 0; |
1138 | } | 1138 | } |
1139 | 1139 | ||
1140 | void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) | 1140 | void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, |
1141 | const u8 *old, const u8 *new, int bytes) | ||
1141 | { | 1142 | { |
1142 | gfn_t gfn = gpa >> PAGE_SHIFT; | 1143 | gfn_t gfn = gpa >> PAGE_SHIFT; |
1143 | struct kvm_mmu_page *page; | 1144 | struct kvm_mmu_page *page; |
@@ -1206,16 +1207,12 @@ void kvm_mmu_pre_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) | |||
1206 | spte = __va(page->page_hpa); | 1207 | spte = __va(page->page_hpa); |
1207 | spte += page_offset / sizeof(*spte); | 1208 | spte += page_offset / sizeof(*spte); |
1208 | while (npte--) { | 1209 | while (npte--) { |
1209 | mmu_pre_write_zap_pte(vcpu, page, spte); | 1210 | mmu_pte_write_zap_pte(vcpu, page, spte); |
1210 | ++spte; | 1211 | ++spte; |
1211 | } | 1212 | } |
1212 | } | 1213 | } |
1213 | } | 1214 | } |
1214 | 1215 | ||
1215 | void kvm_mmu_post_write(struct kvm_vcpu *vcpu, gpa_t gpa, int bytes) | ||
1216 | { | ||
1217 | } | ||
1218 | |||
1219 | int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva) | 1216 | int kvm_mmu_unprotect_page_virt(struct kvm_vcpu *vcpu, gva_t gva) |
1220 | { | 1217 | { |
1221 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, gva); | 1218 | gpa_t gpa = vcpu->mmu.gva_to_gpa(vcpu, gva); |