From patchwork Wed Aug 31 11:05:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 75079 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp272712qga; Wed, 31 Aug 2016 04:09:31 -0700 (PDT) X-Received: by 10.98.39.193 with SMTP id n184mr5271123pfn.164.1472641771828; Wed, 31 Aug 2016 04:09:31 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id w125si50422808pfb.167.2016.08.31.04.09.31 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 31 Aug 2016 04:09:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bf3NV-0001Lc-UO; Wed, 31 Aug 2016 11:08:21 +0000 Received: from mail-wm0-x22c.google.com ([2a00:1450:400c:c09::22c]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bf3LA-0008G9-Sx for linux-arm-kernel@lists.infradead.org; Wed, 31 Aug 2016 11:05:59 +0000 Received: by mail-wm0-x22c.google.com with SMTP id i5so82839839wmg.0 for ; Wed, 31 Aug 2016 04:05:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=c644ZF5Q2uzUEywxGChy6O6tudI/OAI6PfBk48qNuUY=; b=DuywNdcpAFf0Oj6R8E7fEajjeuL0AzqluAVIMX+KsZ30kjEDpI4n8vK93V6MQmGzka cDiG2/rwmP9F1adKt78J5DjRgjP6cor3FSSNdzdfbCf6Fd9bYffIOCe5lYjMEXSgCtC5 REVlAB6k8XUE9VJY+TLzEj7rb2DGwylJL6rnc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=c644ZF5Q2uzUEywxGChy6O6tudI/OAI6PfBk48qNuUY=; b=aOGxifx9SlxLb8tygFUPEl5GEBPXm6EvzL0ZmS+UHfMt7OGYSJqlhBvR3MR7ME76Om H2x2NGbUxJTR77KCilLPy/NHIQkLSArTHrpukW7lCuwgrIBvFBPwOoh5AEDUiYA7ZOco ANrj3EiKhUf6wxgNJCxZlBwb/4LGvVYSgYyKW9OZoNjbzyjK7Q22SMR5hh/cypMKxmBy iGpHldCds15LBoCghxk3LSj/UzETzSz8dh5uSri2cqXuda6Ut3qf+7Ra3dRvD/tqea1u pgciYCfApbB/GkISc9Z1iZ7esA0pr3l9xaVGwjSp0t45O7Od5+S5ZUTkRe069T0yDOlt kbtw== X-Gm-Message-State: AE9vXwNpzWAQ5HJXf2mBjZSe+mdmiFQqzNdnEYTG3MAvK3aUFtWAe9ORdVXnZ8vc9fnQw5kl X-Received: by 10.194.185.202 with SMTP id fe10mr8490343wjc.93.1472641536833; Wed, 31 Aug 2016 04:05:36 -0700 (PDT) Received: from localhost.localdomain ([160.169.158.74]) by smtp.gmail.com with ESMTPSA id jq5sm44052154wjc.20.2016.08.31.04.05.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 31 Aug 2016 04:05:36 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, will.deacon@arm.com Subject: [PATCH v3 5/7] arm64: kernel: drop use of x24 from primary boot path Date: Wed, 31 Aug 2016 12:05:15 +0100 Message-Id: <1472641517-15362-6-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472641517-15362-1-git-send-email-ard.biesheuvel@linaro.org> References: <1472641517-15362-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160831_040557_355779_D6DE3B54 X-CRM114-Status: GOOD ( 10.40 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:22c listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mark.rutland@arm.com, catalin.marinas@arm.com, Ard Biesheuvel MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org Keeping __PHYS_OFFSET in x24 is actually less clear than simply taking the value of __PHYS_OFFSET using an adrp instruction in the three places that we need it. So change that. Reviewed-by: Mark Rutland Signed-off-by: Ard Biesheuvel --- arch/arm64/kernel/head.S | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) -- 2.7.4 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 45b865e022cc..4dee51045e79 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -211,8 +211,8 @@ efi_header_end: ENTRY(stext) bl preserve_boot_args bl el2_setup // Drop to EL1, w0=cpu_boot_mode - adrp x24, __PHYS_OFFSET - and x23, x24, MIN_KIMG_ALIGN - 1 // KASLR offset, defaults to 0 + adrp x23, __PHYS_OFFSET + and x23, x23, MIN_KIMG_ALIGN - 1 // KASLR offset, defaults to 0 bl set_cpu_boot_mode_flag bl __create_page_tables /* @@ -412,6 +412,8 @@ ENDPROC(__create_page_tables) /* * The following fragment of code is executed with the MMU enabled. + * + * x0 = __PHYS_OFFSET */ .set initial_sp, init_thread_union + THREAD_START_SP __primary_switched: @@ -420,6 +422,12 @@ __primary_switched: msr vbar_el1, x8 // vector table address isb + str_l x21, __fdt_pointer, x5 // Save FDT pointer + + ldr_l x4, kimage_vaddr // Save the offset between + sub x4, x4, x0 // the kernel virtual and + str_l x4, kimage_voffset, x5 // physical mappings + // Clear BSS adr_l x0, __bss_start mov x1, xzr @@ -432,12 +440,6 @@ __primary_switched: mov x4, sp and x4, x4, #~(THREAD_SIZE - 1) msr sp_el0, x4 // Save thread_info - str_l x21, __fdt_pointer, x5 // Save FDT pointer - - ldr_l x4, kimage_vaddr // Save the offset between - sub x4, x4, x24 // the kernel virtual and - str_l x4, kimage_voffset, x5 // physical mappings - mov x29, #0 #ifdef CONFIG_KASAN bl kasan_early_init @@ -794,6 +796,7 @@ __primary_switch: bl __relocate_kernel #ifdef CONFIG_RANDOMIZE_BASE ldr x8, =__primary_switched + adrp x0, __PHYS_OFFSET blr x8 /* @@ -818,5 +821,6 @@ __primary_switch: #endif #endif ldr x8, =__primary_switched + adrp x0, __PHYS_OFFSET br x8 ENDPROC(__primary_switch)