diff options
Diffstat (limited to 'include/linux/kvm_host.h')
-rw-r--r-- | include/linux/kvm_host.h | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index ac740b26eb10..a0557422715e 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -36,9 +36,10 @@ | |||
36 | #define KVM_REQ_PENDING_TIMER 5 | 36 | #define KVM_REQ_PENDING_TIMER 5 |
37 | #define KVM_REQ_UNHALT 6 | 37 | #define KVM_REQ_UNHALT 6 |
38 | #define KVM_REQ_MMU_SYNC 7 | 38 | #define KVM_REQ_MMU_SYNC 7 |
39 | #define KVM_REQ_KVMCLOCK_UPDATE 8 | 39 | #define KVM_REQ_CLOCK_UPDATE 8 |
40 | #define KVM_REQ_KICK 9 | 40 | #define KVM_REQ_KICK 9 |
41 | #define KVM_REQ_DEACTIVATE_FPU 10 | 41 | #define KVM_REQ_DEACTIVATE_FPU 10 |
42 | #define KVM_REQ_EVENT 11 | ||
42 | 43 | ||
43 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 44 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
44 | 45 | ||
@@ -289,6 +290,9 @@ void kvm_arch_commit_memory_region(struct kvm *kvm, | |||
289 | void kvm_disable_largepages(void); | 290 | void kvm_disable_largepages(void); |
290 | void kvm_arch_flush_shadow(struct kvm *kvm); | 291 | void kvm_arch_flush_shadow(struct kvm *kvm); |
291 | 292 | ||
293 | int gfn_to_page_many_atomic(struct kvm *kvm, gfn_t gfn, struct page **pages, | ||
294 | int nr_pages); | ||
295 | |||
292 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); | 296 | struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn); |
293 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); | 297 | unsigned long gfn_to_hva(struct kvm *kvm, gfn_t gfn); |
294 | void kvm_release_page_clean(struct page *page); | 298 | void kvm_release_page_clean(struct page *page); |
@@ -296,6 +300,8 @@ void kvm_release_page_dirty(struct page *page); | |||
296 | void kvm_set_page_dirty(struct page *page); | 300 | void kvm_set_page_dirty(struct page *page); |
297 | void kvm_set_page_accessed(struct page *page); | 301 | void kvm_set_page_accessed(struct page *page); |
298 | 302 | ||
303 | pfn_t hva_to_pfn_atomic(struct kvm *kvm, unsigned long addr); | ||
304 | pfn_t gfn_to_pfn_atomic(struct kvm *kvm, gfn_t gfn); | ||
299 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); | 305 | pfn_t gfn_to_pfn(struct kvm *kvm, gfn_t gfn); |
300 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, | 306 | pfn_t gfn_to_pfn_memslot(struct kvm *kvm, |
301 | struct kvm_memory_slot *slot, gfn_t gfn); | 307 | struct kvm_memory_slot *slot, gfn_t gfn); |
@@ -477,8 +483,7 @@ int kvm_deassign_device(struct kvm *kvm, | |||
477 | struct kvm_assigned_dev_kernel *assigned_dev); | 483 | struct kvm_assigned_dev_kernel *assigned_dev); |
478 | #else /* CONFIG_IOMMU_API */ | 484 | #else /* CONFIG_IOMMU_API */ |
479 | static inline int kvm_iommu_map_pages(struct kvm *kvm, | 485 | static inline int kvm_iommu_map_pages(struct kvm *kvm, |
480 | gfn_t base_gfn, | 486 | struct kvm_memory_slot *slot) |
481 | unsigned long npages) | ||
482 | { | 487 | { |
483 | return 0; | 488 | return 0; |
484 | } | 489 | } |
@@ -518,11 +523,22 @@ static inline void kvm_guest_exit(void) | |||
518 | current->flags &= ~PF_VCPU; | 523 | current->flags &= ~PF_VCPU; |
519 | } | 524 | } |
520 | 525 | ||
526 | static inline unsigned long gfn_to_hva_memslot(struct kvm_memory_slot *slot, | ||
527 | gfn_t gfn) | ||
528 | { | ||
529 | return slot->userspace_addr + (gfn - slot->base_gfn) * PAGE_SIZE; | ||
530 | } | ||
531 | |||
521 | static inline gpa_t gfn_to_gpa(gfn_t gfn) | 532 | static inline gpa_t gfn_to_gpa(gfn_t gfn) |
522 | { | 533 | { |
523 | return (gpa_t)gfn << PAGE_SHIFT; | 534 | return (gpa_t)gfn << PAGE_SHIFT; |
524 | } | 535 | } |
525 | 536 | ||
537 | static inline gfn_t gpa_to_gfn(gpa_t gpa) | ||
538 | { | ||
539 | return (gfn_t)(gpa >> PAGE_SHIFT); | ||
540 | } | ||
541 | |||
526 | static inline hpa_t pfn_to_hpa(pfn_t pfn) | 542 | static inline hpa_t pfn_to_hpa(pfn_t pfn) |
527 | { | 543 | { |
528 | return (hpa_t)pfn << PAGE_SHIFT; | 544 | return (hpa_t)pfn << PAGE_SHIFT; |