From patchwork Fri Aug 3 19:58:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555469 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 D3C7013AC for ; Fri, 3 Aug 2018 19:59:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C39532C165 for ; Fri, 3 Aug 2018 19:59:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B7A7F2C245; Fri, 3 Aug 2018 19:59:16 +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 417522C165 for ; Fri, 3 Aug 2018 19:59:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B41896B000A; Fri, 3 Aug 2018 15:59:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A77296B000C; Fri, 3 Aug 2018 15:59:13 -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 918016B000D; Fri, 3 Aug 2018 15:59:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 3419B6B0008 for ; Fri, 3 Aug 2018 15:59:13 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id r21-v6so2015294edp.23 for ; Fri, 03 Aug 2018 12:59:13 -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=rws5vOWYjYJp5Mm/qMcNBSQuV72hTJad8STKZFRW5SI=; b=ehxyYigVXoEd8HJ0syoH60yc6QBjhwiio9cDy0zl858AHgRkTTubN7plruT6+jLWCX h3d+sYhi7ObsTRFIN+Po0V7I/MOwkU47QjUNnAzwiry4PNLVracvpSWPfODURph/jEDT u9ML01CD+QgmcVb3Y9teAL+jTOCAPxn4qKBLezGnfacpTX+2SbVvKIlgziUnd5sDaVZH QcKrJribPZ5z44MWDuUnbptRkpMu8EasYECMOSRHyZeRZe/LVIASV2MzvW3Vmn4VW+9M fXaWzlBZqqr6FCRiR2DIFxvqehVgFXPiyNUFIqjWPrzVBCwHcaPPihp11X48J4EMqWQ1 gLzg== 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: AOUpUlFUnR9Ounnrqgq7fYcbpt5c5bZc9ES+fboVY6e4EmoN8fueSTXf uepfBYjPmJxqeeGyR8IcdDejaqFyY5NOra8LTB81msDv5L64jVkw4AMwOwwFCCSPIdT4nW9RP5q VTNjUEHrmaXMxbCCJXtGypbPbGr7nl9OppaYG2k88rtOIxMT9i4jutjHOfsje1p0= X-Received: by 2002:aa7:d142:: with SMTP id r2-v6mr8614225edo.286.1533326352671; Fri, 03 Aug 2018 12:59:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdPHPQxyiznqb3vLngGy1XaaAiZBYs+i4iNL38LXzG+d6ijmoValQALIqwXuSvxxqfz85D6 X-Received: by 2002:aa7:d142:: with SMTP id r2-v6mr8614200edo.286.1533326351617; Fri, 03 Aug 2018 12:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326351; cv=none; d=google.com; s=arc-20160816; b=l/P1DCGATxAqqmnA3EOrnzOPWDUn6lVpX4TZ7OkvZY4Djt43A9avgec8aYRiNcxA6G 57bxTZsj3QwQy+2s8nMbwxxqKnVI6cMtQL76i+LiFZyG2ngev+0LpiXWerYEPOHqdAQH tI6dSc8cpvfBoJkbOZKmLrj6O+8cE0Kx4Zyoka6jaLD+m4P+DG6hHvNAUIBnaw/Y/ir1 q+jR/w+fsHXN8JqKJlXJ2GuY4CLfWxCt1J3aEX0S6IdMZ8HWnUrJ55Kz8cCl2BcjGtIu 1TDkDJStMVmYGBjFE6L37Bd3r+5EwUW3rYW9WdE28iRaZdKfjI1CVeBIfoCrMD3oHmHJ /Qdw== 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=rws5vOWYjYJp5Mm/qMcNBSQuV72hTJad8STKZFRW5SI=; b=FXs02UqUKImk5Qs6sBQ9uP9/xvxmk0dMTGfuPbKd6pzFJvkyUgY0UciAh3udxB+246 IrYRI/RpFG7oZqPzG+pmuzmxlU3HWs2oUQ0tyo9Z7XnnnrIjHWjGv0poRBRNtqaKXA44 HCZOL0PCztVLX5giHUL0a/dzuP9lcW6cyeDrCLVm72lrIsER0uWXkbI3GjhXtbMlcsb1 j5IYOZzaD5AwFm7ibtjtw7bALUNKLKZk2Qk/AToz8Z6ekdHojc771EaH2hkRuDaZWJxO +AhIqyMnueg3T01QSwQ8/ObdOwGKz5Nf6hD8R92UPLdCjWdFItx1fHhF7pxu/4hepi/Q hX8A== 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 y17-v6si430606eds.303.2018.08.03.12.59.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:11 -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 w73Jx4PU026835 for ; Fri, 3 Aug 2018 15:59:09 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmudxct18-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:06 -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:03 +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:58:58 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73Jwwkx40632382 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:58:58 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 79220A4051; Fri, 3 Aug 2018 22:59:07 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id EE650A404D; Fri, 3 Aug 2018 22:59:04 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:04 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:58:54 +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 1/7] hexagon: switch to NO_BOOTMEM Date: Fri, 3 Aug 2018 22:58:44 +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-0000025C97D4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-0009-0000-0000-000021C33DC5 Message-Id: <1533326330-31677-2-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=874 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 This patch adds registration of the system memory with memblock, eliminates bootmem initialization and converts early memory reservations from bootmem to memblock. Signed-off-by: Mike Rapoport Acked-by: Richard Kuo --- arch/hexagon/Kconfig | 3 +++ arch/hexagon/mm/init.c | 20 ++++++++------------ 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig index 37adb20..66fb2d5 100644 --- a/arch/hexagon/Kconfig +++ b/arch/hexagon/Kconfig @@ -28,6 +28,9 @@ config HEXAGON select GENERIC_CLOCKEVENTS_BROADCAST select MODULES_USE_ELF_RELA select GENERIC_CPU_DEVICES + select HAVE_MEMBLOCK + select ARCH_DISCARD_MEMBLOCK + select NO_BOOTMEM ---help--- Qualcomm Hexagon is a processor architecture designed for high performance and low power across a wide variety of applications. diff --git a/arch/hexagon/mm/init.c b/arch/hexagon/mm/init.c index 1495d45..d789b9c 100644 --- a/arch/hexagon/mm/init.c +++ b/arch/hexagon/mm/init.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -176,7 +177,6 @@ size_t hexagon_coherent_pool_size = (size_t) (DMA_RESERVE << 22); void __init setup_arch_memory(void) { - int bootmap_size; /* XXX Todo: this probably should be cleaned up */ u32 *segtable = (u32 *) &swapper_pg_dir[0]; u32 *segtable_end; @@ -195,18 +195,22 @@ void __init setup_arch_memory(void) bootmem_lastpg = PFN_DOWN((bootmem_lastpg << PAGE_SHIFT) & ~((BIG_KERNEL_PAGE_SIZE) - 1)); + memblock_add(PHYS_OFFSET, + (bootmem_lastpg - ARCH_PFN_OFFSET) << PAGE_SHIFT); + + /* Reserve kernel text/data/bss */ + memblock_reserve(PHYS_OFFSET, + (bootmem_startpg - ARCH_PFN_OFFSET) << PAGE_SHIFT); /* * Reserve the top DMA_RESERVE bytes of RAM for DMA (uncached) * memory allocation */ - max_low_pfn = bootmem_lastpg - PFN_DOWN(DMA_RESERVED_BYTES); min_low_pfn = ARCH_PFN_OFFSET; - bootmap_size = init_bootmem_node(NODE_DATA(0), bootmem_startpg, min_low_pfn, max_low_pfn); + memblock_reserve(PFN_PHYS(max_low_pfn), DMA_RESERVED_BYTES); printk(KERN_INFO "bootmem_startpg: 0x%08lx\n", bootmem_startpg); printk(KERN_INFO "bootmem_lastpg: 0x%08lx\n", bootmem_lastpg); - printk(KERN_INFO "bootmap_size: %d\n", bootmap_size); printk(KERN_INFO "min_low_pfn: 0x%08lx\n", min_low_pfn); printk(KERN_INFO "max_low_pfn: 0x%08lx\n", max_low_pfn); @@ -257,14 +261,6 @@ void __init setup_arch_memory(void) #endif /* - * Free all the memory that wasn't taken up by the bootmap, the DMA - * reserve, or kernel itself. - */ - free_bootmem(PFN_PHYS(bootmem_startpg) + bootmap_size, - PFN_PHYS(bootmem_lastpg - bootmem_startpg) - bootmap_size - - DMA_RESERVED_BYTES); - - /* * The bootmem allocator seemingly just lives to feed memory * to the paging system */ From patchwork Fri Aug 3 19:58:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555471 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 570A713B4 for ; Fri, 3 Aug 2018 19:59:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 46FC12C165 for ; Fri, 3 Aug 2018 19:59:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A7AE2C245; Fri, 3 Aug 2018 19:59:20 +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 1A70C2C165 for ; Fri, 3 Aug 2018 19:59:19 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EBFEF6B0008; Fri, 3 Aug 2018 15:59:13 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E709E6B000E; Fri, 3 Aug 2018 15:59:13 -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 B3C156B0008; Fri, 3 Aug 2018 15:59:13 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 486EB6B000A for ; Fri, 3 Aug 2018 15:59:13 -0400 (EDT) Received: by mail-ed1-f72.google.com with SMTP id d5-v6so2132609edq.3 for ; Fri, 03 Aug 2018 12:59:13 -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=1Lwv9g8aD6fP5UVKIGt8ZBz/0ontqJZ5QSPhDfAGISc=; b=Tbu0YFUKv23WtmsE0KOlFor3QqQQn+URD0NVQBhXOTnfNO7GBu4xqRLhehYSibvvvG DRduNY6wUJFzzkvnjo8ndveA++UUnk5UnzPWOXVTaXY0klzUqV9vW9AqzL4RkxXLJ83u CdmJ+JKT2z9h6/SOXWmShd68CxoNB+vCYZkEq5zzDPYgZKKODcD2TE7E9rNghRaouFfo DyVF2viUmqVfvHhNEnJYaK2/3XPJkr85g9nnZ/VmjkbcHr1PiBhC5Tc44Ynx90MU1oCk /pNMjsshrS/TGrCM9Ok2PpSyUZFr8cq18jst7WZHk1A9upVlXBLYPkEJBY33jacbEcnb zQ/Q== 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: AOUpUlE+xPDo2qVqdptkQNk64LuE40ont87ZLJMbYqmtsA8Y1+nZCYE1 S8E+ayCU/QYzoRJo+kx2b95nwWKjiI/vXzJcI8msEGZqsj++jGoY6VdgIl9h08vy3Fh9aZWVa4F 16K9EkHHYJ2+SzQ+uBoCtjoMFA02c5hi/SzAWdVnEPJZwDRo+ItCqJOtUUBAg1nY= X-Received: by 2002:a50:fa82:: with SMTP id w2-v6mr8766842edr.256.1533326352689; Fri, 03 Aug 2018 12:59:12 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfLmKHQVt8UtCuLve7KEbo4T2HD+UBZabUbR38VxyMKAe04YaUPF9YDmTRRn5kAa/gVngBE X-Received: by 2002:a50:fa82:: with SMTP id w2-v6mr8766808edr.256.1533326351797; Fri, 03 Aug 2018 12:59:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326351; cv=none; d=google.com; s=arc-20160816; b=aWVVR4Cim4jh7pFuVPULIUxOeZ95Y1qdts4fh9tWzCT4Gwa3pajcScFVxalIf8pQ22 Wu6hbYAY/eK7D72vI9UCCVljFYsHTziake8z+iMv4nwbYDqUqcNrMNNQtYXyiE7d6poO Bavz5wTuyDTHn1RwxyYDnsrODuTEHh/+mFGgl3fYhXHyDG/MmLbAy6/ovHorkp+nVttY ePcTTgLgicgDSSiG2Pk4eciq3P/1AFnlc6N0OFc3OW2RnnCEIbkH5bAsNWG3ZzhnJi7Y rbgY+dkPvOpuQF6q8m9YfFNjko3CzsCFpz0k9ALOa7VdgJM/nTIvqSFj5fi84jJ58LU7 XOUA== 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=1Lwv9g8aD6fP5UVKIGt8ZBz/0ontqJZ5QSPhDfAGISc=; b=PRqU9lfrR9nNMLfTHFGbM3OY+vvkbM4I18MBNYqgfvwnFcP0dnSkHL1LpYNiIRdYiY So7/qKFxDDLdX9ddMUEE5EwNNjANlyV8ww09pDtM3EpAs1X9xdG1oZmOVb4U08PLaBsg rJC9SonzLu7P6Hud5bA0tbzr47G+OO8Sgcg17P22mjHGWYz+asvtMlC7+wrxDJ1Vab8X +ubkD1pJs7nIjkF0xYK7JN/uU9k54qkPC4eJ3Z0WoW0vrbiSOCsjCAGKs30GJ7+qCf2d 5bN3KQDAAnv1s6qbaQCc7JXGLT5R0zLsAbuImCEaQByEqzH7TZ0KYeNm5oFNRmKys1Vp a2EA== 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 b40-v6si5262418edf.140.2018.08.03.12.59.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:11 -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 (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx6BE076469 for ; Fri, 3 Aug 2018 15:59:09 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmu30necd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:09 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 20:59:06 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) 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:01 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73Jx1GB41484482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:01 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9BB8B42042; Fri, 3 Aug 2018 22:59:11 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D0E24203F; Fri, 3 Aug 2018 22:59:09 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:09 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:58:58 +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 2/7] of: ignore sub-page memory regions Date: Fri, 3 Aug 2018 22:58:45 +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-0028-0000-0000-000002E51BB9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-0029-0000-0000-0000239D33E2 Message-Id: <1533326330-31677-3-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=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 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 Memory region size is rounded down to page boundary and with sub-page region it becomes 0 and there is no point to add an empty region. Moreover, when the base is less than PAGE_SIZE we get a bogus size as (base + size - 1) evaluates to -1. The commit 8cccffc52694 ("of: check for size < 0 after rounding in early_init_dt_add_memory_arch") introduced a test for wrap around for the case when base is not page aligned, the same test can be used to ignore sub-page region sizes. Signed-off-by: Mike Rapoport Reviewed-by: Rob Herring --- drivers/of/fdt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 6da20b9..e866745 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c @@ -1134,12 +1134,13 @@ void __init __weak early_init_dt_add_memory_arch(u64 base, u64 size) { const u64 phys_offset = MIN_MEMBLOCK_ADDR; + if (size < PAGE_SIZE - (base & ~PAGE_MASK)) { + pr_warn("Ignoring memory block 0x%llx - 0x%llx\n", + base, base + size); + return; + } + if (!PAGE_ALIGNED(base)) { - if (size < PAGE_SIZE - (base & ~PAGE_MASK)) { - pr_warn("Ignoring memory block 0x%llx - 0x%llx\n", - base, base + size); - return; - } size -= PAGE_SIZE - (base & ~PAGE_MASK); base = PAGE_ALIGN(base); } From patchwork Fri Aug 3 19:58:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555467 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 1A21B13AC for ; Fri, 3 Aug 2018 19:59:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 084C42C165 for ; Fri, 3 Aug 2018 19:59:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF4CD2C245; Fri, 3 Aug 2018 19:59:13 +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 7A65B2C1DE for ; Fri, 3 Aug 2018 19:59:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7916A6B0007; Fri, 3 Aug 2018 15:59:12 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 741D86B0008; Fri, 3 Aug 2018 15:59:12 -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 6094F6B000A; Fri, 3 Aug 2018 15:59:12 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by kanga.kvack.org (Postfix) with ESMTP id 368D96B0007 for ; Fri, 3 Aug 2018 15:59:12 -0400 (EDT) Received: by mail-oi0-f69.google.com with SMTP id j189-v6so5559395oih.11 for ; Fri, 03 Aug 2018 12:59:12 -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=oKGwGTmaFvvkhJrj3GYMPQQvSbRfN00IUEp+oz3MTpo=; b=XYRD4eXQqpvDhM0ZMvRVZ5a98E7pqQ2g+eJWnb1LlrW3IlRqriIXkDCXf3p/QqQ9OI K0bHOplhxe6CJXWaj4dJeBtZrs1UMPEFwM/EAaklWIgSdSf/IJNhVY6AqJ8ZvIN2bgA4 NU0KZgCKRHTiTZ1Zz/jG0j8QwlHF6GK1TlhuUPC/8tDlK4xqTUB5YYmowjmqpli2zCvp RfNYpSPpo6z9TM68fUB2WEIbssTzGvCNZ8iZu0RHZtQ0JnFuEy+fHOMrYbWb59nbWJrX weuU4CKN56Qxki+din5mDWvqX6iEyTWC6j/9EeMt170V/ZH0uuYCa6ZWW/JmTgMCntD9 lojA== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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: AOUpUlF0d2kime872T6FnacC9NxAC4uKszwkFB0LCaGYJ6wpTTmOCGaO r+7kdHPO8F/8rShoXzqzAiEEwtaXWXLBaZmmLuVsDkFxyu1kHwCAr1V6AhvmRA262RVfsYWU8sK oAzGf7Z4gH7/PrhtWcinUz8SYikEFhIaE3Lkj/o1aEYlkuZwtRhfqoLT74UzAYks= X-Received: by 2002:aca:b9c2:: with SMTP id j185-v6mr4377566oif.212.1533326351962; Fri, 03 Aug 2018 12:59:11 -0700 (PDT) X-Google-Smtp-Source: AAOMgpflmbZkiJkW6pev2bAyGFl15MPLZppOpSHeA+n/J1EJod39Pd2cav60vrNa+cDkJGE+LYZd X-Received: by 2002:aca:b9c2:: with SMTP id j185-v6mr4377503oif.212.1533326350850; Fri, 03 Aug 2018 12:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326350; cv=none; d=google.com; s=arc-20160816; b=qh040AN3kMdB4U3QVhZl0ba3+CBLV2JO71ZQc5oIrYCUqdnv7NgMP2vMNphAei32JN zRg7NFHe3ClsVXoIDiUN7r1LB4V1TspmFZRMP+C0MXXYPcRlgBQsrg8OGfT+j8pzDMBa zDx5+3kOjDK8o1KEe4QxhykGKliHLibtPiN7RT9gwM7X9EL+aQNBx3ACcxCH4bfVjrUp PcKhFKWWTleHwi7ro3ioVSxkrFRyFFiYcejcUl7eYGQLEd2YF0krGnHXsosxX9Tg21yv ukq3aM2q+kQWsHdkUQ336B3T9DoGGbE58cbpma4jyOo7ebE80QN66HWFXmOyaPoL1yhy edLg== 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=oKGwGTmaFvvkhJrj3GYMPQQvSbRfN00IUEp+oz3MTpo=; b=j3zegMG37Fv+8V2ruxMBgLCpPE7knltr4CAGuWK81Ydhnr9uwBmXgAA2gCr5Krzz/A 9fg6Rw8MAoFvbYxCSGCuIKN/DtL9KtiHWK1foI9NFh3VKCFyZVtDbJPO04rZHFjU28rV 6eVL3WOjl0CCz4HGwr5bSThN7C+nlOGRAPLvH1j68tQmFOPq6gkq+/IZ4nbhJakoobBo E4kyV2tbksWAJ0n7TnoDScTfxdAzUlNxUwuYLYiM33aKKq5SilSYwEzLoBonjG4PgZVP e+mW/G3sSIq5BjjC8H7UHUbv6ejgiMYiqpnaPjdPdAES4i0rZ7HAX4OFOykit9V3nyUn eSWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id x16-v6si3579000oie.224.2018.08.03.12.59.10 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:10 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.158.5 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx5v9026213 for ; Fri, 3 Aug 2018 15:59:10 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmuj3mmfw-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:09 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 20:59:08 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp01.uk.ibm.com (192.168.101.131) 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:05 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73Jx4QH35389588 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:04 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7D0A111C058; Fri, 3 Aug 2018 22:59:13 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B24511C04A; Fri, 3 Aug 2018 22:59:11 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:11 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:59:01 +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 3/7] nios2: use generic early_init_dt_add_memory_arch Date: Fri, 3 Aug 2018 22:58:46 +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-4275-0000-0000-000002A367C7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-4276-0000-0000-000037AB8714 Message-Id: <1533326330-31677-4-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=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=886 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 All we have to do is to enable memblock, the generic FDT code will take care of the rest. Signed-off-by: Mike Rapoport Acked-by: Ley Foon Tan --- arch/nios2/Kconfig | 1 + arch/nios2/kernel/prom.c | 10 ---------- arch/nios2/kernel/setup.c | 2 ++ 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig index 3d4ec88..5db8fa1 100644 --- a/arch/nios2/Kconfig +++ b/arch/nios2/Kconfig @@ -19,6 +19,7 @@ config NIOS2 select SPARSE_IRQ select USB_ARCH_HAS_HCD if USB_SUPPORT select CPU_NO_EFFICIENT_FFS + select HAVE_MEMBLOCK config GENERIC_CSUM def_bool y diff --git a/arch/nios2/kernel/prom.c b/arch/nios2/kernel/prom.c index 8d7446a..ba96a49 100644 --- a/arch/nios2/kernel/prom.c +++ b/arch/nios2/kernel/prom.c @@ -32,16 +32,6 @@ #include -void __init early_init_dt_add_memory_arch(u64 base, u64 size) -{ - u64 kernel_start = (u64)virt_to_phys(_text); - - if (!memory_size && - (kernel_start >= base) && (kernel_start < (base + size))) - memory_size = size; - -} - int __init early_init_dt_reserve_memory_arch(phys_addr_t base, phys_addr_t size, bool nomap) { diff --git a/arch/nios2/kernel/setup.c b/arch/nios2/kernel/setup.c index 926a02b..0946840 100644 --- a/arch/nios2/kernel/setup.c +++ b/arch/nios2/kernel/setup.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -147,6 +148,7 @@ void __init setup_arch(char **cmdline_p) console_verbose(); + memory_size = memblock_phys_mem_size(); memory_start = PAGE_ALIGN((unsigned long)__pa(_end)); memory_end = (unsigned long) CONFIG_NIOS2_MEM_BASE + memory_size; 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 */ From patchwork Fri Aug 3 19:58:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555475 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 3E86A13AC for ; Fri, 3 Aug 2018 19:59:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F5932C165 for ; Fri, 3 Aug 2018 19:59:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 238D12C245; Fri, 3 Aug 2018 19:59:25 +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 67BE42C165 for ; Fri, 3 Aug 2018 19:59:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C74F56B0010; 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 BAE046B0266; Fri, 3 Aug 2018 15:59:18 -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 A9E5B6B0269; Fri, 3 Aug 2018 15:59:18 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f69.google.com (mail-oi0-f69.google.com [209.85.218.69]) by kanga.kvack.org (Postfix) with ESMTP id 6DE5B6B0010 for ; Fri, 3 Aug 2018 15:59:18 -0400 (EDT) Received: by mail-oi0-f69.google.com with SMTP id t138-v6so5657720oih.5 for ; Fri, 03 Aug 2018 12:59:18 -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=pErKKv6F4MkqIuM85zPVB5Q1Ron22fUWJmwJd2N7CKU=; b=kyr+FclGLRvVr4TUCja2q3tZQzFpPMdLcGdrXpgPXymZSg7eWRe56AjvC10XAFp8b6 Z0U9gKwx02mD1ZXh30XS2ADxn3Jv6CEBCy9CXFd1jfy9rgPuR+79ED6ac/MoEW5exky2 dNFwnKIneF00Btsar+M1rLns25tbH9GexZge6nCzqnWh9iJceYfRwkxdbG+Gcebp5WDL kRNsqg7N1eDChr3dxVk9SCUvWs1l/tenUr/OxGmRaQxrsUvl4xKe+qTFC9PrV/pYhBda njoyP0wfPddymYYZEH0qX6+awVUzYOCy9D29CZ9QsJNrX5NqFSoVvdCpvwTtQfVqlUPY dkGg== X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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: AOUpUlHiWrPfBQd9fQDMyXYamtk0kRT0mOrQ5DU4PNoED61xPVCRMsax 3f1anoOJ3rX50lTT0tWSZHuMjrHk78HEiU3BSQt5yA//+avnHSNrV+4xX1z9vzqjNyyX2hBS3xN ezNZ1IoHnySzBkOYmGZooquQ5mOKrXu7f3CjSUd4KdIVLoiRy77cGimCAOweDQdo= X-Received: by 2002:aca:3c45:: with SMTP id j66-v6mr4326397oia.118.1533326358223; Fri, 03 Aug 2018 12:59:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcsC9CN4AZ2Q8UuxHkdqIjrCPccrz4Gbed5tMGdEeBl3LrLfpKkf1gQvOYvkoOq7fJlJxga X-Received: by 2002:aca:3c45:: with SMTP id j66-v6mr4326353oia.118.1533326357558; Fri, 03 Aug 2018 12:59:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326357; cv=none; d=google.com; s=arc-20160816; b=Iqm4xSZqHF10JqckwHLNGnFxH969mGXWAWdynTWaOwzpCM84AfN7A3nRanHHoddHAn +QO2jrfWhM4pU2i5ELXH5U2gG12gG0ftWvmCa+VrbN5bEIkAMElkSqqmi03lnQB/WJ6T Xq9FmdnSQ5xKBhe9DjarMIu0qxODc3/OYzUR51OYHL72y8R6812LF6ff69AVrdMAsTDn pgFuWeA1DvTNco5TmfBAyFbk4orL8RqQ3ExNKo3F9Y//7x7Fnv8k1RBLWhUrNhSNzjT5 thVltrpUL0RVvJYURvkVpxGB6nW6HuJoH/MPTWyA9uSFgFXUDPjLj+iYlJH/D703uadg pmfw== 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=pErKKv6F4MkqIuM85zPVB5Q1Ron22fUWJmwJd2N7CKU=; b=uFSwnmdW5aaIBQQ4ao65VrmiZ/hSCZjD9MwRta37/a2ym/tK7EJUzO0420P/qtrbe8 G5/FMoQtZ5+NbB+grsgbc2eSYgbp/YH5hgkrVc6kq5Iqu8FrPhwguNiVM+gwYw3SJHdu eti6htKOCFjWfVbfxO7Q3FhNxs0RoH33QyoLPVWBNsrr1sRx2KVQ2jm0eixTFu8I9saj kybT+50Wp90P5S36CcfTiRiy9hv8BqmneHe0IC2mIcwp9Rfb1ifkXkJboIJz5qNIf4If 3Vvl4uQGyLtn1G5UJ79N3ZLWUsBjspYTTLOqXLgxTtY2t/CSVCD0D2zxIM+n4aRkpMJO 41eA== ARC-Authentication-Results: i=1; mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (mx0b-001b2d01.pphosted.com. [148.163.158.5]) by mx.google.com with ESMTPS id t12-v6si3909317oif.377.2018.08.03.12.59.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:17 -0700 (PDT) Received-SPF: neutral (google.com: 148.163.158.5 is neither permitted nor denied by best guess record for domain of rppt@linux.vnet.ibm.com) client-ip=148.163.158.5; Authentication-Results: mx.google.com; spf=neutral (google.com: 148.163.158.5 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 (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx3M5186622 for ; Fri, 3 Aug 2018 15:59:17 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 2kmt6sfpjc-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:16 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 20:59:14 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp03.uk.ibm.com (192.168.101.133) 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:11 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73JxAT542532966 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:10 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CB1C952051; Fri, 3 Aug 2018 22:59:19 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTPS id B26965204E; Fri, 3 Aug 2018 22:59:17 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:59:07 +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 5/7] um: setup_physmem: stop using global variables Date: Fri, 3 Aug 2018 22:58:48 +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-0012-0000-0000-00000293ABB5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-0013-0000-0000-000020C5BF45 Message-Id: <1533326330-31677-6-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=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=681 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 The setup_physmem() function receives uml_physmem and uml_reserved as parameters and still used these global variables. Replace such usage with local variables. Signed-off-by: Mike Rapoport Acked-by: Richard Weinberger --- arch/um/kernel/physmem.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index f02596e..0eaec0e 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -86,7 +86,7 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, long map_size; int err; - offset = uml_reserved - uml_physmem; + offset = reserve_end - start; map_size = len - offset; if(map_size <= 0) { os_warn("Too few physical memory! Needed=%lu, given=%lu\n", @@ -96,12 +96,12 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, physmem_fd = create_mem_file(len + highmem); - err = os_map_memory((void *) uml_reserved, physmem_fd, offset, + err = os_map_memory((void *) reserve_end, physmem_fd, offset, map_size, 1, 1, 1); if (err < 0) { os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p " "failed - errno = %d\n", map_size, - (void *) uml_reserved, err); + (void *) reserve_end, err); exit(1); } From patchwork Fri Aug 3 19:58:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555479 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 0E81813B4 for ; Fri, 3 Aug 2018 19:59:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F28232C12E for ; Fri, 3 Aug 2018 19:59:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4EDC2C1DE; Fri, 3 Aug 2018 19:59:41 +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 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 52FBE2C165 for ; Fri, 3 Aug 2018 19:59:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4A936B026B; Fri, 3 Aug 2018 15:59:24 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E214C6B026C; Fri, 3 Aug 2018 15:59:24 -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 CBFFD6B026E; Fri, 3 Aug 2018 15:59:24 -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 65D996B026B for ; Fri, 3 Aug 2018 15:59:24 -0400 (EDT) Received: by mail-ed1-f71.google.com with SMTP id i26-v6so2132815edr.4 for ; Fri, 03 Aug 2018 12:59:24 -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=IMPy9pOsazrrg8v4JRpYZ4Lz2nM+DpeFlUKz+Vm2FoU=; b=DMw5LnwTU5BvqQcOc/s09Nb8Y+A63CwNOCuJ1l9XouSTzF56eq+VXZCsPrwq6LpVEb X6HbjeKX30Js6d/QPy9lfAE0Du7rQdt6f67lNEy4dUDnTgh/qy58Jedq0tUQcuEavStf P0S0sVIZuJnhgOSvlWzxIgowakgq9UGcSrxtwH5TC0iGj2tnuPkiLQIxIuZerxxNR6gm Is3rPCwNr3t1Jg+xFcqjCqIGbCUQoU3a4GVhCFHCpJ0ztNOoGg0h8AXhCMZCE1RS4Z2T rQgFYxRM7hhpy37bU3sXAdSe/GFjfUyHjJ/Xa5Mihv6Ec1LXKOHwRlb2Kt7Q4ZlwrJyf 8Bag== 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: AOUpUlEdoU/TLC5jAbAlsIDJ/lM0MfoLVhjT7FeWGIz9v6st6D9bscR6 1QV63dz2lmzkhGIOnisnM7xMBfd0Zj0mekbdpnievWQ4cD8SxMOlB+pFg7LP22Fkw2sUuURDgma H4QiFANsn5sM+tmqlij160/VSmVBwBMbFgp/on6FKPw794pWHEGgfV4Rbi3arC0Q= X-Received: by 2002:a50:c9c3:: with SMTP id c3-v6mr9148971edi.56.1533326363883; Fri, 03 Aug 2018 12:59:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeyJkcVbw+K1wIaVOEuR8vFTkQ/rdV+5H7djLGi+/+Tmd3Of5yIi2j138/rKRnkwJRMnP7j X-Received: by 2002:a50:c9c3:: with SMTP id c3-v6mr9148948edi.56.1533326362964; Fri, 03 Aug 2018 12:59:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326362; cv=none; d=google.com; s=arc-20160816; b=oi0UVgviFn1wSqRrSbTBpS8MV9hmWMbnb6zdAJMBTVy+47cjS3rGoj4Eo4gD8N4MBi ue663RpjwQ94fJHGLJRMSpifTwvlYziDtGC8eVhjKj0uGbKwL3ch0SIkkq9tPgooOzUq 9lscRxkhlHQ+jVvnYWiYDz5quJx88EQzfhnle/JQ3ERlWkwHzj97MDMGyEHZJYTLVWz2 7VHwXYKiaGhP/Sl+GzaLSUhr0S6IruFMg6Zpf43r2w4OT71PNV7CEi/VRwC9+TXvztwB gZfVr1IvlI2/0SSo2IuXj+H4AXGacecwdv93tVwWsNLfUabib9l135XWD+c2fK1wmFg9 D9ZA== 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=IMPy9pOsazrrg8v4JRpYZ4Lz2nM+DpeFlUKz+Vm2FoU=; b=rdyPzrb7XNGhHMeMY+uxceoPCFNVXeIRKNW9FVkdZUCMxOVgz7qe0sBnpUZZ3MMAPA Rh1jTzDfR9UQ8Bz7YoCPWPJGcVICHP1B4OxMOfQGGtix5niNC/udETitrS7wnTwyC+vC F4kQC8M0UD7CvrFl81Kk6qvLNdmUhvaIQRqb4jo2t021c/8LKjF814JY4lvPGUlTy0a0 pRKKjYH+1GAjC9gfOK59dQBW8PQt4/BIufXJsZvbIzt8f1tzJzx+Lnbgcznsl+8efzLe sGaqw0Aa88jTzSVU3blJOi02EAx99c9EcMcam7aPHXZlD+pi/6jqxkWKGgfvOoUUZkHu fMdw== 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 h9-v6si5039667edl.176.2018.08.03.12.59.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:22 -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 (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx6a0071981 for ; Fri, 3 Aug 2018 15:59:20 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmtce73ex-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:20 -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:18 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) 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:14 +0100 Received: from d06av22.portsmouth.uk.ibm.com (d06av22.portsmouth.uk.ibm.com [9.149.105.58]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73JxDcR44564712 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:13 GMT Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B15C4C044; Fri, 3 Aug 2018 22:59:24 +0100 (BST) Received: from d06av22.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 282684C040; Fri, 3 Aug 2018 22:59:22 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av22.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:22 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:59:10 +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 6/7] um: switch to NO_BOOTMEM Date: Fri, 3 Aug 2018 22:58:49 +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-0000025C97E1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-0009-0000-0000-000021C33DD2 Message-Id: <1533326330-31677-7-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=799 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 Replace bootmem initialization with memblock_add and memblock_reserve calls and explicit initialization of {min,max}_low_pfn. Signed-off-by: Mike Rapoport Acked-by: Richard Weinberger --- arch/um/Kconfig.common | 2 ++ arch/um/kernel/physmem.c | 20 +++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common index 07f84c8..1487957 100644 --- a/arch/um/Kconfig.common +++ b/arch/um/Kconfig.common @@ -8,6 +8,8 @@ config UML select HAVE_UID16 select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_DEBUG_KMEMLEAK + select HAVE_MEMBLOCK + select NO_BOOTMEM select GENERIC_IRQ_SHOW select GENERIC_CPU_DEVICES select GENERIC_CLOCKEVENTS diff --git a/arch/um/kernel/physmem.c b/arch/um/kernel/physmem.c index 0eaec0e..296a91a 100644 --- a/arch/um/kernel/physmem.c +++ b/arch/um/kernel/physmem.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -80,23 +81,18 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, unsigned long len, unsigned long long highmem) { unsigned long reserve = reserve_end - start; - unsigned long pfn = PFN_UP(__pa(reserve_end)); - unsigned long delta = (len - reserve) >> PAGE_SHIFT; - unsigned long offset, bootmap_size; - long map_size; + long map_size = len - reserve; int err; - offset = reserve_end - start; - map_size = len - offset; if(map_size <= 0) { os_warn("Too few physical memory! Needed=%lu, given=%lu\n", - offset, len); + reserve, len); exit(1); } physmem_fd = create_mem_file(len + highmem); - err = os_map_memory((void *) reserve_end, physmem_fd, offset, + err = os_map_memory((void *) reserve_end, physmem_fd, reserve, map_size, 1, 1, 1); if (err < 0) { os_warn("setup_physmem - mapping %ld bytes of memory at 0x%p " @@ -113,9 +109,11 @@ void __init setup_physmem(unsigned long start, unsigned long reserve_end, os_write_file(physmem_fd, __syscall_stub_start, PAGE_SIZE); os_fsync_file(physmem_fd); - bootmap_size = init_bootmem(pfn, pfn + delta); - free_bootmem(__pa(reserve_end) + bootmap_size, - len - bootmap_size - reserve); + memblock_add(__pa(start), len + highmem); + memblock_reserve(__pa(start), reserve); + + min_low_pfn = PFN_UP(__pa(reserve_end)); + max_low_pfn = min_low_pfn + (map_size >> PAGE_SHIFT); } int phys_mapping(unsigned long phys, unsigned long long *offset_out) From patchwork Fri Aug 3 19:58:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10555477 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 6338513B4 for ; Fri, 3 Aug 2018 19:59:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53BF92C1DE for ; Fri, 3 Aug 2018 19:59:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47E182C252; Fri, 3 Aug 2018 19:59:32 +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 5ED022C1DE for ; Fri, 3 Aug 2018 19:59:31 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4D3366B026D; Fri, 3 Aug 2018 15:59:29 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4A8D46B026E; Fri, 3 Aug 2018 15:59:29 -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 399F26B026F; Fri, 3 Aug 2018 15:59:29 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id C785E6B026D for ; Fri, 3 Aug 2018 15:59:28 -0400 (EDT) Received: by mail-ed1-f69.google.com with SMTP id y8-v6so2018984edr.12 for ; Fri, 03 Aug 2018 12:59:28 -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=GUnPBwTCgCMUyubunDgn1FtKTOdOaBs5jPMP++jGO8M=; b=t1m3eILMNbhHlNyKFPbc86XemdDdfEfYYuB+dPUsagKhz5pfaB5CKa6ancwK41PYiQ VeKXeI5GveTachpadSsuESB3t+AFACU6lNAOZjIKD7oCkf44nejX+mjN8IwPrGXhmH9G Olgx10n8Tte3u+HySmFxPZYYfXzeD1ucNI7vfzo8npOczbZEdUlN2rrU3ud3427p5vnh itUS9mf7Z0aYLq6KtLokOHkerFQv5GWF5g6ACmmrb+pAdZZrJFB/l48mkItcwGmQV5Q/ 9EXTOBIp3G5BwDGmYI6oyfnUZfyMI4HP0N9i0YtSRgGpp50RXuGd9rc0dgRyZsNWRiVc V5FQ== 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: AOUpUlFRyHKJsJGTEEpQGzhUdXVnK3eDJ+p/ed/Wv/ENn0zVDOnup3ft qp0FyyqdHixHHYtjd2SGJEehtzMZ8AF7bYAyV4SdMf0UyN4Al9oyUTSs+XO13+pC+D5TzJGC0Ry MxME8Zs0xt9Z9ILxYWfwwkmliKOugt+tsgCgTCAA1ipzkqjEnk8ygddeuoLpWFfY= X-Received: by 2002:a50:ec0b:: with SMTP id g11-v6mr8718146edr.38.1533326368299; Fri, 03 Aug 2018 12:59:28 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcFWWkgsZljCQ2PLUfJIg5IJCcEYCZvZUwIJMgvtF07n3Rnl+68eQ5IZY0HW0xQvmAqM0Cr X-Received: by 2002:a50:ec0b:: with SMTP id g11-v6mr8718129edr.38.1533326367427; Fri, 03 Aug 2018 12:59:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326367; cv=none; d=google.com; s=arc-20160816; b=JCO9tbNqQMiMIXddoU/yRHUgSKavO/g5xxbrQrxUt/KenlMbAX99ursqZ3/7xxtnnB L86ddFs2HTXXQ4GUIflAevKJAYUgoQWt9w4YSLm6XhAg+wjnV6rF0tBMK2TpGRFa6oAa 0NF1/2AtxSYApYIySg9seTFcAF65wOCZR4cQRf+jmIUIZroCVD/GBazrcLfW3x21AosV FNQ2cfveSO7CnQ0RwgannyFHyIBsJZ35EWtjnHx/VtSZkUCWHPz3os/Jc4jNfKvKXLGR LoTVlCVoQ5fjzQfIA3c1qBxGmc/pcOLdX5GNtgKp9H+YLUAVLofhown6hTiOo49dBZnS ox6w== 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=GUnPBwTCgCMUyubunDgn1FtKTOdOaBs5jPMP++jGO8M=; b=ISnbm24O8XRSGlUlW6HaT4BJy5K7tx+C7CoqmecbLI6MRjOPosUg8FviaseB9K5ucL 6L7fV3nGY9zJy9X1ac0oCbWH1h8JwmJBSWUN51PFOlofbHyF1W6C7zc9eJmJKYYR7nKJ /QTkfDvey2sd2OxoX0chF9uwMIby3mFgolclEUnddmBvOhwaYIxZ/3N4YcaKqCWr1eSe xP7Van1eG/ejpK1rHHiWNeE2rJmiriBavK0kxkoV3dLnVxZaXlpgZH0kHI7Jl762iZmA 8RLmNI23BrDcNFCByhZlZ/qEirTFIh9f+frugpEBW/dSkkztpGk5ckghCfzU1gGA7mk0 oVOg== 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 x62-v6si2285545edc.151.2018.08.03.12.59.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Aug 2018 12:59:27 -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 w73Jx4Rt026815 for ; Fri, 3 Aug 2018 15:59:25 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmudxctg5-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 03 Aug 2018 15:59:25 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Aug 2018 20:59:22 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) 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:18 +0100 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w73JxH9b39256106 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 3 Aug 2018 19:59:17 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9A2BBA404D; Fri, 3 Aug 2018 22:59:26 +0100 (BST) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7979DA4040; Fri, 3 Aug 2018 22:59:24 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.204.91]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Fri, 3 Aug 2018 22:59:24 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Fri, 03 Aug 2018 22:59:13 +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 7/7] unicore32: switch to NO_BOOTMEM Date: Fri, 3 Aug 2018 22:58:50 +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-4275-0000-0000-000002A367CD X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18080319-4276-0000-0000-000037AB871B Message-Id: <1533326330-31677-8-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=48 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=804 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 The unicore32 already supports memblock and uses it for some early memory reservations, e.g initrd and the page tables. At some point unicore32 allocates the bootmem bitmap from the memblock and then hands over the memory reservations from memblock to bootmem. This patch removes the bootmem initialization and leaves memblock as the only boot time memory manager for unicore32. Signed-off-by: Mike Rapoport Acked-by: Guan Xuetao --- arch/unicore32/Kconfig | 1 + arch/unicore32/mm/init.c | 54 +----------------------------------------------- 2 files changed, 2 insertions(+), 53 deletions(-) diff --git a/arch/unicore32/Kconfig b/arch/unicore32/Kconfig index 03f991e..cff4b9d 100644 --- a/arch/unicore32/Kconfig +++ b/arch/unicore32/Kconfig @@ -5,6 +5,7 @@ config UNICORE32 select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO select HAVE_MEMBLOCK + select NO_BOOTMEM select HAVE_GENERIC_DMA_COHERENT select HAVE_KERNEL_GZIP select HAVE_KERNEL_BZIP2 diff --git a/arch/unicore32/mm/init.c b/arch/unicore32/mm/init.c index f4950fb..44ccc15 100644 --- a/arch/unicore32/mm/init.c +++ b/arch/unicore32/mm/init.c @@ -84,58 +84,6 @@ static void __init find_limits(unsigned long *min, unsigned long *max_low, } } -static void __init uc32_bootmem_init(unsigned long start_pfn, - unsigned long end_pfn) -{ - struct memblock_region *reg; - unsigned int boot_pages; - phys_addr_t bitmap; - pg_data_t *pgdat; - - /* - * Allocate the bootmem bitmap page. This must be in a region - * of memory which has already been mapped. - */ - boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); - bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES, - __pfn_to_phys(end_pfn)); - - /* - * Initialise the bootmem allocator, handing the - * memory banks over to bootmem. - */ - node_set_online(0); - pgdat = NODE_DATA(0); - init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn); - - /* Free the lowmem regions from memblock into bootmem. */ - for_each_memblock(memory, reg) { - unsigned long start = memblock_region_memory_base_pfn(reg); - unsigned long end = memblock_region_memory_end_pfn(reg); - - if (end >= end_pfn) - end = end_pfn; - if (start >= end) - break; - - free_bootmem(__pfn_to_phys(start), (end - start) << PAGE_SHIFT); - } - - /* Reserve the lowmem memblock reserved regions in bootmem. */ - for_each_memblock(reserved, reg) { - unsigned long start = memblock_region_reserved_base_pfn(reg); - unsigned long end = memblock_region_reserved_end_pfn(reg); - - if (end >= end_pfn) - end = end_pfn; - if (start >= end) - break; - - reserve_bootmem(__pfn_to_phys(start), - (end - start) << PAGE_SHIFT, BOOTMEM_DEFAULT); - } -} - static void __init uc32_bootmem_free(unsigned long min, unsigned long max_low, unsigned long max_high) { @@ -232,7 +180,7 @@ void __init bootmem_init(void) find_limits(&min, &max_low, &max_high); - uc32_bootmem_init(min, max_low); + node_set_online(0); #ifdef CONFIG_SWIOTLB swiotlb_init(1);