Re: [PATCH v3 3/6] powerpc/fsl_booke/64: implement KASLR for fsl_booke64

From: Christophe Leroy
Date: Wed Feb 26 2020 - 00:10:33 EST




Le 26/02/2020 Ã 04:33, Jason Yan a ÃcritÂ:


å 2020/2/26 10:40, Jason Yan åé:


å 2020/2/20 21:48, Christophe Leroy åé:


Le 06/02/2020 Ã 03:58, Jason Yan a ÃcritÂ:
Hi Christophe,

When using a standard C if/else, all code compiled for PPC32 and PPC64, but this will bring some build error because not all variables both defined for PPC32 and PPC64.

[yanaijie@138 linux]$ sh ppc64build.sh
 CALL scripts/atomic/check-atomics.sh
 CALL scripts/checksyscalls.sh
 CHK include/generated/compile.h
 CC arch/powerpc/mm/nohash/kaslr_booke.o
arch/powerpc/mm/nohash/kaslr_booke.c: In function 'kaslr_choose_location':
arch/powerpc/mm/nohash/kaslr_booke.c:341:30: error: 'CONFIG_LOWMEM_CAM_NUM' undeclared (first use in this function); did you mean 'CONFIG_FLATMEM_MANUAL'?
ÂÂ ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true);
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ ^~~~~~~~~~~~~~~~~~~~~
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ CONFIG_FLATMEM_MANUAL

This one has to remain inside an #ifdef. That's the only one that has to remain.

arch/powerpc/mm/nohash/kaslr_booke.c:341:30: note: each undeclared identifier is reported only once for each function it appears in
arch/powerpc/mm/nohash/kaslr_booke.c: In function 'kaslr_early_init':
arch/powerpc/mm/nohash/kaslr_booke.c:404:3: error: 'is_second_reloc'

In mmu_decl.h, put the declaration outside the #ifdef CONFIG_PPC32

undeclared (first use in this function); did you mean '__cond_lock'?
ÂÂ is_second_reloc = 1;
ÂÂ ^~~~~~~~~~~~~~~
ÂÂ __cond_lock
arch/powerpc/mm/nohash/kaslr_booke.c:411:4: error: implicit declaration of function 'create_kaslr_tlb_entry'; did you mean 'reloc_kernel_entry'?

Same, put the declaration outside of the #ifdef

[-Werror=implicit-function-declaration]
ÂÂÂ create_kaslr_tlb_entry(1, tlb_virt, tlb_phys);
ÂÂÂ ^~~~~~~~~~~~~~~~~~~~~~
ÂÂÂ reloc_kernel_entry
cc1: all warnings being treated as errors
make[3]: *** [scripts/Makefile.build:268: arch/powerpc/mm/nohash/kaslr_booke.o] Error 1
make[2]: *** [scripts/Makefile.build:505: arch/powerpc/mm/nohash] Error 2
make[1]: *** [scripts/Makefile.build:505: arch/powerpc/mm] Error 2
make: *** [Makefile:1681: arch/powerpc] Error 2

See the patch I sent you. It builds ok for me.

Christophe