Re: [RFC PATCH v3 2/7] powerpc: Prepare for moving thread_info into task_struct

2018-10-02 Thread Nicholas Piggin
On Wed, 3 Oct 2018 07:49:44 +0200 Christophe LEROY wrote: > Le 03/10/2018 à 07:02, Nicholas Piggin a écrit : > > On Mon, 1 Oct 2018 12:30:21 + (UTC) > > Christophe Leroy wrote: > > > >> This patch cleans the powerpc kernel before activating > >> CONFIG_THREAD_INFO_IN_TASK: > >> - The

Re: [RFC PATCH v3 4/7] powerpc: regain entire stack space

2018-10-02 Thread Christophe LEROY
Le 03/10/2018 à 07:34, Nicholas Piggin a écrit : On Mon, 1 Oct 2018 12:30:25 + (UTC) Christophe Leroy wrote: thread_info is not anymore in the stack, so the entire stack can now be used. Nice. In the meantime, all pointers to the stacks are not anymore pointers to thread_info so

Re: [RFC PATCH v3 3/7] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK

2018-10-02 Thread Nicholas Piggin
On Wed, 3 Oct 2018 07:47:05 +0200 Christophe LEROY wrote: > Le 03/10/2018 à 07:30, Nicholas Piggin a écrit : > > On Mon, 1 Oct 2018 12:30:23 + (UTC) > > Christophe Leroy wrote: > > > >> This patch activates CONFIG_THREAD_INFO_IN_TASK which > >> moves the thread_info into task_struct. >

Re: [RFC PATCH v3 2/7] powerpc: Prepare for moving thread_info into task_struct

2018-10-02 Thread Christophe LEROY
Le 03/10/2018 à 07:02, Nicholas Piggin a écrit : On Mon, 1 Oct 2018 12:30:21 + (UTC) Christophe Leroy wrote: 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

Re: [RFC PATCH v3 3/7] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK

2018-10-02 Thread Christophe LEROY
Le 03/10/2018 à 07:30, Nicholas Piggin a écrit : On Mon, 1 Oct 2018 12:30:23 + (UTC) Christophe Leroy wrote: 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

Re: [RFC PATCH v3 7/7] powerpc/64: Modify CURRENT_THREAD_INFO()

2018-10-02 Thread Nicholas Piggin
On Mon, 1 Oct 2018 12:30:31 + (UTC) Christophe Leroy wrote: > CURRENT_THREAD_INFO() now uses the PACA to retrieve 'current' pointer, > it doesn't use 'sp' anymore. Can you remove this too now? I think it will be clearer what's going on and easier to read once everyone remembers current is

Re: [PATCH v4] powerpc: Avoid code patching freed init sections

2018-10-02 Thread Christophe LEROY
Le 03/10/2018 à 05:20, Michael Ellerman a écrit : Andreas Schwab writes: On Sep 14 2018, Michael Neuling wrote: This stops us from doing code patching in init sections after they've been freed. This breaks booting on PowerBook6,7, crashing very early. Crud, sorry. My CI setup tests

Re: [RFC PATCH v3 5/7] powerpc: 'current_set' is now a table of task_struct pointers

2018-10-02 Thread Nicholas Piggin
On Mon, 1 Oct 2018 12:30:27 + (UTC) Christophe Leroy wrote: > 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.

Re: [PATCH v3 22/33] KVM: PPC: Book3S HV: Handle page fault for a nested guest

2018-10-02 Thread David Gibson
On Tue, Oct 02, 2018 at 09:31:21PM +1000, Paul Mackerras wrote: > 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

Re: [RFC PATCH v3 4/7] powerpc: regain entire stack space

2018-10-02 Thread Nicholas Piggin
On Mon, 1 Oct 2018 12:30:25 + (UTC) Christophe Leroy wrote: > thread_info is not anymore in the stack, so the entire stack > can now be used. Nice. > > In the meantime, all pointers to the stacks are not anymore > pointers to thread_info so this patch changes them to void* Wasn't this

Re: [RFC PATCH v3 3/7] powerpc: Activate CONFIG_THREAD_INFO_IN_TASK

2018-10-02 Thread Nicholas Piggin
On Mon, 1 Oct 2018 12:30:23 + (UTC) Christophe Leroy wrote: > 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

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

