From patchwork Tue Sep 8 09:06:15 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pavel Fedin X-Patchwork-Id: 515321 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3484814016A for ; Tue, 8 Sep 2015 19:09:57 +1000 (AEST) Received: from localhost ([::1]:60908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZEuZ-0001HY-HQ for incoming@patchwork.ozlabs.org; Tue, 08 Sep 2015 05:09:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36484) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZErG-0004P5-Tv for qemu-devel@nongnu.org; Tue, 08 Sep 2015 05:06:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZZErB-0007Gu-Qk for qemu-devel@nongnu.org; Tue, 08 Sep 2015 05:06:30 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:48411) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZZErB-0007G6-Ki for qemu-devel@nongnu.org; Tue, 08 Sep 2015 05:06:25 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NUC00EACPANPL10@mailout1.w1.samsung.com> for qemu-devel@nongnu.org; Tue, 08 Sep 2015 10:06:23 +0100 (BST) X-AuditID: cbfec7f4-f79c56d0000012ee-97-55eea50f0c57 Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 57.40.04846.F05AEE55; Tue, 8 Sep 2015 10:06:23 +0100 (BST) Received: from fedinw7x64.rnd.samsung.ru ([106.109.131.169]) by eusync1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NUC00LPBPAHU450@eusync1.samsung.com>; Tue, 08 Sep 2015 10:06:23 +0100 (BST) From: Pavel Fedin To: qemu-devel@nongnu.org Date: Tue, 08 Sep 2015 12:06:15 +0300 Message-id: <7f11e44c785a4f8b33da83c10081cd517f971ac7.1441702954.git.p.fedin@samsung.com> X-Mailer: git-send-email 2.4.4 In-reply-to: References: In-reply-to: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprBLMWRmVeSWpSXmKPExsVy+t/xy7r8S9+FGtz5xG8x58wDFovjvTtY LNo+f2e3uPv6M4sDi8fOWXfZPVqOvGX1uHNtD5vHk2ubmQJYorhsUlJzMstSi/TtErgydr2e xVxwSqCi58dv5gbGFzxdjJwcEgImEq3b+xghbDGJC/fWs3UxcnEICSxllGjctJEFwmljkpi/ 4Q0bSBWbgLrE6a8fWEBsEQFJid9dp5lBipgFuhglfl7bC1YkLJAkseHBT9YuRg4OFgFViRMH vUBMXoFoib+PhSGWyUlcuT4drJpTwFyic/cKdhBbSMBM4sqSfzjFJzDyL2BkWMUomlqaXFCc lJ5rqFecmFtcmpeul5yfu4kREl5fdjAuPmZ1iFGAg1GJh1fD412oEGtiWXFl7iFGCQ5mJRFe Gz6gEG9KYmVValF+fFFpTmrxIUZpDhYlcd65u96HCAmkJ5akZqemFqQWwWSZODilGhiln7H/ L7/5itd7pkXElQA1rUJpF6vvt/cE122tmDFD7fbSkx+M+PxsdGYmzshQUvqs+CzRI3rjJBE1 npP7Cm/LMj5MWvibb5aTe/XE3nrZHaE5l5pbfE80TNBiMn3nG7xOddb2P4sSlgUaqX8JuDp9 zplZGhFbTV0/X4hZePW5gnX9ZvOdKuZKLMUZiYZazEXFiQD3mKbWKwIAAA== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 210.118.77.11 Cc: Peter Maydell , Shlomo Pongratz , Shlomo Pongratz Subject: [Qemu-devel] [PATCH v13 3/5] arm_kvm: Do not assume particular GIC type in 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This allows us to use different GIC types from v2. There are no kernels which could advertise KVM_CAP_DEVICE_CTRL without the actual ability to create GIC with it. GIC version probe code moved to kvm_arm_vgic_probe() which will be used later. Signed-off-by: Pavel Fedin Reviewed-by: Eric Auger Tested-by: Ashok kumar Reviewed-by: Peter Maydell --- target-arm/kvm.c | 19 ++++++++++++------- target-arm/kvm_arm.h | 9 +++++++++ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/target-arm/kvm.c b/target-arm/kvm.c index b278542..6aadcd8 100644 --- a/target-arm/kvm.c +++ b/target-arm/kvm.c @@ -585,18 +585,23 @@ void kvm_arch_init_irq_routing(KVMState *s) int kvm_arch_irqchip_create(KVMState *s) { - int ret; - /* If we can create the VGIC using the newer device control API, we * let the device do this when it initializes itself, otherwise we * fall back to the old API */ + return kvm_check_extension(s, KVM_CAP_DEVICE_CTRL); +} - ret = kvm_create_device(s, KVM_DEV_TYPE_ARM_VGIC_V2, true); - if (ret == 0) { - return 1; +int kvm_arm_vgic_probe(void) +{ + if (kvm_create_device(kvm_state, + KVM_DEV_TYPE_ARM_VGIC_V3, true) == 0) { + return 3; + } else if (kvm_create_device(kvm_state, + KVM_DEV_TYPE_ARM_VGIC_V2, true) == 0) { + return 2; + } else { + return 0; } - - return 0; } int kvm_arch_fixup_msi_route(struct kvm_irq_routing_entry *route, diff --git a/target-arm/kvm_arm.h b/target-arm/kvm_arm.h index b3e0ab7..10ce771 100644 --- a/target-arm/kvm_arm.h +++ b/target-arm/kvm_arm.h @@ -189,6 +189,15 @@ int kvm_arm_sync_mpstate_to_kvm(ARMCPU *cpu); */ int kvm_arm_sync_mpstate_to_qemu(ARMCPU *cpu); +int kvm_arm_vgic_probe(void); + +#else + +static inline int kvm_arm_vgic_probe(void) +{ + return 0; +} + #endif static inline const char *gic_class_name(void)