From patchwork Tue Jan 16 17:02:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10167701 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 52ED2600CA for ; Tue, 16 Jan 2018 17:03:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B00322701 for ; Tue, 16 Jan 2018 17:03:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2B206228C9; Tue, 16 Jan 2018 17:03:28 +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 2467423E64 for ; Tue, 16 Jan 2018 17:03:26 +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=ZPPknNwzoGdr1LqijKuXGcZswk p/Fi0dYNVkwb1UC6U4qkkBpj0nAWwaQo58wKkoBx31KoS/0k7NYtdFq1f+CuK/JnjNnZJwSdg3Lpq SI6jGhCuWLhizeO4Jm3MPBUFsFekz6cpxaGCievIpV3mz7xwnuO0WQEnB8905ScJqCmY531p5d9tH 9a7kaYwM3Oee32jYJtGnGkoLNZHFhIUQzB9Re/hKHXWsMa6daLvNxRrTdttNFjJzmYzpDHokmYmhV b4TSLdnoA6zQbNbwl+EjGTng474DvpEKYFOHAb0YMkPK0KlvjO8LP8X4VZ4RZgOuiBV8lNjowUYPA PGOqOvng==; 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 1ebUdu-0007Cj-Aj; Tue, 16 Jan 2018 17:03:22 +0000 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1ebUdQ-0006fv-IG for linux-arm-kernel@lists.infradead.org; Tue, 16 Jan 2018 17:02:58 +0000 Received: by mail-wm0-x242.google.com with SMTP id v123so10075597wmd.5 for ; Tue, 16 Jan 2018 09:02:42 -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=UDaER0251DOkAGNjvuCTy9+DtfQbERErq885d7SucChAWaHczsafaZICj/JwuiMKpL 6yfh4RG6v+1E9E16rINJo/EvOIZttC4IqgNn6QSZbeUuA5BBMjCE6MbYWqfV+atepVs0 7xAk6wz9c/KPQU0t89VkfY8X2WSB8n5kgu5pA= 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=R+n3cEskd2w5XuPXY5JS8RdUySrBYSUZtHuqzkMMVSRuCvT56kWxUMdkCcwWXQz1t0 1txnI3GCv0AVKY/Y3Rwb1g3Qh94jwD8dtbdNnHqqCMRjY+LM9lsMiiJHoDZh325ZGW4a O0NwxVh6uDmrfs3JtShFiLQKCyrc/tt/prLSvXAkgyKRTAhDqPzi4hJUuhZGJY/iamYI ss0pTTWuDGCyF9AcFOKko5hQOM+h2vHe7yiKe5t6fT1uoIirY34E5jXsVju/A0gnVlg7 T6x+BCYYxfzg0ixZ+diQJOwHsFYThaHFIjp2e67GjVY0sErzRp6FemLkgQj0JSDGk+4r Uzyw== X-Gm-Message-State: AKGB3mKZ3Aa5OBhIf/oJad4s0dhr2tgOrVql1yUg7MZ7/crY9yRsr+x0 8DKBYyRWrqKBuVySmBRRod97QQ== X-Google-Smtp-Source: ACJfBoto7YMJwSr0cZfAkG+KghuFbQkZLTY1t6J7mJMwjrLj1iOEcFeJqmLwPA6MI5xS/FCHuYxykA== X-Received: by 10.80.134.163 with SMTP id r32mr53892144eda.209.1516122160501; Tue, 16 Jan 2018 09:02:40 -0800 (PST) Received: from localhost.localdomain (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id r29sm2107162edl.82.2018.01.16.09.02.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 09:02:39 -0800 (PST) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL v2 2/3] KVM: arm64: Fix GICv4 init when called from vgic_its_create Date: Tue, 16 Jan 2018 18:02:32 +0100 Message-Id: <20180116170233.7085-3-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180116170233.7085-1-christoffer.dall@linaro.org> References: <20180116170233.7085-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180116_090252_646744_B35C19DD X-CRM114-Status: GOOD ( 12.78 ) 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)