From patchwork Tue Nov 19 06:16:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 21593 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6AE6D20972 for ; Tue, 19 Nov 2013 06:15:31 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf8976657oag.10 for ; Mon, 18 Nov 2013 22:15:30 -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:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=4KBTA/QtqtpvRijMwZG39cuLRzbFvG4CDvso4VcUHFQ=; b=Zzse90Nwn/lY28R2KucpFdk8k+bQ8MIW61a04Z1x8wQeacneVuBpknbCX+cGUICSso MjYudMnQK3Lgaca6QUJhnn3WIpLT/BlbCTg/aLoR6DltQCgYOzGwKR4qhbSBG5qivQ6I E8AJ2F5Jdd/xCLKpxQSn6mdrcEiJTwJ+zTMWIXn4fjHvn75lhPvBuFVOAUsVVdMK9gJI JyhJB76Qdj56xQxb+tLQBrlLnatOF/VTATxkHcRcGp/ZxHWMJEM0ywdaFTGMnUZLDQ3B VvMmkT6jx9qVQuJTpf0Q15PMsOzhdrvAylmstgOQgQAmGXC7xfLjeqZ/qwMXa8Ig+0Nm 0DLw== X-Gm-Message-State: ALoCoQmVlVWr4f1jWiwdqwCrfdVSi3ZBmqWZkE78wzB+ygG5lV8Da96tXy+WBit1I76qv7qz6Dsv X-Received: by 10.42.67.19 with SMTP id r19mr299451ici.6.1384841730888; Mon, 18 Nov 2013 22:15:30 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.131.233 with SMTP id op9ls2700154qeb.60.gmail; Mon, 18 Nov 2013 22:15:30 -0800 (PST) X-Received: by 10.58.136.231 with SMTP id qd7mr19321427veb.1.1384841730788; Mon, 18 Nov 2013 22:15:30 -0800 (PST) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id il5si7873335vdb.88.2013.11.18.22.15.30 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:15:30 -0800 (PST) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id 10so1574225vbe.9 for ; Mon, 18 Nov 2013 22:15:30 -0800 (PST) X-Received: by 10.220.196.66 with SMTP id ef2mr19851961vcb.7.1384841730715; Mon, 18 Nov 2013 22:15:30 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp255286vcz; Mon, 18 Nov 2013 22:15:30 -0800 (PST) X-Received: by 10.68.234.10 with SMTP id ua10mr17289897pbc.116.1384841729750; Mon, 18 Nov 2013 22:15:29 -0800 (PST) Received: from mail-pd0-f172.google.com (mail-pd0-f172.google.com [209.85.192.172]) by mx.google.com with ESMTPS id hb3si11235436pac.36.2013.11.18.22.15.29 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:15:29 -0800 (PST) Received-SPF: neutral (google.com: 209.85.192.172 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.172; Received: by mail-pd0-f172.google.com with SMTP id g10so3286866pdj.31 for ; Mon, 18 Nov 2013 22:15:29 -0800 (PST) X-Received: by 10.66.188.203 with SMTP id gc11mr24488550pac.63.1384841729322; Mon, 18 Nov 2013 22:15:29 -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 fk4sm31648068pab.23.2013.11.18.22.15.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 18 Nov 2013 22:15:28 -0800 (PST) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: kvmarm@lists.cs.columbia.edu, patches@linaro.org, Christoffer Dall Subject: [RFC PATCH v3 2/4] kvm: Introduce kvm_arch_irqchip_create Date: Mon, 18 Nov 2013 22:16:34 -0800 Message-Id: <1384841796-19437-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.4.3 In-Reply-To: <1384841796-19437-1-git-send-email-christoffer.dall@linaro.org> References: <1384841796-19437-1-git-send-email-christoffer.dall@linaro.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.212.50 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , 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[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 4478969..a693945 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1317,10 +1317,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; +}