linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: kvmarm@lists.cs.columbia.edu
Cc: Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>,
	Alexandru Elisei <alexandru.elisei@arm.com>,
	kernel-team@android.com, linux-arm-kernel@lists.infradead.org,
	David Brazdil <dbrazdil@google.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: [PATCH 4/6] KVM: arm64: Extend comment in has_vhe()
Date: Thu,  9 Jun 2022 13:12:21 +0100	[thread overview]
Message-ID: <20220609121223.2551-5-will@kernel.org> (raw)
In-Reply-To: <20220609121223.2551-1-will@kernel.org>

has_vhe() expands to a compile-time constant when evaluated from the VHE
or nVHE code, alternatively checking a static key when called from
elsewhere in the kernel. On face value, this looks like a case of
premature optimization, but in fact this allows symbol references on
VHE-specific code paths to be dropped from the nVHE object.

Expand the comment in has_vhe() to make this clearer, hopefully
discouraging anybody from simplifying the code.

Cc: David Brazdil <dbrazdil@google.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Will Deacon <will@kernel.org>
---
 arch/arm64/include/asm/virt.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/include/asm/virt.h b/arch/arm64/include/asm/virt.h
index 3c8af033a997..0e80db4327b6 100644
--- a/arch/arm64/include/asm/virt.h
+++ b/arch/arm64/include/asm/virt.h
@@ -113,6 +113,9 @@ static __always_inline bool has_vhe(void)
 	/*
 	 * Code only run in VHE/NVHE hyp context can assume VHE is present or
 	 * absent. Otherwise fall back to caps.
+	 * This allows the compiler to discard VHE-specific code from the
+	 * nVHE object, reducing the number of external symbol references
+	 * needed to link.
 	 */
 	if (is_vhe_hyp_code())
 		return true;
-- 
2.36.1.255.ge46751e96f-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2022-06-09 12:21 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 12:12 [PATCH 0/6] KVM/arm64: Minor/trivial fixes from pKVM mega-patch Will Deacon
2022-06-09 12:12 ` [PATCH 1/6] KVM: arm64: Return error from kvm_arch_init_vm() on allocation failure Will Deacon
2022-06-09 12:12 ` [PATCH 2/6] KVM: arm64: Handle all ID registers trapped for a protected VM Will Deacon
2022-06-14  5:57   ` Reiji Watanabe
2022-06-09 12:12 ` [PATCH 3/6] KVM: arm64: Ignore 'kvm-arm.mode=protected' when using VHE Will Deacon
2022-06-09 12:12 ` Will Deacon [this message]
2022-06-09 12:12 ` [PATCH 5/6] KVM: arm64: Remove redundant hyp_assert_lock_held() assertions Will Deacon
2022-06-09 12:12 ` [PATCH 6/6] KVM: arm64: Drop stale comment Will Deacon
2022-06-09 12:19 ` [PATCH 0/6] KVM/arm64: Minor/trivial fixes from pKVM mega-patch Marc Zyngier
2022-06-09 12:26 ` Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220609121223.2551-5-will@kernel.org \
    --to=will@kernel.org \
    --cc=alexandru.elisei@arm.com \
    --cc=dbrazdil@google.com \
    --cc=kernel-team@android.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).