[PATCH v5 00/16] Restricted DMA

2021-04-22 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

[PATCH v5 12/16] dma-direct: Add a new wrapper __dma_direct_free_pages()

2021-04-22 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

[PATCH v5 11/16] swiotlb: Refactor swiotlb_tbl_unmap_single

2021-04-22 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

RE: [PATCH] powerpc: Initialize local variable fdt to NULL in elf64_load()

2021-04-22 Thread David Laight
From: Daniel Axtens > Sent: 22 April 2021 03:21 > > > Hi Lakshmi, > > > >> On 4/15/21 12:14 PM, Lakshmi Ramasubramanian wrote: > >> > >> Sorry - missed copying device-tree and powerpc mailing lists. > >> > >>> There are a few "goto out;" statements before the local variable "fdt" > >>> is

[PATCH v5 15/16] dt-bindings: of: Add restricted DMA pool

2021-04-22 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 | 24

[PATCH v5 14/16] dma-direct: Allocate memory from restricted DMA pool if available

2021-04-22 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 v5 13/16] swiotlb: Add restricted DMA alloc/free support.

2021-04-22 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

Re: [PATCH] powerpc: Initialize local variable fdt to NULL in elf64_load()

2021-04-22 Thread Dan Carpenter
On Thu, Apr 22, 2021 at 08:05:27AM +, David Laight wrote: > From: Daniel Axtens > > Sent: 22 April 2021 03:21 > > > > > Hi Lakshmi, > > > > > >> On 4/15/21 12:14 PM, Lakshmi Ramasubramanian wrote: > > >> > > >> Sorry - missed copying device-tree and powerpc mailing lists. > > >> > > >>> There

[PATCH v5 05/16] swiotlb: Add restricted DMA pool initialization

2021-04-22 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| 80 + 3 files changed, 86

[PATCH v5 04/16] swiotlb: Add DMA_RESTRICTED_POOL

2021-04-22 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 v5 16/16] of: Add plumbing for restricted DMA pool

2021-04-22 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| 25 + drivers/of/device.c | 3 +++ drivers/of/of_private.h | 5 + 3

Re: [PATCH v4 00/14] Restricted DMA

2021-04-22 Thread Claire Chang
v5 here: https://lore.kernel.org/patchwork/cover/1416899/ to rebase onto Christoph's swiotlb cleanups.

[PATCH v5 01/16] swiotlb: Fix the type of index

2021-04-22 Thread Claire Chang
Fix the type of index from unsigned int to int since find_slots() might return -1. Fixes: 0774983bc923 ("swiotlb: refactor swiotlb_tbl_map_single") Signed-off-by: Claire Chang --- kernel/dma/swiotlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c

[PATCH v5 02/16] swiotlb: Refactor swiotlb init functions

2021-04-22 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

[PATCH v5 03/16] swiotlb: Refactor swiotlb_create_debugfs

2021-04-22 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 | 18 -- 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/kernel/dma/swiotlb.c

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-22 Thread Naveen N. Rao
Michael Ellerman wrote: "Naveen N. Rao" writes: Daniel Axtens wrote: Sathvika Vasireddy writes: This adds emulation support for the following instruction: * Set Boolean (setb) Signed-off-by: Sathvika Vasireddy ... If you do end up respinning the patch, I think it would be good to

[PATCH v5 07/16] swiotlb: Update is_swiotlb_buffer to add a struct device argument

2021-04-22 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 v5 06/16] swiotlb: Add a new get_io_tlb_mem getter

2021-04-22 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. Signed-off-by: Claire Chang --- include/linux/swiotlb.h | 11 +++ 1 file changed, 11 insertions(+) diff --git a/include/linux/swiotlb.h b/include/linux/swiotlb.h

[PATCH v5 09/16] swiotlb: Bounce data from/to restricted DMA pool if available

2021-04-22 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 v5 08/16] swiotlb: Update is_swiotlb_active to add a struct device argument

2021-04-22 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 v5 10/16] swiotlb: Move alloc_size to find_slots

2021-04-22 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 96ff36d8ec53..b7d634d7a7eb

