diff options
| author | Alexander Graf <agraf@suse.de> | 2013-02-13 06:56:14 -0500 |
|---|---|---|
| committer | Alexander Graf <agraf@suse.de> | 2013-02-13 06:56:14 -0500 |
| commit | dd92d6f2749c43ebab91c4762a1bc79e6523e936 (patch) | |
| tree | 6e6730bdd09284679c0861df6d0fcbec08ea7a87 | |
| parent | b9e3e208935e95ad62bd1b1bc4408c23a9ae3ada (diff) | |
| parent | b0da5bec30eca7ffbb2c89afa6fe503fd418d3a6 (diff) | |
Merge commit 'origin/next' into kvm-ppc-next
| -rw-r--r-- | Documentation/virtual/kvm/api.txt | 25 | ||||
| -rw-r--r-- | arch/ia64/kvm/lapic.h | 6 | ||||
| -rw-r--r-- | arch/s390/kvm/kvm-s390.c | 8 | ||||
| -rw-r--r-- | arch/s390/kvm/kvm-s390.h | 25 | ||||
| -rw-r--r-- | arch/x86/include/asm/kvm_host.h | 6 | ||||
| -rw-r--r-- | arch/x86/include/asm/vmx.h | 21 | ||||
| -rw-r--r-- | arch/x86/kvm/emulate.c | 2 | ||||
| -rw-r--r-- | arch/x86/kvm/irq.c | 56 | ||||
| -rw-r--r-- | arch/x86/kvm/lapic.c | 140 | ||||
| -rw-r--r-- | arch/x86/kvm/lapic.h | 34 | ||||
| -rw-r--r-- | arch/x86/kvm/mmu.c | 32 | ||||
| -rw-r--r-- | arch/x86/kvm/paging_tmpl.h | 3 | ||||
| -rw-r--r-- | arch/x86/kvm/svm.c | 24 | ||||
| -rw-r--r-- | arch/x86/kvm/vmx.c | 336 | ||||
| -rw-r--r-- | arch/x86/kvm/x86.c | 25 | ||||
| -rw-r--r-- | drivers/s390/kvm/virtio_ccw.c | 20 | ||||
| -rw-r--r-- | include/linux/kvm_host.h | 3 | ||||
| -rw-r--r-- | kernel/sched/core.c | 25 | ||||
| -rw-r--r-- | virt/kvm/ioapic.c | 39 | ||||
| -rw-r--r-- | virt/kvm/ioapic.h | 4 | ||||
| -rw-r--r-- | virt/kvm/iommu.c | 4 | ||||
| -rw-r--r-- | virt/kvm/irq_comm.c | 25 | ||||
| -rw-r--r-- | virt/kvm/kvm_main.c | 106 |
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 | |||
| 219 | single-threaded guest vcpus, it should make all vcpu ids be a multiple | 219 | single-threaded guest vcpus, it should make all vcpu ids be a multiple |
| 220 | of the number of vcpus per vcore. | 220 | of the number of vcpus per vcore. |
| 221 | 221 | ||
| 222 | On powerpc using book3s_hv mode, the vcpus are mapped onto virtual | ||
| 223 | threads in one or more virtual CPU cores. (This is because the | ||
| 224 | hardware requires all the hardware threads in a CPU core to be in the | ||
| 225 | same partition.) The KVM_CAP_PPC_SMT capability indicates the number | ||
| 226 | of vcpus per virtual core (vcore). The vcore id is obtained by | ||
| 227 | dividing the vcpu id by the number of vcpus per vcore. The vcpus in a | ||
| 228 | given 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). | ||
| 230 | Userspace can control the threading (SMT) mode of the guest by its | ||
| 231 | allocation of vcpu ids. For example, if userspace wants | ||
| 232 | single-threaded guest vcpus, it should make all vcpu ids be a multiple | ||
| 233 | of the number of vcpus per vcore. | ||
| 234 | |||
| 235 | For virtual cpus that have been created with S390 user controlled virtual | 222 | For virtual cpus that have been created with S390 user controlled virtual |
| 236 | machines, the resulting vcpu fd can be memory mapped at page offset | 223 | machines, the resulting vcpu fd can be memory mapped at page offset |
| 237 | KVM_S390_SIE_PAGE_OFFSET in order to obtain a memory map of the virtual | 224 | KVM_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 | |||
| 874 | be identical. This allows large pages in the guest to be backed by large | 861 | be identical. This allows large pages in the guest to be backed by large |
| 875 | pages in the host. | 862 | pages in the host. |
| 876 | 863 | ||
| 877 | The flags field supports two flag, KVM_MEM_LOG_DIRTY_PAGES, which instructs | 864 | The flags field supports two flags: KVM_MEM_LOG_DIRTY_PAGES and |
| 878 | kvm to keep track of writes to memory within the slot. See KVM_GET_DIRTY_LOG | 865 | KVM_MEM_READONLY. The former can be set to instruct KVM to keep track of |
| 879 | ioctl. The KVM_CAP_READONLY_MEM capability indicates the availability of the | 866 | writes to memory within the slot. See KVM_GET_DIRTY_LOG ioctl to know how to |
| 880 | KVM_MEM_READONLY flag. When this flag is set for a memory region, KVM only | 867 | use it. The latter can be set, if KVM_CAP_READONLY_MEM capability allows it, |
| 881 | allows read accesses. Writes will be posted to userspace as KVM_EXIT_MMIO | 868 | to make a new slot read-only. In this case, writes to this memory will be |
| 882 | exits. | 869 | posted to userspace as KVM_EXIT_MMIO exits. |
| 883 | 870 | ||
| 884 | When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of | 871 | When the KVM_CAP_SYNC_MMU capability is available, changes in the backing of |
| 885 | the memory region are automatically reflected into the guest. For example, an | 872 | the 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 | ||
| 30 | static 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 | ||
| 68 | static inline u64 kvm_s390_get_base_disp_s(struct kvm_vcpu *vcpu) | 68 | static 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) | |||
| 76 | static inline void kvm_s390_get_base_disp_sse(struct kvm_vcpu *vcpu, | 76 | static 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 | ||
| 88 | static inline u64 kvm_s390_get_base_disp_rsy(struct kvm_vcpu *vcpu) | 88 | static 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 | ||
| 97 | static inline u64 kvm_s390_get_base_disp_rs(struct kvm_vcpu *vcpu) | 100 | static 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 | } |
