diff options
-rw-r--r-- | MAINTAINERS | 14 | ||||
-rw-r--r-- | arch/ia64/kvm/Makefile | 3 | ||||
-rw-r--r-- | arch/ia64/kvm/memcpy.S | 1 | ||||
-rw-r--r-- | arch/ia64/kvm/memset.S | 1 | ||||
-rw-r--r-- | arch/x86/kvm/i8254.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/lapic.c | 2 | ||||
-rw-r--r-- | arch/x86/kvm/x86_emulate.c | 7 | ||||
-rw-r--r-- | drivers/s390/kvm/kvm_virtio.c | 40 | ||||
-rw-r--r-- | include/asm-ia64/kvm.h | 12 | ||||
-rw-r--r-- | include/asm-x86/kvm_x86_emulate.h | 1 | ||||
-rw-r--r-- | virt/kvm/kvm_main.c | 29 |
11 files changed, 65 insertions, 47 deletions
diff --git a/MAINTAINERS b/MAINTAINERS index 915ad48d8bce..36e330c6f183 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -2352,24 +2352,24 @@ S: Supported | |||
2352 | KERNEL VIRTUAL MACHINE (KVM) | 2352 | KERNEL VIRTUAL MACHINE (KVM) |
2353 | P: Avi Kivity | 2353 | P: Avi Kivity |
2354 | M: avi@qumranet.com | 2354 | M: avi@qumranet.com |
2355 | L: kvm-devel@lists.sourceforge.net | 2355 | L: kvm@vger.kernel.org |
2356 | W: kvm.sourceforge.net | 2356 | W: http://kvm.qumranet.com |
2357 | S: Supported | 2357 | S: Supported |
2358 | 2358 | ||
2359 | KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC | 2359 | KERNEL VIRTUAL MACHINE (KVM) FOR POWERPC |
2360 | P: Hollis Blanchard | 2360 | P: Hollis Blanchard |
2361 | M: hollisb@us.ibm.com | 2361 | M: hollisb@us.ibm.com |
2362 | L: kvm-ppc-devel@lists.sourceforge.net | 2362 | L: kvm-ppc@vger.kernel.org |
2363 | W: kvm.sourceforge.net | 2363 | W: http://kvm.qumranet.com |
2364 | S: Supported | 2364 | S: Supported |
2365 | 2365 | ||
2366 | KERNEL VIRTUAL MACHINE For Itanium(KVM/IA64) | 2366 | KERNEL VIRTUAL MACHINE For Itanium (KVM/IA64) |
2367 | P: Anthony Xu | 2367 | P: Anthony Xu |
2368 | M: anthony.xu@intel.com | 2368 | M: anthony.xu@intel.com |
2369 | P: Xiantao Zhang | 2369 | P: Xiantao Zhang |
2370 | M: xiantao.zhang@intel.com | 2370 | M: xiantao.zhang@intel.com |
2371 | L: kvm-ia64-devel@lists.sourceforge.net | 2371 | L: kvm-ia64@vger.kernel.org |
2372 | W: kvm.sourceforge.net | 2372 | W: http://kvm.qumranet.com |
2373 | S: Supported | 2373 | S: Supported |
2374 | 2374 | ||
2375 | KERNEL VIRTUAL MACHINE for s390 (KVM/s390) | 2375 | KERNEL VIRTUAL MACHINE for s390 (KVM/s390) |
diff --git a/arch/ia64/kvm/Makefile b/arch/ia64/kvm/Makefile index 52353397a1a4..112791dd2542 100644 --- a/arch/ia64/kvm/Makefile +++ b/arch/ia64/kvm/Makefile | |||
@@ -7,7 +7,6 @@ offsets-file := asm-offsets.h | |||
7 | always := $(offsets-file) | 7 | always := $(offsets-file) |
8 | targets := $(offsets-file) | 8 | targets := $(offsets-file) |
9 | targets += arch/ia64/kvm/asm-offsets.s | 9 | targets += arch/ia64/kvm/asm-offsets.s |
10 | clean-files := $(addprefix $(objtree)/,$(targets) $(obj)/memcpy.S $(obj)/memset.S) | ||
11 | 10 | ||
12 | # Default sed regexp - multiline due to syntax constraints | 11 | # Default sed regexp - multiline due to syntax constraints |
13 | define sed-y | 12 | define sed-y |
@@ -54,5 +53,5 @@ EXTRA_CFLAGS_vcpu.o += -mfixed-range=f2-f5,f12-f127 | |||
54 | kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ | 53 | kvm-intel-objs = vmm.o vmm_ivt.o trampoline.o vcpu.o optvfault.o mmio.o \ |
55 | vtlb.o process.o | 54 | vtlb.o process.o |
56 | #Add link memcpy and memset to avoid possible structure assignment error | 55 | #Add link memcpy and memset to avoid possible structure assignment error |
57 | kvm-intel-objs += ../lib/memset.o ../lib/memcpy.o | 56 | kvm-intel-objs += memcpy.o memset.o |
58 | obj-$(CONFIG_KVM_INTEL) += kvm-intel.o | 57 | obj-$(CONFIG_KVM_INTEL) += kvm-intel.o |
diff --git a/arch/ia64/kvm/memcpy.S b/arch/ia64/kvm/memcpy.S new file mode 100644 index 000000000000..c04cdbe9f80f --- /dev/null +++ b/arch/ia64/kvm/memcpy.S | |||
@@ -0,0 +1 @@ | |||
#include "../lib/memcpy.S" | |||
diff --git a/arch/ia64/kvm/memset.S b/arch/ia64/kvm/memset.S new file mode 100644 index 000000000000..83c3066d844a --- /dev/null +++ b/arch/ia64/kvm/memset.S | |||
@@ -0,0 +1 @@ | |||
#include "../lib/memset.S" | |||
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 3324d90038e4..7c077a9d9777 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c | |||
@@ -216,7 +216,7 @@ int pit_has_pending_timer(struct kvm_vcpu *vcpu) | |||
216 | { | 216 | { |
217 | struct kvm_pit *pit = vcpu->kvm->arch.vpit; | 217 | struct kvm_pit *pit = vcpu->kvm->arch.vpit; |
218 | 218 | ||
219 | if (pit && vcpu->vcpu_id == 0) | 219 | if (pit && vcpu->vcpu_id == 0 && pit->pit_state.inject_pending) |
220 | return atomic_read(&pit->pit_state.pit_timer.pending); | 220 | return atomic_read(&pit->pit_state.pit_timer.pending); |
221 | 221 | ||
222 | return 0; | 222 | return 0; |
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c index 36809d79788b..c297c50eba63 100644 --- a/arch/x86/kvm/lapic.c +++ b/arch/x86/kvm/lapic.c | |||
@@ -957,7 +957,7 @@ int apic_has_pending_timer(struct kvm_vcpu *vcpu) | |||
957 | { | 957 | { |
958 | struct kvm_lapic *lapic = vcpu->arch.apic; | 958 | struct kvm_lapic *lapic = vcpu->arch.apic; |
959 | 959 | ||
960 | if (lapic) | 960 | if (lapic && apic_enabled(lapic) && apic_lvt_enabled(lapic, APIC_LVTT)) |
961 | return atomic_read(&lapic->timer.pending); | 961 | return atomic_read(&lapic->timer.pending); |
962 | 962 | ||
963 | return 0; | 963 | return 0; |
diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index f2a696d6a243..8a96320ab071 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c | |||
@@ -677,8 +677,9 @@ static int decode_modrm(struct x86_emulate_ctxt *ctxt, | |||
677 | c->use_modrm_ea = 1; | 677 | c->use_modrm_ea = 1; |
678 | 678 | ||
679 | if (c->modrm_mod == 3) { | 679 | if (c->modrm_mod == 3) { |
680 | c->modrm_val = *(unsigned long *) | 680 | c->modrm_ptr = decode_register(c->modrm_rm, |
681 | decode_register(c->modrm_rm, c->regs, c->d & ByteOp); | 681 | c->regs, c->d & ByteOp); |
682 | c->modrm_val = *(unsigned long *)c->modrm_ptr; | ||
682 | return rc; | 683 | return rc; |
683 | } | 684 | } |
684 | 685 | ||
@@ -1005,6 +1006,7 @@ done_prefixes: | |||
1005 | if ((c->d & ModRM) && c->modrm_mod == 3) { | 1006 | if ((c->d & ModRM) && c->modrm_mod == 3) { |
1006 | c->src.type = OP_REG; | 1007 | c->src.type = OP_REG; |
1007 | c->src.val = c->modrm_val; | 1008 | c->src.val = c->modrm_val; |
1009 | c->src.ptr = c->modrm_ptr; | ||
1008 | break; | 1010 | break; |
1009 | } | 1011 | } |
1010 | c->src.type = OP_MEM; | 1012 | c->src.type = OP_MEM; |
@@ -1049,6 +1051,7 @@ done_prefixes: | |||
1049 | if ((c->d & ModRM) && c->modrm_mod == 3) { | 1051 | if ((c->d & ModRM) && c->modrm_mod == 3) { |
1050 | c->dst.type = OP_REG; | 1052 | c->dst.type = OP_REG; |
1051 | c->dst.val = c->dst.orig_val = c->modrm_val; | 1053 | c->dst.val = c->dst.orig_val = c->modrm_val; |
1054 | c->dst.ptr = c->modrm_ptr; | ||
1052 | break; | 1055 | break; |
1053 | } | 1056 | } |
1054 | c->dst.type = OP_MEM; | 1057 | c->dst.type = OP_MEM; |
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 47a7e6200b26..9f55ce6f3c78 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c | |||
@@ -78,27 +78,32 @@ static unsigned desc_size(const struct kvm_device_desc *desc) | |||
78 | + desc->config_len; | 78 | + desc->config_len; |
79 | } | 79 | } |
80 | 80 | ||
81 | /* | 81 | /* This gets the device's feature bits. */ |
82 | * This tests (and acknowleges) a feature bit. | 82 | static u32 kvm_get_features(struct virtio_device *vdev) |
83 | */ | ||
84 | static bool kvm_feature(struct virtio_device *vdev, unsigned fbit) | ||
85 | { | 83 | { |
84 | unsigned int i; | ||
85 | u32 features = 0; | ||
86 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; | 86 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; |
87 | u8 *features; | 87 | u8 *in_features = kvm_vq_features(desc); |
88 | 88 | ||
89 | if (fbit / 8 > desc->feature_len) | 89 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) |
90 | return false; | 90 | if (in_features[i / 8] & (1 << (i % 8))) |
91 | features |= (1 << i); | ||
92 | return features; | ||
93 | } | ||
91 | 94 | ||
92 | features = kvm_vq_features(desc); | 95 | static void kvm_set_features(struct virtio_device *vdev, u32 features) |
93 | if (!(features[fbit / 8] & (1 << (fbit % 8)))) | 96 | { |
94 | return false; | 97 | unsigned int i; |
98 | struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; | ||
99 | /* Second half of bitmap is features we accept. */ | ||
100 | u8 *out_features = kvm_vq_features(desc) + desc->feature_len; | ||
95 | 101 | ||
96 | /* | 102 | memset(out_features, 0, desc->feature_len); |
97 | * We set the matching bit in the other half of the bitmap to tell the | 103 | for (i = 0; i < min(desc->feature_len * 8, 32); i++) { |
98 | * Host we want to use this feature. | 104 | if (features & (1 << i)) |
99 | */ | 105 | out_features[i / 8] |= (1 << (i % 8)); |
100 | features[desc->feature_len + fbit / 8] |= (1 << (fbit % 8)); | 106 | } |
101 | return true; | ||
102 | } | 107 | } |
103 | 108 | ||
104 | /* | 109 | /* |
@@ -221,7 +226,8 @@ static void kvm_del_vq(struct virtqueue *vq) | |||
221 | * The config ops structure as defined by virtio config | 226 | * The config ops structure as defined by virtio config |
222 | */ | 227 | */ |
223 | static struct virtio_config_ops kvm_vq_configspace_ops = { | 228 | static struct virtio_config_ops kvm_vq_configspace_ops = { |
224 | .feature = kvm_feature, | 229 | .get_features = kvm_get_features, |
230 | .set_features = kvm_set_features, | ||
225 | .get = kvm_get, | 231 | .get = kvm_get, |
226 | .set = kvm_set, | 232 | .set = kvm_set, |
227 | .get_status = kvm_get_status, | 233 | .get_status = kvm_get_status, |
diff --git a/include/asm-ia64/kvm.h b/include/asm-ia64/kvm.h index eb2d3559d089..3f6a090cbd9a 100644 --- a/include/asm-ia64/kvm.h +++ b/include/asm-ia64/kvm.h | |||
@@ -22,14 +22,13 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <asm/types.h> | 24 | #include <asm/types.h> |
25 | #include <asm/fpu.h> | ||
26 | 25 | ||
27 | #include <linux/ioctl.h> | 26 | #include <linux/ioctl.h> |
28 | 27 | ||
29 | /* Architectural interrupt line count. */ | 28 | /* Architectural interrupt line count. */ |
30 | #define KVM_NR_INTERRUPTS 256 | 29 | #define KVM_NR_INTERRUPTS 256 |
31 | 30 | ||
32 | #define KVM_IOAPIC_NUM_PINS 24 | 31 | #define KVM_IOAPIC_NUM_PINS 48 |
33 | 32 | ||
34 | struct kvm_ioapic_state { | 33 | struct kvm_ioapic_state { |
35 | __u64 base_address; | 34 | __u64 base_address; |
@@ -61,6 +60,13 @@ struct kvm_ioapic_state { | |||
61 | 60 | ||
62 | #define KVM_CONTEXT_SIZE 8*1024 | 61 | #define KVM_CONTEXT_SIZE 8*1024 |
63 | 62 | ||
63 | struct kvm_fpreg { | ||
64 | union { | ||
65 | unsigned long bits[2]; | ||
66 | long double __dummy; /* force 16-byte alignment */ | ||
67 | } u; | ||
68 | }; | ||
69 | |||
64 | union context { | 70 | union context { |
65 | /* 8K size */ | 71 | /* 8K size */ |
66 | char dummy[KVM_CONTEXT_SIZE]; | 72 | char dummy[KVM_CONTEXT_SIZE]; |
@@ -77,7 +83,7 @@ union context { | |||
77 | unsigned long ibr[8]; | 83 | unsigned long ibr[8]; |
78 | unsigned long dbr[8]; | 84 | unsigned long dbr[8]; |
79 | unsigned long pkr[8]; | 85 | unsigned long pkr[8]; |
80 | struct ia64_fpreg fr[128]; | 86 | struct kvm_fpreg fr[128]; |
81 | }; | 87 | }; |
82 | }; | 88 | }; |
83 | 89 | ||
diff --git a/include/asm-x86/kvm_x86_emulate.h b/include/asm-x86/kvm_x86_emulate.h index d6337f941c98..b877bbd2d3a7 100644 --- a/include/asm-x86/kvm_x86_emulate.h +++ b/include/asm-x86/kvm_x86_emulate.h | |||
@@ -135,6 +135,7 @@ struct decode_cache { | |||
135 | u8 modrm_rm; | 135 | u8 modrm_rm; |
136 | u8 use_modrm_ea; | 136 | u8 use_modrm_ea; |
137 | unsigned long modrm_ea; | 137 | unsigned long modrm_ea; |
138 | void *modrm_ptr; | ||
138 | unsigned long modrm_val; | 139 | unsigned long modrm_val; |
139 | struct fetch_cache fetch; | 140 | struct fetch_cache fetch; |
140 | }; | 141 | }; |
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index f7ba099049ea..2d29e260da3d 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c | |||
@@ -758,25 +758,26 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn) | |||
758 | */ | 758 | */ |
759 | void kvm_vcpu_block(struct kvm_vcpu *vcpu) | 759 | void kvm_vcpu_block(struct kvm_vcpu *vcpu) |
760 | { | 760 | { |
761 | DECLARE_WAITQUEUE(wait, current); | 761 | DEFINE_WAIT(wait); |
762 | 762 | ||
763 | add_wait_queue(&vcpu->wq, &wait); | 763 | for (;;) { |
764 | 764 | prepare_to_wait(&vcpu->wq, &wait, TASK_INTERRUPTIBLE); | |
765 | /* | 765 | |
766 | * We will block until either an interrupt or a signal wakes us up | 766 | if (kvm_cpu_has_interrupt(vcpu)) |
767 | */ | 767 | break; |
768 | while (!kvm_cpu_has_interrupt(vcpu) | 768 | if (kvm_cpu_has_pending_timer(vcpu)) |
769 | && !kvm_cpu_has_pending_timer(vcpu) | 769 | break; |
770 | && !signal_pending(current) | 770 | if (kvm_arch_vcpu_runnable(vcpu)) |
771 | && !kvm_arch_vcpu_runnable(vcpu)) { | 771 | break; |
772 | set_current_state(TASK_INTERRUPTIBLE); | 772 | if (signal_pending(current)) |
773 | break; | ||
774 | |||
773 | vcpu_put(vcpu); | 775 | vcpu_put(vcpu); |
774 | schedule(); | 776 | schedule(); |
775 | vcpu_load(vcpu); | 777 | vcpu_load(vcpu); |
776 | } | 778 | } |
777 | 779 | ||
778 | __set_current_state(TASK_RUNNING); | 780 | finish_wait(&vcpu->wq, &wait); |
779 | remove_wait_queue(&vcpu->wq, &wait); | ||
780 | } | 781 | } |
781 | 782 | ||
782 | void kvm_resched(struct kvm_vcpu *vcpu) | 783 | void kvm_resched(struct kvm_vcpu *vcpu) |