Re: [PATCH 1/5] mm/resource: return real error codes from walk failures

2019-02-25 Thread Christophe Leroy
Le 25/02/2019 à 19:57, Dave Hansen a écrit : From: Dave Hansen walk_system_ram_range() can return an error code either becuase *it* failed, or because the 'func' that it calls returned an error. The memory hotplug does the following: ret = walk_system_ram_range(..., func);

linux-next: build failure after merge of the akpm tree

2019-02-25 Thread Stephen Rothwell
Hi Andrew, After merging the akpm tree, today's linux-next build (powerpc allnoconfig) failed like this: /home/sfr/next/next/arch/powerpc/kernel/setup_32.c:176:21: error: redefinition of 'alloc_stack' static void *__init alloc_stack(void) ^~~ /home/sfr/next/next/arc

Re: [PATCH v3 0/4] Fixes for 3 separate NMI reentrancy bugs

2019-02-25 Thread Satheesh Rajendran
On Tue, Feb 26, 2019 at 04:08:57PM +1000, Nicholas Piggin wrote: > This series fixes several similar but unrelated bugs with NMIs > clobbering live registers without noticing it, because MSR[RI] is set. > Pretty rare bugs, but serious silent corruption consequences. > > For the most part these can

[PATCH v3 4/4] powerpc/64s: Fix data interrupts vs d-side MCE reentrancy

2019-02-25 Thread Nicholas Piggin
Handlers for interrupts that set DAR / DSISR, set MSR[RI] before those SPRs are read. If a d-side machine check hits in this window, DAR / DSISR will be clobbered silently, leading to random corruption. Fix this by having handlers save those registers before setting MSR[RI]. Signed-off-by: Nichol

[PATCH v3 3/4] powerpc/64s: Prepare to handle data interrupts vs d-side MCE reentrancy

2019-02-25 Thread Nicholas Piggin
A subsequent fix for data interrupts (those that set DAR / DSISR) requires some interrupt macros to be open-coded, and also requires the 0x300 interrupt handler to be moved out-of-line. This patch does that without changing behaviour, which makes the later fix a smaller change. Signed-off-by: Nic

[PATCH v3 2/4] powerpc/64s: system reset interrupt preserve HSRRs

2019-02-25 Thread Nicholas Piggin
Code that uses HSRR registers is not required to clear MSR[RI] by convention, however the system reset NMI itself may use HSRR registers (e.g., to call OPAL) and clobber them. Rather than introduce the requirement to clear RI in order to use HSRRs, have system reset interrupt save and restore HSRR

[PATCH v3 0/4] Fixes for 3 separate NMI reentrancy bugs

2019-02-25 Thread Nicholas Piggin
This series fixes several similar but unrelated bugs with NMIs clobbering live registers without noticing it, because MSR[RI] is set. Pretty rare bugs, but serious silent corruption consequences. For the most part these can be observed and tested quite easily with the mambo simulator, except that

[PATCH v3 1/4] powerpc/64s: Fix HV NMI vs HV interrupt recoverability test

2019-02-25 Thread Nicholas Piggin
HV interrupts that use HSRR registers do not enter with MSR[RI] clear, but their entry code is not recoverable vs NMI, due to shared use of HSPRG1 as a scratch register to save r13. This means that a system reset or machine check that hits in HSRR interrupt entry can cause r13 to be silently corru

[PATCH] powerpc/xmon: Fix opcode being uninitialized in print_insn_powerpc

2019-02-25 Thread Nathan Chancellor
When building with -Wsometimes-uninitialized, Clang warns: arch/powerpc/xmon/ppc-dis.c:157:7: warning: variable 'opcode' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (cpu_has_feature(CPU_FTRS_POWER9)) ^~~~ arch/powerpc/xm

Re: [PATCH] tools: testing: selftests: Remove duplicate headers

