Re: [PATCH v13 00/12] Restricted DMA

2021-06-18 Thread Claire Chang
v14: https://lore.kernel.org/patchwork/cover/1448954/

[PATCH v14 12/12] of: Add plumbing for restricted DMA pool

2021-06-18 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 Tested-by: Stefano Stabellini Tested-by: Will Deacon --- drivers/of/address.c| 33 +

[PATCH v14 11/12] dt-bindings: of: Add restricted DMA pool

2021-06-18 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 Tested-by: Stefano Stabellini Tested-by: Will Deacon ---

[PATCH v14 10/12] swiotlb: Add restricted DMA pool initialization

2021-06-18 Thread Claire Chang
Add the initialization function to create restricted DMA pools from matching reserved-memory nodes. 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

[PATCH v14 09/12] swiotlb: Add restricted DMA alloc/free support

2021-06-18 Thread Claire Chang
Add the functions, swiotlb_{alloc,free} and is_swiotlb_for_alloc to support the memory allocation from restricted DMA pool. The restricted DMA pool is preferred if available. Note that since coherent allocation needs remapping, one must set up another device coherent pool by shared-dma-pool and

[PATCH v14 08/12] swiotlb: Refactor swiotlb_tbl_unmap_single

2021-06-18 Thread Claire Chang
Add a new function, swiotlb_release_slots, to make the code reusable for supporting different bounce buffer pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon --- kernel/dma/swiotlb.c | 35 ---

[PATCH v14 07/12] swiotlb: Move alloc_size to swiotlb_find_slots

2021-06-18 Thread Claire Chang
Rename find_slots to swiotlb_find_slots and move the maintenance of alloc_size to it for better code reusability later. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon --- kernel/dma/swiotlb.c | 16 1 file

[PATCH v14 06/12] swiotlb: Use is_swiotlb_force_bounce for swiotlb data bouncing

2021-06-18 Thread Claire Chang
Propagate the swiotlb_force into io_tlb_default_mem->force_bounce and use it to determine whether to bounce the data or not. This will be useful later to allow for different pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon

[PATCH v14 05/12] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-06-18 Thread Claire Chang
Update is_swiotlb_active to add a struct device argument. This will be useful later to allow for different pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon Acked-by: Stefano Stabellini ---

[PATCH v14 04/12] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-06-18 Thread Claire Chang
Update is_swiotlb_buffer to add a struct device argument. This will be useful later to allow for different pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon Acked-by: Stefano Stabellini --- drivers/iommu/dma-iommu.c | 12

[PATCH v14 03/12] swiotlb: Set dev->dma_io_tlb_mem to the swiotlb pool used

2021-06-18 Thread Claire Chang
Always have the pointer to the swiotlb pool used in struct device. This could help simplify the code for other pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon Acked-by: Stefano Stabellini --- drivers/base/core.c| 4

[PATCH v14 02/12] swiotlb: Refactor swiotlb_create_debugfs

2021-06-18 Thread Claire Chang
Split the debugfs creation to make the code reusable for supporting different bounce buffer pools. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon --- kernel/dma/swiotlb.c | 21 ++--- 1 file changed, 14

[PATCH v14 01/12] swiotlb: Refactor swiotlb init functions

2021-06-18 Thread Claire Chang
Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct initialization to make the code reusable. Signed-off-by: Claire Chang Reviewed-by: Christoph Hellwig Tested-by: Stefano Stabellini Tested-by: Will Deacon --- kernel/dma/swiotlb.c | 50

[PATCH v14 00/12] Restricted DMA

2021-06-18 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

Re: [PATCH v6 13/17] powerpc/pseries/vas: Setup IRQ and fault handling

2021-06-18 Thread Nicholas Piggin
Excerpts from Haren Myneni's message of June 18, 2021 12:09 pm: > On Fri, 2021-06-18 at 09:34 +1000, Nicholas Piggin wrote: >> Excerpts from Haren Myneni's message of June 18, 2021 6:37 am: >> > NX generates an interrupt when sees a fault on the user space >> > buffer and the hypervisor forwards

