Re: [PATCH 1/2] powerpc/64s: remove support for kernel-mode syscalls

2019-08-19 Thread Nicholas Piggin
Nicholas Piggin's on August 20, 2019 3:11 pm: > There is support for the kernel to execute the 'sc 0' instruction and > make a system call to itself. This is a relic that is unused in the > tree, therefore untested. It's also highly questionable for modules to > be doing this. Oh I'm sorry this

[PATCH 2/2] powerpc/64s: interrupt entry use isel to prevent untrusted speculative r1 values used by the kernel

2019-08-19 Thread Nicholas Piggin
Interrupts may come from user or kernel, so the stack pointer needs to be set to either the base of the kernel stack, or a new frame on the existing kernel stack pointer, respectively. Using a branch for this can lead to r1-indexed memory operations being speculatively executed using a value of

[PATCH 1/2] powerpc/64s: remove support for kernel-mode syscalls

2019-08-19 Thread Nicholas Piggin
There is support for the kernel to execute the 'sc 0' instruction and make a system call to itself. This is a relic that is unused in the tree, therefore untested. It's also highly questionable for modules to be doing this. Signed-off-by: Nicholas Piggin --- arch/powerpc/kernel/entry_64.S

Re: [PATCH v1 05/10] powerpc/mm: Do early ioremaps from top to bottom on PPC64 too.

2019-08-19 Thread Christophe Leroy
Le 20/08/2019 à 02:20, Michael Ellerman a écrit : Nicholas Piggin writes: Christophe Leroy's on August 14, 2019 6:11 am: Until vmalloc system is up and running, ioremap basically allocates addresses at the border of the IOREMAP area. On PPC32, addresses are allocated down from the top of

Re: [RFC PATCH] powerpc: Convert ____flush_dcache_icache_phys() to C

2019-08-19 Thread Alastair D'Silva
On Fri, 2019-08-16 at 15:52 +, Christophe Leroy wrote: > Resulting code (8xx with 16 bytes per cacheline and 16k pages) > > 016c <__flush_dcache_icache_phys>: > 16c: 54 63 00 22 rlwinm r3,r3,0,0,17 > 170: 7d 20 00 a6 mfmsr r9 > 174: 39 40 04 00 li r10,1024 > 178:

Re: [PATCH] powerpc: Don't add -mabi= flags when building with Clang

