From patchwork Wed Nov 11 14:17:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Brandt X-Patchwork-Id: 7596001 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 DFC5BBF90C for ; Wed, 11 Nov 2015 14:21:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1373A205BB for ; Wed, 11 Nov 2015 14:21:11 +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 3B37E205BA for ; Wed, 11 Nov 2015 14:21:10 +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 1ZwWE6-0001Um-2k; Wed, 11 Nov 2015 14:18:18 +0000 Received: from relmlor2.renesas.com ([210.160.252.172] helo=relmlie1.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZwWE1-0001SL-AV for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2015 14:18:14 +0000 Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie1.idc.renesas.com with ESMTP; 11 Nov 2015 23:17:51 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 320684E732; Wed, 11 Nov 2015 23:17:51 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 2DC012806E; Wed, 11 Nov 2015 23:17:51 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 27D052806D; Wed, 11 Nov 2015 23:17:51 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id ZAA05489; Wed, 11 Nov 2015 23:17:51 +0900 X-IronPort-AV: E=Sophos;i="5.20,276,1444662000"; d="scan'208";a="199537983" Received: from unknown (HELO rtamta01.rta.renesas.com) ([143.103.48.75]) by relmlii2.idc.renesas.com with ESMTP; 11 Nov 2015 23:17:50 +0900 Received: from localhost.localdomain (unknown [143.103.58.49]) by rtamta01.rta.renesas.com (Postfix) with ESMTP id 85A58329; Wed, 11 Nov 2015 14:17:46 +0000 (UTC) From: Chris Brandt To: linux@arm.linux.org.uk, arnd@arndb.de Subject: [PATCH] ARM: xip: Use correct symbol for end of ROM marker Date: Wed, 11 Nov 2015 09:17:35 -0500 Message-Id: <1447251455-22731-1-git-send-email-chris.brandt@renesas.com> X-Mailer: git-send-email 1.7.9.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151111_061813_595275_0EF55136 X-CRM114-Status: GOOD ( 11.51 ) X-Spam-Score: -2.9 (--) 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-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org 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.5 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 For an XIP build, _edata_loc, not _etext, represents the end of the binary image that will be programmed into ROM and mapped into the MODULES_VADDR area. With an XIP kernel, nothing is loaded into RAM before boot, meaning you have to take into account the size of the entire binary image that was programmed, including the init data values that will be copied to RAM during kernel boot. This fixes the bug where you might lose the end of your kernel area after page table setup is complete. Signed-off-by: Chris Brandt --- arch/arm/mm/mmu.c | 4 ++-- include/asm-generic/sections.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 4867f5d..dd5a56b 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1210,7 +1210,7 @@ static inline void prepare_page_table(void) #ifdef CONFIG_XIP_KERNEL /* The XIP kernel is mapped in the module area -- skip over it */ - addr = ((unsigned long)_etext + PMD_SIZE - 1) & PMD_MASK; + addr = ((unsigned long)_edata_loc + PMD_SIZE - 1) & PMD_MASK; #endif for ( ; addr < PAGE_OFFSET; addr += PMD_SIZE) pmd_clear(pmd_off_k(addr)); @@ -1292,7 +1292,7 @@ static void __init devicemaps_init(const struct machine_desc *mdesc) #ifdef CONFIG_XIP_KERNEL map.pfn = __phys_to_pfn(CONFIG_XIP_PHYS_ADDR & SECTION_MASK); map.virtual = MODULES_VADDR; - map.length = ((unsigned long)_etext - map.virtual + ~SECTION_MASK) & SECTION_MASK; + map.length = ((unsigned long)_edata_loc - map.virtual + ~SECTION_MASK) & SECTION_MASK; map.type = MT_ROM; create_mapping(&map); #endif diff --git a/include/asm-generic/sections.h b/include/asm-generic/sections.h index b58fd66..195554d 100644 --- a/include/asm-generic/sections.h +++ b/include/asm-generic/sections.h @@ -26,7 +26,7 @@ * __ctors_start, __ctors_end */ extern char _text[], _stext[], _etext[]; -extern char _data[], _sdata[], _edata[]; +extern char _data[], _sdata[], _edata[], _edata_loc[]; extern char __bss_start[], __bss_stop[]; extern char __init_begin[], __init_end[]; extern char _sinittext[], _einittext[];