2018-10-02 Thread David Gibson
On Tue, Oct 02, 2018 at 09:31:17PM +1000, Paul Mackerras wrote: > 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

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

2018-10-02 Thread David Gibson
On Tue, Oct 02, 2018 at 09:31:16PM +1000, 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 v3 21/33] KVM: PPC: Book3S HV: Framework to handle HV Emulation Assist Interrupt

2018-10-02 Thread David Gibson
On Tue, Oct 02, 2018 at 09:31:20PM +1000, Paul Mackerras wrote: > From: Suraj Jitindar Singh > > A HEAI (hypervisor emulation assistance interrupt) occurs when a > hypervisor resource or instruction is used in a privileged but > non-hypervisor state and the LPCR_EVIRT bit is set in LPCR. When >

Re: [PATCH v2 19/33] KVM: PPC: Book3S HV: Nested guest entry via hypercall

2018-10-02 Thread David Gibson
On Tue, Oct 02, 2018 at 06:00:16PM +1000, Paul Mackerras wrote: > On Tue, Oct 02, 2018 at 05:00:09PM +1000, David Gibson wrote: > > On Fri, Sep 28, 2018 at 07:45:49PM +1000, Paul Mackerras wrote: > > > This adds a new hypercall, H_ENTER_NESTED, which is used by a nested > > > hypervisor to enter

Re: [RFC PATCH v3 2/7] powerpc: Prepare for moving thread_info into task_struct

2018-10-02 Thread Nicholas Piggin
On Mon, 1 Oct 2018 12:30:21 + (UTC) Christophe Leroy wrote: > 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* > - Don't use

Re: [RFC PATCH v3 1/7] book3s/64: avoid circular header inclusion in mmu-hash.h

2018-10-02 Thread Nicholas Piggin
On Mon, 1 Oct 2018 12:30:19 + (UTC) Christophe Leroy wrote: > 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

Re: Looking for architecture papers

2018-10-02 Thread Michael Ellerman
Raz writes: > Hello > > I want to learn about powerpc architecture, mainly hypervisor and > partioning. I download the books (1,2, and 3 ) but I feel it lacks > a lot of information. Are there other books ? The ISA describes how the CPU works to allow you to implement a hypervisor, but it

Re: [PATCH] powerpc: Add doorbell tracepoints

2018-10-02 Thread Nicholas Piggin
On Wed, 3 Oct 2018 10:29:57 +1000 Anton Blanchard wrote: > When analysing sources of OS jitter, I noticed that doorbells cannot be > traced. > > Signed-off-by: Anton Blanchard Acked-by: Nicholas Piggin > --- > arch/powerpc/include/asm/trace.h | 16 >

Re: [PATCH v4] powerpc: Avoid code patching freed init sections

2018-10-02 Thread Michael Ellerman
Andreas Schwab writes: > On Sep 14 2018, Michael Neuling wrote: > >> This stops us from doing code patching in init sections after they've >> been freed. > > This breaks booting on PowerBook6,7, crashing very early. Crud, sorry. My CI setup tests with the mac99 qemu model, but that boots

Re: [PATCH 2/3] powerpc/powernv/npu: Use size-based ATSD invalidates

2018-10-02 Thread Alistair Popple
> > > > We also support 4K page sizes on PPC. If I am not mistaken this means every > > ATSD > > would invalidate the entire GPU TLB for a the given PID on those systems. > > Could > > we change the above check to `if (size <= PAGE_64K)` to avoid this? > > PPC supports 4K pages but the GPU ATS

Re: [PATCH v4] powerpc: Avoid code patching freed init sections

2018-10-02 Thread Michael Neuling
On Tue, 2018-10-02 at 23:35 +0200, Andreas Schwab wrote: > On Sep 14 2018, Michael Neuling wrote: > > > This stops us from doing code patching in init sections after they've > > been freed. > > This breaks booting on PowerBook6,7, crashing very early. Sorry, Can you try?

Re: [PATCH 2/3] powerpc/powernv/npu: Use size-based ATSD invalidates

2018-10-02 Thread Mark Hairgrove
Thanks for the review. Comments below. On Tue, 2 Oct 2018, Alistair Popple wrote: > Thanks Mark, > > Looks like some worthwhile improvments to be had. I've added a couple of > comments inline below. > > > +#define PAGE_64K (64UL * 1024) +#define PAGE_2M (2UL * 1024 * 1024) > > +#define > >

