Message ID | 20220228194037.1600509-14-clabbe@baylibre.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | crypto: rockchip: permit to pass self-tests | expand |
Hi Corentin, I love your patch! Perhaps something to improve: [auto build test WARNING on rockchip/for-next] [also build test WARNING on herbert-cryptodev-2.6/master herbert-crypto-2.6/master v5.17-rc6 next-20220228] [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/0day-ci/linux/commits/Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220301-035430 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next config: arm64-randconfig-r006-20220228 (https://download.01.org/0day-ci/archive/20220301/202203011017.qqb0tTar-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e) 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/0day-ci/linux/commit/03fb353165f76dc7c5ed7c27401537552070406b git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220301-035430 git checkout 03fb353165f76dc7c5ed7c27401537552070406b # 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.c:101:6: warning: data argument not used by format string [-Wformat-extra-args] rk_cipher_algs[i]->alg.skcipher.base.cra_driver_name); ^ include/linux/dev_printk.h:150:67: note: expanded from macro 'dev_info' dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__) ~~~ ^ include/linux/dev_printk.h:110:23: note: expanded from macro 'dev_printk_index_wrap' _p_func(dev, fmt, ##__VA_ARGS__); \ ~~~ ^ 1 warning generated. vim +101 drivers/crypto/rockchip/rk3288_crypto.c 89 90 static int rk_crypto_register(struct rk_crypto_info *crypto_info) 91 { 92 unsigned int i, k; 93 int err = 0; 94 95 for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) { 96 rk_cipher_algs[i]->dev = crypto_info; 97 switch (rk_cipher_algs[i]->type) { 98 case CRYPTO_ALG_TYPE_SKCIPHER: 99 dev_info(crypto_info->dev, "Register %s as\n", 100 rk_cipher_algs[i]->alg.skcipher.base.cra_name, > 101 rk_cipher_algs[i]->alg.skcipher.base.cra_driver_name); 102 err = crypto_register_skcipher(&rk_cipher_algs[i]->alg.skcipher); 103 break; 104 case CRYPTO_ALG_TYPE_AHASH: 105 dev_info(crypto_info->dev, "Register %s as %s\n", 106 rk_cipher_algs[i]->alg.hash.halg.base.cra_name, 107 rk_cipher_algs[i]->alg.hash.halg.base.cra_driver_name); 108 err = crypto_register_ahash(&rk_cipher_algs[i]->alg.hash); 109 break; 110 default: 111 dev_err(crypto_info->dev, "unknown algorithm\n"); 112 } 113 if (err) 114 goto err_cipher_algs; 115 } 116 return 0; 117 118 err_cipher_algs: 119 for (k = 0; k < i; k++) { 120 if (rk_cipher_algs[i]->type == CRYPTO_ALG_TYPE_SKCIPHER) 121 crypto_unregister_skcipher(&rk_cipher_algs[k]->alg.skcipher); 122 else 123 crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash); 124 } 125 return err; 126 } 127 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Corentin, I love your patch! Perhaps something to improve: [auto build test WARNING on rockchip/for-next] [also build test WARNING on herbert-cryptodev-2.6/master herbert-crypto-2.6/master v5.17-rc6 next-20220228] [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/0day-ci/linux/commits/Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220301-035430 base: https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git for-next config: arm-defconfig (https://download.01.org/0day-ci/archive/20220301/202203011055.8Y6mA9xW-lkp@intel.com/config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0 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 # https://github.com/0day-ci/linux/commit/03fb353165f76dc7c5ed7c27401537552070406b git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Corentin-Labbe/crypto-rockchip-permit-to-pass-self-tests/20220301-035430 git checkout 03fb353165f76dc7c5ed7c27401537552070406b # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm 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 >>): In file included from include/linux/device.h:15, from include/linux/dma-mapping.h:7, from drivers/crypto/rockchip/rk3288_crypto.h:8, from drivers/crypto/rockchip/rk3288_crypto.c:12: drivers/crypto/rockchip/rk3288_crypto.c: In function 'rk_crypto_register': >> drivers/crypto/rockchip/rk3288_crypto.c:99:52: warning: too many arguments for format [-Wformat-extra-args] 99 | dev_info(crypto_info->dev, "Register %s as\n", | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); \ | ^~~ include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt' 150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/crypto/rockchip/rk3288_crypto.c:99:25: note: in expansion of macro 'dev_info' 99 | dev_info(crypto_info->dev, "Register %s as\n", | ^~~~~~~~ vim +99 drivers/crypto/rockchip/rk3288_crypto.c > 12 #include "rk3288_crypto.h" 13 #include <linux/dma-mapping.h> 14 #include <linux/module.h> 15 #include <linux/platform_device.h> 16 #include <linux/of.h> 17 #include <linux/clk.h> 18 #include <linux/crypto.h> 19 #include <linux/reset.h> 20 21 static int rk_crypto_enable_clk(struct rk_crypto_info *dev) 22 { 23 int err; 24 25 err = clk_prepare_enable(dev->sclk); 26 if (err) { 27 dev_err(dev->dev, "[%s:%d], Couldn't enable clock sclk\n", 28 __func__, __LINE__); 29 goto err_return; 30 } 31 err = clk_prepare_enable(dev->aclk); 32 if (err) { 33 dev_err(dev->dev, "[%s:%d], Couldn't enable clock aclk\n", 34 __func__, __LINE__); 35 goto err_aclk; 36 } 37 err = clk_prepare_enable(dev->hclk); 38 if (err) { 39 dev_err(dev->dev, "[%s:%d], Couldn't enable clock hclk\n", 40 __func__, __LINE__); 41 goto err_hclk; 42 } 43 44 return err; 45 err_hclk: 46 clk_disable_unprepare(dev->aclk); 47 err_aclk: 48 clk_disable_unprepare(dev->sclk); 49 err_return: 50 return err; 51 } 52 53 static void rk_crypto_disable_clk(struct rk_crypto_info *dev) 54 { 55 clk_disable_unprepare(dev->hclk); 56 clk_disable_unprepare(dev->aclk); 57 clk_disable_unprepare(dev->sclk); 58 } 59 60 static irqreturn_t rk_crypto_irq_handle(int irq, void *dev_id) 61 { 62 struct rk_crypto_info *dev = platform_get_drvdata(dev_id); 63 u32 interrupt_status; 64 65 interrupt_status = CRYPTO_READ(dev, RK_CRYPTO_INTSTS); 66 CRYPTO_WRITE(dev, RK_CRYPTO_INTSTS, interrupt_status); 67 68 dev->status = 1; 69 if (interrupt_status & 0x0a) { 70 dev_warn(dev->dev, "DMA Error\n"); 71 dev->status = 0; 72 } 73 complete(&dev->complete); 74 75 return IRQ_HANDLED; 76 } 77 78 static struct rk_crypto_tmp *rk_cipher_algs[] = { 79 &rk_ecb_aes_alg, 80 &rk_cbc_aes_alg, 81 &rk_ecb_des_alg, 82 &rk_cbc_des_alg, 83 &rk_ecb_des3_ede_alg, 84 &rk_cbc_des3_ede_alg, 85 &rk_ahash_sha1, 86 &rk_ahash_sha256, 87 &rk_ahash_md5, 88 }; 89 90 static int rk_crypto_register(struct rk_crypto_info *crypto_info) 91 { 92 unsigned int i, k; 93 int err = 0; 94 95 for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) { 96 rk_cipher_algs[i]->dev = crypto_info; 97 switch (rk_cipher_algs[i]->type) { 98 case CRYPTO_ALG_TYPE_SKCIPHER: > 99 dev_info(crypto_info->dev, "Register %s as\n", 100 rk_cipher_algs[i]->alg.skcipher.base.cra_name, 101 rk_cipher_algs[i]->alg.skcipher.base.cra_driver_name); 102 err = crypto_register_skcipher(&rk_cipher_algs[i]->alg.skcipher); 103 break; 104 case CRYPTO_ALG_TYPE_AHASH: 105 dev_info(crypto_info->dev, "Register %s as %s\n", 106 rk_cipher_algs[i]->alg.hash.halg.base.cra_name, 107 rk_cipher_algs[i]->alg.hash.halg.base.cra_driver_name); 108 err = crypto_register_ahash(&rk_cipher_algs[i]->alg.hash); 109 break; 110 default: 111 dev_err(crypto_info->dev, "unknown algorithm\n"); 112 } 113 if (err) 114 goto err_cipher_algs; 115 } 116 return 0; 117 118 err_cipher_algs: 119 for (k = 0; k < i; k++) { 120 if (rk_cipher_algs[i]->type == CRYPTO_ALG_TYPE_SKCIPHER) 121 crypto_unregister_skcipher(&rk_cipher_algs[k]->alg.skcipher); 122 else 123 crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash); 124 } 125 return err; 126 } 127 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/crypto/rockchip/rk3288_crypto.c b/drivers/crypto/rockchip/rk3288_crypto.c index 645855d2651b..24a9e3fbf969 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.c +++ b/drivers/crypto/rockchip/rk3288_crypto.c @@ -94,12 +94,22 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info) for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) { rk_cipher_algs[i]->dev = crypto_info; - if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER) - err = crypto_register_skcipher( - &rk_cipher_algs[i]->alg.skcipher); - else - err = crypto_register_ahash( - &rk_cipher_algs[i]->alg.hash); + switch (rk_cipher_algs[i]->type) { + case CRYPTO_ALG_TYPE_SKCIPHER: + dev_info(crypto_info->dev, "Register %s as\n", + rk_cipher_algs[i]->alg.skcipher.base.cra_name, + rk_cipher_algs[i]->alg.skcipher.base.cra_driver_name); + err = crypto_register_skcipher(&rk_cipher_algs[i]->alg.skcipher); + break; + case CRYPTO_ALG_TYPE_AHASH: + dev_info(crypto_info->dev, "Register %s as %s\n", + rk_cipher_algs[i]->alg.hash.halg.base.cra_name, + rk_cipher_algs[i]->alg.hash.halg.base.cra_driver_name); + err = crypto_register_ahash(&rk_cipher_algs[i]->alg.hash); + break; + default: + dev_err(crypto_info->dev, "unknown algorithm\n"); + } if (err) goto err_cipher_algs; } @@ -107,7 +117,7 @@ static int rk_crypto_register(struct rk_crypto_info *crypto_info) err_cipher_algs: for (k = 0; k < i; k++) { - if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER) + if (rk_cipher_algs[i]->type == CRYPTO_ALG_TYPE_SKCIPHER) crypto_unregister_skcipher(&rk_cipher_algs[k]->alg.skcipher); else crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash); @@ -120,7 +130,7 @@ static void rk_crypto_unregister(void) unsigned int i; for (i = 0; i < ARRAY_SIZE(rk_cipher_algs); i++) { - if (rk_cipher_algs[i]->type == ALG_TYPE_CIPHER) + if (rk_cipher_algs[i]->type == CRYPTO_ALG_TYPE_SKCIPHER) crypto_unregister_skcipher(&rk_cipher_algs[i]->alg.skcipher); else crypto_unregister_ahash(&rk_cipher_algs[i]->alg.hash); diff --git a/drivers/crypto/rockchip/rk3288_crypto.h b/drivers/crypto/rockchip/rk3288_crypto.h index 963fbfc4d14e..c94ae950d2fa 100644 --- a/drivers/crypto/rockchip/rk3288_crypto.h +++ b/drivers/crypto/rockchip/rk3288_crypto.h @@ -231,18 +231,13 @@ struct rk_cipher_rctx { struct skcipher_request fallback_req; // keep at the end }; -enum alg_type { - ALG_TYPE_HASH, - ALG_TYPE_CIPHER, -}; - struct rk_crypto_tmp { + u32 type; struct rk_crypto_info *dev; union { struct skcipher_alg skcipher; struct ahash_alg hash; } alg; - enum alg_type type; }; extern struct rk_crypto_tmp rk_ecb_aes_alg; diff --git a/drivers/crypto/rockchip/rk3288_crypto_ahash.c b/drivers/crypto/rockchip/rk3288_crypto_ahash.c index b2417d40e178..87d6a03fa1bb 100644 --- a/drivers/crypto/rockchip/rk3288_crypto_ahash.c +++ b/drivers/crypto/rockchip/rk3288_crypto_ahash.c @@ -353,7 +353,7 @@ static void rk_cra_hash_exit(struct crypto_tfm *tfm) } struct rk_crypto_tmp rk_ahash_sha1 = { - .type = ALG_TYPE_HASH, + .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { .init = rk_ahash_init, .update = rk_ahash_update, @@ -383,7 +383,7 @@ struct rk_crypto_tmp rk_ahash_sha1 = { }; struct rk_crypto_tmp rk_ahash_sha256 = { - .type = ALG_TYPE_HASH, + .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { .init = rk_ahash_init, .update = rk_ahash_update, @@ -413,7 +413,7 @@ struct rk_crypto_tmp rk_ahash_sha256 = { }; struct rk_crypto_tmp rk_ahash_md5 = { - .type = ALG_TYPE_HASH, + .type = CRYPTO_ALG_TYPE_AHASH, .alg.hash = { .init = rk_ahash_init, .update = rk_ahash_update, diff --git a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c index e4e40fefa993..fe67ac6a911c 100644 --- a/drivers/crypto/rockchip/rk3288_crypto_skcipher.c +++ b/drivers/crypto/rockchip/rk3288_crypto_skcipher.c @@ -475,7 +475,7 @@ static void rk_ablk_exit_tfm(struct crypto_skcipher *tfm) } struct rk_crypto_tmp rk_ecb_aes_alg = { - .type = ALG_TYPE_CIPHER, + .type = CRYPTO_ALG_TYPE_SKCIPHER, .alg.skcipher = { .base.cra_name = "ecb(aes)", .base.cra_driver_name = "ecb-aes-rk", @@ -497,7 +497,7 @@ struct rk_crypto_tmp rk_ecb_aes_alg = { }; struct rk_crypto_tmp rk_cbc_aes_alg = { - .type = ALG_TYPE_CIPHER, + .type = CRYPTO_ALG_TYPE_SKCIPHER, .alg.skcipher = { .base.cra_name = "cbc(aes)", .base.cra_driver_name = "cbc-aes-rk", @@ -520,7 +520,7 @@ struct rk_crypto_tmp rk_cbc_aes_alg = { }; struct rk_crypto_tmp rk_ecb_des_alg = { - .type = ALG_TYPE_CIPHER, + .type = CRYPTO_ALG_TYPE_SKCIPHER, .alg.skcipher = { .base.cra_name = "ecb(des)", .base.cra_driver_name = "ecb-des-rk", @@ -542,7 +542,7 @@ struct rk_crypto_tmp rk_ecb_des_alg = { }; struct rk_crypto_tmp rk_cbc_des_alg = { - .type = ALG_TYPE_CIPHER, + .type = CRYPTO_ALG_TYPE_SKCIPHER, .alg.skcipher = { .base.cra_name = "cbc(des)", .base.cra_driver_name = "cbc-des-rk", @@ -565,7 +565,7 @@ struct rk_crypto_tmp rk_cbc_des_alg = { }; struct rk_crypto_tmp rk_ecb_des3_ede_alg = { - .type = ALG_TYPE_CIPHER, + .type = CRYPTO_ALG_TYPE_SKCIPHER, .alg.skcipher = { .base.cra_name = "ecb(des3_ede)", .base.cra_driver_name = "ecb-des3-ede-rk", @@ -587,7 +587,7 @@ struct rk_crypto_tmp rk_ecb_des3_ede_alg = { }; struct rk_crypto_tmp rk_cbc_des3_ede_alg = { - .type = ALG_TYPE_CIPHER, + .type = CRYPTO_ALG_TYPE_SKCIPHER, .alg.skcipher = { .base.cra_name = "cbc(des3_ede)", .base.cra_driver_name = "cbc-des3-ede-rk",
Instead of using a custom type for classify algorithms, let's just use already defined ones. And let's made a bit more verbose about what is registered. Signed-off-by: Corentin Labbe <clabbe@baylibre.com> --- drivers/crypto/rockchip/rk3288_crypto.c | 26 +++++++++++++------ drivers/crypto/rockchip/rk3288_crypto.h | 7 +---- drivers/crypto/rockchip/rk3288_crypto_ahash.c | 6 ++--- .../crypto/rockchip/rk3288_crypto_skcipher.c | 12 ++++----- 4 files changed, 28 insertions(+), 23 deletions(-)