[PATCH -next] ASoC: imx-rpmsg: fix platform_no_drv_owner.cocci warnings

2021-05-27 Thread Zou Wei
./sound/soc/fsl/imx-rpmsg.c:140:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.cocci Reported-by: Hulk Robot Signed-off-by: Zou Wei --- sound/soc/fsl/imx-rpmsg.

Re: [PATCH] powerpc/udbg_hvc: retry putc on -EAGAIN

2021-05-27 Thread Greg KH
On Sun, May 23, 2021 at 08:51:09PM +1000, Michael Ellerman wrote: > Greg KH writes: > > On Fri, May 14, 2021 at 04:44:22PM -0500, Nathan Lynch wrote: > >> hvterm_raw_put_chars() calls hvc_put_chars(), which may return -EAGAIN > >> when the underlying hcall returns a "busy" status, but udbg_hvc_put

[PATCH v2] powerpc/papr_scm: Add support for reporting dirty-shutdown-count

2021-05-27 Thread Vaibhav Jain
Persistent memory devices like NVDIMMs can loose cached writes in case something prevents flush on power-fail. Such situations are termed as dirty shutdown and are exposed to applications as last-shutdown-state (LSS) flag and a dirty-shutdown-counter(DSC) as described at [1]. The latter being usefu

Re: [PATCH] powerpc/papr_scm: Add support for reporting dirty-shutdown-count

2021-05-27 Thread Vaibhav Jain
Thanks for catching this Santosh. Have fixed this in v2 version of this patch -- Cheers ~ Vaibhav Santosh Sivaraj writes: > Hi Vaibhav, > > Vaibhav Jain writes: > >> Persistent memory devices like NVDIMMs can loose cached writes in case >> something prevents flush on power-fail. Such situati

Re: [PATCH v7 14/15] dt-bindings: of: Add restricted DMA pool

2021-05-27 Thread Will Deacon
On Thu, May 27, 2021 at 07:29:20PM +0800, Claire Chang wrote: > On Wed, May 26, 2021 at 11:53 PM Will Deacon wrote: > > > > On Wed, May 26, 2021 at 01:13:22PM +0100, Will Deacon wrote: > > > On Tue, May 18, 2021 at 02:42:14PM +0800, Claire Chang wrote: > > > > @@ -138,4 +160,9 @@ one for multimedi

Re: [PATCH v7 14/15] dt-bindings: of: Add restricted DMA pool

2021-05-27 Thread Claire Chang
On Wed, May 26, 2021 at 11:53 PM Will Deacon wrote: > > On Wed, May 26, 2021 at 01:13:22PM +0100, Will Deacon wrote: > > On Tue, May 18, 2021 at 02:42:14PM +0800, Claire Chang wrote: > > > @@ -138,4 +160,9 @@ one for multimedia processing (named > > > multimedia-memory@7700, 64MiB). > > >

Re: [PATCH v7 14/15] dt-bindings: of: Add restricted DMA pool

2021-05-27 Thread Claire Chang
On Thu, May 27, 2021 at 7:35 PM Will Deacon wrote: > > On Thu, May 27, 2021 at 07:29:20PM +0800, Claire Chang wrote: > > On Wed, May 26, 2021 at 11:53 PM Will Deacon wrote: > > > > > > On Wed, May 26, 2021 at 01:13:22PM +0100, Will Deacon wrote: > > > > On Tue, May 18, 2021 at 02:42:14PM +0800, C

Re: [PATCH v7 14/15] dt-bindings: of: Add restricted DMA pool

2021-05-27 Thread Will Deacon
On Thu, May 27, 2021 at 08:48:59PM +0800, Claire Chang wrote: > On Thu, May 27, 2021 at 7:35 PM Will Deacon wrote: > > > > On Thu, May 27, 2021 at 07:29:20PM +0800, Claire Chang wrote: > > > On Wed, May 26, 2021 at 11:53 PM Will Deacon wrote: > > > > > > > > On Wed, May 26, 2021 at 01:13:22PM +01

[PATCH v8 00/15] Restricted DMA

