linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] Remove default DMA window before creating DDW
@ 2020-06-24  6:24 Leonardo Bras
  2020-06-24  6:24 ` [PATCH v2 1/6] powerpc/pseries/iommu: Create defines for operations in ibm,ddw-applicable Leonardo Bras
                   ` (6 more replies)
  0 siblings, 7 replies; 32+ messages in thread
From: Leonardo Bras @ 2020-06-24  6:24 UTC (permalink / raw)
  To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
	Alexey Kardashevskiy, Leonardo Bras, Thiago Jung Bauermann,
	Ram Pai
  Cc: linuxppc-dev, linux-kernel

There are some devices that only allow 1 DMA window to exist at a time,
and in those cases, a DDW is never created to them, since the default DMA
window keeps using this resource.

LoPAR recommends this procedure:
1. Remove the default DMA window,
2. Query for which configs the DDW can be created,
3. Create a DDW.

Patch #1:
Create defines for outputs of ibm,ddw-applicable, so it's easier to
identify them.

Patch #2:
- After LoPAR level 2.8, there is an extension that can make
  ibm,query-pe-dma-windows to have 6 outputs instead of 5. This changes the
  order of the outputs, and that can cause some trouble. 
- query_ddw() was updated to check how many outputs the 
  ibm,query-pe-dma-windows is supposed to have, update the rtas_call() and
  deal correctly with the outputs in both cases.
- This patch looks somehow unrelated to the series, but it can avoid future
  problems on DDW creation.

Patch #3 moves the window-removing code from remove_ddw() to
remove_dma_window(), creating a way to delete any DMA window, so it can be
used to delete the default DMA window.

Patch #4 makes use of the remove_dma_window() from patch #3 to remove the
default DMA window before query_ddw(). It also implements a new rtas call
to recover the default DMA window, in case anything fails after it was
removed, and a DDW couldn't be created.

Patch #5:
Instead of destroying the created DDW if it doesn't map the whole
partition, make use of it instead of the default DMA window.

Patch #6:
Changes the way iommu_bypass_supported_pSeriesLP() check for 
iommu_bypass: instead of checking the address returned by enable_ddw(),
it checks a new output value that reflects if the DDW created maps
the whole partition.


All patches were tested into an LPAR with an Ethernet VF:
4005:01:00.0 Ethernet controller: Mellanox Technologies MT27700 Family
[ConnectX-4 Virtual Function]

---
Changes since v1:
- Add defines for ibm,ddw-applicable and ibm,ddw-extensions outputs
- Merge aux function query_ddw_out_sz() into query_ddw()
- Merge reset_dma_window() patch (prev. #2) into remove default DMA
  window patch (#4).
- Keep device_node *np name instead of using pdn in remove_*()
- Rename 'device_node *pdn' into 'parent' in new functions
- Rename dfl_win to default_win
- Only remove the default DMA window if there is no window available
  in first query.
- Check if default DMA window can be restored before removing it.
- Fix 'unitialized use' (found by travis mpe:ci-test)
- New patches #5 and #6

Special thanks for Alexey Kardashevskiy and Oliver O'Halloran for
the feedback provided!

Leonardo Bras (6):
  powerpc/pseries/iommu: Create defines for operations in
    ibm,ddw-applicable
  powerpc/pseries/iommu: Update call to ibm,query-pe-dma-windows
  powerpc/pseries/iommu: Move window-removing part of remove_ddw into
    remove_dma_window
  powerpc/pseries/iommu: Remove default DMA window before creating DDW
  powerpc/pseries/iommu: Make use of DDW even if it does not map the
    partition
  powerpc/pseries/iommu: Avoid errors when DDW starts at 0x00

 arch/powerpc/platforms/pseries/iommu.c | 239 ++++++++++++++++++-------
 1 file changed, 176 insertions(+), 63 deletions(-)

-- 
2.25.4





^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2020-07-03  6:27 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  6:24 [PATCH v2 0/6] Remove default DMA window before creating DDW Leonardo Bras
2020-06-24  6:24 ` [PATCH v2 1/6] powerpc/pseries/iommu: Create defines for operations in ibm,ddw-applicable Leonardo Bras
2020-07-01  8:16   ` Alexey Kardashevskiy
2020-07-01 13:28     ` Leonardo Bras
2020-07-02  0:21       ` Alexey Kardashevskiy
2020-07-02  0:36         ` Leonardo Bras
2020-07-02  0:43           ` Alexey Kardashevskiy
2020-07-02  0:46             ` Leonardo Bras
2020-06-24  6:24 ` [PATCH v2 2/6] powerpc/pseries/iommu: Update call to ibm,query-pe-dma-windows Leonardo Bras
2020-07-01  8:17   ` Alexey Kardashevskiy
2020-07-01 14:04     ` Leonardo Bras
2020-07-02  0:18       ` Alexey Kardashevskiy
2020-07-02  0:28         ` Leonardo Bras
2020-06-24  6:24 ` [PATCH v2 3/6] powerpc/pseries/iommu: Move window-removing part of remove_ddw into remove_dma_window Leonardo Bras
2020-06-24  6:24 ` [PATCH v2 4/6] powerpc/pseries/iommu: Remove default DMA window before creating DDW Leonardo Bras
2020-07-01  8:17   ` Alexey Kardashevskiy
2020-07-01 19:48     ` Leonardo Bras
2020-07-02  0:25       ` Alexey Kardashevskiy
2020-06-24  6:24 ` [PATCH v2 5/6] powerpc/pseries/iommu: Make use of DDW even if it does not map the partition Leonardo Bras
2020-06-26 15:23   ` Leonardo Bras
2020-06-26 17:55     ` Leonardo Bras
2020-07-01  8:16   ` Alexey Kardashevskiy
2020-07-01 19:57     ` Leonardo Bras
2020-07-01 23:48       ` Leonardo Bras
2020-07-02  0:31         ` Alexey Kardashevskiy
2020-07-02  0:54           ` Leonardo Bras
2020-07-03  6:27           ` Leonardo Bras
2020-06-24  6:24 ` [PATCH v2 6/6] powerpc/pseries/iommu: Avoid errors when DDW starts at 0x00 Leonardo Bras
2020-06-26 17:46   ` Leonardo Bras
2020-07-01  8:04     ` Alexey Kardashevskiy
2020-07-01 19:59       ` Leonardo Bras
2020-06-24 15:54 ` [PATCH v2 0/6] Remove default DMA window before creating DDW Leonardo Bras

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).