From patchwork Wed Nov 11 14:31:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Brandt X-Patchwork-Id: 7596081 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 C58119F2F7 for ; Wed, 11 Nov 2015 14:34:04 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D482320622 for ; Wed, 11 Nov 2015 14:34:03 +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 0A89320498 for ; Wed, 11 Nov 2015 14:34:03 +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 1ZwWRF-0007RK-VS; Wed, 11 Nov 2015 14:31:53 +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 1ZwWRC-0007Qq-Gc for linux-arm-kernel@lists.infradead.org; Wed, 11 Nov 2015 14:31:51 +0000 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie3.idc.renesas.com with ESMTP; 11 Nov 2015 23:31:28 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id CF0004DAF4; Wed, 11 Nov 2015 23:31:28 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id B6828480A3; Wed, 11 Nov 2015 23:31:28 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id B0117480A6; Wed, 11 Nov 2015 23:31:28 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac4.idc.renesas.com with ESMTP id ZAB28878; Wed, 11 Nov 2015 23:31:28 +0900 X-IronPort-AV: E=Sophos;i="5.20,276,1444662000"; d="scan'208";a="199538448" Received: from unknown (HELO rtamta01.rta.renesas.com) ([143.103.48.75]) by relmlii2.idc.renesas.com with ESMTP; 11 Nov 2015 23:31:27 +0900 Received: from localhost.localdomain (unknown [143.103.58.49]) by rtamta01.rta.renesas.com (Postfix) with ESMTP id 6D91A37F; Wed, 11 Nov 2015 14:31:24 +0000 (UTC) From: Chris Brandt To: linux@arm.linux.org.uk Subject: [PATCH] ARM: xip: Fix module loading Date: Wed, 11 Nov 2015 09:31:09 -0500 Message-Id: <1447252269-22864-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_063150_679146_A8C45A05 X-CRM114-Status: UNSURE ( 7.90 ) X-CRM114-Notice: Please train this message. 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-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 kernel, RAM start at _sdata instead of _stext. This fixes an issue where when you load a module, vmalloc would return virtual memory that the MMU has incorrectly mapped to non-RAM physical addresses. This fix is similar to what is already done in arm_memblock_init(). Signed-off-by: Chris Brandt --- arch/arm/mm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index dd5a56b..d60cb8c 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -1383,7 +1383,11 @@ static void __init kmap_init(void) static void __init map_lowmem(void) { struct memblock_region *reg; +#ifdef CONFIG_XIP_KERNEL + phys_addr_t kernel_x_start = round_down(__pa(_sdata), SECTION_SIZE); +#else phys_addr_t kernel_x_start = round_down(__pa(_stext), SECTION_SIZE); +#endif phys_addr_t kernel_x_end = round_up(__pa(__init_end), SECTION_SIZE); /* Map all the lowmem memory banks. */