From patchwork Thu Mar 21 17:37:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marc Zyngier X-Patchwork-Id: 13599268 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C5C13C6FD1F for ; Thu, 21 Mar 2024 17:37:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=MwOld85nRkzZM0X5wG1TL1OP/Xw7oEWQSuRvIU/kT+g=; b=3nS7zQv6K4U/tc dL6Q70PrQjATMUUnEAULLlAlnU2zRUuhQlw5oaEY8kHA9oNM7TUDX5eE9FiW0xzA5Db4H8Rjni3GL VGGGfZcZtRXL8hnQ1QBgYjy7pUfsTzVbdz/HqyonyGALY6lTu0A/D5AZhoFWqyiaN50EDGUF/903Q pqG1RrxvBl1Fni8V4CWcHiAEvpO6lAtPlVvNVmPqkhHQ/796HL3571kfALengdbwNk0zpgGWaiSJ7 4OqXiqqdtOQ1dgnSyNg28cQuHq7FfXnTjk4COPQwyFynGSqjZgJRhyXaeKdJLKoLc6ZWC1TFe75ly E4RXQFkUkAejcy9cZbwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnMLw-000000047OM-42Tn; Thu, 21 Mar 2024 17:37:20 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnMLt-000000047Ld-2XdA for linux-arm-kernel@lists.infradead.org; Thu, 21 Mar 2024 17:37:19 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id A05B7CE12A4; Thu, 21 Mar 2024 17:37:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBF93C433F1; Thu, 21 Mar 2024 17:37:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711042634; bh=kpeNxrpEe9N03bUIBR0YMybK9tOs+I6f/SHhJcjaGcA=; h=From:To:Cc:Subject:Date:From; b=tNnEJGqZ1S6AKxKFyIj1S+S3hCs6/Feskrhcj6xwQo6WVE+xd5Ek6Az088xJuoDB5 CniiVSd1Mdp6diD6ZW72/pVqgdLbz7JpBl/Jr9+JuqbFfo2umpWZHCf/Ycev1jMy2J 846vib8+0O1mj0ieiAtNaTUFFC02xCxxAPL60LUv4pnizcT9PjmPlhfMKK3IbbsycS ZNdmKrLx4DhCIH/mLTqQg7bEF00aANWehAD9fE9a5ASF+OWNRYBMi9TjdopUYRQ136 g/Vf+94utaxhBqwoous8vUkzKvBuzNvSPQerLwTr83wIldPRlD1SzWsskxhFjUjxH6 Ir9f1vbihTa4w== Received: from sofa.misterjones.org ([185.219.108.64] helo=valley-girl.lan) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1rnMLo-00EHDk-Hx; Thu, 21 Mar 2024 17:37:12 +0000 From: Marc Zyngier To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org Cc: James Morse , Suzuki K Poulose , Oliver Upton , Zenghui Yu Subject: [PATCH] KVM: arm64: Rationalise KVM banner output Date: Thu, 21 Mar 2024 17:37:06 +0000 Message-Id: <20240321173706.3280796-1-maz@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, james.morse@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, yuzenghui@huawei.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240321_103718_507936_C52CA0E6 X-CRM114-Status: GOOD ( 12.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We are not very consistent when it comes to displaying which mode we're in (VHE, {n,h}VHE, protected or not). For example, booting in protected mode with hVHE results in: [ 0.969545] kvm [1]: Protected nVHE mode initialized successfully which is mildly amusing considering that the machine is VHE only. We already cleaned this up a bit with commit 1f3ca7023fe6 ("KVM: arm64: print Hyp mode"), but that's still unsatisfactory. Unify the three strings into one and use a mess of conditional statements to sort it out (yes, it's a slow day). Signed-off-by: Marc Zyngier --- arch/arm64/kvm/arm.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index eff66ff0c7d8..cc18caaa1c64 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -2702,14 +2702,11 @@ static __init int kvm_arm_init(void) if (err) goto out_hyp; - if (is_protected_kvm_enabled()) { - kvm_info("Protected nVHE mode initialized successfully\n"); - } else if (in_hyp_mode) { - kvm_info("VHE mode initialized successfully\n"); - } else { - char mode = cpus_have_final_cap(ARM64_KVM_HVHE) ? 'h' : 'n'; - kvm_info("Hyp mode (%cVHE) initialized successfully\n", mode); - } + kvm_info("%s%sVHE mode initialized successfully\n", + in_hyp_mode ? "" : (is_protected_kvm_enabled() ? + "Protected " : "Hyp "), + in_hyp_mode ? "" : (cpus_have_final_cap(ARM64_KVM_HVHE) ? + "h" : "n")); /* * FIXME: Do something reasonable if kvm_init() fails after pKVM