2019-02-25 Thread Souptick Joarder
On Tue, Feb 26, 2019 at 7:18 AM Michael Ellerman wrote: > > Souptick Joarder writes: > > Remove duplicate headers which are included twice. > > > > Signed-off-by: Sabyasachi Gupta > > Signed-off-by: Souptick Joarder > > --- > ... > > tools/testing/selftests/powerpc/pmu/ebb/fork_cleanup_test.c

Re: [PATCH v2 06/16] KVM: PPC: Book3S HV: XIVE: add controls for the EQ configuration

2019-02-25 Thread Paul Mackerras
On Fri, Feb 22, 2019 at 12:28:30PM +0100, Cédric Le Goater wrote: > These controls will be used by the H_INT_SET_QUEUE_CONFIG and > H_INT_GET_QUEUE_CONFIG hcalls from QEMU. They will also be used to > restore the configuration of the XIVE EQs in the KVM device and to > capture the internal runtime

Re: [PATCH v2 04/16] KVM: PPC: Book3S HV: XIVE: add a control to initialize a source

2019-02-25 Thread Paul Mackerras
On Mon, Feb 25, 2019 at 01:10:12PM +1100, David Gibson wrote: > On Fri, Feb 22, 2019 at 12:28:28PM +0100, Cédric Le Goater wrote: > > + /* > > +* If the source doesn't already have an IPI, allocate > > +* one and get the corresponding data > > +*/ > > + if (!state->ipi_number) { > >

Re: [PATCH v7 07/11] powerpc/32: prepare shadow area for KASAN

2019-02-25 Thread Daniel Axtens
Christophe Leroy writes: > This patch prepares a shadow area for KASAN. > > The shadow area will be at the top of the kernel virtual > memory space above the fixmap area and will occupy one > eighth of the total kernel virtual memory space. > > Signed-off-by: Christophe Leroy > --- > arch/power

[PATCH v2 2/2] powerpc/mm/hash: Handle mmap_min_addr correctly in get_unmapped_area topdown search

2019-02-25 Thread Aneesh Kumar K.V
When doing top-down search the low_limit is not PAGE_SIZE but rather max(PAGE_SIZE, mmap_min_addr). This handle cases in which mmap_min_addr > PAGE_SIZE. Fixes: fba2369e6ceb ("mm: use vm_unmapped_area() on powerpc architecture") Reviewed-by: Laurent Dufour Signed-off-by: Aneesh Kumar K.V --- ar

[PATCH v2 1/2] powerpc/hugetlb: Handle mmap_min_addr correctly in get_unmapped_area callback

2019-02-25 Thread Aneesh Kumar K.V
After we ALIGN up the address we need to make sure we didn't overflow and resulted in zero address. In that case, we need to make sure that the returned address is greater than mmap_min_addr. This fixes selftest va_128TBswitch --run-hugetlb reporting failures when run as non root user for mmap(-1

Re: [PATCH v2 01/16] powerpc/xive: add OPAL extensions for the XIVE native exploitation support

2019-02-25 Thread David Gibson
On Mon, Feb 25, 2019 at 11:11:58AM +0100, Cédric Le Goater wrote: > On 2/25/19 4:50 AM, Michael Ellerman wrote: > > Cédric Le Goater writes: > > > >> The support for XIVE native exploitation mode in Linux/KVM needs a > >> couple more OPAL calls to configure the sPAPR guest and to get/set the > >>

Re: [PATCH v7 06/11] powerpc/32: make KVIRT_TOP dependant on FIXMAP_START

2019-02-25 Thread kbuild test robot
Hi Christophe, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on v5.0-rc8] [cannot apply to next-20190225] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https

Re: powerpc/64: Simplify __secondary_start paca->kstack handling

2019-02-25 Thread Michael Ellerman
On Sat, 2019-02-23 at 12:24:39 UTC, Michael Ellerman wrote: > In __secondary_start() we load the thread_info of the idle task of the > secondary CPU from current_set[cpu], and then convert it into a stack > pointer before storing that back to paca->kstack. > > As pointed out in commit f761622e5943

Re: [v3,2/2] powerpc: Enable kcov