Re: [PATCH v6 12/17] powerpc/pseries/vas: Integrate API with open/close windows

2021-06-18 Thread Nicholas Piggin
Excerpts from Haren Myneni's message of June 18, 2021 5:49 pm: > On Fri, 2021-06-18 at 09:22 +1000, Nicholas Piggin wrote: >> Excerpts from Haren Myneni's message of June 18, 2021 6:36 am: >> > This patch adds VAS window allocatioa/close with the corresponding >> > hcalls. Also changes to

Re: [PATCH v2 9/9] powerpc/boot: Add a boot wrapper for Microwatt

2021-06-18 Thread Nicholas Piggin
Excerpts from Paul Mackerras's message of June 18, 2021 1:49 pm: > From: Joel Stanley > > This allows microwatt's kernel to be built with an embedded device tree. > > Load to arch/powerpc/boot/dtbImage.microwatt to 0x50: > > mw_debug -b fpga stop load arch/powerpc/boot/dtbImage.microwatt

Re: [PATCH v2 8/9] powerpc/boot: Fixup device-tree on little endian

2021-06-18 Thread Nicholas Piggin
Excerpts from Paul Mackerras's message of June 18, 2021 1:49 pm: > From: Benjamin Herrenschmidt > > This fixes the core devtree.c functions and the ns16550 UART backend. Looks okay. Can sparse be run on arch/powerpc/boot? Would be nice to get that working and endian annotations at some point.

Re: [PATCH v2 6/9] powerpc/microwatt: Add support for hardware random number generator

2021-06-18 Thread Nicholas Piggin
Excerpts from Paul Mackerras's message of June 18, 2021 1:47 pm: > Microwatt's hardware RNG is accessed using the DARN instruction. > I think we're getting a platforms/book3s soon with the VAS patches, might be a place to add the get_random_darn function. Huh, DARN is unprivileged right? And

Re: [PATCH v2 1/9] powerpc: Add Microwatt platform

2021-06-18 Thread Nicholas Piggin
Excerpts from Paul Mackerras's message of June 18, 2021 1:43 pm: > Microwatt is a FPGA-based implementation of the Power ISA. It > currently only implements little-endian 64-bit mode, and does > not (yet) support SMP, VMX, VSX or transactional memory. It has an > optional FPU, and an optional

Re: [PATCH v2 5/9] powerpc/microwatt: Use standard 16550 UART for console

2021-06-18 Thread Nicholas Piggin
Excerpts from Paul Mackerras's message of June 18, 2021 10:12 pm: > On Fri, Jun 18, 2021 at 05:40:40PM +1000, Nicholas Piggin wrote: >> Excerpts from Paul Mackerras's message of June 18, 2021 1:46 pm: >> > From: Benjamin Herrenschmidt >> > >> > This adds support to the Microwatt platform to use

Re: linux-next: manual merge of the akpm-current tree with the powerpc tree

2021-06-18 Thread Nicholas Piggin
Excerpts from Stephen Rothwell's message of June 18, 2021 7:44 pm: > Hi all, > > Today's linux-next merge of the akpm-current tree got a conflict in: > > arch/powerpc/kernel/smp.c > > between commit: > > 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C") > > from the powerpc tree

Re: [PATCH] crypto: nx: Fix memcpy() over-reading in nonce

2021-06-18 Thread Kees Cook
On Thu, Jun 17, 2021 at 04:08:15PM +1000, Michael Ellerman wrote: > Kees Cook writes: > > Fix typo in memcpy() where size should be CTR_RFC3686_NONCE_SIZE. > > > > Fixes: 030f4e968741 ("crypto: nx - Fix reentrancy bugs") > > Cc: sta...@vger.kernel.org > > Signed-off-by: Kees Cook > > Thanks. >

[Bug 213079] [bisected] IRQ problems and crashes on a PowerMac G5 with 5.12.3

