From patchwork Fri Aug 3 19:58:47 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555473 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0101C13B4 for ; Fri, 3 Aug 2018 19:59:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E63A12C165 for ; Fri, 3 Aug 2018 19:59:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA78A2C245; Fri, 3 Aug 2018 19:59:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA63E2C165 for ; Fri, 3 Aug 2018 19:59:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CBC76B000E; Fri, 3 Aug 2018 15:59:18 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 0BC406B0010; Fri, 3 Aug 2018 15:59:17 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D35426B0266; Fri, 3 Aug 2018 15:59:17 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 6D06D6B000E for ; Fri, 3 Aug 2018 15:59:17 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id v26-v6so2125368eds.9 for ; Fri, 03 Aug 2018 12:59:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:in-reply-to:references:message-id; bh=Cqm36fpOAU70frvWhQ9HoHzoDyPlisdeTImeBo/S3QE=; b=ESzxNmkv/N7+P5wbjM2WJPwEYYZ1vAPMqN8FMDlY+Zw6GNglAgfVwg6egTDXE9dSsr u0Txh6xfVXjn+JmDJFEJjpYQ54RobJ5KbZ6hbKg2mneLquuotp34FG6WhSzs8Az2XTMG 26VPeQnobandyTJrlgTWpWXnxcF9rMfs6wg5eZD9BDH4MjIAVBO9TAdpVsyh0fgW7b/z BFMKVOTwwqSxBKcgSBNlxDcSYycjl0d0C9js6/lJAsP4xmd6fE1ioPg7rwuovSXP8pdo y4jaD9D1Dsj1UBH/OzxyqzrTSZe2rKqBo+eEqQzUf10w/qn10OwGW6WkVb0LaXUfuUtQ FcSg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com X-Gm-Message-State: AOUpUlGk2EB76sny99fWq3mTu0e0/XaFeG5ewgOKvm59m0A2ZAiAVUKP KHhflru8XNDIIqrv4jspYsPtK7FIFFzv/XroxCFppDCdKa1SEQyiKbodeJu3hAc7XroiJ76uM5N BLDcVvyvzH/oJw3zQNj+JcUa+HzMZFspxjm/IYcATScsBrZEqTxRoX+tAT9Tw31s= X-Received: by 2002:a50:b399:: with SMTP id s25-v6mr8902370edd.217.1533326356892; Fri, 03 Aug 2018 12:59:16 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfNgvX9pS/9k7zpfB8QaJXUJieDigVyfTceWfFKdT17Zv1Yo/0F9QYsR4xt50mixU4uD9xV X-Received: by 2002:a50:b399:: with SMTP id s25-v6mr8902328edd.217.1533326355647; Fri, 03 Aug 2018 12:59:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326355; cv=none; d=google.com; s=arc-20160816; b=MfzxzBfG6wALFKp36njG6hwGcOhHnV/e069A+H5GYlBzKHbVplFzLz7wu+VanQxfHG Q6zKZ7qzsCAGcNibH+WzYnV9x0DB8rn0/lAW2E4KISC/9Y0qpnqFq7zJll/fQseu33BU 1Wln/XfGmiB6NC0F1OJRiFVX42/WaZqlOJSAy+4zUsIu2lXFnktzYpU3EvmCU8bAiX59 QfVXJrWoUP2WgHCEWXLmSu0uN6CzJRpAcBQt8NF+zs8/BGWIVCdV4KcnN/fK5P/jnHDq b+g/OBHAtqcU9p1rrgrKKw7GPhudwYjA3eU44xYIr1aIoN4Jf/E/5T1MxfKBRwqjuEc7 5Mhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:references:in-reply-to:date:subject:cc:to:from :arc-authentication-results; bh=Cqm36fpOAU70frvWhQ9HoHzoDyPlisdeTImeBo/S3QE=; b=mf2bvDQXLzq0WyLLLNqK5ahX9C05d3fOqd9Y1fdl8izhXletCfEy+0hRSujNkoBFVy DRFNs4Te/EZE+mOkUA4tLDFa8xk33ytVP3EJa4eNQ0eXDQQ634ufb4lKncv9ClxFS2Xw eHIG7AB/gMAmSU2xbY9by9IKBifuyL6PTpx/ZX5e2vhJh4gi8enHkR7eoNWExKjZKZv2 /URDUjX4lKdVQVPL+5I68q3JpDAXzyGj5+2G89GPwOLvd2sbA6r4GAeezN+S4yZPdwkU BDhGqY7pgQt5GOjRfL2m/1/CyDyOe6q8P/e4URKeSeyi4e3X56b5C63dfWtuVIb6bsjx YM8w== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id d5-v6si3705768edr.368.2018.08.03.12.59.15 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:15 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.156.1; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.156.1 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) smtp.mailfrom=rppt@linux.vnet.ibm.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx5Dw026899 for ; Fri, 3 Aug 2018 15:59:13 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmudxct6p-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:13 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 20:59:11 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 3 Aug 2018 20:59:08 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73Jx70C35586056 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:07 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E861AE051; Fri, 3 Aug 2018 22:59:05 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E923AE045; Fri, 3 Aug 2018 22:59:03 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:02 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:59:04 +0300 From: Mike Rapoport To: Andrew Morton Cc: Richard Kuo , Ley Foon Tan , Richard Weinberger , Guan Xuetao , Michal Hocko , linux-hexagon@vger.kernel.org, nios2-dev@lists.rocketboards.org, linux-um@lists.infradead.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH 4/7] nios2: switch to NO_BOOTMEM Date: Fri, 3 Aug 2018 22:58:47 +0300 X-Mailer: git-send-email 2.7.4 In-Reply-To: <1533326330-31677-1-git-send-email-rppt@linux.vnet.ibm.com> References: <1533326330-31677-1-git-send-email-rppt@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18080319-0008-0000-0000-0000025C97DA X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-0009-0000-0000-000021C33DCC Message-Id: <1533326330-31677-5-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-08-03_08:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=963 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808030216 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP Remove bootmem bitmap initialization and replace reserve_bootmem() with memblock_reserve(). Signed-off-by: Mike Rapoport Acked-by: Ley Foon Tan --- arch/nios2/Kconfig | 2 ++ arch/nios2/kernel/prom.c | 7 ------- arch/nios2/kernel/setup.c | 37 +++++-------------------------------- 3 files changed, 7 insertions(+), 39 deletions(-) diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 5db8fa1..661f7f9 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -20,6 +20,8 @@ config NIOS2 select USB_ARCH_HAS_HCD if USB_SUPPORT select CPU_NO_EFFICIENT_FFS select HAVE_MEMBLOCK + select ARCH_DISCARD_MEMBLOCK + select NO_BOOTMEM config GENERIC_CSUM def_bool y diff --git a/arch/nios2/kernel/prom.c b/arch/nios2/kernel/prom.c index ba96a49..a6d4f75 100644 --- a/arch/nios2/kernel/prom.c +++ b/arch/nios2/kernel/prom.c @@ -32,13 +32,6 @@ #include -int __init early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, - bool nomap) -{ - reserve_bootmem(base, size, BOOTMEM_DEFAULT); - return 0; -} - void __init early_init_devtree(void *params) { __be32 *dtb = (u32 *)__dtb_start; diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c index 0946840..2d0011d 100644 --- a/arch/nios2/kernel/setup.c +++ b/arch/nios2/kernel/setup.c @@ -144,10 +144,11 @@ asmlinkage void __init nios2_boot_init(unsigned r4, unsigned r5, unsigned r6, void __init setup_arch(char **cmdline_p) { - int bootmap_size; + int dram_start; console_verbose(); + dram_start = memblock_start_of_DRAM(); memory_size = memblock_phys_mem_size(); memory_start = PAGE_ALIGN((unsigned long)__pa(_end)); memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size; @@ -165,39 +166,11 @@ void __init setup_arch(char **cmdline_p) max_low_pfn = PFN_DOWN(memory_end); max_mapnr = max_low_pfn; - /* - * give all the memory to the bootmap allocator, tell it to put the - * boot mem_map at the start of memory - */ - pr_debug("init_bootmem_node(?,%#lx, %#x, %#lx)\n", - min_low_pfn, PFN_DOWN(PHYS_OFFSET), max_low_pfn); - bootmap_size = init_bootmem_node(NODE_DATA(0), - min_low_pfn, PFN_DOWN(PHYS_OFFSET), - max_low_pfn); - - /* - * free the usable memory, we have to make sure we do not free - * the bootmem bitmap so we then reserve it after freeing it :-) - */ - pr_debug("free_bootmem(%#lx, %#lx)\n", - memory_start, memory_end - memory_start); - free_bootmem(memory_start, memory_end - memory_start); - - /* - * Reserve the bootmem bitmap itself as well. We do this in two - * steps (first step was init_bootmem()) because this catches - * the (very unlikely) case of us accidentally initializing the - * bootmem allocator with an invalid RAM area. - * - * Arguments are start, size - */ - pr_debug("reserve_bootmem(%#lx, %#x)\n", memory_start, bootmap_size); - reserve_bootmem(memory_start, bootmap_size, BOOTMEM_DEFAULT); - + memblock_reserve(dram_start, memory_start - dram_start); #ifdef CONFIG_BLK_DEV_INITRD if (initrd_start) { - reserve_bootmem(virt_to_phys((void *)initrd_start), - initrd_end - initrd_start, BOOTMEM_DEFAULT); + memblock_reserve(virt_to_phys((void *)initrd_start), + initrd_end - initrd_start); } #endif /* CONFIG_BLK_DEV_INITRD */