Bug 215567

Summary: build failure when PPC_64S_HASH_MMU=n is selected in kernel .config
Product: Platform Specific/Hardware Reporter: Erhard F. (erhard_f)
Component: PPC-64Assignee: platform_ppc-64
Status: RESOLVED CODE_FIX    
Severity: normal CC: christophe.leroy, mopsfelder
Priority: P1    
Hardware: PPC-64   
OS: Linux   
Kernel Version: 5.17-rc2 Subsystem:
Regression: No Bisected commit-id:
Attachments: kernel .config (kernel 5.17-rc2, Talos II)

Description Erhard F. 2022-02-04 13:00:35 UTC
Created attachment 300391 [details]
kernel .config (kernel 5.17-rc2, Talos II)

[...]
  CC      arch/powerpc/kernel/stacktrace.o
  CC      arch/powerpc/kernel/setup_64.o
arch/powerpc/kernel/setup_64.c: In function 'setup_per_cpu_areas':
arch/powerpc/kernel/setup_64.c:811:21: error: 'mmu_linear_psize' undeclared (first use in this function); did you mean 'mmu_virtual_psize'?
  811 |                 if (mmu_linear_psize == MMU_PAGE_4K)
      |                     ^~~~~~~~~~~~~~~~
      |                     mmu_virtual_psize
arch/powerpc/kernel/setup_64.c:811:21: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [scripts/Makefile.build:288: arch/powerpc/kernel/setup_64.o] Fehler 1

Got this with PPC_64S_HASH_MMU=n on my Talos II. When PPC_64S_HASH_MMU is enabled the kernel builds ok.
Comment 1 Murilo Opsfelder Araújo 2022-03-01 17:20:59 UTC
Hi, Erhard.

Thanks for reporting the issue.
I've sent a fix proposal for this:

https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-March/240698.html

Please let me know if the proposed fix worked for you.
You can reply here on Bugzilla or to the list with your 'Tested-by:' tag.

Thank you!
Murilo
Comment 2 Erhard F. 2022-03-01 18:42:51 UTC
I just tested your patch top of 5.17-rc5. It applies and build continues but fails later with:

[...]
  CC      lib/asn1_decoder.o
  GEN     lib/oid_registry_data.c
  CC      lib/oid_registry.o
  CC      lib/ubsan.o
  CC      lib/sbitmap.o
  AR      lib/built-in.a
  CC [M]  lib/crc-ccitt.o
  CC [M]  lib/crc-itu-t.o
  GEN     .version
  CHK     include/generated/compile.h
  LD      vmlinux.o
  MODPOST vmlinux.symvers
  MODINFO modules.builtin.modinfo
  GEN     modules.builtin
  LD      .tmp_vmlinux.kallsyms1
ld: arch/powerpc/kexec/file_load_64.o: in function `.arch_kexec_kernel_image_probe':
file_load_64.c:(.text+0x1be8): undefined reference to `.add_htab_mem_range'
make: *** [Makefile:1155: vmlinux] Error 1
Comment 3 Christophe Leroy 2022-03-01 19:57:13 UTC
For this linking error, in arch/powerpc/include/asm/kexec_ranges.h change the #ifdef to CONFIG_PPC_64S_HASH_MMU instead of CONFIG_PPC_BOOK3S_64 and it should build.
Comment 4 Murilo Opsfelder Araújo 2022-03-01 20:52:56 UTC
Erhard, would you mind trying the v2?

https://lists.ozlabs.org/pipermail/linuxppc-dev/2022-March/240715.html

Christophe, thanks for the suggestion.  That's exactly what I did in the v2.
Comment 5 Erhard F. 2022-03-01 22:30:09 UTC
Your 2nd patch solved the issue. Thanks Murilo!

Build completes and the Talos boots fine into the patched 5.17-rc5.
Comment 6 Erhard F. 2022-03-12 13:22:51 UTC
5.17-rc7 builds fine again as the patch got included meanwhile.

Closing.