diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/kvm.h | 12 | ||||
-rw-r--r-- | include/linux/kvm_host.h | 22 | ||||
-rw-r--r-- | include/linux/kvm_para.h | 7 |
3 files changed, 33 insertions, 8 deletions
diff --git a/include/linux/kvm.h b/include/linux/kvm.h index 636fc381c897..919ae53adc5c 100644 --- a/include/linux/kvm.h +++ b/include/linux/kvm.h | |||
@@ -414,6 +414,14 @@ struct kvm_enable_cap { | |||
414 | __u8 pad[64]; | 414 | __u8 pad[64]; |
415 | }; | 415 | }; |
416 | 416 | ||
417 | /* for KVM_PPC_GET_PVINFO */ | ||
418 | struct kvm_ppc_pvinfo { | ||
419 | /* out */ | ||
420 | __u32 flags; | ||
421 | __u32 hcall[4]; | ||
422 | __u8 pad[108]; | ||
423 | }; | ||
424 | |||
417 | #define KVMIO 0xAE | 425 | #define KVMIO 0xAE |
418 | 426 | ||
419 | /* | 427 | /* |
@@ -530,6 +538,8 @@ struct kvm_enable_cap { | |||
530 | #ifdef __KVM_HAVE_XCRS | 538 | #ifdef __KVM_HAVE_XCRS |
531 | #define KVM_CAP_XCRS 56 | 539 | #define KVM_CAP_XCRS 56 |
532 | #endif | 540 | #endif |
541 | #define KVM_CAP_PPC_GET_PVINFO 57 | ||
542 | #define KVM_CAP_PPC_IRQ_LEVEL 58 | ||
533 | 543 | ||
534 | #ifdef KVM_CAP_IRQ_ROUTING | 544 | #ifdef KVM_CAP_IRQ_ROUTING |
535 | 545 | ||
@@ -664,6 +674,8 @@ struct kvm_clock_data { | |||
664 | /* Available with KVM_CAP_PIT_STATE2 */ | 674 | /* Available with KVM_CAP_PIT_STATE2 */ |
665 | #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) | 675 | #define KVM_GET_PIT2 _IOR(KVMIO, 0x9f, struct kvm_pit_state2) |
666 | #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) | 676 | #define KVM_SET_PIT2 _IOW(KVMIO, 0xa0, struct kvm_pit_state2) |
677 | /* Available with KVM_CAP_PPC_GET_PVINFO */ | ||
678 | #define KVM_PPC_GET_PVINFO _IOW(KVMIO, 0xa1, struct kvm_ppc_pvinfo) | ||
667 | 679 | ||
668 | /* | 680 | /* |
669 | * ioctls for vcpu fds | 681 | * ioctls for vcpu fds |
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; |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index d73109243fda..47a070b0520e 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h | |||
@@ -17,6 +17,8 @@ | |||
17 | 17 | ||
18 | #define KVM_HC_VAPIC_POLL_IRQ 1 | 18 | #define KVM_HC_VAPIC_POLL_IRQ 1 |
19 | #define KVM_HC_MMU_OP 2 | 19 | #define KVM_HC_MMU_OP 2 |
20 | #define KVM_HC_FEATURES 3 | ||
21 | #define KVM_HC_PPC_MAP_MAGIC_PAGE 4 | ||
20 | 22 | ||
21 | /* | 23 | /* |
22 | * hypercalls use architecture specific | 24 | * hypercalls use architecture specific |
@@ -24,11 +26,6 @@ | |||
24 | #include <asm/kvm_para.h> | 26 | #include <asm/kvm_para.h> |
25 | 27 | ||
26 | #ifdef __KERNEL__ | 28 | #ifdef __KERNEL__ |
27 | #ifdef CONFIG_KVM_GUEST | ||
28 | void __init kvm_guest_init(void); | ||
29 | #else | ||
30 | #define kvm_guest_init() do { } while (0) | ||
31 | #endif | ||
32 | 29 | ||
33 | static inline int kvm_para_has_feature(unsigned int feature) | 30 | static inline int kvm_para_has_feature(unsigned int feature) |
34 | { | 31 | { |