[PATCH kernel] powerpc/makefile: Do not redefine $(CPP) for preprocessor

2021-04-22 Thread Alexey Kardashevskiy
The $(CPP) (do only preprocessing) macro is already defined in Makefile. However POWERPC redefines it and adds $(KBUILD_CFLAGS) which results in flags duplication. Which is not a big deal by itself except for the flags which depend on other flags and the compiler checks them as it parses the

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

2021-04-22 Thread Jason Gunthorpe
On Thu, Apr 22, 2021 at 11:49:31PM +1000, Michael Ellerman wrote: > Alex Williamson writes: > > On Mon, 12 Apr 2021 19:41:41 +1000 > > Michael Ellerman wrote: > > > >> Alex Williamson writes: > >> > On Fri, 26 Mar 2021 07:13:10 +0100 > >> > Christoph Hellwig wrote: > >> > > >> >> This driver

Re: [PATCH 1/2] vfio/pci: remove vfio_pci_nvlink2

2021-04-22 Thread Michael Ellerman
Alex Williamson writes: > On Mon, 12 Apr 2021 19:41:41 +1000 > Michael Ellerman wrote: > >> Alex Williamson writes: >> > On Fri, 26 Mar 2021 07:13:10 +0100 >> > Christoph Hellwig wrote: >> > >> >> This driver never had any open userspace (which for VFIO would include >> >> VM kernel drivers)

Re: [PATCH v2] powerpc/kconfig: Restore alphabetic order of the selects under CONFIG_PPC

2021-04-22 Thread Michael Ellerman
Christophe Leroy writes: > Commit a7d2475af7ae ("powerpc: Sort the selects under CONFIG_PPC") > sorted all selects under CONFIG_PPC. > > 4 years later, several items have been introduced at wrong place, > a few other have been renamed without moving them to their correct > place. > > Reorder them

[PATCH] cpuidle/pseries: Fixup CEDE0 latency only for POWER10 onwards

2021-04-22 Thread Gautham R. Shenoy
From: "Gautham R. Shenoy" Commit d947fb4c965c ("cpuidle: pseries: Fixup exit latency for CEDE(0)") sets the exit latency of CEDE(0) based on the latency values of the Extended CEDE states advertised by the platform On some of the POWER9 LPARs, the older firmwares advertise a very low value of

Re: [PATCH 1/2] powerpc: Make the code in __show_regs nice-looking

2021-04-22 Thread Christophe Leroy
Le 22/04/2021 à 17:10, Xiongwei Song a écrit : From: Xiongwei Song Create a new function named interrupt_detail_printable to judge which interrupts can print esr/dsisr register. What is the benefit of that function ? It may be interesting if the test was done at several places, but as it

Re: [PATCH 2/2] powerpc: Print esr register when hitting Program Interrupt

2021-04-22 Thread Christophe Leroy
Le 22/04/2021 à 17:10, Xiongwei Song a écrit : From: Xiongwei Song The esr register has the details of Program Interrupt on BookE/4xx cpus, printing its value is helpful. Signed-off-by: Xiongwei Song --- arch/powerpc/kernel/process.c | 1 + 1 file changed, 1 insertion(+) diff --git

[PATCH 2/2] powerpc: Print esr register when hitting Program Interrupt

2021-04-22 Thread Xiongwei Song
From: Xiongwei Song The esr register has the details of Program Interrupt on BookE/4xx cpus, printing its value is helpful. Signed-off-by: Xiongwei Song --- arch/powerpc/kernel/process.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/process.c

[PATCH 1/2] powerpc: Make the code in __show_regs nice-looking

2021-04-22 Thread Xiongwei Song
From: Xiongwei Song Create a new function named interrupt_detail_printable to judge which interrupts can print esr/dsisr register. Signed-off-by: Xiongwei Song --- arch/powerpc/kernel/process.c | 21 - 1 file changed, 16 insertions(+), 5 deletions(-) diff --git

Re: [PATCH] powerpc: Initialize local variable fdt to NULL in elf64_load()

