devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Corentin Labbe <clabbe@baylibre.com>,
	heiko@sntech.de, herbert@gondor.apana.org.au, krzk+dt@kernel.org,
	robh+dt@kernel.org
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org,
	devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-rockchip@lists.infradead.org,
	Corentin Labbe <clabbe@baylibre.com>
Subject: Re: [PATCH v4 10/33] crypto: rockchip: rework by using crypto_engine
Date: Sat, 2 Apr 2022 16:22:56 +0800	[thread overview]
Message-ID: <202204021634.IhyHrjoT-lkp@intel.com> (raw)
In-Reply-To: <20220401201804.2867154-11-clabbe@baylibre.com>

Hi Corentin,

I love your patch! Perhaps something to improve:

[auto build test WARNING on next-20220331]
[also build test WARNING on v5.17]
[cannot apply to rockchip/for-next herbert-cryptodev-2.6/master herbert-crypto-2.6/master v5.17 v5.17-rc8 v5.17-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220402-042221
base:    fdcbcd1348f4ef713668bae1b0fa9774e1811205
config: arm64-buildonly-randconfig-r001-20220402 (https://download.01.org/0day-ci/archive/20220402/202204021634.IhyHrjoT-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project c4a1b07d0979e7ff20d7d541af666d822d66b566)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install arm64 cross compiling tool for clang build
        # apt-get install binutils-aarch64-linux-gnu
        # https://github.com/intel-lab-lkp/linux/commit/be381eb03ba20a6e06f0e880a9929d14a1e13064
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220402-042221
        git checkout be381eb03ba20a6e06f0e880a9929d14a1e13064
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/crypto/rockchip/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/crypto/rockchip/rk3288_crypto_skcipher.c:21:46: error: use of undeclared identifier 'tfm'
           unsigned int bs = crypto_skcipher_blocksize(tfm);
                                                       ^
>> drivers/crypto/rockchip/rk3288_crypto_skcipher.c:328:6: warning: variable 'n' set but not used [-Wunused-but-set-variable]
           int n = 0;
               ^
   1 warning and 1 error generated.


vim +/n +328 drivers/crypto/rockchip/rk3288_crypto_skcipher.c

   319	
   320	static int rk_cipher_run(struct crypto_engine *engine, void *async_req)
   321	{
   322		struct skcipher_request *areq = container_of(async_req, struct skcipher_request, base);
   323		struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(areq);
   324		struct rk_cipher_ctx *ctx = crypto_skcipher_ctx(tfm);
   325		struct rk_cipher_rctx *rctx = skcipher_request_ctx(areq);
   326		struct scatterlist *sgs, *sgd;
   327		int err = 0;
 > 328		int n = 0;
   329		int ivsize = crypto_skcipher_ivsize(tfm);
   330		int offset;
   331		u8 iv[AES_BLOCK_SIZE];
   332		u8 biv[AES_BLOCK_SIZE];
   333		u8 *ivtouse = areq->iv;
   334		unsigned int len = areq->cryptlen;
   335		unsigned int todo;
   336	
   337		ivsize = crypto_skcipher_ivsize(tfm);
   338		if (areq->iv && crypto_skcipher_ivsize(tfm) > 0) {
   339			if (rctx->mode & RK_CRYPTO_DEC) {
   340				offset = areq->cryptlen - ivsize;
   341				scatterwalk_map_and_copy(rctx->backup_iv, areq->src,
   342							 offset, ivsize, 0);
   343			}
   344		}
   345	
   346		sgs = areq->src;
   347		sgd = areq->dst;
   348	
   349		while (sgs && sgd && len) {
   350			if (!sgs->length) {
   351				sgs = sg_next(sgs);
   352				sgd = sg_next(sgd);
   353				continue;
   354			}
   355			if (rctx->mode & RK_CRYPTO_DEC) {
   356				/* we backup last block of source to be used as IV at next step */
   357				offset = sgs->length - ivsize;
   358				scatterwalk_map_and_copy(biv, sgs, offset, ivsize, 0);
   359			}
   360			if (sgs == sgd) {
   361				err = dma_map_sg(ctx->dev->dev, sgs, 1, DMA_BIDIRECTIONAL);
   362				if (err <= 0) {
   363					err = -EINVAL;
   364					goto theend_iv;
   365				}
   366			} else {
   367				err = dma_map_sg(ctx->dev->dev, sgs, 1, DMA_TO_DEVICE);
   368				if (err <= 0) {
   369					err = -EINVAL;
   370					goto theend_iv;
   371				}
   372				err = dma_map_sg(ctx->dev->dev, sgd, 1, DMA_FROM_DEVICE);
   373				if (err <= 0) {
   374					err = -EINVAL;
   375					goto theend_sgs;
   376				}
   377			}
   378			err = 0;
   379			rk_ablk_hw_init(ctx->dev, areq);
   380			if (ivsize) {
   381				if (ivsize == DES_BLOCK_SIZE)
   382					memcpy_toio(ctx->dev->reg + RK_CRYPTO_TDES_IV_0, ivtouse, ivsize);
   383				else
   384					memcpy_toio(ctx->dev->reg + RK_CRYPTO_AES_IV_0, ivtouse, ivsize);
   385			}
   386			reinit_completion(&ctx->dev->complete);
   387			ctx->dev->status = 0;
   388	
   389			todo = min(sg_dma_len(sgs), len);
   390			len -= todo;
   391			crypto_dma_start(ctx->dev, sgs, sgd, todo / 4);
   392			wait_for_completion_interruptible_timeout(&ctx->dev->complete,
   393								  msecs_to_jiffies(2000));
   394			if (!ctx->dev->status) {
   395				dev_err(ctx->dev->dev, "DMA timeout\n");
   396				err = -EFAULT;
   397				goto theend;
   398			}
   399			if (sgs == sgd) {
   400				dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_BIDIRECTIONAL);
   401			} else {
   402				dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_TO_DEVICE);
   403				dma_unmap_sg(ctx->dev->dev, sgd, 1, DMA_FROM_DEVICE);
   404			}
   405			if (rctx->mode & RK_CRYPTO_DEC) {
   406				memcpy(iv, biv, ivsize);
   407				ivtouse = iv;
   408			} else {
   409				offset = sgd->length - ivsize;
   410				scatterwalk_map_and_copy(iv, sgd, offset, ivsize, 0);
   411				ivtouse = iv;
   412			}
   413			sgs = sg_next(sgs);
   414			sgd = sg_next(sgd);
   415			n++;
   416		}
   417	
   418		if (areq->iv && ivsize > 0) {
   419			offset = areq->cryptlen - ivsize;
   420			if (rctx->mode & RK_CRYPTO_DEC) {
   421				memcpy(areq->iv, rctx->backup_iv, ivsize);
   422				memzero_explicit(rctx->backup_iv, ivsize);
   423			} else {
   424				scatterwalk_map_and_copy(areq->iv, areq->dst, offset,
   425							 ivsize, 0);
   426			}
   427		}
   428	
   429	theend:
   430		local_bh_disable();
   431		crypto_finalize_skcipher_request(engine, areq, err);
   432		local_bh_enable();
   433		return 0;
   434	
   435	theend_sgs:
   436		if (sgs == sgd) {
   437			dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_BIDIRECTIONAL);
   438		} else {
   439			dma_unmap_sg(ctx->dev->dev, sgs, 1, DMA_TO_DEVICE);
   440			dma_unmap_sg(ctx->dev->dev, sgd, 1, DMA_FROM_DEVICE);
   441		}
   442	theend_iv:
   443		return err;
   444	}
   445	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

  reply	other threads:[~2022-04-02  8:23 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-01 20:17 [PATCH v4 00/33] crypto: rockchip: permit to pass self-tests Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 01/33] crypto: rockchip: use dev_err for error message about interrupt Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 02/33] crypto: rockchip: do not use uninitialized variable Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 03/33] crypto: rockchip: do not do custom power management Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 04/33] crypto: rockchip: fix privete/private typo Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 05/33] crypto: rockchip: do not store mode globally Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 06/33] crypto: rockchip: add fallback for cipher Corentin Labbe
