diff options
Diffstat (limited to 'virt')
-rw-r--r-- | virt/kvm/kvm_main.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 5fed9bfc3cf5..5f865ed4c431 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -1086,7 +1086,7 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
1086 | { | 1086 | { |
1087 | int r; | 1087 | int r; |
1088 | gfn_t base_gfn; | 1088 | gfn_t base_gfn; |
1089 | unsigned long npages; | 1089 | unsigned long npages, ugfn; |
1090 | int largepages; | 1090 | int largepages; |
1091 | unsigned long i; | 1091 | unsigned long i; |
1092 | struct kvm_memory_slot *memslot; | 1092 | struct kvm_memory_slot *memslot; |
@@ -1177,6 +1177,14 @@ int __kvm_set_memory_region(struct kvm *kvm, | |||
1177 | new.lpage_info[0].write_count = 1; | 1177 | new.lpage_info[0].write_count = 1; |
1178 | if ((base_gfn+npages) % KVM_PAGES_PER_HPAGE) | 1178 | if ((base_gfn+npages) % KVM_PAGES_PER_HPAGE) |
1179 | new.lpage_info[largepages-1].write_count = 1; | 1179 | new.lpage_info[largepages-1].write_count = 1; |
1180 | ugfn = new.userspace_addr >> PAGE_SHIFT; | ||
1181 | /* | ||
1182 | * If the gfn and userspace address are not aligned wrt each | ||
1183 | * other, disable large page support for this slot | ||
1184 | */ | ||
1185 | if ((base_gfn ^ ugfn) & (KVM_PAGES_PER_HPAGE - 1)) | ||
1186 | for (i = 0; i < largepages; ++i) | ||
1187 | new.lpage_info[i].write_count = 1; | ||
1180 | } | 1188 | } |
1181 | 1189 | ||
1182 | /* Allocate page dirty bitmap if needed */ | 1190 | /* Allocate page dirty bitmap if needed */ |