From patchwork Wed Aug 24 14:36:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 74623 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp352519qga; Wed, 24 Aug 2016 07:41:20 -0700 (PDT) X-Received: by 10.98.196.138 with SMTP id h10mr6399566pfk.60.1472049680412; Wed, 24 Aug 2016 07:41:20 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id d70si9948633pfg.162.2016.08.24.07.41.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Aug 2016 07:41:20 -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 1bcZLe-0007xU-KX; Wed, 24 Aug 2016 14:40:10 +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 1bcZIO-0005Kq-Or for linux-arm-kernel@lists.infradead.org; Wed, 24 Aug 2016 14:36:53 +0000 Received: by mail-wm0-x22c.google.com with SMTP id i5so31384693wmg.0 for ; Wed, 24 Aug 2016 07:36:28 -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=g6pPR2yPl4TaIJMYMpO7k7SmfzDhVaVgFxdJ2VusSI4=; b=BD4Ow2ugFsjw1xILuZn3GrEe4o7ioB0kLDOrqkhiwvKMtKicieURsUs9Hnpi+O1Y7O v+xqHnRQdvwHvwyEPpfFr8YioNa8Jvx82xIwvfE1RdrdngtBLYerL+wcXdryaEF2TH+p S426Brerbt+YRYLVrctS72UkHt6vfhhZ+06HI= 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=g6pPR2yPl4TaIJMYMpO7k7SmfzDhVaVgFxdJ2VusSI4=; b=Ul0Gcwz6f48mBF0zWfN/8W6nbpWLbd9qkcqdrL+XagfbdEpvPYSZtDR3u+RdUMSV5L +qoit89o/sTz94p02X8UEn8GMjyG5rcMJ9Q9fvJ+4Z13xqm4ekW/V8ZqHJYXukxpK6yT N5NqvwipkW5KbCNwnTm8LUe4yMi1U2lmVvxy1/jJ1kOomiwa/5W9w1msa/ESKiHxAx/Z mirhDaJYqa9aCQnvL1If/LoubaSW+wXrLN28uijy/PG0QlBV75Xo+LHOR/rK35ZAHdj/ Z+iUIbX1HdoG0LGxhP7lEkEt60Tmf2sGub+YHdv/i+AzhOm/Ze2hVK0dCVWWZRogedcx teeQ== X-Gm-Message-State: AEkoouuXHo6OToAQ8+UHnGMAsI8FqEwEZTpAhxxssQAS3S9z//FIUiCxSXYMrFD5kurgE4s4 X-Received: by 10.194.238.42 with SMTP id vh10mr3317245wjc.111.1472049387002; Wed, 24 Aug 2016 07:36:27 -0700 (PDT) Received: from localhost.localdomain ([213.143.60.123]) by smtp.gmail.com with ESMTPSA id n2sm10365569wjd.1.2016.08.24.07.36.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Aug 2016 07:36:26 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com, will.deacon@arm.com, mark.rutland@arm.com, james.morse@arm.com Subject: [PATCH v2 7/9] arm64: kernel: drop use of x24 from primary boot path Date: Wed, 24 Aug 2016 16:36:04 +0200 Message-Id: <1472049366-10922-8-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1472049366-10922-1-git-send-email-ard.biesheuvel@linaro.org> References: <1472049366-10922-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160824_073649_262360_CA2FAA3B X-CRM114-Status: GOOD ( 10.83 ) 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: 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. 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 Reviewed-by: Mark Rutland diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index c112c153821e..27f51272de68 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 @@ -792,6 +794,7 @@ __primary_switch: bl __relocate_kernel #ifdef CONFIG_RANDOMIZE_BASE ldr x8, =__primary_switched + adrp x0, __PHYS_OFFSET blr x8 /* @@ -813,5 +816,6 @@ __primary_switch: #endif #endif ldr x8, =__primary_switched + adrp x0, __PHYS_OFFSET br x8 ENDPROC(__primary_switch)