2021-04-22 Thread Segher Boessenkool
On Thu, Apr 22, 2021 at 08:05:27AM +, David Laight wrote: > > (Does anyone - and by anyone I mean any large distro - compile with > > local variables inited by the compiler?) > > There are compilers that initialise locals to zero for 'debug' builds > and leave the 'random' for optimised

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Lijun Pan
On Thu, Apr 22, 2021 at 2:07 AM Rick Lindsley wrote: > > On 4/21/21 10:30 PM, Lijun Pan wrote: > >> Fixes: ed651a10875f ("ibmvnic: Updated reset handling") > >> Signed-off-by: Dany Madden > >> Reviewed-by: Rick Lindsley > >> Reviewed-by: Sukadev Bhattiprolu > > > > One thing I would like to

Re: [PATCH 2/2] powerpc: Print esr register when hitting Program Interrupt

2021-04-22 Thread Christophe Leroy
Le 22/04/2021 à 17:29, Christophe Leroy a écrit : Le 22/04/2021 à 17:10, Xiongwei Song a écrit : From: Xiongwei Song The esr register has the details of Program Interrupt on BookE/4xx cpus, printing its value is helpful. Signed-off-by: Xiongwei Song ---   arch/powerpc/kernel/process.c

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Michal Suchánek
Hello, On Thu, Apr 22, 2021 at 12:06:45AM -0500, Lijun Pan wrote: > On Wed, Apr 21, 2021 at 2:25 AM Sukadev Bhattiprolu > wrote: > > > > Lijun Pan [l...@linux.vnet.ibm.com] wrote: > > > > > > > > > > On Apr 20, 2021, at 4:35 PM, Dany Madden wrote: > > > > > > > > When ibmvnic gets a FATAL error

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Lijun Pan
On Thu, Apr 22, 2021 at 12:21 PM Michal Suchánek wrote: > > Hello, > > On Thu, Apr 22, 2021 at 12:06:45AM -0500, Lijun Pan wrote: > > On Wed, Apr 21, 2021 at 2:25 AM Sukadev Bhattiprolu > > wrote: > > > > > > Lijun Pan [l...@linux.vnet.ibm.com] wrote: > > > > > > > > > > > > > On Apr 20, 2021,

Re: [PATCH] cpuidle/pseries: Fixup CEDE0 latency only for POWER10 onwards

2021-04-22 Thread Vaidyanathan Srinivasan
* Gautham R Shenoy [2021-04-22 20:37:29]: > From: "Gautham R. Shenoy" > > Commit d947fb4c965c ("cpuidle: pseries: Fixup exit latency for > CEDE(0)") sets the exit latency of CEDE(0) based on the latency values > of the Extended CEDE states advertised by the platform > > On some of the POWER9

[PATCH] powerpc/powernv/pci: remove dead code from !CONFIG_EEH