2021-05-27 Thread Claire Chang
This series implements mitigations for lack of DMA access control on systems without an IOMMU, which could result in the DMA accessing the system memory at unexpected times and/or unexpected addresses, possibly leading to data leakage or corruption. For example, we plan to use the PCI-e bus for Wi

[PATCH v8 01/15] swiotlb: Refactor swiotlb init functions

2021-05-27 Thread Claire Chang
Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct initialization to make the code reusable. Note that we now also call set_memory_decrypted in swiotlb_init_with_tbl. Signed-off-by: Claire Chang --- kernel/dma/swiotlb.c | 51 ++-- 1 fi

[PATCH v8 02/15] swiotlb: Refactor swiotlb_create_debugfs

2021-05-27 Thread Claire Chang
Split the debugfs creation to make the code reusable for supporting different bounce buffer pools, e.g. restricted DMA pool. Signed-off-by: Claire Chang --- kernel/dma/swiotlb.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/kernel/dma/swiotlb.c b/

[PATCH v8 03/15] swiotlb: Add DMA_RESTRICTED_POOL

2021-05-27 Thread Claire Chang
Add a new kconfig symbol, DMA_RESTRICTED_POOL, for restricted DMA pool. Signed-off-by: Claire Chang --- kernel/dma/Kconfig | 14 ++ 1 file changed, 14 insertions(+) diff --git a/kernel/dma/Kconfig b/kernel/dma/Kconfig index 77b405508743..3e961dc39634 100644 --- a/kernel/dma/Kconfig

