diff options
Diffstat (limited to 'arch/ia64/kvm/kvm-ia64.c')
-rw-r--r-- | arch/ia64/kvm/kvm-ia64.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c index dbf527a57341..9c77e3939e97 100644 --- a/arch/ia64/kvm/kvm-ia64.c +++ b/arch/ia64/kvm/kvm-ia64.c | |||
@@ -314,7 +314,7 @@ static struct kvm_vcpu *lid_to_vcpu(struct kvm *kvm, unsigned long id, | |||
314 | union ia64_lid lid; | 314 | union ia64_lid lid; |
315 | int i; | 315 | int i; |
316 | 316 | ||
317 | for (i = 0; i < KVM_MAX_VCPUS; i++) { | 317 | for (i = 0; i < kvm->arch.online_vcpus; i++) { |
318 | if (kvm->vcpus[i]) { | 318 | if (kvm->vcpus[i]) { |
319 | lid.val = VCPU_LID(kvm->vcpus[i]); | 319 | lid.val = VCPU_LID(kvm->vcpus[i]); |
320 | if (lid.id == id && lid.eid == eid) | 320 | if (lid.id == id && lid.eid == eid) |
@@ -388,7 +388,7 @@ static int handle_global_purge(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) | |||
388 | 388 | ||
389 | call_data.ptc_g_data = p->u.ptc_g_data; | 389 | call_data.ptc_g_data = p->u.ptc_g_data; |
390 | 390 | ||
391 | for (i = 0; i < KVM_MAX_VCPUS; i++) { | 391 | for (i = 0; i < kvm->arch.online_vcpus; i++) { |
392 | if (!kvm->vcpus[i] || kvm->vcpus[i]->arch.mp_state == | 392 | if (!kvm->vcpus[i] || kvm->vcpus[i]->arch.mp_state == |
393 | KVM_MP_STATE_UNINITIALIZED || | 393 | KVM_MP_STATE_UNINITIALIZED || |
394 | vcpu == kvm->vcpus[i]) | 394 | vcpu == kvm->vcpus[i]) |
@@ -788,6 +788,8 @@ struct kvm *kvm_arch_create_vm(void) | |||
788 | return ERR_PTR(-ENOMEM); | 788 | return ERR_PTR(-ENOMEM); |
789 | kvm_init_vm(kvm); | 789 | kvm_init_vm(kvm); |
790 | 790 | ||
791 | kvm->arch.online_vcpus = 0; | ||
792 | |||
791 | return kvm; | 793 | return kvm; |
792 | 794 | ||
793 | } | 795 | } |
@@ -1154,7 +1156,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | |||
1154 | 1156 | ||
1155 | /*Initialize itc offset for vcpus*/ | 1157 | /*Initialize itc offset for vcpus*/ |
1156 | itc_offset = 0UL - ia64_getreg(_IA64_REG_AR_ITC); | 1158 | itc_offset = 0UL - ia64_getreg(_IA64_REG_AR_ITC); |
1157 | for (i = 0; i < KVM_MAX_VCPUS; i++) { | 1159 | for (i = 0; i < kvm->arch.online_vcpus; i++) { |
1158 | v = (struct kvm_vcpu *)((char *)vcpu + | 1160 | v = (struct kvm_vcpu *)((char *)vcpu + |
1159 | sizeof(struct kvm_vcpu_data) * i); | 1161 | sizeof(struct kvm_vcpu_data) * i); |
1160 | v->arch.itc_offset = itc_offset; | 1162 | v->arch.itc_offset = itc_offset; |
@@ -1288,6 +1290,8 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm, | |||
1288 | goto fail; | 1290 | goto fail; |
1289 | } | 1291 | } |
1290 | 1292 | ||
1293 | kvm->arch.online_vcpus++; | ||
1294 | |||
1291 | return vcpu; | 1295 | return vcpu; |
1292 | fail: | 1296 | fail: |
1293 | return ERR_PTR(r); | 1297 | return ERR_PTR(r); |
@@ -1828,7 +1832,7 @@ struct kvm_vcpu *kvm_get_lowest_prio_vcpu(struct kvm *kvm, u8 vector, | |||
1828 | struct kvm_vcpu *lvcpu = kvm->vcpus[0]; | 1832 | struct kvm_vcpu *lvcpu = kvm->vcpus[0]; |
1829 | int i; | 1833 | int i; |
1830 | 1834 | ||
1831 | for (i = 1; i < KVM_MAX_VCPUS; i++) { | 1835 | for (i = 1; i < kvm->arch.online_vcpus; i++) { |
1832 | if (!kvm->vcpus[i]) | 1836 | if (!kvm->vcpus[i]) |
1833 | continue; | 1837 | continue; |
1834 | if (lvcpu->arch.xtp > kvm->vcpus[i]->arch.xtp) | 1838 | if (lvcpu->arch.xtp > kvm->vcpus[i]->arch.xtp) |