From patchwork Wed Dec 19 16:16:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eugeniy Paltsev X-Patchwork-Id: 1016174 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=synopsys.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Pvw0AYZb"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=synopsys.com header.i=@synopsys.com header.b="C9joJGAX"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43Kg512dZ8z9sBh for ; Thu, 20 Dec 2018 03:16:53 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=iNMqdPD08OGu/wHnlO/OLm94WWJWl1tWC75OHyV2uPQ=; b=Pvw 0AYZba5B3txMwnr1Ka/M5Gizh8dQ8jYQgY2TBbUCshPF8Hegv7oDrNxMGi9pdnMUAZZENM4uKBH6Y jCjANkto0NncvAaQXI1qM5jS6u0usZ/gMYd8SVNr0QMcWpHkCTBS1eQewyASVdCYjy0MrJsxwQMOv gLpRB0wsZKxz8Qe6NDhT1rMOaa2SkP8j4ai9fav62cP9R5T+Nz+LPUT01AlEyb7wiGfnngHfNw6wI lK2fhOt7JPdMZg0rjO/kKIaAYT/mH/KauE6FGup7QuVhNdU46MTNi0BXLlWWhxTEs0d6pblebFI17 a8jZDN1KwmQ2/I18jRSyMX2I3fltAEQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZeWh-0007CL-E4; Wed, 19 Dec 2018 16:16:51 +0000 Received: from smtprelay2.synopsys.com ([198.182.60.111] helo=smtprelay.synopsys.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gZeWe-0007BK-MW for linux-snps-arc@lists.infradead.org; Wed, 19 Dec 2018 16:16:50 +0000 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 447FF10C1DC3; Wed, 19 Dec 2018 08:16:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1545236195; bh=7LE4Y0kl6NhqEVYvVOZ2QDN3PQMCheUaIYmiZZU/1kw=; h=From:To:Cc:Subject:Date:From; b=C9joJGAXZIEP5+qnZkAtjKK7XOWwWlhILUYXx5RMUg0OwYCY4QpFhALYQBAyc7qU4 7P3DB0X4F1JgFqT48iJNpvZJdIiANSR63JjYM0Tp5/S8/uU8vOS/9THWppIWO9WP20 zjm0MJljSnIpk0ll1+dWECpsKpCxGlDeCd7/em69/z8OhH737/9L4R6Vef2WVAQNv2 K0RmMsWA3HnFuAHJfpn285hcgdZxx4CjlVtJil4YL/vGfkVEmusXBr5nE9g/YLlbOS RowtosTgwvNlsfX55fis/zIQTCLUyN29Fpue1HNKXgCf44gHYMFVH8hGmMLi75nd56 5ZurYJY1Qizkw== Received: from paltsev-e7480.internal.synopsys.com (paltsev-e7480.internal.synopsys.com [10.121.3.66]) by mailhost.synopsys.com (Postfix) with ESMTP id 58E453800; Wed, 19 Dec 2018 08:16:33 -0800 (PST) From: Eugeniy Paltsev To: linux-snps-arc@lists.infradead.org, Vineet Gupta Subject: [PATCH] ARC: adjust memblock_reserve of kernel memory Date: Wed, 19 Dec 2018 19:16:16 +0300 Message-Id: <20181219161616.10422-1-Eugeniy.Paltsev@synopsys.com> X-Mailer: git-send-email 2.14.5 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181219_081648_739843_709686D1 X-CRM114-Status: GOOD ( 10.30 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [198.182.60.111 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexey Brodkin , Eugeniy Paltsev , linux-kernel@vger.kernel.org, stable@vger.kernel.org MIME-Version: 1.0 Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org In setup_arch_memory we reserve the memory area wherein the kernel is located. Current implementation may reserve more memory than it actually required in case of CONFIG_LINUX_LINK_BASE is not equal to CONFIG_LINUX_RAM_BASE. This happens because we calculate start of the reserved region relatively to the CONFIG_LINUX_RAM_BASE and end of the region relatively to the CONFIG_LINUX_RAM_BASE. For example in case of HSDK board we wasted 256MiB of physical memory: ------------------->8------------------------------ Memory: 770416K/1048576K available (5496K kernel code, 240K rwdata, 1064K rodata, 2200K init, 275K bss, 278160K reserved, 0K cma-reserved) ------------------->8------------------------------ Fix that. Cc: stable@vger.kernel.org Signed-off-by: Eugeniy Paltsev --- arch/arc/mm/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c index f8fe5668b30f..a56e6a8ed259 100644 --- a/arch/arc/mm/init.c +++ b/arch/arc/mm/init.c @@ -137,7 +137,8 @@ void __init setup_arch_memory(void) */ memblock_add_node(low_mem_start, low_mem_sz, 0); - memblock_reserve(low_mem_start, __pa(_end) - low_mem_start); + memblock_reserve(CONFIG_LINUX_LINK_BASE, + __pa(_end) - CONFIG_LINUX_LINK_BASE); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start)