Re: [PATCH v03 1/5] powerpc/drmem: Export 'dynamic-memory' loader

2018-10-02 Thread Michael Ellerman
Michael Bringmann writes: > powerpc/drmem: Export many of the functions of DRMEM to parse > "ibm,dynamic-memory" and "ibm,dynamic-memory-v2" during hotplug > operations and for Post Migration events. This isn't a criticism of your patch, but I think the drmem.c code should be moved into

[PATCH] powerpc: Add doorbell tracepoints

2018-10-02 Thread Anton Blanchard
When analysing sources of OS jitter, I noticed that doorbells cannot be traced. Signed-off-by: Anton Blanchard --- arch/powerpc/include/asm/trace.h | 16 arch/powerpc/kernel/dbell.c | 3 +++ 2 files changed, 19 insertions(+) diff --git a/arch/powerpc/include/asm/trace.h

[PATCH] powerpc: use PTRRELOC during early init

2018-10-02 Thread Andreas Schwab
This fixes a crash on powerpc32 when using global data during early init without relocating its address. Fixes: 51c3c62b58 (powerpc: Avoid code patching freed init sections) Signed-off-by: Andreas Schwab --- arch/powerpc/lib/code-patching.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Re: [PATCH v4] powerpc: Avoid code patching freed init sections

2018-10-02 Thread Andreas Schwab
On Sep 14 2018, Michael Neuling wrote: > This stops us from doing code patching in init sections after they've > been freed. This breaks booting on PowerBook6,7, crashing very early. Andreas. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73

Re: [PATCH v03 4/5] migration/memory: Evaluate LMB assoc changes

2018-10-02 Thread Tyrel Datwyler
On 10/01/2018 06:00 AM, Michael Bringmann wrote: > migration/memory: This patch adds code that recognizes changes to > the associativity of memory blocks described by the device-tree > properties in order to drive equivalent 'hotplug' operations to > update local and general kernel data structures

Re: [PATCH v03 3/5] migration/memory: Add hotplug READD_MULTIPLE

2018-10-02 Thread Tyrel Datwyler
On 10/01/2018 05:59 AM, Michael Bringmann wrote: > migration/memory: This patch adds a new pseries hotplug action > for CPU and memory operations, PSERIES_HP_ELOG_ACTION_READD_MULTIPLE. > This is a variant of the READD operation which performs the action > upon multiple instances of the resource

Re: [RFC 00/15] PCI: turn some __weak functions into callbacks

2018-10-02 Thread Bjorn Helgaas
On Fri, Aug 17, 2018 at 12:26:30PM +0200, Arnd Bergmann wrote: > Hi Bjorn and others, > > Triggered by Christoph's patches, I had another go at converting > all of the remaining pci host bridge implementations to be based > on pci_alloc_host_bridge and a separate registration function. > > This

Re: [PATCH v03 1/5] powerpc/drmem: Export 'dynamic-memory' loader

2018-10-02 Thread Tyrel Datwyler
On 10/01/2018 05:59 AM, Michael Bringmann wrote: > powerpc/drmem: Export many of the functions of DRMEM to parse > "ibm,dynamic-memory" and "ibm,dynamic-memory-v2" during hotplug > operations and for Post Migration events. > > Also modify the DRMEM initialization code to allow it to, > > * Be

Re: [PATCH v2 5/5] soc/fsl_qbman: export coalesce change API

2018-10-02 Thread Li Yang
On Tue, Oct 2, 2018 at 1:08 AM Madalin-cristian Bucur wrote: > > > -Original Message- > > From: Li Yang [mailto:leoyang...@nxp.com] > > Sent: Tuesday, October 2, 2018 12:50 AM > > To: Madalin-cristian Bucur > > Cc: Roy Pledge ; Claudiu Manoil > > ; Catalin Marinas ; Scott > > Wood ;

Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node

2018-10-02 Thread Tyrel Datwyler
On 10/02/2018 11:13 AM, Michael Bringmann wrote: > > > On 10/02/2018 11:04 AM, Michal Hocko wrote: >> On Tue 02-10-18 10:14:49, Michael Bringmann wrote: >>> On 10/02/2018 09:59 AM, Michal Hocko wrote: On Tue 02-10-18 09:51:40, Michael Bringmann wrote: [...] > When the device-tree

