aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2013-02-13 06:56:14 -0500
committerAlexander Graf <agraf@suse.de>2013-02-13 06:56:14 -0500
commitdd92d6f2749c43ebab91c4762a1bc79e6523e936 (patch)
tree6e6730bdd09284679c0861df6d0fcbec08ea7a87
parentb9e3e208935e95ad62bd1b1bc4408c23a9ae3ada (diff)
parentb0da5bec30eca7ffbb2c89afa6fe503fd418d3a6 (diff)
Merge commit 'origin/next' into kvm-ppc-next
-rw-r--r--Documentation/virtual/kvm/api.txt25
-rw-r--r--arch/ia64/kvm/lapic.h6
-rw-r--r--arch/s390/kvm/kvm-s390.c8
-rw-r--r--arch/s390/kvm/kvm-s390.h25
-rw-r--r--arch/x86/include/asm/kvm_host.h6
-rw-r--r--arch/x86/include/asm/vmx.h21
-rw-r--r--arch/x86/kvm/emulate.c2
-rw-r--r--arch/x86/kvm/irq.c56
-rw-r--r--arch/x86/kvm/lapic.c140
-rw-r--r--arch/x86/kvm/lapic.h34
-rw-r--r--arch/x86/kvm/mmu.c32
-rw-r--r--arch/x86/kvm/paging_tmpl.h3
-rw-r--r--arch/x86/kvm/svm.c24
-rw-r--r--arch/x86/kvm/vmx.c336
-rw-r--r--arch/x86/kvm/x86.c25
-rw-r--r--drivers/s390/kvm/virtio_ccw.c20
-rw-r--r--include/linux/kvm_host.h3
-rw-r--r--kernel/sched/core.c25
-rw-r--r--virt/kvm/ioapic.c39
-rw-r--r--virt/kvm/ioapic.h4
-rw-r--r--virt/kvm/iommu.c4
-rw-r--r--virt/kvm/irq_comm.c25
-rw-r--r--virt/kvm/kvm_main.c106
23 files changed, 803 insertions, 166 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index 09905cbcbb0b..c2534c300a45 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -219,19 +219,6 @@ allocation of vcpu ids. For example, if userspace wants
219single-threaded guest vcpus, it should make all vcpu ids be a multiple 219single-threaded guest vcpus, it should make all vcpu ids be a multiple
220of the number of vcpus per vcore. 220of the number of vcpus per vcore.
221 221
222On powerpc using book3s_hv mode, the vcpus are mapped onto virtual
223threads in one or more virtual CPU cores. (This is because the
224hardware requires all the hardware threads in a CPU core to be in the
225same partition.) The KVM_CAP_PPC_SMT capability indicates the number
226of vcpus per virtual core (vcore). The vcore id is obtained by
227dividing the vcpu id by the number of vcpus per vcore. The vcpus in a
228given vcore will always be in the same physical core as each other
229(though that might be a different physical core from time to time).
230Userspace can control the threading (SMT) mode of the guest by its
231allocation of vcpu ids. For example, if userspace wants
232single-threaded guest vcpus, it should make all vcpu ids be a multiple
233of the number of vcpus per vcore.
234
235For virtual cpus that have been created with S390 user controlled virtual 222For virtual cpus that have been created with S390 user controlled virtual
236machines, the resulting vcpu fd can be memory mapped at page offset 223machines, the resulting vcpu fd can be memory mapped at page offset
237KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual 224KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual
@@ -874,12 +861,12 @@ It is recommended that the lower 21 bits of guest_phys_addr and userspace_addr
874be identical. This allows large pages in the guest to be backed by large 861be identical. This allows large pages in the guest to be backed by large
875pages in the host. 862pages in the host.
876 863
877The flags field supports two flag, KVM_MEM_LOG_DIRTY_PAGES, which instructs 864The flags field supports two flags: KVM_MEM_LOG_DIRTY_PAGES and
878kvm to keep track of writes to memory within the slot. See KVM_GET_DIRTY_LOG 865KVM_MEM_READONLY. The former can be set to instruct KVM to keep track of
879ioctl. The KVM_CAP_READONLY_MEM capability indicates the availability of the 866writes to memory within the slot. See KVM_GET_DIRTY_LOG ioctl to know how to
880KVM_MEM_READONLY flag. When this flag is set for a memory region, KVM only 867use it. The latter can be set, if KVM_CAP_READONLY_MEM capability allows it,
881allows read accesses. Writes will be posted to userspace as KVM_EXIT_MMIO 868to make a new slot read-only. In this case, writes to this memory will be
882exits. 869posted to userspace as KVM_EXIT_MMIO exits.
883 870
884When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of 871When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of
885the memory region are automatically reflected into the guest. For example, an 872the memory region are automatically reflected into the guest. For example, an
diff --git a/arch/ia64/kvm/lapic.h b/arch/ia64/kvm/lapic.h
index c5f92a926a9a..c3e2935b6db4 100644
--- a/arch/ia64/kvm/lapic.h
+++ b/arch/ia64/kvm/lapic.h
@@ -27,4 +27,10 @@ int kvm_apic_set_irq(struct kvm_vcpu *vcpu, struct kvm_lapic_irq *irq);
27#define kvm_apic_present(x) (true) 27#define kvm_apic_present(x) (true)
28#define kvm_lapic_enabled(x) (true) 28#define kvm_lapic_enabled(x) (true)
29 29
30static inline bool kvm_apic_vid_enabled(void)
31{
32 /* IA64 has no apicv supporting, do nothing here */
33 return false;
34}
35
30#endif 36#endif
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 5b01f0953900..4377d1886631 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -770,6 +770,14 @@ int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
770 } else 770 } else
771 prefix = 0; 771 prefix = 0;
772 772
773 /*
774 * The guest FPRS and ACRS are in the host FPRS/ACRS due to the lazy
775 * copying in vcpu load/put. Lets update our copies before we save
776 * it into the save area
777 */
778 save_fp_regs(&vcpu->arch.guest_fpregs);
779 save_access_regs(vcpu->run->s.regs.acrs);
780
773 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs), 781 if (__guestcopy(vcpu, addr + offsetof(struct save_area, fp_regs),
774 vcpu->arch.guest_fpregs.fprs, 128, prefix)) 782 vcpu->arch.guest_fpregs.fprs, 128, prefix))
775 return -EFAULT; 783 return -EFAULT;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 3e05deff21b6..4d89d64a8161 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -67,8 +67,8 @@ static inline void kvm_s390_set_prefix(struct kvm_vcpu *vcpu, u32 prefix)
67 67
68static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu) 68static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu)
69{ 69{
70 int base2 = vcpu->arch.sie_block->ipb >> 28; 70 u32 base2 = vcpu->arch.sie_block->ipb >> 28;
71 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); 71 u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
72 72
73 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; 73 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
74} 74}
@@ -76,10 +76,10 @@ static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu)
76static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, 76static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu,
77 u64 *address1, u64 *address2) 77 u64 *address1, u64 *address2)
78{ 78{
79 int base1 = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28; 79 u32 base1 = (vcpu->arch.sie_block->ipb & 0xf0000000) >> 28;
80 int disp1 = (vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16; 80 u32 disp1 = (vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16;
81 int base2 = (vcpu->arch.sie_block->ipb & 0xf000) >> 12; 81 u32 base2 = (vcpu->arch.sie_block->ipb & 0xf000) >> 12;
82 int disp2 = vcpu->arch.sie_block->ipb & 0x0fff; 82 u32 disp2 = vcpu->arch.sie_block->ipb & 0x0fff;
83 83
84 *address1 = (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1; 84 *address1 = (base1 ? vcpu->run->s.regs.gprs[base1] : 0) + disp1;
85 *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; 85 *address2 = (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
@@ -87,17 +87,20 @@ static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu,
87 87
88static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu) 88static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu)
89{ 89{
90 int base2 = vcpu->arch.sie_block->ipb >> 28; 90 u32 base2 = vcpu->arch.sie_block->ipb >> 28;
91 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) + 91 u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16) +
92 ((vcpu->arch.sie_block->ipb & 0xff00) << 4); 92 ((vcpu->arch.sie_block->ipb & 0xff00) << 4);
93 /* The displacement is a 20bit _SIGNED_ value */
94 if (disp2 & 0x80000)
95 disp2+=0xfff00000;
93 96
94 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; 97 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + (long)(int)disp2;
95} 98}
96 99
97static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu) 100static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu)
98{ 101{
99 int base2 = vcpu->arch.sie_block->ipb >> 28; 102 u32 base2 = vcpu->arch.sie_block->ipb >> 28;
100 int disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16); 103 u32 disp2 = ((vcpu->arch.sie_block->ipb & 0x0fff0000) >> 16);
101 104
102 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2; 105 return (base2 ? vcpu->run->s.regs.gprs[base2] : 0) + disp2;
103} 106}
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 77d56a4ba89c..635a74d22409 100644
--- a/