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: 10551 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 0028C23E02 for ; Mon, 6 Aug 2012 17:05:10 +0000 (UTC) Received: from mail-gh0-f180.google.com (mail-gh0-f180.google.com [209.85.160.180]) by fiordland.canonical.com (Postfix) with ESMTP id BC9FBA18675 for ; Mon, 6 Aug 2012 17:05:10 +0000 (UTC) Received: by ghbg10 with SMTP id g10so969667ghb.11 for ; Mon, 06 Aug 2012 10:05:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:x-gm-message-state; bh=p53JgvZ6g5eaZkoXygXWg1VZJZHrB3k9C+KkA2Ndae4=; b=LFhwzZ6ec695aUdc+tIjb0dpdSIw+odRKsoBuE7YBl9CEomCtTmEXp+iCXL54CFknj 3JVWpMB/11GMK1xVcsNAX4n9RMHQ4uh2XR0kx1Gw/FG0kz9zMxwa0vblLVd12r3wtbnN H85mOeONEitOU+2sJjoWES0AxgfMag1DTopF30tU+SnlvbY/1KgON+sS/iIaOefZB4j8 ogsui0an1H4Ybi1XceRGTverZROkvBoes+4bikABftLPfju3XNHE1cTdPpWh5V/zJfzG j9j9uZejtViIP8hujes1qFZpHr1dQM7eV0+Hm4KY8LQ+5QrZ5EdyM3rQ/i2qfejh1/uo okqQ== Received: by 10.50.219.226 with SMTP id pr2mr6055358igc.51.1344272709750; Mon, 06 Aug 2012 10:05:09 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.50.87.40 with SMTP id u8csp452149igz; Mon, 6 Aug 2012 10:05:09 -0700 (PDT) Received: by 10.14.179.135 with SMTP id h7mr13944078eem.35.1344272708642; Mon, 06 Aug 2012 10:05:08 -0700 (PDT) Received: from mnementh.archaic.org.uk (1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id u5si10443553eeo.5.2012.08.06.10.05.07 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 06 Aug 2012 10:05:08 -0700 (PDT) Received-SPF: neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) client-ip=2001:8b0:1d0::1; Authentication-Results: mx.google.com; spf=neutral (google.com: 2001:8b0:1d0::1 is neither permitted nor denied by best guess record for domain of pm215@archaic.org.uk) smtp.mail=pm215@archaic.org.uk 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 Cc: patches@linaro.org, Avi Kivity , Marcelo Tosatti , Jan Kiszka , kvm@vger.kernel.org Subject: [PATCH] kvm-all.c: Move init of irqchip_inject_ioctl out of kvm_irqchip_create() 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-Gm-Message-State: ALoCoQmypvneS/aFu+v/tA6oPNrerKuQW+RmQGzvzculDmqBHfWhc/asddQ3fwiYNs0Km9B8yY0V 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;