2019-02-25 Thread Michael Ellerman
On Fri, 2019-02-22 at 00:40:46 UTC, Andrew Donnellan wrote: > kcov provides kernel coverage data that's useful for fuzzing tools like > syzkaller. > > Wire up kcov support on powerpc. Disable kcov instrumentation on the same > files where we currently disable gcov and UBSan instrumentation, plus s

Re: [v5, 01/16] powerpc/wii: properly disable use of BATs when requested.

2019-02-25 Thread Michael Ellerman
On Thu, 2019-02-21 at 19:08:37 UTC, Christophe Leroy wrote: > 'nobats' kernel parameter or some options like CONFIG_DEBUG_PAGEALLOC > deny the use of BATS for mapping memory. > > This patch makes sure that the specific wii RAM mapping function > takes it into account as well. > > Fixes: de32400dd

Re: [1/3] powerpc: sstep: Add tests for compute type instructions

2019-02-25 Thread Michael Ellerman
On Wed, 2019-02-20 at 06:56:58 UTC, Sandipan Das wrote: > This enhances the current selftest framework for validating > the in-kernel instruction emulation infrastructure by adding > support for compute type instructions i.e. integer ALU-based > instructions. Originally, this framework was limited

Re: [v3, 1/2] powerpc/8xx: replace most #ifdef by IS_ENABLED() in 8xx_mmu.c

2019-02-25 Thread Michael Ellerman
On Wed, 2019-02-13 at 16:06:19 UTC, Christophe Leroy wrote: > This patch replaces most #ifdef mess by IS_ENABLED() in 8xx_mmu.c > This has the advantage of allowing syntax verification at compile > time regardless of selected options. > > Signed-off-by: Christophe Leroy Series applied to powerpc

Re: [v16, 01/21] powerpc/irq: use memblock functions returning virtual address

2019-02-25 Thread Michael Ellerman
On Tue, 2019-02-05 at 11:31:59 UTC, Michael Ellerman wrote: > From: Christophe Leroy > > Since only the virtual address of allocated blocks is used, > lets use functions returning directly virtual address. > > Those functions have the advantage of also zeroing the block. > > Suggested-by: Mike

Re: powerpc/64s: Remove MSR_RI optimisation in system_call_exit()

2019-02-25 Thread Michael Ellerman
On Thu, 2019-01-17 at 11:35:10 UTC, Michael Ellerman wrote: > Currently in system_call_exit() we have an optimisation where we > disable MSR_RI (recoverable interrupt) and MSR_EE (external interrupt > enable) in a single mtmsrd instruction. > > Unfortunately this will no longer work with THREAD_IN

[PATCH V3] ASoC: fsl_esai: fix channel swap issue when stream starts

2019-02-25 Thread S.j. Wang
There is very low possibility ( < 0.1% ) that channel swap happened in beginning when multi output/input pin is enabled. The issue is that hardware can't send data to correct pin in the beginning with the normal enable flow. This is hardware issue, but there is no errata, the workaround flow is th

RE: [PATCH V2] ASoC: fsl_esai: fix channel swap issue when stream starts

2019-02-25 Thread S.j. Wang
> > On Tue, Feb 26, 2019 at 02:01:14AM +, S.j. Wang wrote: > > > > diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c > > > > index > > > > afe67c865330..23bd0ad4ac31 100644 > > > > --- a/sound/soc/fsl/fsl_esai.c > > > > +++ b/sound/soc/fsl/fsl_esai.c > > > > @@ -54,6 +54,8 @@

Re: [PATCH V2] ASoC: fsl_esai: fix channel swap issue when stream starts

