From patchwork Tue Feb 18 01:41:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 24813 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f199.google.com (mail-ig0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 00D8520143 for ; Tue, 18 Feb 2014 01:55:59 +0000 (UTC) Received: by mail-ig0-f199.google.com with SMTP id c10sf16900258igq.2 for ; Mon, 17 Feb 2014 17:55:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:in-reply-to:references:cc:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=SNhRmmHPml4VeXakzQbhhcGA7BEB8H7y6NGpcH7jpEc=; b=B3hyjd1COBqcI0h21kt1klBEr4xSDnwk5MFO5IsdNp1AJvlM72R8vovnOGDHlKwSan WyYqIpRyQUndYJ78B4dDhSnNORukNoTZ1/Au80G+mnXJ2aOqlXWwVHSKBCXw05lTtQ+M D2/daxckxUwJphqAkTrWf4FlR69p+frQISWsdkwj48IUn1lv5K2PGnSCwm1zjsVhwnZt iIK1IxaW3uc9MIG/tszJlLeY1+aaWG9xiFfS1DdbMGObAfLEaIzD3KyLRXcD1KGQkO8n 5eATATuIqVrOw8DncrW4Q08XtCYrKF/cy91PIljAOpgsZ7NdiDCNGfexDZI3StYv/T2N D4Zg== X-Gm-Message-State: ALoCoQmvBrntXdj7vLXITMNVZz9rGe1WBxEd5WWEeCoWHVcvVspwthq72sHAe13APYdpY1psLjEK X-Received: by 10.50.8.3 with SMTP id n3mr9809024iga.0.1392688559251; Mon, 17 Feb 2014 17:55:59 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.116 with SMTP id g107ls1152145qgg.49.gmail; Mon, 17 Feb 2014 17:55:59 -0800 (PST) X-Received: by 10.221.53.194 with SMTP id vr2mr2959735vcb.41.1392688559156; Mon, 17 Feb 2014 17:55:59 -0800 (PST) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id qt5si5036187vcb.98.2014.02.17.17.55.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Feb 2014 17:55:59 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id lf12so12634979vcb.31 for ; Mon, 17 Feb 2014 17:55:59 -0800 (PST) X-Received: by 10.221.27.133 with SMTP id rq5mr12361676vcb.9.1392688559061; Mon, 17 Feb 2014 17:55:59 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp180607vcz; Mon, 17 Feb 2014 17:55:58 -0800 (PST) X-Received: by 10.140.86.51 with SMTP id o48mr36511016qgd.67.1392688558615; Mon, 17 Feb 2014 17:55:58 -0800 (PST) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id ew5si9529731qab.119.2014.02.17.17.55.58 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 17 Feb 2014 17:55:58 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:45594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFZja-0006C8-0Y for patch@linaro.org; Mon, 17 Feb 2014 20:44:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFZhV-00037x-PR for qemu-devel@nongnu.org; Mon, 17 Feb 2014 20:42:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFZhP-0005vC-PK for qemu-devel@nongnu.org; Mon, 17 Feb 2014 20:42:21 -0500 Received: from mail-pb0-f48.google.com ([209.85.160.48]:34824) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFZhP-0005v2-JJ for qemu-devel@nongnu.org; Mon, 17 Feb 2014 20:42:15 -0500 Received: by mail-pb0-f48.google.com with SMTP id rr13so16057162pbb.35 for ; Mon, 17 Feb 2014 17:42:14 -0800 (PST) X-Received: by 10.68.24.193 with SMTP id w1mr29918583pbf.78.1392687734714; Mon, 17 Feb 2014 17:42:14 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id vx10sm129526828pac.17.2014.02.17.17.42.12 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 17 Feb 2014 17:42:13 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Date: Mon, 17 Feb 2014 17:41:58 -0800 Message-Id: <1392687720-26806-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1392687720-26806-1-git-send-email-christoffer.dall@linaro.org> References: <1392687720-26806-1-git-send-email-christoffer.dall@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.160.48 Cc: kvmarm@lists.cs.columbia.edu, Christoffer Dall Subject: [Qemu-devel] [PATCH v6 2/4] kvm: Introduce kvm_arch_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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Introduce kvm_arch_irqchip_create an arch-specific hook in preparation for architecture-specific use of the device control API to create IRQ chips. Following patches will implement the ARM irqchip create method to prefer the device control API over the older KVM_CREATE_IRQCHIP API. Reviewed-by: Peter Maydell Signed-off-by: Christoffer Dall --- Changelog[v1 -> v2]: - Proper formatted function comments - Use QEMU's stubs mechanism for KVM stubs include/sysemu/kvm.h | 12 ++++++++++++ kvm-all.c | 11 +++++++++-- stubs/Makefile.objs | 1 + stubs/kvm.c | 7 +++++++ 4 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 stubs/kvm.c diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index 3b25f27..e4e43b8 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -319,4 +319,16 @@ int kvm_irqchip_remove_irqfd_notifier(KVMState *s, EventNotifier *n, int virq); void kvm_pc_gsi_handler(void *opaque, int n, int level); void kvm_pc_setup_irq_routing(bool pci_enabled); void kvm_init_irq_routing(KVMState *s); + +/** + * kvm_arch_irqchip_create: + * @KVMState: The KVMState pointer + * + * Allow architectures to create an in-kernel irq chip themselves. + * + * Returns: < 0: error + * 0: irq chip was not created + * > 0: irq chip was created + */ +int kvm_arch_irqchip_create(KVMState *s); #endif diff --git a/kvm-all.c b/kvm-all.c index 2ca9143..8670878 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1298,10 +1298,17 @@ static int kvm_irqchip_create(KVMState *s) return 0; } - ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); + /* First probe and see if there's a arch-specific hook to create the + * in-kernel irqchip for us */ + ret = kvm_arch_irqchip_create(s); if (ret < 0) { - fprintf(stderr, "Create kernel irqchip failed\n"); return ret; + } else if (ret == 0) { + ret = kvm_vm_ioctl(s, KVM_CREATE_IRQCHIP); + if (ret < 0) { + fprintf(stderr, "Create kernel irqchip failed\n"); + return ret; + } } kvm_kernel_irqchip = true; diff --git a/stubs/Makefile.objs b/stubs/Makefile.objs index df92fe5..df3aa7a 100644 --- a/stubs/Makefile.objs +++ b/stubs/Makefile.objs @@ -27,3 +27,4 @@ stub-obj-y += vm-stop.o stub-obj-y += vmstate.o stub-obj-$(CONFIG_WIN32) += fd-register.o stub-obj-y += cpus.o +stub-obj-y += kvm.o diff --git a/stubs/kvm.c b/stubs/kvm.c new file mode 100644 index 0000000..e7c60b6 --- /dev/null +++ b/stubs/kvm.c @@ -0,0 +1,7 @@ +#include "qemu-common.h" +#include "sysemu/kvm.h" + +int kvm_arch_irqchip_create(KVMState *s) +{ + return 0; +}