Re: [PATCH v2 0/5] soc/fsl/qbman: DPAA QBMan fixes and additions

2018-10-02 Thread Li Yang
On Tue, Oct 2, 2018 at 1:29 AM Madalin-cristian Bucur wrote: > > > -Original Message- > > From: Li Yang [mailto:leoyang...@nxp.com] > > Sent: Tuesday, October 2, 2018 1:30 AM > > To: Madalin-cristian Bucur > > Cc: Roy Pledge ; Claudiu Manoil > > ; Catalin Marinas ; Scott > > Wood ;

Re: [PATCH] powerpc/mobility: Extend start/stop topology update scope

2018-10-02 Thread Nathan Fontenot
On 10/01/2018 01:56 PM, Michael Bringmann wrote: > The PPC mobility code may receive RTAS requests to perform PRRN > topology changes at any time, including during LPAR migration > operations. In some configurations where the affinity of CPUs > or memory is being changed on that platform, the

Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node

2018-10-02 Thread Michael Bringmann
On 10/02/2018 11:04 AM, Michal Hocko wrote: > On Tue 02-10-18 10:14:49, Michael Bringmann wrote: >> On 10/02/2018 09:59 AM, Michal Hocko wrote: >>> On Tue 02-10-18 09:51:40, Michael Bringmann wrote: >>> [...] When the device-tree affinity attributes have changed for memory, the 'nid'

Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node

2018-10-02 Thread Michal Hocko
On Tue 02-10-18 10:14:49, Michael Bringmann wrote: > On 10/02/2018 09:59 AM, Michal Hocko wrote: > > On Tue 02-10-18 09:51:40, Michael Bringmann wrote: > > [...] > >> When the device-tree affinity attributes have changed for memory, > >> the 'nid' affinity calculated points to a different node for

[PATCH v2] powerpc/pseries: Track LMB nid instead of using device tree

2018-10-02 Thread Nathan Fontenot
When removing memory we need to remove the memory from the node it was added to instead of looking up the node it should be in in the device tree. During testing we have seen scenarios where the affinity for a LMB changes due to a partition migration or PRRN event. In these cases the node the LMB

Re: [PATCH RFC] mm/memory_hotplug: Introduce memory block types

2018-10-02 Thread David Hildenbrand
On 02/10/2018 15:47, Michal Hocko wrote: > On Mon 01-10-18 11:34:25, David Hildenbrand wrote: >> On 01/10/2018 10:40, Michal Hocko wrote: >>> On Fri 28-09-18 17:03:57, David Hildenbrand wrote: >>> [...] >>> >>> I haven't read the patch itself but I just wanted to note one thing >>> about this part

Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node

2018-10-02 Thread Michael Bringmann
On 10/02/2018 09:59 AM, Michal Hocko wrote: > On Tue 02-10-18 09:51:40, Michael Bringmann wrote: > [...] >> When the device-tree affinity attributes have changed for memory, >> the 'nid' affinity calculated points to a different node for the >> memory block than the one used to install it,

Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node

2018-10-02 Thread Michal Hocko
On Tue 02-10-18 09:51:40, Michael Bringmann wrote: [...] > When the device-tree affinity attributes have changed for memory, > the 'nid' affinity calculated points to a different node for the > memory block than the one used to install it, previously on the > source system. The newly calculated

Re: [PATCH] migration/mm: Add WARN_ON to try_offline_node

2018-10-02 Thread Michael Bringmann
See below. On 10/01/2018 06:20 PM, Tyrel Datwyler wrote: > On 10/01/2018 01:27 PM, Michal Hocko wrote: >> On Mon 01-10-18 13:56:25, Michael Bringmann wrote: >>> In some LPAR migration scenarios, device-tree modifications are >>> made to the affinity of the memory in the system. For instance, >>>

[PATCH v2 9/9] powerpc/64s/hash: add some slb debugging tests

2018-10-02 Thread Nicholas Piggin
This adds CONFIG_DEBUG_VM checks to ensure: - The kernel stack is in the SLB after it's flushed and bolted. - We don't insert an SLB for an address that is aleady in the SLB. - The kernel SLB miss handler does not take an SLB miss. Signed-off-by: Nicholas Piggin ---