2022-04-04 11:26   ` John Keeping
2022-04-11  8:42     ` LABBE Corentin
2022-04-01 20:17 ` [PATCH v4 07/33] crypto: rockchip: add fallback for ahash Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 08/33] crypto: rockchip: better handle cipher key Corentin Labbe
2022-04-04 11:31   ` John Keeping
2022-04-11  8:51     ` LABBE Corentin
2022-04-01 20:17 ` [PATCH v4 09/33] crypto: rockchip: remove non-aligned handling Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 10/33] crypto: rockchip: rework by using crypto_engine Corentin Labbe
2022-04-02  8:22   ` kernel test robot [this message]
2022-04-02 20:04     ` LABBE Corentin
2022-04-01 20:17 ` [PATCH v4 11/33] crypto: rockchip: rewrite type Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 12/33] crypto: rockchip: add debugfs Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 13/33] crypto: rockchip: introduce PM Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 14/33] crypto: rockchip: handle reset also in PM Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 15/33] crypto: rockchip: use clk_bulk to simplify clock management Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 16/33] crypto: rockchip: add myself as maintainer Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 17/33] crypto: rockchip: use read_poll_timeout Corentin Labbe
2022-04-04 11:38   ` John Keeping
2022-04-11  8:33     ` LABBE Corentin
2022-04-01 20:17 ` [PATCH v4 18/33] crypto: rockchip: fix style issue Corentin Labbe
2022-04-04 11:39   ` John Keeping
2022-04-11  7:40     ` LABBE Corentin
2022-04-01 20:17 ` [PATCH v4 19/33] crypto: rockchip: add support for rk3328 Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 20/33] crypto: rockchip: rename ablk functions to cipher Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 21/33] crypto: rockchip: rework rk_handle_req function Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 22/33] crypto: rockchip: use a rk_crypto_info variable instead of lot of indirection Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 23/33] crypto: rockchip: use the rk_crypto_info given as parameter Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 24/33] crypto: rockchip: rename crypto_info to main in TFM context Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 25/33] crypto: rockchip: store crypto_info in request context Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 26/33] crypto: rockchip: Add support for rk3399 Corentin Labbe
2022-04-01 20:17 ` [PATCH v4 27/33] dt-bindings: crypto: convert rockchip-crypto to yaml Corentin Labbe
2022-04-02 12:10   ` Krzysztof Kozlowski
2022-04-02 20:11     ` LABBE Corentin
2022-04-01 20:17 ` [PATCH v4 28/33] dt-bindings: crypto: rockchip: convert to new driver bindings Corentin Labbe
2022-04-02 11:53   ` Krzysztof Kozlowski
2022-04-02 12:07     ` Krzysztof Kozlowski
2022-04-03 18:58       ` LABBE Corentin
2022-04-02 20:10     ` LABBE Corentin
2022-04-02 20:19       ` Krzysztof Kozlowski
2022-04-01 20:18 ` [PATCH v4 29/33] clk: rk3399: use proper crypto0 name Corentin Labbe
2022-04-06 16:07   ` Rob Herring
2022-04-01 20:18 ` [PATCH v4 30/33] ARM: dts: rk3288: crypto does not need reset-names anymore Corentin Labbe
2022-04-01 20:18 ` [PATCH v4 31/33] arm64: dts: rockchip: add rk3328 crypto node Corentin Labbe
2022-04-01 20:18 ` [PATCH v4 32/33] arm64: dts: rockchip: rk3399: add " Corentin Labbe
2022-04-01 20:18 ` [PATCH v4 33/33] crypto: rockchip: Check for clocks numbers and their frequencies Corentin Labbe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202204021634.IhyHrjoT-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=clabbe@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=heiko@sntech.de \
    --cc=herbert@gondor.apana.org.au \
    --cc=kbuild-all@lists.01.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=llvm@lists.linux.dev \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).