diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 15:48:16 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-01 15:48:16 -0400 |
| commit | 84ff7a001270258f71d6ab0d164f351e32c9718a (patch) | |
| tree | 6b2f33a9ad492186062de247d3572fa5efebe4bd /include | |
| parent | 478735e42bfa047384afa72dceb408035532db20 (diff) | |
| parent | 1f4170e12db06fdde5279d665a7e6e2976b2b623 (diff) | |
Merge branch 'kvm-updates-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm
* 'kvm-updates-2.6.27' of git://git.kernel.org/pub/scm/linux/kernel/git/avi/kvm:
KVM: s390: Fix kvm on IBM System z10
KVM: Advertise synchronized mmu support to userspace
KVM: Synchronize guest physical memory map to host virtual memory map
KVM: Allow browsing memslots with mmu_lock
KVM: Allow reading aliases with mmu_lock
Diffstat (limited to 'include')
| -rw-r--r-- | include/asm-x86/kvm_host.h | 6 | ||||
| -rw-r--r-- | include/linux/kvm.h | 1 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 24 |
3 files changed, 31 insertions, 0 deletions
diff --git a/include/asm-x86/kvm_host.h b/include/asm-x86/kvm_host.h index bc34dc21f178..0f3c53114614 100644 --- a/include/asm-x86/kvm_host.h +++ b/include/asm-x86/kvm_host.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| 15 | #include <linux/mm.h> | 15 | #include <linux/mm.h> |
| 16 | #include <linux/mmu_notifier.h> | ||
| 16 | 17 | ||
| 17 | #include <linux/kvm.h> | 18 | #include <linux/kvm.h> |
| 18 | #include <linux/kvm_para.h> | 19 | #include <linux/kvm_para.h> |
| @@ -251,6 +252,7 @@ struct kvm_vcpu_arch { | |||
| 251 | gfn_t gfn; /* presumed gfn during guest pte update */ | 252 | gfn_t gfn; /* presumed gfn during guest pte update */ |
| 252 | pfn_t pfn; /* pfn corresponding to that gfn */ | 253 | pfn_t pfn; /* pfn corresponding to that gfn */ |
| 253 | int largepage; | 254 | int largepage; |
| 255 | unsigned long mmu_seq; | ||
| 254 | } update_pte; | 256 | } update_pte; |
| 255 | 257 | ||
| 256 | struct i387_fxsave_struct host_fx_image; | 258 | struct i387_fxsave_struct host_fx_image; |
| @@ -729,4 +731,8 @@ asmlinkage void kvm_handle_fault_on_reboot(void); | |||
| 729 | KVM_EX_ENTRY " 666b, 667b \n\t" \ | 731 | KVM_EX_ENTRY " 666b, 667b \n\t" \ |
| 730 | ".popsection" | 732 | ".popsection" |
| 731 | 733 | ||
| 734 | #define KVM_ARCH_WANT_MMU_NOTIFIER | ||
| 735 | int kvm_unmap_hva(struct kvm *kvm, unsigned long hva); | ||
| 736 | int kvm_age_hva(struct kvm *kvm, unsigned long hva); | ||
| 737 | |||
| 732 | #endif | 738 | #endif |
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 0ea064cbfbc8..69511f74f912 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
| @@ -371,6 +371,7 @@ struct kvm_trace_rec { | |||
| 371 | #define KVM_CAP_PV_MMU 13 | 371 | #define KVM_CAP_PV_MMU 13 |
| 372 | #define KVM_CAP_MP_STATE 14 | 372 | #define KVM_CAP_MP_STATE 14 |
| 373 | #define KVM_CAP_COALESCED_MMIO 15 | 373 | #define KVM_CAP_COALESCED_MMIO 15 |
| 374 | #define KVM_CAP_SYNC_MMU 16 /* Changes to host mmap are reflected in guest */ | ||
| 374 | 375 | ||
| 375 | /* | 376 | /* |
| 376 | * ioctls for VM fds | 377 | * ioctls for VM fds |
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index 07d68a8ae8e9..8525afc53107 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -121,6 +121,12 @@ struct kvm { | |||
| 121 | struct kvm_coalesced_mmio_dev *coalesced_mmio_dev; | 121 | struct kvm_coalesced_mmio_dev *coalesced_mmio_dev; |
| 122 | struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; | 122 | struct kvm_coalesced_mmio_ring *coalesced_mmio_ring; |
| 123 | #endif | 123 | #endif |
| 124 | |||
| 125 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER | ||
| 126 | struct mmu_notifier mmu_notifier; | ||
| 127 | unsigned long mmu_notifier_seq; | ||
| 128 | long mmu_notifier_count; | ||
| 129 | #endif | ||
| 124 | }; | 130 | }; |
| 125 | 131 | ||
| 126 | /* The guest did something we don't support. */ | 132 | /* The guest did something we don't support. */ |
| @@ -332,4 +338,22 @@ int kvm_trace_ioctl(unsigned int ioctl, unsigned long arg) | |||
| 332 | #define kvm_trace_cleanup() ((void)0) | 338 | #define kvm_trace_cleanup() ((void)0) |
| 333 | #endif | 339 | #endif |
| 334 | 340 | ||
| 341 | #ifdef KVM_ARCH_WANT_MMU_NOTIFIER | ||
| 342 | static inline int mmu_notifier_retry(struct kvm_vcpu *vcpu, unsigned long mmu_seq) | ||
| 343 | { | ||
| 344 | if (unlikely(vcpu->kvm->mmu_notifier_count)) | ||
| 345 | return 1; | ||
| 346 | /* | ||
| 347 | * Both reads happen under the mmu_lock and both values are | ||
| 348 | * modified under mmu_lock, so there's no need of smb_rmb() | ||
| 349 | * here in between, otherwise mmu_notifier_count should be | ||
| 350 | * read before mmu_notifier_seq, see | ||
| 351 | * mmu_notifier_invalidate_range_end write side. | ||
| 352 | */ | ||
| 353 | if (vcpu->kvm->mmu_notifier_seq != mmu_seq) | ||
| 354 | return 1; | ||
| 355 | return 0; | ||
| 356 | } | ||
| 357 | #endif | ||
| 358 | |||
| 335 | #endif | 359 | #endif |