[PATCH v2 8/9] powerpc/64s/hash: slb_flush_and_rebolt simplify

2018-10-02 Thread Nicholas Piggin
slb_flush_and_rebolt is misleading, it is called in virtual mode, so it can not possibly change the stack, so it should not be touching the shadow area. And since vmalloc is no longer bolted, it should not change any bolted mappings at all. Change the name to slb_flush_and_restore_bolted, and

[PATCH v2 7/9] powerpc/64s/hash: Fix false positive preempt warnings

2018-10-02 Thread Nicholas Piggin
Fixes: 5e46e29e6a97 ("powerpc/64s/hash: convert SLB miss handlers to C") Signed-off-by: Nicholas Piggin --- arch/powerpc/mm/slb.c | 24 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/arch/powerpc/mm/slb.c b/arch/powerpc/mm/slb.c index

[PATCH v2 6/9] powerpc/64s/hash: SLB fix preemption issues

2018-10-02 Thread Nicholas Piggin
slb_setup_new_exec and preload_new_slb_context run with interrupts and preemption enabled, which can be corrupted by re-entrant interrupt or process touching SLB preload cache or SLB allocator. Hard disable interrupts over these regions. Fixes: 5e46e29e6a97 ("powerpc/64s/hash: convert SLB miss

[PATCH v2 5/9] powerpc/64s/hash: add more barriers for slb preloading

2018-10-02 Thread Nicholas Piggin
In several places, more care has to be taken to prevent compiler or CPU re-ordering of memory accesses into critical sections that must not take SLB faults. Barriers are explained in the comments. Fixes: 5e46e29e6a97 ("powerpc/64s/hash: convert SLB miss handlers to C") Fixes: 89ca4e126a3f

[PATCH v2 4/9] powerpc/64s/hash: Fix preloading of SLB entries

2018-10-02 Thread Nicholas Piggin
slb_setup_new_exec and preload_new_slb_context assumed if an address missed the preload cache, then it would not be in the SLB and could be added. This is wrong if the preload cache has started to overflow. This can cause SLB multi-hits on user addresses. That assumption came from an earlier

[PATCH v2 3/9] powerpc/64: interrupts save PPR on stack rather than thread_struct

2018-10-02 Thread Nicholas Piggin
PPR is the odd register out when it comes to interrupt handling, it is saved in current->thread.ppr while all others are saved on the stack. The difficulty with this is that accessing thread.ppr can cause a SLB fault, but the SLB fault handler implementation in C change had assumed the normal

[PATCH v2 2/9] powerpc/64: add struct int_regs to save additional registers on stack

2018-10-02 Thread Nicholas Piggin
struct pt_regs is part of the user ABI and also the fundametal structure for saving registers at interrupt. The generic kernel code makes it difficult to completely decouple these, but it's easy enough to add additional space required to save more registers. Create a struct int_stack with struct

[PATCH v2 1/9] Revert "powerpc/64s/hash: remove user SLB data from the paca"

2018-10-02 Thread Nicholas Piggin
This reverts commit 8fed04d0f6aedf99b3d811ba58d38bb7f938a47a. There are a number of problems with this patch, there are minor bugs like vmalloc_sllp update no longer being picked up into pacas, but more fundamentally the SLB flush can not be broadcast out to other CPUs because it must be done in

[PATCH v2 0/9] Fixes for SLB to C series

2018-10-02 Thread Nicholas Piggin
This is another spin of the fixes. Also painfully re-discovered that we need https://patchwork.ozlabs.org/patch/962327/, as it prevents POWER8 NUMA from booting (initial stack SLB for the !0 node CPUs gets cleared by the initial TLB flush without it, and the SLB handler now uses the stack...)

Re: drivers binding to device node with multiple compatible strings

2018-10-02 Thread Rob Herring
On Fri, Sep 28, 2018 at 4:01 PM Li Yang wrote: > > On Fri, Sep 28, 2018 at 3:07 PM Rob Herring wrote: > > > > On Thu, Sep 27, 2018 at 5:25 PM Li Yang wrote: > > > > > > Hi Rob and Grant, > > > > > > Various device tree specs are recommending to include all the > > > potential compatible strings

Re: [PATCH v6] selftests: add headers_install to lib.mk

2018-10-02 Thread Michael Ellerman
Shuah Khan writes: > On 09/27/2018 10:52 PM, Michael Ellerman wrote: >> [ + linuxppc-dev ] >> >> Anders Roxell writes: >>> If the kernel headers aren't installed we can't build all the tests. >>> Add a new make target rule 'khdr' in the file lib.mk to generate the >>> kernel headers and that

Re: [PATCH RFC] mm/memory_hotplug: Introduce memory block types

2018-10-02 Thread Michal Hocko
On Mon 01-10-18 11:34:25, David Hildenbrand wrote: > On 01/10/2018 10:40, Michal Hocko wrote: > > On Fri 28-09-18 17:03:57, David Hildenbrand wrote: > > [...] > > > > I haven't read the patch itself but I just wanted to note one thing > > about this part > > > >> For paravirtualized devices it

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

2018-10-02 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 is an alternative to doing the tlbie instruction and having it be

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

2018-10-02 Thread Paul Mackerras
With this, userspace can enable a KVM-HV guest to run nested guests under it. Signed-off-by: Paul Mackerras --- Documentation/virtual/kvm/api.txt | 14 ++ arch/powerpc/include/asm/kvm_ppc.h | 1 + arch/powerpc/kvm/book3s_hv.c | 17 +

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

2018-10-02 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 v3 29/33] KVM: PPC: Book3S HV: Handle differing endianness for H_ENTER_NESTED

