Re: [PATCH 17/26] KVM: PPC: Book3S PR: add math support for PR KVM HTM

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:30PM +0800, wei.guo.si...@gmail.com wrote: > ines: 219 > > From: Simon Guo > > The math registers will be saved into vcpu->arch.fp/vr and corresponding > vcpu->arch.fp_tm/vr_tm area. > > We flush or giveup the math regs into vcpu->arch.fp/vr before saving > transac

Re: [PATCH 00/26] KVM: PPC: Book3S PR: Transaction memory support on PR KVM

2018-01-22 Thread Paul Mackerras
On Tue, Jan 23, 2018 at 04:38:32PM +1100, Paul Mackerras wrote: > On Thu, Jan 11, 2018 at 06:11:13PM +0800, wei.guo.si...@gmail.com wrote: > > From: Simon Guo > > > > In current days, many OS distributions have utilized transaction > > memory functionality. In PowerPC, HV KVM supports TM. But PR

Re: [PATCH 00/26] KVM: PPC: Book3S PR: Transaction memory support on PR KVM

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:13PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > In current days, many OS distributions have utilized transaction > memory functionality. In PowerPC, HV KVM supports TM. But PR KVM > does not. > > The drive for the transaction memory support of PR KV

Re: [PATCH 07/26] KVM: PPC: Book3S PR: add TEXASR related macros

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:20PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > This patches add some macros for CR0/TEXASR bits so that PR KVM TM > logic(tbegin./treclaim./tabort.) can make use of them later. > > Signed-off-by: Simon Guo Reviewed-by: Paul Mackerras This and s

Re: [PATCH 04/26] KVM: PPC: Book3S PR: add C function wrapper for _kvmppc_save/restore_tm()

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:17PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > Currently _kvmppc_save/restore_tm() APIs can only be invoked from > assembly function. This patch adds C function wrappers for them so > that they can be safely called from C function. > > Signed-off-b

Re: [PATCH 16/26] KVM: PPC: Book3S PR: add transaction memory save/restore skeleton for PR KVM

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:29PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > The transaction memory checkpoint area save/restore behavior is > triggered when VCPU qemu process is switching out/into CPU. ie. > at kvmppc_core_vcpu_put_pr() and kvmppc_core_vcpu_load_pr(). > > MSR

Re: [PATCH 02/26] KVM: PPC: Book3S PR: add new parameter (guest MSR) for kvmppc_save_tm()/kvmppc_restore_tm()

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:15PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > HV KVM and PR KVM need different MSR source to indicate whether > treclaim. or trecheckpoint. is necessary. > > This patch add new parameter (guest MSR) for these kvmppc_save_tm/ > kvmppc_restore_tm()

Re: [PATCH 10/26] KVM: PPC: Book3S PR: set MSR HV bit accordingly for PPC970 and others.

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:23PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > Apple G5 machines(PPC970/FX/GX/MP) have supervisor mode disabled and > MSR HV bit is forced into 1. We should follow this in PR KVM guest. > > This patch set MSR HV=1 for G5 machines and HV=0 for other

Re: [PATCH 13/26] KVM: PPC: Book3S PR: adds new kvmppc_copyto_vcpu_tm/kvmppc_copyfrom_vcpu_tm API for PR KVM.

2018-01-22 Thread Paul Mackerras
On Thu, Jan 11, 2018 at 06:11:26PM +0800, wei.guo.si...@gmail.com wrote: > From: Simon Guo > > This patch adds 2 new APIs: kvmppc_copyto_vcpu_tm() and > kvmppc_copyfrom_vcpu_tm(). These 2 APIs will be used to copy from/to TM > data between VCPU_TM/VCPU area. > > PR KVM will use these APIs for t

Re: Anyone working on the KPTI support for powerpc?

