From patchwork Thu Nov 12 12:17:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hurley X-Patchwork-Id: 7601391 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 B2ADD9F392 for ; Thu, 12 Nov 2015 12:20:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id BD711206EB for ; Thu, 12 Nov 2015 12:20:39 +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 D5E2A205B9 for ; Thu, 12 Nov 2015 12:20:38 +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 1ZwqpS-0002Q7-5l; Thu, 12 Nov 2015 12:18:14 +0000 Received: from mail-ig0-x229.google.com ([2607:f8b0:4001:c05::229]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZwqpP-0002OX-7s for linux-arm-kernel@lists.infradead.org; Thu, 12 Nov 2015 12:18:11 +0000 Received: by igl9 with SMTP id 9so95822498igl.0 for ; Thu, 12 Nov 2015 04:17:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hurleysoftware_com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=RrED/COKX7TFjO0TgM/oeXhpOK1XMJhHOyd9KqIu910=; b=clLQ0CN9S4VZTAT8VF1IvDLTDglhTlDJmaifi+ugeBJ4usiwJE8nL1p61OdEhWBFMB UgPAhQ9FjDpNoRiQBIKTv9K0SjoHj4iHKQwESewqURkjViFlCargken1TmFAgfGAm8ZP O5HlKd/vCqk3OGawMJBoiLXn982sSZ814UDnD8s7eMlgMxrB2Oqh15hTn4ovOrchOmLQ rozSddEk5FKcS0fCzixvrXcGja6nhpLJRxwmvWy3E1E2e8u+0V02ji/GEJ/P3rj5p2AW 1rc5CrA5pEvtYppi+QL1+is0kIv8+sbZxVJ79Aml8TiOmfV9sfSBT8Mu4R+os9r+16Fs pNlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=RrED/COKX7TFjO0TgM/oeXhpOK1XMJhHOyd9KqIu910=; b=OkE5w5faem752EZkplBuY+JP1nyUKzUC4VMyIp4wEuGaZ62cHqdD5MJ8UHt6JG7VDx ZOMUPro+YZaajEfGxNZXBruQ5YMtTKl0QHyGsuVWkyBwoMP1ZZ5+zhzt6sXvbtKbgXiy zw4jT+nQKaPzNe4jRlb5S7MCDhGvxGVabFVLI7B9q6UTq4vTMqHX06nNT0hvC3owrbkg CWX/yz3YgRD+KznVk22MIa5u7WRxzgbq0g5424ggsTO6AMGCYxFImzZLDMDqtCNfwMdk Lm82K0y8AWPpR2ACya6FfS649/9eQd46xQlshZfk63OKSN0scUUr5cZF/lLgKwOBzukB D9tw== X-Gm-Message-State: ALoCoQlZGA1THCvKN4ldFgXOqD1gt6BTpRinAdJVbA2JO5Cs0htl3wQVnC+ZCT4HdmiquVPQ/CLD X-Received: by 10.50.171.194 with SMTP id aw2mr37570055igc.83.1447330669118; Thu, 12 Nov 2015 04:17:49 -0800 (PST) Received: from [192.168.1.6] (cpe-76-190-194-55.neo.res.rr.com. [76.190.194.55]) by smtp.gmail.com with ESMTPSA id or1sm4849685igb.4.2015.11.12.04.17.48 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 12 Nov 2015 04:17:48 -0800 (PST) Subject: Re: [PATCH] ARM: xip: Use correct symbol for end of ROM marker To: Chris Brandt , linux@arm.linux.org.uk, arnd@arndb.de References: <1447251455-22731-1-git-send-email-chris.brandt@renesas.com> From: Peter Hurley Message-ID: <5644836B.2050608@hurleysoftware.com> Date: Thu, 12 Nov 2015 07:17:47 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1447251455-22731-1-git-send-email-chris.brandt@renesas.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151112_041811_340610_EB64B52B X-CRM114-Status: GOOD ( 18.91 ) X-Spam-Score: -2.6 (--) 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-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sh@vger.kernel.org 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,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,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 On 11/11/2015 09:17 AM, Chris Brandt wrote: > 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[]; > I think below is required as well. Peter Hurley --- a/arch/arm/kernel/module.c +++ b/arch/arm/kernel/module.c @@ -34,7 +36,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 Regards,