2018-10-02 Thread Paul Mackerras
From: Suraj Jitindar Singh The hcall H_ENTER_NESTED takes as the two parameters the address in L1 guest memory of a hv_regs struct and a pt_regs struct which the L1 guest would like to use to run a L2 guest and in which are returned the exit state of the L2 guest. For efficiency, these are in

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

2018-10-02 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 v3 28/33] KVM: PPC: Book3S HV: Sanitise hv_regs on nested guest entry

2018-10-02 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 v3 27/33] KVM: PPC: Book3S HV: Add one-reg interface to virtual PTCR register

2018-10-02 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 v3 26/33] KVM: PPC: Book3S HV: Don't access HFSCR, LPIDR or LPCR when running nested

2018-10-02 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 v3 25/33] KVM: PPC: Book3S HV: Invalidate TLB when nested vcpu moves physical cpu

2018-10-02 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 v3 24/33] KVM: PPC: Book3S HV: Emulate Privileged TLBIE for guest hypervisors

2018-10-02 Thread Paul Mackerras
From: Suraj Jitindar Singh When running a nested (L2) guest the guest (L1) hypervisor will use hypervisor privileged tlb invalidation instructions (to manage the partition scoped page tables) which will result in hypervisor emulation assistance interrupts. We emulate these instructions on behalf

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

2018-10-02 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 v3 22/33] KVM: PPC: Book3S HV: Handle page fault for a nested guest

2018-10-02 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 v3 21/33] KVM: PPC: Book3S HV: Framework to handle HV Emulation Assist Interrupt

2018-10-02 Thread Paul Mackerras
From: Suraj Jitindar Singh A HEAI (hypervisor emulation assistance interrupt) occurs when a hypervisor resource or instruction is used in a privileged but non-hypervisor state and the LPCR_EVIRT bit is set in LPCR. When this occurs bit 45 is set in HSRR1. Detect the occurrence of this, and if

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

2018-10-02 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 v3 18/33] KVM: PPC: Book3S HV: Nested guest entry via hypercall

2018-10-02 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 v3 19/33] KVM: PPC: Book3S HV: Use XICS hypercalls when running as a nested hypervisor

2018-10-02 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 v3 17/33] KVM: PPC: Book3S HV: Framework and hcall stubs for nested virtualization

2018-10-02 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 v3 16/33] KVM: PPC: Book3S HV: Use kvmppc_unmap_pte() in kvm_unmap_radix()

2018-10-02 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 v3 15/33] KVM: PPC: Book3S HV: Refactor radix page fault handler

2018-10-02 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 v3 13/33] KVM: PPC: Book3S HV: Clear partition table entry on vm teardown

2018-10-02 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 v3 14/33] KVM: PPC: Book3S HV: Make kvmppc_mmu_radix_xlate process/partition table agnostic

