This patch set adds support in caam drivers (caam/jr, caam/qi, caam/qi2) for the crypto engine to work behind an IOMMU. v2: Fixed compilation warnings (unused variables) in patch 3/7. v1: The changes consist in: 1. Deferred probing support -caam/jr - top level drivers are converted to "libraries"; this also fixes the issue reported previously by Marcin: https://patchwork.kernel.org/cover/10558409/ -caam/qi - use the newly added QBMan functions (*) to decide whether to defer caam controller probing or not 2. Fixing spurios memory accesses, that lead to IOMMU access faults -crypto engine prefetches S/G table entries in chunks of 4 (64 bytes), and driver has to make sure memory is allocated and mapped -crypto engine tries to prefetch S/G table entries when input / output is marked as scattered, even though length is zero 3. Getting rid of platform device created by caam/qi There are inherent problems with platform device being created dynamically (and not relying on the existence of a DT node). 4. Update phys -> virt address translation in case IOMMU is present iova -> phys -> virt 5. Fix the device used for key buffers DMA mapping Key buffers are incorrectly DMA mapped using a job ring device, since they are accessed eventually by the QI - this creating an ICID / stream ID mismatch at IOMMU level. Tests were performed on: -LS1046A - caam/jr and caam/qi - job ring and queue interface -LS1088A - caam/jr and caam/qi2 - job ring and dpsec interface There are some dependencies (see below). While not everything is in place, I would like at least to patches 1-6/7 being reviewed & merged. i. Patch 7/7 (crypto: caam - defer probing until QMan is available) depends on commit 1c8f39946c03 ("soc: fsl: qbman_portals: add APIs to retrieve the probing status") from Leo's tree: git://git.kernel.org/pub/scm/linux/kernel/git/leo/linux.git and should not be merged. ii. U-boot updates for LS1088A (needed for caam/jr ICID programming) [U-Boot,1/2] armv8: fsl-layerscape: add missing sec jr base address defines https://patchwork.ozlabs.org/patch/1059256/ [U-Boot,2/2] armv8: ls1088a: add icid setup for platform devices https://patchwork.ozlabs.org/patch/1059259/ Horia Geantă (7): crypto: caam - avoid S/G table fetching for AEAD zero-length output crypto: caam - fix S/G table passing page boundary crypto: caam - convert top level drivers to libraries crypto: caam/qi - don't allocate an extra platform device crypto: caam/qi - fix address translations with IOMMU enabled crypto: caam/qi - DMA map keys using proper device crypto: caam - defer probing until QMan is available drivers/crypto/caam/Kconfig | 46 ++++------- drivers/crypto/caam/Makefile | 18 ++--- drivers/crypto/caam/caamalg.c | 74 ++++++++---------- drivers/crypto/caam/caamalg_qi.c | 124 +++++++++++++++--------------- drivers/crypto/caam/caamalg_qi2.c | 72 +++++++++++++---- drivers/crypto/caam/caamhash.c | 81 ++++++------------- drivers/crypto/caam/caampkc.c | 57 +++----------- drivers/crypto/caam/caamrng.c | 54 ++----------- drivers/crypto/caam/ctrl.c | 124 ++++++++++++++++++------------ drivers/crypto/caam/desc_constr.h | 11 +++ drivers/crypto/caam/intern.h | 102 ++++++++++++++++++++++-- drivers/crypto/caam/jr.c | 43 +++++++++++ drivers/crypto/caam/qi.c | 52 ++++++------- 13 files changed, 465 insertions(+), 393 deletions(-) -- 2.17.1