From patchwork Mon Oct 30 02:55:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 10031913 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 B2900603B5 for ; Mon, 30 Oct 2017 02:57:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D88C28718 for ; Mon, 30 Oct 2017 02:57:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 911A02871F; Mon, 30 Oct 2017 02:57:52 +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=unavailable 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 1893E28718 for ; Mon, 30 Oct 2017 02:57:52 +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=q5ODGZGtDM6uJzZZdAzl2Uacf23ACJp8nmTJZIZ1AOc=; b=IxVjR7IVPZXEgZi4mw6kKQeRJX ga5twjx8nWKNM/Jngi1qeHev4qciyigi/dnIagmKF9K0t8PTIxhd4fu5BHpXGshKshDpAwTeCuvnh bFqRxsyZ9qSuRSvra7CPMx0w8L+dhkk0nYL7hVKi9B0s1ux900ok9Fx+9wPRpU/sktTD2VN8d2LP3 q+KRVXdOIvFoj32BpZiFn0bSfM5QTPJbvJrwqm7qxV9+P09UBnIV4TdPXhHGRYXdJTabyra/gdfdc +XfNZmRT1e8wf+gujWYvzxrZ9GMrskthUvBRq03NLs+QUkx3X/55U73HpLm7Qfqnzo+akqA28sRee RBSL7P2g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1e90Gn-0006gt-A8; Mon, 30 Oct 2017 02:57:45 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1e90Fc-0005zu-PQ for linux-arm-kernel@lists.infradead.org; Mon, 30 Oct 2017 02:56:34 +0000 Received: by mail-wm0-x244.google.com with SMTP id m72so12945183wmc.1 for ; Sun, 29 Oct 2017 19:56:13 -0700 (PDT) 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=6qZmh1pjpTbXMiw2vFNcgd2bl//v7wN9+MjiO/tSS6g=; b=MIBAOZnBHzAj9ujGF2ko1VINPEl9Yo3FOk+LFhOmlEy9WcJaVN7P7vVzPiXgOc3wcj SwRN8wXMwZumMI7LzLHFmm1vFcKY35vXa4O2gVHJf0mub/sAcTLIfoQoI+x4q+Ov8Qc3 R+1qJjui0s21ddU+9jxdEjLhyDOtXmYU3g4Yk= 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=6qZmh1pjpTbXMiw2vFNcgd2bl//v7wN9+MjiO/tSS6g=; b=TRj3C1M5inVPTh3i7L0ymL1oEZRYvv/NzMnjuuaKHb9l+RO5OrEa69EgPQSbURlXFM iGg9JEb/uQAKAggZeLmEWEevQ2MHjdA+AQlr9BUxwMHQ0o/rxIpuHxIW8WkEaUjFEa2G rgbhnEddrzjn5T0wsT99wOaQbpxwnEQ00EITB6svoLlX3KllnPRRzxwb0U7u29fJtv5H u0RdCBnsc9PBBnvNsQfY6cORyyTs44QZFiuvgIdMiaci5u9Eh8FZJ6UZxcokpJLfyR2v JYXPAln9M815sXBjof/Q8jCu+S7+1uF8NuQq1yORNU0hhdBochc24hAifHnvPaVbQY2a Q2lw== X-Gm-Message-State: AMCzsaUayzWcS2vokLNy8VOKqPN+b1vB4PGIh+4roTb9xcKz6qpgGLz5 TU6swHk9eQUlB2JTVXysUEDnXw== X-Google-Smtp-Source: ABhQp+S39nvvQflAUYuezwykd69eLUZSpR3qm3G8/a2icAw/jN5ApNClHN5HruP2n2xuPvhJGvaAhA== X-Received: by 10.80.244.2 with SMTP id r2mr10037319edm.26.1509332172660; Sun, 29 Oct 2017 19:56:12 -0700 (PDT) Received: from localhost.localdomain (xd93dd96b.cust.hiper.dk. [217.61.217.107]) by smtp.gmail.com with ESMTPSA id u14sm7856415edd.47.2017.10.29.19.56.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 29 Oct 2017 19:56:11 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= Subject: [PULL 3/8] arm/arm64: kvm: Move initialization completion message Date: Mon, 30 Oct 2017 03:55:58 +0100 Message-Id: <20171030025603.23550-4-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171030025603.23550-1-christoffer.dall@linaro.org> References: <20171030025603.23550-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171029_195632_980478_B3A30632 X-CRM114-Status: GOOD ( 12.64 ) 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: kvm@vger.kernel.org, Julien Thierry , Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Christoffer Dall 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 From: Julien Thierry KVM is being a bit too optimistic, Hyp mode is said to be initialized when Hyp segments have only been mapped. Notify KVM's successful initialization only once it is really fully initialized. Signed-off-by: Julien Thierry Acked-by: Marc Zyngier Cc: Christoffer Dall Signed-off-by: Christoffer Dall --- virt/kvm/arm/arm.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/virt/kvm/arm/arm.c b/virt/kvm/arm/arm.c index b9f68e4add71..95cba0799828 100644 --- a/virt/kvm/arm/arm.c +++ b/virt/kvm/arm/arm.c @@ -1326,21 +1326,12 @@ static void teardown_hyp_mode(void) { int cpu; - if (is_kernel_in_hyp_mode()) - return; - free_hyp_pgds(); for_each_possible_cpu(cpu) free_page(per_cpu(kvm_arm_hyp_stack_page, cpu)); hyp_cpu_pm_exit(); } -static int init_vhe_mode(void) -{ - kvm_info("VHE mode initialized successfully\n"); - return 0; -} - /** * Inits Hyp-mode on all online CPUs */ @@ -1421,8 +1412,6 @@ static int init_hyp_mode(void) } } - kvm_info("Hyp mode initialized successfully\n"); - return 0; out_err: @@ -1456,6 +1445,7 @@ int kvm_arch_init(void *opaque) { int err; int ret, cpu; + bool in_hyp_mode; if (!is_hyp_mode_available()) { kvm_err("HYP mode not available\n"); @@ -1474,21 +1464,28 @@ int kvm_arch_init(void *opaque) if (err) return err; - if (is_kernel_in_hyp_mode()) - err = init_vhe_mode(); - else + in_hyp_mode = is_kernel_in_hyp_mode(); + + if (!in_hyp_mode) { err = init_hyp_mode(); - if (err) - goto out_err; + if (err) + goto out_err; + } err = init_subsystems(); if (err) goto out_hyp; + if (in_hyp_mode) + kvm_info("VHE mode initialized successfully\n"); + else + kvm_info("Hyp mode initialized successfully\n"); + return 0; out_hyp: - teardown_hyp_mode(); + if (!in_hyp_mode) + teardown_hyp_mode(); out_err: teardown_common_resources(); return err;