From patchwork Fri Aug 23 19:41:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 19509 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4389A248E6 for ; Fri, 23 Aug 2013 19:41:18 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id z20sf818922yhz.5 for ; Fri, 23 Aug 2013 12:41:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state: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=ZbZffyxGlV14cuhIHxf7UGkqmxJVUhXZoVkqAJzifGo=; b=iY+E7NXmM6ivJhEcAGUxaZbZVjNrRBDmSe0AiP/d0Ks29HTxn3Tgu/P86r2G3lE2YH g+UuyRWDEFm7u3dNTco+aaOb6C2Fk419KEo3PZwVgMe4dAwfohNk2ZW2vR9KxvnyT4sv 1Z14uVhdHg+zSapah0UuGtIKzkNOUnQAg5PyGm4lr8Y6RLjyOD2QS21GWpVk0wv/v3mU KNDWqIcrtc9fyPpYDezoXU/UzxV/UNI/uu6rEjmjURBapMk2S2GyeNHTBiEVcm8uyB5R 92fabObyo7MUK/wigivK0nhMHGJAekG8u9rbU2r9vnqiFkHT7VthSeBjY6sZj0AaPi8+ Twng== X-Received: by 10.224.36.198 with SMTP id u6mr553772qad.6.1377286878025; Fri, 23 Aug 2013 12:41:18 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.99.10 with SMTP id em10ls1721916qeb.82.gmail; Fri, 23 Aug 2013 12:41:17 -0700 (PDT) X-Received: by 10.58.155.68 with SMTP id vu4mr861054veb.21.1377286877930; Fri, 23 Aug 2013 12:41:17 -0700 (PDT) Received: from mail-vb0-f51.google.com (mail-vb0-f51.google.com [209.85.212.51]) by mx.google.com with ESMTPS id jf10si419912vdb.102.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 12:41:17 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.51 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.51; Received: by mail-vb0-f51.google.com with SMTP id x16so704398vbf.38 for ; Fri, 23 Aug 2013 12:41:17 -0700 (PDT) X-Gm-Message-State: ALoCoQkwX/+deu1nnzDwGx56UG8N+h198kiMh/pYQ+IuhQWcUJs9ePATY+ZCga6L3bxIq7ZdREa+ X-Received: by 10.52.232.165 with SMTP id tp5mr725474vdc.11.1377286877777; Fri, 23 Aug 2013 12:41:17 -0700 (PDT) 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 u4csp112010vcz; Fri, 23 Aug 2013 12:41:17 -0700 (PDT) X-Received: by 10.67.4.227 with SMTP id ch3mr692067pad.74.1377286876605; Fri, 23 Aug 2013 12:41:16 -0700 (PDT) Received: from mail-pd0-f179.google.com (mail-pd0-f179.google.com [209.85.192.179]) by mx.google.com with ESMTPS id yt8si1274422pab.177.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 12:41:16 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.179 is neither permitted nor denied by best guess record for domain of christoffer.dall@linaro.org) client-ip=209.85.192.179; Received: by mail-pd0-f179.google.com with SMTP id v10so1044732pde.38 for ; Fri, 23 Aug 2013 12:41:16 -0700 (PDT) X-Received: by 10.68.175.33 with SMTP id bx1mr1512024pbc.21.1377286876076; Fri, 23 Aug 2013 12:41:16 -0700 (PDT) Received: from localhost.localdomain (c-67-169-183-77.hsd1.ca.comcast.net. [67.169.183.77]) by mx.google.com with ESMTPSA id ib9sm1446453pbc.43.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 23 Aug 2013 12:41:15 -0700 (PDT) From: Christoffer Dall To: qemu-devel@nongnu.org Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall Subject: [PATCH 2/4] kvm: Introduce kvm_arch_irqchip_create Date: Fri, 23 Aug 2013 12:41:00 -0700 Message-Id: <1377286862-5879-3-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1377286862-5879-1-git-send-email-christoffer.dall@linaro.org> References: <1377286862-5879-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.51 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. Signed-off-by: Christoffer Dall --- include/sysemu/kvm.h | 4 ++++ kvm-all.c | 11 +++++++++-- target-arm/kvm.c | 5 +++++ target-i386/kvm.c | 5 +++++ target-ppc/kvm.c | 5 +++++ target-s390x/kvm.c | 5 +++++ 6 files changed, 33 insertions(+), 2 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index de74411..1e5847e 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -224,6 +224,10 @@ void kvm_arch_reset_vcpu(CPUState *cpu); int kvm_arch_on_sigbus_vcpu(CPUState *cpu, int code, void *addr); int kvm_arch_on_sigbus(int code, void *addr); +/* return negative error on error, 0 if irq chip was not created, and positive + * number if it was created */ +int kvm_arch_irqchip_create(KVMState *s); + void kvm_arch_init_irq_routing(KVMState *s); int kvm_set_irq(KVMState *s, int irq, int level); diff --git a/kvm-all.c b/kvm-all.c index 716860f..fe64f3b 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -1295,10 +1295,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/target-arm/kvm.c b/target-arm/kvm.c index b92e00d..2484d90 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -647,3 +647,8 @@ void kvm_arch_remove_all_hw_breakpoints(void) void kvm_arch_init_irq_routing(KVMState *s) { } + +int kvm_arch_irqchip_create(KVMState *s) +{ + return 0; +} diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 376fc70..8a62161 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -2188,6 +2188,11 @@ bool kvm_arch_stop_on_emulation_error(CPUState *cs) ((env->segs[R_CS].selector & 3) != 3); } +int kvm_arch_irqchip_create(KVMState *s) +{ + return 0; +} + void kvm_arch_init_irq_routing(KVMState *s) { if (!kvm_check_extension(s, KVM_CAP_IRQ_ROUTING)) { diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c index 30a870e..15c92e8 100644 --- a/target-ppc/kvm.c +++ b/target-ppc/kvm.c @@ -1875,3 +1875,8 @@ int kvm_arch_on_sigbus(int code, void *addr) void kvm_arch_init_irq_routing(KVMState *s) { } + +int kvm_arch_irqchip_create(KVMState *s) +{ + return 0; +} diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c index 26d18e3..7f4dae9 100644 --- a/target-s390x/kvm.c +++ b/target-s390x/kvm.c @@ -893,6 +893,11 @@ void kvm_arch_init_irq_routing(KVMState *s) { } +int kvm_arch_irqchip_create(KVMState *s) +{ + return 0; +} + int kvm_s390_assign_subch_ioeventfd(EventNotifier *notifier, uint32_t sch, int vq, bool assign) {