Re: [PATCH] powerpc/kexec_file: print error string on usable memory property update failure

2022-12-20 Thread Sourabh Jain



On 19/12/22 14:16, Hari Bathini wrote:



On 16/12/22 5:57 pm, Sourabh Jain wrote:

Print the FDT error description along with the error message if failed
to set the "linux,drconf-usable-memory" property in the kdump kernel's
FDT.

Signed-off-by: Sourabh Jain 


LGTM

Acked-by: Hari Bathini 


Thanks!

- Sourabh Jain


Re: [RFC PATCH] mm: remove zap_page_range and change callers to use zap_vma_page_range

2022-12-20 Thread Michael Ellerman
Mike Kravetz  writes:
> zap_page_range was originally designed to unmap pages within an address
> range that could span multiple vmas.  While working on [1], it was
> discovered that all callers of zap_page_range pass a range entirely within
> a single vma.  In addition, the mmu notification call within zap_page
> range does not correctly handle ranges that span multiple vmas as calls
> should be vma specific.
>
> Instead of fixing zap_page_range, change all callers to use the new
> routine zap_vma_page_range.  zap_vma_page_range is just a wrapper around
> zap_page_range_single passing in NULL zap details.  The name is also
> more in line with other exported routines that operate within a vma.
> We can then remove zap_page_range.
>
> Also, change madvise_dontneed_single_vma to use this new routine.
>
> [1] 
> https://lore.kernel.org/linux-mm/20221114235507.294320-2-mike.krav...@oracle.com/
> Suggested-by: Peter Xu 
> Signed-off-by: Mike Kravetz 
> ---
>  arch/arm64/kernel/vdso.c|  4 ++--
>  arch/powerpc/kernel/vdso.c  |  2 +-
>  arch/powerpc/platforms/book3s/vas-api.c |  2 +-
>  arch/powerpc/platforms/pseries/vas.c|  2 +-
  
Acked-by: Michael Ellerman  (powerpc)

cheers


Re: [PATCH v1 5/5] powerpc/epapr: Don't use wrteei on non booke

2022-12-20 Thread Pali Rohár
On Monday 19 December 2022 19:46:00 Christophe Leroy wrote:
> wrteei is only for booke. Use the standard mfmsr/ori/mtmsr
> when non booke.
> 
> Reported-by: Jan-Benedict Glaw 
> Signed-off-by: Christophe Leroy 
> ---
> Not sure this is needed at all, the commit that introduced the code says it 
> is for e500, but there's no such limitation in Kconfig. Maybe we should limit 
> all the file to CONFIG_PPC_E500

This ePAPR code is according to ePAPR v1.1. So it does not have to be
e500 specific. But is there anything else in this category?

> ---
>  arch/powerpc/kernel/epapr_hcalls.S | 6 ++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/arch/powerpc/kernel/epapr_hcalls.S 
> b/arch/powerpc/kernel/epapr_hcalls.S
> index 69a912550577..033116e465d0 100644
> --- a/arch/powerpc/kernel/epapr_hcalls.S
> +++ b/arch/powerpc/kernel/epapr_hcalls.S
> @@ -21,7 +21,13 @@ _GLOBAL(epapr_ev_idle)
>   ori r4, r4,_TLF_NAPPING /* so when we take an exception */
>   PPC_STL r4, TI_LOCAL_FLAGS(r2)  /* it will return to our caller */
>  
> +#ifdef CONFIG_BOOKE_OR_40x
>   wrteei  1
> +#else
> + mfmsr   r4
> + ori r4, r4, MSR_EE
> + mtmsr   r4
> +#endif
>  
>  idle_loop:
>   LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
> -- 
> 2.38.1
> 


Re: [PATCH v1 4/5] powerpc: Remove cpu-as-y completely

2022-12-20 Thread Pali Rohár
On Monday 19 December 2022 19:45:59 Christophe Leroy wrote:
> cpu-as-y is there to force assembler building options.
> But there is no need for that. Gcc is passed the necessary
> options and it automatically pass the appropriate option to
> GAS.
> 
> GCC is given -maltivec when relevant, so no need
> for -Wa,-maltivec in addition
> 
> And -Wa,-many is wrong as it will hide innapropriate
> instructions. Better to detect them and handle them on a
> case by case basis.
> -Wa,-many was added by commit 960e30029863 ("powerpc/Makefile:
> Fix PPC_BOOK3S_64 ASFLAGS") in order to fix an issue with
> clang and the passed -Wa,-mpower4 option. But we have now
> removed it expecting the compiler to automatically pass the
> proper options and instructions based on -mcpu=power4
> 
> Signed-off-by: Christophe Leroy 

Acked-by: Pali Rohár 

> ---
>  arch/powerpc/Makefile | 12 
>  1 file changed, 12 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index 0f9f291895cb..7e67f939a243 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -201,18 +201,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
>  # often slow when they are implemented at all
>  KBUILD_CFLAGS+= $(call cc-option,-mno-string)
>  
> -cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec)
> -
> -# When using '-many -mpower4' gas will first try and find a matching power4
> -# mnemonic and failing that it will allow any valid mnemonic that GAS knows
> -# about. GCC will pass -many to GAS when assembling, clang does not.
> -# LLVM IAS doesn't understand either flag: 
> https://github.com/ClangBuiltLinux/linux/issues/675
> -# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
> -cpu-as-$(CONFIG_PPC_BOOK3S_64)   += $(call as-option,-Wa$(comma)-many)
> -
> -KBUILD_AFLAGS += $(cpu-as-y)
> -KBUILD_CFLAGS += $(cpu-as-y)
> -
>  KBUILD_AFLAGS += $(aflags-y)
>  KBUILD_CFLAGS += $(cflags-y)
>  
> -- 
> 2.38.1
> 


Re: [PATCH v1 3/5] powerpc/64: Replace -mcpu=e500mc64 by -mcpu=e5500

