Received: by 10.223.176.5 with SMTP id f5csp262419wra; Thu, 1 Feb 2018 19:56:18 -0800 (PST) X-Google-Smtp-Source: AH8x225qo9tLYwQMcgm7DOenZaMfycPFFWNeQVcc4O3m5ct+3yqF4eXtTbflsNfPCTxMSfeoIKDn X-Received: by 10.99.0.17 with SMTP id 17mr21033836pga.94.1517543778611; Thu, 01 Feb 2018 19:56:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517543778; cv=none; d=google.com; s=arc-20160816; b=RXXxsHLc0unOWV7IbhAO8yGxvNDRj8AaCrXq3o8bXPBBrcfFUtaRCkgWUmyIglj4f2 bX4zCWO8BToTjM4ruJWfxYtmvn132jp3PjsxZRwzShKVgkqbnPH+tyOxqbgcJUutc4tP RTpMYxSsHhgFTxO+rpzZ4MkV5cUOMxWRioZUZ4o4Xcv7XulvZ40E5mWNmouopod3dE41 taIKSJjC0OstkxbfF8/iMp78JzXsJIh/uRS9qhyLGSw053UoSG9EAX5gK42E8Kby7GSR Jdr9XpEyOIFQOupTD0/IKJm/1dds0GRamnnXnktd2tbphChV/BFYW6gpOtLMPOuCp2JH 7FGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=RlG27HYMwmIrMhIPeGAWGzcitm8COM+vcpBP6m7eSz4=; b=HPfdCkxhOnbgfTOklp1cR862rBNmoIQv+LspIPJo9dL/bCvuf42PBHscxUUBzVEM5X +SmOdKzv/sJJkDE6zTzlSIoorJh3kEpMCjgswD+vzRhN4HfIyOm/WgjEGq1HNuBquagq K5YdcsshRQ/Hx2jylDJLiJxYTvWrFao47Vfbv+65Sm/2O6HB1PpeZGjLOuzits1xifEX qmovTrzEsfo107EiPfNpB/tO631W/X77XIEA0aiDgUpzdfW6FPUyqb+ybKA8bYV7XbZ8 oW4tADSripUh15i7azeTvEM6v24TkPCaGMJFSb8kgTyB7Lg1lfvRwNE/VNPOL9N0KaUe dVjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jFsbnoXI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12si791315pgn.121.2018.02.01.19.56.03; Thu, 01 Feb 2018 19:56:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=jFsbnoXI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751846AbeBBDzT (ORCPT + 99 others); Thu, 1 Feb 2018 22:55:19 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:36949 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751557AbeBBDzG (ORCPT ); Thu, 1 Feb 2018 22:55:06 -0500 Received: by mail-lf0-f68.google.com with SMTP id 63so29432295lfv.4 for ; Thu, 01 Feb 2018 19:55:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RlG27HYMwmIrMhIPeGAWGzcitm8COM+vcpBP6m7eSz4=; b=jFsbnoXIkKqt8CSps4s8KWpGIlS+m2nqWBB7QjH17tvPKU+WdWFvfczqbf/quE03Uw HcfCzp7e77vub5N0AJK7YiizUkiWHL57rS4VxSytS5MwqrCq43hI/MwUw0SZxZ85Veie xEGaW7MmYWTOndvLeC25fd2gcyc5ESwm545twCAkPvCXvwRzknAiMScNZVy0O7gucgP7 Nvog/12NRKEm39+ozzaQ8CYFn/Zp7MwLEEPHSh1tSDNqObJXlgCZRLpROPrZVnmFIXKa kI+xLarJ3SY7jLICdT0c8dFp9udV335qQC00ZGYNzjKwInSx60MX6PtRZgxYzSJ0OHEV GoSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RlG27HYMwmIrMhIPeGAWGzcitm8COM+vcpBP6m7eSz4=; b=PQ9WQMoUAlD/lStagsqZkl0nVzRe3J0zuYpEBRvAbDUeO+x1Ua/XN5jfKgEyhH4OK/ pItlktmdfADTA9anYWICWn6H7R8XYiFvbMZ6fVnTEdJix9k2pyUM89kh/3Ii/hWcdJiK vcOynkxnIhg9k4tN3vslCkdG+bmjtEInIsjLXdPCMvKVaZFopdsXbRbFrN/e3deekYJu mzmgo9i3mtqeITnjNBJCNQslDWMyoEBg7cr79kfJesxsfDEB44jYkuaVJX7upespMNf0 zgiSOBocokZ7OUNmyaU4w29RHzrhN2i6wmVj81Bqq4yw+vEwnSasZx1qz+HUDDSILkkp xmeg== X-Gm-Message-State: AKwxytckU+TPCDFOLP3gt91NKN7ba92264iGOQSw5fCs7Jvm8EZI0SC6 nSFKO8mgHkZ1z2+fJaCc5Rs= X-Received: by 10.25.92.13 with SMTP id q13mr22217334lfb.69.1517543704511; Thu, 01 Feb 2018 19:55:04 -0800 (PST) Received: from linux.local ([95.79.164.146]) by smtp.gmail.com with ESMTPSA id f14sm190934lje.84.2018.02.01.19.55.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Feb 2018 19:55:03 -0800 (PST) From: Serge Semin To: ralf@linux-mips.org, miodrag.dinic@mips.com, jhogan@kernel.org, goran.ferenc@mips.com, david.daney@cavium.com, paul.gortmaker@windriver.com, paul.burton@mips.com, alex.belits@cavium.com, Steven.Hill@cavium.com Cc: alexander.sverdlin@nokia.com, matt.redfearn@mips.com, kumba@gentoo.org, marcin.nowakowski@mips.com, James.hogan@mips.com, Peter.Wotton@mips.com, Sergey.Semin@t-platforms.ru, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, Serge Semin Subject: [PATCH v2 01/15] MIPS: memblock: Add RESERVED_NOMAP memory flag Date: Fri, 2 Feb 2018 06:54:44 +0300 Message-Id: <20180202035458.30456-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20180202035458.30456-1-fancer.lancer@gmail.com> References: <20180117222312.14763-1-fancer.lancer@gmail.com> <20180202035458.30456-1-fancer.lancer@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Even if nomap flag is specified the reserved memory declared in dts isn't really discarded from the buddy allocator in the current code. We'll fix it by adding the no-map MIPS memory flag. Additionally lets add the RESERVED_NOMAP memory regions handling to the methods, which aren't going to be changed in the further patches. Signed-off-by: Serge Semin --- arch/mips/include/asm/bootinfo.h | 1 + arch/mips/kernel/prom.c | 8 ++++++-- arch/mips/kernel/setup.c | 8 ++++++++ 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h index e26a093bb17a..276618b5319d 100644 --- a/arch/mips/include/asm/bootinfo.h +++ b/arch/mips/include/asm/bootinfo.h @@ -90,6 +90,7 @@ extern unsigned long mips_machtype; #define BOOT_MEM_ROM_DATA 2 #define BOOT_MEM_RESERVED 3 #define BOOT_MEM_INIT_RAM 4 +#define BOOT_MEM_RESERVED_NOMAP 5 /* * A memory map that's built upon what was determined diff --git a/arch/mips/kernel/prom.c b/arch/mips/kernel/prom.c index 0dbcd152a1a9..b123eb8279cd 100644 --- a/arch/mips/kernel/prom.c +++ b/arch/mips/kernel/prom.c @@ -41,7 +41,7 @@ char *mips_get_machine_name(void) #ifdef CONFIG_USE_OF void __init early_init_dt_add_memory_arch(u64 base, u64 size) { - return add_memory_region(base, size, BOOT_MEM_RAM); + add_memory_region(base, size, BOOT_MEM_RAM); } void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) @@ -52,7 +52,11 @@ void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) int __init early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, bool nomap) { - add_memory_region(base, size, BOOT_MEM_RESERVED); + if (!nomap) + add_memory_region(base, size, BOOT_MEM_RESERVED); + else + add_memory_region(base, size, BOOT_MEM_RESERVED_NOMAP); + return 0; } diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c index 702c678de116..1a4d64410303 100644 --- a/arch/mips/kernel/setup.c +++ b/arch/mips/kernel/setup.c @@ -172,6 +172,7 @@ bool __init memory_region_available(phys_addr_t start, phys_addr_t size) in_ram = true; break; case BOOT_MEM_RESERVED: + case BOOT_MEM_RESERVED_NOMAP: if ((start >= start_ && start < end_) || (start < start_ && start + size >= start_)) free = false; @@ -207,6 +208,9 @@ static void __init print_memory_map(void) case BOOT_MEM_RESERVED: printk(KERN_CONT "(reserved)\n"); break; + case BOOT_MEM_RESERVED_NOMAP: + printk(KERN_CONT "(reserved nomap)\n"); + break; default: printk(KERN_CONT "type %lu\n", boot_mem_map.map[i].type); break; @@ -955,9 +959,13 @@ static void __init resource_init(void) res->name = "System RAM"; res->flags |= IORESOURCE_SYSRAM; break; + case BOOT_MEM_RESERVED_NOMAP: + res->name = "reserved nomap"; + break; case BOOT_MEM_RESERVED: default: res->name = "reserved"; + break; } request_resource(&iomem_resource, res); -- 2.12.0