[PATCH v2 1/2] of: of_node_get()/of_node_put() nodes held in phandle cache

2018-12-16 Thread frowand . list
From: Frank Rowand The phandle cache contains struct device_node pointers. The refcount of the pointers was not incremented while in the cache, allowing use after free error after kfree() of the node. Add the proper increment and decrement of the use count. Fixes: 0b3ce78e90fc ("of: cache

[PATCH v2 0/2] of: phandle_cache, fix refcounts, remove stale entry

2018-12-16 Thread frowand . list
From: Frank Rowand Non-overlay dynamic devicetree node removal may leave the node in the phandle cache. Subsequent calls to of_find_node_by_phandle() will incorrectly find the stale entry. This bug exposed the foloowing phandle cache refcount bug. The refcount of phandle_cache entries is not

Re: [PATCH 2/8] powerpc/dma: properly wire up the unmap_page and unmap_sg methods

2018-12-16 Thread Christophe Leroy
Le 17/12/2018 à 08:34, Christoph Hellwig a écrit : On Mon, Dec 17, 2018 at 07:41:54AM +0100, Christophe Leroy wrote: Le 16/12/2018 à 18:19, Christoph Hellwig a écrit : The unmap methods need to transfer memory ownership back from the device to the cpu by identical means as

Re: [PATCH 7/8] powerpc/dma: split the two __dma_alloc_coherent implementations

2018-12-16 Thread Christoph Hellwig
On Mon, Dec 17, 2018 at 07:51:05AM +0100, Christophe Leroy wrote: > > > Le 16/12/2018 à 18:19, Christoph Hellwig a écrit : >> The implemementation for the CONFIG_NOT_COHERENT_CACHE case doesn't share >> any code with the one for systems with coherent caches. Split it off >> and merge it with the

Re: [PATCH 2/8] powerpc/dma: properly wire up the unmap_page and unmap_sg methods

2018-12-16 Thread Christoph Hellwig
On Mon, Dec 17, 2018 at 07:41:54AM +0100, Christophe Leroy wrote: > > > Le 16/12/2018 à 18:19, Christoph Hellwig a écrit : >> The unmap methods need to transfer memory ownership back from the device >> to the cpu by identical means as dma_sync_*_to_cpu. I'm not sure powerpc >> needs to do any

Re: [PATCH 3/8] crypto4xx_core: don't abuse __dma_sync_page

2018-12-16 Thread Christoph Hellwig
On Sun, Dec 16, 2018 at 07:28:32PM +0100, Christian Lamparter wrote: > Yeap, the crypto4xx is a real piece of work. However, ibm emac network driver > is even worse: Oh, fun.

Re: [PATCH v2 2/3] powerpc/lib: Refactor __patch_instruction() to use __put_user_asm()

2018-12-16 Thread Christophe Leroy
Hi Russel, Le 10/12/2018 à 08:00, Russell Currey a écrit : __patch_instruction() is called in early boot, and uses __put_user_size(), which includes the locks and unlocks for KUAP, which could either be called too early, or in the Radix case, forced to use "early_" versions of functions just to

Re: [PATCH 7/8] powerpc/dma: split the two __dma_alloc_coherent implementations

2018-12-16 Thread Christophe Leroy
Le 16/12/2018 à 18:19, Christoph Hellwig a écrit : The implemementation for the CONFIG_NOT_COHERENT_CACHE case doesn't share any code with the one for systems with coherent caches. Split it off and merge it with the helpers in dma-noncoherent.c that have no other callers. Signed-off-by:

Re: [PATCH 2/8] powerpc/dma: properly wire up the unmap_page and unmap_sg methods

2018-12-16 Thread Christophe Leroy
Le 16/12/2018 à 18:19, Christoph Hellwig a écrit : The unmap methods need to transfer memory ownership back from the device to the cpu by identical means as dma_sync_*_to_cpu. I'm not sure powerpc needs to do any work in this transfer direction, but given that it does invalidate the caches

Re: [PATCH v1 03/13] powerpc/mm/32s: rework mmu_mapin_ram()

2018-12-16 Thread Jonathan Neuschäfer
Hi, thanks for your reply. On Thu, Dec 13, 2018 at 03:51:32PM +0100, Christophe Leroy wrote: > Hi Again, > > Le 13/12/2018 à 13:16, Christophe Leroy a écrit : [...] > > Can you tell/provide the .config and dts used ? I'm using wii.dts and almost the wii_defconfig from my tree (save- defconfig

Re: use generic DMA mapping code in powerpc V4

2018-12-16 Thread Michael Ellerman
Christoph Hellwig writes: > FYI, given that we are one week before the expected 4.20 release > date and I haven't found the bug plaging Christians setups I think > we need to defer most of this to the next merge window. OK, sorry I couldn't help. I tried powering up my pasemi board last week

Re: [PATCH] ocxl: Fix endiannes bug in ocxl_link_update_pe()

2018-12-16 Thread Alastair D'Silva
On Sun, 2018-12-16 at 22:28 +0100, Greg Kurz wrote: > All fields in the PE are big-endian. Use cpu_to_be32() like > everywhere > else something is written to the PE. Otherwise a wrong TID will be > used > by the NPU. If this TID happens to point to an existing thread > sharing > the same mm, it

Re: [PATCH] ocxl: Fix endiannes bug in ocxl_link_update_pe()

2018-12-16 Thread Andrew Donnellan
On 17/12/18 8:28 am, Greg Kurz wrote: All fields in the PE are big-endian. Use cpu_to_be32() like everywhere else something is written to the PE. Otherwise a wrong TID will be used by the NPU. If this TID happens to point to an existing thread sharing the same mm, it could be woken up by error.

Re: [PATCH] kernel/dma/direct: Do not include SME mask in the DMA supported check

2018-12-16 Thread Lendacky, Thomas
On 12/15/2018 04:55 AM, Christoph Hellwig wrote: > The mail seems to be so oddly encoded so that git-am fails on it. Can > you resend as plain text? Hmmm... not sure what happened with that, but yeah, looking at the message source shows something strange went on. Let me take a look and I'll try

Re: [PATCH 8/8] cxl: drop the dma_set_mask callback from vphb

2018-12-16 Thread Andrew Donnellan
On 17/12/18 4:19 am, Christoph Hellwig wrote: The CXL code never even looks at the dma mask, so there is no good reason for this sanity check. Remove it because it gets in the way of the dma ops refactoring. Signed-off-by: Christoph Hellwig Acked-by: Andrew Donnellan ---

[PATCH] ocxl: Fix endiannes bug in ocxl_link_update_pe()

2018-12-16 Thread Greg Kurz
All fields in the PE are big-endian. Use cpu_to_be32() like everywhere else something is written to the PE. Otherwise a wrong TID will be used by the NPU. If this TID happens to point to an existing thread sharing the same mm, it could be woken up by error. This is highly improbable though. The

Re: [PATCH v1 6/9] arm64: kexec: no need to ClearPageReserved()

2018-12-16 Thread Matthias Brugger
On 14/12/2018 12:10, David Hildenbrand wrote: > This will be done by free_reserved_page(). > > Cc: Catalin Marinas > Cc: Will Deacon > Cc: Bhupesh Sharma > Cc: James Morse > Cc: Marc Zyngier > Cc: Dave Kleikamp > Cc: Mark Rutland > Cc: Andrew Morton > Cc: Michal Hocko > Cc: Matthew

Re: [PATCH 3/8] crypto4xx_core: don't abuse __dma_sync_page

2018-12-16 Thread Christian Lamparter
On Sunday, December 16, 2018 6:19:46 PM CET Christoph Hellwig wrote: > This function is internal to the DMA API implementation. Instead use the > DMA API to properly unmap. Note that the DMA API usage in this driver > is a disaster and urgently needs some work - it is missing all the unmaps, >

[PATCH] powerpc/ptrace: cleanup do_syscall_trace_enter

2018-12-16 Thread Dmitry V. Levin
Invoke tracehook_report_syscall_entry once. Signed-off-by: Dmitry V. Levin --- arch/powerpc/kernel/ptrace.c | 54 +--- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c index

[PATCH 8/8] cxl: drop the dma_set_mask callback from vphb

2018-12-16 Thread Christoph Hellwig
The CXL code never even looks at the dma mask, so there is no good reason for this sanity check. Remove it because it gets in the way of the dma ops refactoring. Signed-off-by: Christoph Hellwig --- drivers/misc/cxl/vphb.c | 12 1 file changed, 12 deletions(-) diff --git

[PATCH 7/8] powerpc/dma: split the two __dma_alloc_coherent implementations

2018-12-16 Thread Christoph Hellwig
The implemementation for the CONFIG_NOT_COHERENT_CACHE case doesn't share any code with the one for systems with coherent caches. Split it off and merge it with the helpers in dma-noncoherent.c that have no other callers. Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt ---

[PATCH 5/8] powerpc/dma: remove the unused ISA_DMA_THRESHOLD export

2018-12-16 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt --- arch/powerpc/kernel/setup_32.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index be6ee8dec98d..947f904688b0 100644 --- a/arch/powerpc/kernel/setup_32.c

[PATCH 6/8] powerpc/dma: remove the unused dma_iommu_ops export

2018-12-16 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig --- arch/powerpc/kernel/dma-iommu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c index f9fe2080ceb9..2ca6cfaebf65 100644 --- a/arch/powerpc/kernel/dma-iommu.c +++

[PATCH 4/8] powerpc/dma: remove the unused ARCH_HAS_DMA_MMAP_COHERENT define

2018-12-16 Thread Christoph Hellwig
Signed-off-by: Christoph Hellwig Acked-by: Benjamin Herrenschmidt --- arch/powerpc/include/asm/dma-mapping.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h index 8fa394520af6..f2a4a7142b1e 100644 ---

[PATCH 3/8] crypto4xx_core: don't abuse __dma_sync_page

2018-12-16 Thread Christoph Hellwig
This function is internal to the DMA API implementation. Instead use the DMA API to properly unmap. Note that the DMA API usage in this driver is a disaster and urgently needs some work - it is missing all the unmaps, seems to do a secondary map where it looks like it should to a unmap in one

[PATCH 2/8] powerpc/dma: properly wire up the unmap_page and unmap_sg methods

2018-12-16 Thread Christoph Hellwig
The unmap methods need to transfer memory ownership back from the device to the cpu by identical means as dma_sync_*_to_cpu. I'm not sure powerpc needs to do any work in this transfer direction, but given that it does invalidate the caches in dma_sync_*_to_cpu already we should make sure we also

small powerpc DMA fixes and cleanups

2018-12-16 Thread Christoph Hellwig
Hi all, this series has a few smaller fixes and cleanups for the powerpc DMA code. The biggest changes are related to the not cache coherent DMA support, which as far as I can tell was not consistent in its cache maintainance operations. Also the AMCC ppc44x crypto driver looks like it was

[PATCH 1/8] powerpc: allow NOT_COHERENT_CACHE for amigaone

2018-12-16 Thread Christoph Hellwig
AMIGAONE selects NOT_COHERENT_CACHE, so we better allow it. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/Kconfig.cputype | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype index

[PATCH] powerpc: use mm zones more sensibly

2018-12-16 Thread Christoph Hellwig
Powerpc has somewhat odd usage where ZONE_DMA is used for all memory on common 64-bit configfs, and ZONE_DMA32 is used for 31-bit schemes. Move to a scheme closer to what other architectures use (and I dare to say the intent of the system): - ZONE_DMA: optionally for memory < 31-bit (64-bit

Re: use generic DMA mapping code in powerpc V4

2018-12-16 Thread Christoph Hellwig
FYI, given that we are one week before the expected 4.20 release date and I haven't found the bug plaging Christians setups I think we need to defer most of this to the next merge window. I'd still like to get a few bits in earlier, which I will send out separately now.