From patchwork Thu Jul 26 14:35:16 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 10276 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 90AE723E57 for ; Thu, 26 Jul 2012 14:35:23 +0000 (UTC) Received: from mail-yw0-f52.google.com (mail-yw0-f52.google.com [209.85.213.52]) by fiordland.canonical.com (Postfix) with ESMTP id 50360A188B0 for ; Thu, 26 Jul 2012 14:35:23 +0000 (UTC) Received: by yhpp61 with SMTP id p61so2035393yhp.11 for ; Thu, 26 Jul 2012 07:35:22 -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:in-reply-to:references :x-gm-message-state; bh=I8zeSSNSEsVwtDCGtfRMgzpyBqLh9RKLpDXOWzM3HZE=; b=H1mPm3WjJT4GNktWYZrsOv1ubGsavBWUesRlM4zUCYr2aAk7P5WvsDQ5bugTHh1WDR b85czPQDe8+AezU8+icgh9o9Q/liV6RN7gsVAumuDfGHpsQHZAQia+F/38Ffdnqg65gc +kGUEhF6fagFpcwCo883FQ1Pr6w7t6siM1bftCv1hP8kO8yEwYmAuEbWM4U8AEGy//D8 aWFBaNs8rUnFz36UB9UCOoKA1UoV/oP+f1KiwDCxaeBnqL/q7H53Gv3ehZ9gMxq+HDNr Y8DV8e4atSbGPrJ0/hpMcrgyespfVvuIIE3WRqLeW4FN10R6qIsN9bQW2VpQQDc4M+vM kuxQ== Received: by 10.42.41.11 with SMTP id n11mr28498072ice.13.1343313322682; Thu, 26 Jul 2012 07:35:22 -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.43.93.3 with SMTP id bs3csp142933icc; Thu, 26 Jul 2012 07:35:21 -0700 (PDT) Received: by 10.180.103.136 with SMTP id fw8mr13975085wib.20.1343313321107; Thu, 26 Jul 2012 07:35:21 -0700 (PDT) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [81.2.115.146]) by mx.google.com with ESMTPS id k2si28648797wef.16.2012.07.26.07.35.20 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jul 2012 07:35:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) client-ip=81.2.115.146; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 81.2.115.146 as permitted sender) smtp.mail=pm215@archaic.org.uk Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1SuP9q-00073W-7M; Thu, 26 Jul 2012 15:35:18 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Avi Kivity , Marcelo Tosatti , Jan Kiszka , Alexander Graf Subject: [PATCH v2 6/7] kvm: Decouple 'GSI routing' from 'kernel irqchip' Date: Thu, 26 Jul 2012 15:35:16 +0100 Message-Id: <1343313317-27087-7-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1343313317-27087-1-git-send-email-peter.maydell@linaro.org> References: <1343313317-27087-1-git-send-email-peter.maydell@linaro.org> X-Gm-Message-State: ALoCoQkuyXZaocnljIshXJgE6AFQxhOdIiX2jm474a+5HFFcyQb8PbkY4xhA/I/Ssl4dvyeXZ/RS Don't assume having an in-kernel irqchip means that GSI routing is enabled. Signed-off-by: Peter Maydell --- kvm-all.c | 3 ++- kvm-stub.c | 1 + kvm.h | 10 ++++++++++ target-i386/kvm.c | 3 ++- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index cdacd74..6def6c9 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -103,6 +103,7 @@ bool kvm_kernel_irqchip; bool kvm_async_interrupts_allowed; bool kvm_irqfds_allowed; bool kvm_msi_via_irqfd_allowed; +bool kvm_gsi_routing_allowed; static const KVMCapabilityInfo kvm_required_capabilites[] = { KVM_CAP_INFO(USER_MEMORY), @@ -1099,7 +1100,7 @@ int kvm_irqchip_add_msi_route(KVMState *s, MSIMessage msg) struct kvm_irq_routing_entry kroute; int virq; - if (!kvm_irqchip_in_kernel()) { + if (!kvm_gsi_routing_enabled()) { return -ENOSYS; } diff --git a/kvm-stub.c b/kvm-stub.c index 158bb7b..94c9ea1 100644 --- a/kvm-stub.c +++ b/kvm-stub.c @@ -22,6 +22,7 @@ bool kvm_kernel_irqchip; bool kvm_async_interrupts_allowed; bool kvm_irqfds_allowed; bool kvm_msi_via_irqfd_allowed; +bool kvm_gsi_routing_allowed; int kvm_init_vcpu(CPUArchState *env) { diff --git a/kvm.h b/kvm.h index 34d32c7..444ed2e 100644 --- a/kvm.h +++ b/kvm.h @@ -27,6 +27,7 @@ extern bool kvm_kernel_irqchip; extern bool kvm_async_interrupts_allowed; extern bool kvm_irqfds_allowed; extern bool kvm_msi_via_irqfd_allowed; +extern bool kvm_gsi_routing_allowed; #if defined CONFIG_KVM || !defined NEED_CPU_H #define kvm_enabled() (kvm_allowed) @@ -60,12 +61,21 @@ extern bool kvm_msi_via_irqfd_allowed; */ #define kvm_msi_via_irqfd_enabled() (kvm_msi_via_irqfd_allowed) +/** + * kvm_gsi_routing_enabled: + * + * Returns: true if GSI routing is enabled (ie the kernel supports + * it and we're running in a configuration that permits it). + */ +#define kvm_gsi_routing_enabled() (kvm_gsi_routing_allowed) + #else #define kvm_enabled() (0) #define kvm_irqchip_in_kernel() (false) #define kvm_async_interrupts_enabled() (false) #define kvm_irqfds_enabled() (false) #define kvm_msi_via_irqfd_enabled() (false) +#define kvm_gsi_routing_allowed() (false) #endif struct kvm_run; diff --git a/target-i386/kvm.c b/target-i386/kvm.c index 46ee906..e58460f 100644 --- a/target-i386/kvm.c +++ b/target-i386/kvm.c @@ -2047,8 +2047,9 @@ void kvm_arch_init_irq_routing(KVMState *s) } /* We know at this point that we're using the in-kernel * irqchip, so we can use irqfds, and on x86 we know - * we can use msi via irqfd. + * we can use msi via irqfd and GSI routing. */ kvm_irqfds_allowed = true; kvm_msi_via_irqfd_allowed = true; + kvm_gsi_routing_allowed = true; }