From patchwork Wed Feb 13 08:58:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 2134611 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id 79CB13FCA4 for ; Wed, 13 Feb 2013 09:01:30 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1U5YBF-0002ZH-JK; Wed, 13 Feb 2013 08:59:05 +0000 Received: from mail-ea0-f173.google.com ([209.85.215.173]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1U5YB1-0002UV-At for linux-arm-kernel@lists.infradead.org; Wed, 13 Feb 2013 08:58:52 +0000 Received: by mail-ea0-f173.google.com with SMTP id i1so379852eaa.32 for ; Wed, 13 Feb 2013 00:58:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:from:to:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=NVhe4SBuEQsc4cesmIq4FPHCyr8vYxW5z/uiOQBtQ+c=; b=M8LUOiUXBjyHScoT8zzaRgbHdTqwsimIrwVNInCOa6jcmlhe53SrreK3spGlcuA/4E /wU+Fj4uRoE56c01NYCEBGfBeKZOZz1Reyq7w42bPex1tZp5ufn9N2DeOjUbSyqugFNl RN/PjCq5u+TCn8WSezOEj2SrcxIhakwb7EYaYQfHFE5Y9CNF+3ZZ2jhjv6NubZjIkS4+ 4L/kByGOXF6okpiMfs42h72wXgKYTkuG1XJQuckUA3tM2UWC3tJE+C7Pg6dV4ouDPPw5 7ndoxVqQhFr4SqKku84+SMrGSOQwJcm/5kM4nPGXAZZtZieVXVFXS6D3a0pfW2RpnaCc A3iA== X-Received: by 10.14.215.193 with SMTP id e41mr3137643eep.32.1360745929279; Wed, 13 Feb 2013 00:58:49 -0800 (PST) Received: from localhost (nat-63.starnet.cz. [178.255.168.63]) by mx.google.com with ESMTPS id 3sm71869050eej.6.2013.02.13.00.58.48 (version=TLSv1.1 cipher=RC4-SHA bits=128/128); Wed, 13 Feb 2013 00:58:48 -0800 (PST) From: Michal Simek To: linux-arm-kernel@lists.infradead.org, monstr@monstr.eu Subject: [PATCH 2/2] arm: mm: Add support for booting the kernel out of the first 16MB of memory Date: Wed, 13 Feb 2013 09:58:45 +0100 Message-Id: <1360745925-20952-2-git-send-email-michal.simek@xilinx.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1360745925-20952-1-git-send-email-michal.simek@xilinx.com> References: <1360745925-20952-1-git-send-email-michal.simek@xilinx.com> X-Gm-Message-State: ALoCoQmq+P17x/wfrBdYkZ9kdNvihO1XA2Se1RsjR51EdLEd6f5S1Srx3gbRtnT2BL4KAHXkJJVL X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130213_035851_483492_76DE9386 X-CRM114-Status: GOOD ( 20.22 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.173 listed in list.dnswl.org] -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The kernel should be loaded to the first 16MB memory and DTS memory node should reflect this as well. In case when the kernel is loaded to addresses higher than 16MB, the kernel doesn't boot and fail. This patch fix this case by changing the current memory bank start address to the kernel loading address. The memory which is in front of the kernel loading address will be ignored (which is also the current behavior if memory is described with several memory banks). Here is the example of behavior: dts memory reg = <0x0 0x40000000>; kernel load address = 0x10000000 (respectively 0x1000800) Current: The kernel doesn't boot and fails with this error: "Ignoring RAM at 00000000-3fffffff (vmalloc region overlap). Memory policy: ECC disabled, Data cache writeback Kernel panic - not syncing: ERROR: Failed to allocate 0x1000 bytes below 0x0." When this patch is applied: The kernel works only with 0x10000000-0x3fffffff. (0x0-0x0fffffff is ignored) And the kernel bootlog contains "Change memory bank to 10000000-3fffffff" message. The patch just add the same behavior as is the case when you setup mem=768M on the command line and load the kernel to the 0x10000000(0x10008000) address. When mem is specified dts memory description is simply ignored. Signed-off-by: Michal Simek --- arch/arm/mm/mmu.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-) diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c index e60f370..78fd18b 100644 --- a/arch/arm/mm/mmu.c +++ b/arch/arm/mm/mmu.c @@ -936,6 +936,17 @@ void __init sanity_check_meminfo(void) if (bank->start > ULONG_MAX) highmem = 1; + if (bank->start < __pa(PAGE_OFFSET) && + __pa(PAGE_OFFSET) <= (bank->start + bank->size - 1)) { + int offset = __pa(PAGE_OFFSET) - bank->start; + bank->start += offset; + bank->size -= offset; + pr_crit("Change memory bank to %.8llx-%.8llx\n", + (unsigned long long)bank->start, + (unsigned long long)bank->start + + bank->size - 1); + } + #ifdef CONFIG_HIGHMEM if (__va(bank->start + bank->size - 1) < (void *)PAGE_OFFSET) { pr_notice("Ignoring RAM at %.8llx-%.8llx ",