diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-18 19:05:28 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-18 19:05:28 -0500 |
| commit | 66dcff86ba40eebb5133cccf450878f2bba102ef (patch) | |
| tree | e7eb49ad9316989a529b00303d2dd2cffa61a7f5 /include/linux | |
| parent | 91ed9e8a32d9a76adc59c83f8b40024076cf8a02 (diff) | |
| parent | 2c4aa55a6af070262cca425745e8e54310e96b8d (diff) | |
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Pull KVM update from Paolo Bonzini:
"3.19 changes for KVM:
- spring cleaning: removed support for IA64, and for hardware-
assisted virtualization on the PPC970
- ARM, PPC, s390 all had only small fixes
For x86:
- small performance improvements (though only on weird guests)
- usual round of hardware-compliancy fixes from Nadav
- APICv fixes
- XSAVES support for hosts and guests. XSAVES hosts were broken
because the (non-KVM) XSAVES patches inadvertently changed the KVM
userspace ABI whenever XSAVES was enabled; hence, this part is
going to stable. Guest support is just a matter of exposing the
feature and CPUID leaves support"
* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (179 commits)
KVM: move APIC types to arch/x86/
KVM: PPC: Book3S: Enable in-kernel XICS emulation by default
KVM: PPC: Book3S HV: Improve H_CONFER implementation
KVM: PPC: Book3S HV: Fix endianness of instruction obtained from HEIR register
KVM: PPC: Book3S HV: Remove code for PPC970 processors
KVM: PPC: Book3S HV: Tracepoints for KVM HV guest interactions
KVM: PPC: Book3S HV: Simplify locking around stolen time calculations
arch: powerpc: kvm: book3s_paired_singles.c: Remove unused function
arch: powerpc: kvm: book3s_pr.c: Remove unused function
arch: powerpc: kvm: book3s.c: Remove some unused functions
arch: powerpc: kvm: book3s_32_mmu.c: Remove unused function
KVM: PPC: Book3S HV: Check wait conditions before sleeping in kvmppc_vcore_blocked
KVM: PPC: Book3S HV: ptes are big endian
KVM: PPC: Book3S HV: Fix inaccuracies in ICP emulation for H_IPI
KVM: PPC: Book3S HV: Fix KSM memory corruption
KVM: PPC: Book3S HV: Fix an issue where guest is paused on receiving HMI
KVM: PPC: Book3S HV: Fix computation of tlbie operand
KVM: PPC: Book3S HV: Add missing HPTE unlock
KVM: PPC: BookE: Improve irq inject tracepoint
arm/arm64: KVM: Require in-kernel vgic for the arch timers
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/kvm_host.h | 106 | ||||
| -rw-r--r-- | include/linux/kvm_types.h | 27 |
2 files changed, 32 insertions, 101 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index a6059bdf7b03..26f106022c88 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
| @@ -43,6 +43,7 @@ | |||
| 43 | * include/linux/kvm_h. | 43 | * include/linux/kvm_h. |
| 44 | */ | 44 | */ |
| 45 | #define KVM_MEMSLOT_INVALID (1UL << 16) | 45 | #define KVM_MEMSLOT_INVALID (1UL << 16) |
| 46 | #define KVM_MEMSLOT_INCOHERENT (1UL << 17) | ||
| 46 | 47 | ||
| 47 | /* Two fragments for cross MMIO pages. */ | 48 | /* Two fragments for cross MMIO pages. */ |
| 48 | #define KVM_MAX_MMIO_FRAGMENTS 2 | 49 | #define KVM_MAX_MMIO_FRAGMENTS 2 |
| @@ -353,6 +354,8 @@ struct kvm_memslots { | |||
| 353 | struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; | 354 | struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; |
| 354 | /* The mapping table from slot id to the index in memslots[]. */ | 355 | /* The mapping table from slot id to the index in memslots[]. */ |
| 355 | short id_to_index[KVM_MEM_SLOTS_NUM]; | 356 | short id_to_index[KVM_MEM_SLOTS_NUM]; |
| 357 | atomic_t lru_slot; | ||
| 358 | int used_slots; | ||
| 356 | }; | 359 | }; |
| 357 | 360 | ||
| 358 | struct kvm { | 361 | struct kvm { |
| @@ -395,7 +398,6 @@ struct kvm { | |||
| 395 | * Update side is protected by irq_lock. | 398 | * Update side is protected by irq_lock. |
| 396 | */ | 399 | */ |
| 397 | struct kvm_irq_routing_table __rcu *irq_routing; | 400 | struct kvm_irq_routing_table __rcu *irq_routing; |
| 398 | struct hlist_head mask_notifier_list; | ||
| 399 | #endif | 401 | #endif |
| 400 | #ifdef CONFIG_HAVE_KVM_IRQFD | 402 | #ifdef CONFIG_HAVE_KVM_IRQFD |
| 401 | struct hlist_head irq_ack_notifier_list; | 403 | struct hlist_head irq_ack_notifier_list; |
| @@ -447,6 +449,14 @@ void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | |||
| 447 | int __must_check vcpu_load(struct kvm_vcpu *vcpu); | 449 | int __must_check vcpu_load(struct kvm_vcpu *vcpu); |
| 448 | void vcpu_put(struct kvm_vcpu *vcpu); | 450 | void vcpu_put(struct kvm_vcpu *vcpu); |
| 449 | 451 | ||
| 452 | #ifdef __KVM_HAVE_IOAPIC | ||
| 453 | void kvm_vcpu_request_scan_ioapic(struct kvm *kvm); | ||
| 454 | #else | ||
| 455 | static inline void kvm_vcpu_request_scan_ioapic(struct kvm *kvm) | ||
| 456 | { | ||
| 457 | } | ||
| 458 | #endif | ||
| 459 | |||
| 450 | #ifdef CONFIG_HAVE_KVM_IRQFD | 460 | #ifdef CONFIG_HAVE_KVM_IRQFD |
| 451 | int kvm_irqfd_init(void); | 461 | int kvm_irqfd_init(void); |
| 452 | void kvm_irqfd_exit(void); | 462 | void kvm_irqfd_exit(void); |
| @@ -711,44 +721,6 @@ struct kvm_irq_ack_notifier { | |||
| 711 | void (*irq_acked)(struct kvm_irq_ack_notifier *kian); | 721 | void (*irq_acked)(struct kvm_irq_ack_notifier *kian); |
| 712 | }; | 722 | }; |
| 713 | 723 | ||
| 714 | struct kvm_assigned_dev_kernel { | ||
| 715 | struct kvm_irq_ack_notifier ack_notifier; | ||
| 716 | struct list_head list; | ||
| 717 | int assigned_dev_id; | ||
| 718 | int host_segnr; | ||
| 719 | int host_busnr; | ||
| 720 | int host_devfn; | ||
| 721 | unsigned int entries_nr; | ||
| 722 | int host_irq; | ||
| 723 | bool host_irq_disabled; | ||
| 724 | bool pci_2_3; | ||
| 725 | struct msix_entry *host_msix_entries; | ||
| 726 | int guest_irq; | ||
| 727 | struct msix_entry *guest_msix_entries; | ||
| 728 | unsigned long irq_requested_type; | ||
| 729 | int irq_source_id; | ||
| 730 | int flags; | ||
| 731 | struct pci_dev *dev; | ||
| 732 | struct kvm *kvm; | ||
| 733 | spinlock_t intx_lock; | ||
| 734 | spinlock_t intx_mask_lock; | ||
| 735 | char irq_name[32]; | ||
| 736 | struct pci_saved_state *pci_saved_state; | ||
| 737 | }; | ||
| 738 | |||
| 739 | struct kvm_irq_mask_notifier { | ||
| 740 | void (*func)(struct kvm_irq_mask_notifier *kimn, bool masked); | ||
| 741 | int irq; | ||
| 742 | struct hlist_node link; | ||
| 743 | }; | ||
| 744 | |||
| 745 | void kvm_register_irq_mask_notifier(struct kvm *kvm, int irq, | ||
| 746 | struct kvm_irq_mask_notifier *kimn); | ||
| 747 | void kvm_unregister_irq_mask_notifier(struct kvm *kvm, int irq, | ||
| 748 | struct kvm_irq_mask_notifier *kimn); | ||
| 749 | void kvm_fire_mask_notifiers(struct kvm *kvm, unsigned irqchip, unsigned pin, | ||
| 750 | bool mask); | ||
| 751 | |||
| 752 | int kvm_irq_map_gsi(struct kvm *kvm, | 724 | int kvm_irq_map_gsi(struct kvm *kvm, |
| 753 | struct kvm_kernel_irq_routing_entry *entries, int gsi); | 725 | struct kvm_kernel_irq_routing_entry *entries, int gsi); |
| 754 | int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin); | 726 | int kvm_irq_map_chip_pin(struct kvm *kvm, unsigned irqchip, unsigned pin); |
| @@ -770,12 +742,6 @@ void kvm_free_irq_source_id(struct kvm *kvm, int irq_source_id); | |||
| 770 | #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT | 742 | #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT |
| 771 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 743 | int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
| 772 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); | 744 | void kvm_iommu_unmap_pages(struct kvm *kvm, struct kvm_memory_slot *slot); |
| 773 | int kvm_iommu_map_guest(struct kvm *kvm); | ||
| 774 | int kvm_iommu_unmap_guest(struct kvm *kvm); | ||
| 775 | int kvm_assign_device(struct kvm *kvm, | ||
| 776 | struct kvm_assigned_dev_kernel *assigned_dev); | ||
| 777 | int kvm_deassign_device(struct kvm *kvm, | ||
| 778 | struct kvm_assigned_dev_kernel *assigned_dev); | ||
| 779 | #else | 745 | #else |
| 780 | static inline int kvm_iommu_map_pages(struct kvm *kvm, | 746 | static inline int kvm_iommu_map_pages(struct kvm *kvm, |
| 781 | struct kvm_memory_slot *slot) | 747 | struct kvm_memory_slot *slot) |
| @@ -787,11 +753,6 @@ static inline void kvm_iommu_unmap_pages(struct kvm *kvm, | |||
| 787 | struct kvm_memory_slot *slot) | 753 | struct kvm_memory_slot *slot) |
| 788 | { | 754 | { |
| 789 | } | 755 | } |
| 790 | |||
| 791 | static inline int kvm_iommu_unmap_guest(struct kvm *kvm) | ||
| 792 | { | ||
| 793 | return 0; | ||
| 794 | } | ||
| 795 | #endif | 756 | #endif |
| 796 | 757 | ||
| 797 | static inline void kvm_guest_enter(void) | 758 | static inline void kvm_guest_enter(void) |
| @@ -832,12 +793,28 @@ static inline void kvm_guest_exit(void) | |||
| 832 | static inline struct kvm_memory_slot * | 793 | static inline struct kvm_memory_slot * |
| 833 | search_memslots(struct kvm_memslots *slots, gfn_t gfn) | 794 | search_memslots(struct kvm_memslots *slots, gfn_t gfn) |
| 834 | { | 795 | { |
| 835 | struct kvm_memory_slot *memslot; | 796 | int start = 0, end = slots->used_slots; |
| 797 | int slot = atomic_read(&slots->lru_slot); | ||
| 798 | struct kvm_memory_slot *memslots = slots->memslots; | ||
| 799 | |||
| 800 | if (gfn >= memslots[slot].base_gfn && | ||
| 801 | gfn < memslots[slot].base_gfn + memslots[slot].npages) | ||
| 802 | return &memslots[slot]; | ||
| 836 | 803 | ||
| 837 | kvm_for_each_memslot(memslot, slots) | 804 | while (start < end) { |
| 838 | if (gfn >= memslot->base_gfn && | 805 | slot = start + (end - start) / 2; |
| 839 | gfn < memslot->base_gfn + memslot->npages) | 806 | |
| 840 | return memslot; | 807 | if (gfn >= memslots[slot].base_gfn) |
| 808 | end = slot; | ||
| 809 | else | ||
| 810 | start = slot + 1; | ||
| 811 | } | ||
| 812 | |||
| 813 | if (gfn >= memslots[start].base_gfn && | ||
| 814 | gfn < memslots[start].base_gfn + memslots[start].npages) { | ||
| 815 | atomic_set(&slots->lru_slot, start); | ||
| 816 | return &memslots[start]; | ||
| 817 | } | ||
| 841 | 818 | ||
| 842 | return NULL; | 819 | return NULL; |
| 843 | } | 820 | } |
| @@ -1011,25 +988,6 @@ static inline bool kvm_vcpu_compatible(struct kvm_vcpu *vcpu) { return true; } | |||
| 1011 | 988 | ||
| 1012 | #endif | 989 | #endif |
| 1013 | 990 | ||
| 1014 | #ifdef CONFIG_KVM_DEVICE_ASSIGNMENT | ||
| 1015 | |||
| 1016 | long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | ||
| 1017 | unsigned long arg); | ||
| 1018 | |||
| 1019 | void kvm_free_all_assigned_devices(struct kvm *kvm); | ||
| 1020 | |||
| 1021 | #else | ||
| 1022 | |||
| 1023 | static inline long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | ||
| 1024 | unsigned long arg) | ||
| 1025 | { | ||
| 1026 | return -ENOTTY; | ||
| 1027 | } | ||
| 1028 | |||
| 1029 | static inline void kvm_free_all_assigned_devices(struct kvm *kvm) {} | ||
| 1030 | |||
| 1031 | #endif | ||
| 1032 | |||
| 1033 | static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) | 991 | static inline void kvm_make_request(int req, struct kvm_vcpu *vcpu) |
| 1034 | { | 992 | { |
| 1035 | set_bit(req, &vcpu->requests); | 993 | set_bit(req, &vcpu->requests); |
diff --git a/include/linux/kvm_types.h b/include/linux/kvm_types.h index b606bb689a3e..931da7e917cf 100644 --- a/include/linux/kvm_types.h +++ b/include/linux/kvm_types.h | |||
| @@ -54,33 +54,6 @@ typedef u64 hfn_t; | |||
| 54 | 54 | ||
| 55 | typedef hfn_t pfn_t; | 55 | typedef hfn_t pfn_t; |
| 56 | 56 | ||
| 57 | union kvm_ioapic_redirect_entry { | ||
| 58 | u64 bits; | ||
| 59 | struct { | ||
| 60 | u8 vector; | ||
| 61 | u8 delivery_mode:3; | ||
| 62 | u8 dest_mode:1; | ||
| 63 | u8 delivery_status:1; | ||
| 64 | u8 polarity:1; | ||
| 65 | u8 remote_irr:1; | ||
| 66 | u8 trig_mode:1; | ||
| 67 | u8 mask:1; | ||
| 68 | u8 reserve:7; | ||
| 69 | u8 reserved[4]; | ||
| 70 | u8 dest_id; | ||
| 71 | } fields; | ||
| 72 | }; | ||
| 73 | |||
| 74 | struct kvm_lapic_irq { | ||
| 75 | u32 vector; | ||
| 76 | u32 delivery_mode; | ||
| 77 | u32 dest_mode; | ||
| 78 | u32 level; | ||
| 79 | u32 trig_mode; | ||
| 80 | u32 shorthand; | ||
| 81 | u32 dest_id; | ||
| 82 | }; | ||
| 83 | |||
| 84 | struct gfn_to_hva_cache { | 57 | struct gfn_to_hva_cache { |
| 85 | u64 generation; | 58 | u64 generation; |
| 86 | gpa_t gpa; | 59 | gpa_t gpa; |
