From patchwork Sat Mar 2 14:52:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Puranjay Mohan X-Patchwork-Id: 13579543 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 24DF7C54798 for ; Sat, 2 Mar 2024 14:52:46 +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=3EYVHsPQ6rk0wDtezvBTNEAfYqtPKVryHmCMvpxSXGw=; b=I0845371D7VQiE W+7IuNBuSxIAUs68u+00nQ+4jd261RutMpVRj2lMRH2STsxoJWbSSaPmZ4olRX+HEPkeGjq3AUdpt ZUYoVUccPJtO6OFq+wBaLU+CWsUfY8LKIK5CokzBe06U6GBteAP03gn/fwMJywFP1gyJBBdwGydEF 4hE0vfbBotvTfzjrXXnncpk09aufX085tRu1y/9Cd+UoDBmXMvr2wy9C2z/T1Je9uuh0QpqUJdYGC DX/Gf61uVsk0MInlirFF5nPh8C9R7ovbsmm60FdMkkGW0UkBWNtwo87Jn54L0qQLqyR0APiXg1S1l T/qILLcbba1SBmp0EWjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgQj3-00000003m5g-2bHa; Sat, 02 Mar 2024 14:52:33 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rgQj0-00000003m4m-2cMp for linux-arm-kernel@lists.infradead.org; Sat, 02 Mar 2024 14:52:31 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-412cd58dd71so7268675e9.1 for ; Sat, 02 Mar 2024 06:52:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709391148; x=1709995948; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Q/ES2FJW4PaZ/LjH5h1eFhluoaUopAjREsxQYkJ4pLs=; b=fyd1bx5MZPnuSjDnWMKRicjkCAuDdJ8YA9NmsZhjeQInsoxVuFwK5VXUPslaG3x8zP Kr7aGe3Dv/wG0rUiwKWu7HDoSD01ejfSTSgPio+a8NQgAwRkzrChdWw0ZGowGqEN/Y0E Qnj76KRCN6/9Afhp2YSck86iYfPo/ego0gJtPXZSVUQUu0sRyYs1OJo0Lja9ESiIniDp 39NGbKi1sNcUE2rSfa7xpMfAUp+gu6SUKZzunn2lJZbqrOs0GSrSl4iadzvszUggSkc1 Fn61fP6ErIBPCJelm9fxf+Qo6qFpjfNNCUeUC32JBvo8+tkgBqcrLNS6IYla6YLPDRs7 NpYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709391148; x=1709995948; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Q/ES2FJW4PaZ/LjH5h1eFhluoaUopAjREsxQYkJ4pLs=; b=F9+dn6377yJW2y0Pcuv+G3ZoZm3VBYOARol5JCbK1EPHsghhRvIv3E9jee+4fQGIl1 Tc9jwgfSzEAMIi2b3o7w4Z9GoocqF2eQ10ifItmI31o9nZY/5zzKVAYJTDJMr/J4ZZnp DQWnVlOhE1mQ3am+fKfPuwn7cBfh7V1vHvFwQHWdUS3RwpngNNc7ogkv2EEDnf0QVMKo FLXqOHl6Dgl/mWnumDMyY2LS1Kl0/eVlELpvMgEv7WwgydcqquMxdhAte1uKrf2Zj8tK jEXmssfghxe9smpWjOeq62YqOeQ9p2WbvEntCeRnq6aCrGreGUHZV92DztpMgWDA2UOV i1Dw== X-Forwarded-Encrypted: i=1; AJvYcCUswYihPEmtJe+vsiTNaeNr7bjakyVorziHpxUyw7WluFOarJk68LyiN/qcV44NgOXbWt5de2YBO8e0rOMyjMTaCWEey+yBeYl0eHo1uXr2wne/mjE= X-Gm-Message-State: AOJu0YxGIl2z6MjGxdrZlw7Rk4seyICelI4h734u4rrt1OUQm+DlREL4 nIiv1QI0hIh2ODbq9Kw2ChDF9o/7BcJ6IB/VAWqj+TjDtBtyrfxn X-Google-Smtp-Source: AGHT+IGxWNMD5uOCujmqbxrHNDAoUpOevGETa2GqEm4G+m57sD9n+m4Qie72K4Nv3xJ1eUz1tMjDHw== X-Received: by 2002:adf:9d83:0:b0:33d:d7be:3bec with SMTP id p3-20020adf9d83000000b0033dd7be3becmr3254953wre.58.1709391148038; Sat, 02 Mar 2024 06:52:28 -0800 (PST) Received: from localhost (54-240-197-231.amazon.com. [54.240.197.231]) by smtp.gmail.com with ESMTPSA id by1-20020a056000098100b0033e22341942sm4085502wrb.78.2024.03.02.06.52.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Mar 2024 06:52:27 -0800 (PST) From: Puranjay Mohan To: catalin.marinas@arm.com, will@kernel.org, anshuman.khandual@arm.com, mark.rutland@arm.com, ardb@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: puranjay12@gmail.com Subject: [PATCH] arm64: head: remove unnecessary instructions from __relocate_kernel Date: Sat, 2 Mar 2024 14:52:10 +0000 Message-Id: <20240302145210.65919-1-puranjay12@gmail.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240302_065230_687434_51C191E0 X-CRM114-Status: GOOD ( 12.34 ) 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 Formerly, we had to access the RELA and RELR tables via the kernel mapping that was being relocated, and so deriving the start and end addresses was done by loading __rela_offset in x9 and then adding the actual virtual offset of the kernel to it. d7bea550279d ("arm64: head: use relative references to the RELA and RELR tables") changed this to load the entries via the ID map as we map the entire kernel image via the ID map. The two instructions for finding the actual virtual offset were left by that commit, so remove them now as they are unnecessary and add runtime overhead. Fixes: d7bea550279d ("arm64: head: use relative references to the RELA and RELR tables") Signed-off-by: Puranjay Mohan --- arch/arm64/kernel/head.S | 2 -- 1 file changed, 2 deletions(-) base-commit: 5ad3cb0ed525b80c7f66c32b49a68c1f3510bec9 diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index cab7f91949d8..90db196f7c19 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -787,8 +787,6 @@ SYM_FUNC_START_LOCAL(__relocate_kernel) */ adr_l x9, __rela_start adr_l x10, __rela_end - mov_q x11, KIMAGE_VADDR // default virtual offset - add x11, x11, x23 // actual virtual offset 0: cmp x9, x10 b.hs 1f