2018-10-02 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 v3 12/33] KVM: PPC: Use ccr field in pt_regs struct embedded in vcpu struct

2018-10-02 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 v3 10/33] KVM: PPC: Book3S HV: Handle hypervisor instruction faults better

2018-10-02 Thread Paul Mackerras
Currently the code for handling hypervisor instruction page faults passes 0 for the flags indicating the type of fault, which is OK in the usual case that the page is not mapped in the partition-scoped page tables. However, there are other causes for hypervisor instruction page faults, such as

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

2018-10-02 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.

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

2018-10-02 Thread Paul Mackerras
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 required between vcpus or vcores; the vcpu can enter the guest without

[PATCH v3 08/33] KVM: PPC: Book3S HV: Call kvmppc_handle_exit_hv() with vcore unlocked

2018-10-02 Thread Paul Mackerras
Currently kvmppc_handle_exit_hv() is called with the vcore lock held because it is called within a for_each_runnable_thread loop. However, we already unlock the vcore within kvmppc_handle_exit_hv() under certain circumstances, and this is safe because (a) any vcpus that become runnable and are

[PATCH v3 07/33] KVM: PPC: Book3S: Rework TM save/restore code and make it C-callable

2018-10-02 Thread Paul Mackerras
This adds a parameter to __kvmppc_save_tm and __kvmppc_restore_tm which allows the caller to indicate whether it wants the nonvolatile register state to be preserved across the call, as required by the C calling conventions. This parameter being non-zero also causes the MSR bits that enable TM,

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

2018-10-02 Thread Paul Mackerras
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 label we are committed to exiting to host virtual mode. Thus the machine

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

2018-10-02 Thread Paul Mackerras
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 with C. Reviewed-by: David Gibson Signed-off-by: Paul Mackerras

[PATCH v3 03/33] KVM: PPC: Book3S HV: Remove left-over code in XICS-on-XIVE emulation

2018-10-02 Thread Paul Mackerras
This removes code that clears the external interrupt pending bit in the pending_exceptions bitmap. This is left over from an earlier iteration of the code where this bit was set when an escalation interrupt arrived in order to wake the vcpu from cede. Currently we set the vcpu->arch.irq_pending

[PATCH v3 04/33] KVM: PPC: Book3S HV: Move interrupt delivery on guest entry to C code

2018-10-02 Thread Paul Mackerras
This is based on a patch by Suraj Jitindar Singh. This moves the code in book3s_hv_rmhandlers.S that generates an external, decrementer or privileged doorbell interrupt just before entering the guest to C code in book3s_hv_builtin.c. This is to make future maintenance and modification easier.

[PATCH v3 02/33] KVM: PPC: Book3S: Simplify external interrupt handling

