From patchwork Mon Feb 1 14:08:56 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Brandt X-Patchwork-Id: 8179941 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 EF65D9F8AA for ; Mon, 1 Feb 2016 14:11:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2589120457 for ; Mon, 1 Feb 2016 14:11:29 +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 2622820460 for ; Mon, 1 Feb 2016 14:11:27 +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 1aQFB0-0007Tx-Vm; Mon, 01 Feb 2016 14:09:58 +0000 Received: from relmlor4.renesas.com ([210.160.252.174] helo=relmlie3.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aQFAt-00074x-BB for linux-arm-kernel@lists.infradead.org; Mon, 01 Feb 2016 14:09:53 +0000 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 01 Feb 2016 23:09:29 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id AC1456872F; Mon, 1 Feb 2016 23:09:29 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id A47682806E; Mon, 1 Feb 2016 23:09:29 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 933252806D; Mon, 1 Feb 2016 23:09:29 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id ZAB02832; Mon, 1 Feb 2016 23:09:29 +0900 X-IronPort-AV: E=Sophos;i="5.22,380,1449500400"; d="scan'208";a="204756435" Received: from unknown (HELO rtamta01.rta.renesas.com) ([143.103.48.75]) by relmlii2.idc.renesas.com with ESMTP; 01 Feb 2016 23:09:28 +0900 Received: from localhost.localdomain (unknown [143.103.58.146]) by rtamta01.rta.renesas.com (Postfix) with ESMTP id 900B553B; Mon, 1 Feb 2016 14:09:25 +0000 (UTC) From: Chris Brandt To: linux@arm.linux.org.uk Subject: [PATCH v2] ARM: proc-v7.S: Adjust stack address when XIP_KERNEL Date: Mon, 1 Feb 2016 09:08:56 -0500 Message-Id: <1454335736-10084-1-git-send-email-chris.brandt@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1454105474-3009-1-git-send-email-chris.brandt@renesas.com> References: <1454105474-3009-1-git-send-email-chris.brandt@renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160201_060951_622533_50CB6B3A X-CRM114-Status: GOOD ( 10.69 ) X-Spam-Score: -2.4 (--) 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: Chris Brandt , linux-arm-kernel@lists.infradead.org, Nicolas Pitre 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.7 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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: Nicolas Pitre When XIP_KERNEL is enabled, the virt to phys address translation for RAM is not the same as the virt to phys address translation for .text. The only way to know where physical RAM is located is to use PLAT_PHYS_OFFSET. The MACRO will be useful for other places where there is a similar problem. Signed-off-by: Nicolas Pitre Signed-off-by: Chris Brandt --- v2: * Fixed Signed-off to show correct author --- arch/arm/include/asm/memory.h | 8 ++++++++ arch/arm/mm/proc-v7.S | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index c79b57b..7dd2ab5 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -134,6 +134,14 @@ */ #define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) +#ifdef CONFIG_XIP_KERNEL +#define PHYS_OFFSET_FIXUP \ + ( XIP_VIRT_ADDR(CONFIG_XIP_PHYS_ADDR) - PAGE_OFFSET + \ + PLAT_PHYS_OFFSET - CONFIG_XIP_PHYS_ADDR ) +#else +#define PHYS_OFFSET_FIXUP 0 +#endif + #ifndef __ASSEMBLY__ /* diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S index 0f92d57..1595fb2 100644 --- a/arch/arm/mm/proc-v7.S +++ b/arch/arm/mm/proc-v7.S @@ -487,7 +487,7 @@ __errata_finish: .align 2 __v7_setup_stack_ptr: - .word __v7_setup_stack - . + .word __v7_setup_stack - . + PHYS_OFFSET_FIXUP ENDPROC(__v7_setup) .bss