powerpc/kexec_file: fix implicit decl error

Message ID 20230204172206.7662-1-rdunlap@infradead.org
State New
Headers
Series powerpc/kexec_file: fix implicit decl error |

Commit Message

Randy Dunlap Feb. 4, 2023, 5:22 p.m. UTC
  kexec (PPC64) code calls memory_hotplug_max(). Add the header declaration
for it from <asm/mmzone.h>. Using <linux/mmzone.h> does not work since
the #include for <asm/mmzone.h> depends on CONFIG_NUMA=y, which is not
set in this kernel config file.

Fixes this build error/warning:

../arch/powerpc/kexec/file_load_64.c: In function 'kexec_extra_fdt_size_ppc64':
../arch/powerpc/kexec/file_load_64.c:993:33: error: implicit declaration of function 'memory_hotplug_max' [-Werror=implicit-function-declaration]
  993 |                 usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) +
      |                                 ^~~~~~~~~~~~~~~~~~

Fixes: fc546faa5595 ("powerpc/kexec_file: Count hot-pluggable memory in FDT estimate")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org
---
 arch/powerpc/kexec/file_load_64.c |    1 +
 1 file changed, 1 insertion(+)
  

Comments

Sourabh Jain Feb. 5, 2023, 1:50 p.m. UTC | #1
On 04/02/23 22:52, Randy Dunlap wrote:
> kexec (PPC64) code calls memory_hotplug_max(). Add the header declaration
> for it from <asm/mmzone.h>. Using <linux/mmzone.h> does not work since
> the #include for <asm/mmzone.h> depends on CONFIG_NUMA=y, which is not
> set in this kernel config file.

I didn't realize that linux/mmzone.h includes asm/mmzone.h under 
CONFIG_NUMA.

from linux/mmzone.h

#else /* CONFIG_NUMA */

#include <asm/mmzone.h>

#endif /* !CONFIG_NUMA */

>
> Fixes this build error/warning:
>
> ../arch/powerpc/kexec/file_load_64.c: In function 'kexec_extra_fdt_size_ppc64':
> ../arch/powerpc/kexec/file_load_64.c:993:33: error: implicit declaration of function 'memory_hotplug_max' [-Werror=implicit-function-declaration]
>    993 |                 usm_entries = ((memory_hotplug_max() / drmem_lmb_size()) +
>        |                                 ^~~~~~~~~~~~~~~~~~
>
> Fixes: fc546faa5595 ("powerpc/kexec_file: Count hot-pluggable memory in FDT estimate")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: linuxppc-dev@lists.ozlabs.org
> ---
>   arch/powerpc/kexec/file_load_64.c |    1 +
>   1 file changed, 1 insertion(+)
>
> diff -- a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
> --- a/arch/powerpc/kexec/file_load_64.c
> +++ b/arch/powerpc/kexec/file_load_64.c
> @@ -26,6 +26,7 @@
>   #include <asm/firmware.h>
>   #include <asm/kexec_ranges.h>
>   #include <asm/crashdump-ppc64.h>
> +#include <asm/mmzone.h>

Yes including the asm/mmzone.h will fix the build issue.

- Sourabh

>   #include <asm/prom.h>
>   
>   struct umem_info {
  
Michael Ellerman Feb. 15, 2023, 12:16 p.m. UTC | #2
On Sat, 4 Feb 2023 09:22:06 -0800, Randy Dunlap wrote:
> kexec (PPC64) code calls memory_hotplug_max(). Add the header declaration
> for it from <asm/mmzone.h>. Using <linux/mmzone.h> does not work since
> the #include for <asm/mmzone.h> depends on CONFIG_NUMA=y, which is not
> set in this kernel config file.
> 
> Fixes this build error/warning:
> 
> [...]

Applied to powerpc/fixes.

[1/1] powerpc/kexec_file: fix implicit decl error
      https://git.kernel.org/powerpc/c/97e45d469eb180a7bd2809e4e079331552c73e42

cheers
  

Patch

diff -- a/arch/powerpc/kexec/file_load_64.c b/arch/powerpc/kexec/file_load_64.c
--- a/arch/powerpc/kexec/file_load_64.c
+++ b/arch/powerpc/kexec/file_load_64.c
@@ -26,6 +26,7 @@ 
 #include <asm/firmware.h>
 #include <asm/kexec_ranges.h>
 #include <asm/crashdump-ppc64.h>
+#include <asm/mmzone.h>
 #include <asm/prom.h>
 
 struct umem_info {