Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp96242pxp; Fri, 4 Mar 2022 22:39:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzadqgT3sfsesVKmq9DWfH1vk0SHtrzgFSrrpjqeEy7i46cziFjNbKnQVwoJGAaVNH0f6+H X-Received: by 2002:a63:cd58:0:b0:364:bca8:55a with SMTP id a24-20020a63cd58000000b00364bca8055amr1720547pgj.56.1646462394343; Fri, 04 Mar 2022 22:39:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646462394; cv=none; d=google.com; s=arc-20160816; b=cy93mMTswv++s3l/9woKwPSuHBx7IyhK75W+3oXf4tDr7L2ztxdQhxcn3iDoZeNxHl 3eOk/BWrrIwvFqYpalpIvqSHPR5OKpBQxf90IGG2wjvi9suv4AedeJR/3Wb7BXbUy5y6 FIj/cADKf/PEfwFc8F/O9AIhvgCqvvcGIMvubtRrScSipvZSjpN0o8wOuXaVHOWK/2Y+ Xtcf0hvlO+SYqQ5GWmJW2rq3IaBe9UoiNkvQH49EjrHsegSSy26EV0J1RFpe6YBRlWpm LfzQ8zGna8ZuGYWYMxPZvb/HFxp3QaaHGIknnxsYrckHg6VuAsnPHW1H4fgGfVpCMR3Y 8/jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=u83+nnI7pCcc7F1ve7v0DvVKOqnRZUTaiPUJ2CTlXLc=; b=tZZ4nYSW6IhWROnv59mDIiSauB95IwYcRHMxGWLoFF5PA1ij9rMWqNt+I/42FuO9/I fpCOtJ3XjFHkrqgXTQtUxwIokZJ/tAbkmISv2/UbzzowHnYgwF/P3pQ9b2uREZePA+1Y pyfdYEVrJF7iQyrN8RONx7v3U2jRkGukyV7Ufo/n6zHS5FVeas0yPk8wZLpbNLb5QFf6 fur+grr1T2tRrjW0NHo0OmhGRi8U6xe+rf839A9MZfwUYOBhMP3+2Vcr5b0WQXIkfrRD d859FNNWy85WkBfXzraju725/zsrfXm+iZcx9JjT4JhNF2+IokFFWDDSMKX3nin/RVC6 61oA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id om17-20020a17090b3a9100b001beec00d3ebsi1511573pjb.125.2022.03.04.22.39.18; Fri, 04 Mar 2022 22:39:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231349AbiCEGWZ (ORCPT + 99 others); Sat, 5 Mar 2022 01:22:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55900 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231174AbiCEGWY (ORCPT ); Sat, 5 Mar 2022 01:22:24 -0500 Received: from loongson.cn (mail.loongson.cn [114.242.206.163]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B2EB2527F6; Fri, 4 Mar 2022 22:21:34 -0800 (PST) Received: from linux.localdomain (unknown [113.200.148.30]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxGs1pASNiBh4DAA--.2113S3; Sat, 05 Mar 2022 14:21:30 +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 v5 1/4] memblock: Introduce memblock_mem_range_remove_map() Date: Sat, 5 Mar 2022 14:21:26 +0800 Message-Id: <1646461289-31992-2-git-send-email-yangtiezhu@loongson.cn> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1646461289-31992-1-git-send-email-yangtiezhu@loongson.cn> References: <1646461289-31992-1-git-send-email-yangtiezhu@loongson.cn> X-CM-TRANSID: AQAAf9AxGs1pASNiBh4DAA--.2113S3 X-Coremail-Antispam: 1UD129KBjvJXoW7trWUXr48tFy8tr17Cr4rXwb_yoW8Cw15pr n3G3W8CF48GFn7Xa97G3W3ury7A34rCF1fGFW7Cr1q9a4xJr1xuw4kGayUtFyjqF47KFs0 vF1xJayDGa9ruFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUBv14x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2048vs2IY020E87I2jVAFwI0_Jr4l82xGYIkIc2 x26xkF7I0E14v26r1I6r4UM28lY4IEw2IIxxk0rwA2F7IY1VAKz4vEj48ve4kI8wA2z4x0 Y4vE2Ix0cI8IcVAFwI0_Gr0_Xr1l84ACjcxK6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1l84 ACjcxK6I8E87Iv67AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVCY1x0267AKxVW8Jr0_Cr1U M2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjx v20xvE14v26r106r15McIj6I8E87Iv67AKxVW8JVWxJwAm72CE4IkC6x0Yz7v_Jr0_Gr1l F7xvr2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7MxkIecxEwVAFwVW8AwCF04 k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18 MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr4 1lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1l IxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4 A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x0JU7-BiUUUUU= X-CM-SenderInfo: p1dqw3xlh2x3gn0dqz5rrqw2lrqou0/ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is preparation for supporting mem=limit@base and memmap=limit@base parameters, 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) -- 2.1.0