From patchwork Thu Apr 28 14:03:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 12830810 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 8C09DC433EF for ; Thu, 28 Apr 2022 14:17:15 +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=JNfupCpNDMV7206A527oE9Nbjw+rTruvYr8zoxbPuBU=; b=UHR0V7piKxYUHf /3JzdTXsPedoT8yv55KHBxsA0EULEktgPsUAzpn/ZgQZMe+Su1h4/5KT4G4GMEF165V1syJkO0d7W rfNTmswZ91EN6yMTs1zvLNR2Vl7xXFBP6aweReBNEPQBCxMQiNBdGDKEGx8Q+KIV/svFO6uZ5WCgU EfvM6qSLuQ1s1et5cqSXoXRIt5MWSALuhJT1btS1lBlmhw3i8APAQXQGf/I/0esiRMyyYh31JO2ar W5R+3kWV8gRl9Ph7xmy/xZBQm1CE1mbTmKvgmmZW6R6UIjr5ARMigM4j+ewFDlXT6CxkG+fMv1lq8 Fif4FTCS/4vawWMGWX9g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nk4vy-007PKQ-1g; Thu, 28 Apr 2022 14:15:54 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nk4ke-007JC0-JX for linux-arm-kernel@lists.infradead.org; Thu, 28 Apr 2022 14:04:14 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 9C9E461000; Thu, 28 Apr 2022 14:04:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C71A6C385AA; Thu, 28 Apr 2022 14:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651154651; bh=vLx33q87eXGXQ2LRwNhK6vgYZeRec9h1RejRTtSSgD8=; h=From:To:Cc:Subject:Date:From; b=N72b2lJPxhRlrxKzbNYsbfwbd5W7FKUb/HbySA1PIHa3vHMaV1fbU37oET5qQRLGM Sp2FYyYYSpG/PXnAlSU85EaV5Jxy8yj8taY8QkigcbDCtBII1LVlOgxkwEWDD5FItN usZK0MKdHHqg0rXCV9ukWYFRTwDsFMqYekyFRQXFB84VOsJzQXSwO8PL19Kms1vIFh plKZBJk6nr5tiDG7Xd3m5tmx4GutBzEBJSNr2kqume+cFOAfSSYt8xmNvplQybsKHr XAXCSJ2uolgVz7RVfgVf3HVRSM7VbsoMZ7Ez0I13XQZ/vRTiFVdefVQrd9Z729fTBf LtLqsfuy0410g== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, maz@kernel.org, dbrazdil@google.com Cc: Ard Biesheuvel Subject: [PATCH] arm64: kvm: avoid unnecessary absolute addressing via literals Date: Thu, 28 Apr 2022 16:03:50 +0200 Message-Id: <20220428140350.3303481-1-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1625; h=from:subject; bh=vLx33q87eXGXQ2LRwNhK6vgYZeRec9h1RejRTtSSgD8=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBiap7FPmVR8RjP3uOW9iGq4+cTaDa9BMjP/SZ7DXRS uMvp5CaJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYmqexQAKCRDDTyI5ktmPJFnKC/ 9mwnUocnM4ue8AKxpnruQWg7tCiJEfaqjRfmzpUHdbfKYwH+ouJeI0iezPLzev41SSkQaYKPaRzGaj kOrv1H5QjL7fbSgoKy4+UTO4aZb1LGF+hNQP1csXr0iK3Y9X3RM0xRnuWDMfJ3QE8EymD92dwjWNg+ 8V9Xjfl9wwx2VTUv3zKF19ZhjIihl0wkV8p0D6mbzSCYTg/rQN/V18dWhVgFHqaIjyZqnY+p1oG6kv 6CvP70RFl5tnWV8R1bXC4JWrcUqAHLeRTVegtM7zjPjECKhpAv+YCijafP8etEeoQx00fcCYeYETGP xGaOObOdTOj7FE+vvaAe6GltF8Rw4D/oTYd2xMLWDNib8dGzLuzRXpL8Y2m7V78KGp98+r5sVa278n p6LAmFrM3//g/qZjPsQwfVlexg1aaQzmyUcWuyzcRY3C1Rf9pFu3p4hJ60iqgfVEF8HvTRsxfpQ8lH v+xlIOzEUcgZ4cmfVGvEgZr5i/bSVZFR8ITVcOSjpgaAA= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220428_070412_745033_48724598 X-CRM114-Status: GOOD ( 13.86 ) 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 There are a few cases in the nVHE code where we take the absolute address of a symbol via a literal pool entry, and subsequently translate it to another address space (PA, kimg VA, kernel linear VA, etc). Originally, this literal was needed because we relied on a different translation for absolute references, but this is no longer the case, so we can simply use relative addressing instead. This removes a couple of RELA entries pointing into the .text segment. Signed-off-by: Ard Biesheuvel --- arch/arm64/kvm/hyp/nvhe/host.S | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S index 3d613e721a75..366551594417 100644 --- a/arch/arm64/kvm/hyp/nvhe/host.S +++ b/arch/arm64/kvm/hyp/nvhe/host.S @@ -80,7 +80,7 @@ SYM_FUNC_START(__hyp_do_panic) mov lr, #(PSR_F_BIT | PSR_I_BIT | PSR_A_BIT | PSR_D_BIT |\ PSR_MODE_EL1h) msr spsr_el2, lr - ldr lr, =nvhe_hyp_panic_handler + adr_l lr, nvhe_hyp_panic_handler hyp_kimg_va lr, x6 msr elr_el2, lr @@ -125,13 +125,11 @@ alternative_else_nop_endif add sp, sp, #16 /* * Compute the idmap address of __kvm_handle_stub_hvc and - * jump there. Since we use kimage_voffset, do not use the - * HYP VA for __kvm_handle_stub_hvc, but the kernel VA instead - * (by loading it from the constant pool). + * jump there. * * Preserve x0-x4, which may contain stub parameters. */ - ldr x5, =__kvm_handle_stub_hvc + adr_l x5, __kvm_handle_stub_hvc hyp_pa x5, x6 br x5 SYM_FUNC_END(__host_hvc)