From patchwork Wed Jul 25 05:29:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Rapoport X-Patchwork-Id: 10543449 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 07FC517FD for ; Wed, 25 Jul 2018 05:30:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED739293FB for ; Wed, 25 Jul 2018 05:30:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1E2B29491; Wed, 25 Jul 2018 05:30:11 +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 5E52F293FB for ; Wed, 25 Jul 2018 05:30:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 846776B0008; Wed, 25 Jul 2018 01:30:10 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 7F51A6B000A; Wed, 25 Jul 2018 01:30:10 -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 6BC6E6B000C; Wed, 25 Jul 2018 01:30:10 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-oi0-f71.google.com (mail-oi0-f71.google.com [209.85.218.71]) by kanga.kvack.org (Postfix) with ESMTP id 432EB6B0008 for ; Wed, 25 Jul 2018 01:30:10 -0400 (EDT) Received: by mail-oi0-f71.google.com with SMTP id e23-v6so6586182oii.10 for ; Tue, 24 Jul 2018 22:30:10 -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:message-id; bh=r2kzX2Ya9omN1rb6xGXbadCH+rfSiR1HJ7NmYMho+as=; b=Z8Ke+fmr9IncJzQDsxR7WdzvmtNQ+99QnO23S5osJBJgBN8Iaj9t0SLkoJqDytaMLz 1AziTTFZHfGILnngRoDKR1n9mQiCLQ0nppfzqgytkn9BOnfRr+EihHvlv4gB/Ng4VYWJ 5I/cv8DZvnaMqnbCUqR1XX7AhKT92e2ZQJL8qBXwulNSweAarv+oUbXb3Sko7tzYMe4S 0Dy6oc4tG/Ok3zSJYTsCDbw+vg12ykYN1EYtyH/LOzXbEHLbFmYX18iu3OStUjbVFGlh +8gDC2LUKJQOB9m4muPkkuG0DJqCDeLX3pVBeIRl9tb+hMik7RwSbc8OuRMmKWOXl0hl S8WQ== 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: AOUpUlHvbOijC2WqT2xbykFeEp9JE2dsGm0vpwnjt/UGZpHv2FykvQpD q8Qjnz+LfcuyDZXVYoKLV6u7W5ovf4L03pyntINypkOcnsuzcN/BBM9YiocWpozwmcMSR85eKiG apONn6jP2Gqtw10x5bXHOjUB23/KAI4tDqZDYhb00aQ/4lbl3M2L4y7ObPEmAIjQ= X-Received: by 2002:aca:b48b:: with SMTP id d133-v6mr1747416oif.165.1532496609764; Tue, 24 Jul 2018 22:30:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4IdMYJXOKhn2KfFn+V8OMRmnY6/Unvm6r1Xxyza6gBESkMn6EkrdYdzzhc68MNldwbQGt X-Received: by 2002:aca:b48b:: with SMTP id d133-v6mr1747371oif.165.1532496609016; Tue, 24 Jul 2018 22:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532496608; cv=none; d=google.com; s=arc-20160816; b=J7dq1J7YY04nOKJ0D+5oyh3zo+tjbiEaQqciQ1YTQs/xNbmGiXHr/76KslnXanIGvA 4Vfl59krYUDSD/6/b4f/qtKAGiks7hAanc7o2Yl3Lasc8PBTb+jZCn4Hb2g95vTTYAel GKum3iAL+czLFxvOyMcuZHQdinps93IcfEF1yp4e8j4SLHFd+0MJKaYioQsdu2ZHTw11 IDqkIybk8ek3mSKWe8kt5Lmfeept9q3J1BnwKEjz7+x6ahhNq3N0m6SGDf2Mxc/eHB1R ZYYxE/JlQcS51ps9ZOo5zctBQuOCdE13N10tRSIoyFy4TCtxVOnDYc2yrz2h4oHy7Wx0 z3WQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=r2kzX2Ya9omN1rb6xGXbadCH+rfSiR1HJ7NmYMho+as=; b=aPGr5YkixQn2xZvtlSyFQud++Euwdn16HXr/9oOrH/kajYfqQOe7WR2qQCtDnIcnam UAS7vYIR46FoxACkLKPnpb3tE8T0aupX80dVV7l8Gbq6OPGPVQ3LLLl3ypge9gV96mgH F03+QeLkZ0kjaihMf7f+yrVviTS6JgRvP8J0WVCN7nfRvEx2PkLdH94TJ1f0lvASnrIy Wq4mOdxsT/88PDoHMlELM46XM50zJ9cPzadxx6NQtDLRvpuu6p50StGjgV4rwdjV1CSm ox/5JkeVRbOiHYSnG+ky6JiaaFmuh1+XHZL5gMpSVdDDx1HOeJWgL6jxvbPPhlIXcxBT cFiQ== 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 o188-v6si9576992oib.135.2018.07.24.22.30.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 22:30:08 -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 (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6P5TTVd125703 for ; Wed, 25 Jul 2018 01:30:08 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kehqkkcaf-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Jul 2018 01:30:07 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 25 Jul 2018 06:30:04 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) 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) Wed, 25 Jul 2018 06:30:00 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6P5TxZb36569232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 25 Jul 2018 05:29:59 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E3A311C052; Wed, 25 Jul 2018 08:30:13 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 095A111C050; Wed, 25 Jul 2018 08:30:12 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.110]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Wed, 25 Jul 2018 08:30:11 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Wed, 25 Jul 2018 08:29:57 +0300 From: Mike Rapoport To: Richard Kuo Cc: Michal Hocko , linux-hexagon@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Mike Rapoport Subject: [PATCH v2] hexagon: switch to NO_BOOTMEM Date: Wed, 25 Jul 2018 08:29:54 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18072505-0012-0000-0000-0000028E6EA9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18072505-0013-0000-0000-000020C05387 Message-Id: <1532496594-26353-1-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-25_01:,, 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=945 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250061 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 --- v2: fix calculation of the reserved memory size 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 */