aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2009-06-09 08:56:28 -0400
committerAvi Kivity <avi@redhat.com>2009-09-10 01:32:52 -0400
commit73880c80aa9c8dc353cd0ad26579023213cd5314 (patch)
treed5bee5c87c3468feb941cc898e342f52c0adce19 /arch/ia64
parent1ed0ce000a6c20c36ec649e32fc24393ef418ed8 (diff)
KVM: Break dependency between vcpu index in vcpus array and vcpu_id.
Archs are free to use vcpu_id as they see fit. For x86 it is used as vcpu's apic id. New ioctl is added to configure boot vcpu id that was assumed to be 0 till now. Signed-off-by: Gleb Natapov <gleb@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'arch/ia64')
-rw-r--r--arch/ia64/include/asm/kvm_host.h1
-rw-r--r--arch/ia64/kvm/Kconfig1
-rw-r--r--arch/ia64/kvm/kvm-ia64.c8
-rw-r--r--arch/ia64/kvm/vcpu.c2
4 files changed, 4 insertions, 8 deletions
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index 5f43697aed30..9cf1c4b1f92f 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -465,7 +465,6 @@ struct kvm_arch {
465 unsigned long metaphysical_rr4; 465 unsigned long metaphysical_rr4;
466 unsigned long vmm_init_rr; 466 unsigned long vmm_init_rr;
467 467
468 int online_vcpus;
469 int is_sn2; 468 int is_sn2;
470 469
471 struct kvm_ioapic *vioapic; 470 struct kvm_ioapic *vioapic;
diff --git a/arch/ia64/kvm/Kconfig b/arch/ia64/kvm/Kconfig
index f922bbba3797..cbadd8a65233 100644
--- a/arch/ia64/kvm/Kconfig
+++ b/arch/ia64/kvm/Kconfig
@@ -25,6 +25,7 @@ config KVM
25 select PREEMPT_NOTIFIERS 25 select PREEMPT_NOTIFIERS
26 select ANON_INODES 26 select ANON_INODES
27 select HAVE_KVM_IRQCHIP 27 select HAVE_KVM_IRQCHIP
28 select KVM_APIC_ARCHITECTURE
28 ---help--- 29 ---help---
29 Support hosting fully virtualized guest machines using hardware 30 Support hosting fully virtualized guest machines using hardware
30 virtualization extensions. You will need a fairly recent 31 virtualization extensions. You will need a fairly recent
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 4082665ace0a..d1f7bcda2c7f 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -338,7 +338,7 @@ static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id,
338 union ia64_lid lid; 338 union ia64_lid lid;
339 int i; 339 int i;
340 340
341 for (i = 0; i < kvm->arch.online_vcpus; i++) { 341 for (i = 0; i < atomic_read(&kvm->online_vcpus); i++) {
342 if (kvm->vcpus[i]) { 342 if (kvm->vcpus[i]) {
343 lid.val = VCPU_LID(kvm->vcpus[i]); 343 lid.val = VCPU_LID(kvm->vcpus[i]);
344 if (lid.id == id && lid.eid == eid) 344 if (lid.id == id && lid.eid == eid)
@@ -412,7 +412,7 @@ static int handle_global_purge(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
412 412
413 call_data.ptc_g_data = p->u.ptc_g_data; 413 call_data.ptc_g_data = p->u.ptc_g_data;
414 414
415 for (i = 0; i < kvm->arch.online_vcpus; i++) { 415 for (i = 0; i < atomic_read(&kvm->online_vcpus); i++) {
416 if (!kvm->vcpus[i] || kvm->vcpus[i]->arch.mp_state == 416 if (!kvm->vcpus[i] || kvm->vcpus[i]->arch.mp_state ==
417 KVM_MP_STATE_UNINITIALIZED || 417 KVM_MP_STATE_UNINITIALIZED ||
418 vcpu == kvm->vcpus[i]) 418 vcpu == kvm->vcpus[i])
@@ -852,8 +852,6 @@ struct kvm *kvm_arch_create_vm(void)
852 852
853 kvm_init_vm(kvm); 853 kvm_init_vm(kvm);
854 854
855 kvm->arch.online_vcpus = 0;
856
857 return kvm; 855 return kvm;
858 856
859} 857}
@@ -1356,8 +1354,6 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
1356 goto fail; 1354 goto fail;
1357 } 1355 }
1358 1356
1359 kvm->arch.online_vcpus++;
1360
1361 return vcpu; 1357 return vcpu;
1362fail: 1358fail:
1363 return ERR_PTR(r); 1359 return ERR_PTR(r);
diff --git a/arch/ia64/kvm/vcpu.c b/arch/ia64/kvm/vcpu.c
index 61a3320b62c1..dce75b70cdd5 100644
--- a/arch/ia64/kvm/vcpu.c
+++ b/arch/ia64/kvm/vcpu.c
@@ -831,7 +831,7 @@ static void vcpu_set_itc(struct kvm_vcpu *vcpu, u64 val)
831 kvm = (struct kvm *)KVM_VM_BASE; 831 kvm = (struct kvm *)KVM_VM_BASE;
832 832
833 if (kvm_vcpu_is_bsp(vcpu)) { 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;