]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
kvm: enable smp > 1
authorMarcelo Tosatti <mtosatti@redhat.com>
Tue, 4 May 2010 12:45:27 +0000 (09:45 -0300)
committerMarcelo Tosatti <mtosatti@redhat.com>
Tue, 11 May 2010 17:02:22 +0000 (14:02 -0300)
Process INIT/SIPI requests and enable -smp > 1.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
kvm-all.c
kvm.h
target-i386/kvm.c
target-ppc/kvm.c
target-s390x/kvm.c

index e76620229f2804745e200517010551910246dca8..d06980c0009730cb72ca9bbe66255d678575872f 100644 (file)
--- 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 70bfbf8abc5b112a081ef98564da392297543ae3..5071a31decd7e228f17a741085b81e0f4f1f08ae 100644 (file)
--- 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 */
index c9ec72eee79fc5cce922e05b95a5ed13be9930d8..bd7a1906783dc2e194d02471428aeeb1aca46a0b 100644 (file)
@@ -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) &&
index aa3d43247bb80ebef19e8e6e5f8bcf9e60f27662..91c0963f8864cd6378ef9833c521f23fcd2540bd 100644 (file)
@@ -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)) {
index 72e77b0cdae628e8d094940705da6a83f542397d..a2c00acf0fca5fd53df88f1464d21dd0afa07ee0 100644 (file)
@@ -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)
 {