[PATCH v2 1/5] powerpc/nohash: Refactor update of BDI2000 pointers in switch_mmu_context()

2021-05-07 Thread Christophe Leroy
Instead of duplicating the update of BDI2000 pointers in set_context(), do it directly from switch_mmu_context(). Define a helper in mmu.h that can be re-used later by book3s/32. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/mmu.h | 8 arch/powerpc/kernel/head_40x

[PATCH v2 2/5] powerpc/nohash: Convert set_context() to C

2021-05-07 Thread Christophe Leroy
ppc8xx already has set_context() in C. Other ones have it in assembly. The only thing it does is to write the context id into SPRN_PID. Do it in C. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/mmu_context.h | 1 - arch/powerpc/kernel/head_40x.S | 7 --- arch/power

[PATCH v2 3/5] powerpc/32s: Refactor update of user segment registers

2021-05-07 Thread Christophe Leroy
KUEP implements the update of user segment registers. Move it into mmu-hash.h in order to use it from other places. And inline kuep_lock() and kuep_unlock() and remove kuep.c inlining kuep_lock() is important for system_call_exception(), otherwise system_call_exception() has to save into stack th

[PATCH v2 4/5] powerpc/32s: Convert switch_mmu_context() to C

2021-05-07 Thread Christophe Leroy
switch_mmu_context() does things that can easily be done in C. For updating user segments, we have update_user_segments(). As mentionned in commit b5efec00b671 ("powerpc/32s: Move KUEP locking/unlocking in C"), update_user_segments() has the loop unrolled which is a significant performance gain.

[PATCH v2 5/5] powerpc/32s: Simplify calculation of segment register content

2021-05-07 Thread Christophe Leroy
segment register has VSID on bits 8-31. Bits 4-7 are reserved, there is no requirement to set them to 0. VSIDs are calculated from VSID of SR0 by adding 0x111. Even with highest possible VSID which would be 0xF0, adding 16 times 0x111 results in 0x1001100. So, the reserved bits are never ove

Re: [PATCH net v3] ibmvnic: Continue with reset if set link down failed

2021-05-07 Thread Lijun Pan
On Tue, May 4, 2021 at 3:24 PM Dany Madden wrote: > > On 2021-05-04 12:31, Lijun Pan wrote: > > On Tue, May 4, 2021 at 2:27 PM Lijun Pan wrote: > >> > >> On Tue, May 4, 2021 at 2:14 PM Dany Madden wrote: > >> > > >> > When ibmvnic gets a FATAL error message from the vnicserver, it marks > >> > t

Re: [PATCH v2 2/3] powerpc/fsl: set fsl, i2c-erratum-a004447 flag for P2041 i2c controllers

