From patchwork Thu Jul 16 14:37:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Brandt X-Patchwork-Id: 6807611 Return-Path: X-Original-To: patchwork-linux-sh@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 7B29FC05AC for ; Thu, 16 Jul 2015 14:39:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0345A20673 for ; Thu, 16 Jul 2015 14:39:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 143992065D for ; Thu, 16 Jul 2015 14:39:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755685AbbGPOi4 (ORCPT ); Thu, 16 Jul 2015 10:38:56 -0400 Received: from relmlor4.renesas.com ([210.160.252.174]:39618 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755666AbbGPOiz (ORCPT ); Thu, 16 Jul 2015 10:38:55 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 16 Jul 2015 23:38:53 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 971915BC70; Thu, 16 Jul 2015 23:38:53 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 8483D8002E; Thu, 16 Jul 2015 23:38:53 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 77D9D8002D; Thu, 16 Jul 2015 23:38:53 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac1.idc.renesas.com with ESMTP id ZAB02226; Thu, 16 Jul 2015 23:38:53 +0900 X-IronPort-AV: E=Sophos;i="5.15,488,1432566000"; d="scan'208";a="190502109" Received: from unknown (HELO rtamta01.rta.renesas.com) ([143.103.48.75]) by relmlii1.idc.renesas.com with ESMTP; 16 Jul 2015 23:38:52 +0900 Received: from localhost.localdomain (unknown [172.27.49.110]) by rtamta01.rta.renesas.com (Postfix) with ESMTP id CC4EE52F; Thu, 16 Jul 2015 14:38:24 +0000 (UTC) From: Chris Brandt To: linux@arm.linux.org.uk, arnd@arndb.de Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sh@vger.kernel.org, Chris Brandt Subject: [PATCH 2/2] ARM: xip: Use correct symbol for end of ROM marker Date: Thu, 16 Jul 2015 10:37:14 -0400 Message-Id: <1437057434-1616-3-git-send-email-chris.brandt@renesas.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1437057434-1616-1-git-send-email-chris.brandt@renesas.com> References: <1437057434-1616-1-git-send-email-chris.brandt@renesas.com> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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, is the end of constant R/O memory that needs to be mapped into the MODULES_VADDR area. This fixes the bug where you might loose part of your R/O data after page table setup is complete. Signed-off-by: Chris Brandt --- arch/arm/kernel/module.c | 2 +- arch/arm/mm/mmu.c | 4 ++-- include/asm-generic/sections.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c index efdddcb..41ae2cc 100644 --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -34,7 +34,7 @@ * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off. */ #undef MODULES_VADDR -#define MODULES_VADDR (((unsigned long)_etext + ~PMD_MASK) & PMD_MASK) +#define MODULES_VADDR (((unsigned long)_edata_loc + ~PMD_MASK) & PMD_MASK) #endif #ifdef CONFIG_MMU diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index 6ca7d9a..57456df 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1162,7 +1162,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)); @@ -1241,7 +1241,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[];