From patchwork Fri Nov 6 07:53:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Magnus Damm X-Patchwork-Id: 7567251 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 450BFC05C6 for ; Fri, 6 Nov 2015 07:54:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5B8542076D for ; Fri, 6 Nov 2015 07:54:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 77E7020742 for ; Fri, 6 Nov 2015 07:54:15 +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 1ZubpI-0007Q7-O6; Fri, 06 Nov 2015 07:52:48 +0000 Received: from mail-pa0-x230.google.com ([2607:f8b0:400e:c03::230]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZubpE-0007Hw-9h for linux-arm-kernel@lists.infradead.org; Fri, 06 Nov 2015 07:52:45 +0000 Received: by padhx2 with SMTP id hx2so106922826pad.1 for ; Thu, 05 Nov 2015 23:52:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:date:message-id:subject; bh=ftufbsi1HorQILrStQ17dbIQprHVQHoTFXIyGzLRhsQ=; b=rE5xh5twGtKMzb1m2UZ++2IPQkmawNhqp16CHmj1ZEP6BHMfZObvdoNsNaTTZ7IUQH +U82ttk5IGKeI9NF6kydXKy1+UT9mrdvZEY1qzne9hIRqBrzkZBAUFAZUr+Z0TeOLaCi fFJbSDGBoRCPc7VYD4bhUbh+40emxKlUAPj8Ux7DFPGpsX2xyT4Yqv37I/E8oPsuQZ9R nZcLYkLK85GtQ1KLPvzeNLeH/raefdfpBpeVRDGBggv/cIKmHHgLzYcQw/RhwksShZgQ 1DZa5CjmopFl5bVtMswBz1dUy9VFL1ptItgJb18gDOMc0XuE+Q4y5KWWVHDZKsy8qbPm XEuA== X-Received: by 10.68.241.6 with SMTP id we6mr15987040pbc.23.1446796343466; Thu, 05 Nov 2015 23:52:23 -0800 (PST) Received: from [127.0.0.1] (s214090.ppp.asahi-net.or.jp. [220.157.214.90]) by smtp.gmail.com with ESMTPSA id bh4sm12189374pbb.17.2015.11.05.23.52.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2015 23:52:22 -0800 (PST) From: Magnus Damm To: linux-arm-kernel@lists.infradead.org Date: Fri, 06 Nov 2015 16:53:19 +0900 Message-Id: <20151106075319.19378.64286.sendpatchset@little-apple> Subject: [PATCH] ARM: proc-v7: Put stack in data section, handle XIP case X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151105_235244_396583_7383254F X-CRM114-Status: GOOD ( 12.01 ) X-Spam-Score: -2.7 (--) 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: , linux@arm.linux.org.uk, geert+renesas@glider.be, linux-sh@vger.kernel.org, catalin.marinas@arm.com, Magnus Damm , Chris.Brandt@renesas.com, ezequiel@vanguardiasur.com.ar, u.kleine-koenig@pengutronix.de 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.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, 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 From: Magnus Damm Adjust the ARM v7 setup code to put the temporary stack in the data section and also use PLAT_PHYS_OFFSET to handle the XIP case. The common case of XIP=n the code is considered to be position independent while for XIP=y PLAT_PHYS_OFFSET is fixed. This is based on that early code in head.S invoking PROCINFO_INITFUNC seems position independent. At this point two places in proc-v7.S make use of the temporary stack so the PLAT_PHYS_OFFSET calculation is duplicated. The XIP=n case has been tested with CPU Hotplug on r8a7779 (Cortex A9 Quad) and Chris [CCed] has tested the XIP=y case. Signed-off-by: Magnus Damm Tested-by: Chris.Brandt@renesas.com --- Please let me know if considering XIP=y position independent is overkill, or if it is better to share code somehow. arch/arm/mm/proc-v7.S | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) --- 0001/arch/arm/mm/proc-v7.S +++ work/arch/arm/mm/proc-v7.S 2015-11-06 16:32:13.370513000 +0900 @@ -274,7 +274,15 @@ __v7_ca15mp_setup: __v7_b15mp_setup: __v7_ca17mp_setup: mov r10, #0 -1: adr r12, __v7_setup_stack @ the local stack +1: adr r11, __v7_setup_stack_ptr @ pointer to local stack + ldmia r11, {r0, r12} +#ifdef CONFIG_XIP_KERNEL + ldr r11, =PLAT_PHYS_OFFSET @ fixed address +#else + sub r11, r11, r0 @ position independent offset +#endif + add r12, r12, r11 @ phys address + sub r12, #PAGE_OFFSET stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6 bl v7_invalidate_l1 ldmia r12, {r0-r5, lr} @@ -415,7 +423,15 @@ __v7_pj4b_setup: #endif /* CONFIG_CPU_PJ4B */ __v7_setup: - adr r12, __v7_setup_stack @ the local stack + adr r11, __v7_setup_stack_ptr @ pointer to local stack + ldmia r11, {r0, r12} +#ifdef CONFIG_XIP_KERNEL + ldr r11, =PLAT_PHYS_OFFSET @ fixed address +#else + sub r11, r11, r0 @ position independent offset +#endif + add r12, r12, r11 @ phys address + sub r12, #PAGE_OFFSET stmia r12, {r0-r5, lr} @ v7_invalidate_l1 touches r0-r6 bl v7_invalidate_l1 ldmia r12, {r0-r5, lr} @@ -482,6 +498,11 @@ __errata_finish: ret lr @ return to head.S:__ret ENDPROC(__v7_setup) +__v7_setup_stack_ptr: + .long . + .long __v7_setup_stack + + .data .align 2 __v7_setup_stack: .space 4 * 7 @ 12 registers