[PATCH] powerpc/perf: Quiet PMU registration message

2018-10-08 Thread Joel Stanley
On a Power9 box we get a few screens full of these on boot. Drop them to pr_debug. [5.993645] nest_centaur6_imc performance monitor hardware support registered [5.993728] nest_centaur7_imc performance monitor hardware support registered [5.996510] core_imc performance monitor hardware

Re: [PATCH v2 3/3] powerpc: machine check interrupt is a non-maskable interrupt

2018-10-08 Thread Nicholas Piggin
On Tue, 9 Oct 2018 06:46:30 +0200 Christophe LEROY wrote: > Le 09/10/2018 à 06:32, Nicholas Piggin a écrit : > > On Mon, 8 Oct 2018 17:39:11 +0200 > > Christophe LEROY wrote: > > > >> Hi Nick, > >> > >> Le 19/07/2017 à 08:59, Nicholas Piggin a écrit : > >>> Use nmi_enter similarly to

[PATCH] powerpc/mm: make NULL pointer deferences explicit on bad page faults.

2018-10-08 Thread Christophe Leroy
As several other arches including x86, this patch makes it explicit that a bad page fault is a NULL pointer dereference when the fault address is lower than PAGE_SIZE Signed-off-by: Christophe Leroy --- arch/powerpc/mm/fault.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-)

Re: [PATCH 5/5] dma-direct: always allow dma mask <= physiscal memory size

2018-10-08 Thread Benjamin Herrenschmidt
On Wed, 2018-10-03 at 16:10 -0700, Alexander Duyck wrote: > > -* Because 32-bit DMA masks are so common we expect every > > architecture > > -* to be able to satisfy them - either by not supporting more > > physical > > -* memory, or by providing a ZONE_DMA32. If neither

[PATCH v7 9/9] powerpc: clean stack pointers naming

2018-10-08 Thread Christophe Leroy
Some stack pointers used to also be thread_info pointers and were called tp. Now that they are only stack pointers, rename them sp. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 17 +++-- arch/powerpc/kernel/setup_64.c | 20 ++-- 2 files

[PATCH v7 8/9] powerpc/64: Remove CURRENT_THREAD_INFO

2018-10-08 Thread Christophe Leroy
Now that current_thread_info is located at the beginning of 'current' task struct, CURRENT_THREAD_INFO macro is not really needed any more. This patch replaces it by loads of the value at PACACURRENT(r13). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/exception-64s.h | 4

[PATCH v7 6/9] powerpc: 'current_set' is now a table of task_struct pointers

2018-10-08 Thread Christophe Leroy
The table of pointers 'current_set' has been used for retrieving the stack and current. They used to be thread_info pointers as they were pointing to the stack and current was taken from the 'task' field of the thread_info. Now, the pointers of 'current_set' table are now both pointers to

[PATCH v7 7/9] powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU

2018-10-08 Thread Christophe Leroy
Now that thread_info is similar to task_struct, it's address is in r2 so CURRENT_THREAD_INFO() macro is useless. This patch removes it. At the same time, as the 'cpu' field is not anymore in thread_info, this patch renames it to TASK_CPU. Signed-off-by: Christophe Leroy ---

[PATCH v7 5/9] powerpc: regain entire stack space

2018-10-08 Thread Christophe Leroy
thread_info is not anymore in the stack, so the entire stack can now be used. There is also no risk anymore of corrupting task_cpu(p) with a stack overflow so the patch removes the test. When doing this, an explicit test for NULL stack pointer is needed in validate_sp() as it is not anymore

[PATCH v7 4/9] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Christophe Leroy
This patch activates CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if stack addresses are

[PATCH v7 3/9] powerpc: Prepare for moving thread_info into task_struct

2018-10-08 Thread Christophe Leroy
This patch cleans the powerpc kernel before activating CONFIG_THREAD_INFO_IN_TASK: - The purpose of the pointer given to call_do_softirq() and call_do_irq() is to point the new stack ==> change it to void* and rename it 'sp' - Don't use CURRENT_THREAD_INFO() to locate the stack. - Fix a few

[PATCH v7 2/9] powerpc: Only use task_struct 'cpu' field on SMP

2018-10-08 Thread Christophe Leroy
When moving to CONFIG_THREAD_INFO_IN_TASK, the thread_info 'cpu' field gets moved into task_struct and only defined when CONFIG_SMP is set. This patch ensures that TI_CPU is only used when CONFIG_SMP is set and that task_struct 'cpu' field is not used directly out of SMP code. Signed-off-by:

[PATCH v7 1/9] book3s/64: avoid circular header inclusion in mmu-hash.h

2018-10-08 Thread Christophe Leroy
When activating CONFIG_THREAD_INFO_IN_TASK, linux/sched.h includes asm/current.h. This generates a circular dependency. To avoid that, asm/processor.h shall not be included in mmu-hash.h In order to do that, this patch moves into a new header called asm/task_size_user64.h the information from

