This patch set adds support in caam drivers (caam/jr, caam/qi, caam/qi2) for the crypto engine to work behind an IOMMU. 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-8/9 being reviewed & merged. i. Patch 9/9 (crypto: caam - defer probing until QMan is available) should NOT be merged, since there are compilation dependencies on the patch series: (*) Prerequisites for NXP LS104xA SMMU enablement https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=98625 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 | 72 ++++++++--------- 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(+), 391 deletions(-) -- 2.17.1