2021-05-07 Thread Joakim Tjernlund
On Fri, 2021-05-07 at 12:40 +1200, Chris Packham wrote: > The i2c controllers on the P2040/P2041 have an erratum where the > documented scheme for i2c bus recovery will not work (A-004447). A > different mechanism is needed which is documented in the P2040 Chip > Errata Rev Q (latest available at t

Re: [PATCH v2 2/3] powerpc/fsl: set fsl, i2c-erratum-a004447 flag for P2041 i2c controllers

2021-05-07 Thread Joakim Tjernlund
On Fri, 2021-05-07 at 10:04 +0200, Joakim Tjernlund wrote: > On Fri, 2021-05-07 at 12:40 +1200, Chris Packham wrote: > > The i2c controllers on the P2040/P2041 have an erratum where the > > documented scheme for i2c bus recovery will not work (A-004447). A > > different mechanism is needed which is

Re: UBSAN: array-index-out-of-bounds in arch/powerpc/kernel/legacy_serial.c:359:56

2021-05-07 Thread Christophe Leroy
Hi Paul, Le 06/05/2021 à 21:32, Paul Menzel a écrit : [corrected subject] Am 06.05.21 um 21:31 schrieb Paul Menzel: Dear Linux folks, On the POWER8 system IBM S822LC, Linux 5.13+, built with USSAN, logs the warning below. ``` [    0.030091]

Re: UBSAN: array-index-out-of-bounds in arch/powerpc/kernel/legacy_serial.c:359:56

2021-05-07 Thread Paul Menzel
[+Andrey] Dear Christophe, Am 07.05.21 um 10:31 schrieb Christophe Leroy: Le 06/05/2021 à 21:32, Paul Menzel a écrit : [corrected subject] Am 06.05.21 um 21:31 schrieb Paul Menzel: On the POWER8 system IBM S822LC, Linux 5.13+, built with USSAN, logs the warning below. ``` [    0.030091

Re: UBSAN: array-index-out-of-bounds in arch/powerpc/kernel/legacy_serial.c:359:56

2021-05-07 Thread Christophe Leroy
Le 07/05/2021 à 10:42, Paul Menzel a écrit : [+Andrey] Dear Christophe, Am 07.05.21 um 10:31 schrieb Christophe Leroy: Le 06/05/2021 à 21:32, Paul Menzel a écrit : [corrected subject] Am 06.05.21 um 21:31 schrieb Paul Menzel: On the POWER8 system IBM S822LC, Linux 5.13+, built with U

[PATCH] powerpc: Define NR_CPUS all the time

2021-05-07 Thread Christophe Leroy
include/linux/threads.h defines a default value for CONFIG_NR_CPUS but suggests the architectures should always define it. So do it, when CONFIG_SMP is not selected set CONFIG_NR_CPUS to 1. Signed-off-by: Christophe Leroy --- arch/powerpc/platforms/Kconfig.cputype | 6 +++--- 1 file changed, 3

[PATCH] powerpc/xive: Fix unsigned comparison with less than zero

2021-05-07 Thread Jiapeng Chong
The return from the call to irq_domain_alloc_irqs() is int, it can be a negative error code, however this is being assigned to an unsigned int variable 'irq', this may lead to invalid if statement detection, so that kfree execution is invalid. So making 'irq' an int. Clean up the following coccich

Re: [PATCH v7 4/6] KVM: PPC: Book3S HV: Nested support in H_RPT_INVALIDATE

2021-05-07 Thread Aneesh Kumar K.V
Nicholas Piggin writes: ... > + */ >> +long do_h_rpt_invalidate_pat(struct kvm_vcpu *vcpu, unsigned long lpid, >> + unsigned long type, unsigned long pg_sizes, >> + unsigned long start, unsigned long end) >> +{ >> +struct kvm_nested_guest *gp;

[PATCH v2] powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable

2021-05-07 Thread Vaibhav Jain
In case performance stats for an nvdimm are not available, reading the 'perf_stats' sysfs file returns an -ENOENT error. A better approach is to make the 'perf_stats' file entirely invisible to indicate that performance stats for an nvdimm are unavailable. So this patch updates 'papr_nd_attribute_

Re: [PATCH] powerpc/papr_scm: Make 'perf_stats' invisible if perf-stats unavailable

2021-05-07 Thread Vaibhav Jain
"Aneesh Kumar K.V" writes: > Vaibhav Jain writes: > >> In case performance stats for an nvdimm are not available, reading the >> 'perf_stats' sysfs file returns an -ENOENT error. A better approach is >> to make the 'perf_stats' file entirely invisible to indicate that >> performance stats for an

[PATCH] lockdown, selinux: fix bogus SELinux lockdown permission checks

2021-05-07 Thread Ondrej Mosnacek
Commit 59438b46471a ("security,lockdown,selinux: implement SELinux lockdown") added an implementation of the locked_down LSM hook to SELinux, with the aim to restrict which domains are allowed to perform operations that would breach lockdown. However, in several places the security_locked_down() h

Re: [PATCH v2 3/3] i2c: mpc: implement erratum A-004447 workaround

2021-05-07 Thread Andy Shevchenko
On Fri, May 7, 2021 at 3:40 AM Chris Packham wrote: > > The P2040/P2041 has an erratum where the normal i2c recovery mechanism > does not work. Implement the alternative recovery mechanism documented > in the P2040 Chip Errata Rev Q. Thanks. > +static int i2c_mpc_wait_sr(struct mpc_i2c *i2c, int

Re: [PATCH v2] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-05-07 Thread Vaibhav Jain
Hi Ira, Thanks for looking into this patch Ira Weiny writes: > On Thu, May 06, 2021 at 12:46:06AM +0530, Vaibhav Jain wrote: >> Currently drc_pmem_qeury_stats() generates a dev_err in case >> "Enable Performance Information Collection" feature is disabled from >> HMC or performance stats are no

Re: [RFC PATCH 0/7] Memory hotplug/hotremove at subsection size

2021-05-07 Thread David Hildenbrand
On 07.05.21 13:55, Michal Hocko wrote: [I haven't read through respective patches due to lack of time but let me comment on the general idea and the underlying justification] On Thu 06-05-21 17:31:09, David Hildenbrand wrote: On 06.05.21 17:26, Zi Yan wrote: From: Zi Yan Hi all, This patc

[PATCH] powerpc/perf: Simplify Makefile

2021-05-07 Thread Christophe Leroy
arch/powerpc/Kbuild decend into arch/powerpc/perf/ only when CONFIG_PERF_EVENTS is selected, so there is not need to take CONFIG_PERF_EVENTS into account in arch/powerpc/perf/Makefile. Signed-off-by: Christophe Leroy --- arch/powerpc/perf/Makefile | 6 ++ 1 file changed, 2 insertions(+), 4 d

Re: [PATCH] powerpc/perf: Simplify Makefile

2021-05-07 Thread Michal Suchánek
On Fri, May 07, 2021 at 02:01:09PM +, Christophe Leroy wrote: > arch/powerpc/Kbuild decend into arch/powerpc/perf/ only when > CONFIG_PERF_EVENTS is selected, so there is not need to take > CONFIG_PERF_EVENTS into account in arch/powerpc/perf/Makefile. So long as CONFIG_PERF_EVENTS stays boole

Re: [PATCH v2 3/3] i2c: mpc: implement erratum A-004447 workaround

2021-05-07 Thread Joakim Tjernlund
On Fri, 2021-05-07 at 14:46 +0300, Andy Shevchenko wrote: > On Fri, May 7, 2021 at 3:40 AM Chris Packham > wrote: > > > > The P2040/P2041 has an erratum where the normal i2c recovery mechanism > > does not work. Implement the alternative recovery mechanism documented > > in the P2040 Chip Errata

Re: [PATCH v2 3/3] i2c: mpc: implement erratum A-004447 workaround

2021-05-07 Thread Andy Shevchenko
On Fri, May 7, 2021 at 5:52 PM Joakim Tjernlund wrote: > On Fri, 2021-05-07 at 14:46 +0300, Andy Shevchenko wrote: > > On Fri, May 7, 2021 at 3:40 AM Chris Packham > > wrote: ... > > So, now you may shrink it even further, i.e. > > > >void __iomem *sr = i2c->base + MPC_I2C_SR; > >

Re: [RFC PATCH 0/7] Memory hotplug/hotremove at subsection size

2021-05-07 Thread Michal Hocko
[I haven't read through respective patches due to lack of time but let me comment on the general idea and the underlying justification] On Thu 06-05-21 17:31:09, David Hildenbrand wrote: > On 06.05.21 17:26, Zi Yan wrote: > > From: Zi Yan > > > > Hi all, > > > > This patchset tries to remove t

Re: [PATCH 2/3] hotplug-memory.c: enhance dlpar_memory_remove* LMB checks

2021-05-07 Thread Daniel Henrique Barboza
On 5/3/21 10:02 PM, David Gibson wrote: On Fri, Apr 30, 2021 at 09:09:16AM -0300, Daniel Henrique Barboza wrote: dlpar_memory_remove_by_ic() validates the amount of LMBs to be removed by checking !DRCONF_MEM_RESERVED, and in the following loop before dlpar_remove_lmb() a check for DRCONF_MEM_

[PATCH] powerpc/8xx: Update mpc885_ads_defconfig to improve CI

2021-05-07 Thread Christophe Leroy
mpc885_ads_defconfig is used by several CI robots. A few functionnalities are specific to 8xx and are not covered by other default configuration, so improve build test coverage by adding them to mpc885_ads_defconfig. 8xx is the only platform supporting 16k page size in addition to 4k page size. C

Re: UBSAN: array-index-out-of-bounds in arch/powerpc/kernel/legacy_serial.c:359:56

2021-05-07 Thread Paul Menzel
Dear Christophe, Am 07.05.21 um 10:59 schrieb Christophe Leroy: Le 07/05/2021 à 10:42, Paul Menzel a écrit : [+Andrey] Am 07.05.21 um 10:31 schrieb Christophe Leroy: Le 06/05/2021 à 21:32, Paul Menzel a écrit : [corrected subject] Am 06.05.21 um 21:31 schrieb Paul Menzel: On the POWE

Re: [RESEND PATCH v4 10/11] powerpc: Protect patching_mm with a lock

2021-05-07 Thread Christopher M. Riedl
On Thu May 6, 2021 at 5:51 AM CDT, Peter Zijlstra wrote: > On Wed, May 05, 2021 at 11:34:51PM -0500, Christopher M. Riedl wrote: > > Powerpc allows for multiple CPUs to patch concurrently. When patching > > with STRICT_KERNEL_RWX a single patching_mm is allocated for use by all > > CPUs for the few

Re: UBSAN: array-index-out-of-bounds in arch/powerpc/kernel/legacy_serial.c:359:56

2021-05-07 Thread Segher Boessenkool
On Fri, May 07, 2021 at 10:31:42AM +0200, Christophe Leroy wrote: > The function is as follows, so when legacy_serial_console == -1 as in your > situation, the pointers are just not used. And it is still undefined behaviour. C11 6.5.6/8 has If both the pointer operand and the result point to e

Re: [PATCH v2 1/3] dt-bindings: i2c: mpc: Add fsl,i2c-erratum-a004447 flag

2021-05-07 Thread Rob Herring
On Fri, May 07, 2021 at 12:40:45PM +1200, Chris Packham wrote: > Document the fsl,i2c-erratum-a004447 flag which indicates the presence > of an i2c erratum on some QorIQ SoCs. > > Signed-off-by: Chris Packham > --- > Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 7 +++ > 1 file change

[RFC 0/12] Unify asm/unaligned.h around struct helper

2021-05-07 Thread Arnd Bergmann
From: Arnd Bergmann The get_unaligned()/put_unaligned() helpers are traditionally architecture specific, with the two main variants being the "access-ok.h" version that assumes unaligned pointer accesses always work on a particular architecture, and the "le-struct.h" version that casts the data t

[RFC 05/12] powerpc: use linux/unaligned/le_struct.h on LE power7

2021-05-07 Thread Arnd Bergmann
From: Arnd Bergmann Little-endian POWER7 kernels disable CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS because that is not supported on the hardware, but the kernel still uses direct load/store for explicti get_unaligned()/put_unaligned(). I assume this is a mistake that leads to power7 having to trap

[RFC 0/12] Unify asm/unaligned.h around struct helper

2021-05-07 Thread Arnd Bergmann
From: Arnd Bergmann The get_unaligned()/put_unaligned() helpers are traditionally architecture specific, with the two main variants being the "access-ok.h" version that assumes unaligned pointer accesses always work on a particular architecture, and the "le-struct.h" version that casts the data t

Re: [PATCH] lockdown,selinux: fix bogus SELinux lockdown permission checks

2021-05-07 Thread Casey Schaufler
On 5/7/2021 4:40 AM, Ondrej Mosnacek wrote: > Commit 59438b46471a ("security,lockdown,selinux: implement SELinux > lockdown") added an implementation of the locked_down LSM hook to > SELinux, with the aim to restrict which domains are allowed to perform > operations that would breach lockdown. > >

Re: [RESEND PATCH v4 10/11] powerpc: Protect patching_mm with a lock

2021-05-07 Thread Peter Zijlstra
On Fri, May 07, 2021 at 03:03:51PM -0500, Christopher M. Riedl wrote: > On Thu May 6, 2021 at 5:51 AM CDT, Peter Zijlstra wrote: > > On Wed, May 05, 2021 at 11:34:51PM -0500, Christopher M. Riedl wrote: > > > Powerpc allows for multiple CPUs to patch concurrently. When patching > > > with STRICT_KE

[PATCH -next] crypto: nx842: add missing MODULE_DEVICE_TABLE

2021-05-07 Thread Bixuan Cui
This patch adds missing MODULE_DEVICE_TABLE definition which generates correct modalias for automatic loading of this driver when it is built as an external module. Reported-by: Hulk Robot Signed-off-by: Bixuan Cui --- drivers/crypto/nx/nx-842-pseries.c | 1 + 1 file changed, 1 insertion(+) di

[PATCH v3] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible

2021-05-07 Thread Vaibhav Jain
Currently drc_pmem_qeury_stats() generates a dev_err in case "Enable Performance Information Collection" feature is disabled from HMC or performance stats are not available for an nvdimm. The error is of the form below: papr_scm ibm,persistent-memory:ibm,pmemory@44104001: Failed to query

[PATCH] powerpc/legacy_serial: Fix UBSAN: array-index-out-of-bounds

2021-05-07 Thread Christophe Leroy
UBSAN complains when a pointer is calculated with invalid 'legacy_serial_console' index, allthough the index is verified before dereferencing the pointer. Fix it by checking 'legacy_serial_console' validity before calculating pointers. Fixes: 0bd3f9e953bd ("powerpc/legacy_serial: Use early_iorema