aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2010-05-04 09:45:27 -0300
committerMarcelo Tosatti <mtosatti@redhat.com>2010-05-11 14:02:22 -0300
commit0af691d779965663abdd7bc708c2ad7bce2f6da0 (patch)
treed70d5e1f8b12998b4873fcf83c963862a30e0b4e
parentdbaa07c404d05676df8a081e60b6e66344eafc51 (diff)
kvm: enable smp > 1
Process INIT/SIPI requests and enable -smp > 1. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--kvm-all.c10
-rw-r--r--kvm.h2
-rw-r--r--target-i386/kvm.c16
-rw-r--r--target-ppc/kvm.c5
-rw-r--r--target-s390x/kvm.c5
5 files changed, 33 insertions, 5 deletions
diff --git a/kvm-all.c b/kvm-all.c
index e76620229f..d06980c000 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -593,11 +593,6 @@ int kvm_init(int smp_cpus)
int ret;
int i;
- if (smp_cpus > 1) {
- fprintf(stderr, "No SMP KVM support, use '-smp 1'\n");
- return -EINVAL;
- }
-
s = qemu_mallocz(sizeof(KVMState));
#ifdef KVM_CAP_SET_GUEST_DEBUG
@@ -840,6 +835,11 @@ int kvm_cpu_exec(CPUState *env)
}
#endif
+ if (kvm_arch_process_irqchip_events(env)) {
+ ret = 0;
+ break;
+ }
+
if (env->kvm_vcpu_dirty) {
kvm_arch_put_registers(env, KVM_PUT_RUNTIME_STATE);
env->kvm_vcpu_dirty = 0;
diff --git a/kvm.h b/kvm.h
index 70bfbf8abc..5071a31dec 100644
--- a/kvm.h
+++ b/kvm.h
@@ -90,6 +90,8 @@ int kvm_arch_handle_exit(CPUState *env, struct kvm_run *run);
int kvm_arch_pre_run(CPUState *env, struct kvm_run *run);
+int kvm_arch_process_irqchip_events(CPUState *env);
+
int kvm_arch_get_registers(CPUState *env);
/* state subset only touched by the VCPU itself during runtime */
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index c9ec72eee7..bd7a190678 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -1073,6 +1073,22 @@ int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
return 0;
}
+int kvm_arch_process_irqchip_events(CPUState *env)
+{
+ if (env->interrupt_request & CPU_INTERRUPT_INIT) {
+ kvm_cpu_synchronize_state(env);
+ do_cpu_init(env);
+ env->exception_index = EXCP_HALTED;
+ }
+
+ if (env->interrupt_request & CPU_INTERRUPT_SIPI) {
+ kvm_cpu_synchronize_state(env);
+ do_cpu_sipi(env);
+ }
+
+ return env->halted;
+}
+
static int kvm_handle_halt(CPUState *env)
{
if (!((env->interrupt_request & CPU_INTERRUPT_HARD) &&
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index aa3d43247b..91c0963f88 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -224,6 +224,11 @@ int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
return 0;
}
+int kvm_arch_process_irqchip_events(CPUState *env)
+{
+ return 0;
+}
+
static int kvmppc_handle_halt(CPUState *env)
{
if (!(env->interrupt_request & CPU_INTERRUPT_HARD) && (msr_ee)) {
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 72e77b0cda..a2c00acf0f 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -175,6 +175,11 @@ int kvm_arch_post_run(CPUState *env, struct kvm_run *run)
return 0;
}
+int kvm_arch_process_irqchip_events(CPUState *env)
+{
+ return 0;
+}
+
static void kvm_s390_interrupt_internal(CPUState *env, int type, uint32_t parm,
uint64_t parm64, int vm)
{