From patchwork Wed May 1 01:48:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 240717 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 C76E22C00CD for ; Wed, 1 May 2013 11:49:12 +1000 (EST) Received: from localhost ([::1]:55758 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXMAQ-0005d1-TM for incoming@patchwork.ozlabs.org; Tue, 30 Apr 2013 21:49:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53055) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXM9x-0005bq-Tt for qemu-devel@nongnu.org; Tue, 30 Apr 2013 21:48:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UXM9v-0006tY-Ap for qemu-devel@nongnu.org; Tue, 30 Apr 2013 21:48:41 -0400 Received: from va3ehsobe004.messaging.microsoft.com ([216.32.180.14]:10477 helo=va3outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UXM9v-0006sJ-6Y; Tue, 30 Apr 2013 21:48:39 -0400 Received: from mail41-va3-R.bigfish.com (10.7.14.246) by VA3EHSOBE008.bigfish.com (10.7.40.28) with Microsoft SMTP Server id 14.1.225.23; Wed, 1 May 2013 01:48:37 +0000 Received: from mail41-va3 (localhost [127.0.0.1]) by mail41-va3-R.bigfish.com (Postfix) with ESMTP id BD1653C026B; Wed, 1 May 2013 01:48:37 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1155h) Received: from mail41-va3 (localhost.localdomain [127.0.0.1]) by mail41-va3 (MessageSwitch) id 1367372915719335_14394; Wed, 1 May 2013 01:48:35 +0000 (UTC) Received: from VA3EHSMHS016.bigfish.com (unknown [10.7.14.239]) by mail41-va3.bigfish.com (Postfix) with ESMTP id A0DB660489; Wed, 1 May 2013 01:48:35 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by VA3EHSMHS016.bigfish.com (10.7.99.26) with Microsoft SMTP Server (TLS) id 14.1.225.23; Wed, 1 May 2013 01:48:35 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.2.328.11; Wed, 1 May 2013 01:48:34 +0000 Received: from snotra.am.freescale.net ([10.214.82.239]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r411mWbm015644; Tue, 30 Apr 2013 18:48:33 -0700 From: Scott Wood To: Alexander Graf Date: Tue, 30 Apr 2013 20:48:24 -0500 Message-ID: <1367372912-23519-1-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 1.7.10.4 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 216.32.180.14 Cc: Scott Wood , Jan Kiszka , qemu-ppc@nongnu.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH v3 1/9] 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 From: Alexander Graf 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 Signed-off-by: Scott Wood --- v1 -> v2: - use kvm_halt_in_kernel() instead v2 -> v3: - fix comment --- cpus.c | 2 +- include/sysemu/kvm.h | 10 ++++++++++ kvm-all.c | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/cpus.c b/cpus.c index 5a98a37..59225e4 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_halt_in_kernel()) { return false; } return true; diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 75bd7d9..4a010c6 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_halt_in_kernel_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_halt_in_kernel + * + * Returns: true if halted cpus should still get a KVM_RUN ioctl to run + * inside of kernel space. This only works if MP state is implemented. + */ +#define kvm_halt_in_kernel() (kvm_halt_in_kernel_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_halt_in_kernel() (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 2d92721..7976b2d 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_halt_in_kernel_allowed; bool kvm_irqfds_allowed; bool kvm_msi_via_irqfd_allowed; bool kvm_gsi_routing_allowed; @@ -1275,6 +1276,7 @@ static int kvm_irqchip_create(KVMState *s) * interrupt delivery (though the reverse is not necessarily true) */ kvm_async_interrupts_allowed = true; + kvm_halt_in_kernel_allowed = true; kvm_init_irq_routing(s);