• Tom Zanussi's avatar
    crypto: iaa - Add irq support for the crypto async interface · 09646c98
    Tom Zanussi authored
    The existing iaa crypto async support provides an implementation that
    satisfies the interface but does so in a synchronous manner - it fills
    and submits the IDXD descriptor and then waits for it to complete
    before returning.  This isn't a problem at the moment, since all
    existing callers (e.g. zswap) wrap any asynchronous callees in a
    synchronous wrapper anyway.
    
    This change makes the iaa crypto async implementation truly
    asynchronous: it fills and submits the IDXD descriptor, then returns
    immediately with -EINPROGRESS.  It also sets the descriptor's 'request
    completion irq' bit and sets up a callback with the IDXD driver which
    is called when the operation completes and the irq fires.  The
    existing callers such as zswap use synchronous wrappers to deal with
    -EINPROGRESS and so work as expected without any changes.
    
    This mode can be enabled by writing 'async_irq' to the sync_mode
    iaa_crypto driver attribute:
    
      echo async_irq > /sys/bus/dsa/drivers/crypto/sync_mode
    
    Async mode without interrupts (caller must poll) can be enabled by
    writing 'async' to it:
    
      echo async > /sys/bus/dsa/drivers/crypto/sync_mode
    
    The default sync mode can be enabled by writing 'sync' to it:
    
      echo sync > /sys/bus/dsa/drivers/crypto/sync_mode
    
    The sync_mode value setting at the time the IAA algorithms are
    registered is captured in each algorithm's crypto_ctx and used for all
    compresses and decompresses when using a given algorithm.
    Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    09646c98
iaa_crypto_main.c 53 KB