2019-02-25 Thread Nicolin Chen
On Tue, Feb 26, 2019 at 02:01:14AM +, S.j. Wang wrote: > > > diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c index > > > afe67c865330..23bd0ad4ac31 100644 > > > --- a/sound/soc/fsl/fsl_esai.c > > > +++ b/sound/soc/fsl/fsl_esai.c > > > @@ -54,6 +54,8 @@ struct fsl_esai { > > >

RE: [PATCH V2] ASoC: fsl_esai: fix channel swap issue when stream starts

2019-02-25 Thread S.j. Wang
> > On Mon, Feb 25, 2019 at 02:48:18AM +, S.j. Wang wrote: > > There is very low possibility ( < 0.1% ) that channel swap happened in > > beginning when multi output/input pin is enabled. The issue is that > > hardware can't send data to correct pin in the beginning with the > > normal enab

Re: [PATCH] tools: testing: selftests: Remove duplicate headers

2019-02-25 Thread Michael Ellerman
Souptick Joarder writes: > Remove duplicate headers which are included twice. > > Signed-off-by: Sabyasachi Gupta > Signed-off-by: Souptick Joarder > --- ... > tools/testing/selftests/powerpc/pmu/ebb/fork_cleanup_test.c | 1 - I took this hunk via the powerpc tree. > diff --git a/tools/testing

Re: [RFC PATCH 3/5] kasan: allow architectures to provide an outline readiness check

2019-02-25 Thread Daniel Axtens
>>> Unless somebody minds, I'll do the change and take this patch in my >>> series in order to handle the case of book3s/32 hash. >> >> Please do; feel free to take as many of the patches as you would like >> and I'll rebase whatever is left on the next version of your series. > > I have now done

Re: [PATCH v2 2/2] arch: powerpc/hlwd-pic: Add missing of_node-put() in hlwd_pic_probe()

2019-02-25 Thread Tyrel Datwyler
On 02/25/2019 01:00 AM, Himadri Pandya wrote: > Decrement the reference count on device_node "np" while breaking out of > the loop. Issue identified by Coccinelle. > > Signed-off-by: Himadri Pandya > --- > Changes in V2: > - Change subject line > --- > arch/powerpc/platforms/embedded6xx/hl

Re: [PATCH v2 1/2] arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()

2019-02-25 Thread Tyrel Datwyler
On 02/25/2019 01:00 AM, Himadri Pandya wrote: > Decrement the reference count on device_node "node" while breaking out > of the loop. Issue identified by Coccinelle. > > Signed-off-by: Himadri Pandya > --- > Changes in V2: > - Change subject line > --- > arch/powerpc/kernel/machine_kexec_6

Re: [PATCH v7 02/11] powerpc: prepare string/mem functions for KASAN

2019-02-25 Thread kbuild test robot
Hi Christophe, Thank you for the patch! Yet something to improve: [auto build test ERROR on powerpc/next] [also build test ERROR on v5.0-rc8] [cannot apply to next-20190225] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https

[PATCH 4.20 040/183] soc/fsl/qe: fix err handling of ucc_of_parse_tdm

2019-02-25 Thread Greg Kroah-Hartman
4.20-stable review patch. If anyone has any objections, please let me know. -- [ Upstream commit 8d68100ab4ad92560a16a68b72e068613ac4d573 ] Currently there are some issues with the ucc_of_parse_tdm function: 1, a possible null pointer dereference in ucc_of_parse_tdm, detected by

Re: [PATCH V2] ASoC: fsl_esai: fix channel swap issue when stream starts

2019-02-25 Thread Nicolin Chen
On Mon, Feb 25, 2019 at 02:48:18AM +, S.j. Wang wrote: > There is very low possibility ( < 0.1% ) that channel swap happened > in beginning when multi output/input pin is enabled. The issue is > that hardware can't send data to correct pin in the beginning with > the normal enable flow. > > Th

[PATCH 1/5] mm/resource: return real error codes from walk failures

2019-02-25 Thread Dave Hansen
From: Dave Hansen walk_system_ram_range() can return an error code either becuase *it* failed, or because the 'func' that it calls returned an error. The memory hotplug does the following: ret = walk_system_ram_range(..., func); if (ret) return ret; and 'ret'

Re: [PATCH v7 00/11] KASAN for powerpc/32

2019-02-25 Thread Christophe Leroy
Le 25/02/2019 à 14:48, Christophe Leroy a écrit : This series adds KASAN support to powerpc/32 Looks like only half of defconfigs build ok. I hope I have now fixes everything. Will run on kisskb tonight and send out v8 tomorrow if everything is OK. Christophe Tested on nohash/32 (8xx)

[PATCH] tty: hvc_xen: Mark expected switch fall-through

2019-02-25 Thread Gustavo A. R. Silva
In preparation to enabling -Wimplicit-fallthrough, mark switch cases where we are expecting to fall through. This patch fixes the following warning: drivers/tty/hvc/hvc_xen.c: In function ‘xencons_backend_changed’: drivers/tty/hvc/hvc_xen.c:493:6: warning: this statement may fall through [-Wimpl

Re: [PATCH v2 1/2] arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()

2019-02-25 Thread kbuild test robot
Hi Himadri, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on powerpc/next] [also build test WARNING on v5.0-rc8 next-20190225] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day

Re: [PATCH] mmap.2: describe the 5level paging hack

2019-02-25 Thread Michael Kerrisk (man-pages)
On 2/11/19 5:36 PM, Jann Horn wrote: > The manpage is missing information about the compatibility hack for > 5-level paging that went in in 4.14, around commit ee00f4a32a76 ("x86/mm: > Allow userspace have mappings above 47-bit"). Add some information about > that. > > While I don't think any hard

Re: [RFC PATCH 3/5] kasan: allow architectures to provide an outline readiness check

2019-02-25 Thread Christophe Leroy
Hi Daniel, Le 18/02/2019 à 07:13, Daniel Axtens a écrit : christophe leroy writes: Le 15/02/2019 à 01:04, Daniel Axtens a écrit : In powerpc (as I understand it), we spend a lot of time in boot running in real mode before MMU paging is initalised. During this time we call a lot of generic co

[PATCH v7 06/11] powerpc/32: make KVIRT_TOP dependant on FIXMAP_START

2019-02-25 Thread Christophe Leroy
When we add KASAN shadow area, KVIRT_TOP can't be anymore fixed at 0xfe00. This patch uses FIXADDR_START to define KVIRT_TOP. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/book3s/32/pgtable.h | 2 +- arch/powerpc/include/asm/nohash/32/pgtable.h | 2 +- arch/powerpc/mm/init_32

[PATCH v7 07/11] powerpc/32: prepare shadow area for KASAN

2019-02-25 Thread Christophe Leroy
This patch prepares a shadow area for KASAN. The shadow area will be at the top of the kernel virtual memory space above the fixmap area and will occupy one eighth of the total kernel virtual memory space. Signed-off-by: Christophe Leroy --- arch/powerpc/Kconfig | 5 + arch/po

[PATCH v7 10/11] powerpc/32s: move hash code patching out of MMU_init_hw()

2019-02-25 Thread Christophe Leroy
For KASAN, hash table handling will be activated early for accessing to KASAN shadow areas. In order to avoid any modification of the hash functions while they are still used with the early hash table, the code patching is moved out of MMU_init_hw() and put close to the big-bang switch to the fina

[PATCH v7 11/11] powerpc/32s: set up an early static hash table for KASAN.

2019-02-25 Thread Christophe Leroy
KASAN requires early activation of hash table, before memblock() functions are available. This patch implements an early hash_table statically defined in __initdata. During early boot, a single page table is used. For hash32, when doing the final init, one page table is allocated for each PGD ent

[PATCH v7 08/11] powerpc: disable KASAN instrumentation on early/critical files.

2019-02-25 Thread Christophe Leroy
All files containing functions run before kasan_early_init() is called must have KASAN instrumentation disabled. For those file, branch profiling also have to be disabled otherwise each if () generates a call to ftrace_likely_update(). Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/Mak

[PATCH v7 09/11] powerpc/32: Add KASAN support

2019-02-25 Thread Christophe Leroy
This patch adds KASAN support for PPC32. The following patch will add an early activation of hash table for book3s. Until then, a warning will be raised if trying to use KASAN on an hash 6xx. To support KASAN, this patch initialises that MMU mapings for accessing to the KASAN shadow area defined i

[PATCH v7 05/11] powerpc/32: use memset() instead of memset_io() to zero BSS

2019-02-25 Thread Christophe Leroy
Since commit 400c47d81ca38 ("powerpc32: memset: only use dcbz once cache is enabled"), memset() can be used before activation of the cache, so no need to use memset_io() for zeroing the BSS. Acked-by: Dmitry Vyukov Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/early_32.c | 6 ++ 1

[PATCH v7 00/11] KASAN for powerpc/32

2019-02-25 Thread Christophe Leroy
This series adds KASAN support to powerpc/32 Tested on nohash/32 (8xx) and book3s/32 (mpc832x ie 603). Boot tested on qemu mac99 Changes in v7: - split in several smaller patches - prom_init now has its own string functions - full deactivation of powerpc-optimised string functions when KASAN is a

[PATCH v7 01/11] powerpc/32: Move early_init() in a separate file

2019-02-25 Thread Christophe Leroy
In preparation of KASAN, move early_init() into a separate file in order to allow deactivation of KASAN for that function. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/Makefile | 2 +- arch/powerpc/kernel/early_32.c | 38 ++ arch/powerpc/kernel/s

[PATCH v7 04/11] powerpc/mm: don't use direct assignation during early boot.

2019-02-25 Thread Christophe Leroy
In kernel/cputable.c, explicitly use memcpy() instead of *y = *x; This will allow GCC to replace it with __memcpy() when KASAN is selected. Acked-by: Dmitry Vyukov Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/cputable.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletion

[PATCH v7 02/11] powerpc: prepare string/mem functions for KASAN

2019-02-25 Thread Christophe Leroy
CONFIG_KASAN implements wrappers for memcpy() memmove() and memset() Those wrappers are doing the verification then call respectively __memcpy() __memmove() and __memset(). The arches are therefore expected to rename their optimised functions that way. For files on which KASAN is inhibited, #defin

[PATCH v7 03/11] powerpc/prom_init: don't use string functions from lib/

2019-02-25 Thread Christophe Leroy
When KASAN is active, the string functions in lib/ are doing the KASAN checks. This is too early for prom_init. This patch implements dedicated string functions for prom_init, which will be compiled in with KASAN disabled. Size of prom_init before the patch: textdata bss dec he

Re: [PATCH v2 11/16] KVM: introduce a 'mmap' method for KVM devices

2019-02-25 Thread Cédric Le Goater
Hello Paolo, On 2/25/19 4:33 AM, David Gibson wrote: > On Fri, Feb 22, 2019 at 12:28:35PM +0100, Cédric Le Goater wrote: >> Some KVM devices will want to handle special mappings related to the >> underlying HW. For instance, the XIVE interrupt controller of the >> POWER9 processor has MMIO pages f

Re: [PATCH v2 01/16] powerpc/xive: add OPAL extensions for the XIVE native exploitation support

2019-02-25 Thread Cédric Le Goater
On 2/25/19 4:50 AM, Michael Ellerman wrote: > Cédric Le Goater writes: > >> The support for XIVE native exploitation mode in Linux/KVM needs a >> couple more OPAL calls to configure the sPAPR guest and to get/set the >> state of the XIVE internal structures. >> >> Signed-off-by: Cédric Le Goater

[PATCH v2 2/2] arch: powerpc/hlwd-pic: Add missing of_node-put() in hlwd_pic_probe()

2019-02-25 Thread Himadri Pandya
Decrement the reference count on device_node "np" while breaking out of the loop. Issue identified by Coccinelle. Signed-off-by: Himadri Pandya --- Changes in V2: - Change subject line --- arch/powerpc/platforms/embedded6xx/hlwd-pic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

[PATCH v2 1/2] arch: powerpc/kexec: Add missing of_node-put() in default_machine_kexec_prepare()

2019-02-25 Thread Himadri Pandya
Decrement the reference count on device_node "node" while breaking out of the loop. Issue identified by Coccinelle. Signed-off-by: Himadri Pandya --- Changes in V2: - Change subject line --- arch/powerpc/kernel/machine_kexec_64.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/p