From patchwork Wed Sep 23 21:43:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 54078 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by patches.linaro.org (Postfix) with ESMTPS id 71A4522B1E for ; Wed, 23 Sep 2015 21:44:28 +0000 (UTC) Received: by wicgb1 with SMTP id gb1sf31717105wic.3 for ; Wed, 23 Sep 2015 14:44:27 -0700 (PDT) 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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=3P41Tml8oGGPvaq/lqFYJnA+iJXc+9IMzLDC8hEa9CY=; b=lJx/JAHAbMWn88m58DWC3RkfKKZre9zuQPUvKEpGn1TErkVNkcDSxVE75dU/BK6kNd 2m+kmwoR5gHOpDucHuZ6ucXDhAALO/yiMHoIIipODAt+Mb7g6OsNy2H5crebWQUPFCTh H+x2vXm9urJsp9FvZzsarbcG+5R10gLLU4eTOr4zHhDHSj9fckJ7sx27Ah4Wj4/ZkXrW PzyKYJAhmTLgRv83nVAKhr8NSoCHuq3kDAt95KT44SqFmsXDJPZ0K+gI+KWU9RpT3NIK xlolC9TDaHnIltCLd1cgYLbTq97JKvc9bC97OkWeHO2NRjsD1cxp2xVypw2DKG2piJBe QnWg== X-Gm-Message-State: ALoCoQmBw4gsTbgMLujhaVskdjlP9cl/fc/jM0UPd+F46h9pLgD6tqJaR1N3ZsFgwiYO6J/vxde5 X-Received: by 10.152.37.161 with SMTP id z1mr4084341laj.8.1443044667730; Wed, 23 Sep 2015 14:44:27 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.234 with SMTP id y10ls70366lae.62.gmail; Wed, 23 Sep 2015 14:44:27 -0700 (PDT) X-Received: by 10.112.234.199 with SMTP id ug7mr12431668lbc.116.1443044667578; Wed, 23 Sep 2015 14:44:27 -0700 (PDT) Received: from mail-la0-f45.google.com (mail-la0-f45.google.com. [209.85.215.45]) by mx.google.com with ESMTPS id a6si3589179laf.3.2015.09.23.14.44.27 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 14:44:27 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) client-ip=209.85.215.45; Received: by lahg1 with SMTP id g1so66889390lah.1 for ; Wed, 23 Sep 2015 14:44:27 -0700 (PDT) X-Received: by 10.25.207.82 with SMTP id f79mr4493524lfg.73.1443044667467; Wed, 23 Sep 2015 14:44:27 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp5718lbq; Wed, 23 Sep 2015 14:44:26 -0700 (PDT) X-Received: by 10.180.88.168 with SMTP id bh8mr5815026wib.48.1443044666416; Wed, 23 Sep 2015 14:44:26 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id nd16si14402343wic.70.2015.09.23.14.44.26 for (version=TLS1 cipher=RC4-SHA bits=128/128); Wed, 23 Sep 2015 14:44:26 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:50980 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zerpx-0007Ll-B6 for patch@linaro.org; Wed, 23 Sep 2015 17:44:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zerou-0006Gq-4m for qemu-devel@nongnu.org; Wed, 23 Sep 2015 17:43:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zerot-0006qZ-3w for qemu-devel@nongnu.org; Wed, 23 Sep 2015 17:43:20 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:35098) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zeros-0006nH-TQ for qemu-devel@nongnu.org; Wed, 23 Sep 2015 17:43:19 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Zeroj-00030f-N6 for qemu-devel@nongnu.org; Wed, 23 Sep 2015 22:43:09 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 23 Sep 2015 22:43:05 +0100 Message-Id: <1443044589-11529-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1443044589-11529-1-git-send-email-peter.maydell@linaro.org> References: <1443044589-11529-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 3/7] 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.45 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Pavel Fedin 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 Message-id: 015f4d9e4a8a50dfbdd734c4730558e24a69c6dc.1441784344.git.p.fedin@samsung.com Signed-off-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)