2022-12-20 Thread Pali Rohár
On Monday 19 December 2022 19:45:58 Christophe Leroy wrote:
> E500MC64 is a processor pre-dating E5500 that has never been
> commercialised. Use -mcpu=e5500 for E5500 core.
> 
> More details at https://gcc.gnu.org/PR108149
> 
> Signed-off-by: Christophe Leroy 

Acked-by: Pali Rohár 

> ---
>  arch/powerpc/platforms/Kconfig.cputype | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/Kconfig.cputype 
> b/arch/powerpc/platforms/Kconfig.cputype
> index 31cea2eeb59e..29d6be033576 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -249,7 +249,7 @@ config TARGET_CPU
>   default "power8" if POWER8_CPU
>   default "power9" if POWER9_CPU
>   default "power10" if POWER10_CPU
> - default "e500mc64" if E5500_CPU
> + default "e5500" if E5500_CPU
>   default "e6500" if E6500_CPU
>   default "power4" if POWERPC64_CPU && !CPU_LITTLE_ENDIAN
>   default "power8" if POWERPC64_CPU && CPU_LITTLE_ENDIAN
> -- 
> 2.38.1
> 


Re: [PATCH v1 2/5] powerpc: Pass correct CPU reference to assembler

2022-12-20 Thread Pali Rohár
On Monday 19 December 2022 19:45:57 Christophe Leroy wrote:
> Jan-Benedict reported issue with building ppc64e_defconfig
> with mainline GCC work:
> 
>   powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d 
> -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
> -I./include -I./arch/powerpc/include/uapi 
> -I./arch/powerpc/include/generated/uapi -I./include/uapi 
> -I./include/generated/uapi -include ./include/linux/compiler-version.h 
> -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc 
> -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 
> -Wl,-a64 -mabi=elfv1 -Wa,-me500 -Wa,-me500mc -mabi=elfv1 -mbig-endian
> -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o 
> arch/powerpc/kernel/vdso/gettimeofday-64.o 
> arch/powerpc/kernel/vdso/gettimeofday.S
>   arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
>   arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
> `stdu'
>   arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
> `stdu'
>   arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
> `std'
>   arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
> `std'
>   arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
> `ld'
>   arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
> `ld'
>   ...
>   make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: 
> arch/powerpc/kernel/vdso/gettimeofday-64.o] Error 1
>   make: *** [arch/powerpc/Makefile:387: vdso_prepare] Error 2
> 
> This is due to assembler being called with -me500mc which is
> a 32 bits target.
> 
> The problem comes from the fact that CONFIG_PPC_E500MC is selected for
> both the e500mc (32 bits) and the e5500 (64 bits), and therefore the
> following makefile rule is wrong:
> 
>   cpu-as-$(CONFIG_PPC_E500MC)+= $(call as-option,-Wa$(comma)-me500mc)
> 
> Today we have CONFIG_TARGET_CPU which provides the identification of the
> expected CPU, it is used for GCC. Once GCC knows the target CPU, it adds
> the correct CPU option to assembler, no need to add it explicitely.
> 
> With that change (And also commit 825eada7717c ("powerpc/64: Set
> default CPU in Kconfig")), it now is:
> 
>   powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d 
> -nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
> -I./include -I./arch/powerpc/include/uapi 
> -I./arch/powerpc/include/generated/uapi -I./include/uapi 
> -I./include/generated/uapi -include ./include/linux/compiler-version.h 
> -include ./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc 
> -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 
> -Wl,-a64 -mabi=elfv1 -mcpu=e500mc64 -mabi=elfv1 -mbig-endian
> -Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o 
> arch/powerpc/kernel/vdso/gettimeofday-64.o 
> arch/powerpc/kernel/vdso/gettimeofday.S
> 
> Reported-by: Jan-Benedict Glaw 
> Signed-off-by: Christophe Leroy 

Acked-by: Pali Rohár 

> ---
> v3: Remove -Wa,-mXXX completery as there are additional mismatches between 
> -mcpu and -Wa-m (eg: 8540 vs e500). When given the proper -mcpu=, GCC gives 
> the correct option to assembler.
> 
> v2: When target cpu is powerpc, the option to be used is -mppc
> 
> Commit 825eada7717c is in powerpc/next-test branch. Make sure the SHA doesn't 
> change when it goes into powerpc/next
> ---
>  arch/powerpc/Makefile | 6 +-
>  1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index bf5f0a998273..0f9f291895cb 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -201,18 +201,14 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
>  # often slow when they are implemented at all
>  KBUILD_CFLAGS+= $(call cc-option,-mno-string)
>  
> -cpu-as-$(CONFIG_40x) += -Wa,-m405
> -cpu-as-$(CONFIG_44x) += -Wa,-m440
>  cpu-as-$(CONFIG_ALTIVEC) += $(call as-option,-Wa$(comma)-maltivec)
> -cpu-as-$(CONFIG_PPC_E500)+= -Wa,-me500
>  
>  # When using '-many -mpower4' gas will first try and find a matching power4
>  # mnemonic and failing that it will allow any valid mnemonic that GAS knows
>  # about. GCC will pass -many to GAS when assembling, clang does not.
>  # LLVM IAS doesn't understand either flag: 
> https://github.com/ClangBuiltLinux/linux/issues/675
>  # but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
> -cpu-as-$(CONFIG_PPC_BOOK3S_64)   += $(call 
> as-option,-Wa$(comma)-mpower4) $(call as-option,-Wa$(comma)-many)
> -cpu-as-$(CONFIG_PPC_E500MC)  += $(call as-option,-Wa$(comma)-me500mc)
> +cpu-as-$(CONFIG_PPC_BOOK3S_64)   += $(call as-option,-Wa$(comma)-many)
>  
>  KBUILD_AFLAGS += $(cpu-as-y)
>  KBUILD_CFLAGS += $(cpu-as-y)
> -- 
> 2.38.1
> 


Re: [PATCH v1 1/5] powerpc/64: Set default CPU in Kconfig

2022-12-20 Thread Pali Rohár
On Monday 19 December 2022 19:45:56 Christophe Leroy wrote:
> Since 0069f3d14e7a ("powerpc/64e: Tie PPC_BOOK3E_64 to PPC_E500MC"), the
> only possible BOOK3E/64 are E500, so no need of a default CPU over the
> E5500.
> 
> When the user selects book3e, they must have an e500 compatible
> compiler, and it won't work anymore with the default -mcpu=power64, see
> commit d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
> (unrecognized opcode: `wrteei')").
> 
> For book3s/64, replace GENERIC_CPU by POWERPC64_CPU to match the PPC32
> POWERPC_CPU, and set a default mpcu value in Kconfig directly.
> 
> When a user selects a particular CPU, they must ensure the compiler has
> the requested capability. Therefore, remove hidden fallback, instead
> offer user the possibility to say they want to use the toolchain
> default.
> 
> It also fixes the non existing E5500_CPU which is a leftover of
> commit d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
> (unrecognized opcode: `wrteei')")
> 
> Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12 
> (unrecognized opcode: `wrteei')")
> Reported-by: Pali Rohár 
> Tested-by: Pali Rohár 
> Signed-off-by: Christophe Leroy 

Acked-by: Pali Rohár 

> ---
>  arch/powerpc/Makefile  | 22 +-
>  arch/powerpc/platforms/Kconfig.cputype | 12 +++-
>  2 files changed, 12 insertions(+), 22 deletions(-)
> 
> diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
> index dc4cbf0a5ca9..bf5f0a998273 100644
> --- a/arch/powerpc/Makefile
> +++ b/arch/powerpc/Makefile
> @@ -146,19 +146,6 @@ CFLAGS-$(CONFIG_PPC32)   += $(call cc-option, 
> $(MULTIPLEWORD))
>  
>  CFLAGS-$(CONFIG_PPC32)   += $(call cc-option,-mno-readonly-in-sdata)
>  
> -ifdef CONFIG_PPC_BOOK3S_64
> -ifdef CONFIG_CPU_LITTLE_ENDIAN
> -CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
> -else
> -CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
> -endif
> -CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power10, \
> -   $(call cc-option,-mtune=power9,   \
> -   $(call cc-option,-mtune=power8)))
> -else ifdef CONFIG_PPC_BOOK3E_64
> -CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
> -endif
> -
>  ifdef CONFIG_FUNCTION_TRACER
>  CC_FLAGS_FTRACE := -pg
>  ifdef CONFIG_MPROFILE_KERNEL
> @@ -166,11 +153,12 @@ CC_FLAGS_FTRACE += -mprofile-kernel
>  endif
>  endif
>  
> -CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call 
> cc-option,-mcpu=$(CONFIG_TARGET_CPU))
> -AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call 
> cc-option,-mcpu=$(CONFIG_TARGET_CPU))
> +CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
> +AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
>  
> -CFLAGS-$(CONFIG_E5500_CPU) += $(call 
> cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
> -CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
> +CFLAGS-$(CONFIG_POWERPC64_CPU) += $(call cc-option,-mtune=power10,   \
> +   $(call cc-option,-mtune=power9,   \
> +   $(call cc-option,-mtune=power8)))
>  
>  asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
>  
> diff --git a/arch/powerpc/platforms/Kconfig.cputype 
> b/arch/powerpc/platforms/Kconfig.cputype
> index 9563336e3348..31cea2eeb59e 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -118,19 +118,18 @@ endchoice
>  
>  choice
>   prompt "CPU selection"
> - default GENERIC_CPU
>   help
> This will create a kernel which is optimised for a particular CPU.
> The resulting kernel may not run on other CPUs, so use this with care.
>  
> If unsure, select Generic.
>  
> -config GENERIC_CPU
> +config POWERPC64_CPU
>   bool "Generic (POWER5 and PowerPC 970 and above)"
>   depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
>   select PPC_64S_HASH_MMU
>  
> -config GENERIC_CPU
> +config POWERPC64_CPU
>   bool "Generic (POWER8 and above)"
>   depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
>   select ARCH_HAS_FAST_MULTIPLIER
> @@ -233,13 +232,12 @@ config E500MC_CPU
>  
>  config TOOLCHAIN_DEFAULT_CPU
>   bool "Rely on the toolchain's implicit default CPU"
> - depends on PPC32
>  
>  endchoice
>  
>  config TARGET_CPU_BOOL
>   bool
> - default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU
> + default !TOOLCHAIN_DEFAULT_CPU
>  
>  config TARGET_CPU
>   string
> @@ -251,6 +249,10 @@ config TARGET_CPU
>   default "power8" if POWER8_CPU
>   default "power9" if POWER9_CPU
>   default "power10" if POWER10_CPU
> + default "e500mc64" if E5500_CPU
> + default "e6500" if E6500_CPU
> + default "power4" if POWERPC64_CPU && !CPU_LITTLE_ENDIAN
> + default "power8" if POWERPC64_CPU && CPU_LITTLE_ENDIAN
>   default "405" if 405_CPU
>   default "440" if 440_CPU
>   default "464" if 464_CPU
> -- 
> 2.38.1
> 


Re: [PATCH v12 0/6] implement getrandom() in vDSO

2022-12-20 Thread Eric Biggers
On Tue, Dec 20, 2022 at 05:17:52PM +, Christophe Leroy wrote:
> Hi Jason,
> 
> Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> > Changes v11->v12:
> > 
> > - In order to avoid mlock()ing pages, and the related rlimit and fork
> >inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
> >while meeting the cache-like requirements of vDSO getrandom().
> > 
> >This has some tenticles in mm/ and arch/x86/ code, so I've marked the
> >two patches for that as still RFC, while the rest of the series is not
> >RFC.
> > 
> > - Mandate that opaque state blobs don't straddle page boundaries, so
> >that VM_DROPPABLE can work on page-level granularity rather than
> >allocation-level granularity.
> > 
> > - Add compiler barriers to vDSO getrandom() to prevent theoretical
> >reordering potential.
> > 
> > - Initialize the trials loop counter in the chacha test.
> 
> I would have liked to give it a try on powerpc, but the series 
> conflicts. I tried both on v6.1 and on linus/master from now:
> 

Same here, I can't figure out how to apply this series.

It would help if people always used the --base option to git format-patch...

- Eric


Re: [RFC PATCH] mm: remove zap_page_range and change callers to use zap_vma_page_range

2022-12-20 Thread Peter Xu
On Fri, Dec 16, 2022 at 11:20:12AM -0800, Mike Kravetz wrote:
> zap_page_range was originally designed to unmap pages within an address
> range that could span multiple vmas.  While working on [1], it was
> discovered that all callers of zap_page_range pass a range entirely within
> a single vma.  In addition, the mmu notification call within zap_page
> range does not correctly handle ranges that span multiple vmas as calls
> should be vma specific.
> 
> Instead of fixing zap_page_range, change all callers to use the new
> routine zap_vma_page_range.  zap_vma_page_range is just a wrapper around
> zap_page_range_single passing in NULL zap details.  The name is also
> more in line with other exported routines that operate within a vma.
> We can then remove zap_page_range.
> 
> Also, change madvise_dontneed_single_vma to use this new routine.
> 
> [1] 
> https://lore.kernel.org/linux-mm/20221114235507.294320-2-mike.krav...@oracle.com/
> Suggested-by: Peter Xu 
> Signed-off-by: Mike Kravetz 

Acked-by: Peter Xu 

Thanks!

-- 
Peter Xu



Re: [PATCH v12 0/6] implement getrandom() in vDSO

2022-12-20 Thread Christophe Leroy
Hi Jason,

Le 12/12/2022 à 19:53, Jason A. Donenfeld a écrit :
> Changes v11->v12:
> 
> - In order to avoid mlock()ing pages, and the related rlimit and fork
>inheritance issues there, Introduce VM_DROPPABLE to prevent swapping
>while meeting the cache-like requirements of vDSO getrandom().
> 
>This has some tenticles in mm/ and arch/x86/ code, so I've marked the
>two patches for that as still RFC, while the rest of the series is not
>RFC.
> 
> - Mandate that opaque state blobs don't straddle page boundaries, so
>that VM_DROPPABLE can work on page-level granularity rather than
>allocation-level granularity.
> 
> - Add compiler barriers to vDSO getrandom() to prevent theoretical
>reordering potential.
> 
> - Initialize the trials loop counter in the chacha test.

I would have liked to give it a try on powerpc, but the series 
conflicts. I tried both on v6.1 and on linus/master from now:

--

$ LANG= git reset --hard linus/master
HEAD is now at b6bb9676f216 Merge tag 'm68knommu-for-v6.2' of 
git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu

$ LANG= git am -3 ~/Téléchargements/implement-getrandom-in-vDSO.patch
Applying: mm: add VM_DROPPABLE for designating always lazily freeable 
mappings
Using index info to reconstruct a base tree...
M   fs/proc/task_mmu.c
M   include/linux/mm.h
M   include/trace/events/mmflags.h
M   mm/Kconfig
M   mm/memory.c
M   mm/mprotect.c
M   mm/rmap.c
Falling back to patching base and 3-way merge...
Auto-merging mm/rmap.c
CONFLICT (content): Merge conflict in mm/rmap.c
Auto-merging mm/mprotect.c
Auto-merging mm/memory.c
Auto-merging mm/Kconfig
Auto-merging include/trace/events/mmflags.h
Auto-merging include/linux/mm.h
Auto-merging fs/proc/task_mmu.c
error: Failed to merge in the changes.
Patch failed at 0001 mm: add VM_DROPPABLE for designating always lazily 
freeable mappings
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
[chleroy@PO20335 linux-powerpc]$ git diff
diff --cc mm/rmap.c
index b616870a09be,9fabd7affd3a..
--- a/mm/rmap.c
+++ b/mm/rmap.c
@@@ -1291,16 -1256,13 +1291,22 @@@ void page_add_anon_rmap(struct page *pa
   void page_add_new_anon_rmap(struct page *page,
 struct vm_area_struct *vma, unsigned long address)
   {
  -  const bool compound = PageCompound(page);
  -  int nr = compound ? thp_nr_pages(page) : 1;
  +  int nr;

 VM_BUG_ON_VMA(address < vma->vm_start || address >= 
vma->vm_end, vma);
++<<< HEAD
  +  __SetPageSwapBacked(page);
  +
  +  if (likely(!PageCompound(page))) {
  +  /* increment count (starts at -1) */
  +  atomic_set(>_mapcount, 0);
  +  nr = 1;
  +  } else {
++===
+   if (!(vma->vm_flags & VM_DROPPABLE))
+   __SetPageSwapBacked(page);
+   if (compound) {
++>>> mm: add VM_DROPPABLE for designating always lazily freeable 
mappings
 VM_BUG_ON_PAGE(!PageTransHuge(page), page);
 /* increment count (starts at -1) */
 atomic_set(compound_mapcount_ptr(page), 0);

--

$ LANG= git reset --hard v6.1
Updating files: 100% (12634/12634), done.
HEAD is now at 830b3c68c1fb Linux 6.1

$ LANG= git am -3 ~/Téléchargements/implement-getrandom-in-vDSO.patch
Applying: mm: add VM_DROPPABLE for designating always lazily freeable 
mappings
Applying: x86: mm: Skip faulting instruction for VM_DROPPABLE faults
Applying: random: add vgetrandom_alloc() syscall
Using index info to reconstruct a base tree...
M   MAINTAINERS
M   drivers/char/random.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/char/random.c
Auto-merging MAINTAINERS
Applying: arch: allocate vgetrandom_alloc() syscall number
Applying: random: introduce generic vDSO getrandom() implementation
Using index info to reconstruct a base tree...
M   MAINTAINERS
M   drivers/char/random.c
Falling back to patching base and 3-way merge...
Auto-merging drivers/char/random.c
CONFLICT (content): Merge conflict in drivers/char/random.c
Auto-merging MAINTAINERS
error: Failed to merge in the changes.
Patch failed at 0005 random: introduce generic vDSO getrandom() 
implementation
hint: Use 'git am --show-current-patch=diff' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

---

Christophe


Re: [PATCH] tools/objtool: tolerate STT_NOTYPE symbols at end of section

2022-12-20 Thread Christophe Leroy


Le 20/12/2022 à 11:13, Nicholas Piggin a écrit :
> Hand-written asm often contains non-function symbols in executable
> sections. _end symbols for finding the size of instruction blocks
> for runtime processing is one such usage.
> 
> optprobe_template_end is one example that causes the warning:
> 
>objtool: optprobe_template_end(): can't find starting instruction
> 
> This is because the symbol happens to be at the end of the file (and
> therefore end of a section in the object file).
> 
> So ignore end-of-section STT_NOTYPE symbols instead of bailing out
> because an instruction can't be found. While we're here, add a more
> descriptive warning for STT_FUNC symbols found at the end of a
> section.

There's a patch to solve this already as far as I understand. They seem 
different.

See 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20221208072813.25799-1...@linux.ibm.com/

> 
> Signed-off-by: Nicholas Piggin 
> ---
>   tools/objtool/check.c | 9 +
>   1 file changed, 9 insertions(+)
> 
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index 4350be739f4f..4b7c8b33069e 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -427,6 +427,15 @@ static int decode_instructions(struct objtool_file *file)
>   if (func->type != STT_NOTYPE && func->type != STT_FUNC)
>   continue;
>   
> + if (func->offset == sec->sh.sh_size) {
> + /* Heuristic: likely an "end" symbol */
> + if (func->type == STT_NOTYPE)
> + continue;
> + WARN("%s(): STT_FUNC at end of section",
> +  func->name);
> + return -1;
> + }
> +
>   if (func->return_thunk || func->alias != func)
>   continue;
>   


[linux-next:master] BUILD REGRESSION e45fb347b630ee76482fe938ba76cf8eab811290

2022-12-20 Thread kernel test robot
tree/branch: 
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
branch HEAD: e45fb347b630ee76482fe938ba76cf8eab811290  Add linux-next specific 
files for 20221220

Error/Warning reports:

https://lore.kernel.org/oe-kbuild-all/202211242120.mzzvguln-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212020520.0okmino3-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212040713.rvney9e8-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212061455.6ge7y0jg-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212090509.njal9tbo-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212191708.xk9ybj52-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212201859.qugugk1f-...@intel.com
https://lore.kernel.org/oe-kbuild-all/202212202020.ql8aaqu0-...@intel.com

Error/Warning: (recently discovered and may have been fixed)

Documentation/gpu/drm-internals:179: ./include/drm/drm_file.h:411: WARNING: 
undefined label: drm_accel_node (if the link has no caption the label must 
precede a section header)
Documentation/networking/devlink/etas_es58x.rst: WARNING: document isn't 
included in any toctree
Warning: tools/power/cpupower/man/cpupower-powercap-info.1 references a file 
that doesn't exist: Documentation/power/powercap/powercap.txt
arch/arm/kernel/entry-armv.S:485:5: warning: "CONFIG_ARM_THUMB" is not defined, 
evaluates to 0 [-Wundef]
arch/loongarch/kernel/asm-offsets.c:265:6: warning: no previous prototype for 
'output_pbe_defines' [-Wmissing-prototypes]
arch/powerpc/kernel/kvm_emul.o: warning: objtool: kvm_template_end(): can't 
find starting instruction
arch/powerpc/kernel/optprobes_head.o: warning: objtool: 
optprobe_template_end(): can't find starting instruction
drivers/regulator/tps65219-regulator.c:310:32: warning: parameter 'dev' set but 
not used [-Wunused-but-set-parameter]
drivers/regulator/tps65219-regulator.c:310:60: warning: parameter 'dev' set but 
not used [-Wunused-but-set-parameter]
drivers/regulator/tps65219-regulator.c:370:26: warning: ordered comparison of 
pointer with integer zero [-Wextra]
lib/dhry_run.c:61:6: warning: variable 'ret' is used uninitialized whenever 
'if' condition is false [-Wsometimes-uninitialized]
mm/memfd.c:274:31: warning: unused variable 'ns' [-Wunused-variable]

Unverified Error/Warning (likely false positive, please contact us if 
interested):

drivers/accessibility/speakup/main.c:1290:26: sparse: sparse: obsolete array 
initializer, use C99 syntax
drivers/cxl/core/mbox.c:832:18: sparse: sparse: cast from non-scalar
drivers/cxl/core/mbox.c:832:18: sparse: sparse: cast to non-scalar
drivers/i2c/busses/i2c-qcom-geni.c:1028:28: sparse: sparse: symbol 
'i2c_master_hub' was not declared. Should it be static?
drivers/media/platform/ti/davinci/vpif.c:483:20: sparse: sparse: cast from 
non-scalar
drivers/media/platform/ti/davinci/vpif.c:483:20: sparse: sparse: cast to 
non-scalar
fs/xfs/xfs_iomap.c:86:29: sparse: sparse: symbol 'xfs_iomap_page_ops' was not 
declared. Should it be static?

Error/Warning ids grouped by kconfigs:

gcc_recent_errors
|-- alpha-allyesconfig
|   |-- 
drivers-regulator-tps65219-regulator.c:warning:ordered-comparison-of-pointer-with-integer-zero
|   `-- 
drivers-regulator-tps65219-regulator.c:warning:parameter-dev-set-but-not-used
|-- arc-allyesconfig
|   |-- 
drivers-regulator-tps65219-regulator.c:warning:ordered-comparison-of-pointer-with-integer-zero
|   `-- 
drivers-regulator-tps65219-regulator.c:warning:parameter-dev-set-but-not-used
|-- arm-allyesconfig
|   |-- 
drivers-regulator-tps65219-regulator.c:warning:ordered-comparison-of-pointer-with-integer-zero
|   `-- 
drivers-regulator-tps65219-regulator.c:warning:parameter-dev-set-but-not-used
|-- arm-buildonly-randconfig-r005-20221219
|   `-- 
arch-arm-kernel-entry-armv.S:warning:CONFIG_ARM_THUMB-is-not-defined-evaluates-to
|-- arm64-allyesconfig
|   |-- 
drivers-regulator-tps65219-regulator.c:warning:ordered-comparison-of-pointer-with-integer-zero
|   `-- 
drivers-regulator-tps65219-regulator.c:warning:parameter-dev-set-but-not-used
|-- i386-allyesconfig
|   |-- 
drivers-regulator-tps65219-regulator.c:warning:ordered-comparison-of-pointer-with-integer-zero
|   `-- 
drivers-regulator-tps65219-regulator.c:warning:parameter-dev-set-but-not-used
|-- i386-buildonly-randconfig-r001-20221219
|   `-- mm-memfd.c:warning:unused-variable-ns
|-- ia64-allmodconfig
|   |-- 
drivers-regulator-tps65219-regulator.c:warning:ordered-comparison-of-pointer-with-integer-zero
|   `-- 
drivers-regulator-tps65219-regulator.c:warning:parameter-dev-set-but-not-used
|-- loongarch-allyesconfig
|   `-- 
arch-loongarch-kernel-asm-offsets.c:warning:no-previous-prototype-for-output_pbe_defines
|-- loongarch-randconfig-s051-20221218
|   |-- 
drivers-i2c-busses-i2c-qcom-geni.c:sparse:sparse:symbol-i2c_master_hub-was-not-declared.-Should-it-be-static
|   `-- 
fs-xfs-xfs_iomap.c:sparse:sparse:symbol-xfs_iomap_page_ops-was-not-declared.-Should-it-be-static
|-- m68k-al

[PATCH] tools/objtool: tolerate STT_NOTYPE symbols at end of section

2022-12-20 Thread Nicholas Piggin
Hand-written asm often contains non-function symbols in executable
sections. _end symbols for finding the size of instruction blocks
for runtime processing is one such usage.

optprobe_template_end is one example that causes the warning:

  objtool: optprobe_template_end(): can't find starting instruction

This is because the symbol happens to be at the end of the file (and
therefore end of a section in the object file).

So ignore end-of-section STT_NOTYPE symbols instead of bailing out
because an instruction can't be found. While we're here, add a more
descriptive warning for STT_FUNC symbols found at the end of a
section.

Signed-off-by: Nicholas Piggin 
---
 tools/objtool/check.c | 9 +
 1 file changed, 9 insertions(+)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 4350be739f4f..4b7c8b33069e 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -427,6 +427,15 @@ static int decode_instructions(struct objtool_file *file)
if (func->type != STT_NOTYPE && func->type != STT_FUNC)
continue;
 
+   if (func->offset == sec->sh.sh_size) {
+   /* Heuristic: likely an "end" symbol */
+   if (func->type == STT_NOTYPE)
+   continue;
+   WARN("%s(): STT_FUNC at end of section",
+func->name);
+   return -1;
+   }
+
if (func->return_thunk || func->alias != func)
continue;
 
-- 
2.37.2



[PATCH v1 1/5] powerpc/64: Set default CPU in Kconfig

2022-12-20 Thread Christophe Leroy
Since 0069f3d14e7a ("powerpc/64e: Tie PPC_BOOK3E_64 to PPC_E500MC"), the
only possible BOOK3E/64 are E500, so no need of a default CPU over the
E5500.

When the user selects book3e, they must have an e500 compatible
compiler, and it won't work anymore with the default -mcpu=power64, see
commit d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
(unrecognized opcode: `wrteei')").

For book3s/64, replace GENERIC_CPU by POWERPC64_CPU to match the PPC32
POWERPC_CPU, and set a default mpcu value in Kconfig directly.

When a user selects a particular CPU, they must ensure the compiler has
the requested capability. Therefore, remove hidden fallback, instead
offer user the possibility to say they want to use the toolchain
default.

It also fixes the non existing E5500_CPU which is a leftover of
commit d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12
(unrecognized opcode: `wrteei')")

Fixes: d6b551b8f90c ("powerpc/64e: Fix build failure with GCC 12 (unrecognized 
opcode: `wrteei')")
Reported-by: Pali Rohár 
Tested-by: Pali Rohár 
Signed-off-by: Christophe Leroy 
---
 arch/powerpc/Makefile  | 22 +-
 arch/powerpc/platforms/Kconfig.cputype | 12 +++-
 2 files changed, 12 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index dc4cbf0a5ca9..bf5f0a998273 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -146,19 +146,6 @@ CFLAGS-$(CONFIG_PPC32) += $(call cc-option, 
$(MULTIPLEWORD))
 
 CFLAGS-$(CONFIG_PPC32) += $(call cc-option,-mno-readonly-in-sdata)
 
-ifdef CONFIG_PPC_BOOK3S_64
-ifdef CONFIG_CPU_LITTLE_ENDIAN
-CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power8
-else
-CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=power4
-endif
-CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power10,   \
- $(call cc-option,-mtune=power9,   \
- $(call cc-option,-mtune=power8)))
-else ifdef CONFIG_PPC_BOOK3E_64
-CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64
-endif
-
 ifdef CONFIG_FUNCTION_TRACER
 CC_FLAGS_FTRACE := -pg
 ifdef CONFIG_MPROFILE_KERNEL
@@ -166,11 +153,12 @@ CC_FLAGS_FTRACE += -mprofile-kernel
 endif
 endif
 
-CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call 
cc-option,-mcpu=$(CONFIG_TARGET_CPU))
-AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += $(call 
cc-option,-mcpu=$(CONFIG_TARGET_CPU))
+CFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
+AFLAGS-$(CONFIG_TARGET_CPU_BOOL) += -mcpu=$(CONFIG_TARGET_CPU)
 
-CFLAGS-$(CONFIG_E5500_CPU) += $(call cc-option,-mcpu=e500mc64,-mcpu=powerpc64)
-CFLAGS-$(CONFIG_E6500_CPU) += $(call cc-option,-mcpu=e6500,$(E5500_CPU))
+CFLAGS-$(CONFIG_POWERPC64_CPU) += $(call cc-option,-mtune=power10, \
+ $(call cc-option,-mtune=power9,   \
+ $(call cc-option,-mtune=power8)))
 
 asinstr := $(call as-instr,lis 9$(comma)foo@high,-DHAVE_AS_ATHIGH=1)
 
diff --git a/arch/powerpc/platforms/Kconfig.cputype 
b/arch/powerpc/platforms/Kconfig.cputype
index 9563336e3348..31cea2eeb59e 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -118,19 +118,18 @@ endchoice
 
 choice
prompt "CPU selection"
-   default GENERIC_CPU
help
  This will create a kernel which is optimised for a particular CPU.
  The resulting kernel may not run on other CPUs, so use this with care.
 
  If unsure, select Generic.
 
-config GENERIC_CPU
+config POWERPC64_CPU
bool "Generic (POWER5 and PowerPC 970 and above)"
depends on PPC_BOOK3S_64 && !CPU_LITTLE_ENDIAN
select PPC_64S_HASH_MMU
 
-config GENERIC_CPU
+config POWERPC64_CPU
bool "Generic (POWER8 and above)"
depends on PPC_BOOK3S_64 && CPU_LITTLE_ENDIAN
select ARCH_HAS_FAST_MULTIPLIER
@@ -233,13 +232,12 @@ config E500MC_CPU
 
 config TOOLCHAIN_DEFAULT_CPU
bool "Rely on the toolchain's implicit default CPU"
-   depends on PPC32
 
 endchoice
 
 config TARGET_CPU_BOOL
bool
-   default !GENERIC_CPU && !TOOLCHAIN_DEFAULT_CPU
+   default !TOOLCHAIN_DEFAULT_CPU
 
 config TARGET_CPU
string
@@ -251,6 +249,10 @@ config TARGET_CPU
default "power8" if POWER8_CPU
default "power9" if POWER9_CPU
default "power10" if POWER10_CPU
+   default "e500mc64" if E5500_CPU
+   default "e6500" if E6500_CPU
+   default "power4" if POWERPC64_CPU && !CPU_LITTLE_ENDIAN
+   default "power8" if POWERPC64_CPU && CPU_LITTLE_ENDIAN
default "405" if 405_CPU
default "440" if 440_CPU
default "464" if 464_CPU
-- 
2.38.1



[PATCH v1 2/5] powerpc: Pass correct CPU reference to assembler

2022-12-20 Thread Christophe Leroy
Jan-Benedict reported issue with building ppc64e_defconfig
with mainline GCC work:

  powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d 
-nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
-I./include -I./arch/powerpc/include/uapi 
-I./arch/powerpc/include/generated/uapi -I./include/uapi 
-I./include/generated/uapi -include ./include/linux/compiler-version.h -include 
./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 
-fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 
-Wa,-me500 -Wa,-me500mc -mabi=elfv1 -mbig-endian
-Wl,-soname=linux-vdso64.so.1 -D__VDSO64__ -s -c -o 
arch/powerpc/kernel/vdso/gettimeofday-64.o 
arch/powerpc/kernel/vdso/gettimeofday.S
arch/powerpc/kernel/vdso/gettimeofday.S: Assembler messages:
arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
`stdu'
arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
`stdu'
arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
`std'
arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
`std'
arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
`ld'
arch/powerpc/kernel/vdso/gettimeofday.S:72: Error: unrecognized opcode: 
`ld'
...
make[1]: *** [arch/powerpc/kernel/vdso/Makefile:76: 
arch/powerpc/kernel/vdso/gettimeofday-64.o] Error 1
make: *** [arch/powerpc/Makefile:387: vdso_prepare] Error 2

This is due to assembler being called with -me500mc which is
a 32 bits target.

The problem comes from the fact that CONFIG_PPC_E500MC is selected for
both the e500mc (32 bits) and the e5500 (64 bits), and therefore the
following makefile rule is wrong:

  cpu-as-$(CONFIG_PPC_E500MC)+= $(call as-option,-Wa$(comma)-me500mc)

Today we have CONFIG_TARGET_CPU which provides the identification of the
expected CPU, it is used for GCC. Once GCC knows the target CPU, it adds
the correct CPU option to assembler, no need to add it explicitely.

With that change (And also commit 825eada7717c ("powerpc/64: Set
default CPU in Kconfig")), it now is:

  powerpc64-linux-gcc -Wp,-MMD,arch/powerpc/kernel/vdso/.gettimeofday-64.o.d 
-nostdinc -I./arch/powerpc/include -I./arch/powerpc/include/generated  
-I./include -I./arch/powerpc/include/uapi 
-I./arch/powerpc/include/generated/uapi -I./include/uapi 
-I./include/generated/uapi -include ./include/linux/compiler-version.h -include 
./include/linux/kconfig.h -D__KERNEL__ -I ./arch/powerpc -DHAVE_AS_ATHIGH=1 
-fmacro-prefix-map=./= -D__ASSEMBLY__ -fno-PIE -m64 -Wl,-a64 -mabi=elfv1 
-mcpu=e500mc64 -mabi=elfv1 -mbig-endian-Wl,-soname=linux-vdso64.so.1 
-D__VDSO64__ -s -c -o arch/powerpc/kernel/vdso/gettimeofday-64.o 
arch/powerpc/kernel/vdso/gettimeofday.S

Reported-by: Jan-Benedict Glaw 
Signed-off-by: Christophe Leroy 
---
v3: Remove -Wa,-mXXX completery as there are additional mismatches between 
-mcpu and -Wa-m (eg: 8540 vs e500). When given the proper -mcpu=, GCC gives the 
correct option to assembler.

v2: When target cpu is powerpc, the option to be used is -mppc

Commit 825eada7717c is in powerpc/next-test branch. Make sure the SHA doesn't 
change when it goes into powerpc/next
---
 arch/powerpc/Makefile | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index bf5f0a998273..0f9f291895cb 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -201,18 +201,14 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 # often slow when they are implemented at all
 KBUILD_CFLAGS  += $(call cc-option,-mno-string)
 
-cpu-as-$(CONFIG_40x)   += -Wa,-m405
-cpu-as-$(CONFIG_44x)   += -Wa,-m440
 cpu-as-$(CONFIG_ALTIVEC)   += $(call as-option,-Wa$(comma)-maltivec)
-cpu-as-$(CONFIG_PPC_E500)  += -Wa,-me500
 
 # When using '-many -mpower4' gas will first try and find a matching power4
 # mnemonic and failing that it will allow any valid mnemonic that GAS knows
 # about. GCC will pass -many to GAS when assembling, clang does not.
 # LLVM IAS doesn't understand either flag: 
https://github.com/ClangBuiltLinux/linux/issues/675
 # but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
-cpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-mpower4) $(call 
as-option,-Wa$(comma)-many)
-cpu-as-$(CONFIG_PPC_E500MC)+= $(call as-option,-Wa$(comma)-me500mc)
+cpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-many)
 
 KBUILD_AFLAGS += $(cpu-as-y)
 KBUILD_CFLAGS += $(cpu-as-y)
-- 
2.38.1



[PATCH v1 4/5] powerpc: Remove cpu-as-y completely

2022-12-20 Thread Christophe Leroy
cpu-as-y is there to force assembler building options.
But there is no need for that. Gcc is passed the necessary
options and it automatically pass the appropriate option to
GAS.

GCC is given -maltivec when relevant, so no need
for -Wa,-maltivec in addition

And -Wa,-many is wrong as it will hide innapropriate
instructions. Better to detect them and handle them on a
case by case basis.
-Wa,-many was added by commit 960e30029863 ("powerpc/Makefile:
Fix PPC_BOOK3S_64 ASFLAGS") in order to fix an issue with
clang and the passed -Wa,-mpower4 option. But we have now
removed it expecting the compiler to automatically pass the
proper options and instructions based on -mcpu=power4

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/Makefile | 12 
 1 file changed, 12 deletions(-)

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 0f9f291895cb..7e67f939a243 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -201,18 +201,6 @@ KBUILD_CFLAGS += -fno-asynchronous-unwind-tables
 # often slow when they are implemented at all
 KBUILD_CFLAGS  += $(call cc-option,-mno-string)
 
-cpu-as-$(CONFIG_ALTIVEC)   += $(call as-option,-Wa$(comma)-maltivec)
-
-# When using '-many -mpower4' gas will first try and find a matching power4
-# mnemonic and failing that it will allow any valid mnemonic that GAS knows
-# about. GCC will pass -many to GAS when assembling, clang does not.
-# LLVM IAS doesn't understand either flag: 
https://github.com/ClangBuiltLinux/linux/issues/675
-# but LLVM IAS only supports ISA >= 2.06 for Book3S 64 anyway...
-cpu-as-$(CONFIG_PPC_BOOK3S_64) += $(call as-option,-Wa$(comma)-many)
-
-KBUILD_AFLAGS += $(cpu-as-y)
-KBUILD_CFLAGS += $(cpu-as-y)
-
 KBUILD_AFLAGS += $(aflags-y)
 KBUILD_CFLAGS += $(cflags-y)
 
-- 
2.38.1



[PATCH v1 5/5] powerpc/epapr: Don't use wrteei on non booke

2022-12-20 Thread Christophe Leroy
wrteei is only for booke. Use the standard mfmsr/ori/mtmsr
when non booke.

Reported-by: Jan-Benedict Glaw 
Signed-off-by: Christophe Leroy 
---
Not sure this is needed at all, the commit that introduced the code says it is 
for e500, but there's no such limitation in Kconfig. Maybe we should limit all 
the file to CONFIG_PPC_E500
---
 arch/powerpc/kernel/epapr_hcalls.S | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/powerpc/kernel/epapr_hcalls.S 
b/arch/powerpc/kernel/epapr_hcalls.S
index 69a912550577..033116e465d0 100644
--- a/arch/powerpc/kernel/epapr_hcalls.S
+++ b/arch/powerpc/kernel/epapr_hcalls.S
@@ -21,7 +21,13 @@ _GLOBAL(epapr_ev_idle)
ori r4, r4,_TLF_NAPPING /* so when we take an exception */
PPC_STL r4, TI_LOCAL_FLAGS(r2)  /* it will return to our caller */
 
+#ifdef CONFIG_BOOKE_OR_40x
wrteei  1
+#else
+   mfmsr   r4
+   ori r4, r4, MSR_EE
+   mtmsr   r4
+#endif
 
 idle_loop:
LOAD_REG_IMMEDIATE(r11, EV_HCALL_TOKEN(EV_IDLE))
-- 
2.38.1



[PATCH v1 3/5] powerpc/64: Replace -mcpu=e500mc64 by -mcpu=e5500

2022-12-20 Thread Christophe Leroy
E500MC64 is a processor pre-dating E5500 that has never been
commercialised. Use -mcpu=e5500 for E5500 core.

More details at https://gcc.gnu.org/PR108149

Signed-off-by: Christophe Leroy 
---
 arch/powerpc/platforms/Kconfig.cputype | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/Kconfig.cputype 
b/arch/powerpc/platforms/Kconfig.cputype
index 31cea2eeb59e..29d6be033576 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -249,7 +249,7 @@ config TARGET_CPU
default "power8" if POWER8_CPU
default "power9" if POWER9_CPU
default "power10" if POWER10_CPU
-   default "e500mc64" if E5500_CPU
+   default "e5500" if E5500_CPU
default "e6500" if E6500_CPU
default "power4" if POWERPC64_CPU && !CPU_LITTLE_ENDIAN
default "power8" if POWERPC64_CPU && CPU_LITTLE_ENDIAN
-- 
2.38.1