[PATCH 2/5] crypto: mips/sha - remove duplicate hash init function

2021-12-20 Thread Tianjia Zhang
sha*_base_init() series functions has implemented the initialization of the hash context, this commit use sha*_base_init() function to replace repeated implementations. Signed-off-by: Tianjia Zhang --- arch/mips/cavium-octeon/crypto/octeon-sha1.c | 17 +--- .../mips/cavium-octeon/crypto/oct

[PATCH 3/5] crypto: powerpc/sha - remove duplicate hash init function

2021-12-20 Thread Tianjia Zhang
sha*_base_init() series functions has implemented the initialization of the hash context, this commit use sha*_base_init() function to replace repeated implementations. Signed-off-by: Tianjia Zhang --- arch/powerpc/crypto/sha1-spe-glue.c | 17 ++-- arch/powerpc/crypto/sha1.c

[PATCH 4/5] crypto: sparc/sha - remove duplicate hash init function

2021-12-20 Thread Tianjia Zhang
sha*_base_init() series functions has implemented the initialization of the hash context, this commit use sha*_base_init() function to replace repeated implementations. Signed-off-by: Tianjia Zhang --- arch/sparc/crypto/sha1_glue.c | 14 ++--- arch/sparc/crypto/sha256_glue.c | 37 +++--

[PATCH 0/5] Remove duplicate context init function for sha algorithm

2021-12-20 Thread Tianjia Zhang
This series of patches is mainly for repetitive code cleaning. The sha algorithm has provided generic context initialization implementation. The context initialization code in the optimized implementation of each platform is a repetitive code and can be deleted. The sha*_base_init() series of funct

[PATCH 1/5] crypto: sha256 - remove duplicate generic hash init function

2021-12-20 Thread Tianjia Zhang
crypto_sha256_init() and sha256_base_init() are the same repeated implementations, remove the crypto_sha256_init() in generic implementation, sha224 is the same process. Signed-off-by: Tianjia Zhang --- crypto/sha256_generic.c | 16 ++-- 1 file changed, 2 insertions(+), 14 deletions(

[PATCH 5/5] crypto: s390/sha512 - Use macros instead of direct IV numbers

2021-12-20 Thread Tianjia Zhang
In the init functions of sha512 and sha384, the initial hash value use macros instead of numbers. Signed-off-by: Tianjia Zhang --- arch/s390/crypto/sha512_s390.c | 32 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/arch/s390/crypto/sha512_s390.c

RE: [PATCH] powerpc: use strscpy to copy strings

2021-12-20 Thread David Laight
From: Jason Wang > Sent: 20 December 2021 03:24 > > The strlcpy should not be used because it doesn't limit the source > length. So that it will lead some potential bugs. > > But the strscpy doesn't require reading memory from the src string > beyond the specified "count" bytes, and since the ret

Re: [PATCH] sound: fsl: add missing put_device() call in imx_hdmi_probe()

2021-12-20 Thread Shengjiu Wang
On Thu, Dec 9, 2021 at 5:58 PM 王擎 wrote: > > > >> From: Wang Qing > >> > >> of_find_device_by_node() takes a reference to the embedded struct device > >> which needs to be dropped when error return. > > > >... > > > >>data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); > >>

Re: [patch V3 28/35] PCI/MSI: Simplify pci_irq_get_affinity()

2021-12-20 Thread Thomas Gleixner
On Sat, Dec 18 2021 at 21:25, Cédric Le Goater wrote: > On 12/18/21 11:25, Thomas Gleixner wrote: >> On Fri, Dec 17 2021 at 15:30, Nathan Chancellor wrote: >>> On Fri, Dec 10, 2021 at 11:19:26PM +0100, Thomas Gleixner wrote: >>> I just bisected a boot failure on my AMD test desktop to this patch a

Re: [PATCH] powerpc: dts: Remove "spidev" nodes

2021-12-20 Thread Mark Brown
On Fri, Dec 17, 2021 at 04:14:00PM -0600, Rob Herring wrote: > "spidev" is not a real device, but a Linux implementation detail. It has > never been documented either. The kernel has WARNed on the use of it for > over 6 years. Time to remove its usage from the tree. Reviwed-by: Mark Brown Thanks

[PATCH] powerpc: dts: Fix some I2C unit addresses

2021-12-20 Thread Thierry Reding
From: Thierry Reding The unit-address for the Maxim MAX1237 ADCs on XPedite5200 boards don't match the value in the "reg" property and cause a DTC warning. Signed-off-by: Thierry Reding --- arch/powerpc/boot/dts/xpedite5200.dts | 2 +- arch/powerpc/boot/dts/xpedite5200_xmon.dts | 2 +- 2

