From patchwork Mon Feb 28 06:31:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiezhu Yang X-Patchwork-Id: 12762401 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 34698C433FE for ; Mon, 28 Feb 2022 06:31:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233206AbiB1GcA (ORCPT ); Mon, 28 Feb 2022 01:32:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233120AbiB1Gb7 (ORCPT ); Mon, 28 Feb 2022 01:31:59 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0ED0466AE5; Sun, 27 Feb 2022 22:31:17 -0800 (PST) Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9DxGMkrbBxiQxMIAA--.10334S4; Mon, 28 Feb 2022 14:31:08 +0800 (CST) From: Tiezhu Yang To: Thomas Bogendoerfer , Mike Rapoport , Andrew Morton Cc: Xuefeng Li , linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] memblock: Introduce memblock_mem_range_remove_map() Date: Mon, 28 Feb 2022 14:31:04 +0800 Message-Id: <1646029866-6692-3-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1646029866-6692-1-git-send-email-yangtiezhu@loongson.cn> References: <1646029866-6692-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9DxGMkrbBxiQxMIAA--.10334S4 X-Coremail-Ant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f9x0JU5CztUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org This is preparation for supporting memmap=limit@base parameter, no functionality change. Signed-off-by: Tiezhu Yang --- include/linux/memblock.h | 1 + mm/memblock.c | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/include/linux/memblock.h b/include/linux/memblock.h index 50ad196..e558d2c 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -482,6 +482,7 @@ phys_addr_t memblock_end_of_DRAM(void); void memblock_enforce_memory_limit(phys_addr_t memory_limit); void memblock_cap_memory_range(phys_addr_t base, phys_addr_t size); void memblock_mem_limit_remove_map(phys_addr_t limit); +void memblock_mem_range_remove_map(phys_addr_t base, phys_addr_t limit); bool memblock_is_memory(phys_addr_t addr); bool memblock_is_map_memory(phys_addr_t addr); bool memblock_is_region_memory(phys_addr_t base, phys_addr_t size); diff --git a/mm/memblock.c b/mm/memblock.c index 1018e50..2476d15d 100644 --- a/mm/memblock.c +++ b/mm/memblock.c @@ -1723,7 +1723,7 @@ void __init memblock_cap_memory_range(phys_addr_t base, phys_addr_t size) base + size, PHYS_ADDR_MAX); } -void __init memblock_mem_limit_remove_map(phys_addr_t limit) +void __init memblock_mem_range_remove_map(phys_addr_t base, phys_addr_t limit) { phys_addr_t max_addr; @@ -1736,7 +1736,12 @@ void __init memblock_mem_limit_remove_map(phys_addr_t limit) if (max_addr == PHYS_ADDR_MAX) return; - memblock_cap_memory_range(0, max_addr); + memblock_cap_memory_range(base, max_addr); +} + +void __init memblock_mem_limit_remove_map(phys_addr_t limit) +{ + memblock_mem_range_remove_map(0, limit); } static int __init_memblock memblock_search(struct memblock_type *type, phys_addr_t addr)