Skip to content

Commit 112f3ba

Browse files
willdeaconMarc Zyngier
authored andcommitted
KVM: arm64: Extend comment in has_vhe()
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 <[email protected]> Acked-by: Mark Rutland <[email protected]> Signed-off-by: Will Deacon <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cde5042 commit 112f3ba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/arm64/include/asm/virt.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ static __always_inline bool has_vhe(void)
113113
/*
114114
* Code only run in VHE/NVHE hyp context can assume VHE is present or
115115
* absent. Otherwise fall back to caps.
116+
* This allows the compiler to discard VHE-specific code from the
117+
* nVHE object, reducing the number of external symbol references
118+
* needed to link.
116119
*/
117120
if (is_vhe_hyp_code())
118121
return true;

0 commit comments

Comments
 (0)