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

2018-10-07 Thread Christophe Leroy
On 10/06/2018 12:40 PM, Michael Ellerman wrote: Christophe Leroy writes: diff --git a/arch/powerpc/include/asm/livepatch.h b/arch/powerpc/include/asm/livepatch.h index 47a03b9b528b..818451bf629c 100644 --- a/arch/powerpc/include/asm/livepatch.h +++ b/arch/powerpc/include/asm/livepatch.h @@

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

2018-10-07 Thread Christophe LEROY
Le 06/10/2018 à 14:47, Michael Ellerman a écrit : Christophe LEROY writes: The serie has been successfully compiled tested at http://kisskb.ellerman.id.au/kisskb/head/358723b36b126a381d827c82d04ee226321416b2/ I guess we need to turn on BPF_JIT in some configs :) This works (builds), but

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

2018-10-07 Thread Rob Herring
On Sat, Oct 6, 2018 at 5:54 AM Andreas Färber wrote: > > Am 05.10.18 um 18:58 schrieb Rob Herring: > > Convert Realtek SoC bindings to DT schema format using json-schema. > > YAML (2x) ? > > Cc: "Andreas Färber" > > Cc: Mark Rutland > > Cc: linux-arm-ker...@lists.infradead.org > > Cc: devicet.

Re: [PATCH 15/36] dt-bindings: arm: Convert Actions Semi bindings to jsonschema

2018-10-07 Thread Rob Herring
On Sat, Oct 6, 2018 at 5:40 AM Andreas Färber wrote: > > Hi Rob, > > Am 05.10.18 um 18:58 schrieb Rob Herring: > > Convert Actions Semi SoC bindings to DT schema format using json-schema. > > This sounds like the next Yanny vs. Laurel... I fail to see any json. ;) Read the docs in patch 8. > Als

Re: [PATCH v4 25/32] KVM: PPC: Book3S HV: Invalidate TLB when nested vcpu moves physical cpu

2018-10-07 Thread David Gibson
On Fri, Oct 05, 2018 at 03:32:26PM +1000, Paul Mackerras wrote: > On Fri, Oct 05, 2018 at 02:54:28PM +1000, David Gibson wrote: > > On Fri, Oct 05, 2018 at 02:23:50PM +1000, Paul Mackerras wrote: > > > On Fri, Oct 05, 2018 at 02:09:08PM +1000, David Gibson wrote: > > > > On Thu, Oct 04, 2018 at 09:

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

2018-10-07 Thread Benjamin Herrenschmidt
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 it's not great. Nick, any better idea ? diff --git a/arch/powerpc/kernel/exceptions-64

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

2018-10-07 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 mos

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

2018-10-07 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

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

2018-10-07 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 a

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

2018-10-07 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 f

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

2018-10-07 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. Th

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

2018-10-07 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 v5 06/33] KVM: PPC: Book3S HV: Simplify real-mode interrupt handling

2018-10-07 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 v5 07/33] KVM: PPC: Book3S: Rework TM save/restore code and make it C-callable

2018-10-07 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, FP

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

2018-10-07 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 adde

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

2018-10-07 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 needi

[PATCH v5 10/33] KVM: PPC: Book3S HV: Handle hypervisor instruction faults better

2018-10-07 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 not

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

2018-10-07 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. Reviewe

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

2018-10-07 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 change

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

2018-10-07 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 as

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

2018-10-07 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 thr

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

2018-10-07 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 --- arch/powerpc/kvm/boo

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

2018-10-07 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 a

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

2018-10-07 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 hyperv

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

2018-10-07 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 th

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

2018-10-07 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 --- ar

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

2018-10-07 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(), w

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

2018-10-07 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 r

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

2018-10-07 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 partition-scop

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

2018-10-07 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 corre

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

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

2018-10-07 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 sa

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

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

2018-10-07 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 on

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

2018-10-07 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 c

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

2018-10-07 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 the

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

2018-10-07 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 | 39

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

2018-10-07 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 hypervis

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

2018-10-07 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 33/33] KVM: PPC: Book3S HV: Add NO_HASH flag to GET_SMMU_INFO ioctl result

2018-10-07 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 ta

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

2018-10-07 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 > controllers,