2018-01-22 Thread Michael Ellerman
Yang Li writes: > I assume some of the powerpc platforms would be impacted by the newly > announced meltdown/spetre vulnerabilities. It will be good if we have > an aligned implementation of the KPTI. Hi Leo, We aren't working on KPTI at the moment, but we did recently merge some related chang

Re: [PATCH] powerpc: pseries: use irq_of_parse_and_map helper

2018-01-22 Thread Michael Ellerman
Rob Herring writes: > Instead of calling both of_irq_parse_one and irq_create_of_mapping, call > of_irq_parse_and_map instead which does the same thing. This gets us closer > to making the former 2 functions static. > > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > C

Re: [PATCH v10 01/27] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-01-22 Thread Ram Pai
Andrew, Please apply the following two patches to your tree. [PATCH v10 01/27] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled [PATCH v10 02/27] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey I have not heard any complaints on

Re: Pull request: scottwood/linux.git next

2018-01-22 Thread Michael Ellerman
Scott Wood writes: > Contains fixes for CPM GPIO and an FSL PCI erratum workaround, > plus a minor cleanup patch. > > The following changes since commit f2ac428e0edabbca41b9dfe9473a90147962e4e9: > > powerpc/pseries/cpuidle: add polling idle for shared processor guests > (2018-01-18 15:43:44 +1

[PATCH v10 24/24] selftests/powerpc: Add core file test for Protection Key register

2018-01-22 Thread Ram Pai
From: Thiago Jung Bauermann This test verifies that the AMR is being written to a process' core file. Signed-off-by: Thiago Jung Bauermann --- tools/testing/selftests/powerpc/ptrace/Makefile|2 +- tools/testing/selftests/powerpc/ptrace/core-pkey.c | 438 2 files c

[PATCH v10 23/24] selftests/powerpc: Add ptrace tests for Protection Key register

2018-01-22 Thread Ram Pai
From: Thiago Jung Bauermann This test exercises read and write access to the AMR. Signed-off-by: Thiago Jung Bauermann --- tools/testing/selftests/powerpc/include/reg.h |1 + tools/testing/selftests/powerpc/ptrace/Makefile|5 +- .../testing/selftests/powerpc/ptrace/ptrace-pkey

[PATCH v10 22/24] selftests/vm: Fix deadlock in protection_keys.c

2018-01-22 Thread Ram Pai
From: Thiago Jung Bauermann The sig_chld() handler calls dprintf2() taking care of setting dprint_in_signal so that sigsafe_printf() won't call printf(). Unfortunately, this precaution is is negated by dprintf_level(), which has a call to fflush(). This function acquires a lock, which means that

[PATCH v10 21/24] selftests/vm: sub-page allocator

2018-01-22 Thread Ram Pai
introduce a new allocator that allocates 4k hardware-pages to back 64k linux-page. This allocator is only applicable on powerpc. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 30 ++ 1 files changed, 30 insertions(+), 0 deletions(-) diff --gi

[PATCH v10 20/24] selftests/vm: testcases must restore pkey-permissions

2018-01-22 Thread Ram Pai
Generally the signal handler restores the state of the pkey register before returning. However there are times when the read/write operation can legitamely fail without invoking the signal handler. Eg: A sys_read() operaton to a write-protected page should be disallowed. In such a case the state

[PATCH v10 19/24] selftests/vm: detect write violation on a mapped access-denied-key page

2018-01-22 Thread Ram Pai
detect write-violation on a page to which access-disabled key is associated much after the page is mapped. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 13 + 1 files changed, 13 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/vm/prot

[PATCH v10 18/24] selftests/vm: associate key on a mapped page and detect write violation

2018-01-22 Thread Ram Pai
detect write-violation on a page to which write-disabled key is associated much after the page is mapped. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/vm/protec

[PATCH v10 17/24] selftests/vm: associate key on a mapped page and detect access violation

2018-01-22 Thread Ram Pai
detect access-violation on a page to which access-disabled key is associated much after the page is mapped. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 19 +++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/tools/testing/selftests/

[PATCH v10 16/24] selftests/vm: fix an assertion in test_pkey_alloc_exhaust()

2018-01-22 Thread Ram Pai
The maximum number of keys that can be allocated has to take into consideration, that some keys are reserved by the architecture for specific purpose. Hence cannot be allocated. Fix the assertion in test_pkey_alloc_exhaust() Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers

[PATCH v10 15/24] selftests/vm: powerpc implementation to check support for pkey

2018-01-22 Thread Ram Pai
pkey subsystem is supported if the hardware and kernel has support. We determine that by checking if allocation of a key succeeds or not. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 22 -- tools/testing/selftests/vm/protection_keys.c |9 +++

[PATCH v10 14/24] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-01-22 Thread Ram Pai
When a key is freed, the key is no more effective. Clear the bits corresponding to the pkey in the shadow register. Otherwise it will carry some spurious bits which can trigger false-positive asserts. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |3 ++- 1 fi

[PATCH v10 13/24] selftests/vm: powerpc implementation for generic abstraction

2018-01-22 Thread Ram Pai
Introduce powerpc implementation for the different abstactions. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 109 ++ tools/testing/selftests/vm/protection_keys.c | 40 ++ 2 files changed, 118 insertions(+), 31 deletions(-) diff --g

[PATCH v10 12/24] selftests/vm: generic cleanup

2018-01-22 Thread Ram Pai
cleanup the code to satisfy coding styles. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 81 ++ 1 files changed, 43 insertions(+), 38 deletions(-) diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protec

[PATCH v10 11/24] selftests/vm: pkey register should match shadow pkey

2018-01-22 Thread Ram Pai
expected_pkey_fault() is comparing the contents of pkey register with 0. This may not be true all the time. There could be bits set by default by the architecture which can never be changed. Hence compare the value against shadow pkey register, which is supposed to track the bits accurately all thr

[PATCH v10 10/24] selftests/vm: introduce two arch independent abstraction

2018-01-22 Thread Ram Pai
open_hugepage_file() <- opens the huge page file get_start_key() <-- provides the first non-reserved key. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 11 +++ tools/testing/selftests/vm/protection_keys.c |6 +++--- 2 files changed, 14 insertions(+), 3

[PATCH v10 09/24] selftests/vm: fix alloc_random_pkey() to make it really random

2018-01-22 Thread Ram Pai
alloc_random_pkey() was allocating the same pkey every time. Not all pkeys were geting tested. fixed it. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c | 10 +++--- 1 files changed, 7 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/vm/protection

[PATCH v10 08/24] selftests/vm: clear the bits in shadow reg when a pkey is freed.

2018-01-22 Thread Ram Pai
When a key is freed, the key is no more effective. Clear the bits corresponding to the pkey in the shadow register. Otherwise it will carry some spurious bits which can trigger false-positive asserts. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |3 +++ 1 fi

[PATCH v10 07/24] selftests/vm: fixed bugs in pkey_disable_clear()

2018-01-22 Thread Ram Pai
instead of clearing the bits, pkey_disable_clear() was setting the bits. Fixed it. Also fixed a wrong assertion in that function. When bits are cleared, the resulting bit value will be less than the original. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |4 ++-- 1

[PATCH v10 06/24] selftests/vm: fix the wrong assert in pkey_disable_set()

2018-01-22 Thread Ram Pai
If the flag is 0, no bits will be set. Hence we cant expect the resulting bitmap to have a higher value than what it was earlier. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/protection_keys.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/testing/selfte

[PATCH v10 05/24] selftests/vm: generic function to handle shadow key register

2018-01-22 Thread Ram Pai
helper functions to handler shadow pkey register Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 27 tools/testing/selftests/vm/protection_keys.c | 34 - 2 files changed, 49 insertions(+), 12 deletions(-) diff --git a/to

[PATCH v10 04/24] selftests/vm: typecast the pkey register

2018-01-22 Thread Ram Pai
This is in preparation to accomadate a differing size register across architectures. Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 27 +- tools/testing/selftests/vm/protection_keys.c | 69 ++ 2 files changed, 51 insertions(+), 45 de

[PATCH v10 03/24] selftests/vm: move generic definitions to header file

2018-01-22 Thread Ram Pai
Moved all the generic definition and helper functions to the header file Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 62 ++-- tools/testing/selftests/vm/protection_keys.c | 66 -- 2 files changed, 57 insertions(+), 71

[PATCH v10 02/24] selftests/vm: rename all references to pkru to a generic name

2018-01-22 Thread Ram Pai
some pkru references are named to pkey_reg and some prku references are renamed to pkey Signed-off-by: Ram Pai --- tools/testing/selftests/vm/pkey-helpers.h| 85 +- tools/testing/selftests/vm/protection_keys.c | 227 ++ 2 files changed, 164 insertions(+), 1

[PATCH v10 01/24] selftests/x86: Move protecton key selftest to arch neutral directory

2018-01-22 Thread Ram Pai
Signed-off-by: Ram Pai --- tools/testing/selftests/vm/Makefile |1 + tools/testing/selftests/vm/pkey-helpers.h | 223 tools/testing/selftests/vm/protection_keys.c | 1407 + tools/testing/selftests/x86/Makefile |2 +- tools/testing/self

[PATCH v10 00/24] selftests, powerpc, x86 : Memory Protection Keys

2018-01-22 Thread Ram Pai
Memory protection keys enable applications to protect its address space from inadvertent access from itself. This feature is now enabled on powerpc architecture. The patches move the selftests to arch neutral directory and enhances them. Verified for correctness on powerpc and on x86 architecture

Re: [PATCH v10 00/27] powerpc, mm: Memory Protection Keys

2018-01-22 Thread Ram Pai
Sorry please ignore this series. It was a duplication mistake. I aborted the send midway, but a few escaped into the cyber. RP On Mon, Jan 22, 2018 at 10:26:29AM -0800, Ram Pai wrote: > Memory protection keys enable applications to protect its > address space from inadvertent access from or corr

[PATCH v10 2/2] Documentation/vm: PowerPC specific updates to memory protection keys

2018-01-22 Thread Ram Pai
Add documentation updates that capture PowerPC specific changes. Signed-off-by: Thiago Jung Bauermann Signed-off-by: Ram Pai --- Documentation/vm/protection-keys.txt | 84 + 1 files changed, 63 insertions(+), 21 deletions(-) diff --git a/Documentation/vm/prote

[PATCH v10 1/2] Documentation/x86: Move protecton key documentation to arch neutral directory

2018-01-22 Thread Ram Pai
Since PowerPC and Intel both support memory protection keys, moving the documenation to arch-neutral directory. Signed-off-by: Ram Pai --- Documentation/vm/protection-keys.txt | 90 + Documentation/x86/protection-keys.txt | 90

[PATCH v10 0/2] Documentation, powerpc, x86 : Memory Protection Keys

2018-01-22 Thread Ram Pai
Memory protection keys enable applications to protect its address space from inadvertent access from itself. This feature is now enabled on powerpc architecture. The patches moves the documentation to arch neutral directory and captures the latest information. Ram Pai (2): Documentation/x86: M

[PATCH v10 02/27] mm, powerpc, x86: introduce an additional vma bit for powerpc pkey

2018-01-22 Thread Ram Pai
Currently only 4bits are allocated in the vma flags to hold 16 keys. This is sufficient for x86. PowerPC supports 32 keys, which needs 5bits. This patch allocates an additional bit. Acked-by: Balbir Singh Signed-off-by: Ram Pai --- fs/proc/task_mmu.c |1 + include/linux/mm.h |3 ++-

[PATCH v10 01/27] mm, powerpc, x86: define VM_PKEY_BITx bits if CONFIG_ARCH_HAS_PKEYS is enabled

2018-01-22 Thread Ram Pai
VM_PKEY_BITx are defined only if CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS is enabled. Powerpc also needs these bits. Hence lets define the VM_PKEY_BITx bits for any architecture that enables CONFIG_ARCH_HAS_PKEYS. Signed-off-by: Ram Pai --- fs/proc/task_mmu.c |4 ++-- include/linux/mm.h |

[PATCH v10 00/27] powerpc, mm: Memory Protection Keys

2018-01-22 Thread Ram Pai
Memory protection keys enable applications to protect its address space from inadvertent access from or corruption by itself. These patches along with the pte-bit freeing patch series enables the protection key feature on powerpc; 4k and 64k hashpage kernels. Will send the documentation and selft

[PATCH v8 1/2] powerpc/powernv: Enable tunneled operations

2018-01-22 Thread Philippe Bergheaud
P9 supports PCI tunneled operations (atomics and as_notify). This patch adds support for tunneled operations on powernv, with a new API, to be called by device drivers: pnv_pci_get_tunnel_ind() Tell driver the 16-bit ASN indication used by kernel. pnv_pci_set_tunnel_bar() Tell kernel the Tu

[PATCH v8 2/2] cxl: read PHB indications from the device tree

2018-01-22 Thread Philippe Bergheaud
Configure the P9 XSL_DSNCTL register with PHB indications found in the device tree, or else use legacy hard-coded values. Signed-off-by: Philippe Bergheaud --- Changelog: v2: New patch. Use the new device tree property "ibm,phb-indications". v3: No change. v4: No functional change. Drop co

Re: [RFC PATCH v2 0/1] of: easier debugging for node life cycle issues

2018-01-22 Thread Wolfram Sang
Hi Frank, > Please go back and read the thread for version 1. Simply resubmitting a > forward port is ignoring that whole conversation. > > There is a lot of good info in that thread. I certainly learned stuff in it. Yes, I did that and learned stuff, too. My summary of the discussion was: -

Re: [RFC PATCH v2 0/1] of: easier debugging for node life cycle issues

2018-01-22 Thread Frank Rowand
On 01/21/18 06:31, Wolfram Sang wrote: > I got a bug report for a DT node refcounting problem in the I2C subsystem. > This > patch was a huge help in validating the bug report and the proposed solution. > So, I thought I bring it to attention again. Thanks Tyrel, for the initial > work! > > Note

Re: [PATCH v2] cpufreq: powernv: Add support of frequency domain

2018-01-22 Thread Abhishek
On 12/20/2017 12:20 PM, Viresh Kumar wrote: On 20-12-17, 12:12, Abhishek Goel wrote: diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c index b6d7c4c..fd642bc 100644 --- a/drivers/cpufreq/powernv-cpufreq.c +++ b/drivers/cpufreq/powernv-cpufreq.c @@ -37,6 +37,7

Re: [PATCH v2] powerpc/mm: Fix growth direction for hugepages mmaps with slice

2018-01-22 Thread Christophe LEROY
Le 19/01/2018 à 11:05, Aneesh Kumar K.V a écrit : Did a reply instead of reply-all. Aneesh Kumar K.V writes: Christophe LEROY writes: Le 17/01/2018 à 04:19, Aneesh Kumar K.V a écrit : On 01/16/2018 10:18 PM, Christophe LEROY wrote: Le 16/01/2018 à 17:03, Aneesh Kumar K.V a écrit :

[PATCH v3] cpufreq: powernv: Add support of frequency domain

2018-01-22 Thread Abhishek Goel
Frequency-domain indicates group of CPUs that would share same frequency. It is detected using device-tree node "frequency-domain-indicator". frequency-domain-indicator is a bitmask which will have different value depending upon the generation of the processor. CPUs of the same chip for which the