From patchwork Thu Jun 30 14:42:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 12901952 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 175FAC433EF for ; Thu, 30 Jun 2022 14:45:22 +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=l8GBFX1gDOh+Oa4BEzlRWX1XRa18Azy4kDLSVp3N+oU=; b=306HWT/K++rmoN +5lGOno6Gy8JuOX5qyTaau+c9xiEdAOd9ofSz3xc7O2RM8k64xlLuzNu8a2d+96ls0Eig9LNEJW9b v05xXcmf5ylc7i8j/BgZRBaHhNpTZ8sGy/pp53CIgkN7P6beJZeH5DySbv/3rA2sOY3MEsU0Jrw6P WS9of6bGaH1AXIgXHsipx2w7hzDIolmW0lcXJ/QcNBwnjOnmIY5dJlAdWj7RukKJymcvNgVy2gqbB fBoAqlH/hq98JmFfdAv0qmdj32g/Zvfn3YBR736oB0UUi2MzbG+W5R31IFctAdyfuu9ZeRZIjHCFP K+izieDCeHnt96jf0UjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6vP3-0008FH-BI; Thu, 30 Jun 2022 14:44:21 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1o6vNY-0007h2-55 for linux-arm-kernel@lists.infradead.org; Thu, 30 Jun 2022 14:42:49 +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 ABB856232A; Thu, 30 Jun 2022 14:42:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9135BC341CB; Thu, 30 Jun 2022 14:42:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1656600167; bh=9lLFI1Q7GpU0jIzBfscXwQ5dctUoxP7KVFxnfsmujWw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rSEukn4CtKHKiQJz53rVI/6GSAeo+eu4h+abG+KIdun852XuJawptIUbYqMs/O4L4 wFYr/QUJUFWuBB5APiot8HBUGY5OpxUiRlupzSy+4/5ql7eTHhDMgsoNaWLXmUGqxV NvgTRPJJh/QYB94OqHyPIDDUSuYp+GZwIgzh3Us3pCuB/Zzy6eM2J2wHu/gmW7EFkY rSeduuSgUuNgyhADUqHtcgKsCHbjEMAddDk6+EYtYZriVLgTmKga+5Ek3Ay9Ozz43Z iFJts7/J7ttH7sbbDWH3P7p+oA/qLnu5rzJv30Iye3ZP//SFg6+goFU33lGtnwYgXs 9CLOjw8r4zLHw== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Will Deacon , Marc Zyngier , =?utf-8?q?Pierre-Cl=C3=A9ment_Tosi?= , Quentin Perret , Mark Rutland Subject: [PATCH 6/6] arm64: efi/libstub: enter with the MMU on if executing in place Date: Thu, 30 Jun 2022 16:42:30 +0200 Message-Id: <20220630144230.2332555-7-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220630144230.2332555-1-ardb@kernel.org> References: <20220630144230.2332555-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=986; h=from:subject; bh=9lLFI1Q7GpU0jIzBfscXwQ5dctUoxP7KVFxnfsmujWw=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBivbZTY5VvtnR3y49Yx07L2TkwYt2h0Bdce/jw1gF0 afm0+nqJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCYr22UwAKCRDDTyI5ktmPJP04C/ oDZIc29O7WwnIt4t08BxmNLzpa7WBmiwKAjD900F1kD/Eh26IAgwNfWI1x8OFKa4TuFYg3e0Ihp/H1 PgkKj+7m1kN+9cHthAp5VbXDYqpYKVMHffL4P+X6bU3PgGWKdORudZQxTbDUwy5Rvu9Wh983qE8xkX Er16LWO1OkInpqcWwBJutGyAN07DDXQrrFV5lgLcKtGKefWN3SN0v7KZVmrnrWiGUZm2XYNThJPf1H 0Ho+OE6+aq9KBWhS2Ad8wIuxPx46GpMysqeRjAn68dmaarq/i00EusWxs3q8aMzkMkaprTFs/2dEee H7UZ5Q9ur14sTYQvl64xSOz9VtpgrrWSWxQx/V+Y+RcZP7k3zv2iAVSppTGFW5O73ecyf2DfHx9ycD 8/s9w7eZS7J7XmVNRD7qJm3fNx7TCRsHwhkHg6UE8sb7dNwEs1SU028VjENo7AD6hyQqJJsIUSR/pf 5gb6OzHd95RVPchE8ekfk19A8SPnN0UiByPJOZDcER6xk= 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-20220630_074248_276096_260F16E8 X-CRM114-Status: GOOD ( 12.74 ) 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 If the kernel image has not been moved from the place where it was loaded by the firmware, just call the kernel entrypoint directly, and keep the MMU and caches enabled. This removes the need for any cache invalidation in the entry path. Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/efi-entry.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kernel/efi-entry.S b/arch/arm64/kernel/efi-entry.S index 61a87fa1c305..0da0b373cf32 100644 --- a/arch/arm64/kernel/efi-entry.S +++ b/arch/arm64/kernel/efi-entry.S @@ -23,6 +23,10 @@ SYM_CODE_START(efi_enter_kernel) add x19, x0, x2 // relocated Image entrypoint mov x20, x1 // DTB address + adrp x3, _text // just call the entrypoint + cmp x0, x3 // directly if the image was + b.eq 2f // not moved around in memory + /* * Clean the copied Image to the PoC, and ensure it is not shadowed by * stale icache entries from before relocation.