[PATCH v5 2/5] powerpc/kprobes: Mark newly allocated probes as RO

2019-10-30 Thread Russell Currey
With CONFIG_STRICT_KERNEL_RWX=y and CONFIG_KPROBES=y, there will be one W+X page at boot by default. This can be tested with CONFIG_PPC_PTDUMP=y and CONFIG_PPC_DEBUG_WX=y set, and checking the kernel log during boot. powerpc doesn't implement its own alloc() for kprobes like other architectures d

[PATCH v5 1/5] powerpc/mm: Implement set_memory() routines

2019-10-30 Thread Russell Currey
The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, and are generally useful primitives to have. This implementation is designed to be completely generic across powerpc's many MMUs. It's possible that this could be optimised to be faster for specific MMUs, but the focus is

[PATCH v5 3/5] powerpc/mm/ptdump: debugfs handler for W+X checks at runtime

2019-10-30 Thread Russell Currey
Very rudimentary, just echo 1 > [debugfs]/check_wx_pages and check the kernel log. Useful for testing strict module RWX. Updated the Kconfig entry to reflect this. Also fixed a typo. Signed-off-by: Russell Currey --- arch/powerpc/Kconfig.debug | 6 -- arch/powerpc/mm/ptdum

[PATCH v5 5/5] powerpc/configs: Enable STRICT_MODULE_RWX in skiroot_defconfig

2019-10-30 Thread Russell Currey
skiroot_defconfig is the only powerpc defconfig with STRICT_KERNEL_RWX enabled, and if you want memory protection for kernel text you'd want it for modules too, so enable STRICT_MODULE_RWX there. Signed-off-by: Russell Currey --- arch/powerpc/configs/skiroot_defconfig | 1 + 1 file changed, 1 in

[PATCH v5 4/5] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX

2019-10-30 Thread Russell Currey
To enable strict module RWX on powerpc, set: CONFIG_STRICT_MODULE_RWX=y You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real security benefit. ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX. This is due to a quirk in arch/Kconfig and arch/powerpc/Kcon

[PATCH v5 0/5] Implement STRICT_MODULE_RWX for powerpc

2019-10-30 Thread Russell Currey
v4 cover letter: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198268.html v3 cover letter: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198023.html Changes since v4: [1/5]: Addressed review comments from Michael Ellerman (thanks!) [4/5]: make ARCH_

Re: [PATCH 6/6] s390x: Mark archrandom.h functions __must_check

2019-10-30 Thread Harald Freudenberger
On 29.10.19 14:18, Richard Henderson wrote: > On 10/29/19 8:26 AM, Harald Freudenberger wrote: >> Fine with me, Thanks, reviewed, build and tested. >> You may add my reviewed-by: Harald Freudenberger >> However, will this go into the kernel tree via crypto or s390 subsystem ? > That's an excellent

Re: [PATCH v5 1/5] powerpc/mm: Implement set_memory() routines

2019-10-30 Thread Christophe Leroy
Le 30/10/2019 à 08:31, Russell Currey a écrit : The set_memory_{ro/rw/nx/x}() functions are required for STRICT_MODULE_RWX, and are generally useful primitives to have. This implementation is designed to be completely generic across powerpc's many MMUs. It's possible that this could be optim

Re: [PATCH 2/2] ASoC: fsl_asrc: Add support for imx8qm

2019-10-30 Thread Nicolin Chen
On Wed, Oct 30, 2019 at 03:20:35AM +, S.j. Wang wrote: > Hi > > > > > On Tue, Oct 29, 2019 at 05:17:09PM +0800, Shengjiu Wang wrote: > > > There are two asrc module in imx8qm, each module has different clock > > > configuration, and the DMA type is EDMA. > > > > > > So in this patch, we defin

Re: [PATCH v5 0/5] Implement STRICT_MODULE_RWX for powerpc

2019-10-30 Thread Christophe Leroy
Le 30/10/2019 à 08:31, Russell Currey a écrit : v4 cover letter: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198268.html v3 cover letter: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198023.html Changes since v4: [1/5]: Addressed review comments from

[PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Yunsheng Lin
When passing the return value of dev_to_node() to cpumask_of_node() without checking if the device's node id is NUMA_NO_NODE, there is global-out-of-bounds detected by KASAN. >From the discussion [1], NUMA_NO_NODE really means no node affinity, which also means all cpus should be usable. So the cp

Re: [PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Peter Zijlstra
On Wed, Oct 30, 2019 at 05:34:28PM +0800, Yunsheng Lin wrote: > When passing the return value of dev_to_node() to cpumask_of_node() > without checking if the device's node id is NUMA_NO_NODE, there is > global-out-of-bounds detected by KASAN. > > From the discussion [1], NUMA_NO_NODE really means

Re: [PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Michal Hocko
On Wed 30-10-19 17:34:28, Yunsheng Lin wrote: > When passing the return value of dev_to_node() to cpumask_of_node() > without checking if the device's node id is NUMA_NO_NODE, there is > global-out-of-bounds detected by KASAN. > > >From the discussion [1], NUMA_NO_NODE really means no node affinit

Re: [PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Michal Hocko
On Wed 30-10-19 11:14:49, Peter Zijlstra wrote: > On Wed, Oct 30, 2019 at 05:34:28PM +0800, Yunsheng Lin wrote: > > When passing the return value of dev_to_node() to cpumask_of_node() > > without checking if the device's node id is NUMA_NO_NODE, there is > > global-out-of-bounds detected by KASAN.

Re: [PATCH v2 07/23] soc: fsl: qe: merge qe_ic.h into qe_ic.c

2019-10-30 Thread Christophe Leroy
Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : The local qe_ic.h header is only used by qe_ic.c, so merge its contents into the .c file. This is preparation for moving the driver to drivers/irqchip/. It also avoids confusion between this header and the one at include/soc/fsl/qe/qe_ic.h, whi

Re: [PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Peter Zijlstra
On Wed, Oct 30, 2019 at 11:22:29AM +0100, Michal Hocko wrote: > On Wed 30-10-19 11:14:49, Peter Zijlstra wrote: > > On Wed, Oct 30, 2019 at 05:34:28PM +0800, Yunsheng Lin wrote: > > > When passing the return value of dev_to_node() to cpumask_of_node() > > > without checking if the device's node id

Re: [PATCH v3] drm/radeon: Fix EEH during kexec

2019-10-30 Thread Michael Ellerman
Hi Kyle, KyleMahlkuch writes: > From: Kyle Mahlkuch > > During kexec some adapters hit an EEH since they are not properly > shut down in the radeon_pci_shutdown() function. Adding > radeon_suspend_kms() fixes this issue. > Enabled only on PPC because this patch causes issues on some other > boar

Re: [PATCH v2 09/23] soc: fsl: qe: move qe_ic_cascade_* functions to qe_ic.c

2019-10-30 Thread Christophe Leroy
Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : These functions are only ever called through a function pointer, and therefore it makes no sense for them to be "static inline" - gcc has no choice but to emit a copy in each translation unit that takes the address of one of these (currently va

Re: [PATCH v2 11/23] soc: fsl: qe: rename qe_ic_cascade_low_mpic -> qe_ic_cascade_low

2019-10-30 Thread Christophe Leroy
Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : The qe_ic_cascade_{low,high}_mpic functions are now used as handlers both when the interrupt parent is mpic as well as ipic, so remove the _mpic suffix. Here you are modifying code that you drop in patch 14. That's pointless. You should perf

Re: [PATCH v2 17/23] soc: fsl: qe: make qe_ic_cascade_* static

2019-10-30 Thread Christophe Leroy
Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : Now that the references from arch/powerpc/ are gone, these are only referenced from inside qe_ic.c, so make them static. Why do that in two steps ? I think patch 9 could remain until here, and then you could squash patch 9 and patch 17 toget

Re: [PATCH v2 19/23] net: ethernet: freescale: make UCC_GETH explicitly depend on PPC32

2019-10-30 Thread Christophe Leroy
Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : Currently, QUICC_ENGINE depends on PPC32, so this in itself does not change anything. In order to allow removing the PPC32 dependency from QUICC_ENGINE and avoid allmodconfig build failures, add this explicit dependency. Signed-off-by: Rasmus

Re: [PATCH v2 20/23] serial: make SERIAL_QE depend on PPC32

2019-10-30 Thread Christophe Leroy
Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : Currently SERIAL_QE depends on QUICC_ENGINE, which in turn depends on PPC32, so this doesn't add any extra dependency. However, the QUICC Engine IP block also exists on some arm boards, so this serves as preparation for removing the PPC32 depen

[PATCH] powerpc: Add build-time check of ptrace PT_xx defines

2019-10-30 Thread Michael Ellerman
As part of the uapi we export a lot of PT_xx defines for each register in struct pt_regs. These are expressed as an index from gpr[0], in units of unsigned long. Currently there's nothing tying the values of those defines to the actual layout of the struct. But we *don't* want to change the uapi

Re: [PATCH] powerpc: Add build-time check of ptrace PT_xx defines

2019-10-30 Thread Christophe Leroy
Le 30/10/2019 à 12:12, Michael Ellerman a écrit : As part of the uapi we export a lot of PT_xx defines for each register in struct pt_regs. These are expressed as an index from gpr[0], in units of unsigned long. Currently there's nothing tying the values of those defines to the actual layout

Re: [PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Michal Hocko
On Wed 30-10-19 11:28:00, Peter Zijlstra wrote: > On Wed, Oct 30, 2019 at 11:22:29AM +0100, Michal Hocko wrote: > > On Wed 30-10-19 11:14:49, Peter Zijlstra wrote: > > > On Wed, Oct 30, 2019 at 05:34:28PM +0800, Yunsheng Lin wrote: > > > > When passing the return value of dev_to_node() to cpumask_o

Re: [PATCH 5/6] powerpc: Mark archrandom.h functions __must_check

2019-10-30 Thread Michael Ellerman
Richard Henderson writes: > We cannot use the pointer output without validating the > success of the random read. You _can_, but you must not. > Signed-off-by: Richard Henderson > --- > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Michael Ellerman > --- > arch/powerpc/include/asm/

[PATCH V2 1/2] ASoC: dt-bindings: fsl_asrc: add compatible string for imx8qm

2019-10-30 Thread Shengjiu Wang
In order to support the two asrc modules in imx8qm, we need to add compatible string "fsl,imx8qm-asrc0" and "fsl,imx8qm-asrc1" Signed-off-by: Shengjiu Wang --- Documentation/devicetree/bindings/sound/fsl,asrc.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation

[PATCH V2 2/2] ASoC: fsl_asrc: Add support for imx8qm

2019-10-30 Thread Shengjiu Wang
There are two asrc module in imx8qm, each module has different clock configuration, and the DMA type is EDMA. So in this patch, we define the new clocks, refine the clock map, and include struct fsl_asrc_soc_data for different soc usage. The EDMA channel is fixed with each dma request, one dma re

Re: [PATCH] powerpc/tools: Don't quote $objdump in scripts

2019-10-30 Thread Michael Ellerman
Segher Boessenkool writes: > On Thu, Oct 24, 2019 at 11:47:30AM +1100, Michael Ellerman wrote: >> Some of our scripts are passed $objdump and then call it as >> "$objdump". This doesn't work if it contains spaces because we're >> using ccache, for example you get errors such as: >> >> ./arch/po

Re: [PATCH] powerpc/configs: Rename foo_basic_defconfig to foo_base.config

2019-10-30 Thread Michael Ellerman
On Tue, 2019-05-28 at 08:16:14 UTC, Michael Ellerman wrote: > We have several "defconfigs" that are not actually full defconfigs > they are just a base set of options which are then merged with other > fragments to produce a working defconfig. > > The most obvious example is corenet_basic_defconfi

Re: [PATCH v4] powerpc/setup_64: fix -Wempty-body warnings

2019-10-30 Thread Michael Ellerman
On Mon, 2019-07-15 at 18:32:32 UTC, Qian Cai wrote: > At the beginning of setup_64.c, it has, > > #ifdef DEBUG > #define DBG(fmt...) udbg_printf(fmt) > #else > #define DBG(fmt...) > #endif > > where DBG() could be compiled away, and generate warnings, > > arch/powerpc/kernel/setup_64.c

Re: [PATCH] powerpc/configs: Add debug config fragment

2019-10-30 Thread Michael Ellerman
On Thu, 2019-08-01 at 04:58:55 UTC, Andrew Donnellan wrote: > Add a debug config fragment that we can use to put useful debug options > into. > > Currently we only define a target for powernv[_be]_debug_defconfig, and the > only option included is to enable debugfs SCOM access. > > Suggested-by:

Re: [PATCH v7 1/2] powerpc/xmon: Allow listing and clearing breakpoints in read-only mode

2019-10-30 Thread Michael Ellerman
On Sat, 2019-09-07 at 06:11:23 UTC, "Christopher M. Riedl" wrote: > Read-only mode should not prevent listing and clearing any active > breakpoints. > > Tested-by: Daniel Axtens > Reviewed-by: Daniel Axtens > Signed-off-by: Christopher M. Riedl Series applied to powerpc next, thanks. https://

Re: [PATCH v2] powerpc/nvdimm: Update vmemmap_populated to check sub-section range

2019-10-30 Thread Michael Ellerman
On Tue, 2019-09-17 at 12:38:51 UTC, "Aneesh Kumar K.V" wrote: > With commit: 7cc7867fb061 ("mm/devm_memremap_pages: enable sub-section remap") > pmem namespaces are remapped in 2M chunks. On architectures like ppc64 we > can map the memmap area using 16MB hugepage size and that can cover > a memory

Re: [PATCH] powerpc/pkeys: remove unused pkey_allows_readwrite

2019-10-30 Thread Michael Ellerman
On Tue, 2019-09-17 at 15:22:30 UTC, Qian Cai wrote: > pkey_allows_readwrite() was first introduced in the commit 5586cf61e108 > ("powerpc: introduce execute-only pkey"), but the usage was removed > entirely in the commit a4fcc877d4e1 ("powerpc/pkeys: Preallocate > execute-only key"). > > Found by

Re: [PATCH] powerpc/configs: add FADump awareness to skiroot_defconfig

2019-10-30 Thread Michael Ellerman
On Wed, 2019-10-09 at 14:04:29 UTC, Hari Bathini wrote: > FADump is supported on PowerNV platform. To fulfill this support, the > petitboot kernel must be FADump aware. Enable config PRESERVE_FA_DUMP > to make the petitboot kernel FADump aware. > > Signed-off-by: Hari Bathini Applied to powerpc

Re: [PATCH] powerpc: make syntax for FADump config options in kernel/Makefile readable

2019-10-30 Thread Michael Ellerman
On Wed, 2019-10-09 at 15:27:20 UTC, Hari Bathini wrote: > arch/powerpc/kernel/fadump.c file needs to be compiled in if 'config > FA_DUMP' or 'config PRESERVE_FA_DUMP' is set. The current syntax > achieves that but looks a bit odd. Fix it for better readability. > > Signed-off-by: Hari Bathini Ap

Re: [PATCH] selftests/powerpc: Reduce sigfuz runtime to ~60s

2019-10-30 Thread Michael Ellerman
On Sun, 2019-10-13 at 23:46:43 UTC, Michael Ellerman wrote: > The defaults for the sigfuz test is to run for 4000 iterations, but > that can take quite a while and the test harness may kill the test. > Reduce the number of iterations to 600, which gives a runtime of > roughly 1 minute on a Power8 s

Re: [PATCH] powerpc/pseries: Mark accumulate_stolen_time() as notrace

2019-10-30 Thread Michael Ellerman
On Thu, 2019-10-24 at 05:59:32 UTC, Michael Ellerman wrote: > accumulate_stolen_time() is called prior to interrupt state being > reconciled, which can trip the warning in arch_local_irq_restore(): > > WARNING: CPU: 5 PID: 1017 at arch/powerpc/kernel/irq.c:258 > .arch_local_irq_restore+0x9c/0x1

Re: [PATCH v2 1/3] powerpc/pseries: Don't opencode HPTE_V_BOLTED

2019-10-30 Thread Michael Ellerman
On Thu, 2019-10-24 at 09:35:40 UTC, "Aneesh Kumar K.V" wrote: > No functional change in this patch. > > Signed-off-by: Aneesh Kumar K.V Series applied to powerpc next, thanks. https://git.kernel.org/powerpc/c/82ce028ad26dd075b06285ef61a854a564d910fb cheers

Re: [PATCH v3] powerpc/powernv: Add queue mechanism for early messages

2019-10-30 Thread Michael Ellerman
On Mon, 2018-05-21 at 02:04:38 UTC, Deb McLemore wrote: > Problem being solved is when issuing a BMC soft poweroff during IPL, > the poweroff was being lost so the machine would not poweroff. > > Opal messages were being received before the opal-power code > registered its notifiers. > > Alternat

Re: [PATCH] powerpc/prom_init: Undo relocation before entering secure mode

2019-10-30 Thread Michael Ellerman
On Wed, 2019-09-11 at 16:34:33 UTC, Thiago Jung Bauermann wrote: > The ultravisor will do an integrity check of the kernel image but we > relocated it so the check will fail. Restore the original image by > relocating it back to the kernel virtual base address. > > This works because during build

Re: [PATCH] powernv/eeh: Fix oops when probing cxl devices

2019-10-30 Thread Michael Ellerman
On Wed, 2019-10-16 at 16:28:33 UTC, Frederic Barrat wrote: > Recent cleanup in the way EEH support is added to a device causes a > kernel oops when the cxl driver probes a device and creates virtual > devices discovered on the FPGA: > > BUG: Kernel NULL pointer dereference at 0x00a0 >

Re: [PATCH] powerpc/powernv: Fix CPU idle to be called with IRQs disabled

2019-10-30 Thread Michael Ellerman
On Tue, 2019-10-22 at 11:58:14 UTC, Nicholas Piggin wrote: > Commit e78a7614f3876 ("idle: Prevent late-arriving interrupts from > disrupting offline") changes arch_cpu_idle_dead to be called with > interrupts disabled, which triggers the WARN in pnv_smp_cpu_kill_self. > > Fix this by fixing up irq

Re: [PATCH v7] numa: make node_to_cpumask_map() NUMA_NO_NODE aware

2019-10-30 Thread Qian Cai
> On Oct 30, 2019, at 6:28 AM, Peter Zijlstra wrote: > > It only makes 'wild' guesses when the BIOS is shit and it complains > about that. > > Or do you like you BIOS broken? Agree. It is the garbage in and garbage out. No need to complicate the existing code further.

Re: [PATCH v2 17/23] soc: fsl: qe: make qe_ic_cascade_* static

2019-10-30 Thread Rasmus Villemoes
On 30/10/2019 11.50, Christophe Leroy wrote: > > > Le 25/10/2019 à 14:40, Rasmus Villemoes a écrit : >> Now that the references from arch/powerpc/ are gone, these are only >> referenced from inside qe_ic.c, so make them static. > > Why do that in two steps ? > I think patch 9 could remain until

Re: [RFC PATCH 00/27] current interrupt series plus scv syscall

2019-10-30 Thread Michal Suchánek
Hello, On Wed, Oct 02, 2019 at 01:13:52PM +1000, Nicholas Piggin wrote: > Michal Suchánek's on September 24, 2019 7:33 pm: > > Hello, > > > > can you mark the individual patches with RFC rather than the wole > > series? > > Hey, thanks for the reviews. I'll resend all but the last two patches >

Re: [PATCH v10 4/5] x86/kasan: support KASAN_VMALLOC

2019-10-30 Thread Daniel Axtens
Andrey Ryabinin writes: > On 10/29/19 7:20 AM, Daniel Axtens wrote: >> In the case where KASAN directly allocates memory to back vmalloc >> space, don't map the early shadow page over it. >> >> We prepopulate pgds/p4ds for the range that would otherwise be empty. >> This is required to get it sy

Re: [PATCH v10 4/5] x86/kasan: support KASAN_VMALLOC

2019-10-30 Thread Andrey Ryabinin
On 10/30/19 4:50 PM, Daniel Axtens wrote: > Andrey Ryabinin writes: > >> On 10/29/19 7:20 AM, Daniel Axtens wrote: >>> In the case where KASAN directly allocates memory to back vmalloc >>> space, don't map the early shadow page over it. >>> >>> We prepopulate pgds/p4ds for the range that would

Re: [PATCH v10 4/5] x86/kasan: support KASAN_VMALLOC

2019-10-30 Thread Daniel Axtens
Andrey Ryabinin writes: > On 10/30/19 4:50 PM, Daniel Axtens wrote: >> Andrey Ryabinin writes: >> >>> On 10/29/19 7:20 AM, Daniel Axtens wrote: In the case where KASAN directly allocates memory to back vmalloc space, don't map the early shadow page over it. We prepopulate pg

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

2019-10-30 Thread Uladzislau Rezki
Hello, Daniel > > @@ -1294,14 +1299,19 @@ static bool __purge_vmap_area_lazy(unsigned long > start, unsigned long end) > spin_lock(&free_vmap_area_lock); > llist_for_each_entry_safe(va, n_va, valist, purge_list) { > unsigned long nr = (va->va_end - va->va_start) >> PAG

Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic

2019-10-30 Thread Lakshmi Ramasubramanian
On 10/23/19 8:47 PM, Nayna Jain wrote: Hi Nayna, process_buffer_measurement() is limited to measuring the kexec boot command line. This patch makes process_buffer_measurement() more generic, allowing it to measure other types of buffer data (e.g. blacklisted binary hashes or key hashes). Now

Re: [PATCH v9 5/8] ima: make process_buffer_measurement() generic

2019-10-30 Thread Mimi Zohar
On Wed, 2019-10-30 at 08:22 -0700, Lakshmi Ramasubramanian wrote: > On 10/23/19 8:47 PM, Nayna Jain wrote: > > Hi Nayna, > > > process_buffer_measurement() is limited to measuring the kexec boot > > command line. This patch makes process_buffer_measurement() more > > generic, allowing it to measu

[PATCH 06/11] powerpc/powernv: Remove intermediate variable

2019-10-30 Thread Reza Arbab
Trim the pointless temporary variable. Signed-off-by: Reza Arbab --- arch/powerpc/platforms/powernv/pci-ioda.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c index b78b5e81f941..319152

[PATCH 04/11] powerpc/powernv/npu: Wire up pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Reza Arbab
Rework of pnv_pci_ioda_iommu_bypass_supported() dropped a call to pnv_npu_try_dma_set_bypass(). Reintroduce this call, so that the DMA bypass configuration of a GPU device is propagated to its corresponding NPU devices. Fixes: 2d6ad41b2c21 ("powerpc/powernv: use the generic iommu bypass code") Sig

[PATCH 05/11] powerpc/powernv: Return failure for some uses of dma_set_mask()

2019-10-30 Thread Reza Arbab
Rework of pnv_pci_ioda_dma_set_mask() effectively reverted commit 253fd51e2f53 ("powerpc/powernv/pci: Return failure for some uses of dma_set_mask()"). Reintroduce the desired behavior that an unfulfilled request for a DMA mask between 32 and 64 bits will return error instead of silently falling b

[PATCH 11/11] powerpc/powernv: Add pnv_pci_ioda_dma_set_mask()

2019-10-30 Thread Reza Arbab
Change pnv_pci_ioda_iommu_bypass_supported() to have no side effects, by separating the part of the function that determines if bypass is supported from the part that actually attempts to configure it. Move the latter to a controller-specific dma_set_mask() callback. Signed-off-by: Reza Arbab --

[PATCH 08/11] powerpc/powernv: Replace open coded pnv_ioda_get_pe()s

2019-10-30 Thread Reza Arbab
Collapse several open coded instances of pnv_ioda_get_pe(). Signed-off-by: Reza Arbab --- arch/powerpc/platforms/powernv/npu-dma.c | 22 +- arch/powerpc/platforms/powernv/pci-ioda.c | 10 +++--- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/arch/powerpc

[PATCH 01/11] Revert "powerpc/powernv: Remove unused pnv_npu_try_dma_set_bypass() function"

2019-10-30 Thread Reza Arbab
Revert commit b4d37a7b6934 ("powerpc/powernv: Remove unused pnv_npu_try_dma_set_bypass() function") so that this function can be reintegrated. Fixes: 2d6ad41b2c21 ("powerpc/powernv: use the generic iommu bypass code") Signed-off-by: Reza Arbab Cc: Christoph Hellwig --- arch/powerpc/platforms/po

[PATCH 07/11] powerpc/powernv/npu: Simplify pnv_npu_try_dma_set_bypass() loop

2019-10-30 Thread Reza Arbab
Write this loop more compactly to improve readability. Signed-off-by: Reza Arbab --- arch/powerpc/platforms/powernv/npu-dma.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/arch/powerpc/platforms/powernv/npu-dma.c b/arch/powerpc/platforms/powernv/npu-dma.c index a6

[PATCH 10/11] powerpc/powernv: Add pnv_phb3_iommu_bypass_supported()

2019-10-30 Thread Reza Arbab
Move this code to its own function for reuse. As a side benefit, rearrange the comments and spread things out for readability. Signed-off-by: Reza Arbab --- arch/powerpc/platforms/powernv/pci-ioda.c | 37 +-- 1 file changed, 25 insertions(+), 12 deletions(-) diff --g

[PATCH 02/11] powerpc/powernv: Add pnv_ioda_pe_iommu_bypass_supported()

2019-10-30 Thread Reza Arbab
This little calculation will be needed in other places. Move it to a convenience function. Signed-off-by: Reza Arbab --- arch/powerpc/platforms/powernv/pci-ioda.c | 8 +++- arch/powerpc/platforms/powernv/pci.h | 8 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a

[PATCH 09/11] Revert "powerpc/pci: remove the dma_set_mask pci_controller ops methods"

2019-10-30 Thread Reza Arbab
Bring back the pci controller based hook in dma_set_mask(), as it will have a user again. This reverts commit 662acad4067a ("powerpc/pci: remove the dma_set_mask pci_controller ops methods"). The callback signature has been adjusted with void return to fit its caller. Signed-off-by: Reza Arbab C

[PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Reza Arbab
With recent kernels, TCE tables for NPU devices are no longer being configured. That task was performed by pnv_npu_try_dma_set_bypass(), a function that got swept away in recent overhauling of dma code. Patches 1-4 here bring the lost function back and reintegrate it with the updated generic iommu

[PATCH 03/11] powerpc/powernv/npu: Change pnv_npu_try_dma_set_bypass() argument

2019-10-30 Thread Reza Arbab
To enable simpler calling code, change this function to find the value of bypass instead of taking it as an argument. Signed-off-by: Reza Arbab --- arch/powerpc/platforms/powernv/npu-dma.c | 12 +--- arch/powerpc/platforms/powernv/pci.h | 2 +- 2 files changed, 10 insertions(+), 4 d

Re: [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Christoph Hellwig
On Wed, Oct 30, 2019 at 11:59:49AM -0500, Reza Arbab wrote: > With recent kernels, TCE tables for NPU devices are no longer being > configured. That task was performed by pnv_npu_try_dma_set_bypass(), a > function that got swept away in recent overhauling of dma code. > > Patches 1-4 here bring th

Re: [PATCH 11/11] powerpc/powernv: Add pnv_pci_ioda_dma_set_mask()

2019-10-30 Thread Christoph Hellwig
On Wed, Oct 30, 2019 at 12:00:00PM -0500, Reza Arbab wrote: > Change pnv_pci_ioda_iommu_bypass_supported() to have no side effects, by > separating the part of the function that determines if bypass is > supported from the part that actually attempts to configure it. > > Move the latter to a contr

Re: [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Reza Arbab
On Wed, Oct 30, 2019 at 06:53:41PM +0100, Christoph Hellwig wrote: How do you even use this code? Nothing in the kernel even calls dma_set_mask for NPU devices, as we only suport vfio pass through. You use it by calling dma_set_mask() for the *GPU* device. The purpose of pnv_npu_try_dma_set_b

Re: [PATCH 11/11] powerpc/powernv: Add pnv_pci_ioda_dma_set_mask()

2019-10-30 Thread Reza Arbab
On Wed, Oct 30, 2019 at 06:55:18PM +0100, Christoph Hellwig wrote: On Wed, Oct 30, 2019 at 12:00:00PM -0500, Reza Arbab wrote: Change pnv_pci_ioda_iommu_bypass_supported() to have no side effects, by separating the part of the function that determines if bypass is supported from the part that ac

Re: [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Christoph Hellwig
On Wed, Oct 30, 2019 at 01:08:51PM -0500, Reza Arbab wrote: > On Wed, Oct 30, 2019 at 06:53:41PM +0100, Christoph Hellwig wrote: >> How do you even use this code? Nothing in the kernel even calls >> dma_set_mask for NPU devices, as we only suport vfio pass through. > > You use it by calling dma_se

Re: [PATCH v5 0/5] Implement STRICT_MODULE_RWX for powerpc

2019-10-30 Thread Kees Cook
On Wed, Oct 30, 2019 at 09:58:19AM +0100, Christophe Leroy wrote: > > > Le 30/10/2019 à 08:31, Russell Currey a écrit : > > v4 cover letter: > > https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198268.html > > v3 cover letter: > > https://lists.ozlabs.org/pipermail/linuxppc-dev/2019

Re: [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Reza Arbab
On Wed, Oct 30, 2019 at 07:13:59PM +0100, Christoph Hellwig wrote: On Wed, Oct 30, 2019 at 01:08:51PM -0500, Reza Arbab wrote: On Wed, Oct 30, 2019 at 06:53:41PM +0100, Christoph Hellwig wrote: How do you even use this code? Nothing in the kernel even calls dma_set_mask for NPU devices, as we

Re: [PATCH 00/11] powerpv/powernv: Restore pnv_npu_try_dma_set_bypass()

2019-10-30 Thread Christoph Hellwig
On Wed, Oct 30, 2019 at 01:32:01PM -0500, Reza Arbab wrote: > Aha, it's this again. Didn't catch your meaning at first. Point taken. It's not _me_. It that you (plural) keep ignoring how Linux development works.

Re: [PATCH v2] powerpc/imc: Dont create debugfs files for cpu-less nodes

2019-10-30 Thread Qian Cai
On Tue, 2019-07-23 at 16:57 +0530, Anju T Sudhakar wrote: > Hi Qian, > > On 7/16/19 12:11 AM, Qian Cai wrote: > > On Thu, 2019-07-11 at 14:53 +1000, Michael Ellerman wrote: > > > Hi Maddy, > > > > > > Madhavan Srinivasan writes: > > > > diff --git a/arch/powerpc/platforms/powernv/opal-imc.c > >

Re: [PATCH v4 0/4] Implement STRICT_MODULE_RWX for powerpc

2019-10-30 Thread Kees Cook
On Wed, Oct 30, 2019 at 11:16:22AM +1100, Michael Ellerman wrote: > Kees Cook writes: > > On Mon, Oct 14, 2019 at 04:13:16PM +1100, Russell Currey wrote: > >> v3 cover letter here: > >> https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198023.html > >> > >> Only minimal changes since t

Re: [PATCH v5 0/5] Implement STRICT_MODULE_RWX for powerpc

2019-10-30 Thread Christophe Leroy
Le 30/10/2019 à 19:30, Kees Cook a écrit : On Wed, Oct 30, 2019 at 09:58:19AM +0100, Christophe Leroy wrote: Le 30/10/2019 à 08:31, Russell Currey a écrit : v4 cover letter: https://lists.ozlabs.org/pipermail/linuxppc-dev/2019-October/198268.html v3 cover letter: https://lists.ozlabs.org

Section mismatch warnings on powerpc

2019-10-30 Thread Qian Cai
Still see those, WARNING: vmlinux.o(.text+0x2d04): Section mismatch in reference from the variable __boot_from_prom to the function .init.text:prom_init() The function __boot_from_prom() references the function __init prom_init(). This is often because __boot_from_prom lacks a __init annotation or

[PATCH 00/12] Convert cpu_up/down to device_online/offline

2019-10-30 Thread Qais Yousef
Using cpu_up/down directly to bring cpus online/offline loses synchronization with sysfs and could suffer from a race similar to what is described in commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and serialization during LPM"). cpu_up/down seem to be more of a internal implementation d

[PATCH 03/12] powerpc: Replace cpu_up/down with device_online/offline

2019-10-30 Thread Qais Yousef
The core device API performs extra housekeeping bits that are missing from directly calling cpu_up/down. See commit a6717c01ddc2 ("powerpc/rtas: use device model APIs and serialization during LPM") for an example description of what might go wrong. This also prepares to make cpu_up/down a private

Re: [PATCH RFC 1/5] dma/direct: turn ARCH_ZONE_DMA_BITS into a variable

2019-10-30 Thread Christoph Hellwig
On Mon, Oct 14, 2019 at 08:31:03PM +0200, Nicolas Saenz Julienne wrote: > Some architectures, notably ARM, are interested in tweaking this > depending on their runtime DMA addressing limitations. > > Signed-off-by: Nicolas Saenz Julienne Do you want me to pick this up for the 5.5 dma-mapping tre

Re: [PATCH v3 3/8] powerpc: Fix vDSO clock_getres()

2019-10-30 Thread Sasha Levin
Hi, [This is an automated email] This commit has been processed because it contains a "Fixes:" tag, fixing commit: a7f290dad32ee [PATCH] powerpc: Merge vdso's and add vdso support to 32 bits kernel. The bot has tested the following trees: v5.3.8, v4.19.81, v4.14.151, v4.9.198, v4.4.198. v5.3.

[PATCH 01/19] mm/gup: pass flags arg to __gup_device_* functions

2019-10-30 Thread John Hubbard
A subsequent patch requires access to gup flags, so pass the flags argument through to the __gup_device_* functions. Also placate checkpatch.pl by shortening a nearby line. Cc: Kirill A. Shutemov Signed-off-by: John Hubbard --- mm/gup.c | 28 ++-- 1 file changed, 18 ins

[PATCH 00/19] mm/gup: track dma-pinned pages: FOLL_PIN, FOLL_LONGTERM

2019-10-30 Thread John Hubbard
Hi, This applies cleanly to linux-next and mmotm, and also to linux.git if linux-next's commit 20cac10710c9 ("mm/gup_benchmark: fix MAP_HUGETLB case") is first applied there. This provides tracking of dma-pinned pages. This is a prerequisite to solving the larger problem of proper interactions be

[PATCH 02/19] mm/gup: factor out duplicate code from four routines

2019-10-30 Thread John Hubbard
There are four locations in gup.c that have a fair amount of code duplication. This means that changing one requires making the same changes in four places, not to mention reading the same code four times, and wondering if there are subtle differences. Factor out the common code into static functi

[PATCH 03/19] goldish_pipe: rename local pin_user_pages() routine

2019-10-30 Thread John Hubbard
1. Avoid naming conflicts: rename local static function from "pin_user_pages()" to "pin_goldfish_pages()". An upcoming patch will introduce a global pin_user_pages() function. Signed-off-by: John Hubbard --- drivers/platform/goldfish/goldfish_pipe.c | 18 +- 1 file changed, 9 in

[PATCH 04/19] media/v4l2-core: set pages dirty upon releasing DMA buffers

2019-10-30 Thread John Hubbard
After DMA is complete, and the device and CPU caches are synchronized, it's still required to mark the CPU pages as dirty, if the data was coming from the device. However, this driver was just issuing a bare put_page() call, without any set_page_dirty*() call. Fix the problem, by calling set_page_

[PATCH 06/19] goldish_pipe: convert to pin_user_pages() and put_user_page()

2019-10-30 Thread John Hubbard
1. Call the new global pin_user_pages_fast(), from pin_goldfish_pages(). 2. As required by pin_user_pages(), release these pages via put_user_page(). In this case, do so via put_user_pages_dirty_lock(). That has the side effect of calling set_page_dirty_lock(), instead of set_page_dirty(). This i

[PATCH 07/19] infiniband: set FOLL_PIN, FOLL_LONGTERM via pin_longterm_pages*()

2019-10-30 Thread John Hubbard
Convert infiniband to use the new wrapper calls, and stop explicitly setting FOLL_LONGTERM at the call sites. The new pin_longterm_*() calls replace get_user_pages*() calls, and set both FOLL_LONGTERM and a new FOLL_PIN flag. The FOLL_PIN flag requires that the caller must return the pages via put

[PATCH 05/19] mm/gup: introduce pin_user_pages*() and FOLL_PIN

2019-10-30 Thread John Hubbard
Introduce pin_user_pages*() variations of get_user_pages*() calls, and also pin_longterm_pages*() variations. These variants all set FOLL_PIN, which is also introduced, and basically documented. (An upcoming patch provides more extensive documentation.) The second set (pin_longterm*) also sets FOL

[PATCH 08/19] mm/process_vm_access: set FOLL_PIN via pin_user_pages_remote()

2019-10-30 Thread John Hubbard
Convert process_vm_access to use the new pin_user_pages_remote() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages. Also, release the pages via put_user_page*(). Also, rename "pages" to "pinned_pages", as this makes for easier reading of p

[PATCH 10/19] fs/io_uring: set FOLL_PIN via pin_user_pages()

2019-10-30 Thread John Hubbard
Convert fs/io_uring to use the new pin_user_pages() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages, and therefore for any code that calls put_user_page(). Signed-off-by: John Hubbard --- fs/io_uring.c | 5 ++--- 1 file changed, 2 inser

[PATCH 09/19] drm/via: set FOLL_PIN via pin_user_pages_fast()

2019-10-30 Thread John Hubbard
Convert drm/via to use the new pin_user_pages_fast() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages, and therefore for any code that calls put_user_page(). Signed-off-by: John Hubbard --- drivers/gpu/drm/via/via_dmablit.c | 2 +- 1 fil

[PATCH 11/19] net/xdp: set FOLL_PIN via pin_user_pages()

2019-10-30 Thread John Hubbard
Convert net/xdp to use the new pin_longterm_pages() call, which sets FOLL_PIN. Setting FOLL_PIN is now required for code that requires tracking of pinned pages. Signed-off-by: John Hubbard --- net/xdp/xdp_umem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/xdp/xdp_

[PATCH 12/19] mm/gup: track FOLL_PIN pages

2019-10-30 Thread John Hubbard
Add tracking of pages that were pinned via FOLL_PIN. As mentioned in the FOLL_PIN documentation, callers who effectively set FOLL_PIN are required to ultimately free such pages via put_user_page(). The effect is similar to FOLL_GET, and may be thought of as "FOLL_GET for DIO and/or RDMA use". Pag

[PATCH 13/19] media/v4l2-core: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-10-30 Thread John Hubbard
1. Change v4l2 from get_user_pages(FOLL_LONGTERM), to pin_longterm_pages(), which sets both FOLL_LONGTERM and FOLL_PIN. 2. Because all FOLL_PIN-acquired pages must be released via put_user_page(), also convert the put_page() call over to put_user_pages_dirty_lock(). Cc: Mauro Carvalho Chehab Sig

[PATCH 14/19] vfio, mm: pin_longterm_pages (FOLL_PIN) and put_user_page() conversion

2019-10-30 Thread John Hubbard
This also fixes one or two likely bugs. 1. Change vfio from get_user_pages(FOLL_LONGTERM), to pin_longterm_pages(), which sets both FOLL_LONGTERM and FOLL_PIN. Note that this is a change in behavior, because the get_user_pages_remote() call was not setting FOLL_LONGTERM, but the new pin_user_page

[PATCH 18/19] mm/gup: remove support for gup(FOLL_LONGTERM)

2019-10-30 Thread John Hubbard
Now that all other kernel callers of get_user_pages(FOLL_LONGTERM) have been converted to pin_longterm_pages(), lock it down: 1) Add an assertion to get_user_pages(), preventing callers from passing FOLL_LONGTERM (in addition to the existing assertion that prevents FOLL_PIN). 2) Remove the

[PATCH 16/19] mm/gup_benchmark: support pin_user_pages() and related calls

2019-10-30 Thread John Hubbard
Up until now, gup_benchmark supported testing of the following kernel functions: * get_user_pages(): via the '-U' command line option * get_user_pages_longterm(): via the '-L' command line option * get_user_pages_fast(): as the default (no options required) Add test coverage for the new correspon

[PATCH 15/19] powerpc: book3s64: convert to pin_longterm_pages() and put_user_page()

2019-10-30 Thread John Hubbard
1. Convert from get_user_pages(FOLL_LONGTERM) to pin_longterm_pages(). 2. As required by pin_user_pages(), release these pages via put_user_page(). In this case, do so via put_user_pages_dirty_lock(). That has the side effect of calling set_page_dirty_lock(), instead of set_page_dirty(). This is

[PATCH 19/19] Documentation/vm: add pin_user_pages.rst

2019-10-30 Thread John Hubbard
Document the new pin_user_pages() and related calls and behavior. Thanks to Jan Kara and Vlastimil Babka for explaining the 4 cases in this documentation. (I've reworded it and expanded on it slightly.) Cc: Jonathan Corbet Signed-off-by: John Hubbard --- Documentation/vm/index.rst |

  1   2   >