[PATCH v7 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Christophe Leroy
The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if

Re: [PATCH v2 3/3] powerpc: machine check interrupt is a non-maskable interrupt

2018-10-08 Thread Christophe LEROY
Le 09/10/2018 à 06:32, Nicholas Piggin a écrit : On Mon, 8 Oct 2018 17:39:11 +0200 Christophe LEROY wrote: Hi Nick, Le 19/07/2017 à 08:59, Nicholas Piggin a écrit : Use nmi_enter similarly to system reset interrupts. This uses NMI printk NMI buffers and turns off various debugging

Re: [PATCH] powerpc/xmon/ppc-opc: Use ARRAY_SIZE macro

2018-10-08 Thread Joe Perches
On Tue, 2018-10-09 at 14:43 +1100, Michael Ellerman wrote: > Joe Perches writes: > > > On Thu, 2018-10-04 at 19:10 +0200, Gustavo A. R. Silva wrote: > > > Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. > > [] > > > diff --git a/arch/powerpc/xmon/ppc-opc.c

Re: [PATCH v2 3/3] powerpc: machine check interrupt is a non-maskable interrupt

2018-10-08 Thread Nicholas Piggin
On Mon, 8 Oct 2018 17:39:11 +0200 Christophe LEROY wrote: > Hi Nick, > > Le 19/07/2017 à 08:59, Nicholas Piggin a écrit : > > Use nmi_enter similarly to system reset interrupts. This uses NMI > > printk NMI buffers and turns off various debugging facilities that > > helps avoid tripping on

Re: [PATCH] powerpc/xmon/ppc-opc: Use ARRAY_SIZE macro

2018-10-08 Thread Michael Ellerman
Joe Perches writes: > On Thu, 2018-10-04 at 19:10 +0200, Gustavo A. R. Silva wrote: >> Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. > [] >> diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c > [] >> @@ -966,8 +966,7 @@ const struct powerpc_operand

Re: [PATCH] powerpc/xmon/ppc-opc: Use ARRAY_SIZE macro

2018-10-08 Thread Joe Perches
On Thu, 2018-10-04 at 19:10 +0200, Gustavo A. R. Silva wrote: > Use ARRAY_SIZE instead of dividing sizeof array with sizeof an element. [] > diff --git a/arch/powerpc/xmon/ppc-opc.c b/arch/powerpc/xmon/ppc-opc.c [] > @@ -966,8 +966,7 @@ const struct powerpc_operand powerpc_operands[] = >{

Re: [PATCH v5 06/33] KVM: PPC: Book3S HV: Simplify real-mode interrupt handling

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:30:52PM +1100, Paul Mackerras wrote: > This streamlines the first part of the code that handles a hypervisor > interrupt that occurred in the guest. With this, all of the real-mode > handling that occurs is done before the "guest_exit_cont" label; once > we get to that

Re: [PATCH v5 22/33] KVM: PPC: Book3S HV: Introduce rmap to track nested guest mappings

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:31:08PM +1100, Paul Mackerras wrote: > From: Suraj Jitindar Singh > > When a host (L0) page which is mapped into a (L1) guest is in turn > mapped through to a nested (L2) guest we keep a reverse mapping (rmap) > so that these mappings can be retrieved later. > >

Re: [PATCH v5 17/33] KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:31:03PM +1100, Paul Mackerras wrote: > This starts the process of adding the code to support nested HV-style > virtualization. It defines a new H_SET_PARTITION_TABLE hypercall which > a nested hypervisor can use to set the base address and size of a > partition table in

Re: [PATCH v5 33/33] KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:31:19PM +1100, Paul Mackerras wrote: > This adds a KVM_PPC_NO_HASH flag to the flags field of the > kvm_ppc_smmu_info struct, and arranges for it to be set when > running as a nested hypervisor, as an unambiguous indication > to userspace that HPT guests are not

Re: [PATCH v5 09/33] KVM: PPC: Book3S HV: Streamlined guest entry/exit path on P9 for radix guests

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:30:55PM +1100, Paul Mackerras wrote: > This creates an alternative guest entry/exit path which is used for > radix guests on POWER9 systems when we have indep_threads_mode=Y. In > these circumstances there is exactly one vcpu per vcore and there is > no coordination

Re: [PATCH v5 32/33] KVM: PPC: Book3S HV: Add a VM capability to enable nested virtualization

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:31:18PM +1100, Paul Mackerras wrote: > With this, userspace can enable a KVM-HV guest to run nested guests > under it. > > The administrator can control whether any nested guests can be run; > setting the "nested" module parameter to false prevents any guests > becoming

Re: [PATCH v5 30/33] KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode

2018-10-08 Thread David Gibson
On Mon, Oct 08, 2018 at 04:31:16PM +1100, Paul Mackerras wrote: > With this, the KVM-HV module can be loaded in a guest running under > KVM-HV, and if the hypervisor supports nested virtualization, this > guest can now act as a nested hypervisor and run nested guests. > > This also adds some

Re: [PATCH 09/16] of: overlay: validate overlay properties #address-cells and #size-cells

2018-10-08 Thread Frank Rowand
On 10/08/18 11:46, Alan Tull wrote: > On Mon, Oct 8, 2018 at 10:57 AM Alan Tull wrote: >> >> On Thu, Oct 4, 2018 at 11:14 PM wrote: >>> >>> From: Frank Rowand >>> >>> If overlay properties #address-cells or #size-cells are already in >>> the live devicetree for any given node, then the values

Re: Looking for architecture papers

2018-10-08 Thread Gustavo Romero
Hi Raz, On 10/04/2018 04:41 AM, Raz wrote: Frankly, the more I read the more perplexed I get. For example, according to BOOK III-S, chapter 3, the MSR bits are differ from the ones described in arch/powerpc/include/asm/reg.h. Bit zero, is LE, but in the book it is 64-bit mode. Would someone be

Re: Looking for architecture papers

2018-10-08 Thread Segher Boessenkool
On Mon, Oct 08, 2018 at 07:44:12PM +0300, Raz wrote: > Both systemsim and my powerpc server boots with MSR_HV=1, i.e, hypervisor > state. > Is there away to fix that ? writing to the MSR cannot work according > the documentation ( and reality ). But that is what you do: you write HV=0 in MSR.

[PATCH 4.18 125/168] sched/topology: Set correct NUMA topology type

2018-10-08 Thread Greg Kroah-Hartman
4.18-stable review patch. If anyone has any objections, please let me know. -- From: Srikar Dronamraju [ Upstream commit e5e96fafd9028b1478b165db78c52d981c14f471 ] With the following commit: 051f3ca02e46 ("sched/topology: Introduce NUMA identity node sched domain") the

Re: [PATCH 09/16] of: overlay: validate overlay properties #address-cells and #size-cells

2018-10-08 Thread Alan Tull
On Mon, Oct 8, 2018 at 10:57 AM Alan Tull wrote: > > On Thu, Oct 4, 2018 at 11:14 PM wrote: > > > > From: Frank Rowand > > > > If overlay properties #address-cells or #size-cells are already in > > the live devicetree for any given node, then the values in the > > overlay must match the values

Re: [PATCH 0/8] add generic builtin command line

2018-10-08 Thread Maksym Kokhan
Hi, Daniel On Sat, Sep 29, 2018 at 9:17 PM wrote: > > On Thu, Sep 27, 2018 at 07:55:08PM +0300, Maksym Kokhan wrote: > > Daniel Walker (7): > > add generic builtin command line > > drivers: of: ifdef out cmdline section > > x86: convert to generic builtin command line > > arm: convert to

Re: [PATCH 29/36] dt-bindings: arm: Convert Renesas board/soc bindings to json-schema

2018-10-08 Thread Rob Herring
On Mon, Oct 8, 2018 at 10:13 AM Geert Uytterhoeven wrote: > > Hi Rob, > > On Mon, Oct 8, 2018 at 4:57 PM Rob Herring wrote: > > On Mon, Oct 8, 2018 at 2:47 AM Geert Uytterhoeven > > wrote: > > > On Fri, Oct 5, 2018 at 6:59 PM Rob Herring wrote: > > > > Convert Renesas SoC bindings to DT

Re: Looking for architecture papers

2018-10-08 Thread Raz
Both systemsim and my powerpc server boots with MSR_HV=1, i.e, hypervisor state. Is there away to fix that ? writing to the MSR cannot work according the documentation ( and reality ). On Sat, Oct 6, 2018 at 3:27 PM Segher Boessenkool wrote: > > On Sat, Oct 06, 2018 at 12:19:45PM +0300, Raz

Re: [PATCH v2 3/3] powerpc: machine check interrupt is a non-maskable interrupt

2018-10-08 Thread Christophe LEROY
Hi Nick, Le 19/07/2017 à 08:59, Nicholas Piggin a écrit : Use nmi_enter similarly to system reset interrupts. This uses NMI printk NMI buffers and turns off various debugging facilities that helps avoid tripping on ourselves or other CPUs. Signed-off-by: Nicholas Piggin ---

Re: [PATCH 09/16] of: overlay: validate overlay properties #address-cells and #size-cells

2018-10-08 Thread Alan Tull
On Thu, Oct 4, 2018 at 11:14 PM wrote: > > From: Frank Rowand > > If overlay properties #address-cells or #size-cells are already in > the live devicetree for any given node, then the values in the > overlay must match the values in the live tree. Hi Frank, I'm starting some FPGA testing on

Patch "sched/topology: Set correct NUMA topology type" has been added to the 4.18-stable tree

2018-10-08 Thread gregkh
This is a note to let you know that I've just added the patch titled sched/topology: Set correct NUMA topology type to the 4.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is:

Re: [PATCH 29/36] dt-bindings: arm: Convert Renesas board/soc bindings to json-schema

2018-10-08 Thread Geert Uytterhoeven
Hi Rob, On Mon, Oct 8, 2018 at 4:57 PM Rob Herring wrote: > On Mon, Oct 8, 2018 at 2:47 AM Geert Uytterhoeven > wrote: > > On Fri, Oct 5, 2018 at 6:59 PM Rob Herring wrote: > > > Convert Renesas SoC bindings to DT schema format using json-schema. > > > --- /dev/null > > > +++

Re: [PATCH 05/36] dt-bindings: arm: renesas: Move 'renesas,prr' binding to its own doc

2018-10-08 Thread Rob Herring
On Mon, Oct 8, 2018 at 2:05 AM Geert Uytterhoeven wrote: > > Hi Rob, > > On Fri, Oct 5, 2018 at 6:58 PM Rob Herring wrote: > > In preparation to convert board-level bindings to json-schema, move > > various misc SoC bindings out to their own file. > > > > Cc: Mark Rutland > > Cc: Simon Horman

Re: [PATCH 29/36] dt-bindings: arm: Convert Renesas board/soc bindings to json-schema

2018-10-08 Thread Rob Herring
On Mon, Oct 8, 2018 at 2:47 AM Geert Uytterhoeven wrote: > > Hi Rob, > > On Fri, Oct 5, 2018 at 6:59 PM Rob Herring wrote: > > Convert Renesas SoC bindings to DT schema format using json-schema. > > > > Cc: Simon Horman > > Cc: Magnus Damm > > Cc: Mark Rutland > > Cc:

Re: [PATCH 29/36] dt-bindings: arm: Convert Renesas board/soc bindings to json-schema

2018-10-08 Thread Rob Herring
On Mon, Oct 8, 2018 at 3:02 AM Simon Horman wrote: > > On Fri, Oct 05, 2018 at 11:58:41AM -0500, Rob Herring wrote: > > Convert Renesas SoC bindings to DT schema format using json-schema. > > > > Cc: Simon Horman > > Cc: Magnus Damm > > Cc: Mark Rutland > > Cc:

Re: [PATCH 28/36] dt-bindings: arm: Convert Rockchip board/soc bindings to json-schema

2018-10-08 Thread Rob Herring
On Mon, Oct 8, 2018 at 4:45 AM Heiko Stuebner wrote: > > Hi Rob, > > either I'm misunderstanding that, or something did go a bit wrong during > the conversion, as pointed out below: > > Am Freitag, 5. Oktober 2018, 18:58:40 CEST schrieb Rob Herring: > > Convert Rockchip SoC bindings to DT schema

Re: [PATCH 22/36] dt-bindings: arm: Convert FSL board/soc bindings to json-schema

2018-10-08 Thread Rob Herring
On Mon, Oct 8, 2018 at 2:02 AM Shawn Guo wrote: > > On Fri, Oct 05, 2018 at 11:58:34AM -0500, Rob Herring wrote: > > Convert Freescale SoC bindings to DT schema format using json-schema. > > +properties: > > + $nodename: > > +const: '/' > > + compatible: > > +oneOf: > > + -

Re: [PATCH v5 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Christophe Leroy
On 10/08/2018 11:06 AM, Michael Ellerman wrote: Christophe Leroy writes: The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from

Re: [PATCH 29/36] dt-bindings: arm: Convert Renesas board/soc bindings to json-schema

2018-10-08 Thread Simon Horman
On Fri, Oct 05, 2018 at 11:58:41AM -0500, Rob Herring wrote: > Convert Renesas SoC bindings to DT schema format using json-schema. > > Cc: Simon Horman > Cc: Magnus Damm > Cc: Mark Rutland > Cc: linux-renesas-...@vger.kernel.org > Cc: devicet...@vger.kernel.org > Signed-off-by: Rob Herring

Re: [PATCH v5 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Michael Ellerman
Christophe Leroy writes: > The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which > moves the thread_info into task_struct. > > Moving thread_info into task_struct has the following advantages: > - It protects thread_info from corruption in the case of stack > overflows. > -

Re: [PATCH v6 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Benjamin Herrenschmidt
On Mon, 2018-10-08 at 09:16 +, Christophe Leroy wrote: > The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which > moves the thread_info into task_struct. We need to make sure we don't have code that assumes that we don't take faults on TI access. On ppc64, the stack SLB

Re: [PATCH 28/36] dt-bindings: arm: Convert Rockchip board/soc bindings to json-schema

2018-10-08 Thread Heiko Stuebner
Hi Rob, either I'm misunderstanding that, or something did go a bit wrong during the conversion, as pointed out below: Am Freitag, 5. Oktober 2018, 18:58:40 CEST schrieb Rob Herring: > Convert Rockchip SoC bindings to DT schema format using json-schema. > > Cc: Mark Rutland > Cc: Heiko

Re: [RFC PATCH kernel] vfio/spapr_tce: Get rid of possible infinite loop

2018-10-08 Thread Michael Ellerman
Serhii Popovych writes: > Alexey Kardashevskiy wrote: >> As a part of cleanup, the SPAPR TCE IOMMU subdriver releases preregistered >> memory. If there is a bug in memory release, the loop in >> tce_iommu_release() becomes infinite; this actually happened to me. >> >> This makes the loop finite

Re: [PATCH] powerpc: Fix HMIs on big-endian with CONFIG_RELOCATABLE=y

2018-10-08 Thread Benjamin Herrenschmidt
On Mon, 2018-10-08 at 17:04 +1000, Nicholas Piggin wrote: > On Mon, 08 Oct 2018 15:08:31 +1100 > Benjamin Herrenschmidt wrote: > > > HMIs will crash the kernel due to > > > > BRANCH_LINK_TO_FAR(hmi_exception_realmode) > > > > Calling into the OPD instead of the actual code. > > > >

[PATCH v6 9/9] powerpc: clean stack pointers naming

2018-10-08 Thread Christophe Leroy
Some stack pointers used to also be thread_info pointers and were called tp. Now that they are only stack pointers, rename them sp. Signed-off-by: Christophe Leroy --- arch/powerpc/kernel/irq.c | 17 +++-- arch/powerpc/kernel/setup_64.c | 20 ++-- 2 files

[PATCH v6 8/9] powerpc/64: Remove CURRENT_THREAD_INFO

2018-10-08 Thread Christophe Leroy
Now that current_thread_info is located at the beginning of 'current' task struct, CURRENT_THREAD_INFO macro is not really needed any more. This patch replaces it by loads of the value at PACACURRENT(r13). Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/exception-64s.h | 4

[PATCH v6 7/9] powerpc/32: Remove CURRENT_THREAD_INFO and rename TI_CPU

2018-10-08 Thread Christophe Leroy
Now that thread_info is similar to task_struct, it's address is in r2 so CURRENT_THREAD_INFO() macro is useless. This patch removes it. At the same time, as the 'cpu' field is not anymore in thread_info, this patch renames it to TASK_CPU. Signed-off-by: Christophe Leroy ---

[PATCH v6 6/9] powerpc: 'current_set' is now a table of task_struct pointers

2018-10-08 Thread Christophe Leroy
The table of pointers 'current_set' has been used for retrieving the stack and current. They used to be thread_info pointers as they were pointing to the stack and current was taken from the 'task' field of the thread_info. Now, the pointers of 'current_set' table are now both pointers to

[PATCH v6 5/9] powerpc: regain entire stack space

2018-10-08 Thread Christophe Leroy
thread_info is not anymore in the stack, so the entire stack can now be used. In the meantime, with the previous patch all pointers to the stacks are not anymore pointers to thread_info so this patch changes them to void* Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/irq.h

[PATCH v6 4/9] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Christophe Leroy
This patch activates CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if stack addresses are

[PATCH v6 3/9] powerpc: Prepare for moving thread_info into task_struct

2018-10-08 Thread Christophe Leroy
This patch cleans the powerpc kernel before activating CONFIG_THREAD_INFO_IN_TASK: - The purpose of the pointer given to call_do_softirq() and call_do_irq() is to point the new stack ==> change it to void* and rename it 'sp' - Don't use CURRENT_THREAD_INFO() to locate the stack. - Fix a few

[PATCH v6 2/9] powerpc: Only use task_struct 'cpu' field on SMP

2018-10-08 Thread Christophe Leroy
When moving to CONFIG_THREAD_INFO_IN_TASK, the thread_info 'cpu' field gets moved into task_struct and only defined when CONFIG_SMP is set. This patch ensures that TI_CPU is only used when CONFIG_SMP is set and that task_struct 'cpu' field is not used directly out of SMP code. Signed-off-by:

[PATCH v6 0/9] powerpc: Switch to CONFIG_THREAD_INFO_IN_TASK

2018-10-08 Thread Christophe Leroy
The purpose of this serie is to activate CONFIG_THREAD_INFO_IN_TASK which moves the thread_info into task_struct. Moving thread_info into task_struct has the following advantages: - It protects thread_info from corruption in the case of stack overflows. - Its address is harder to determine if

[PATCH v6 1/9] book3s/64: avoid circular header inclusion in mmu-hash.h

2018-10-08 Thread Christophe Leroy
When activating CONFIG_THREAD_INFO_IN_TASK, linux/sched.h includes asm/current.h. This generates a circular dependency. To avoid that, asm/processor.h shall not be included in mmu-hash.h In order to do that, this patch moves into a new header called asm/task_size_user64.h the information from

Re: [PATCH -next] powerpc/powernv: Fix debugfs_simple_attr.cocci warnings

2018-10-08 Thread Michael Ellerman
YueHaibing writes: > Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE > for debugfs files. > > Semantic patch information: > Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() > imposes some significant overhead as compared to > DEFINE_DEBUGFS_ATTRIBUTE +

Re: [PATCH] powerpc: Don't print kernel instructions in show_user_instructions()

2018-10-08 Thread Michael Ellerman
Jann Horn writes: > On Fri, Oct 5, 2018 at 3:21 PM Michael Ellerman wrote: >> Recently we implemented show_user_instructions() which dumps the code >> around the NIP when a user space process dies with an unhandled >> signal. This was modelled on the x86 code, and we even went so far as >> to

Re: [PATCH v5 05/33] KVM: PPC: Book3S HV: Extract PMU save/restore operations as C-callable functions

2018-10-08 Thread Madhavan Srinivasan
On Monday 08 October 2018 11:00 AM, Paul Mackerras wrote: This pulls out the assembler code that is responsible for saving and restoring the PMU state for the host and guest into separate functions so they can be used from an alternate entry path. The calling convention is made compatible

Re: [PATCH] powerpc: Don't print kernel instructions in show_user_instructions()

2018-10-08 Thread Michael Ellerman
Christophe LEROY writes: > Le 05/10/2018 à 15:21, Michael Ellerman a écrit : >> Recently we implemented show_user_instructions() which dumps the code ... >> diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c >> index 913c5725cdb2..bb6ac471a784 100644 >> ---

Re: [PATCH 29/36] dt-bindings: arm: Convert Renesas board/soc bindings to json-schema

2018-10-08 Thread Geert Uytterhoeven
Hi Rob, On Fri, Oct 5, 2018 at 6:59 PM Rob Herring wrote: > Convert Renesas SoC bindings to DT schema format using json-schema. > > Cc: Simon Horman > Cc: Magnus Damm > Cc: Mark Rutland > Cc: linux-renesas-...@vger.kernel.org > Cc: devicet...@vger.kernel.org > Signed-off-by: Rob Herring

Re: [RFC PATCH kernel] vfio/spapr_tce: Get rid of possible infinite loop

2018-10-08 Thread Serhii Popovych
Alexey Kardashevskiy wrote: > As a part of cleanup, the SPAPR TCE IOMMU subdriver releases preregistered > memory. If there is a bug in memory release, the loop in > tce_iommu_release() becomes infinite; this actually happened to me. > > This makes the loop finite and prints a warning on every

Re: [PATCH 36/36] dt-bindings: arm: Convert ZTE board/soc bindings to json-schema

2018-10-08 Thread Shawn Guo
On Fri, Oct 05, 2018 at 11:58:48AM -0500, Rob Herring wrote: > Convert ZTE SoC bindings to DT schema format using json-schema. > > Cc: Jun Nie > Cc: Baoyou Xie > Cc: Shawn Guo > Cc: Mark Rutland > Cc: linux-arm-ker...@lists.infradead.org > Cc: devicet...@vger.kernel.org > Signed-off-by: Rob

Re: [PATCH 05/36] dt-bindings: arm: renesas: Move 'renesas,prr' binding to its own doc

2018-10-08 Thread Geert Uytterhoeven
Hi Rob, On Fri, Oct 5, 2018 at 6:58 PM Rob Herring wrote: > In preparation to convert board-level bindings to json-schema, move > various misc SoC bindings out to their own file. > > Cc: Mark Rutland > Cc: Simon Horman > Cc: Magnus Damm > Cc: devicet...@vger.kernel.org > Cc:

Re: [PATCH] powerpc: Fix HMIs on big-endian with CONFIG_RELOCATABLE=y

2018-10-08 Thread Nicholas Piggin
On Mon, 08 Oct 2018 15:08:31 +1100 Benjamin Herrenschmidt wrote: > HMIs will crash the kernel due to > > BRANCH_LINK_TO_FAR(hmi_exception_realmode) > > Calling into the OPD instead of the actual code. > > Signed-off-by: Benjamin Herrenschmidt > --- > > This hack fixes it for me, but

Re: [PATCH 22/36] dt-bindings: arm: Convert FSL board/soc bindings to json-schema

2018-10-08 Thread Shawn Guo
On Fri, Oct 05, 2018 at 11:58:34AM -0500, Rob Herring wrote: > Convert Freescale SoC bindings to DT schema format using json-schema. > > Cc: Shawn Guo > Cc: Mark Rutland > Cc: devicet...@vger.kernel.org > Signed-off-by: Rob Herring > --- > .../devicetree/bindings/arm/armadeus.txt | 6 -

Re: [PATCH 06/36] dt-bindings: arm: zte: Move sysctrl bindings to their own doc

2018-10-08 Thread Shawn Guo
On Fri, Oct 05, 2018 at 11:58:18AM -0500, Rob Herring wrote: > In preparation to convert board-level bindings to json-schema, move > various misc SoC bindings out to their own file. > > Cc: Mark Rutland > Cc: Jun Nie > Cc: Baoyou Xie > Cc: Shawn Guo > Cc: devicet...@vger.kernel.org > Cc:

Re: [PATCH 04/36] dt-bindings: arm: fsl: Move DCFG and SCFG bindings to their own docs

2018-10-08 Thread Shawn Guo
On Fri, Oct 05, 2018 at 11:58:16AM -0500, Rob Herring wrote: > In preparation to convert board-level bindings to json-schema, move > various misc SoC bindings out to their own file. > > Cc: Shawn Guo > Cc: Mark Rutland > Cc: devicet...@vger.kernel.org > Signed-off-by: Rob Herring Acked-by:

Re: [PATCH v4 6/6] arm64: dts: add LX2160ARDB board support

2018-10-08 Thread Shawn Guo
On Thu, Oct 04, 2018 at 06:33:51AM +0530, Vabhav Sharma wrote: > LX2160A reference design board (RDB) is a high-performance > computing, evaluation, and development platform with LX2160A > SoC. > > Signed-off-by: Priyanka Jain > Signed-off-by: Sriram Dash > Signed-off-by: Vabhav Sharma > --- >

Re: [PATCH v4 5/6] arm64: dts: add QorIQ LX2160A SoC support

2018-10-08 Thread Shawn Guo
On Thu, Oct 04, 2018 at 06:33:50AM +0530, Vabhav Sharma wrote: > LX2160A SoC is based on Layerscape Chassis Generation 3.2 Architecture. > > LX2160A features an advanced 16 64-bit ARM v8 CortexA72 processor cores > in 8 cluster, CCN508, GICv3,two 64-bit DDR4 memory controller, 8 I2C >

[PATCH v5 33/33] KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result

2018-10-08 Thread Paul Mackerras
This adds a KVM_PPC_NO_HASH flag to the flags field of the kvm_ppc_smmu_info struct, and arranges for it to be set when running as a nested hypervisor, as an unambiguous indication to userspace that HPT guests are not supported. Reporting the KVM_CAP_PPC_MMU_HASH_V3 capability as false could be

[PATCH v5 32/33] KVM: PPC: Book3S HV: Add a VM capability to enable nested virtualization

2018-10-08 Thread Paul Mackerras
With this, userspace can enable a KVM-HV guest to run nested guests under it. The administrator can control whether any nested guests can be run; setting the "nested" module parameter to false prevents any guests becoming nested hypervisors (that is, any attempt to enable the nested capability on

[PATCH v5 30/33] KVM: PPC: Book3S HV: Allow HV module to load without hypervisor mode

2018-10-08 Thread Paul Mackerras
With this, the KVM-HV module can be loaded in a guest running under KVM-HV, and if the hypervisor supports nested virtualization, this guest can now act as a nested hypervisor and run nested guests. This also adds some checks to inform userspace that HPT guests are not supported by nested

[PATCH v5 31/33] KVM: PPC: Book3S HV: Add nested shadow page tables to debugfs

2018-10-08 Thread Paul Mackerras
This adds a list of valid shadow PTEs for each nested guest to the 'radix' file for the guest in debugfs. This can be useful for debugging. Reviewed-by: David Gibson Signed-off-by: Paul Mackerras --- arch/powerpc/include/asm/kvm_book3s_64.h | 1 + arch/powerpc/kvm/book3s_64_mmu_radix.c |

[PATCH v5 29/33] KVM: PPC: Book3S HV: Handle differing endianness for H_ENTER_NESTED

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh The hcall H_ENTER_NESTED takes two parameters: the address in L1 guest memory of a hv_regs struct and the address of a pt_regs struct. The hcall requests the L0 hypervisor to use the register values in these structs to run a L2 guest and to return the exit state of

[PATCH v5 28/33] KVM: PPC: Book3S HV: Sanitise hv_regs on nested guest entry

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh restore_hv_regs() is used to copy the hv_regs L1 wants to set to run the nested (L2) guest into the vcpu structure. We need to sanitise these values to ensure we don't let the L1 guest hypervisor do things we don't want it to. We don't let data address watchpoints or

[PATCH v5 27/33] KVM: PPC: Book3S HV: Add one-reg interface to virtual PTCR register

2018-10-08 Thread Paul Mackerras
This adds a one-reg register identifier which can be used to read and set the virtual PTCR for the guest. This register identifies the address and size of the virtual partition table for the guest, which contains information about the nested guests under this guest. Migrating this value is the

[PATCH v5 26/33] KVM: PPC: Book3S HV: Don't access HFSCR, LPIDR or LPCR when running nested

2018-10-08 Thread Paul Mackerras
When running as a nested hypervisor, this avoids reading hypervisor privileged registers (specifically HFSCR, LPIDR and LPCR) at startup; instead reasonable default values are used. This also avoids writing LPIDR in the single-vcpu entry/exit path. Also, this removes the check for CPU_FTR_HVMODE

[PATCH v5 25/33] KVM: PPC: Book3S HV: Invalidate TLB when nested vcpu moves physical cpu

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh This is only done at level 0, since only level 0 knows which physical CPU a vcpu is running on. This does for nested guests what L0 already did for its own guests, which is to flush the TLB on a pCPU when it goes to run a vCPU there, and there is another vCPU in the

[PATCH v5 24/33] KVM: PPC: Book3S HV: Use hypercalls for TLB invalidation when nested

2018-10-08 Thread Paul Mackerras
This adds code to call the H_TLB_INVALIDATE hypercall when running as a guest, in the cases where we need to invalidate TLBs (or other MMU caches) as part of managing the mappings for a nested guest. Calling H_TLB_INVALIDATE lets the nested hypervisor inform the parent hypervisor about changes to

[PATCH v5 22/33] KVM: PPC: Book3S HV: Introduce rmap to track nested guest mappings

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh When a host (L0) page which is mapped into a (L1) guest is in turn mapped through to a nested (L2) guest we keep a reverse mapping (rmap) so that these mappings can be retrieved later. Whenever we create an entry in a shadow_pgtable for a nested guest we create a

[PATCH v5 23/33] KVM: PPC: Book3S HV: Implement H_TLB_INVALIDATE hcall

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh When running a nested (L2) guest the guest (L1) hypervisor will use the H_TLB_INVALIDATE hcall when it needs to change the partition scoped page tables or the partition table which it manages. It will use this hcall in the situations where it would use a

[PATCH v5 21/33] KVM: PPC: Book3S HV: Handle page fault for a nested guest

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh Consider a normal (L1) guest running under the main hypervisor (L0), and then a nested guest (L2) running under the L1 guest which is acting as a nested hypervisor. L0 has page tables to map the address space for L1 providing the translation from L1 real address -> L0

[PATCH v5 20/33] KVM: PPC: Book3S HV: Handle hypercalls correctly when nested

2018-10-08 Thread Paul Mackerras
When we are running as a nested hypervisor, we use a hypercall to enter the guest rather than code in book3s_hv_rmhandlers.S. This means that the hypercall handlers listed in hcall_real_table never get called. There are some hypercalls that are handled there and not in kvmppc_pseries_do_hcall(),

[PATCH v5 19/33] KVM: PPC: Book3S HV: Use XICS hypercalls when running as a nested hypervisor

2018-10-08 Thread Paul Mackerras
This adds code to call the H_IPI and H_EOI hypercalls when we are running as a nested hypervisor (i.e. without the CPU_FTR_HVMODE cpu feature) and we would otherwise access the XICS interrupt controller directly or via an OPAL call. Reviewed-by: David Gibson Signed-off-by: Paul Mackerras ---

[PATCH v5 18/33] KVM: PPC: Book3S HV: Nested guest entry via hypercall

2018-10-08 Thread Paul Mackerras
This adds a new hypercall, H_ENTER_NESTED, which is used by a nested hypervisor to enter one of its nested guests. The hypercall supplies register values in two structs. Those values are copied by the level 0 (L0) hypervisor (the one which is running in hypervisor mode) into the vcpu struct of

[PATCH v5 17/33] KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization

2018-10-08 Thread Paul Mackerras
This starts the process of adding the code to support nested HV-style virtualization. It defines a new H_SET_PARTITION_TABLE hypercall which a nested hypervisor can use to set the base address and size of a partition table in its memory (analogous to the PTCR register). On the host (level 0

[PATCH v5 15/33] KVM: PPC: Book3S HV: Refactor radix page fault handler

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh The radix page fault handler accounts for all cases, including just needing to insert a pte. This breaks it up into separate functions for the two main cases; setting rc and inserting a pte. This allows us to make the setting of rc and inserting of a pte generic for

[PATCH v5 16/33] KVM: PPC: Book3S HV: Use kvmppc_unmap_pte() in kvm_unmap_radix()

2018-10-08 Thread Paul Mackerras
kvmppc_unmap_pte() does a sequence of operations that are open-coded in kvm_unmap_radix(). This extends kvmppc_unmap_pte() a little so that it can be used by kvm_unmap_radix(), and makes kvm_unmap_radix() call it. Reviewed-by: David Gibson Signed-off-by: Paul Mackerras ---

[PATCH v5 14/33] KVM: PPC: Book3S HV: Make kvmppc_mmu_radix_xlate process/partition table agnostic

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh kvmppc_mmu_radix_xlate() is used to translate an effective address through the process tables. The process table and partition tables have identical layout. Exploit this fact to make the kvmppc_mmu_radix_xlate() function able to translate either an effective address

[PATCH v5 13/33] KVM: PPC: Book3S HV: Clear partition table entry on vm teardown

2018-10-08 Thread Paul Mackerras
From: Suraj Jitindar Singh When destroying a VM we return the LPID to the pool, however we never zero the partition table entry. This is instead done when we reallocate the LPID. Zero the partition table entry on VM teardown before returning the LPID to the pool. This means if we were running

[PATCH v5 12/33] KVM: PPC: Use ccr field in pt_regs struct embedded in vcpu struct

2018-10-08 Thread Paul Mackerras
When the 'regs' field was added to struct kvm_vcpu_arch, the code was changed to use several of the fields inside regs (e.g., gpr, lr, etc.) but not the ccr field, because the ccr field in struct pt_regs is 64 bits on 64-bit platforms, but the cr field in kvm_vcpu_arch is only 32 bits. This

[PATCH v5 11/33] KVM: PPC: Book3S HV: Add a debugfs file to dump radix mappings

2018-10-08 Thread Paul Mackerras
This adds a file called 'radix' in the debugfs directory for the guest, which when read gives all of the valid leaf PTEs in the partition-scoped radix tree for a radix guest, in human-readable format. It is analogous to the existing 'htab' file which dumps the HPT entries for a HPT guest.