From patchwork Thu Feb 14 06:32:00 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Scott Wood X-Patchwork-Id: 220382 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A65A32C0089 for ; Thu, 14 Feb 2013 18:06:12 +1100 (EST) Received: from localhost ([::1]:44796 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5sNN-0005Z8-U4 for incoming@patchwork.ozlabs.org; Thu, 14 Feb 2013 01:32:57 -0500 Received: from eggs.gnu.org ([208.118.235.92]:58365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5sMu-0005Jg-S7 for qemu-devel@nongnu.org; Thu, 14 Feb 2013 01:32:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U5sMq-0003li-EV for qemu-devel@nongnu.org; Thu, 14 Feb 2013 01:32:28 -0500 Received: from ch1ehsobe005.messaging.microsoft.com ([216.32.181.185]:14962 helo=ch1outboundpool.messaging.microsoft.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U5sMf-0003jK-VC; Thu, 14 Feb 2013 01:32:14 -0500 Received: from mail22-ch1-R.bigfish.com (10.43.68.248) by CH1EHSOBE011.bigfish.com (10.43.70.61) with Microsoft SMTP Server id 14.1.225.23; Thu, 14 Feb 2013 06:32:13 +0000 Received: from mail22-ch1 (localhost [127.0.0.1]) by mail22-ch1-R.bigfish.com (Postfix) with ESMTP id 526F0C0151; Thu, 14 Feb 2013 06:32:13 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1155h) Received: from mail22-ch1 (localhost.localdomain [127.0.0.1]) by mail22-ch1 (MessageSwitch) id 1360823531880325_21310; Thu, 14 Feb 2013 06:32:11 +0000 (UTC) Received: from CH1EHSMHS040.bigfish.com (snatpool1.int.messaging.microsoft.com [10.43.68.244]) by mail22-ch1.bigfish.com (Postfix) with ESMTP id CB1D04C0045; Thu, 14 Feb 2013 06:32:11 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CH1EHSMHS040.bigfish.com (10.43.69.249) with Microsoft SMTP Server (TLS) id 14.1.225.23; Thu, 14 Feb 2013 06:32:11 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.328.11; Thu, 14 Feb 2013 06:32:10 +0000 Received: from snotra.am.freescale.net ([10.214.80.163]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r1E6W1Pq002433; Wed, 13 Feb 2013 23:32:09 -0700 From: Scott Wood To: Alexander Graf Date: Thu, 14 Feb 2013 00:32:00 -0600 Message-ID: <1360823521-32306-6-git-send-email-scottwood@freescale.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1360823521-32306-1-git-send-email-scottwood@freescale.com> References: <1360823521-32306-1-git-send-email-scottwood@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 X-Received-From: 216.32.181.185 Cc: Scott Wood , qemu-ppc@nongnu.org, qemu-devel@nongnu.org Subject: [Qemu-devel] [RFC ppc-next PATCH 5/6] kvm: export result of irqchip config check 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows platform code to register in-kernel irqchips that don't use the legacy KVM_CAP_IRQCHIP/KVM_CREATE_IRQCHIP interface. Signed-off-by: Scott Wood --- include/sysemu/kvm.h | 10 ++++++++++ kvm-all.c | 11 +++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/include/sysemu/kvm.h b/include/sysemu/kvm.h index f2d97b5..b9a8701 100644 --- a/include/sysemu/kvm.h +++ b/include/sysemu/kvm.h @@ -45,6 +45,7 @@ extern bool kvm_async_interrupts_allowed; extern bool kvm_irqfds_allowed; extern bool kvm_msi_via_irqfd_allowed; extern bool kvm_gsi_routing_allowed; +extern bool kvm_irqchip_wanted; #if defined CONFIG_KVM || !defined NEED_CPU_H #define kvm_enabled() (kvm_allowed) @@ -97,6 +98,14 @@ extern bool kvm_gsi_routing_allowed; */ #define kvm_gsi_routing_enabled() (kvm_gsi_routing_allowed) +/** + * kvm_irqchip_wanted + * + * Returns: true if the user requested that an in-kernel IRQ chip be + * used, regardless of whether support has been detected. + */ +#define kvm_irqchip_wanted() (kvm_irqchip_wanted) + #else #define kvm_enabled() (0) #define kvm_irqchip_in_kernel() (false) @@ -104,6 +113,7 @@ extern bool kvm_gsi_routing_allowed; #define kvm_irqfds_enabled() (false) #define kvm_msi_via_irqfd_enabled() (false) #define kvm_gsi_routing_allowed() (false) +#define kvm_irqchip_wanted() (false) #endif struct kvm_run; diff --git a/kvm-all.c b/kvm-all.c index 04ec2d5..13a628d 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -109,6 +109,7 @@ bool kvm_async_interrupts_allowed; bool kvm_irqfds_allowed; bool kvm_msi_via_irqfd_allowed; bool kvm_gsi_routing_allowed; +bool kvm_irqchip_wanted; static const KVMCapabilityInfo kvm_required_capabilites[] = { KVM_CAP_INFO(USER_MEMORY), @@ -1205,8 +1206,14 @@ static int kvm_irqchip_create(KVMState *s) if (QTAILQ_EMPTY(&list->head) || !qemu_opt_get_bool(QTAILQ_FIRST(&list->head), - "kernel_irqchip", true) || - !kvm_check_extension(s, KVM_CAP_IRQCHIP)) { + "kernel_irqchip", true)) { + return 0; + } + + kvm_irqchip_wanted = true; + + /* Platform code may have a different way of enabling an IRQ chip */ + if (!kvm_check_extension(s, KVM_CAP_IRQCHIP)) { return 0; }