From patchwork Wed Apr 24 20:49:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 239314 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1DC412C0170 for ; Thu, 25 Apr 2013 06:50:15 +1000 (EST) Received: from localhost ([::1]:34996 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV6dp-0005mT-1S for incoming@patchwork.ozlabs.org; Wed, 24 Apr 2013 16:50:13 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45593) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV6dX-0005mO-6x for qemu-devel@nongnu.org; Wed, 24 Apr 2013 16:49:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UV6dV-0005W3-T6 for qemu-devel@nongnu.org; Wed, 24 Apr 2013 16:49:55 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60902 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UV6dV-0005Vu-JW; Wed, 24 Apr 2013 16:49:53 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 9A60BA51FE; Wed, 24 Apr 2013 22:49:52 +0200 (CEST) From: Alexander Graf To: qemu-ppc@nongnu.org Date: Wed, 24 Apr 2013 22:49:49 +0200 Message-Id: <1366836589-20822-1-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.6.0.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Jan Kiszka , qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH] KVM: Don't assume that mpstate exists with in-kernel PIC always X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On PPC, we don't support MP state. So far it's not necessary and I'm not convinced yet that we really need to support it ever. However, the current idle logic in QEMU assumes that an in-kernel PIC also means we support MP state. This assumption is not true anymore. Let's split up the two cases into two different variables. That way PPC can expose an in-kernel PIC, while not implementing MP state. Signed-off-by: Alexander Graf CC: Jan Kiszka --- cpus.c | 2 +- include/sysemu/kvm.h | 10 ++++++++++ kvm-all.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletions(-) diff --git a/cpus.c b/cpus.c index e919dd7..4a871c0 100644 --- a/cpus.c +++ b/cpus.c @@ -73,7 +73,7 @@ static bool cpu_thread_is_idle(CPUArchState *env) return true; } if (!cpu->halted || qemu_cpu_has_work(cpu) || - kvm_async_interrupts_enabled()) { + (kvm_async_interrupts_enabled() && kvm_mpstate_enabled())) { return false; } return true; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 8a9ebda..fbfb7f0 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -42,6 +42,7 @@ extern bool kvm_allowed; extern bool kvm_kernel_irqchip; extern bool kvm_async_interrupts_allowed; +extern bool kvm_mpstate_allowed; extern bool kvm_irqfds_allowed; extern bool kvm_msi_via_irqfd_allowed; extern bool kvm_gsi_routing_allowed; @@ -72,6 +73,14 @@ extern bool kvm_gsi_routing_allowed; #define kvm_async_interrupts_enabled() (kvm_async_interrupts_allowed) /** + * kvm_supports_mpstate: + * + * Returns: true if the kvm side supports MP states which is + * required to indicate to kvm that a vcpu is currently halted + */ +#define kvm_mpstate_enabled() (kvm_mpstate_allowed) + +/** * kvm_irqfds_enabled: * * Returns: true if we can use irqfds to inject interrupts into @@ -101,6 +110,7 @@ extern bool kvm_gsi_routing_allowed; #define kvm_enabled() (0) #define kvm_irqchip_in_kernel() (false) #define kvm_async_interrupts_enabled() (false) +#define kvm_supports_mpstate() (false) #define kvm_irqfds_enabled() (false) #define kvm_msi_via_irqfd_enabled() (false) #define kvm_gsi_routing_allowed() (false) diff --git a/kvm-all.c b/kvm-all.c index 130cdbc..f19a439 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -106,6 +106,7 @@ struct KVMState KVMState *kvm_state; bool kvm_kernel_irqchip; bool kvm_async_interrupts_allowed; +bool kvm_mpstate_allowed; bool kvm_irqfds_allowed; bool kvm_msi_via_irqfd_allowed; bool kvm_gsi_routing_allowed; @@ -1219,6 +1220,7 @@ static int kvm_irqchip_create(KVMState *s) * interrupt delivery (though the reverse is not necessarily true) */ kvm_async_interrupts_allowed = true; + kvm_mpstate_allowed = true; kvm_init_irq_routing(s);