Subject: Re: [linux-next] Build failure drivers/cxl/cxl_pmem (powerpc)

From: Michael Ellerman <[email-masked]>
Date: Fri, 29 Jul 2022 16:17:27 +1000

Sachin Sant <[email-masked]> writes:
> Linux-next (5.19.0-rc8-next-20220728) fails to build on powerpc with
> following error:
>
> ERROR: modpost: "memory_add_physaddr_to_nid" [drivers/cxl/cxl_pmem.ko] undefined!
> make[1]: *** [scripts/Makefile.modpost:128: modules-only.symvers] Error 1
>
> The code in question was last changed by following patch:
>
> commit 04ad63f086d1
>        cxl/region: Introduce cxl_pmem_region objects

This should fix it.

Dan, do you want to apply that on top of your tree to reduce the window
of breakage?

cheers

>From 8ca5b098b6ff1048953be748dbffc987996e2605 Mon Sep 17 00:00:00 2001
From: Michael Ellerman <[email-masked]>
Date: Fri, 29 Jul 2022 16:13:55 +1000
Subject: [PATCH] powerpc/mm: Export memory_add_physaddr_to_nid() for modules

The cxl_pmem module wants to call memory_add_physaddr_to_nid(), so
export the symbol.

Fixes: 04ad63f086d1 ("cxl/region: Introduce cxl_pmem_region objects")
Reported-by: Sachin Sant <[email-masked]>
Signed-off-by: Michael Ellerman <[email-masked]>
---
 arch/powerpc/mm/mem.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
index 7b0d286bf9ba..01772e79fd93 100644
--- a/arch/powerpc/mm/mem.c
+++ b/arch/powerpc/mm/mem.c
@@ -55,6 +55,7 @@ int memory_add_physaddr_to_nid(u64 start)
 {
 	return hot_add_scn_to_nid(start);
 }
+EXPORT_SYMBOL_GPL(memory_add_physaddr_to_nid);
 #endif
 
 int __weak create_section_mapping(unsigned long start, unsigned long end,
-- 
2.35.3