From patchwork Tue Mar 24 16:10:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 6081831 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF9969F2A9 for ; Tue, 24 Mar 2015 16:14:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 13019201EF for ; Tue, 24 Mar 2015 16:14:17 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 240E320148 for ; Tue, 24 Mar 2015 16:14:16 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1YaRQb-00023J-CB; Tue, 24 Mar 2015 16:11:41 +0000 Received: from mail-wi0-f169.google.com ([209.85.212.169]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YaRQ2-0001k0-DQ for linux-arm-kernel@lists.infradead.org; Tue, 24 Mar 2015 16:11:07 +0000 Received: by wixw10 with SMTP id w10so1762013wix.0 for ; Tue, 24 Mar 2015 09:10:44 -0700 (PDT) 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=5mw2D6oHklu3kh3Ki+aSvpi9GUt27Nx+iXKeSXTCnnQ=; b=LZgfAVBjGqFP020hQkNcVNNesAPdgq3Db5vkmq/p+xYUPAv/NWFFBYw/QwVpRXywe3 EV/kluMb6u//SzNpauHgkIui26PFXpesSI/fTmQ/6Zb7KWf/M+1Pw5VsLkgg7+R6mS/C btwsgSz30Q9GsQZNTG7ZJyyJCON/2oZNn8DJomTmzvwMlMcUBlXDHRY2gRO7jLPtgqfv sI9GQ+LjAetpJYCojVaKgrV2xWKdDkmpDIUWSiNhkmeOJahcJpoE3XkixVwcsoWprHUv mK225XuUu66RN3idxL4qJ4saiKv7iVejvI6PyTyO++qWDFO4CWiLn5nRlSdV+J1fZ4Lo DJMw== X-Gm-Message-State: ALoCoQkFV1PMn/N51syNLMJPFR5pe+nJaxx2BcaBWoZUiAqEwYSpLt5a7Zvg8hVXgXl50s63sfte X-Received: by 10.180.216.38 with SMTP id on6mr29813757wic.15.1427213444056; Tue, 24 Mar 2015 09:10:44 -0700 (PDT) Received: from ards-macbook-pro.local ([90.174.5.112]) by mx.google.com with ESMTPSA id ub1sm6685489wjc.43.2015.03.24.09.10.41 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Mar 2015 09:10:42 -0700 (PDT) From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org, nico@linaro.org, linux@arm.linux.org.uk, dave.martin@arm.com, arnd@arndb.de Subject: [PATCH 1/3] ARM: move cpu_resume() to .text section Date: Tue, 24 Mar 2015 17:10:28 +0100 Message-Id: <1427213430-28463-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1427213430-28463-1-git-send-email-ard.biesheuvel@linaro.org> References: <1427213430-28463-1-git-send-email-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150324_091106_603703_E09B5BF0 X-CRM114-Status: GOOD ( 11.47 ) X-Spam-Score: -0.7 (/) Cc: Ard Biesheuvel X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move cpu_resume() to the .text section where it belongs. Change the adr reference to sleep_save_sp to an explicit PC relative reference so sleep_save_sp itself can remain in .data. This helps prevent linker failure on large kernels, as the code in the .data section may be too far away to be in range for normal b/bl instructions. Signed-off-by: Ard Biesheuvel Reviewed-by: Nicolas Pitre Tested-by: Sudeep Holla --- arch/arm/kernel/sleep.S | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/sleep.S b/arch/arm/kernel/sleep.S index 31041b4a3f53..fb64c96cd801 100644 --- a/arch/arm/kernel/sleep.S +++ b/arch/arm/kernel/sleep.S @@ -116,14 +116,7 @@ cpu_resume_after_mmu: ldmfd sp!, {r4 - r11, pc} ENDPROC(cpu_resume_after_mmu) -/* - * Note: Yes, part of the following code is located into the .data section. - * This is to allow sleep_save_sp to be accessed with a relative load - * while we can't rely on any MMU translation. We could have put - * sleep_save_sp in the .text section as well, but some setups might - * insist on it to be truly read-only. - */ - .data + .text .align ENTRY(cpu_resume) ARM_BE8(setend be) @ ensure we are in BE mode @@ -145,6 +138,8 @@ ARM_BE8(setend be) @ ensure we are in BE mode compute_mpidr_hash r1, r4, r5, r6, r0, r3 1: adr r0, _sleep_save_sp + ldr r2, [r0] + add r0, r0, r2 ldr r0, [r0, #SLEEP_SAVE_SP_PHYS] ldr r0, [r0, r1, lsl #2] @@ -156,10 +151,12 @@ THUMB( bx r3 ) ENDPROC(cpu_resume) .align 2 +_sleep_save_sp: + .long sleep_save_sp - . mpidr_hash_ptr: .long mpidr_hash - . @ mpidr_hash struct offset + .data .type sleep_save_sp, #object ENTRY(sleep_save_sp) -_sleep_save_sp: .space SLEEP_SAVE_SP_SZ @ struct sleep_save_sp