From patchwork Fri Jan 12 12:33:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10160671 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BAC89602A7 for ; Fri, 12 Jan 2018 12:34:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7F70287C0 for ; Fri, 12 Jan 2018 12:34:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9C4B9289D3; Fri, 12 Jan 2018 12:34:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2516B287C0 for ; Fri, 12 Jan 2018 12:34:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=uzy3yiGIwB0AyM1E2G8IazCx0MqmgTKkwiTM2X35py4=; b=dpce2U287eZ85JQ6W0LancqDQy vRlZ6s56zMTi9Bve0Sfh18DExpWB+OcNI1Z/wu3HNo4q06ImFqq898AaTT9nEbDXNYRuzRVFHKeWx wng5J3q0uiAK1t7LO3jG+hL4z+vG3G3SHja+KqUaPGb4fkcKSHA64ft62n/9HwjdfQLqjYXymAE85 Pm3DHk5YS59Od6+Hg3GvbM0RYK4Vwc7GZwIiAuEE9FONswjZbQMswNym6MnhSv/SDoeHzves70Yj0 Iv+jYbcPcVQZxQCEnFPe+XLiBZnk8kzUkiA33hKgUMRoPtZOtUDyHx8qsj4pJ+6euQM/o+oQQYJh5 o3yVh/dQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eZyXC-0001v7-E0; Fri, 12 Jan 2018 12:34:10 +0000 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eZyWu-0001WK-3b for linux-arm-kernel@lists.infradead.org; Fri, 12 Jan 2018 12:33:53 +0000 Received: by mail-wm0-x243.google.com with SMTP id 143so11711812wma.5 for ; Fri, 12 Jan 2018 04:33:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=kJvcC/2xPmrnyiaVvjg+lzUYxcKR/JvCssw/xrYLT44=; b=M3off/RT0pRhxsSB+dT9ww2KOXWzvQoxqIgyZ7oIVqu2195IqjpXmF21XF6zhCYQIV KuPlP8nmE1J/7FlI2wv4JlVL5xCc/zdw6oNR4+X/BoahxOpHTqf4xoqS59y1wr08yKTY QALAlqRdwmHYT+JMQL5GnzqeeMHOFWg616Wqw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=kJvcC/2xPmrnyiaVvjg+lzUYxcKR/JvCssw/xrYLT44=; b=PdmnOfhLl5g79xsXR9+jOVeLJmNJ6PM8OQ8KwNoIVv5vc5zfiNDcZtHWEoEgiSWev9 3LRUioDnWGhrevhmC7TXyUCHh5iQX9tKoNpiZRkSWMoGNpcpmwGVf1NzgeqACokeOzMA z+AijQTSLSjEZXJV5DMCuFCjifC25mXu+ygA9M8W1F/Iah0EqO2bUzjEK2daROZl1RXp 8xxJQCPmki1G6+GvJnNvjfyxv+X3qOhNOkLiiPfeEiNW3HWN+57xeRtUcTdoKejzV7wQ g25y74BXorZG5ma+hTt3M24aUS9tuGVFjAL8wK373tdTL4NzPw2MvB5Q0i3sbf+WbORg OyTQ== X-Gm-Message-State: AKGB3mJe5PiurJZg3MTNkfnuW+h2s7VxERs0H4g0x4JvyqOBchGIlbSu cWxaYnWoqiSsZaxijctTESKwMQ== X-Google-Smtp-Source: ACJfBousNW9a4E1CRFm3bD91TMtPWCm3LNPvINhtKhoeoMqbKQfhi1B7CjyBD9KEyjtir3QS5nu9lQ== X-Received: by 10.80.206.11 with SMTP id y11mr35798640edi.137.1515760423008; Fri, 12 Jan 2018 04:33:43 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id g61sm12591145edd.48.2018.01.12.04.33.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 12 Jan 2018 04:33:42 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 2/2] KVM: arm64: Fix GICv4 init when called from vgic_its_create Date: Fri, 12 Jan 2018 13:33:34 +0100 Message-Id: <20180112123334.28687-3-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180112123334.28687-1-christoffer.dall@linaro.org> References: <20180112123334.28687-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180112_043352_161445_CE2F67E0 X-CRM114-Status: GOOD ( 12.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 3d1ad640f8c94 ("KVM: arm/arm64: Fix GICv4 ITS initialization issues") moved the vgic_supports_direct_msis() check in vgic_v4_init(). However when vgic_v4_init is called from vgic_its_create(), the has_its field is not yet set. Hence vgic_supports_direct_msis returns false and vgic_v4_init does nothing. The gic/its init sequence is a bit messy, so let's be specific about the prerequisite checks in the various call paths instead of relying on a common wrapper. Fixes: 3d1ad640f8c94 ("KVM: arm/arm64: Fix GICv4 ITS initialization issues") Reported-by: Eric Auger Signed-off-by: Christoffer Dall --- virt/kvm/arm/vgic/vgic-init.c | 8 +++++--- virt/kvm/arm/vgic/vgic-v4.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/virt/kvm/arm/vgic/vgic-init.c b/virt/kvm/arm/vgic/vgic-init.c index 62310122ee78..743ca5cb05ef 100644 --- a/virt/kvm/arm/vgic/vgic-init.c +++ b/virt/kvm/arm/vgic/vgic-init.c @@ -285,9 +285,11 @@ int vgic_init(struct kvm *kvm) if (ret) goto out; - ret = vgic_v4_init(kvm); - if (ret) - goto out; + if (vgic_has_its(kvm)) { + ret = vgic_v4_init(kvm); + if (ret) + goto out; + } kvm_for_each_vcpu(i, vcpu, kvm) kvm_vgic_vcpu_enable(vcpu); diff --git a/virt/kvm/arm/vgic/vgic-v4.c b/virt/kvm/arm/vgic/vgic-v4.c index 4a37292855bc..bc4265154bac 100644 --- a/virt/kvm/arm/vgic/vgic-v4.c +++ b/virt/kvm/arm/vgic/vgic-v4.c @@ -118,7 +118,7 @@ int vgic_v4_init(struct kvm *kvm) struct kvm_vcpu *vcpu; int i, nr_vcpus, ret; - if (!vgic_supports_direct_msis(kvm)) + if (!kvm_vgic_global_state.has_gicv4) return 0; /* Nothing to see here... move along. */ if (dist->its_vm.vpes)