2021-06-18 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=213079 --- Comment #11 from Erhard F. (erhar...@mailbox.org) --- Created attachment 297473 --> https://bugzilla.kernel.org/attachment.cgi?id=297473=edit dmesg (5.13-rc6 + DEBUG_VM_PGTABLE, PowerMac G5 11,2) The trace got some additional data with

[Bug 213069] kernel BUG at arch/powerpc/include/asm/book3s/64/hash-4k.h:147! Oops: Exception in kernel mode, sig: 5 [#1]

2021-06-18 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=213069 Erhard F. (erhar...@mailbox.org) changed: What|Removed |Added Status|REOPENED|RESOLVED

Re: [PATCH v4 07/11] powerpc/pseries/iommu: Reorganize iommu_table_setparms*() with new helper

2021-06-18 Thread Leonardo Brás
Hello Alexey, thanks for this feedback! On Mon, 2021-05-10 at 17:34 +1000, Alexey Kardashevskiy wrote: > > > This does not apply anymore as it conflicts with my 4be518d838809e2135. ok, rebasing on top of torvalds/master > > > > --- > >   arch/powerpc/platforms/pseries/iommu.c | 100

Re: [PATCH v3] lockdown,selinux: fix wrong subject in some SELinux lockdown checks

2021-06-18 Thread Dan Williams
On Wed, Jun 16, 2021 at 1:51 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

Re: [PATCH 1/1] powerpc/pseries: Interface to represent PAPR firmware attributes

2021-06-18 Thread Fabiano Rosas
"Pratik R. Sampat" writes: > Adds a generic interface to represent the energy and frequency related > PAPR attributes on the system using the new H_CALL > "H_GET_ENERGY_SCALE_INFO". > > H_GET_EM_PARMS H_CALL was previously responsible for exporting this > information in the lparcfg, however the

Re: [PATCH 8/8] membarrier: Rewrite sync_core_before_usermode() and improve documentation

2021-06-18 Thread Mathieu Desnoyers
- On Jun 18, 2021, at 3:58 PM, Andy Lutomirski l...@kernel.org wrote: > On Fri, Jun 18, 2021, at 9:31 AM, Mathieu Desnoyers wrote: >> - On Jun 17, 2021, at 8:12 PM, Andy Lutomirski l...@kernel.org wrote: >> >> > On 6/17/21 7:47 AM, Mathieu Desnoyers wrote: >> > >> >> Please change back

Re: [PATCH 8/8] membarrier: Rewrite sync_core_before_usermode() and improve documentation

2021-06-18 Thread Andy Lutomirski
On Fri, Jun 18, 2021, at 9:31 AM, Mathieu Desnoyers wrote: > - On Jun 17, 2021, at 8:12 PM, Andy Lutomirski l...@kernel.org wrote: > > > On 6/17/21 7:47 AM, Mathieu Desnoyers wrote: > > > >> Please change back this #ifndef / #else / #endif within function for > >> > >> if

Re: [PATCH 01/18] mm: add a kunmap_local_dirty helper

2021-06-18 Thread Ira Weiny
On Fri, Jun 18, 2021 at 11:37:28AM +0800, Herbert Xu wrote: > On Thu, Jun 17, 2021 at 08:01:57PM -0700, Ira Weiny wrote: > > > > > + flush_kernel_dcache_page(__page); \ > > > > Is this required on 32bit systems? Why is kunmap_flush_on_unmap() not > > sufficient on 64bit

Re: [PATCH for 4.16 v7 02/11] powerpc: membarrier: Skip memory barrier in switch_mm()

2021-06-18 Thread Mathieu Desnoyers
- On Jun 18, 2021, at 1:13 PM, Christophe Leroy christophe.le...@csgroup.eu wrote: [...] > > I don't understand all that complexity to just replace a simple > 'smp_mb__after_unlock_lock()'. > > #define smp_mb__after_unlock_lock() smp_mb() > #define smp_mb() barrier() > # define

Re: [PATCH for 4.16 v7 02/11] powerpc: membarrier: Skip memory barrier in switch_mm()

2021-06-18 Thread Christophe Leroy
Le 29/01/2018 à 21:20, Mathieu Desnoyers a écrit : Allow PowerPC to skip the full memory barrier in switch_mm(), and only issue the barrier when scheduling into a task belonging to a process that has registered to use expedited private. Threads targeting the same VM but which belong to

Re: [PATCH 8/8] membarrier: Rewrite sync_core_before_usermode() and improve documentation

2021-06-18 Thread Mathieu Desnoyers
- On Jun 17, 2021, at 8:12 PM, Andy Lutomirski l...@kernel.org wrote: > On 6/17/21 7:47 AM, Mathieu Desnoyers wrote: > >> Please change back this #ifndef / #else / #endif within function for >> >> if (!IS_ENABLED(CONFIG_ARCH_HAS_MEMBARRIER_SYNC_CORE)) { >> ... >> } else { >> ... >> } >>

Re: [PATCH 8/8] membarrier: Rewrite sync_core_before_usermode() and improve documentation

2021-06-18 Thread Christophe Leroy
Le 16/06/2021 à 20:52, Andy Lutomirski a écrit : On 6/15/21 9:45 PM, Nicholas Piggin wrote: Excerpts from Andy Lutomirski's message of June 16, 2021 1:21 pm: The old sync_core_before_usermode() comments suggested that a non-icache-syncing return-to-usermode instruction is x86-specific and

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-18 Thread Christoph Hellwig
On Fri, Jun 18, 2021 at 09:09:17AM -0500, Tom Lendacky wrote: > > swiotlb_init_with_tbl uses memblock_alloc to allocate the io_tlb_mem > > and memblock_alloc[1] will do memset in memblock_alloc_try_nid[2], so > > swiotlb_init_with_tbl is also good. > > I'm happy to add the memset in

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-18 Thread Tom Lendacky
On 6/18/21 1:25 AM, Claire Chang wrote: > On Fri, Jun 18, 2021 at 7:30 AM Stefano Stabellini > wrote: >> >> On Thu, 17 Jun 2021, Claire Chang wrote: >>> Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct >>> initialization to make the code reusable. >>> >>> Signed-off-by:

Re: [PATCH v2 5/9] powerpc/microwatt: Use standard 16550 UART for console

2021-06-18 Thread Paul Mackerras
On Fri, Jun 18, 2021 at 05:40:40PM +1000, Nicholas Piggin wrote: > Excerpts from Paul Mackerras's message of June 18, 2021 1:46 pm: > > From: Benjamin Herrenschmidt > > > > This adds support to the Microwatt platform to use the standard > > 16550-style UART which available in the standalone

linux-next: manual merge of the akpm-current tree with the powerpc tree

2021-06-18 Thread Stephen Rothwell
Hi all, Today's linux-next merge of the akpm-current tree got a conflict in: arch/powerpc/kernel/smp.c between commit: 86f46f343272 ("powerpc/32s: Initialise KUAP and KUEP in C") from the powerpc tree and commit: 103e676c91d0 ("lazy tlb: introduce lazy mm refcount helper functions")

Re: [PATCH 1/1] powerpc/pseries: Interface to represent PAPR firmware attributes

2021-06-18 Thread Gautham R Shenoy
On Wed, Jun 16, 2021 at 07:12:40PM +0530, Pratik R. Sampat wrote: > Adds a generic interface to represent the energy and frequency related > PAPR attributes on the system using the new H_CALL > "H_GET_ENERGY_SCALE_INFO". > > H_GET_EM_PARMS H_CALL was previously responsible for exporting this >

Re: [PATCH 4/4] powerpc: Enable KFENCE on BOOK3S/64

2021-06-18 Thread Daniel Axtens
Daniel Axtens writes: >> +#ifdef CONFIG_PPC64 >> +static inline bool kfence_protect_page(unsigned long addr, bool protect) >> +{ >> +struct page *page; >> + >> +page = virt_to_page(addr); >> +if (protect) >> +__kernel_map_pages(page, 1, 0); >> +else >> +

Re: [PATCH 4/4] powerpc: Enable KFENCE on BOOK3S/64

2021-06-18 Thread Daniel Axtens
> +#ifdef CONFIG_PPC64 > +static inline bool kfence_protect_page(unsigned long addr, bool protect) > +{ > + struct page *page; > + > + page = virt_to_page(addr); > + if (protect) > + __kernel_map_pages(page, 1, 0); > + else > + __kernel_map_pages(page, 1,

Re: [PATCH v6 12/17] powerpc/pseries/vas: Integrate API with open/close windows

2021-06-18 Thread Haren Myneni
On Fri, 2021-06-18 at 09:22 +1000, Nicholas Piggin wrote: > Excerpts from Haren Myneni's message of June 18, 2021 6:36 am: > > This patch adds VAS window allocatioa/close with the corresponding > > hcalls. Also changes to integrate with the existing user space VAS > > API and provide

Re: [PATCH 2/4] powerpc/64s: Remove unneeded #ifdef CONFIG_DEBUG_PAGEALLOC in hash_utils

2021-06-18 Thread Daniel Axtens
Hi Jordan and Christophe, > --- a/arch/powerpc/mm/book3s64/hash_utils.c > +++ b/arch/powerpc/mm/book3s64/hash_utils.c > @@ -126,11 +126,8 @@ EXPORT_SYMBOL_GPL(mmu_slb_size); > #ifdef CONFIG_PPC_64K_PAGES > int mmu_ci_restrictions; > #endif > -#ifdef CONFIG_DEBUG_PAGEALLOC > static u8

Re: [PATCH v2 5/9] powerpc/microwatt: Use standard 16550 UART for console

2021-06-18 Thread Nicholas Piggin
Excerpts from Paul Mackerras's message of June 18, 2021 1:46 pm: > From: Benjamin Herrenschmidt > > This adds support to the Microwatt platform to use the standard > 16550-style UART which available in the standalone Microwatt FPGA. > > Signed-off-by: Benjamin Herrenschmidt > Signed-off-by:

Re: [PATCH 1/4] powerpc/64s: Add DEBUG_PAGEALLOC for radix

2021-06-18 Thread Daniel Axtens
Jordan Niethe writes: > There is support for DEBUG_PAGEALLOC on hash but not on radix. > Add support on radix. Somewhat off-topic but I wonder at what point we can drop the weird !PPC condition in mm/Kconfig.debug: config DEBUG_PAGEALLOC bool "Debug page memory allocations"

Re: [PATCH] Documentation: PCI: pci-error-recovery: rearrange the general sequence

2021-06-18 Thread Oliver O'Halloran
On Fri, Jun 18, 2021 at 4:05 PM Wesley Sheng wrote: > > Reset_link() callback function was called before mmio_enabled() in > pcie_do_recovery() function actually, so rearrange the general > sequence betwen step 2 and step 3 accordingly. I don't think this is true in all cases. If

Re: [PATCH v13 01/12] swiotlb: Refactor swiotlb init functions

2021-06-18 Thread Claire Chang
On Fri, Jun 18, 2021 at 7:30 AM Stefano Stabellini wrote: > > On Thu, 17 Jun 2021, Claire Chang wrote: > > Add a new function, swiotlb_init_io_tlb_mem, for the io_tlb_mem struct > > initialization to make the code reusable. > > > > Signed-off-by: Claire Chang > > Reviewed-by: Christoph Hellwig

[PATCH] Documentation: PCI: pci-error-recovery: rearrange the general sequence

2021-06-18 Thread Wesley Sheng
Reset_link() callback function was called before mmio_enabled() in pcie_do_recovery() function actually, so rearrange the general sequence betwen step 2 and step 3 accordingly. Signed-off-by: Wesley Sheng --- Documentation/PCI/pci-error-recovery.rst | 23 --- 1 file changed,