aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/include/asm/kvm_host.h4
-rw-r--r--arch/ia64/include/asm/kvm_para.h4
-rw-r--r--arch/ia64/kvm/Kconfig11
-rw-r--r--arch/ia64/kvm/kvm-ia64.c85
-rw-r--r--arch/ia64/kvm/vcpu.c4
5 files changed, 39 insertions, 69 deletions
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 5f43697aed30..d9b6325a9328 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -235,7 +235,8 @@ struct kvm_vm_data {
235#define KVM_REQ_PTC_G 32 235#define KVM_REQ_PTC_G 32
236#define KVM_REQ_RESUME 33 236#define KVM_REQ_RESUME 33
237 237
238#define KVM_PAGES_PER_HPAGE 1 238#define KVM_NR_PAGE_SIZES 1
239#define KVM_PAGES_PER_HPAGE(x) 1
239 240
240struct kvm; 241struct kvm;
241struct kvm_vcpu; 242struct kvm_vcpu;
@@ -465,7 +466,6 @@ struct kvm_arch {
465 unsigned long metaphysical_rr4; 466 unsigned long metaphysical_rr4;
466 unsigned long vmm_init_rr; 467 unsigned long vmm_init_rr;
467 468
468 int online_vcpus;
469 int is_sn2; 469 int is_sn2;
470 470
471 struct kvm_ioapic *vioapic; 471 struct kvm_ioapic *vioapic;
diff --git a/arch/ia64/include/asm/kvm_para.h b/arch/ia64/include/asm/kvm_para.h
index 0d6d8ca07b8c..1588aee781a2 100644
--- a/arch/ia64/include/asm/kvm_para.h
+++ b/arch/ia64/include/asm/kvm_para.h
@@ -19,9 +19,13 @@
19 * 19 *
20 */ 20 */
21 21
22#ifdef __KERNEL__
23
22static inline unsigned int kvm_arch_para_features(void) 24static inline unsigned int kvm_arch_para_features(void)
23{ 25{
24 return 0; 26 return 0;
25} 27}
26 28
27#endif 29#endif
30
31#endif
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig
index 64d520937874..ef3e7be29caf 100644
--- a/arch/ia64/kvm/Kconfig
+++ b/arch/ia64/kvm/Kconfig
@@ -1,12 +1,8 @@
1# 1#
2# KVM configuration 2# KVM configuration
3# 3#
4config HAVE_KVM
5 bool
6 4
7config HAVE_KVM_IRQCHIP 5source "virt/kvm/Kconfig"
8 bool
9 default y
10 6
11menuconfig VIRTUALIZATION 7menuconfig VIRTUALIZATION
12 bool "Virtualization" 8 bool "Virtualization"
@@ -28,6 +24,8 @@ config KVM
28 depends on PCI 24 depends on PCI
29 select PREEMPT_NOTIFIERS 25 select PREEMPT_NOTIFIERS
30 select ANON_INODES 26 select ANON_INODES
27 select HAVE_KVM_IRQCHIP
28 select KVM_APIC_ARCHITECTURE
31 ---help--- 29 ---help---
32 Support hosting fully virtualized guest machines using hardware 30 Support hosting fully virtualized guest machines using hardware
33 virtualization extensions. You will need a fairly recent 31 virtualization extensions. You will need a fairly recent
@@ -49,9 +47,6 @@ config KVM_INTEL
49 Provides support for KVM on Itanium 2 processors equipped with the VT 47 Provides support for KVM on Itanium 2 processors equipped with the VT
50 extensions. 48 extensions.
51 49
52config KVM_TRACE
53 bool
54
55source drivers/virtio/Kconfig 50source drivers/virtio/Kconfig
56 51
57endif # VIRTUALIZATION 52endif # VIRTUALIZATION
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 80c57b0a21c4..0ad09f05efa9 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -210,16 +210,6 @@ int kvm_dev_ioctl_check_extension(long ext)
210 210
211} 211}
212 212
213static struct kvm_io_device *vcpu_find_mmio_dev(struct kvm_vcpu *vcpu,
214 gpa_t addr, int len, int is_write)
215{
216 struct kvm_io_device *dev;
217
218 dev = kvm_io_bus_find_dev(&vcpu->kvm->mmio_bus, addr, len, is_write);
219
220 return dev;
221}
222
223static int handle_vm_error(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) 213static int handle_vm_error(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
224{ 214{
225 kvm_run->exit_reason = KVM_EXIT_UNKNOWN; 215 kvm_run->exit_reason = KVM_EXIT_UNKNOWN;
@@ -231,6 +221,7 @@ static int handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
231{ 221{
232 struct kvm_mmio_req *p; 222 struct kvm_mmio_req *p;
233 struct kvm_io_device *mmio_dev; 223 struct kvm_io_device *mmio_dev;
224 int r;
234 225
235 p = kvm_get_vcpu_ioreq(vcpu); 226 p = kvm_get_vcpu_ioreq(vcpu);
236 227
@@ -247,16 +238,13 @@ static int handle_mmio(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
247 kvm_run->exit_reason = KVM_EXIT_MMIO; 238 kvm_run->exit_reason = KVM_EXIT_MMIO;
248 return 0; 239 return 0;
249mmio: 240mmio:
250 mmio_dev = vcpu_find_mmio_dev(vcpu, p->addr, p->size, !p->dir); 241 if (p->dir)
251 if (mmio_dev) { 242 r = kvm_io_bus_read(&vcpu->kvm->mmio_bus, p->addr,
252 if (!p->dir) 243 p->size, &p->data);
253 kvm_iodevice_write(mmio_dev, p->addr, p->size, 244 else
254 &p->data); 245 r = kvm_io_bus_write(&vcpu->kvm->mmio_bus, p->addr,
255 else 246 p->size, &p->data);
256 kvm_iodevice_read(mmio_dev, p->addr, p->size, 247 if (r)
257 &p->data);
258
259 } else
260 printk(KERN_ERR"kvm: No iodevice found! addr:%lx\n", p->addr); 248 printk(KERN_ERR"kvm: No iodevice found! addr:%lx\n", p->addr);
261 p->state = STATE_IORESP_READY; 249 p->state = STATE_IORESP_READY;
262 250
@@ -337,13 +325,12 @@ static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id,
337{ 325{
338 union ia64_lid lid; 326 union ia64_lid lid;
339 int i; 327 int i;
328 struct kvm_vcpu *vcpu;
340 329
341 for (i = 0; i < kvm->arch.online_vcpus; i++) { 330 kvm_for_each_vcpu(i, vcpu, kvm) {
342 if (kvm->vcpus[i]) { 331 lid.val = VCPU_LID(vcpu);
343 lid.val = VCPU_LID(kvm->vcpus[i]); 332 if (lid.id == id && lid.eid == eid)
344 if (lid.id == id && lid.eid == eid) 333 return vcpu;
345 return kvm->vcpus[i];
346 }
347 } 334 }
348 335
349 return NULL; 336 return NULL;
@@ -409,21 +396,21 @@ static int handle_global_purge(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
409 struct kvm *kvm = vcpu->kvm; 396 struct kvm *kvm = vcpu->kvm;
410 struct call_data call_data; 397 struct call_data call_data;
411 int i; 398 int i;
399 struct kvm_vcpu *vcpui;
412 400
413 call_data.ptc_g_data = p->u.ptc_g_data; 401 call_data.ptc_g_data = p->u.ptc_g_data;
414 402
415 for (i = 0; i < kvm->arch.online_vcpus; i++) { 403 kvm_for_each_vcpu(i, vcpui, kvm) {
416 if (!kvm->vcpus[i] || kvm->vcpus[i]->arch.mp_state == 404 if (vcpui->arch.mp_state == KVM_MP_STATE_UNINITIALIZED ||
417 KVM_MP_STATE_UNINITIALIZED || 405 vcpu == vcpui)
418 vcpu == kvm->vcpus[i])
419 continue; 406 continue;
420 407
421 if (waitqueue_active(&kvm->vcpus[i]->wq)) 408 if (waitqueue_active(&vcpui->wq))
422 wake_up_interruptible(&kvm->vcpus[i]->wq); 409 wake_up_interruptible(&vcpui->wq);
423 410
424 if (kvm->vcpus[i]->cpu != -1) { 411 if (vcpui->cpu != -1) {
425 call_data.vcpu = kvm->vcpus[i]; 412 call_data.vcpu = vcpui;
426 smp_call_function_single(kvm->vcpus[i]->cpu, 413 smp_call_function_single(vcpui->cpu,
427 vcpu_global_purge, &call_data, 1); 414 vcpu_global_purge, &call_data, 1);
428 } else 415 } else
429 printk(KERN_WARNING"kvm: Uninit vcpu received ipi!\n"); 416 printk(KERN_WARNING"kvm: Uninit vcpu received ipi!\n");
@@ -852,8 +839,6 @@ struct kvm *kvm_arch_create_vm(void)
852 839
853 kvm_init_vm(kvm); 840 kvm_init_vm(kvm);
854 841
855 kvm->arch.online_vcpus = 0;
856
857 return kvm; 842 return kvm;
858 843
859} 844}
@@ -1000,10 +985,10 @@ long kvm_arch_vm_ioctl(struct file *filp,
1000 goto out; 985 goto out;
1001 if (irqchip_in_kernel(kvm)) { 986 if (irqchip_in_kernel(kvm)) {
1002 __s32 status; 987 __s32 status;
1003 mutex_lock(&kvm->lock); 988 mutex_lock(&kvm->irq_lock);
1004 status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, 989 status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID,
1005 irq_event.irq, irq_event.level); 990 irq_event.irq, irq_event.level);
1006 mutex_unlock(&kvm->lock); 991 mutex_unlock(&kvm->irq_lock);
1007 if (ioctl == KVM_IRQ_LINE_STATUS) { 992 if (ioctl == KVM_IRQ_LINE_STATUS) {
1008 irq_event.status = status; 993 irq_event.status = status;
1009 if (copy_to_user(argp, &irq_event, 994 if (copy_to_user(argp, &irq_event,
@@ -1216,7 +1201,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1216 if (IS_ERR(vmm_vcpu)) 1201 if (IS_ERR(vmm_vcpu))
1217 return PTR_ERR(vmm_vcpu); 1202 return PTR_ERR(vmm_vcpu);
1218 1203
1219 if (vcpu->vcpu_id == 0) { 1204 if (kvm_vcpu_is_bsp(vcpu)) {
1220 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 1205 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
1221 1206
1222 /*Set entry address for first run.*/ 1207 /*Set entry address for first run.*/
@@ -1224,7 +1209,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1224 1209
1225 /*Initialize itc offset for vcpus*/ 1210 /*Initialize itc offset for vcpus*/
1226 itc_offset = 0UL - kvm_get_itc(vcpu); 1211 itc_offset = 0UL - kvm_get_itc(vcpu);
1227 for (i = 0; i < kvm->arch.online_vcpus; i++) { 1212 for (i = 0; i < KVM_MAX_VCPUS; i++) {
1228 v = (struct kvm_vcpu *)((char *)vcpu + 1213 v = (struct kvm_vcpu *)((char *)vcpu +
1229 sizeof(struct kvm_vcpu_data) * i); 1214 sizeof(struct kvm_vcpu_data) * i);
1230 v->arch.itc_offset = itc_offset; 1215 v->arch.itc_offset = itc_offset;
@@ -1356,8 +1341,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
1356 goto fail; 1341 goto fail;
1357 } 1342 }
1358 1343
1359 kvm->arch.online_vcpus++;
1360
1361 return vcpu; 1344 return vcpu;
1362fail: 1345fail:
1363 return ERR_PTR(r); 1346 return ERR_PTR(r);
@@ -1952,19 +1935,6 @@ int kvm_highest_pending_irq(struct kvm_vcpu *vcpu)
1952 return find_highest_bits((int *)&vpd->irr[0]); 1935 return find_highest_bits((int *)&vpd->irr[0]);
1953} 1936}
1954 1937
1955int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu)
1956{
1957 if (kvm_highest_pending_irq(vcpu) != -1)
1958 return 1;
1959 return 0;
1960}
1961
1962int kvm_arch_interrupt_allowed(struct kvm_vcpu *vcpu)
1963{
1964 /* do real check here */
1965 return 1;
1966}
1967
1968int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu) 1938int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
1969{ 1939{
1970 return vcpu->arch.timer_fired; 1940 return vcpu->arch.timer_fired;
@@ -1977,7 +1947,8 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
1977 1947
1978int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 1948int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
1979{ 1949{
1980 return vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE; 1950 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) ||
1951 (kvm_highest_pending_irq(vcpu) != -1);
1981} 1952}
1982 1953
1983int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 1954int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index cc406d064a09..dce75b70cdd5 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -830,8 +830,8 @@ static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val)
830 830
831 kvm = (struct kvm *)KVM_VM_BASE; 831 kvm = (struct kvm *)KVM_VM_BASE;
832 832
833 if (vcpu->vcpu_id == 0) { 833 if (kvm_vcpu_is_bsp(vcpu)) {
834 for (i = 0; i < kvm->arch.online_vcpus; i++) { 834 for (i = 0; i < atomic_read(&kvm->online_vcpus); i++) {
835 v = (struct kvm_vcpu *)((char *)vcpu + 835 v = (struct kvm_vcpu *)((char *)vcpu +
836 sizeof(struct kvm_vcpu_data) * i); 836 sizeof(struct kvm_vcpu_data) * i);
837 VMX(v, itc_offset) = itc_offset; 837 VMX(v, itc_offset) = itc_offset;