1. 29 Dec, 2023 4 commits
  2. 22 Dec, 2023 14 commits
  3. 15 Dec, 2023 22 commits
    • Bharat Bhushan's avatar
      crypto: octeontx2 - Fix cptvf driver cleanup · c480a421
      Bharat Bhushan authored
      This patch fixes following cleanup issues:
       - Missing instruction queue free on cleanup. This
         will lead to memory leak.
       - lfs->lfs_num is set to zero before cleanup, which
         will lead to improper cleanup.
      Signed-off-by: default avatarBharat Bhushan <bbhushan2@marvell.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      c480a421
    • Uwe Kleine-König's avatar
      hwrng: xgene - Convert to platform remove callback returning void · 9d7edaae
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9d7edaae
    • Uwe Kleine-König's avatar
      hwrng: timeriomem - Convert to platform remove callback returning void · b74bc79f
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b74bc79f
    • Uwe Kleine-König's avatar
      hwrng: stm32 - Convert to platform remove callback returning void · 541b0719
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      541b0719
    • Uwe Kleine-König's avatar
      hwrng: omap - Convert to platform remove callback returning void · 4da4a48b
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      4da4a48b
    • Uwe Kleine-König's avatar
      hwrng: npcm - Convert to platform remove callback returning void · e5906ee3
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e5906ee3
    • Uwe Kleine-König's avatar
      hwrng: n2 - Convert to platform remove callback returning void · 550b48d1
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      550b48d1
    • Uwe Kleine-König's avatar
      hwrng: mxc - Convert to platform remove callback returning void · 0791bdf5
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0791bdf5
    • Uwe Kleine-König's avatar
      hwrng: ks-sa - Convert to platform remove callback returning void · 724989b8
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      724989b8
    • Uwe Kleine-König's avatar
      hwrng: ingenic - Convert to platform remove callback returning void · b383836d
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b383836d
    • Uwe Kleine-König's avatar
      hwrng: exynos - Convert to platform remove callback returning void · 9daec3cb
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Acked-by: default avatarLukasz Stelmach <l.stelmach@samsung.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      9daec3cb
    • Uwe Kleine-König's avatar
      hwrng: cctrng - Convert to platform remove callback returning void · 0e00c526
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      0e00c526
    • Uwe Kleine-König's avatar
      hwrng: atmel - Convert to platform remove callback returning void · 30a7821f
      Uwe Kleine-König authored
      The .remove() callback for a platform driver returns an int which makes
      many driver authors wrongly assume it's possible to do error handling by
      returning an error code. However the value returned is ignored (apart
      from emitting a warning) and this typically results in resource leaks.
      
      To improve here there is a quest to make the remove callback return
      void. In the first step of this quest all drivers are converted to
      .remove_new(), which already returns void. Eventually after all drivers
      are converted, .remove_new() will be renamed to .remove().
      
      Trivially convert this driver from always returning zero in the remove
      callback to the void returning variant.
      Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      30a7821f
    • Christophe JAILLET's avatar
      hwrng: virtio - Remove usage of the deprecated ida_simple_xx() API · e4db80d8
      Christophe JAILLET authored
      ida_alloc() and ida_free() should be preferred to the deprecated
      ida_simple_get() and ida_simple_remove().
      
      This is less verbose.
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      e4db80d8
    • Chenghai Huang's avatar
      crypto: hisilicon/sec2 - optimize the error return process · 1bed8225
      Chenghai Huang authored
      Add the printf of an error message and optimized the handling
      process of ret.
      Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      1bed8225
    • Chenghai Huang's avatar
      crypto: hisilicon/qm - delete a dbg function · 03fa3012
      Chenghai Huang authored
      Deleted a dbg function because this function has the risk of
      address leakage. In addition, this function is only used for
      debugging in the early stage and is not required in the future.
      Signed-off-by: default avatarChenghai Huang <huangchenghai2@huawei.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      03fa3012
    • Herbert Xu's avatar
      crypto: api - Disallow identical driver names · 27016f75
      Herbert Xu authored
      Disallow registration of two algorithms with identical driver names.
      
      Cc: <stable@vger.kernel.org>
      Reported-by: default avatarOvidiu Panait <ovidiu.panait@windriver.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      27016f75
    • Tom Zanussi's avatar
      dmaengine: idxd: Add support for device/wq defaults · 979f6ded
      Tom Zanussi authored
      Add a load_device_defaults() function pointer to struct
      idxd_driver_data, which if defined, will be called when an idxd device
      is probed and will allow the idxd device to be configured with default
      values.
      
      The load_device_defaults() function is passed an idxd device to work
      with to set specific device attributes.
      
      Also add a load_device_defaults() implementation IAA devices; future
      patches would add default functions for other device types such as
      DSA.
      
      The way idxd device probing works, if the device configuration is
      valid at that point e.g. at least one workqueue and engine is properly
      configured then the device will be enabled and ready to go.
      
      The IAA implementation, idxd_load_iaa_device_defaults(), configures a
      single workqueue (wq0) for each device with the following default
      values:
      
            mode     	        "dedicated"
            threshold		0
            size		Total WQ Size from WQCAP
            priority		10
            type		IDXD_WQT_KERNEL
            group		0
            name              "iaa_crypto"
            driver_name       "crypto"
      
      Note that this now adds another configuration step for any users that
      want to configure their own devices/workqueus with something different
      in that they'll first need to disable (in the case of IAA) wq0 and the
      device itself before they can set their own attributes and re-enable,
      since they've been already been auto-enabled.  Note also that in order
      for the new configuration to be applied to the deflate-iaa crypto
      algorithm the iaa_crypto module needs to unregister the old version,
      which is accomplished by removing the iaa_crypto module, and
      re-registering it with the new configuration by reinserting the
      iaa_crypto module.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      979f6ded
    • Tom Zanussi's avatar
      crypto: iaa - Add IAA Compression Accelerator stats · 93382a91
      Tom Zanussi authored
      Add support for optional debugfs statistics support for the IAA
      Compression Accelerator.  This is enabled by the kernel config item:
      
        CRYPTO_DEV_IAA_CRYPTO_STATS
      
      When enabled, the IAA crypto driver will generate statistics which can
      be accessed at /sys/kernel/debug/iaa-crypto/.
      
      See Documentation/driver-api/crypto/iax/iax-crypto.rst for details.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      93382a91
    • 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
    • Tom Zanussi's avatar
      crypto: iaa - Add support for deflate-iaa compression algorithm · 2ec6761d
      Tom Zanussi authored
      This patch registers the deflate-iaa deflate compression algorithm and
      hooks it up to the IAA hardware using the 'fixed' compression mode
      introduced in the previous patch.
      
      Because the IAA hardware has a 4k history-window limitation, only
      buffers <= 4k, or that have been compressed using a <= 4k history
      window, are technically compliant with the deflate spec, which allows
      for a window of up to 32k.  Because of this limitation, the IAA fixed
      mode deflate algorithm is given its own algorithm name, 'deflate-iaa'.
      
      With this change, the deflate-iaa crypto algorithm is registered and
      operational, and compression and decompression operations are fully
      enabled following the successful binding of the first IAA workqueue
      to the iaa_crypto sub-driver.
      
      when there are no IAA workqueues bound to the driver, the IAA crypto
      algorithm can be unregistered by removing the module.
      
      A new iaa_crypto 'verify_compress' driver attribute is also added,
      allowing the user to toggle compression verification.  If set, each
      compress will be internally decompressed and the contents verified,
      returning error codes if unsuccessful.  This can be toggled with 0/1:
      
        echo 0 > /sys/bus/dsa/drivers/crypto/verify_compress
      
      The default setting is '1' - verify all compresses.
      
      The verify_compress value setting at the time the algorithm is
      registered is captured in the algorithm's crypto_ctx and used for all
      compresses when using the algorithm.
      
      [ Based on work originally by George Powley, Jing Lin and Kyung Min
      Park ]
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      2ec6761d
    • Tom Zanussi's avatar
      crypto: iaa - Add compression mode management along with fixed mode · b190447e
      Tom Zanussi authored
      Define an in-kernel API for adding and removing compression modes,
      which can be used by kernel modules or other kernel code that
      implements IAA compression modes.
      
      Also add a separate file, iaa_crypto_comp_fixed.c, containing huffman
      tables generated for the IAA 'fixed' compression mode.  Future
      compression modes can be added in a similar fashion.
      
      One or more crypto compression algorithms will be created for each
      compression mode, each of which can be selected as the compression
      algorithm to be used by a particular facility.
      Signed-off-by: default avatarTom Zanussi <tom.zanussi@linux.intel.com>
      Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
      b190447e