Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp867089imm; Fri, 3 Aug 2018 13:02:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdyCG5S982xGtghLq+LpSW5hxHVagkvWkipGAfsZEv9NzjoshanB/HE4rO1l27m+QANpy10 X-Received: by 2002:aa7:824d:: with SMTP id e13-v6mr4800743pfn.97.1533326529381; Fri, 03 Aug 2018 13:02:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533326529; cv=none; d=google.com; s=arc-20160816; b=NuDzRvlPhEIxt2lDp4jTcxULHBT65TMtoGWwRNvSeI7VKU29YV67plgKBTyomY372I a+GEvf1+0Wj9oK1S5WEY+cHBB49ode5dCzUOTf/eczXdVt2fPwOA+rJ5kVrRw8VRZDoc V9V4u0jEJ4V/vKXMYp8HeCtDFrUaJnJldwJJP1elO7PGeW2EnmvMVrWvSxShxFgosXUK rdXCq/gsJ4KkVKZdPOUV0Nh+QX4QgxwEzvIPIinZVSWKx99aaL9KQkJYyyCzEHg278kB OwD8IwmnBP9xt1013uB4294LIuVLtoPy/Kl6aSC0eh6Kfm+1VuBVYYhZoaFAZ/6NjRUq 3nUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from:arc-authentication-results; bh=rws5vOWYjYJp5Mm/qMcNBSQuV72hTJad8STKZFRW5SI=; b=rDtm6T4/lI/h7wE+pTn2XbleMf+vtribuo6ea/QlHbq+sL7RgW4EfmH2EA0/SSvbie NWTuuD0NhvXtvCGBhoN3lbIEPyvhGniGx5bzdpwofLZQvb+MQ39LvDswA5a+ksaXQOmo U53N4xPf2p2fzezGDWUHVKWnwYDVOdSH9gDlDi/9mBPAzGs7+6oiaStxBd+zEg9f7FUo HooNA6len2eNd1lLKWdud6+Sh5lf3YH2uDSMannszzMYMMGaHXcb0bX7NIuNWZcyKxRG Ge5f64+8ZhRfdXI9cM9g88EavYC11n7a2zV+k2oglrCwisGDMCK5xc9Jvgnmk8NikJIv YmpA== 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 g10-v6si4775123pge.694.2018.08.03.13.01.54; Fri, 03 Aug 2018 13:02:09 -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 S1732049AbeHCV4w (ORCPT + 99 others); Fri, 3 Aug 2018 17:56:52 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53268 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731014AbeHCV4v (ORCPT ); Fri, 3 Aug 2018 17:56:51 -0400 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w73Jx5C4099123 for ; Fri, 3 Aug 2018 15:59:07 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2kmvdttqbx-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=875 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1808030216 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 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 */ -- 2.7.4