2021-04-22 Thread Nick Desaulniers
While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a possible candidate to convert to #ifdef CONFIG_EEH, but it seems that based on Kconfig dependencies it's not possible to build this file without CONFIG_EEH enabled. Suggested-by: Nathan Chancellor Suggested-by: Joe Perches

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-22 Thread Segher Boessenkool
Hi! On Fri, Apr 16, 2021 at 05:44:52PM +1000, Daniel Axtens wrote: > Sathvika Vasireddy writes: > Ok, if I've understood correctly... > > > + ra = ra & ~0x3; > > This masks off the bits of RA that are not part of BTF: > > ra is in [0, 31] which is [0b0, 0b1] > Then

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-22 Thread Segher Boessenkool
Hi! On Fri, Apr 23, 2021 at 12:16:18AM +0200, Gabriel Paubert wrote: > On Thu, Apr 22, 2021 at 02:13:34PM -0500, Segher Boessenkool wrote: > > On Fri, Apr 16, 2021 at 05:44:52PM +1000, Daniel Axtens wrote: > > > Sathvika Vasireddy writes: > > > > + if ((regs->ccr) & (1 <<

Re: [PATCH 1/2] powerpc/sstep: Add emulation support for ‘setb’ instruction

2021-04-22 Thread Gabriel Paubert
Hi, On Thu, Apr 22, 2021 at 02:13:34PM -0500, Segher Boessenkool wrote: > Hi! > > On Fri, Apr 16, 2021 at 05:44:52PM +1000, Daniel Axtens wrote: > > Sathvika Vasireddy writes: > > Ok, if I've understood correctly... > > > > > + ra = ra & ~0x3; > > > > This masks off

Re: [PATCH kernel] powerpc/makefile: Do not redefine $(CPP) for preprocessor

2021-04-22 Thread Daniel Axtens
Hi Alexey, > The $(CPP) (do only preprocessing) macro is already defined in Makefile. > However POWERPC redefines it and adds $(KBUILD_CFLAGS) which results > in flags duplication. Which is not a big deal by itself except for > the flags which depend on other flags and the compiler checks them >

Re: [PATCH] powerpc/powernv/pci: remove dead code from !CONFIG_EEH

2021-04-22 Thread Daniel Axtens
Hi Nick, > While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a > possible candidate to convert to #ifdef CONFIG_EEH, but it seems that > based on Kconfig dependencies it's not possible to build this file > without CONFIG_EEH enabled. This seemed odd to me, but I think you're

Re: [PATCH] powerpc/powernv/pci: remove dead code from !CONFIG_EEH

2021-04-22 Thread Oliver O'Halloran
On Fri, Apr 23, 2021 at 9:09 AM Daniel Axtens wrote: > > Hi Nick, > > > While looking at -Wundef warnings, the #if CONFIG_EEH stood out as a > > possible candidate to convert to #ifdef CONFIG_EEH, but it seems that > > based on Kconfig dependencies it's not possible to build this file > > without

Re: [PATCH 1/2] audit: add support for the openat2 syscall

2021-04-22 Thread Richard Guy Briggs
On 2021-03-18 08:08, Richard Guy Briggs wrote: > On 2021-03-18 11:48, Christian Brauner wrote: > > [+Cc Aleksa, the author of openat2()] > > Ah! Thanks for pulling in Aleksa. I thought I caught everyone... > > > and a comment below. :) > > Same... > > > On Wed, Mar 17, 2021 at 09:47:17PM

Re: [PATCH 1/2] powerpc/vdso64: link vdso64 with linker

2021-04-22 Thread Nick Desaulniers
On Wed, Sep 2, 2020 at 11:02 AM Christophe Leroy wrote: > > > > Le 02/09/2020 à 19:41, Nick Desaulniers a écrit : > > On Wed, Sep 2, 2020 at 5:14 AM Michael Ellerman wrote: > >> > >> Nick Desaulniers writes: > >>> Fixes: commit f2af201002a8 ("powerpc/build: vdso linker warning for > >>> orphan

[PATCH 4/4] powerpc/pseries: warn if recursing into the hcall tracing code

2021-04-22 Thread Nicholas Piggin
--- arch/powerpc/platforms/pseries/lpar.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/pseries/lpar.c b/arch/powerpc/platforms/pseries/lpar.c index 835e7f661a05..a961a7ebeab3 100644 --- a/arch/powerpc/platforms/pseries/lpar.c +++

[powerpc:next] BUILD SUCCESS ee6b25fa7c037e42cc5f3b5c024b2a779edab6dd

2021-04-22 Thread kernel test robot
nfig-a015-20210421 i386 randconfig-a016-20210421 i386 randconfig-a014-20210422 i386 randconfig-a012-20210422 i386 randconfig-a011-20210422 i386 randconfig-a013-20210422 i386 randconfig-a015-20210422 i386

Re: [PATCH 7/7] swiotlb: don't override the command line in swiotlb_adjust_size

2021-04-22 Thread Tom Lendacky
On 4/22/21 2:19 AM, Christoph Hellwig wrote: > When the user specified an explicit swiotlb size on the command line, > the achitecture code should not override it. > > Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl") > Reported-by: Tom Lendacky > Signed-off-by: Christoph Hellwig I tested

Re: [PATCH v5 16/16] of: Add plumbing for restricted DMA pool

2021-04-22 Thread Claire Chang
On Thu, Apr 22, 2021 at 4:17 PM Claire Chang wrote: > > 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| 25 + >

Re: [PATCH kernel] powerpc/makefile: Do not redefine $(CPP) for preprocessor

2021-04-22 Thread Alexey Kardashevskiy
On 23/04/2021 08:58, Daniel Axtens wrote: Hi Alexey, The $(CPP) (do only preprocessing) macro is already defined in Makefile. However POWERPC redefines it and adds $(KBUILD_CFLAGS) which results in flags duplication. Which is not a big deal by itself except for the flags which depend on

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Rick Lindsley
On 4/22/21 10:21 AM, Michal Suchánek wrote: Merging do_reset and do_hard_reset might be a good code cleanup which is out of the scope of this fix. I agree, on both points. Accepting the patch, and improving the reset path are not in conflict with each other. My position is that improving the

[PATCH 0/4] Fix queued spinlocks and a bit more

2021-04-22 Thread Nicholas Piggin
Patch 1 is the important fix. 2 might fix something, although I haven't provoked a crash yet. Patch 3 is a small cleanup, and patch 4 I think is the right thing to do but these could wait for later. Thanks, Nick Nicholas Piggin (4): powerpc/pseries: Fix hcall tracing recursion in pv queued

Re: [PATCH kernel] powerpc/makefile: Do not redefine $(CPP) for preprocessor

2021-04-22 Thread Christophe Leroy
Le 23/04/2021 à 00:58, Daniel Axtens a écrit : diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index c9d2c7825cd6..3a2f2001c62b 100644 --- a/arch/powerpc/Makefile +++ b/arch/powerpc/Makefile @@ -214,7 +214,6 @@ KBUILD_CPPFLAGS += -I $(srctree)/arch/$(ARCH) $(asinstr)

[PATCH 2/4] powerpc/pseries: Don't trace hcall tracing wrapper

2021-04-22 Thread Nicholas Piggin
This doesn't seem very useful to trace before the recursion check, even if the ftrace code has any recursion checks of its own. Be on the safe side and don't trace the hcall trace wrappers. Reported-by: Naveen N. Rao Signed-off-by: Nicholas Piggin --- arch/powerpc/platforms/pseries/lpar.c | 4

[PATCH 1/4] powerpc/pseries: Fix hcall tracing recursion in pv queued spinlocks

2021-04-22 Thread Nicholas Piggin
The paravit queued spinlock slow path adds itself to the queue then calls pv_wait to wait for the lock to become free. This is implemented by calling H_CONFER to donate cycles. When hcall tracing is enabled, this H_CONFER call can lead to a spin lock being taken in the tracing code, which will

[PATCH 3/4] powerpc/pseries: use notrace hcall variant for H_CEDE idle

2021-04-22 Thread Nicholas Piggin
Rather than special-case H_CEDE in the hcall trace wrappers, make the idle H_CEDE call use plpar_hcall_norets_notrace(). Signed-off-by: Nicholas Piggin --- arch/powerpc/include/asm/plpar_wrappers.h | 6 +- arch/powerpc/platforms/pseries/lpar.c | 10 -- 2 files changed, 5

Re: [V3 PATCH 13/16] crypto/nx: Rename nx-842-pseries file name to nx-common-pseries

2021-04-22 Thread Herbert Xu
On Sat, Apr 17, 2021 at 02:11:15PM -0700, Haren Myneni wrote: > > Rename nx-842-pseries.c to nx-common-pseries.c to add code for new > GZIP compression type. The actual functionality is not changed in > this patch. > > Signed-off-by: Haren Myneni > --- > drivers/crypto/nx/Makefile

[PATCH v3 05/11] powerpc/pseries/iommu: Allow DDW windows starting at 0x00

2021-04-22 Thread Leonardo Bras
enable_ddw() currently returns the address of the DMA window, which is considered invalid if has the value 0x00. Also, it only considers valid an address returned from find_existing_ddw if it's not 0x00. Changing this behavior makes sense, given the users of enable_ddw() only need to know if

[PATCH v3 06/11] powerpc/pseries/iommu: Add ddw_property_create() and refactor enable_ddw()

2021-04-22 Thread Leonardo Bras
Code used to create a ddw property that was previously scattered in enable_ddw() is now gathered in ddw_property_create(), which deals with allocation and filling the property, letting it ready for of_property_add(), which now occurs in sequence. This created an opportunity to reorganize the

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

2021-04-22 Thread Leonardo Bras
Add a new helper _iommu_table_setparms(), and use it in iommu_table_setparms() and iommu_table_setparms_lpar() to avoid duplicated code. Also, setting tbl->it_ops was happening outsite iommu_table_setparms*(), so move it to the new helper. Since we need the iommu_table_ops to be declared before

[PATCH v3 08/11] powerpc/pseries/iommu: Update remove_dma_window() to accept property name

2021-04-22 Thread Leonardo Bras
Update remove_dma_window() so it can be used to remove DDW with a given property name. This enables the creation of new property names for DDW, so we can have different usage for it, like indirect mapping. Signed-off-by: Leonardo Bras --- arch/powerpc/platforms/pseries/iommu.c | 21

[PATCH v3 04/11] powerpc/pseries/iommu: Add ddw_list_new_entry() helper

2021-04-22 Thread Leonardo Bras
There are two functions creating direct_window_list entries in a similar way, so create a ddw_list_new_entry() to avoid duplicity and simplify those functions. Signed-off-by: Leonardo Bras Reviewed-by: Alexey Kardashevskiy --- arch/powerpc/platforms/pseries/iommu.c | 32

Re: [PATCH v3 00/11] DDW + Indirect Mapping

2021-04-22 Thread Leonardo Bras
Changes since v2: - Some patches got removed from the series and sent by themselves, - New tbl created for DDW + indirect mapping reserves MMIO32 space, - Improved reserved area algorithm, - Improved commit messages, - Removed define for default DMA window prop name, - Avoided some unnecessary

Re: [PATCH] powerpc/mce: save ignore_event flag unconditionally for UE

2021-04-22 Thread Ganesh
On 4/7/21 10:28 AM, Ganesh Goudar wrote: When we hit an UE while using machine check safe copy routines, ignore_event flag is set and the event is ignored by mce handler, And the flag is also saved for defered handling and printing of mce event information, But as of now saving of this flag is

Re: [V3 PATCH 16/16] crypto/nx: Add sysfs interface to export NX capabilities

2021-04-22 Thread Herbert Xu
On Sat, Apr 17, 2021 at 02:13:40PM -0700, Haren Myneni wrote: > > Changes to export the following NXGZIP capabilities through sysfs: > > /sys/devices/vio/ibm,compression-v1/NxGzCaps: > min_compress_len /*Recommended minimum compress length in bytes*/ > min_decompress_len /*Recommended minimum

Re: [V3 PATCH 15/16] crypto/nx: Get NX capabilities for GZIP coprocessor type

2021-04-22 Thread Herbert Xu
On Sat, Apr 17, 2021 at 02:12:51PM -0700, Haren Myneni wrote: > > phyp provides NX capabilities which gives recommended minimum > compression / decompression length and maximum request buffer size > in bytes. > > Changes to get NX overall capabilities which points to the specific > features phyp

Re: [V3 PATCH 14/16] crypto/nx: Register and unregister VAS interface

2021-04-22 Thread Herbert Xu
On Sat, Apr 17, 2021 at 02:12:12PM -0700, Haren Myneni wrote: > > Changes to create /dev/crypto/nx-gzip interface with VAS register > and to remove this interface with VAS unregister. > > Signed-off-by: Haren Myneni > --- > drivers/crypto/nx/Kconfig | 1 + >

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Rick Lindsley
On Wed, Apr 21, 2021 at 3:06 AM Rick Lindsley wrote: Please describe the advantage in deferring it further by routing it through do_hard_reset(). I don't see one. On 4/21/21 10:12 PM, Lijun Pan replied: It is not deferred. It exits with error and calls do_hard_reset. See my reply to

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Rick Lindsley
On 4/21/21 10:06 PM, Lijun Pan wrote: No real customer runs the system under that heavy load created by HTX stress test, which can tear down any working system. So, are you saying the bugs that HTX uncovers are not worth fixing? There's a fair number of individuals and teams out there that

[PATCH 6/7] swiotlb: replace default_nslabs with a byte value

2021-04-22 Thread Christoph Hellwig
Replace the default_nslabs variable with one that stores the size in bytes as that is what all the users actually expect. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/dma/swiotlb.c

Re: [PATCH 1/1] powerpc/kernel/iommu: Align size for IOMMU_PAGE_SIZE() to save TCEs

2021-04-22 Thread Leonardo Bras
Hello, This patch was also reviewed when it was part of another patchset: http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20200911170738.82818-4-leobra...@gmail.com/ On Thu, 2021-03-18 at 14:44 -0300, Leonardo Bras wrote: > Currently both iommu_alloc_coherent() and iommu_free_coherent()

[PATCH v3 00/11] DDW + Indirect Mapping

2021-04-22 Thread Leonardo Bras
So far it's assumed possible to map the guest RAM 1:1 to the bus, which works with a small number of devices. SRIOV changes it as the user can configure hundreds VFs and since phyp preallocates TCEs and does not allow IOMMU pages bigger than 64K, it has to limit the number of TCEs per a PE to

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Rick Lindsley
On 4/21/21 10:30 PM, Lijun Pan wrote: Fixes: ed651a10875f ("ibmvnic: Updated reset handling") Signed-off-by: Dany Madden Reviewed-by: Rick Lindsley Reviewed-by: Sukadev Bhattiprolu One thing I would like to point out as already pointed out by Nathan Lynch is that those review-by tags given

[PATCH v3 02/11] powerpc/kernel/iommu: Add new iommu_table_in_use() helper

2021-04-22 Thread Leonardo Bras
Having a function to check if the iommu table has any allocation helps deciding if a tbl can be reset for using a new DMA window. It should be enough to replace all instances of !bitmap_empty(tbl...). iommu_table_in_use() skips reserved memory, so we don't need to worry about releasing it before

[PATCH v3 01/11] powerpc/pseries/iommu: Replace hard-coded page shift

2021-04-22 Thread Leonardo Bras
Some functions assume IOMMU page size can only be 4K (pageshift == 12). Update them to accept any page size passed, so we can use 64K pages. In the process, some defines like TCE_SHIFT were made obsolete, and then removed. IODA3 Revision 3.0_prd1 (OpenPowerFoundation), Figures 3.4 and 3.5 show a

[PATCH v3 03/11] powerpc/pseries/iommu: Add iommu_pseries_alloc_table() helper

2021-04-22 Thread Leonardo Bras
Creates a helper to allow allocating a new iommu_table without the need to reallocate the iommu_group. This will be helpful for replacing the iommu_table for the new DMA window, after we remove the old one with iommu_tce_table_put(). Signed-off-by: Leonardo Bras Reviewed-by: Alexey

[PATCH v3 11/11] powerpc/pseries/iommu: Rename "direct window" to "dma window"

2021-04-22 Thread Leonardo Bras
A previous change introduced the usage of DDW as a bigger indirect DMA mapping when the DDW available size does not map the whole partition. As most of the code that manipulates direct mappings was reused for indirect mappings, it's necessary to rename all names and debug/info messages to reflect

cleanup and fix swiotlb sizing

2021-04-22 Thread Christoph Hellwig
Hi all, based on a report from Tom that overriding the default sizing provided by the x86 SEV code on the command line doesn't work anymore, this series cleans up how we handle default and command line sizes for the swiotlb buffer and then fixes the recently introduced bug in a straight-forward

[PATCH 4/7] powerpc/pseries: simplify svm_swiotlb_init

2021-04-22 Thread Christoph Hellwig
The value returned by swiotlb_size_or_default is always properly aligned now, so don't duplicate the work. Signed-off-by: Christoph Hellwig --- arch/powerpc/platforms/pseries/svm.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git

[PATCH 2/7] swiotlb: use swiotlb_size_or_default in swiotlb_init

2021-04-22 Thread Christoph Hellwig
Use swiotlb_size_or_default to calculate the buffer size insted of open coding it. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index c7b3dd86db7f56..27461fd63e0330

Re: [PATCH] powerpc/mce: save ignore_event flag unconditionally for UE

2021-04-22 Thread Ganesh
On 4/22/21 11:31 AM, Ganesh wrote: On 4/7/21 10:28 AM, Ganesh Goudar wrote: When we hit an UE while using machine check safe copy routines, ignore_event flag is set and the event is ignored by mce handler, And the flag is also saved for defered handling and printing of mce event information,

[PATCH v3 09/11] powerpc/pseries/iommu: Find existing DDW with given property name

2021-04-22 Thread Leonardo Bras
At the moment pseries stores information about created directly mapped DDW window in DIRECT64_PROPNAME. With the objective of implementing indirect DMA mapping with DDW, it's necessary to have another propriety name to make sure kexec'ing into older kernels does not break, as it would if we reuse

[PATCH v3 10/11] powerpc/pseries/iommu: Make use of DDW for indirect mapping

2021-04-22 Thread Leonardo Bras
So far it's assumed possible to map the guest RAM 1:1 to the bus, which works with a small number of devices. SRIOV changes it as the user can configure hundreds VFs and since phyp preallocates TCEs and does not allow IOMMU pages bigger than 64K, it has to limit the number of TCEs per a PE to

[PATCH 1/7] swiotlb: pass bytes instead of nslabs to swiotlb_init_with_tbl

2021-04-22 Thread Christoph Hellwig
Pass the actual allocation size to swiotlb_init_with_tbl, which simplifies things quite a bit. Signed-off-by: Christoph Hellwig --- arch/mips/cavium-octeon/dma-octeon.c | 2 +- arch/powerpc/platforms/pseries/svm.c | 3 +-- drivers/xen/swiotlb-xen.c| 2 +- include/linux/swiotlb.h

[PATCH 7/7] swiotlb: don't override the command line in swiotlb_adjust_size

2021-04-22 Thread Christoph Hellwig
When the user specified an explicit swiotlb size on the command line, the achitecture code should not override it. Fixes: 2cbc2776efe4 ("swiotlb: remove swiotlb_nr_tbl") Reported-by: Tom Lendacky Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 6 +- 1 file changed, 5

Re: [PATCH 1/1] powerpc/kernel/iommu: Use largepool as a last resort when !largealloc

2021-04-22 Thread Leonardo Bras
Hello, FYI: This patch was reviewed when it was part of another patchset: http://patchwork.ozlabs.org/project/linuxppc-dev/patch/20200817234033.442511-4-leobra...@gmail.com/ On Thu, 2021-03-18 at 14:44 -0300, Leonardo Bras wrote: > As of today, doing iommu_range_alloc() only for !largealloc

Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Sukadev Bhattiprolu
Lijun Pan [lijunp...@gmail.com] wrote: > > Now, sure we can attempt a "thorough hard reset" which also does > > the same hcalls to reestablish the connection. Is there any > > other magic in do_hard_reset()? But in addition, it also frees lot > > more Linux kernel buffers and reallocates them for

[PATCH 5/7] MIPS/octeon: simplify swiotlb initialization

2021-04-22 Thread Christoph Hellwig
Just use swiotlb_adjust_size and swiotlb_init to initialize swiotlb instead of doing a lot of manual work. Signed-off-by: Christoph Hellwig --- arch/mips/cavium-octeon/dma-octeon.c | 16 ++-- arch/mips/include/asm/octeon/pci-octeon.h | 1 - arch/mips/pci/pci-octeon.c

[PATCH 3/7] swiotlb: use swiotlb_adjust_size in setup_io_tlb_npages

2021-04-22 Thread Christoph Hellwig
Use the proper helper to do the proper alignment of the buffer size to the requirements of the swiotlb allocator instead of open coding the logic. Signed-off-by: Christoph Hellwig --- kernel/dma/swiotlb.c | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git