From patchwork Mon Aug 6 17:05:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 175400 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 260772C008C for ; Tue, 7 Aug 2012 03:05:25 +1000 (EST) Received: from localhost ([::1]:60173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyQk6-0006fa-Sr for incoming@patchwork.ozlabs.org; Mon, 06 Aug 2012 13:05:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37722) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyQjw-0006fN-8R for qemu-devel@nongnu.org; Mon, 06 Aug 2012 13:05:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SyQjt-0000l9-1r for qemu-devel@nongnu.org; Mon, 06 Aug 2012 13:05:12 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:60291) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SyQjs-0000ib-QN for qemu-devel@nongnu.org; Mon, 06 Aug 2012 13:05:08 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SyQjp-0004dy-9O; Mon, 06 Aug 2012 18:05:05 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 6 Aug 2012 18:05:05 +0100 Message-Id: <1344272705-17825-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Marcelo Tosatti , Jan Kiszka , Avi Kivity , kvm@vger.kernel.org, patches@linaro.org Subject: [Qemu-devel] [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create() 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 Move the init of the irqchip_inject_ioctl field of KVMState out of kvm_irqchip_create() and into kvm_init(), so that kvm_set_irq() can be used even when no irqchip is created (for architectures that support async interrupt notification even without an in kernel irqchip). Signed-off-by: Peter Maydell --- We can't just set irqchip_inject_ioctl in target-*/kvm.c because the KVMState struct layout is private to kvm-all.c. Moving the default initialisation of this field seemed the simplest approach. It's safe because the use in kvm_set_irq() is guarded by a check of kvm_async_interrupts_enabled(). The other approach would be to have a helper function for setting the field, but that seems overkill when KVM_IRQ_LINE is the standard default value. (KVM_IRQ_LINE_STATUS seems to be undocumented, incidentally. I am going to assume it's another x86ism until somebody does document it :-)) kvm-all.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kvm-all.c b/kvm-all.c index 6def6c9..9a1f001 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1200,7 +1200,6 @@ static int kvm_irqchip_create(KVMState *s) return ret; } - s->irqchip_inject_ioctl = KVM_IRQ_LINE; if (kvm_check_extension(s, KVM_CAP_IRQ_INJECT_STATUS)) { s->irqchip_inject_ioctl = KVM_IRQ_LINE_STATUS; } @@ -1321,6 +1320,8 @@ int kvm_init(void) s->direct_msi = (kvm_check_extension(s, KVM_CAP_SIGNAL_MSI) > 0); #endif + s->irqchip_inject_ioctl = KVM_IRQ_LINE; + ret = kvm_arch_init(s); if (ret < 0) { goto err;