[PATCH v2 00/13] Implement livepatch on PPC32 and more

2021-12-20 Thread Christophe Leroy
This series implements livepatch on PPC32 and implements CONFIG_DYNAMIC_FTRACE_WITH_ARGS to simplify ftracing. v2: - Fix problem with strict modules RWX - Convert powerpc to CONFIG_DYNAMIC_FTRACE_WITH_ARGS - Convert function graph tracing to C - Refactor PPC32 versus PPC64 Signed-off-by: Christop

[PATCH v2 01/13] livepatch: Fix build failure on 32 bits processors

2021-12-20 Thread Christophe Leroy
Trying to build livepatch on powerpc/32 results in: kernel/livepatch/core.c: In function 'klp_resolve_symbols': kernel/livepatch/core.c:221:23: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] 221 | sym = (Elf64_Sym *)sechdr

[PATCH v2 02/13] tracing: Fix selftest config check for function graph start up test

2021-12-20 Thread Christophe Leroy
CONFIG_DYNAMIC_FTRACE_WITH_DIRECT_CALLS is required to test direct tramp. Signed-off-by: Christophe Leroy --- kernel/trace/trace_selftest.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/kernel/trace/trace_selftest.c b/kernel/trace/trace_selftest.c index afd937a46496..

[PATCH v2 03/13] powerpc/module_32: Fix livepatching for RO modules

2021-12-20 Thread Christophe Leroy
Livepatching a loaded module involves applying relocations through apply_relocate_add(), which attempts to write to read-only memory when CONFIG_STRICT_MODULE_RWX=y. R_PPC_ADDR16_LO, R_PPC_ADDR16_HI, R_PPC_ADDR16_HA and R_PPC_REL24 are the types generated by the kpatch-build userspace tool or klp-

[PATCH v2 05/13] powerpc/ftrace: Don't save again LR in ftrace_regs_caller() on PPC32

2021-12-20 Thread Christophe Leroy
PPC32 mcount() caller already saves LR on stack, no need to save it again. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/ftrace_32.S | 3 --- 1 file changed, 3 deletions(-) diff --git a/arch/powerpc/kernel/trace/ftrace_32.S b/arch/powerpc/kernel/trace/ftrace_32.S index 0a02c0cb

[PATCH v2 06/13] powerpc/ftrace: Simplify PPC32's return_to_handler()

2021-12-20 Thread Christophe Leroy
return_to_handler() was copied from PPC64. For PPC32 it just needs to save r3 and r4, and doesn't require any nop after the bl. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/ftrace_32.S | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/arch/pow

[PATCH v2 07/13] powerpc/ftrace: Prepare PPC32's ftrace_caller() for CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2021-12-20 Thread Christophe Leroy
In order to implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS, change ftrace_caller() stack layout to match struct pt_regs. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ftrace.h | 39 +-- arch/powerpc/kernel/trace/ftrace_32.S | 29 +--- 2 files

[PATCH v2 08/13] powerpc/ftrace: Prepare PPC64's ftrace_caller() for CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2021-12-20 Thread Christophe Leroy
In order to implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS, change ftrace_caller() to handle LIVEPATCH the same way as frace_caller_regs(). Signed-off-by: Christophe Leroy --- .../powerpc/kernel/trace/ftrace_64_mprofile.S | 25 ++- 1 file changed, 19 insertions(+), 6 deletions(-) dif

[PATCH v2 09/13] powerpc/ftrace: Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS

2021-12-20 Thread Christophe Leroy
Implement CONFIG_DYNAMIC_FTRACE_WITH_ARGS. It accelerates the call of livepatching. Also note that powerpc being the last one to convert to CONFIG_DYNAMIC_FTRACE_WITH_ARGS, it will now be possible to remove klp_arch_set_pc() on all architectures. Signed-off-by: Christophe Leroy --- arch/powerpc

[PATCH v2 04/13] powerpc/ftrace: Add support for livepatch to PPC32

2021-12-20 Thread Christophe Leroy
PPC64 needs some special logic to properly set up the TOC. See commit 85baa095497f ("powerpc/livepatch: Add live patching support on ppc64le") for details. PPC32 doesn't have TOC so it doesn't need that logic, so adding LIVEPATCH support is straight forward. Add CONFIG_LIVEPATCH_64 and move livep

[PATCH v2 10/13] powerpc/ftrace: Refactor ftrace_{en/dis}able_ftrace_graph_caller

2021-12-20 Thread Christophe Leroy
ftrace_enable_ftrace_graph_caller() and ftrace_disable_ftrace_graph_caller() have common code. They will have even more common code after following patch. Refactor into a single ftrace_modify_ftrace_graph_caller() function. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/ftrace.c

