From patchwork Thu Jun 9 12:12:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12875482 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 62EE3C433EF for ; Thu, 9 Jun 2022 12:21:25 +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:References:In-Reply-To: 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: List-Owner; bh=5uRPaxF6+ipJ/JdN3gJF4mOCWU0QYm1zfSsNizTxYYI=; b=MSXdmCB961Sy9e 6xpOAP7Yo4GL5yD2U5F5pmRjwDVgKNHjAZ/4/FVhSMS/vmGl79Xrf6Dp4AKAItWRbVzECffkpAsRZ 9enKTMn6kLU7TlDYH9jLvmyu7OnLMjEwzxyJPn7gffnCw1bk/9hZY9CbQHeQnU3M4WW/SBQyJdXZx 6XpSQKINSOixkxj2UFtM/fJS04/TQ/7cU5rBl01GbFuiUPxO9GCc+lWTw2b6iF53bdCxM2jptpBZH rIxUQpCuCgooCIBCVwr8ZdYCYrb2UCSL8flLOTsLXEGUxFzI+bxbV38myk1YM2HJX0Co5ThXrAwmZ BYiBUZ3S8BA+7qxBJzdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzH97-001gOB-N7; Thu, 09 Jun 2022 12:20:18 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzH1j-001cqw-Rc for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2022 12:12:41 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 78A3EB82D5B; Thu, 9 Jun 2022 12:12:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 97545C3411F; Thu, 9 Jun 2022 12:12:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654776757; bh=Vt2h95kPG0rNKVQQsdXAODtHYoMLCkyG3rzEO6q/eug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Gv+GUgGppkKB03l7lJQ/wVVkga0Gm3t6nEI6UygxyNzTAosWDy19fFtQ1vAsgUQW8 5P2cTvEZ+hphy9wKSHolD29YcxdZd88j3Em7BFHYm0y0tBH8LEL2Z5zwxOzPotPN7j a3fnIqGHZ08KcwDaUgeglRRhLSMCZCIjacv6rKxeSLW/CHt5SmTzZPXVHjj2uWXBy/ KZsjPAZXxFgJ5z4cw0zpNalwO8yFM4Lto7MVcZOlvO9pZMTsXaEinNU28ZPjM/v1ku NdiYIgyZhC9jfSB+UEBVheB9vYaqE6xj6LFrTkRnkMSynhu+LHvudPlk1zLVqCk7DK 2CRjBeTMt29+A== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: Will Deacon , Marc Zyngier , Alexandru Elisei , kernel-team@android.com, linux-arm-kernel@lists.infradead.org, David Brazdil , Mark Rutland Subject: [PATCH 4/6] KVM: arm64: Extend comment in has_vhe() Date: Thu, 9 Jun 2022 13:12:21 +0100 Message-Id: <20220609121223.2551-5-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220609121223.2551-1-will@kernel.org> References: <20220609121223.2551-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220609_051240_243853_425D6528 X-CRM114-Status: GOOD ( 12.84 ) 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 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 Acked-by: Mark Rutland Signed-off-by: Will Deacon --- 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;