diff mbox series

[5/5] powerpc/64s: Fix CONFIG_NUMA=n build

Message ID 20231129131919.2528517-5-mpe@ellerman.id.au (mailing list archive)
State Accepted
Commit ede66cd22441820cbd399936bf84fdc4294bc7fa
Headers show
Series [1/5] powerpc/suspend: Add prototype for do_after_copyback() | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 8 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.

Commit Message

Michael Ellerman Nov. 29, 2023, 1:19 p.m. UTC
With CONFIG_NUMA=n the build fails with:

  arch/powerpc/mm/book3s64/pgtable.c:275:15: error: no previous prototype for ‘create_section_mapping’ [-Werror=missing-prototypes]
  275 | int __meminit create_section_mapping(unsigned long start, unsigned long end,
      |               ^~~~~~~~~~~~~~~~~~~~~~

That happens because the prototype for create_section_mapping() is in
asm/mmzone.h, but asm/mmzone.h is only included by linux/mmzone.h
when CONFIG_NUMA=y.

In fact the prototype is only needed by arch/powerpc/mm code, so move
the prototype into arch/powerpc/mm/mmu_decl.h, which also fixes the
build error.

Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/include/asm/mmzone.h | 5 -----
 arch/powerpc/mm/mmu_decl.h        | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)

Comments

Arnd Bergmann Nov. 29, 2023, 1:25 p.m. UTC | #1
On Wed, Nov 29, 2023, at 14:19, Michael Ellerman wrote:
> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
> index 7f9ff0640124..72341b9fb552 100644
> --- a/arch/powerpc/mm/mmu_decl.h
> +++ b/arch/powerpc/mm/mmu_decl.h
> +
> +#ifdef CONFIG_MEMORY_HOTPLUG
> +int create_section_mapping(unsigned long start, unsigned long end,
> +			   int nid, pgprot_t prot);
> +#endif

This one should probably go next to the remove_section_mapping()
declaration in arch/powerpc/include/asm/sparsemem.h for consistency.

I would personally remove the #ifdef as well, but there is
already one in that file.

     Arnd
Michael Ellerman Nov. 30, 2023, 6:43 a.m. UTC | #2
"Arnd Bergmann" <arnd@arndb.de> writes:
> On Wed, Nov 29, 2023, at 14:19, Michael Ellerman wrote:
>> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
>> index 7f9ff0640124..72341b9fb552 100644
>> --- a/arch/powerpc/mm/mmu_decl.h
>> +++ b/arch/powerpc/mm/mmu_decl.h
>> +
>> +#ifdef CONFIG_MEMORY_HOTPLUG
>> +int create_section_mapping(unsigned long start, unsigned long end,
>> +			   int nid, pgprot_t prot);
>> +#endif
>
> This one should probably go next to the remove_section_mapping()
> declaration in arch/powerpc/include/asm/sparsemem.h for consistency.
 
That doesn't work due to:

In file included from ../include/linux/numa.h:26,
                 from ../include/linux/async.h:13,
                 from ../init/initramfs.c:3:
../arch/powerpc/include/asm/sparsemem.h:19:44: error: unknown type name ‘pgprot_t’
   19 |                                   int nid, pgprot_t prot);
      |                                            ^~~~~~~~

Which might be fixable, but I'd rather just move
remove_section_mapping() into mmu_decl.h as well.

cheers
Arnd Bergmann Nov. 30, 2023, 8:07 a.m. UTC | #3
On Thu, Nov 30, 2023, at 07:43, Michael Ellerman wrote:
> "Arnd Bergmann" <arnd@arndb.de> writes:
>> On Wed, Nov 29, 2023, at 14:19, Michael Ellerman wrote:
>>> diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
>>> index 7f9ff0640124..72341b9fb552 100644
>>> --- a/arch/powerpc/mm/mmu_decl.h
>>> +++ b/arch/powerpc/mm/mmu_decl.h
>>> +
>>> +#ifdef CONFIG_MEMORY_HOTPLUG
>>> +int create_section_mapping(unsigned long start, unsigned long end,
>>> +			   int nid, pgprot_t prot);
>>> +#endif
>>
>> This one should probably go next to the remove_section_mapping()
>> declaration in arch/powerpc/include/asm/sparsemem.h for consistency.
> 
> That doesn't work due to:
>
> In file included from ../include/linux/numa.h:26,
>                  from ../include/linux/async.h:13,
>                  from ../init/initramfs.c:3:
> ../arch/powerpc/include/asm/sparsemem.h:19:44: error: unknown type name 
> ‘pgprot_t’
>    19 |                                   int nid, pgprot_t prot);
>       |                                            ^~~~~~~~
>
> Which might be fixable, but I'd rather just move
> remove_section_mapping() into mmu_decl.h as well.

Ok, makes sense.

     Arnd
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index 4c6c6dbd182f..4740ca230d36 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -46,10 +46,5 @@  u64 memory_hotplug_max(void);
 #define __HAVE_ARCH_RESERVED_KERNEL_PAGES
 #endif
 
-#ifdef CONFIG_MEMORY_HOTPLUG
-extern int create_section_mapping(unsigned long start, unsigned long end,
-				  int nid, pgprot_t prot);
-#endif
-
 #endif /* __KERNEL__ */
 #endif /* _ASM_MMZONE_H_ */
diff --git a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
index 7f9ff0640124..72341b9fb552 100644
--- a/arch/powerpc/mm/mmu_decl.h
+++ b/arch/powerpc/mm/mmu_decl.h
@@ -181,3 +181,8 @@  static inline bool debug_pagealloc_enabled_or_kfence(void)
 {
 	return IS_ENABLED(CONFIG_KFENCE) || debug_pagealloc_enabled();
 }
+
+#ifdef CONFIG_MEMORY_HOTPLUG
+int create_section_mapping(unsigned long start, unsigned long end,
+			   int nid, pgprot_t prot);
+#endif