[PATCH v2 11/13] powerpc/ftrace: directly call of function graph tracer by ftrace caller

2021-12-20 Thread Christophe Leroy
Modify function graph tracer to be handled directly by the standard ftrace caller. This is made possible as powerpc now supports CONFIG_DYNAMIC_FTRACE_WITH_ARGS. This change simplifies the call of function graph ftrace. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/ftrace.h

[PATCH v2 12/13] powerpc/ftrace: Prepare ftrace_64_mprofile.S for reuse by PPC32

2021-12-20 Thread Christophe Leroy
PPC64 mprofile versions and PPC32 are very similar. Modify PPC64 version so that if can be reused for PPC32. Signed-off-by: Christophe Leroy --- .../powerpc/kernel/trace/ftrace_64_mprofile.S | 73 +-- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/arch/powerpc/k

[PATCH v2 13/13] powerpc/ftrace: Remove ftrace_32.S

2021-12-20 Thread Christophe Leroy
Functions in ftrace_32.S are common with PPC64. Reuse the ones defined for PPC64 with slight modification when required. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/trace/Makefile| 7 +- arch/powerpc/kernel/trace/ftrace_32.S | 152 -- .../trace/

[PATCH 0/2] powerpc/fadump: handle CMA activation failure appropriately

2021-12-20 Thread Hari Bathini
While commit a4e92ce8e4c8 ("powerpc/fadump: Reservationless firmware assisted dump"), introduced Linux kernel's Contiguous Memory Allocator (CMA) based reservation for fadump, it came with the assumption that the memory remains reserved even if CMA activation fails. This assumption ensures no kerne

[PATCH 1/2] mm/cma: provide option to opt out from exposing pages on activation failure

2021-12-20 Thread Hari Bathini
Commit 072355c1cf2d ("mm/cma: expose all pages to the buddy if activation of an area fails") started exposing all pages to buddy allocator on CMA activation failure. But there can be CMA users that want to handle the reserved memory differently on CMA allocation failure. Provide an option to opt ou

[PATCH 2/2] powerpc/fadump: opt out from freeing pages on cma activation failure

2021-12-20 Thread Hari Bathini
With commit a4e92ce8e4c8 ("powerpc/fadump: Reservationless firmware assisted dump"), Linux kernel's Contiguous Memory Allocator (CMA) based reservation was introduced in fadump. That change was aimed at using CMA to let applications utilize the memory reserved for fadump while blocking it from bein

Re: [PATCH 08/17] all: replace bitmap_weight with bitmap_weight_{eq,gt,ge,lt,le} where appropriate

2021-12-20 Thread Greg Kroah-Hartman
On Sat, Dec 18, 2021 at 01:20:04PM -0800, Yury Norov wrote: > Kernel code calls bitmap_weight() to compare the weight of bitmap with > a given number. We can do it more efficiently with bitmap_weight_{eq, ...} > because conditional bitmap_weight may stop traversing the bitmap earlier, > as soon as

Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)

2021-12-20 Thread Tyrel Datwyler
On 12/11/21 5:28 PM, Stefan Berger wrote: > Fix the following crash on kexec by checking chip->ops for a NULL pointer > in tpm_chip_start() and returning an error code if this is the case. > > BUG: Kernel NULL pointer dereference on read at 0x0060 > Faulting instruction address: 0xc099

Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)

2021-12-20 Thread Stefan Berger
On 12/20/21 19:39, Tyrel Datwyler wrote: On 12/11/21 5:28 PM, Stefan Berger wrote: Fix the following crash on kexec by checking chip->ops for a NULL pointer in tpm_chip_start() and returning an error code if this is the case. BUG: Kernel NULL pointer dereference on read at 0x0060 Faulting

Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)

2021-12-20 Thread Jason Gunthorpe
On Mon, Dec 20, 2021 at 08:05:58PM -0500, Stefan Berger wrote: > diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c > index ddaeceb7e109..4cb908349b31 100644 > +++ b/drivers/char/tpm/tpm-chip.c > @@ -473,15 +473,8 @@ static void tpm_del_char_device(struct tpm_chip *chip) >

Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)

2021-12-20 Thread Stefan Berger
On 12/20/21 20:13, Jason Gunthorpe wrote: On Mon, Dec 20, 2021 at 08:05:58PM -0500, Stefan Berger wrote: diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c index ddaeceb7e109..4cb908349b31 100644 +++ b/drivers/char/tpm/tpm-chip.c @@ -473,15 +473,8 @@ static void tpm_del_ch

Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)