2018-10-02 Thread Paul Mackerras
Currently we use two bits in the vcpu pending_exceptions bitmap to indicate that an external interrupt is pending for the guest, one for "one-shot" interrupts that are cleared when delivered, and one for interrupts that persist until cleared by an explicit action of the OS (e.g. an acknowledge to

[PATCH v3 00/33] KVM: PPC: Book3S HV: Nested HV virtualization

2018-10-02 Thread Paul Mackerras
This patch series implements nested virtualization in the KVM-HV module for radix guests on POWER9 systems. Unlike PR KVM, nested guests are able to run in supervisor mode, meaning that performance is much better than with PR KVM, and is very close to the performance of a non-nested guests for

[PATCH v3 01/33] powerpc: Turn off CPU_FTR_P9_TM_HV_ASSIST in non-hypervisor mode

2018-10-02 Thread Paul Mackerras
When doing nested virtualization, it is only necessary to do the transactional memory hypervisor assist at level 0, that is, when we are in hypervisor mode. Nested hypervisors can just use the TM facilities as architected. Therefore we should clear the CPU_FTR_P9_TM_HV_ASSIST bit when we are not

RE: [PATCH] driver core: device: add BUS_ATTR_WO macro

2018-10-02 Thread Ioana Ciornei
> > Add BUS_ATTR_WO macro to make it easier to add attributes without > > auditing the mode settings. Also, use the newly added macro where > > appropriate. > > > > Signed-off-by: Ioana Ciornei > > --- > > arch/powerpc/platforms/pseries/ibmebus.c | 12 > > drivers/block/rbd.c

Re: [PATCH 2/2] powerpc/64: Increase stack redzone for 64-bit kernel to 512 bytes

2018-10-02 Thread Segher Boessenkool
On Tue, Oct 02, 2018 at 09:59:29AM +1000, Nicholas Piggin wrote: > On Mon, 1 Oct 2018 03:51:21 -0500 > Segher Boessenkool wrote: > > And that is required by the ABI! > > > > """ > > 2.2.2.4. Protected Zone > > > > The 288 bytes below the stack pointer are available as volatile program > >

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

2018-10-02 Thread Paul Mackerras
On Tue, Oct 02, 2018 at 04:01:52PM +1000, David Gibson wrote: > On Fri, Sep 28, 2018 at 07:45:48PM +1000, 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

Re: [PATCH v2 19/33] KVM: PPC: Book3S HV: Nested guest entry via hypercall

2018-10-02 Thread Paul Mackerras
On Tue, Oct 02, 2018 at 05:00:09PM +1000, David Gibson wrote: > On Fri, Sep 28, 2018 at 07:45:49PM +1000, Paul Mackerras wrote: > > 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

Re: [PATCH 1/3] powerpc/powernv/npu: Reduce eieio usage when issuing ATSD invalidates

2018-10-02 Thread Alistair Popple
Thanks, this looks good to me. Reviewed-by: Alistair Popple On Thursday, 27 September 2018 4:23:09 PM AEST Mark Hairgrove wrote: > There are two types of ATSDs issued to the NPU: invalidates targeting a > specific virtual address and invalidates targeting the whole address > space. In both

Re: [PATCH v2 20/33] KVM: PPC: Book3S HV: Use XICS hypercalls when running as a nested hypervisor

2018-10-02 Thread David Gibson
On Fri, Sep 28, 2018 at 07:45:50PM +1000, Paul Mackerras wrote: > 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

Re: [PATCH 3/3] powerpc/powernv/npu: Remove atsd_threshold debugfs setting

2018-10-02 Thread Alistair Popple
Looks good to me, thanks! Reviewed-by: Alistair Popple On Thursday, 27 September 2018 4:23:11 PM AEST Mark Hairgrove wrote: > This threshold is no longer used now that all invalidates issue a single > ATSD to each active NPU. > > Signed-off-by: Mark Hairgrove > --- >

Re: [PATCH 2/3] powerpc/powernv/npu: Use size-based ATSD invalidates

2018-10-02 Thread Alistair Popple
Thanks Mark, Looks like some worthwhile improvments to be had. I've added a couple of comments inline below. > +#define PAGE_64K (64UL * 1024) +#define PAGE_2M (2UL * 1024 * 1024) +#define > PAGE_1G (1UL * 1024 * 1024 * 1024) include/linux/sizes.h includes definitions for SZ_64K, SZ_2M, SZ_1G,

Re: [PATCH v2 19/33] KVM: PPC: Book3S HV: Nested guest entry via hypercall

2018-10-02 Thread David Gibson
On Fri, Sep 28, 2018 at 07:45:49PM +1000, Paul Mackerras wrote: > 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

RE: [PATCH v2 0/5] soc/fsl/qbman: DPAA QBMan fixes and additions

2018-10-02 Thread Madalin-cristian Bucur
> -Original Message- > From: Li Yang [mailto:leoyang...@nxp.com] > Sent: Tuesday, October 2, 2018 1:30 AM > To: Madalin-cristian Bucur > Cc: Roy Pledge ; Claudiu Manoil > ; Catalin Marinas ; Scott > Wood ; moderated list:ARM/FREESCALE IMX / MXC ARM > ARCHITECTURE ; linuxppc-dev > ; lkml

RE: [PATCH v2 5/5] soc/fsl_qbman: export coalesce change API

2018-10-02 Thread Madalin-cristian Bucur
> -Original Message- > From: Li Yang [mailto:leoyang...@nxp.com] > Sent: Tuesday, October 2, 2018 12:50 AM > To: Madalin-cristian Bucur > Cc: Roy Pledge ; Claudiu Manoil > ; Catalin Marinas ; Scott > Wood ; moderated list:ARM/FREESCALE IMX / MXC ARM > ARCHITECTURE ; linuxppc-dev > ; lkml

  1   2   >