diff mbox series

MIPS: Loongson64: Remove duplicated add_memory_region

Message ID 20190926140458.10367-1-jiaxun.yang@flygoat.com (mailing list archive)
State Superseded
Headers show
Series MIPS: Loongson64: Remove duplicated add_memory_region | expand

Commit Message

Jiaxun Yang Sept. 26, 2019, 2:04 p.m. UTC
From a94e4f24ec83 ("MIPS: init: Drop boot_mem_map"), add_memory_region is
handled by memblock_add directly. So they're totally duplicated with following
memblock_add_node and leading to boot failure in some cases.

Reported-by: Huacai Chen <chenhc@lemote.com>
Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/mips/loongson64/loongson-3/numa.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Huacai Chen Sept. 27, 2019, 10:36 a.m. UTC | #1
Hi Jiaxun and Paul,

This patch isn't a complete fix, please refer to
https://patchwork.kernel.org/patch/11164281/.

Huacai

On Thu, Sep 26, 2019 at 10:05 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
> From a94e4f24ec83 ("MIPS: init: Drop boot_mem_map"), add_memory_region is
> handled by memblock_add directly. So they're totally duplicated with following
> memblock_add_node and leading to boot failure in some cases.
>
> Reported-by: Huacai Chen <chenhc@lemote.com>
> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/mips/loongson64/loongson-3/numa.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c
> index 414e97de5dc0..dae7d7704e66 100644
> --- a/arch/mips/loongson64/loongson-3/numa.c
> +++ b/arch/mips/loongson64/loongson-3/numa.c
> @@ -142,8 +142,6 @@ static void __init szmem(unsigned int node)
>                                 (u32)node_id, mem_type, mem_start, mem_size);
>                         pr_info("       start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
>                                 start_pfn, end_pfn, num_physpages);
> -                       add_memory_region((node_id << 44) + mem_start,
> -                               (u64)mem_size << 20, BOOT_MEM_RAM);
>                         memblock_add_node(PFN_PHYS(start_pfn),
>                                 PFN_PHYS(end_pfn - start_pfn), node);
>                         break;
> @@ -156,16 +154,14 @@ static void __init szmem(unsigned int node)
>                                 (u32)node_id, mem_type, mem_start, mem_size);
>                         pr_info("       start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
>                                 start_pfn, end_pfn, num_physpages);
> -                       add_memory_region((node_id << 44) + mem_start,
> -                               (u64)mem_size << 20, BOOT_MEM_RAM);
>                         memblock_add_node(PFN_PHYS(start_pfn),
>                                 PFN_PHYS(end_pfn - start_pfn), node);
>                         break;
>                 case SYSTEM_RAM_RESERVED:
>                         pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
>                                 (u32)node_id, mem_type, mem_start, mem_size);
> -                       add_memory_region((node_id << 44) + mem_start,
> -                               (u64)mem_size << 20, BOOT_MEM_RESERVED);
> +                       memblock_add_node(PFN_PHYS(start_pfn),
> +                               PFN_PHYS(end_pfn - start_pfn), node);
>                         memblock_reserve(((node_id << 44) + mem_start),
>                                 mem_size << 20);
>                         break;
> --
> 2.23.0
>
Jiaxun Yang Sept. 28, 2019, 8:52 a.m. UTC | #2
On 2019/9/27 下午6:36, Huacai Chen wrote:
> Hi Jiaxun and Paul,
>
> This patch isn't a complete fix, please refer to
> https://patchwork.kernel.org/patch/11164281/.

Hi Paul,

Please pick Huacai's patch as a material of rc1.

Thanks

--

Jiaxun Yang

> Huacai
diff mbox series

Patch

diff --git a/arch/mips/loongson64/loongson-3/numa.c b/arch/mips/loongson64/loongson-3/numa.c
index 414e97de5dc0..dae7d7704e66 100644
--- a/arch/mips/loongson64/loongson-3/numa.c
+++ b/arch/mips/loongson64/loongson-3/numa.c
@@ -142,8 +142,6 @@  static void __init szmem(unsigned int node)
 				(u32)node_id, mem_type, mem_start, mem_size);
 			pr_info("       start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
 				start_pfn, end_pfn, num_physpages);
-			add_memory_region((node_id << 44) + mem_start,
-				(u64)mem_size << 20, BOOT_MEM_RAM);
 			memblock_add_node(PFN_PHYS(start_pfn),
 				PFN_PHYS(end_pfn - start_pfn), node);
 			break;
@@ -156,16 +154,14 @@  static void __init szmem(unsigned int node)
 				(u32)node_id, mem_type, mem_start, mem_size);
 			pr_info("       start_pfn:0x%llx, end_pfn:0x%llx, num_physpages:0x%lx\n",
 				start_pfn, end_pfn, num_physpages);
-			add_memory_region((node_id << 44) + mem_start,
-				(u64)mem_size << 20, BOOT_MEM_RAM);
 			memblock_add_node(PFN_PHYS(start_pfn),
 				PFN_PHYS(end_pfn - start_pfn), node);
 			break;
 		case SYSTEM_RAM_RESERVED:
 			pr_info("Node%d: mem_type:%d, mem_start:0x%llx, mem_size:0x%llx MB\n",
 				(u32)node_id, mem_type, mem_start, mem_size);
-			add_memory_region((node_id << 44) + mem_start,
-				(u64)mem_size << 20, BOOT_MEM_RESERVED);
+			memblock_add_node(PFN_PHYS(start_pfn),
+				PFN_PHYS(end_pfn - start_pfn), node);
 			memblock_reserve(((node_id << 44) + mem_start),
 				mem_size << 20);
 			break;