Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp409667imm; Tue, 24 Jul 2018 22:33:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdxpHYQIGLmqt947qcLQbKeCHg5g9p+7E3Fl6xoW59JVXTrcpUH0IBaXXFz3M0Zeabnz28z X-Received: by 2002:a17:902:5a08:: with SMTP id q8-v6mr19441331pli.300.1532496807833; Tue, 24 Jul 2018 22:33:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532496807; cv=none; d=google.com; s=arc-20160816; b=QbWHc5lDtNvbCyGhilBUmjxF7k5j50VDefzWGkMRbVwDm3WqVV0PqVDiI7+ednyHJa xdBYX3N/zVOMiMitB7esSv+kIZ8/fRo5HGiDGyxUJdrAM19O1MXw/sk9ZZarElHhRASJ HVGRlE03WIsMRhOa+s3zRiafFYAE45ar4R0l5scbhFy3rOcEHfshuW2BG+3F2scyucj1 nNHML/dOzuQc+FDV+9BJ14b1+9Hzl+wVFRjjLVlQj6nDpgYFat5kqhSEHlrtFH/YBuSF uygMRk4zQz063GaMhFvF+gddGf7MwdH3xEHLUBMh00dG1VmUSw/lSQJsyuWwUTiLmkIU iGbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=r2kzX2Ya9omN1rb6xGXbadCH+rfSiR1HJ7NmYMho+as=; b=hLZUfyp43gZXHklCpNfPh/4QOEHQgF63fcmLMraL3UkvegceoPy2KlY0cYz1b6lTtn dF9FnSU9ZqM4sABUJ0y6oDqEOEOAttNfO9i8EjeLbEt/PW4xTHlu/MsVtxynZAajafuz MkXdeSjX7uMWe7WXCyr3lNLFJdh++Lp+jtYrlM4ftB6qTU/JwBv0GcyczBsoT0ymDgjP AnNcMr7nNEHDx37z0EpjuiZviRCrOmDtqANocPOFEZt7ZAsJsOfXL9ZPYqi/FgLlNwvl bKp0V9tLb16qqWBsojacYiFai7VGbCijw92NJqfzg9nHEjc98JQJNxgruoXvIjUz8mY1 hMkg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l6-v6si13575285pfb.69.2018.07.24.22.33.12; Tue, 24 Jul 2018 22:33:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728154AbeGYGlo (ORCPT + 99 others); Wed, 25 Jul 2018 02:41:44 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47048 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727564AbeGYGlo (ORCPT ); Wed, 25 Jul 2018 02:41:44 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6P5Va1f091912 for ; Wed, 25 Jul 2018 01:31:43 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kejvq0b87-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 25 Jul 2018 01:31:40 -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=946 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807250061 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 */ -- 2.7.4