2021-12-20 Thread Tyrel Datwyler
On 12/20/21 5:05 PM, Stefan Berger wrote: > > On 12/20/21 19:39, Tyrel Datwyler wrote: >> On 12/11/21 5:28 PM, Stefan Berger wrote: >>> Fix the following crash on kexec by checking chip->ops for a NULL pointer >>> in tpm_chip_start() and returning an error code if this is the case. >>> >>> BUG: Ke

Re: [PATCH] tpm: Fix kexec crash due to access to ops NULL pointer (powerpc)

2021-12-20 Thread Tyrel Datwyler
On 12/20/21 5:31 PM, Stefan Berger wrote: > > On 12/20/21 20:13, Jason Gunthorpe wrote: >> On Mon, Dec 20, 2021 at 08:05:58PM -0500, Stefan Berger wrote: >> >>> diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c >>> index ddaeceb7e109..4cb908349b31 100644 >>> +++ b/drivers/char

[PATCH] powerpc: No need to initialise statics to 0

2021-12-20 Thread Xiang wangx
Static variables do not need to be initialised to 0, because compiler will initialise all uninitialised statics to 0. Thus, remove the unneeded initializations. Signed-off-by: Xiang wangx --- arch/powerpc/platforms/powermac/nvram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --gi

Re: [PATCH kernel v4] KVM: PPC: Merge powerpc's debugfs entry content into generic entry

2021-12-20 Thread Alexey Kardashevskiy
On 12/20/21 18:29, Cédric Le Goater wrote: > On 12/20/21 02:23, Alexey Kardashevskiy wrote: >> At the moment KVM on PPC creates 4 types of entries under the kvm debugfs: >> 1) "%pid-%fd" per a KVM instance (for all platforms); >> 2) "vm%pid" (for PPC Book3s HV KVM); >> 3) "vm%u_vcpu%u_timing" (f

[PATCH kernel 0/6] powerpc: Build with LLVM_IAS=1

2021-12-20 Thread Alexey Kardashevskiy
This allows compiling the upstream Linux with the upstream llvm with one fix on top; https://reviews.llvm.org/D115419 This is based on sha1 798527287598 Michael Ellerman "Automatic merge of 'next' into merge (2021-12-14 00:12)". Please comment. Thanks. Alan Modra (1): powerpc/toc: PowerPC6

[PATCH llvm 1/6] powerpc/toc: PowerPC64 future proof kernel toc, revised for lld

2021-12-20 Thread Alexey Kardashevskiy
From: Alan Modra This patch future-proofs the kernel against linker changes that might put the toc pointer at some location other than .got+0x8000, by replacing __toc_start+0x8000 with .TOC. throughout. If the kernel's idea of the toc pointer doesn't agree with the linker, bad things happen. pr

[PATCH llvm 2/6] powerpc: check for support for -Wa,-m{power4,any}

2021-12-20 Thread Alexey Kardashevskiy
From: Daniel Axtens LLVM's integrated assembler does not like either -Wa,-mpower4 or -Wa,-many. So just don't pass them if they're not supported. Signed-off-by: Daniel Axtens Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)

[PATCH llvm 3/6] powerpc/64/asm: Inline BRANCH_TO_C000

2021-12-20 Thread Alexey Kardashevskiy
It is used just once and does not really help with readability, remove it. Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/kernel/exceptions-64s.S | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kern

[PATCH llvm 4/6] powerpc/64/asm: Do not reassign labels

2021-12-20 Thread Alexey Kardashevskiy
From: Daniel Axtens The LLVM integrated assembler really does not like us reassigning things to the same label: :7:9: error: invalid reassignment of non-absolute variable 'fs_label' This happens across a bunch of platforms: https://github.com/ClangBuiltLinux/linux/issues/1043 https://github.co

[PATCH llvm 5/6] powerpc/mm: Switch obsolete dssall to .long

2021-12-20 Thread Alexey Kardashevskiy
The dssall ("Data Stream Stop All") instruction is obsolete altogether with other Data Cache Instructions since ISA 2.03 (year 2006). LLVM IAS does not support it but PPC970 seems to be using it. This switches dssall to .long as there is no much point in fixing LLVM. Signed-off-by: Alexey Kardash

[PATCH llvm 6/6] powerpc/mm/book3s64/hash: Switch pre 2.06 tlbiel to .long

2021-12-20 Thread Alexey Kardashevskiy
The llvm integrated assembler does not recognise the ISA 2.05 tlbiel version. Work around it by switching to .long when an old arch level detected. Signed-off-by: Daniel Axtens [aik: did "Eventually do this more smartly"] Signed-off-by: Alexey Kardashevskiy --- arch/powerpc/include/asm/ppc-opco