From patchwork Tue Mar 24 17:52: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: 6084641 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 017C5BF90F for ; Tue, 24 Mar 2015 17:56:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 276092024D for ; Tue, 24 Mar 2015 17:56:07 +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 3E7D6201ED for ; Tue, 24 Mar 2015 17:56:06 +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 1YaT1W-0002k3-IH; Tue, 24 Mar 2015 17:53:54 +0000 Received: from mail-we0-f179.google.com ([74.125.82.179]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YaT0m-0002OB-Ey for linux-arm-kernel@lists.infradead.org; Tue, 24 Mar 2015 17:53:09 +0000 Received: by wetk59 with SMTP id k59so307663wet.3 for ; Tue, 24 Mar 2015 10:52:46 -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=cZYDBlpzM9bZVcU+sIaBGfbJLXu0rcJhMP4F5okmssQ=; b=ARVPiKlTo8iAGKv65COqHpwKpoP2Jux/aI49ubTHdqUkJF0gh/KDfnbPdbKVsiK8/o ln2NgMzEB/zX7sHe9khHkIR37o4fn/+xoec55OgkihYHLJb0MByFRDwJDCUQhAcJ9/d7 IKbAbmfrMbFwH4+WTJ5lRYpBsH9rFJljoCUwoBVPnp3BvSvFwGv6hFwJp4uuuKxeqOEl Q0IOfL9hMQjIeOdwhEaHSOu5hm+pCCAE4Ypo/s4WRFhe3ULpnJLfhVrHLHYTwYNuMmKI bk9jpRvtGob7bkF/PTCgTKg6uyn9ibJdT1dxg6B8UpgQFHw5tnxrf3imHBw0TYyhlecR w+RQ== X-Gm-Message-State: ALoCoQmkJfEJKZwbylEJUb8zN+m7lbn9D24HN+/sdHrLvB5RnkaQkwrYe7QsemAup0k6YSn9EjKH X-Received: by 10.194.108.137 with SMTP id hk9mr9884670wjb.112.1427219566292; Tue, 24 Mar 2015 10:52:46 -0700 (PDT) Received: from ards-macbook-pro.local ([90.174.5.112]) by mx.google.com with ESMTPSA id ge8sm7064903wjc.32.2015.03.24.10.52.44 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 24 Mar 2015 10:52:45 -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 v2 2/4] ARM: move cpu_resume() to .text section Date: Tue, 24 Mar 2015 18:52:28 +0100 Message-Id: <1427219550-21636-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1427219550-21636-1-git-send-email-ard.biesheuvel@linaro.org> References: <1427219550-21636-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_105308_686331_BB18C2AB X-CRM114-Status: GOOD ( 11.46 ) 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. Reviewed-by: Nicolas Pitre Tested-by: Sudeep Holla Signed-off-by: Ard Biesheuvel --- 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 0ea3813fedce..fabdb14e88b8 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