[PATCH v8 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-27 Thread Claire Chang
Add the initialization function to create restricted DMA pools from matching reserved-memory nodes. Signed-off-by: Claire Chang --- include/linux/device.h | 4 +++ include/linux/swiotlb.h | 3 +- kernel/dma/swiotlb.c| 76 + 3 files changed, 82 inser

[PATCH v8 05/15] swiotlb: Add a new get_io_tlb_mem getter

2021-05-27 Thread Claire Chang
Add a new getter, get_io_tlb_mem, to help select the io_tlb_mem struct. The restricted DMA pool is preferred if available. The reason it was done this way instead of assigning the active pool to dev->dma_io_tlb_mem was because directly using dev->dma_io_tlb_mem might cause memory allocation issues

[PATCH v8 06/15] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-05-27 Thread Claire Chang
Update is_swiotlb_buffer to add a struct device argument. This will be useful later to allow for restricted DMA pool. Signed-off-by: Claire Chang --- drivers/iommu/dma-iommu.c | 12 ++-- drivers/xen/swiotlb-xen.c | 2 +- include/linux/swiotlb.h | 6 +++--- kernel/dma/direct.c |

[PATCH v8 07/15] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-05-27 Thread Claire Chang
Update is_swiotlb_active to add a struct device argument. This will be useful later to allow for restricted DMA pool. Signed-off-by: Claire Chang --- drivers/gpu/drm/i915/gem/i915_gem_internal.c | 2 +- drivers/gpu/drm/nouveau/nouveau_ttm.c| 2 +- drivers/pci/xen-pcifront.c

[PATCH v8 08/15] swiotlb: Bounce data from/to restricted DMA pool if available

2021-05-27 Thread Claire Chang
Regardless of swiotlb setting, the restricted DMA pool is preferred if available. The restricted DMA pools provide a basic level of protection against the DMA overwriting buffer contents at unexpected times. However, to protect against general data leakage and system memory corruption, the system

[PATCH v8 09/15] swiotlb: Move alloc_size to find_slots

2021-05-27 Thread Claire Chang
Move the maintenance of alloc_size to find_slots for better code reusability later. Signed-off-by: Claire Chang --- kernel/dma/swiotlb.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index fa7f23fffc81..88b3471ac6a8 100

[PATCH v8 10/15] swiotlb: Refactor swiotlb_tbl_unmap_single

2021-05-27 Thread Claire Chang
Add a new function, release_slots, to make the code reusable for supporting different bounce buffer pools, e.g. restricted DMA pool. Signed-off-by: Claire Chang --- kernel/dma/swiotlb.c | 35 --- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/kern

Re: [PATCH v7 00/15] Restricted DMA

2021-05-27 Thread Claire Chang
v8 here: https://lore.kernel.org/patchwork/cover/1437112/

Re: [PATCH v7 01/15] swiotlb: Refactor swiotlb init functions

2021-05-27 Thread Christoph Hellwig
On Wed, May 19, 2021 at 11:50:07AM -0700, Florian Fainelli wrote: > You convert this call site with swiotlb_init_io_tlb_mem() which did not > do the set_memory_decrypted()+memset(). Is this okay or should > swiotlb_init_io_tlb_mem() add an additional argument to do this > conditionally? The zeroin

[PATCH v8 11/15] dma-direct: Add a new wrapper __dma_direct_free_pages()

2021-05-27 Thread Claire Chang
Add a new wrapper __dma_direct_free_pages() that will be useful later for swiotlb_free(). Signed-off-by: Claire Chang --- kernel/dma/direct.c | 14 ++ 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/kernel/dma/direct.c b/kernel/dma/direct.c index 078f7087e466..eb409832

[PATCH v8 12/15] swiotlb: Add restricted DMA alloc/free support.

2021-05-27 Thread Claire Chang
Add the functions, swiotlb_{alloc,free} to support the memory allocation from restricted DMA pool. Signed-off-by: Claire Chang --- include/linux/swiotlb.h | 4 kernel/dma/swiotlb.c| 35 +-- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/

[PATCH v8 13/15] dma-direct: Allocate memory from restricted DMA pool if available

2021-05-27 Thread Claire Chang
The restricted DMA pool is preferred if available. The restricted DMA pools provide a basic level of protection against the DMA overwriting buffer contents at unexpected times. However, to protect against general data leakage and system memory corruption, the system needs to provide a way to lock

[PATCH v8 15/15] of: Add plumbing for restricted DMA pool

2021-05-27 Thread Claire Chang
If a device is not behind an IOMMU, we look up the device node and set up the restricted DMA when the restricted-dma-pool is presented. Signed-off-by: Claire Chang --- drivers/of/address.c| 33 + drivers/of/device.c | 3 +++ drivers/of/of_private.h | 6 +

[PATCH v8 14/15] dt-bindings: of: Add restricted DMA pool

2021-05-27 Thread Claire Chang
Introduce the new compatible string, restricted-dma-pool, for restricted DMA. One can specify the address and length of the restricted DMA memory region by restricted-dma-pool in the reserved-memory node. Signed-off-by: Claire Chang --- .../reserved-memory/reserved-memory.txt | 36

Re: [PATCH v7 02/15] swiotlb: Refactor swiotlb_create_debugfs

2021-05-27 Thread Christoph Hellwig
On Tue, May 18, 2021 at 02:42:02PM +0800, Claire Chang wrote: > struct io_tlb_mem *io_tlb_default_mem; > +static struct dentry *debugfs_dir; > > /* > * Max segment that we can provide which (if pages are contingous) will > @@ -662,18 +663,30 @@ EXPORT_SYMBOL_GPL(is_swiotlb_active); > > #if

Re: [PATCH v7 03/15] swiotlb: Add DMA_RESTRICTED_POOL

2021-05-27 Thread Christoph Hellwig
On Tue, May 18, 2021 at 02:42:03PM +0800, Claire Chang wrote: > Add a new kconfig symbol, DMA_RESTRICTED_POOL, for restricted DMA pool. Please merge this with the actual code that is getting added.

Re: [PATCH v7 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-27 Thread Christoph Hellwig
On Mon, May 24, 2021 at 11:49:34AM -0400, Konrad Rzeszutek Wilk wrote: > rmem_swiotlb_setup > > ? > > Which is ARM specific and inside the generic code? I don't think it is arm specific at all. It is OF specific, but just about every platform but x86 uses OF. And I can think of an ACPI version

Re: [PATCH v7 04/15] swiotlb: Add restricted DMA pool initialization

2021-05-27 Thread Christoph Hellwig
I'd still much prefer to always have the pointer in struct device. Especially as we're also looking into things like a global 64-bit bounce buffer. Something like this untested patch ontop of your series: diff --git a/drivers/base/core.c b/drivers/base/core.c index 628e33939aca..3cb95fa29f70 100

Re: [PATCH v7 07/15] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-05-27 Thread Christoph Hellwig
> + if (is_swiotlb_active(NULL)) { Passing a NULL argument to this doesn't make sense. They all should have a struct device at hand, you'll just need to dig for it. And this function should be about to go away anyway, but until then we need to do this properly.

Re: [PATCH v7 13/15] dma-direct: Allocate memory from restricted DMA pool if available

2021-05-27 Thread Christoph Hellwig
> +#ifdef CONFIG_DMA_RESTRICTED_POOL > + if (swiotlb_free(dev, page, size)) > + return; > +#endif Please avoid the ifdefs by either stubbing out the function to be a no-op or by using IS_ENABLED. > +#ifdef CONFIG_DMA_RESTRICTED_POOL > + page = swiotlb_alloc(dev, size); > +

Re: [PATCH v8 00/15] Restricted DMA

2021-05-27 Thread Christoph Hellwig
I just finished reviewing v7, sorry. Let me find some time to see what difference this version makes.

RE: [PATCH -next 2/3] xen: balloon: Replaced simple_strtoull() with kstrtoull()

2021-05-27 Thread David Laight
From: Chen Huang > Sent: 26 May 2021 10:20 > > The simple_strtoull() function is deprecated in some situation, since > it does not check for the range overflow, use kstrtoull() instead. > ... > - target_bytes = simple_strtoull(buf, &endchar, 0) * 1024; > + ret = kstrtoull(buf, 0, &target_

Re: [PATCH v2] lockdown,selinux: avoid bogus SELinux lockdown permission checks

2021-05-27 Thread Paul Moore
On Thu, May 27, 2021 at 12:33 AM James Morris wrote: > On Wed, 26 May 2021, Ondrej Mosnacek wrote: > > > Thanks, Michael! > > > > James/Paul, is there anything blocking this patch from being merged? > > Especially the BPF case is causing real trouble for people and the > > only workaround is to br

Re: [PATCH] mm: generalize ZONE_[DMA|DMA32]

2021-05-27 Thread Geert Uytterhoeven
On Thu, May 27, 2021 at 4:21 PM Kefeng Wang wrote: > ZONE_[DMA|DMA32] configs have duplicate definitions on platforms > that subscribe them. Instead, just make them generic options which > can be selected on applicable platforms. > > Also only x86/arm64 architectures could enable both ZONE_DMA and

[PATCH] mm: generalize ZONE_[DMA|DMA32]

2021-05-27 Thread Kefeng Wang
ZONE_[DMA|DMA32] configs have duplicate definitions on platforms that subscribe them. Instead, just make them generic options which can be selected on applicable platforms. Also only x86/arm64 architectures could enable both ZONE_DMA and ZONE_DMA32 if EXPERT, add ARCH_HAS_ZONE_DMA_SET to make dma

Re: [PATCH v7 01/15] swiotlb: Refactor swiotlb init functions

2021-05-27 Thread Tom Lendacky
On 5/27/21 8:02 AM, Christoph Hellwig wrote: > On Wed, May 19, 2021 at 11:50:07AM -0700, Florian Fainelli wrote: >> You convert this call site with swiotlb_init_io_tlb_mem() which did not >> do the set_memory_decrypted()+memset(). Is this okay or should >> swiotlb_init_io_tlb_mem() add an additiona

Re: [PATCH] mm: generalize ZONE_[DMA|DMA32]

2021-05-27 Thread Mike Rapoport
On Thu, May 27, 2021 at 10:30:47PM +0800, Kefeng Wang wrote: > ZONE_[DMA|DMA32] configs have duplicate definitions on platforms > that subscribe them. Instead, just make them generic options which > can be selected on applicable platforms. > > Also only x86/arm64 architectures could enable both ZO

Re: [PATCH -next 2/3] xen: balloon: Replaced simple_strtoull() with kstrtoull()

2021-05-27 Thread Dan Carpenter
On Thu, May 27, 2021 at 02:10:21PM +, David Laight wrote: > From: Chen Huang > > Sent: 26 May 2021 10:20 > > > > The simple_strtoull() function is deprecated in some situation, since > > it does not check for the range overflow, use kstrtoull() instead. > > > ... > > - target_bytes = simple

Re: [PATCH] docs: kernel-parameters: mark numa=off is supported by a bundle of architectures

2021-05-27 Thread Jonathan Corbet
Barry Song writes: > risc-v and arm64 support numa=off by common arch_numa_init() > in drivers/base/arch_numa.c. x86, ppc, mips, sparc support it > by arch-level early_param. > numa=off is widely used in linux distributions. it is better > to document it. > > Signed-off-by: Barry Song > --- > D

Re: [PATCH v7 01/15] swiotlb: Refactor swiotlb init functions

2021-05-27 Thread Tom Lendacky
On 5/27/21 9:41 AM, Tom Lendacky wrote: > On 5/27/21 8:02 AM, Christoph Hellwig wrote: >> On Wed, May 19, 2021 at 11:50:07AM -0700, Florian Fainelli wrote: >>> You convert this call site with swiotlb_init_io_tlb_mem() which did not >>> do the set_memory_decrypted()+memset(). Is this okay or should

Re: [PATCH] mm: generalize ZONE_[DMA|DMA32]

2021-05-27 Thread kernel test robot
-20210527] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Kefeng-Wang/mm-generalize-ZONE_-DMA-DMA32/20210

Re: [PATCH] mm: generalize ZONE_[DMA|DMA32]

2021-05-27 Thread Catalin Marinas
On Thu, May 27, 2021 at 10:30:47PM +0800, Kefeng Wang wrote: > ZONE_[DMA|DMA32] configs have duplicate definitions on platforms > that subscribe them. Instead, just make them generic options which > can be selected on applicable platforms. > > Also only x86/arm64 architectures could enable both ZO

Re: [PATCH v3 0/4] P2040/P2041 i2c recovery erratum

2021-05-27 Thread Wolfram Sang
On Wed, May 26, 2021 at 11:02:45AM +1000, Michael Ellerman wrote: > Wolfram Sang writes: > > On Wed, May 12, 2021 at 09:20:48AM +1200, Chris Packham wrote: > >> The P2040/P2041 has an erratum where the i2c recovery scheme > >> documented in the reference manual (and currently implemented > >> in t

[PATCH] ASoC: fsl-asoc-card: Set .owner attribute when registering card.

2021-05-27 Thread Nicolas Cavallari
Otherwise, when compiled as module, a WARN_ON is triggered: WARNING: CPU: 0 PID: 5 at sound/core/init.c:208 snd_card_new+0x310/0x39c [snd] [...] CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.10.39 #1 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Workqueue: events deferred_probe_work_f

Re: [PATCH v2] lockdown,selinux: avoid bogus SELinux lockdown permission checks

2021-05-27 Thread Paul Moore
On Mon, May 17, 2021 at 5:22 AM Ondrej Mosnacek wrote: > > Commit 59438b46471a ("security,lockdown,selinux: implement SELinux > lockdown") added an implementation of the locked_down LSM hook to > SELinux, with the aim to restrict which domains are allowed to perform > operations that would breach

[PATCH] Revert "powerpc: Switch to relative jump labels"

2021-05-27 Thread Roman Bolshakov
This reverts commit b0b3b2c78ec075cec4721986a95abbbac8c3da4f. Otherwise, direct kernel boot with initramfs no longer works in QEMU. It's broken in some bizarre way because a valid initramfs is not recognized anymore: Found initrd at 0xc1f7:0xc3d61d64 rootfs image is not in

Re: [PATCH 1/3] sched/topology: Allow archs to populate distance map

2021-05-27 Thread Srikar Dronamraju
* Valentin Schneider [2021-05-25 11:21:02]: > On 24/05/21 21:48, Srikar Dronamraju wrote: > > * Valentin Schneider [2021-05-24 15:16:09]: > >> Ok so from your arch you can figure out the *size* of the set of unique > >> distances, but not the individual node_distance(a, b)... That's quite > >> u