From patchwork Wed May 12 21:25:04 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marcelo Tosatti X-Patchwork-Id: 99108 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CLRHba029163 for ; Wed, 12 May 2010 21:27:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757949Ab0ELV1N (ORCPT ); Wed, 12 May 2010 17:27:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6517 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757935Ab0ELV1M (ORCPT ); Wed, 12 May 2010 17:27:12 -0400 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR5Ow011091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 12 May 2010 17:27:06 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR52S018170; Wed, 12 May 2010 17:27:05 -0400 Received: from amt.cnet (vpn2-10-158.ams2.redhat.com [10.36.10.158]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id o4CLR2Xg021865; Wed, 12 May 2010 17:27:04 -0400 Received: from amt.cnet (amt.cnet [127.0.0.1]) by amt.cnet (Postfix) with ESMTP id 69DEC65607F; Wed, 12 May 2010 18:26:23 -0300 (BRT) Received: (from marcelo@localhost) by amt.cnet (8.14.3/8.14.3/Submit) id o4CLQIHB028661; Wed, 12 May 2010 18:26:18 -0300 From: Marcelo Tosatti To: Anthony Liguori Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Marcelo Tosatti , Avi Kivity Subject: [PATCH 10/12] kvm: enable smp > 1 Date: Wed, 12 May 2010 18:25:04 -0300 Message-Id: <0af691d779965663abdd7bc708c2ad7bce2f6da0.1273699506.git.mtosatti@redhat.com> In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 12 May 2010 21:27:17 +0000 (UTC) diff --git a/kvm-all.c b/kvm-all.c index e766202..d06980c 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 70bfbf8..5071a31 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 c9ec72e..bd7a190 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 aa3d432..91c0963 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 72e77b0..a2c00ac 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) {