Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2046565imm; Mon, 16 Jul 2018 00:51:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpci8fmh3epIoK23poWK3CqcO8baab1IBd0dfydGxrkq9f2jLzkF7W+wi4UtWdfSbOjjnYBv X-Received: by 2002:a63:c50c:: with SMTP id f12-v6mr14238966pgd.88.1531727474663; Mon, 16 Jul 2018 00:51:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531727474; cv=none; d=google.com; s=arc-20160816; b=Krz8WkTakBIXOlgf5zrKw562yQ++5/+NL0yQ3zQteXbrTmt/ZiYxEcBwx6j1EezD9W IWYcsTSsYCI36XVwaPDN90sVos1IBo6CzNU9IcJEUKPBig5n35ZjIykgnDt69caX90Mz hXsqHodT2Rm3I2+6KmBoIK/dd7wv+aZ0aEhcuZVzoN/rxGtAQFz7wYKuAv6MJ7J/zHoY cP1EqCp0mq7UWB+/vkeoLchnNm0d0JSqwixJNnNacCk4e3yihnHXxTDGUhJ6mZxXt6y/ RAqtsswRWSOyyMVDJ1I8u9ZH8tc+WG7eNa0xlIOtj9W3VEh14k/iUTiGRVSrJX/n1Xkt lFYg== 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=wCGNW+zsXmGEyZltEEnEMJidOJSJ6WBj3tywpGBmMFA=; b=FY7rxPI/7H46LeWdC8debKFvKcwT+KwC8QHTS4tbo3CKOqDhzSXG2gI/FRXAgshk3P uOiWg91kqdQGrYHvAk/4FPdSj0f7M/d46r+PERPJfHvoqOwr7N6Gw9xu6hNqGKgXOSgx zUMwvkgOuaqf58SOGqnZxVyCOHMHPXe/k4V0XeD6DfAybhh4pVFoRu/pLdLvtkGdR+M7 287eQYh4eQ1t7nOaV1BQNiQ5Gs0niFRmPgj5LsvPkbgkR/sgCCF9AqqCtKfQFpxqs+V+ BfhA2c37uIHZOkPpxz81/b8UmXLukKnzQGysrtIpKnfPFDoV1Kmxl/sfBX3azy5gRgQb uD4g== 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 u26-v6si28678260pge.590.2018.07.16.00.50.59; Mon, 16 Jul 2018 00:51:14 -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 S1730161AbeGPIJc (ORCPT + 99 others); Mon, 16 Jul 2018 04:09:32 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:43220 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389038AbeGPIJb (ORCPT ); Mon, 16 Jul 2018 04:09:31 -0400 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 w6G7dF9H101998 for ; Mon, 16 Jul 2018 03:43:28 -0400 Received: from e06smtp04.uk.ibm.com (e06smtp04.uk.ibm.com [195.75.94.100]) by mx0a-001b2d01.pphosted.com with ESMTP id 2k8gg6wats-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 16 Jul 2018 03:43:27 -0400 Received: from localhost by e06smtp04.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 16 Jul 2018 08:43:26 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp04.uk.ibm.com (192.168.101.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 16 Jul 2018 08:43:23 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w6G7hMgV32571544 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 16 Jul 2018 07:43:22 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C5F7142047; Mon, 16 Jul 2018 10:43:41 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5AEDB4204F; Mon, 16 Jul 2018 10:43:40 +0100 (BST) Received: from rapoport-lnx (unknown [9.148.8.99]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Mon, 16 Jul 2018 10:43:40 +0100 (BST) Received: by rapoport-lnx (sSMTP sendmail emulation); Mon, 16 Jul 2018 10:43:20 +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] hexagon: switch to NO_BOOTMEM Date: Mon, 16 Jul 2018 10:43:18 +0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-GCONF: 00 x-cbid: 18071607-0016-0000-0000-000001E735D9 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18071607-0017-0000-0000-0000323BDD74 Message-Id: <1531726998-10971-1-git-send-email-rppt@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-07-16_02:,, 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=886 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807160092 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 --- Build tested only. 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..8d265bf 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 - PHYS_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