diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 12:57:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-01-10 12:57:11 -0500 |
commit | 3dcf6c1b6b29f327ec24a1986aaa8eba399b463f (patch) | |
tree | 51e8d0659aa3e4aa50ac94cf13051fef135bda19 /include/linux | |
parent | e4e11180dfa545233e5145919b75b7fac88638df (diff) | |
parent | da69dee073a27ee2d4e50c9b19e9faf8776857eb (diff) |
Merge branch 'kvm-updates/3.3' of git://git.kernel.org/pub/scm/virt/kvm/kvm
* 'kvm-updates/3.3' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (74 commits)
KVM: PPC: Whitespace fix for kvm.h
KVM: Fix whitespace in kvm_para.h
KVM: PPC: annotate kvm_rma_init as __init
KVM: x86 emulator: implement RDPMC (0F 33)
KVM: x86 emulator: fix RDPMC privilege check
KVM: Expose the architectural performance monitoring CPUID leaf
KVM: VMX: Intercept RDPMC
KVM: SVM: Intercept RDPMC
KVM: Add generic RDPMC support
KVM: Expose a version 2 architectural PMU to a guests
KVM: Expose kvm_lapic_local_deliver()
KVM: x86 emulator: Use opcode::execute for Group 9 instruction
KVM: x86 emulator: Use opcode::execute for Group 4/5 instructions
KVM: x86 emulator: Use opcode::execute for Group 1A instruction
KVM: ensure that debugfs entries have been created
KVM: drop bsp_vcpu pointer from kvm struct
KVM: x86: Consolidate PIT legacy test
KVM: x86: Do not rely on implicit inclusions
KVM: Make KVM_INTEL depend on CPU_SUP_INTEL
KVM: Use memdup_user instead of kmalloc/copy_from_user
...
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/kvm_host.h | 39 | ||||
-rw-r--r-- | include/linux/kvm_para.h | 1 |
2 files changed, 35 insertions, 5 deletions
diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h index d52623199978..900c76337e8f 100644 --- a/include/linux/kvm_host.h +++ b/include/linux/kvm_host.h | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/signal.h> | 14 | #include <linux/signal.h> |
15 | #include <linux/sched.h> | 15 | #include <linux/sched.h> |
16 | #include <linux/mm.h> | 16 | #include <linux/mm.h> |
17 | #include <linux/mmu_notifier.h> | ||
17 | #include <linux/preempt.h> | 18 | #include <linux/preempt.h> |
18 | #include <linux/msi.h> | 19 | #include <linux/msi.h> |
19 | #include <linux/slab.h> | 20 | #include <linux/slab.h> |
@@ -50,6 +51,9 @@ | |||
50 | #define KVM_REQ_APF_HALT 12 | 51 | #define KVM_REQ_APF_HALT 12 |
51 | #define KVM_REQ_STEAL_UPDATE 13 | 52 | #define KVM_REQ_STEAL_UPDATE 13 |
52 | #define KVM_REQ_NMI 14 | 53 | #define KVM_REQ_NMI 14 |
54 | #define KVM_REQ_IMMEDIATE_EXIT 15 | ||
55 | #define KVM_REQ_PMU 16 | ||
56 | #define KVM_REQ_PMI 17 | ||
53 | 57 | ||
54 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 | 58 | #define KVM_USERSPACE_IRQ_SOURCE_ID 0 |
55 | 59 | ||
@@ -179,6 +183,7 @@ struct kvm_memory_slot { | |||
179 | unsigned long *rmap; | 183 | unsigned long *rmap; |
180 | unsigned long *dirty_bitmap; | 184 | unsigned long *dirty_bitmap; |
181 | unsigned long *dirty_bitmap_head; | 185 | unsigned long *dirty_bitmap_head; |
186 | unsigned long nr_dirty_pages; | ||
182 | struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; | 187 | struct kvm_lpage_info *lpage_info[KVM_NR_PAGE_SIZES - 1]; |
183 | unsigned long userspace_addr; | 188 | unsigned long userspace_addr; |
184 | int user_alloc; | 189 | int user_alloc; |
@@ -224,11 +229,20 @@ struct kvm_irq_routing_table {}; | |||
224 | 229 | ||
225 | #endif | 230 | #endif |
226 | 231 | ||
232 | #ifndef KVM_MEM_SLOTS_NUM | ||
233 | #define KVM_MEM_SLOTS_NUM (KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS) | ||
234 | #endif | ||
235 | |||
236 | /* | ||
237 | * Note: | ||
238 | * memslots are not sorted by id anymore, please use id_to_memslot() | ||
239 | * to get the memslot by its id. | ||
240 | */ | ||
227 | struct kvm_memslots { | 241 | struct kvm_memslots { |
228 | int nmemslots; | ||
229 | u64 generation; | 242 | u64 generation; |
230 | struct kvm_memory_slot memslots[KVM_MEMORY_SLOTS + | 243 | struct kvm_memory_slot memslots[KVM_MEM_SLOTS_NUM]; |
231 | KVM_PRIVATE_MEM_SLOTS]; | 244 | /* The mapping table from slot id to the index in memslots[]. */ |
245 | int id_to_index[KVM_MEM_SLOTS_NUM]; | ||
232 | }; | 246 | }; |
233 | 247 | ||
234 | struct kvm { | 248 | struct kvm { |
@@ -239,7 +253,6 @@ struct kvm { | |||
239 | struct srcu_struct srcu; | 253 | struct srcu_struct srcu; |
240 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE | 254 | #ifdef CONFIG_KVM_APIC_ARCHITECTURE |
241 | u32 bsp_vcpu_id; | 255 | u32 bsp_vcpu_id; |
242 | struct kvm_vcpu *bsp_vcpu; | ||
243 | #endif | 256 | #endif |
244 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; | 257 | struct kvm_vcpu *vcpus[KVM_MAX_VCPUS]; |
245 | atomic_t online_vcpus; | 258 | atomic_t online_vcpus; |
@@ -302,6 +315,11 @@ static inline struct kvm_vcpu *kvm_get_vcpu(struct kvm *kvm, int i) | |||
302 | (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ | 315 | (vcpup = kvm_get_vcpu(kvm, idx)) != NULL; \ |
303 | idx++) | 316 | idx++) |
304 | 317 | ||
318 | #define kvm_for_each_memslot(memslot, slots) \ | ||
319 | for (memslot = &slots->memslots[0]; \ | ||
320 | memslot < slots->memslots + KVM_MEM_SLOTS_NUM && memslot->npages;\ | ||
321 | memslot++) | ||
322 | |||
305 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); | 323 | int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, unsigned id); |
306 | void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); | 324 | void kvm_vcpu_uninit(struct kvm_vcpu *vcpu); |
307 | 325 | ||
@@ -314,6 +332,7 @@ void kvm_exit(void); | |||
314 | 332 | ||
315 | void kvm_get_kvm(struct kvm *kvm); | 333 | void kvm_get_kvm(struct kvm *kvm); |
316 | void kvm_put_kvm(struct kvm *kvm); | 334 | void kvm_put_kvm(struct kvm *kvm); |
335 | void update_memslots(struct kvm_memslots *slots, struct kvm_memory_slot *new); | ||
317 | 336 | ||
318 | static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) | 337 | static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) |
319 | { | 338 | { |
@@ -322,6 +341,18 @@ static inline struct kvm_memslots *kvm_memslots(struct kvm *kvm) | |||
322 | || lockdep_is_held(&kvm->slots_lock)); | 341 | || lockdep_is_held(&kvm->slots_lock)); |
323 | } | 342 | } |
324 | 343 | ||
344 | static inline struct kvm_memory_slot * | ||
345 | id_to_memslot(struct kvm_memslots *slots, int id) | ||
346 | { | ||
347 | int index = slots->id_to_index[id]; | ||
348 | struct kvm_memory_slot *slot; | ||
349 | |||
350 | slot = &slots->memslots[index]; | ||
351 | |||
352 | WARN_ON(slot->id != id); | ||
353 | return slot; | ||
354 | } | ||
355 | |||
325 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) | 356 | #define HPA_MSB ((sizeof(hpa_t) * 8) - 1) |
326 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) | 357 | #define HPA_ERR_MASK ((hpa_t)1 << HPA_MSB) |
327 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } | 358 | static inline int is_error_hpa(hpa_t hpa) { return hpa >> HPA_MSB; } |
diff --git a/include/linux/kvm_para.h b/include/linux/kvm_para.h index 47a070b0520e..ff476ddaf310 100644 --- a/include/linux/kvm_para.h +++ b/include/linux/kvm_para.h | |||
@@ -35,4 +35,3 @@ static inline int kvm_para_has_feature(unsigned int feature) | |||
35 | } | 35 | } |
36 | #endif /* __KERNEL__ */ | 36 | #endif /* __KERNEL__ */ |
37 | #endif /* __LINUX_KVM_PARA_H */ | 37 | #endif /* __LINUX_KVM_PARA_H */ |
38 | |||