2019-08-19 Thread Nathan Chancellor
On Mon, Aug 19, 2019 at 04:19:31AM -0500, Segher Boessenkool wrote: > On Sun, Aug 18, 2019 at 12:13:21PM -0700, Nathan Chancellor wrote: > > When building pseries_defconfig, building vdso32 errors out: > > > > error: unknown target ABI 'elfv1' > > > > Commit 4dc831aa8813 ("powerpc: Fix

Re: [PATCH v6 1/7] kvmppc: Driver to manage pages of secure guest

2019-08-19 Thread Thiago Jung Bauermann
Hello Bharata, I have just a couple of small comments. Bharata B Rao writes: > +/* > + * Get a free device PFN from the pool > + * > + * Called when a normal page is moved to secure memory (UV_PAGE_IN). Device > + * PFN will be used to keep track of the secure page on HV side. > + * > + *

Re: [PATCH v10 2/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-19 Thread Nicholas Piggin
Santosh Sivaraj's on August 20, 2019 11:47 am: > Hi Nick, > > Nicholas Piggin writes: > >> Santosh Sivaraj's on August 15, 2019 10:39 am: >>> From: Balbir Singh >>> >>> The current code would fail on huge pages addresses, since the shift would >>> be incorrect. Use the correct page shift

Re: [PATCH 2/2] powerpc: support KASAN instrumentation of bitops

2019-08-19 Thread Daniel Axtens
Christophe Leroy writes: > Le 19/08/2019 à 08:28, Daniel Axtens a écrit : >> In KASAN development I noticed that the powerpc-specific bitops >> were not being picked up by the KASAN test suite. > > I'm not sure anybody cares about who noticed the problem. This sentence > could be rephrased as:

[PATCH v2 2/2] powerpc: support KASAN instrumentation of bitops

2019-08-19 Thread Daniel Axtens
The powerpc-specific bitops are not being picked up by the KASAN test suite. Instrumentation is done via the bitops/instrumented-{atomic,lock}.h headers. They require that arch-specific versions of bitop functions are renamed to arch_*. Do this renaming. For clear_bit_unlock_is_negative_byte,

[PATCH v2 1/2] kasan: support instrumented bitops combined with generic bitops

2019-08-19 Thread Daniel Axtens
Currently bitops-instrumented.h assumes that the architecture provides atomic, non-atomic and locking bitops (e.g. both set_bit and __set_bit). This is true on x86 and s390, but is not always true: there is a generic bitops/non-atomic.h header that provides generic non-atomic operations, and also

Re: [PATCH 0/3] Add bad pmem bad blocks to bad range

2019-08-19 Thread Santosh Sivaraj
Santosh Sivaraj writes: > This series, which should be based on top of the still un-merged > "powerpc: implement machine check safe memcpy" series, adds support > to add the bad blocks which generated an MCE to the NVDIMM bad blocks. > The next access of the same memory will be blocked by the

Re: [PATCH] btrfs: fix allocation of bitmap pages.

2019-08-19 Thread Christoph Hellwig
On Mon, Aug 19, 2019 at 07:46:00PM +0200, David Sterba wrote: > Another thing that is lost is the slub debugging support for all > architectures, because get_zeroed_pages lacking the red zones and sanity > checks. > > I find working with raw pages in this code a bit inconsistent with the > rest

[PATCH 2/3] of_pmem: Add memory ranges which took a mce to bad range

2019-08-19 Thread Santosh Sivaraj
Subscribe to the MCE notification and add the physical address which generated a memory error to nvdimm bad range. Signed-off-by: Santosh Sivaraj --- drivers/nvdimm/of_pmem.c | 151 +-- 1 file changed, 131 insertions(+), 20 deletions(-) diff --git

[PATCH 3/3] papr/scm: Add bad memory ranges to nvdimm bad ranges

2019-08-19 Thread Santosh Sivaraj
Subscribe to the MCE notification and add the physical address which generated a memory error to nvdimm bad range. Signed-off-by: Santosh Sivaraj --- arch/powerpc/platforms/pseries/papr_scm.c | 86 ++- 1 file changed, 85 insertions(+), 1 deletion(-) diff --git

[PATCH 1/3] powerpc/mce: Add MCE notification chain

2019-08-19 Thread Santosh Sivaraj
This is needed to report bad blocks for persistent memory. Signed-off-by: Santosh Sivaraj --- arch/powerpc/include/asm/mce.h | 3 +++ arch/powerpc/kernel/mce.c | 15 +++ 2 files changed, 18 insertions(+) diff --git a/arch/powerpc/include/asm/mce.h

[PATCH 0/3] Add bad pmem bad blocks to bad range

2019-08-19 Thread Santosh Sivaraj
This series, which should be based on top of the still un-merged "powerpc: implement machine check safe memcpy" series, adds support to add the bad blocks which generated an MCE to the NVDIMM bad blocks. The next access of the same memory will be blocked by the NVDIMM layer itself. --- Santosh

[PATCH v4 16/16] powerpc/configs: Enable secure guest support in pseries and ppc64 defconfigs

2019-08-19 Thread Thiago Jung Bauermann
From: Ryan Grimm Enables running as a secure guest in platforms with an Ultravisor. Signed-off-by: Ryan Grimm Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/configs/ppc64_defconfig | 1 + arch/powerpc/configs/pseries_defconfig | 1 + 2 files changed, 2

[PATCH v4 15/16] Documentation/powerpc: Ultravisor API

2019-08-19 Thread Thiago Jung Bauermann
From: Sukadev Bhattiprolu POWER9 processor includes support for Protected Execution Facility (PEF). Attached documentation provides an overview of PEF and defines the API for various interfaces that must be implemented in the Ultravisor firmware as well as in the KVM Hypervisor. Based on input

[PATCH v4 14/16] powerpc/pseries/svm: Force SWIOTLB for secure guests

2019-08-19 Thread Thiago Jung Bauermann
From: Anshuman Khandual SWIOTLB checks range of incoming CPU addresses to be bounced and sees if the device can access it through its DMA window without requiring bouncing. In such cases it just chooses to skip bouncing. But for cases like secure guests on powerpc platform all addresses need to

[PATCH v4 13/16] powerpc/pseries/iommu: Don't use dma_iommu_ops on secure guests

2019-08-19 Thread Thiago Jung Bauermann
Secure guest memory is inacessible to devices so regular DMA isn't possible. In that case set devices' dma_map_ops to NULL so that the generic DMA code path will use SWIOTLB to bounce buffers for DMA. Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/platforms/pseries/iommu.c | 11

[PATCH v4 12/16] powerpc/pseries/svm: Disable doorbells in SVM guests

2019-08-19 Thread Thiago Jung Bauermann
From: Sukadev Bhattiprolu Normally, the HV emulates some instructions like MSGSNDP, MSGCLRP from a KVM guest. To emulate the instructions, it must first read the instruction from the guest's memory and decode its parameters. However for a secure guest (aka SVM), the page containing the

[RFC PATCH v4 11/16] powerpc/pseries/svm: Export guest SVM status to user space via sysfs

2019-08-19 Thread Thiago Jung Bauermann
From: Ryan Grimm User space might want to know it's running in a secure VM. It can't do a mfmsr because mfmsr is a privileged instruction. The solution here is to create a cpu attribute: /sys/devices/system/cpu/svm which will read 0 or 1 based on the S bit of the current CPU. Signed-off-by:

[PATCH v4 10/16] powerpc/pseries/svm: Unshare all pages before kexecing a new kernel

2019-08-19 Thread Thiago Jung Bauermann
From: Ram Pai A new kernel deserves a clean slate. Any pages shared with the hypervisor is unshared before invoking the new kernel. However there are exceptions. If the new kernel is invoked to dump the current kernel, or if there is a explicit request to preserve the state of the current

[PATCH v4 09/16] powerpc/pseries/svm: Use shared memory for Debug Trace Log (DTL)

2019-08-19 Thread Thiago Jung Bauermann
From: Anshuman Khandual Secure guests need to share the DTL buffers with the hypervisor. To that end, use a kmem_cache constructor which converts the underlying buddy allocated SLUB cache pages into shared memory. Signed-off-by: Anshuman Khandual Signed-off-by: Thiago Jung Bauermann ---

[PATCH v4 08/16] powerpc/pseries/svm: Use shared memory for LPPACA structures

2019-08-19 Thread Thiago Jung Bauermann
From: Anshuman Khandual LPPACA structures need to be shared with the host. Hence they need to be in shared memory. Instead of allocating individual chunks of memory for a given structure from memblock, a contiguous chunk of memory is allocated and then converted into shared memory. Subsequent

[PATCH v4 07/16] powerpc/pseries: Add and use LPPACA_SIZE constant

2019-08-19 Thread Thiago Jung Bauermann
Helps document what the hard-coded number means. Also take the opportunity to fix an #endif comment. Suggested-by: Alexey Kardashevskiy Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/kernel/paca.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git

[PATCH v4 06/16] powerpc: Introduce the MSR_S bit

2019-08-19 Thread Thiago Jung Bauermann
From: Sukadev Bhattiprolu Protected Execution Facility (PEF) is an architectural change for POWER 9 that enables Secure Virtual Machines (SVMs). When enabled, PEF adds a new higher privileged mode, called Ultravisor mode, to POWER architecture. The hardware changes include the following: *

[PATCH v4 05/16] powerpc/pseries/svm: Add helpers for UV_SHARE_PAGE and UV_UNSHARE_PAGE

2019-08-19 Thread Thiago Jung Bauermann
From: Ram Pai These functions are used when the guest wants to grant the hypervisor access to certain pages. Signed-off-by: Ram Pai Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/ultravisor-api.h | 2 ++ arch/powerpc/include/asm/ultravisor.h | 24

[PATCH v4 04/16] powerpc/prom_init: Add the ESM call to prom_init

2019-08-19 Thread Thiago Jung Bauermann
From: Ram Pai Make the Enter-Secure-Mode (ESM) ultravisor call to switch the VM to secure mode. Pass kernel base address and FDT address so that the Ultravisor is able to verify the integrity of the VM using information from the ESM blob. Add "svm=" command line option to turn on switching to

[PATCH v4 03/16] powerpc: Add support for adding an ESM blob to the zImage wrapper

2019-08-19 Thread Thiago Jung Bauermann
From: Benjamin Herrenschmidt For secure VMs, the signing tool will create a ticket called the "ESM blob" for the Enter Secure Mode ultravisor call with the signatures of the kernel and initrd among other things. This adds support to the wrapper script for adding that blob via the "-e" option to

[PATCH v4 02/16] powerpc/pseries: Introduce option to build secure virtual machines

2019-08-19 Thread Thiago Jung Bauermann
Introduce CONFIG_PPC_SVM to control support for secure guests and include Ultravisor-related helpers when it is selected Signed-off-by: Thiago Jung Bauermann --- arch/powerpc/include/asm/asm-prototypes.h | 2 +- arch/powerpc/kernel/Makefile | 4 +++-

[PATCH v4 00/16] Secure Virtual Machine Enablement

2019-08-19 Thread Thiago Jung Bauermann
Hello, This is a minor update of this patch series. It addresses review comments made to v3. Details are in the changelog. The sysfs patch is updated and included here but as I mentioned earlier can be postponed. It is marked RFC for that reason. As with the previous version, the patch

[PATCH v4 01/16] powerpc/kernel: Add ucall_norets() ultravisor call handler

2019-08-19 Thread Thiago Jung Bauermann
From: Claudio Carvalho The ultracalls (ucalls for short) allow the Secure Virtual Machines (SVM)s and hypervisor to request services from the ultravisor such as accessing a register or memory region that can only be accessed when running in ultravisor-privileged mode. This patch adds the

Re: [PATCH v10 2/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-19 Thread Santosh Sivaraj
Hi Nick, Nicholas Piggin writes: > Santosh Sivaraj's on August 15, 2019 10:39 am: >> From: Balbir Singh >> >> The current code would fail on huge pages addresses, since the shift would >> be incorrect. Use the correct page shift value returned by >> __find_linux_pte() to get the correct

Re: [PATCH v1 05/10] powerpc/mm: Do early ioremaps from top to bottom on PPC64 too.

2019-08-19 Thread Michael Ellerman
Nicholas Piggin writes: > Christophe Leroy's on August 14, 2019 6:11 am: >> Until vmalloc system is up and running, ioremap basically >> allocates addresses at the border of the IOREMAP area. >> >> On PPC32, addresses are allocated down from the top of the area >> while on PPC64, addresses are

Re: [PATCH v1 08/10] powerpc/mm: move __ioremap_at() and __iounmap_at() into ioremap.c

2019-08-19 Thread Michael Ellerman
Christophe Leroy writes: > diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c > index 57d742509cec..889ee656cf64 100644 > --- a/arch/powerpc/mm/ioremap.c > +++ b/arch/powerpc/mm/ioremap.c > @@ -103,3 +103,46 @@ void iounmap(volatile void __iomem *token) > vunmap(addr); > }

Re: [PATCH] powerpc/vdso32: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2019-08-19 Thread Nathan Lynch
Christophe Leroy writes: > Hi, > > Le 19/08/2019 à 18:37, Nathan Lynch a écrit : >> Hi, >> >> Christophe Leroy writes: >>> Benchmark from vdsotest: >> >> I assume you also ran the verification/correctness parts of vdsotest...? :-) >> > > I did run vdsotest-all. I guess it runs the

Re: [PATCH v4 1/3] kasan: support backing vmalloc space with real shadow memory

2019-08-19 Thread Andy Lutomirski
> On Aug 18, 2019, at 8:58 PM, Daniel Axtens wrote: > >>> Each page of shadow memory represent 8 pages of real memory. Could we use >>> page_ref to count how many pieces of a shadow page are used so that we can >>> free it when the ref count decreases to 0. > > I'm not sure how much of a

Re: [PATCH] powerpc/vdso32: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2019-08-19 Thread Christophe Leroy
Hi, Le 19/08/2019 à 18:37, Nathan Lynch a écrit : Hi, Christophe Leroy writes: Benchmark from vdsotest: I assume you also ran the verification/correctness parts of vdsotest...? :-) I did run vdsotest-all. I guess it runs the verifications too ? Christophe

Re: [PATCH v5 3/4] mm/nvdimm: Use correct #defines instead of open coding

2019-08-19 Thread Dan Williams
On Mon, Aug 19, 2019 at 2:32 AM Aneesh Kumar K.V wrote: > > Aneesh Kumar K.V writes: > > > Dan Williams writes: > > > >> On Fri, Aug 9, 2019 at 12:45 AM Aneesh Kumar K.V > >> wrote: > >>> > >> > > ... > > >>> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c > >>> index

Re: [PATCH] btrfs: fix allocation of bitmap pages.

2019-08-19 Thread Christophe Leroy
Le 19/08/2019 à 19:46, David Sterba a écrit : On Sat, Aug 17, 2019 at 07:44:39AM +, Christophe Leroy wrote: Various notifications of type "BUG kmalloc-4096 () : Redzone overwritten" have been observed recently in various parts of the kernel. After some time, it has been made a relation

Re: [PATCH] btrfs: fix allocation of bitmap pages.

2019-08-19 Thread David Sterba
On Sat, Aug 17, 2019 at 07:44:39AM +, Christophe Leroy wrote: > Various notifications of type "BUG kmalloc-4096 () : Redzone > overwritten" have been observed recently in various parts of > the kernel. After some time, it has been made a relation with > the use of BTRFS filesystem. > > [

Clean up cut-here even harder (was Re: [PATCH 1/3] powerpc: don't use __WARN() for WARN_ON())

2019-08-19 Thread Kees Cook
On Mon, Aug 19, 2019 at 09:28:03AM -0700, Kees Cook wrote: > On Mon, Aug 19, 2019 at 01:06:28PM +, Christophe Leroy wrote: > > __WARN() used to just call __WARN_TAINT(TAINT_WARN) > > > > But a call to printk() has been added in the commit identified below > > to print a " cut here "

Re: [PATCH v5 1/4] nvdimm: Consider probe return -EOPNOTSUPP as success

2019-08-19 Thread Dan Williams
On Mon, Aug 19, 2019 at 12:07 AM Aneesh Kumar K.V wrote: > > Dan Williams writes: > > > On Tue, Aug 13, 2019 at 9:22 PM Dan Williams > > wrote: > >> > >> Hi Aneesh, logic looks correct but there are some cleanups I'd like to > >> see and a lead-in patch that I attached. > >> > >> I've started

Re: [PATCH] powerpc/vdso32: Add support for CLOCK_{REALTIME/MONOTONIC}_COARSE

2019-08-19 Thread Nathan Lynch
Hi, Christophe Leroy writes: > Benchmark from vdsotest: I assume you also ran the verification/correctness parts of vdsotest...? :-)

Re: [PATCH 1/3] powerpc: don't use __WARN() for WARN_ON()

2019-08-19 Thread Kees Cook
On Mon, Aug 19, 2019 at 01:06:28PM +, Christophe Leroy wrote: > __WARN() used to just call __WARN_TAINT(TAINT_WARN) > > But a call to printk() has been added in the commit identified below > to print a " cut here " line. > > This change only applies to warnings using __WARN(), which

Re: [PATCH v4 11/25] powernv/fadump: register kernel metadata address with opal

2019-08-19 Thread Hari Bathini
On 14/08/19 3:51 PM, Mahesh Jagannath Salgaonkar wrote: > On 8/14/19 12:36 PM, Hari Bathini wrote: >> >> >> On 13/08/19 4:11 PM, Mahesh J Salgaonkar wrote: >>> On 2019-07-16 17:03:15 Tue, Hari Bathini wrote: OPAL allows registering address with it in the first kernel and retrieving it

Re: [PATCH 3/3] powerpc: use __builtin_trap() in BUG/WARN macros.

2019-08-19 Thread Segher Boessenkool
On Mon, Aug 19, 2019 at 05:05:46PM +0200, Christophe Leroy wrote: > Le 19/08/2019 à 16:37, Segher Boessenkool a écrit : > >On Mon, Aug 19, 2019 at 04:08:43PM +0200, Christophe Leroy wrote: > >>Le 19/08/2019 à 15:23, Segher Boessenkool a écrit : > >>>On Mon, Aug 19, 2019 at 01:06:31PM +,

Re: [PATCH 3/3] powerpc: use __builtin_trap() in BUG/WARN macros.

2019-08-19 Thread Christophe Leroy
Le 19/08/2019 à 16:37, Segher Boessenkool a écrit : On Mon, Aug 19, 2019 at 04:08:43PM +0200, Christophe Leroy wrote: Le 19/08/2019 à 15:23, Segher Boessenkool a écrit : On Mon, Aug 19, 2019 at 01:06:31PM +, Christophe Leroy wrote: Note that we keep using an assembly text using "twi

Re: [PATCH v3 3/3] powerpc/64: optimise LOAD_REG_IMMEDIATE_SYM()

2019-08-19 Thread Nicholas Piggin
Segher Boessenkool's on August 20, 2019 12:24 am: > On Mon, Aug 19, 2019 at 01:58:12PM +, Christophe Leroy wrote: >> -#define LOAD_REG_IMMEDIATE_SYM(reg,expr)\ >> -lis reg,(expr)@highest; \ >> -ori reg,reg,(expr)@higher; \ >> -rldicr reg,reg,32,31;

Re: [PATCH 0/6] drm+dma: cache support for arm, etc

2019-08-19 Thread Rob Clark
On Sun, Aug 18, 2019 at 10:23 PM Christoph Hellwig wrote: > > On Fri, Aug 16, 2019 at 02:04:35PM -0700, Rob Clark wrote: > > I don't disagree about needing an API to get uncached memory (or > > ideally just something outside of the linear map). But I think this > > is a separate problem. > > > >

Re: [PATCH 3/3] powerpc: use __builtin_trap() in BUG/WARN macros.

2019-08-19 Thread Segher Boessenkool
On Mon, Aug 19, 2019 at 04:08:43PM +0200, Christophe Leroy wrote: > Le 19/08/2019 à 15:23, Segher Boessenkool a écrit : > >On Mon, Aug 19, 2019 at 01:06:31PM +, Christophe Leroy wrote: > >>Note that we keep using an assembly text using "twi 31, 0, 0" for > >>inconditional traps because GCC

Re: [PATCH v10 6/7] powerpc/mce: Handle UE event for memcpy_mcsafe

2019-08-19 Thread Nicholas Piggin
Santosh Sivaraj's on August 15, 2019 10:39 am: > From: Balbir Singh > > If we take a UE on one of the instructions with a fixup entry, set nip > to continue execution at the fixup entry. Stop processing the event > further or print it. The previous patch added these fixup entries and now you

Re: [PATCH 7/8] parisc: don't set ARCH_NO_COHERENT_DMA_MMAP

2019-08-19 Thread Christoph Hellwig
Does my explanation from Thursday make sense or is it completely off? Does the patch description need some update to be less confusing to those used to different terminology? On Thu, Aug 15, 2019 at 12:50:02PM +0200, Christoph Hellwig wrote: > Except for the different naming scheme vs the code

Re: [PATCH v3 3/3] powerpc/64: optimise LOAD_REG_IMMEDIATE_SYM()

2019-08-19 Thread Segher Boessenkool
On Mon, Aug 19, 2019 at 01:58:12PM +, Christophe Leroy wrote: > -#define LOAD_REG_IMMEDIATE_SYM(reg,expr) \ > - lis reg,(expr)@highest; \ > - ori reg,reg,(expr)@higher; \ > - rldicr reg,reg,32,31; \ > - orisreg,reg,(expr)@__AS_ATHIGH;

Re: [PATCH v10 2/7] powerpc/mce: Fix MCE handling for huge pages

2019-08-19 Thread Nicholas Piggin
Santosh Sivaraj's on August 15, 2019 10:39 am: > From: Balbir Singh > > The current code would fail on huge pages addresses, since the shift would > be incorrect. Use the correct page shift value returned by > __find_linux_pte() to get the correct physical address. The code is more > generic and

Re: [PATCH v3 1/3] powerpc: rewrite LOAD_REG_IMMEDIATE() as an intelligent macro

2019-08-19 Thread Segher Boessenkool
Hi Christophe, On Mon, Aug 19, 2019 at 01:58:10PM +, Christophe Leroy wrote: > +.macro __LOAD_REG_IMMEDIATE r, x > + .if (\x) >= 0x8000 || (\x) < -0x8000 > + __LOAD_REG_IMMEDIATE_32 \r, (\x) >> 32 > + sldi\r, \r, 32 > + .if (\x) & 0x

Re: [PATCH 3/3] powerpc: use __builtin_trap() in BUG/WARN macros.

2019-08-19 Thread Christophe Leroy
Le 19/08/2019 à 15:23, Segher Boessenkool a écrit : On Mon, Aug 19, 2019 at 01:06:31PM +, Christophe Leroy wrote: Note that we keep using an assembly text using "twi 31, 0, 0" for inconditional traps because GCC drops all code after __builtin_trap() when the condition is always true at

Re: [PATCH v10 1/7] powerpc/mce: Schedule work from irq_work

2019-08-19 Thread Nicholas Piggin
Santosh Sivaraj's on August 15, 2019 10:39 am: > schedule_work() cannot be called from MCE exception context as MCE can > interrupt even in interrupt disabled context. The powernv code doesn't do this in general, rather defers kernel MCEs. My patch series converts the pseries machine check

[PATCH v3 3/3] powerpc/64: optimise LOAD_REG_IMMEDIATE_SYM()

2019-08-19 Thread Christophe Leroy
Optimise LOAD_REG_IMMEDIATE_SYM() using a temporary register to parallelise operations. It reduces the path from 5 to 3 instructions. Suggested-by: Segher Boessenkool Signed-off-by: Christophe Leroy --- v3: new --- arch/powerpc/include/asm/ppc_asm.h | 12 ++--

[PATCH v3 2/3] powerpc/32: replace LOAD_MSR_KERNEL() by LOAD_REG_IMMEDIATE()

2019-08-19 Thread Christophe Leroy
LOAD_MSR_KERNEL() and LOAD_REG_IMMEDIATE() are doing the same thing in the same way. Drop LOAD_MSR_KERNEL() Signed-off-by: Christophe Leroy --- v2: no change v3: no change --- arch/powerpc/kernel/entry_32.S | 18 +- arch/powerpc/kernel/head_32.h | 21 - 2

[PATCH v3 1/3] powerpc: rewrite LOAD_REG_IMMEDIATE() as an intelligent macro

2019-08-19 Thread Christophe Leroy
Today LOAD_REG_IMMEDIATE() is a basic #define which loads all parts on a value into a register, including the parts that are NUL. This means always 2 instructions on PPC32 and always 5 instructions on PPC64. And those instructions cannot run in parallele as they are updating the same register.

Re: [PATCH v4 1/2] powerpc/time: Only set CONFIG_ARCH_HAS_SCALED_CPUTIME on PPC64

2019-08-19 Thread Nicholas Piggin
Christophe Leroy's on August 14, 2019 4:31 pm: > Hi Nick, > > > Le 07/06/2018 à 03:43, Nicholas Piggin a écrit : >> On Wed, 6 Jun 2018 14:21:08 + (UTC) >> Christophe Leroy wrote: >> >>> scaled cputime is only meaningfull when the processor has >>> SPURR and/or PURR, which means only on

Re: [PATCH v1 05/10] powerpc/mm: Do early ioremaps from top to bottom on PPC64 too.

2019-08-19 Thread Nicholas Piggin
Christophe Leroy's on August 14, 2019 6:11 am: > Until vmalloc system is up and running, ioremap basically > allocates addresses at the border of the IOREMAP area. > > On PPC32, addresses are allocated down from the top of the area > while on PPC64, addresses are allocated up from the base of the

Re: [PATCH 3/3] powerpc: use __builtin_trap() in BUG/WARN macros.

2019-08-19 Thread Segher Boessenkool
On Mon, Aug 19, 2019 at 01:06:31PM +, Christophe Leroy wrote: > Note that we keep using an assembly text using "twi 31, 0, 0" for > inconditional traps because GCC drops all code after > __builtin_trap() when the condition is always true at build time. As I said, it can also do this for

Re: [PATCH v2 09/44] powerpc/64s/pseries: machine check convert to use common event code

2019-08-19 Thread Nicholas Piggin
Michael Ellerman's on August 17, 2019 8:25 am: > kbuild test robot writes: >> Hi Nicholas, >> >> I love your patch! Yet something to improve: >> >> [auto build test ERROR on linus/master] >> [cannot apply to v5.3-rc3 next-20190807] >> [if your patch is applied to the wrong git tree, please drop

Re: [PATCH 1/2] powerpc/64s: remplement power4_idle code in C

2019-08-19 Thread Nicholas Piggin
Michael Ellerman's on August 18, 2019 1:49 pm: > Nicholas Piggin writes: >> diff --git a/arch/powerpc/kernel/exceptions-64s.S >> b/arch/powerpc/kernel/exceptions-64s.S >> index eee5bef736c8..64d5ffbb07d1 100644 >> --- a/arch/powerpc/kernel/exceptions-64s.S >> +++

Re: [PATCH 2/3] powerpc/64s/radix: all CPUs should flush local translation structure before turning MMU on

2019-08-19 Thread Nicholas Piggin
Michael Ellerman's on August 19, 2019 12:00 pm: > Nicholas Piggin writes: >> Rather than sprinkle various translation structure invalidations >> around different places in early boot, have each CPU flush everything >> from its local translation structures before enabling its MMU. >> >> Radix

[PATCH 3/3] powerpc: use __builtin_trap() in BUG/WARN macros.

2019-08-19 Thread Christophe Leroy
The below exemples of use of WARN_ON() show that the result is sub-optimal in regard of the capabilities of powerpc. void test_warn1(unsigned long long a) { WARN_ON(a); } void test_warn2(unsigned long a) { WARN_ON(a); } void test_warn3(unsigned long a, unsigned long b) {

[PATCH 1/3] powerpc: don't use __WARN() for WARN_ON()

2019-08-19 Thread Christophe Leroy
__WARN() used to just call __WARN_TAINT(TAINT_WARN) But a call to printk() has been added in the commit identified below to print a " cut here " line. This change only applies to warnings using __WARN(), which means WARN_ON() where the condition is constant at compile time. For WARN_ON()

[PATCH 2/3] powerpc: refactoring BUG/WARN macros

2019-08-19 Thread Christophe Leroy
BUG(), WARN() and friends are using a similar inline assembly to implement various traps with various flags. Lets refactor via a new BUG_ENTRY() macro. Signed-off-by: Christophe Leroy --- arch/powerpc/include/asm/bug.h | 41 +++-- 1 file changed, 15

Re: [PATCH v1 07/10] powerpc/mm: move iounmap() into ioremap.c and drop __iounmap()

2019-08-19 Thread Michael Ellerman
Christophe Leroy writes: > diff --git a/arch/powerpc/mm/ioremap.c b/arch/powerpc/mm/ioremap.c > index 0c23660522ca..57d742509cec 100644 > --- a/arch/powerpc/mm/ioremap.c > +++ b/arch/powerpc/mm/ioremap.c > @@ -72,3 +75,31 @@ void __iomem *ioremap_prot(phys_addr_t addr, unsigned long > size,

[PATCH v5 0/2] powerpc: Enabling IMA arch specific secure boot policies

2019-08-19 Thread Nayna Jain
IMA subsystem supports custom, built-in, arch-specific policies to define the files to be measured and appraised. These policies are honored based on the priority where arch-specific policies is the highest and custom is the lowest. OpenPOWER systems rely on IMA for signature verification of the

[PATCH v5 2/2] powerpc: Add support to initialize ima policy rules

2019-08-19 Thread Nayna Jain
POWER secure boot relies on the kernel IMA security subsystem to perform the OS kernel image signature verification. Since each secure boot mode has different IMA policy requirements, dynamic definition of the policy rules based on the runtime secure boot mode of the system is required. On systems

[PATCH v5 1/2] powerpc: detect the secure boot mode of the system

2019-08-19 Thread Nayna Jain
Secure boot on POWER defines different IMA policies based on the secure boot state of the system. This patch defines a function to detect the secure boot state of the system. The PPC_SECURE_BOOT config represents the base enablement of secureboot on POWER. Signed-off-by: Nayna Jain ---

Re: [PATCH 2/2] powerpc: support KASAN instrumentation of bitops

2019-08-19 Thread Christophe Leroy
Le 19/08/2019 à 08:28, Daniel Axtens a écrit : In KASAN development I noticed that the powerpc-specific bitops were not being picked up by the KASAN test suite. I'm not sure anybody cares about who noticed the problem. This sentence could be rephrased as: The powerpc-specific bitops are

Re: [PATCH 1/2] kasan: support instrumented bitops combined with generic bitops

2019-08-19 Thread Christophe Leroy
Le 19/08/2019 à 08:28, Daniel Axtens a écrit : Currently bitops-instrumented.h assumes that the architecture provides atomic, non-atomic and locking bitops (e.g. both set_bit and __set_bit). This is true on x86 and s390, but is not always true: there is a generic bitops/non-atomic.h header

Re: [5.3.0-rc4-next][bisected 882632][qla2xxx] WARNING: CPU: 10 PID: 425 at drivers/scsi/qla2xxx/qla_isr.c:2784 qla2x00_status_entry.isra

2019-08-19 Thread Abdul Haleem
On Wed, 2019-08-14 at 20:42 -0700, Bart Van Assche wrote: > On 8/14/19 10:18 AM, Abdul Haleem wrote: > > On Wed, 2019-08-14 at 10:05 -0700, Bart Van Assche wrote: > >> On 8/14/19 9:52 AM, Abdul Haleem wrote: > >>> Greeting's > >>> > >>> Today's linux-next kernel (5.3.0-rc4-next-20190813) booted

Re: [PATCH v4 1/3] kasan: support backing vmalloc space with real shadow memory

2019-08-19 Thread Mark Rutland
On Fri, Aug 16, 2019 at 10:41:00AM -0700, Andy Lutomirski wrote: > On Fri, Aug 16, 2019 at 10:08 AM Mark Rutland wrote: > > > > Hi Christophe, > > > > On Fri, Aug 16, 2019 at 09:47:00AM +0200, Christophe Leroy wrote: > > > Le 15/08/2019 à 02:16, Daniel Axtens a écrit : > > > > Hook into vmalloc

Re: [PATCH v5 3/4] mm/nvdimm: Use correct #defines instead of open coding

2019-08-19 Thread Aneesh Kumar K.V
Aneesh Kumar K.V writes: > Dan Williams writes: > >> On Fri, Aug 9, 2019 at 12:45 AM Aneesh Kumar K.V >> wrote: >>> >> ... >>> diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c >>> index 37e96811c2fc..c1d9be609322 100644 >>> --- a/drivers/nvdimm/pfn_devs.c >>> +++

Re: [PATCH] powerpc: Don't add -mabi= flags when building with Clang

2019-08-19 Thread Segher Boessenkool
On Sun, Aug 18, 2019 at 12:13:21PM -0700, Nathan Chancellor wrote: > When building pseries_defconfig, building vdso32 errors out: > > error: unknown target ABI 'elfv1' > > Commit 4dc831aa8813 ("powerpc: Fix compiling a BE kernel with a > powerpc64le toolchain") added these flags to fix

Re: [PATCH v2 3/3] arm: Add support for function error injection

2019-08-19 Thread Leo Yan
Hi Russell, On Tue, Aug 06, 2019 at 06:00:15PM +0800, Leo Yan wrote: > This patch implements arm specific functions regs_set_return_value() and > override_function_with_return() to support function error injection. > > In the exception flow, it updates pt_regs::ARM_pc with pt_regs::ARM_lr > so

Re: [PATCH v5 1/3] PM: wakeup: Add routine to help fetch wakeup source object.

2019-08-19 Thread Rafael J. Wysocki
On Monday, August 19, 2019 10:33:25 AM CEST Ran Wang wrote: > Hi Rafael, > > On Monday, August 19, 2019 16:20, Rafael J. Wysocki wrote: > > > > On Mon, Aug 19, 2019 at 10:15 AM Ran Wang wrote: > > > > > > Hi Rafael, > > > > > > On Monday, August 05, 2019 17:59, Rafael J. Wysocki wrote: > > > >

RE: [PATCH v5 1/3] PM: wakeup: Add routine to help fetch wakeup source object.

2019-08-19 Thread Ran Wang
Hi Rafael, On Monday, August 19, 2019 16:20, Rafael J. Wysocki wrote: > > On Mon, Aug 19, 2019 at 10:15 AM Ran Wang wrote: > > > > Hi Rafael, > > > > On Monday, August 05, 2019 17:59, Rafael J. Wysocki wrote: > > > > > > On Wednesday, July 24, 2019 9:47:20 AM CEST Ran Wang wrote: > > > > Some

Re: [PATCH v5 1/3] PM: wakeup: Add routine to help fetch wakeup source object.

2019-08-19 Thread Rafael J. Wysocki
On Mon, Aug 19, 2019 at 10:15 AM Ran Wang wrote: > > Hi Rafael, > > On Monday, August 05, 2019 17:59, Rafael J. Wysocki wrote: > > > > On Wednesday, July 24, 2019 9:47:20 AM CEST Ran Wang wrote: > > > Some user might want to go through all registered wakeup sources and > > > doing things

WARN_ON(1) generates ugly code since commit 6b15f678fb7d

2019-08-19 Thread Christophe Leroy
Hi Drew, I recently noticed gcc suddenly generating ugly code for WARN_ON(1). It looks like commit 6b15f678fb7d ("include/asm-generic/bug.h: fix "cut here" for WARN_ON for __WARN_TAINT architectures") is the culprit. unsigned long test_mul1(unsigned long a, unsigned long b) {     unsigned

RE: [PATCH v5 1/3] PM: wakeup: Add routine to help fetch wakeup source object.

2019-08-19 Thread Ran Wang
Hi Rafael, On Monday, August 05, 2019 17:59, Rafael J. Wysocki wrote: > > On Wednesday, July 24, 2019 9:47:20 AM CEST Ran Wang wrote: > > Some user might want to go through all registered wakeup sources and > > doing things accordingly. For example, SoC PM driver might need to do > > HW

Re: [PATCH] powerpc: optimise WARN_ON()

2019-08-19 Thread Segher Boessenkool
On Mon, Aug 19, 2019 at 07:40:42AM +0200, Christophe Leroy wrote: > Le 18/08/2019 à 14:01, Segher Boessenkool a écrit : > >On Sat, Aug 17, 2019 at 09:04:42AM +, Christophe Leroy wrote: > >>Unlike BUG_ON(x), WARN_ON(x) uses !!(x) as the trigger > >>of the t(d/w)nei instruction instead of using

Re: [PATCH] powerpc: Don't add -mabi= flags when building with Clang

2019-08-19 Thread Daniel Axtens
Hi Nathan, > When building pseries_defconfig, building vdso32 errors out: > > error: unknown target ABI 'elfv1' > > Commit 4dc831aa8813 ("powerpc: Fix compiling a BE kernel with a > powerpc64le toolchain") added these flags to fix building GCC but > clang is multitargeted and does not need

Re: [PATCH v5 3/4] mm/nvdimm: Use correct #defines instead of open coding

2019-08-19 Thread Aneesh Kumar K.V
Dan Williams writes: > On Fri, Aug 9, 2019 at 12:45 AM Aneesh Kumar K.V > wrote: >> >> Use PAGE_SIZE instead of SZ_4K and sizeof(struct page) instead of 64. >> If we have a kernel built with different struct page size the previous >> patch should handle marking the namespace disabled. > > Each

Re: [PATCH v5 1/4] nvdimm: Consider probe return -EOPNOTSUPP as success

2019-08-19 Thread Aneesh Kumar K.V
Dan Williams writes: > On Tue, Aug 13, 2019 at 9:22 PM Dan Williams wrote: >> >> Hi Aneesh, logic looks correct but there are some cleanups I'd like to >> see and a lead-in patch that I attached. >> >> I've started prefixing nvdimm patches with: >> >> libnvdimm/$component: >> >> ...since

[PATCH] powerpc/603: fix handling of the DIRTY flag

2019-08-19 Thread Christophe Leroy
If a page is already mapped RW without the DIRTY flag, the DIRTY flag is never set and a TLB store miss exception is taken forever. This is easily reproduced with the following app: void main(void) { volatile char *ptr = mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_ANONYMOUS,

[PATCH 2/2] powerpc: support KASAN instrumentation of bitops

2019-08-19 Thread Daniel Axtens
In KASAN development I noticed that the powerpc-specific bitops were not being picked up by the KASAN test suite. Instrumentation is done via the bitops/instrumented-{atomic,lock}.h headers. They require that arch-specific versions of bitop functions are renamed to arch_*. Do this renaming. For

[PATCH 1/2] kasan: support instrumented bitops combined with generic bitops

2019-08-19 Thread Daniel Axtens
Currently bitops-instrumented.h assumes that the architecture provides atomic, non-atomic and locking bitops (e.g. both set_bit and __set_bit). This is true on x86 and s390, but is not always true: there is a generic bitops/non-atomic.h header that provides generic non-atomic operations, and also

Re: [PATCH v6 00/12] implement KASLR for powerpc/fsl_booke/32

2019-08-19 Thread Jason Yan
Hi Michael, Is there anything more I should do to get this feature meeting the requirements of the mainline? Thanks, Jason On 2019/8/9 18:07, Jason Yan wrote: This series implements KASLR for powerpc/fsl_booke/32, as a security feature that deters exploit attempts relying on knowledge of