Message ID | 1b852d136031c4ca8af3bc2857fcc56d9c36fe58.1501498024.git.joe@perches.com (mailing list archive) |
---|---|
State | Not Applicable |
Delegated to: | Herbert Xu |
Headers | show |
Hi Joe, [auto build test WARNING on staging/staging-testing] [also build test WARNING on next-20170803] [cannot apply to v4.13-rc3] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Joe-Perches/staging-ccree-Fix-format-argument-mismatches/20170731-191055 config: m32r-allmodconfig (attached as .config) compiler: m32r-linux-gcc (GCC) 6.2.0 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=m32r All warnings (new ones prefixed by >>): In file included from include/linux/kernel.h:13:0, from drivers/staging/ccree/ssi_driver.c:17: drivers/staging/ccree/ssi_driver.c: In function 'init_cc_regs': >> drivers/staging/ccree/ssi_driver.c:180:16: warning: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=] SSI_LOG_DEBUG("AXIM_CFG=0x%08X\n", CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG))); ^ include/linux/printk.h:136:11: note: in definition of macro 'no_printk' printk(fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/ccree/ssi_driver.c:180:2: note: in expansion of macro 'SSI_LOG_DEBUG' SSI_LOG_DEBUG("AXIM_CFG=0x%08X\n", CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG))); ^~~~~~~~~~~~~ In file included from drivers/staging/ccree/ssi_driver.c:64:0: drivers/staging/ccree/ssi_driver.c: In function 'init_cc_resources': include/linux/kern_levels.h:4:18: warning: format '%X' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=] #define KERN_SOH "\001" /* ASCII Start Of Header */ ^ drivers/staging/ccree/ssi_driver.h:95:9: note: in definition of macro 'SSI_LOG' printk(level "cc715ree::%s: " format, __func__, ##__VA_ARGS__) ^~~~~ include/linux/kern_levels.h:13:19: note: in expansion of macro 'KERN_SOH' #define KERN_INFO KERN_SOH "6" /* informational */ ^~~~~~~~ drivers/staging/ccree/ssi_driver.c:319:10: note: in expansion of macro 'KERN_INFO' SSI_LOG(KERN_INFO, "ARM CryptoCell %s Driver: HW version 0x%08X, Driver version %s\n", SSI_DEV_NAME_STR, ^~~~~~~~~ vim +180 drivers/staging/ccree/ssi_driver.c abefd674 Gilad Ben-Yossef 2017-04-23 @17 #include <linux/kernel.h> abefd674 Gilad Ben-Yossef 2017-04-23 18 #include <linux/module.h> abefd674 Gilad Ben-Yossef 2017-04-23 19 abefd674 Gilad Ben-Yossef 2017-04-23 20 #include <linux/crypto.h> abefd674 Gilad Ben-Yossef 2017-04-23 21 #include <crypto/algapi.h> abefd674 Gilad Ben-Yossef 2017-04-23 22 #include <crypto/aes.h> abefd674 Gilad Ben-Yossef 2017-04-23 23 #include <crypto/sha.h> fe0a1951 Gilad Ben-Yossef 2017-04-23 24 #include <crypto/aead.h> abefd674 Gilad Ben-Yossef 2017-04-23 25 #include <crypto/authenc.h> abefd674 Gilad Ben-Yossef 2017-04-23 26 #include <crypto/scatterwalk.h> 302ef8eb Gilad Ben-Yossef 2017-04-23 27 #include <crypto/internal/skcipher.h> abefd674 Gilad Ben-Yossef 2017-04-23 28 abefd674 Gilad Ben-Yossef 2017-04-23 29 #include <linux/init.h> abefd674 Gilad Ben-Yossef 2017-04-23 30 #include <linux/moduleparam.h> abefd674 Gilad Ben-Yossef 2017-04-23 31 #include <linux/types.h> abefd674 Gilad Ben-Yossef 2017-04-23 32 #include <linux/random.h> abefd674 Gilad Ben-Yossef 2017-04-23 33 #include <linux/ioport.h> abefd674 Gilad Ben-Yossef 2017-04-23 34 #include <linux/interrupt.h> abefd674 Gilad Ben-Yossef 2017-04-23 35 #include <linux/fcntl.h> abefd674 Gilad Ben-Yossef 2017-04-23 36 #include <linux/poll.h> abefd674 Gilad Ben-Yossef 2017-04-23 37 #include <linux/proc_fs.h> abefd674 Gilad Ben-Yossef 2017-04-23 38 #include <linux/mutex.h> abefd674 Gilad Ben-Yossef 2017-04-23 39 #include <linux/sysctl.h> abefd674 Gilad Ben-Yossef 2017-04-23 40 #include <linux/fs.h> abefd674 Gilad Ben-Yossef 2017-04-23 41 #include <linux/cdev.h> abefd674 Gilad Ben-Yossef 2017-04-23 42 #include <linux/platform_device.h> abefd674 Gilad Ben-Yossef 2017-04-23 43 #include <linux/mm.h> abefd674 Gilad Ben-Yossef 2017-04-23 44 #include <linux/delay.h> abefd674 Gilad Ben-Yossef 2017-04-23 45 #include <linux/dma-mapping.h> abefd674 Gilad Ben-Yossef 2017-04-23 46 #include <linux/dmapool.h> abefd674 Gilad Ben-Yossef 2017-04-23 47 #include <linux/list.h> abefd674 Gilad Ben-Yossef 2017-04-23 48 #include <linux/slab.h> abefd674 Gilad Ben-Yossef 2017-04-23 49 #include <linux/spinlock.h> abefd674 Gilad Ben-Yossef 2017-04-23 50 #include <linux/pm.h> abefd674 Gilad Ben-Yossef 2017-04-23 51 abefd674 Gilad Ben-Yossef 2017-04-23 52 /* cache.h required for L1_CACHE_ALIGN() and cache_line_size() */ abefd674 Gilad Ben-Yossef 2017-04-23 53 #include <linux/cache.h> abefd674 Gilad Ben-Yossef 2017-04-23 54 #include <linux/io.h> abefd674 Gilad Ben-Yossef 2017-04-23 55 #include <linux/uaccess.h> abefd674 Gilad Ben-Yossef 2017-04-23 56 #include <linux/pagemap.h> abefd674 Gilad Ben-Yossef 2017-04-23 57 #include <linux/sched.h> abefd674 Gilad Ben-Yossef 2017-04-23 58 #include <linux/random.h> abefd674 Gilad Ben-Yossef 2017-04-23 59 #include <linux/of.h> 675ef02f Gilad Ben-Yossef 2017-06-25 60 #include <linux/clk.h> d255b343 Gilad Ben-Yossef 2017-06-25 61 #include <linux/of_address.h> abefd674 Gilad Ben-Yossef 2017-04-23 62 abefd674 Gilad Ben-Yossef 2017-04-23 63 #include "ssi_config.h" abefd674 Gilad Ben-Yossef 2017-04-23 64 #include "ssi_driver.h" abefd674 Gilad Ben-Yossef 2017-04-23 65 #include "ssi_request_mgr.h" abefd674 Gilad Ben-Yossef 2017-04-23 66 #include "ssi_buffer_mgr.h" abefd674 Gilad Ben-Yossef 2017-04-23 67 #include "ssi_sysfs.h" 302ef8eb Gilad Ben-Yossef 2017-04-23 68 #include "ssi_cipher.h" fe0a1951 Gilad Ben-Yossef 2017-04-23 69 #include "ssi_aead.h" 50cfbbb7 Gilad Ben-Yossef 2017-04-23 70 #include "ssi_hash.h" a4d826b9 Gilad Ben-Yossef 2017-04-23 71 #include "ssi_ivgen.h" abefd674 Gilad Ben-Yossef 2017-04-23 72 #include "ssi_sram_mgr.h" abefd674 Gilad Ben-Yossef 2017-04-23 73 #include "ssi_pm.h" b7e607bf Gilad Ben-Yossef 2017-07-11 74 #include "ssi_fips.h" abefd674 Gilad Ben-Yossef 2017-04-23 75 abefd674 Gilad Ben-Yossef 2017-04-23 76 #ifdef DX_DUMP_BYTES a1ab41eb Gilad Ben-Yossef 2017-05-07 77 void dump_byte_array(const char *name, const u8 *the_array, unsigned long size) abefd674 Gilad Ben-Yossef 2017-04-23 78 { abefd674 Gilad Ben-Yossef 2017-04-23 79 int i, line_offset = 0, ret = 0; a1ab41eb Gilad Ben-Yossef 2017-05-07 80 const u8 *cur_byte; abefd674 Gilad Ben-Yossef 2017-04-23 81 char line_buf[80]; abefd674 Gilad Ben-Yossef 2017-04-23 82 6191eb1d Gilad Ben-Yossef 2017-06-27 83 if (!the_array) { 4a457c17 Gilad Ben-Yossef 2017-07-27 84 SSI_LOG_ERR("cannot dump array - NULL pointer\n"); abefd674 Gilad Ben-Yossef 2017-04-23 85 return; abefd674 Gilad Ben-Yossef 2017-04-23 86 } abefd674 Gilad Ben-Yossef 2017-04-23 87 84264234 Simon Sandström 2017-07-02 88 ret = snprintf(line_buf, sizeof(line_buf), "%s[%lu]: ", name, size); abefd674 Gilad Ben-Yossef 2017-04-23 89 if (ret < 0) { abefd674 Gilad Ben-Yossef 2017-04-23 90 SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n", ret); abefd674 Gilad Ben-Yossef 2017-04-23 91 return; abefd674 Gilad Ben-Yossef 2017-04-23 92 } abefd674 Gilad Ben-Yossef 2017-04-23 93 line_offset = ret; abefd674 Gilad Ben-Yossef 2017-04-23 94 for (i = 0, cur_byte = the_array; abefd674 Gilad Ben-Yossef 2017-04-23 95 (i < size) && (line_offset < sizeof(line_buf)); i++, cur_byte++) { abefd674 Gilad Ben-Yossef 2017-04-23 96 ret = snprintf(line_buf + line_offset, abefd674 Gilad Ben-Yossef 2017-04-23 97 sizeof(line_buf) - line_offset, abefd674 Gilad Ben-Yossef 2017-04-23 98 "0x%02X ", *cur_byte); abefd674 Gilad Ben-Yossef 2017-04-23 99 if (ret < 0) { abefd674 Gilad Ben-Yossef 2017-04-23 100 SSI_LOG_ERR("snprintf returned %d . aborting buffer array dump\n", ret); abefd674 Gilad Ben-Yossef 2017-04-23 101 return; abefd674 Gilad Ben-Yossef 2017-04-23 102 } abefd674 Gilad Ben-Yossef 2017-04-23 103 line_offset += ret; abefd674 Gilad Ben-Yossef 2017-04-23 104 if (line_offset > 75) { /* Cut before line end */ abefd674 Gilad Ben-Yossef 2017-04-23 105 SSI_LOG_DEBUG("%s\n", line_buf); abefd674 Gilad Ben-Yossef 2017-04-23 106 line_offset = 0; abefd674 Gilad Ben-Yossef 2017-04-23 107 } abefd674 Gilad Ben-Yossef 2017-04-23 108 } abefd674 Gilad Ben-Yossef 2017-04-23 109 abefd674 Gilad Ben-Yossef 2017-04-23 110 if (line_offset > 0) /* Dump remaining line */ abefd674 Gilad Ben-Yossef 2017-04-23 111 SSI_LOG_DEBUG("%s\n", line_buf); abefd674 Gilad Ben-Yossef 2017-04-23 112 } abefd674 Gilad Ben-Yossef 2017-04-23 113 #endif abefd674 Gilad Ben-Yossef 2017-04-23 114 abefd674 Gilad Ben-Yossef 2017-04-23 115 static irqreturn_t cc_isr(int irq, void *dev_id) abefd674 Gilad Ben-Yossef 2017-04-23 116 { abefd674 Gilad Ben-Yossef 2017-04-23 117 struct ssi_drvdata *drvdata = (struct ssi_drvdata *)dev_id; abefd674 Gilad Ben-Yossef 2017-04-23 118 void __iomem *cc_base = drvdata->cc_base; a1ab41eb Gilad Ben-Yossef 2017-05-07 119 u32 irr; a1ab41eb Gilad Ben-Yossef 2017-05-07 120 u32 imr; abefd674 Gilad Ben-Yossef 2017-04-23 121 abefd674 Gilad Ben-Yossef 2017-04-23 122 /* STAT_OP_TYPE_GENERIC STAT_PHASE_0: Interrupt */ abefd674 Gilad Ben-Yossef 2017-04-23 123 abefd674 Gilad Ben-Yossef 2017-04-23 124 /* read the interrupt status */ abefd674 Gilad Ben-Yossef 2017-04-23 125 irr = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRR)); abefd674 Gilad Ben-Yossef 2017-04-23 126 SSI_LOG_DEBUG("Got IRR=0x%08X\n", irr); abefd674 Gilad Ben-Yossef 2017-04-23 127 if (unlikely(irr == 0)) { /* Probably shared interrupt line */ abefd674 Gilad Ben-Yossef 2017-04-23 128 SSI_LOG_ERR("Got interrupt with empty IRR\n"); abefd674 Gilad Ben-Yossef 2017-04-23 129 return IRQ_NONE; abefd674 Gilad Ben-Yossef 2017-04-23 130 } abefd674 Gilad Ben-Yossef 2017-04-23 131 imr = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR)); abefd674 Gilad Ben-Yossef 2017-04-23 132 abefd674 Gilad Ben-Yossef 2017-04-23 133 /* clear interrupt - must be before processing events */ abefd674 Gilad Ben-Yossef 2017-04-23 134 CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), irr); abefd674 Gilad Ben-Yossef 2017-04-23 135 abefd674 Gilad Ben-Yossef 2017-04-23 136 drvdata->irq = irr; abefd674 Gilad Ben-Yossef 2017-04-23 137 /* Completion interrupt - most probable */ abefd674 Gilad Ben-Yossef 2017-04-23 138 if (likely((irr & SSI_COMP_IRQ_MASK) != 0)) { abefd674 Gilad Ben-Yossef 2017-04-23 139 /* Mask AXI completion interrupt - will be unmasked in Deferred service handler */ abefd674 Gilad Ben-Yossef 2017-04-23 140 CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), imr | SSI_COMP_IRQ_MASK); abefd674 Gilad Ben-Yossef 2017-04-23 141 irr &= ~SSI_COMP_IRQ_MASK; abefd674 Gilad Ben-Yossef 2017-04-23 142 complete_request(drvdata); abefd674 Gilad Ben-Yossef 2017-04-23 143 } 16609980 Gilad Ben-Yossef 2017-04-23 144 #ifdef CC_SUPPORT_FIPS 16609980 Gilad Ben-Yossef 2017-04-23 145 /* TEE FIPS interrupt */ 16609980 Gilad Ben-Yossef 2017-04-23 146 if (likely((irr & SSI_GPR0_IRQ_MASK) != 0)) { 16609980 Gilad Ben-Yossef 2017-04-23 147 /* Mask interrupt - will be unmasked in Deferred service handler */ 16609980 Gilad Ben-Yossef 2017-04-23 148 CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), imr | SSI_GPR0_IRQ_MASK); 16609980 Gilad Ben-Yossef 2017-04-23 149 irr &= ~SSI_GPR0_IRQ_MASK; 16609980 Gilad Ben-Yossef 2017-04-23 150 fips_handler(drvdata); 16609980 Gilad Ben-Yossef 2017-04-23 151 } 16609980 Gilad Ben-Yossef 2017-04-23 152 #endif abefd674 Gilad Ben-Yossef 2017-04-23 153 /* AXI error interrupt */ abefd674 Gilad Ben-Yossef 2017-04-23 154 if (unlikely((irr & SSI_AXI_ERR_IRQ_MASK) != 0)) { a1ab41eb Gilad Ben-Yossef 2017-05-07 155 u32 axi_err; abefd674 Gilad Ben-Yossef 2017-04-23 156 abefd674 Gilad Ben-Yossef 2017-04-23 157 /* Read the AXI error ID */ abefd674 Gilad Ben-Yossef 2017-04-23 158 axi_err = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_MON_ERR)); abefd674 Gilad Ben-Yossef 2017-04-23 159 SSI_LOG_DEBUG("AXI completion error: axim_mon_err=0x%08X\n", axi_err); abefd674 Gilad Ben-Yossef 2017-04-23 160 abefd674 Gilad Ben-Yossef 2017-04-23 161 irr &= ~SSI_AXI_ERR_IRQ_MASK; abefd674 Gilad Ben-Yossef 2017-04-23 162 } abefd674 Gilad Ben-Yossef 2017-04-23 163 abefd674 Gilad Ben-Yossef 2017-04-23 164 if (unlikely(irr != 0)) { abefd674 Gilad Ben-Yossef 2017-04-23 165 SSI_LOG_DEBUG("IRR includes unknown cause bits (0x%08X)\n", irr); abefd674 Gilad Ben-Yossef 2017-04-23 166 /* Just warning */ abefd674 Gilad Ben-Yossef 2017-04-23 167 } abefd674 Gilad Ben-Yossef 2017-04-23 168 abefd674 Gilad Ben-Yossef 2017-04-23 169 return IRQ_HANDLED; abefd674 Gilad Ben-Yossef 2017-04-23 170 } abefd674 Gilad Ben-Yossef 2017-04-23 171 abefd674 Gilad Ben-Yossef 2017-04-23 172 int init_cc_regs(struct ssi_drvdata *drvdata, bool is_probe) abefd674 Gilad Ben-Yossef 2017-04-23 173 { d255b343 Gilad Ben-Yossef 2017-06-25 174 unsigned int val, cache_params; abefd674 Gilad Ben-Yossef 2017-04-23 175 void __iomem *cc_base = drvdata->cc_base; abefd674 Gilad Ben-Yossef 2017-04-23 176 abefd674 Gilad Ben-Yossef 2017-04-23 177 /* Unmask all AXI interrupt sources AXI_CFG1 register */ abefd674 Gilad Ben-Yossef 2017-04-23 178 val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG)); abefd674 Gilad Ben-Yossef 2017-04-23 179 CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG), val & ~SSI_AXI_IRQ_MASK); abefd674 Gilad Ben-Yossef 2017-04-23 @180 SSI_LOG_DEBUG("AXIM_CFG=0x%08X\n", CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG))); abefd674 Gilad Ben-Yossef 2017-04-23 181 abefd674 Gilad Ben-Yossef 2017-04-23 182 /* Clear all pending interrupts */ abefd674 Gilad Ben-Yossef 2017-04-23 183 val = CC_HAL_READ_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IRR)); abefd674 Gilad Ben-Yossef 2017-04-23 184 SSI_LOG_DEBUG("IRR=0x%08X\n", val); abefd674 Gilad Ben-Yossef 2017-04-23 185 CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_ICR), val); abefd674 Gilad Ben-Yossef 2017-04-23 186 abefd674 Gilad Ben-Yossef 2017-04-23 187 /* Unmask relevant interrupt cause */ abefd674 Gilad Ben-Yossef 2017-04-23 188 val = (~(SSI_COMP_IRQ_MASK | SSI_AXI_ERR_IRQ_MASK | SSI_GPR0_IRQ_MASK)); abefd674 Gilad Ben-Yossef 2017-04-23 189 CC_HAL_WRITE_REGISTER(CC_REG_OFFSET(HOST_RGF, HOST_IMR), val); abefd674 Gilad Ben-Yossef 2017-04-23 190 :::::: The code at line 180 was first introduced by commit :::::: abefd6741d540fc624e73a2a3bdef2397bcbd064 staging: ccree: introduce CryptoCell HW driver :::::: TO: Gilad Ben-Yossef <gilad@benyossef.com> :::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org> --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation
On Thu, 2017-08-03 at 17:09 +0800, kbuild test robot wrote: > Hi Joe, > > [auto build test WARNING on staging/staging-testing] > [also build test WARNING on next-20170803] > [cannot apply to v4.13-rc3] > [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] Pretty odd that m32r has ioread32 as _readl and so unsigned long Seems silly to have to cast it. Gilad, is this actually a supported platform for ccree? > url: https://github.com/0day-ci/linux/commits/Joe-Perches/staging-ccree-Fix-format-argument-mismatches/20170731-191055 > config: m32r-allmodconfig (attached as .config) > compiler: m32r-linux-gcc (GCC) 6.2.0 > reproduce: > wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # save the attached .config to linux build tree > make.cross ARCH=m32r > > All warnings (new ones prefixed by >>): > > In file included from include/linux/kernel.h:13:0, > from drivers/staging/ccree/ssi_driver.c:17: > drivers/staging/ccree/ssi_driver.c: In function 'init_cc_regs': > > > drivers/staging/ccree/ssi_driver.c:180:16: warning: format '%X' expects argument of type 'unsigned int', but argument 2 has type 'long unsigned int' [-Wformat=] > > SSI_LOG_DEBUG("AXIM_CFG=0x%08X\n", CC_HAL_READ_REGISTER(CC_REG_OFFSET(CRY_KERNEL, AXIM_CFG)));
On Thu, Aug 3, 2017 at 4:49 PM, Joe Perches <joe@perches.com> wrote: > On Thu, 2017-08-03 at 17:09 +0800, kbuild test robot wrote: >> Hi Joe, >> >> [auto build test WARNING on staging/staging-testing] >> [also build test WARNING on next-20170803] >> [cannot apply to v4.13-rc3] >> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] > > Pretty odd that m32r has ioread32 as _readl and so unsigned long > Seems silly to have to cast it. Yes, that does seem silly. > > Gilad, is this actually a supported platform for ccree? Yes, since CryptoCell can be baked into any silicon that can be made to talk AMBA, even though I don't know of a specific platform that carries both M32R cores and CryptoCell. That doesn't seem like a unique problem to ccree though, do other drivers do this cast? In that case, maybe we need to add a printk format like for dma addresses. I wanted to add the M32R kernel mailing list but it seems the arch has been orphaned and the web site is a a maze of twisty little 404s, all alike. Is that thing still alive? Gilad
diff --git a/drivers/staging/ccree/ssi_aead.c b/drivers/staging/ccree/ssi_aead.c index f5ca0e35c5d3..6664ade43b70 100644 --- a/drivers/staging/ccree/ssi_aead.c +++ b/drivers/staging/ccree/ssi_aead.c @@ -103,7 +103,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) if (ctx->enckey) { dma_free_coherent(dev, AES_MAX_KEY_SIZE, ctx->enckey, ctx->enckey_dma_addr); SSI_LOG_DEBUG("Freed enckey DMA buffer enckey_dma_addr=%pad\n", - ctx->enckey_dma_addr); + &ctx->enckey_dma_addr); ctx->enckey_dma_addr = 0; ctx->enckey = NULL; } @@ -117,7 +117,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) xcbc->xcbc_keys_dma_addr); } SSI_LOG_DEBUG("Freed xcbc_keys DMA buffer xcbc_keys_dma_addr=%pad\n", - xcbc->xcbc_keys_dma_addr); + &xcbc->xcbc_keys_dma_addr); xcbc->xcbc_keys_dma_addr = 0; xcbc->xcbc_keys = NULL; } else if (ctx->auth_mode != DRV_HASH_NULL) { /* HMAC auth. */ @@ -128,7 +128,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) hmac->ipad_opad, hmac->ipad_opad_dma_addr); SSI_LOG_DEBUG("Freed ipad_opad DMA buffer ipad_opad_dma_addr=%pad\n", - hmac->ipad_opad_dma_addr); + &hmac->ipad_opad_dma_addr); hmac->ipad_opad_dma_addr = 0; hmac->ipad_opad = NULL; } @@ -137,7 +137,7 @@ static void ssi_aead_exit(struct crypto_aead *tfm) hmac->padded_authkey, hmac->padded_authkey_dma_addr); SSI_LOG_DEBUG("Freed padded_authkey DMA buffer padded_authkey_dma_addr=%pad\n", - hmac->padded_authkey_dma_addr); + &hmac->padded_authkey_dma_addr); hmac->padded_authkey_dma_addr = 0; hmac->padded_authkey = NULL; } diff --git a/drivers/staging/ccree/ssi_buffer_mgr.c b/drivers/staging/ccree/ssi_buffer_mgr.c index 63936091d524..88b36477ce6d 100644 --- a/drivers/staging/ccree/ssi_buffer_mgr.c +++ b/drivers/staging/ccree/ssi_buffer_mgr.c @@ -14,6 +14,7 @@ * along with this program; if not, see <http://www.gnu.org/licenses/>. */ +#include <linux/kernel.h> #include <linux/crypto.h> #include <linux/version.h> #include <crypto/algapi.h> @@ -33,14 +34,10 @@ #include "ssi_hash.h" #include "ssi_aead.h" -#ifdef CC_DEBUG #define GET_DMA_BUFFER_TYPE(buff_type) ( \ ((buff_type) == SSI_DMA_BUF_NULL) ? "BUF_NULL" : \ ((buff_type) == SSI_DMA_BUF_DLLI) ? "BUF_DLLI" : \ ((buff_type) == SSI_DMA_BUF_MLLI) ? "BUF_MLLI" : "BUF_INVALID") -#else -#define GET_DMA_BUFFER_TYPE(buff_type) -#endif enum dma_buffer_type { DMA_NULL_TYPE = -1, @@ -262,7 +259,7 @@ static int ssi_buffer_mgr_generate_mlli( SSI_LOG_DEBUG("MLLI params: " "virt_addr=%pK dma_addr=%pad mlli_len=0x%X\n", mlli_params->mlli_virt_addr, - mlli_params->mlli_dma_addr, + &mlli_params->mlli_dma_addr, mlli_params->mlli_len); build_mlli_exit: @@ -278,7 +275,7 @@ static inline void ssi_buffer_mgr_add_buffer_entry( SSI_LOG_DEBUG("index=%u single_buff=%pad " "buffer_len=0x%08X is_last=%d\n", - index, buffer_dma, buffer_len, is_last_entry); + index, &buffer_dma, buffer_len, is_last_entry); sgl_data->nents[index] = 1; sgl_data->entry[index].buffer_dma = buffer_dma; sgl_data->offset[index] = 0; @@ -362,7 +359,7 @@ static int ssi_buffer_mgr_map_scatterlist( SSI_LOG_DEBUG("Mapped sg: dma_address=%pad " "page=%p addr=%pK offset=%u " "length=%u\n", - sg_dma_address(sg), + &sg_dma_address(sg), sg_page(sg), sg_virt(sg), sg->offset, sg->length); @@ -426,7 +423,7 @@ ssi_aead_handle_config_buf(struct device *dev, SSI_LOG_DEBUG("Mapped curr_buff: dma_address=%pad " "page=%p addr=%pK " "offset=%u length=%u\n", - sg_dma_address(&areq_ctx->ccm_adata_sg), + &sg_dma_address(&areq_ctx->ccm_adata_sg), sg_page(&areq_ctx->ccm_adata_sg), sg_virt(&areq_ctx->ccm_adata_sg), areq_ctx->ccm_adata_sg.offset, @@ -459,7 +456,7 @@ static inline int ssi_ahash_handle_curr_buf(struct device *dev, SSI_LOG_DEBUG("Mapped curr_buff: dma_address=%pad " "page=%p addr=%pK " "offset=%u length=%u\n", - sg_dma_address(areq_ctx->buff_sg), + &sg_dma_address(areq_ctx->buff_sg), sg_page(areq_ctx->buff_sg), sg_virt(areq_ctx->buff_sg), areq_ctx->buff_sg->offset, @@ -484,7 +481,7 @@ void ssi_buffer_mgr_unmap_blkcipher_request( if (likely(req_ctx->gen_ctx.iv_dma_addr != 0)) { SSI_LOG_DEBUG("Unmapped iv: iv_dma_addr=%pad iv_size=%u\n", - req_ctx->gen_ctx.iv_dma_addr, + &req_ctx->gen_ctx.iv_dma_addr, ivsize); dma_unmap_single(dev, req_ctx->gen_ctx.iv_dma_addr, ivsize, @@ -545,7 +542,7 @@ int ssi_buffer_mgr_map_blkcipher_request( } SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=%pad\n", ivsize, info, - req_ctx->gen_ctx.iv_dma_addr); + &req_ctx->gen_ctx.iv_dma_addr); } else { req_ctx->gen_ctx.iv_dma_addr = 0; } @@ -675,7 +672,7 @@ void ssi_buffer_mgr_unmap_aead_request( */ if (areq_ctx->mlli_params.curr_pool) { SSI_LOG_DEBUG("free MLLI buffer: dma=%pad virt=%pK\n", - areq_ctx->mlli_params.mlli_dma_addr, + &areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); dma_pool_free(areq_ctx->mlli_params.curr_pool, areq_ctx->mlli_params.mlli_virt_addr, @@ -794,7 +791,7 @@ static inline int ssi_buffer_mgr_aead_chain_iv( SSI_LOG_DEBUG("Mapped iv %u B at va=%pK to dma=%pad\n", hw_iv_size, req->iv, - areq_ctx->gen_ctx.iv_dma_addr); + &areq_ctx->gen_ctx.iv_dma_addr); if (do_chain && areq_ctx->plaintext_authenticate_only) { // TODO: what about CTR?? ask Ron struct crypto_aead *tfm = crypto_aead_reqtfm(req); unsigned int iv_size_to_authenc = crypto_aead_ivsize(tfm); @@ -1726,7 +1723,7 @@ void ssi_buffer_mgr_unmap_hash_request( */ if (areq_ctx->mlli_params.curr_pool) { SSI_LOG_DEBUG("free MLLI buffer: dma=%pad virt=%pK\n", - areq_ctx->mlli_params.mlli_dma_addr, + &areq_ctx->mlli_params.mlli_dma_addr, areq_ctx->mlli_params.mlli_virt_addr); dma_pool_free(areq_ctx->mlli_params.curr_pool, areq_ctx->mlli_params.mlli_virt_addr, @@ -1736,7 +1733,7 @@ void ssi_buffer_mgr_unmap_hash_request( if ((src) && likely(areq_ctx->in_nents != 0)) { SSI_LOG_DEBUG("Unmapped sg src: virt=%pK dma=%pad len=0x%X\n", sg_virt(src), - sg_dma_address(src), + &sg_dma_address(src), sg_dma_len(src)); dma_unmap_sg(dev, src, areq_ctx->in_nents, DMA_TO_DEVICE); @@ -1746,7 +1743,7 @@ void ssi_buffer_mgr_unmap_hash_request( SSI_LOG_DEBUG("Unmapped buffer: areq_ctx->buff_sg=%pK" " dma=%pad len 0x%X\n", sg_virt(areq_ctx->buff_sg), - sg_dma_address(areq_ctx->buff_sg), + &sg_dma_address(areq_ctx->buff_sg), sg_dma_len(areq_ctx->buff_sg)); dma_unmap_sg(dev, areq_ctx->buff_sg, 1, DMA_TO_DEVICE); if (!do_revert) { diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 6219a92184aa..d956b965a6b2 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -212,7 +212,7 @@ static int ssi_blkcipher_init(struct crypto_tfm *tfm) } SSI_LOG_DEBUG("Mapped key %u B at va=%pK to dma=%pad\n", max_key_buf_size, ctx_p->user.key, - ctx_p->user.key_dma_addr); + &ctx_p->user.key_dma_addr); if (ctx_p->cipher_mode == DRV_CIPHER_ESSIV) { /* Alloc hash tfm for essiv */ @@ -245,7 +245,7 @@ static void ssi_blkcipher_exit(struct crypto_tfm *tfm) dma_unmap_single(dev, ctx_p->user.key_dma_addr, max_key_buf_size, DMA_TO_DEVICE); SSI_LOG_DEBUG("Unmapped key buffer key_dma_addr=%pad\n", - ctx_p->user.key_dma_addr); + &ctx_p->user.key_dma_addr); /* Free key buffer in context */ kfree(ctx_p->user.key); @@ -621,9 +621,9 @@ ssi_blkcipher_create_data_desc( /* Process */ if (likely(req_ctx->dma_buf_type == SSI_DMA_BUF_DLLI)) { SSI_LOG_DEBUG(" data params addr %pad length 0x%X\n", - sg_dma_address(src), nbytes); + &sg_dma_address(src), nbytes); SSI_LOG_DEBUG(" data params addr %pad length 0x%X\n", - sg_dma_address(dst), nbytes); + &sg_dma_address(dst), nbytes); hw_desc_init(&desc[*seq_size]); set_din_type(&desc[*seq_size], DMA_DLLI, sg_dma_address(src), nbytes, NS_BIT); @@ -638,7 +638,7 @@ ssi_blkcipher_create_data_desc( /* bypass */ SSI_LOG_DEBUG(" bypass params addr %pad " "length 0x%X addr 0x%08X\n", - req_ctx->mlli_params.mlli_dma_addr, + &req_ctx->mlli_params.mlli_dma_addr, req_ctx->mlli_params.mlli_len, (unsigned int)ctx_p->drvdata->mlli_sram_addr); hw_desc_init(&desc[*seq_size]); diff --git a/drivers/staging/ccree/ssi_driver.c b/drivers/staging/ccree/ssi_driver.c index a4ab9ef4baf7..ad9b2cfac6d6 100644 --- a/drivers/staging/ccree/ssi_driver.c +++ b/drivers/staging/ccree/ssi_driver.c @@ -250,10 +250,9 @@ static int init_cc_resources(struct platform_device *plat_dev) rc = -ENODEV; goto init_cc_res_err; } - SSI_LOG_DEBUG("Got MEM resource (%s): start=%pad end=%pad\n", + SSI_LOG_DEBUG("Got MEM resource (%s): %pR\n", new_drvdata->res_mem->name, - new_drvdata->res_mem->start, - new_drvdata->res_mem->end); + new_drvdata->res_mem); /* Map registers space */ req_mem_cc_regs = request_mem_region(new_drvdata->res_mem->start, resource_size(new_drvdata->res_mem), "arm_cc7x_regs"); if (unlikely(!req_mem_cc_regs)) { diff --git a/drivers/staging/ccree/ssi_driver.h b/drivers/staging/ccree/ssi_driver.h index b6ad89ae9bee..69a523321306 100644 --- a/drivers/staging/ccree/ssi_driver.h +++ b/drivers/staging/ccree/ssi_driver.h @@ -100,7 +100,7 @@ #ifdef CC_DEBUG #define SSI_LOG_DEBUG(format, ...) SSI_LOG(KERN_DEBUG, format, ##__VA_ARGS__) #else /* Debug log messages are removed at compile time for non-DEBUG config. */ -#define SSI_LOG_DEBUG(format, ...) do {} while (0) +#define SSI_LOG_DEBUG(format, ...) no_printk(format, ##__VA_ARGS__) #endif #define MIN(a, b) (((a) < (b)) ? (a) : (b)) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index 1a405bbadf6d..b422f33c6240 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -1,4 +1,4 @@ -/* + /* * Copyright (C) 2012-2017 ARM Limited or its affiliates. * * This program is free software; you can redistribute it and/or modify @@ -141,7 +141,7 @@ static int ssi_hash_map_result(struct device *dev, SSI_LOG_DEBUG("Mapped digest result buffer %u B " "at va=%pK to dma=%pad\n", digestsize, state->digest_result_buff, - state->digest_result_dma_addr); + &state->digest_result_dma_addr); return 0; } @@ -205,7 +205,7 @@ static int ssi_hash_map_request(struct device *dev, } SSI_LOG_DEBUG("Mapped digest %d B at va=%pK to dma=%pad\n", ctx->inter_digestsize, state->digest_buff, - state->digest_buff_dma_addr); + &state->digest_buff_dma_addr); if (is_hmac) { dma_sync_single_for_cpu(dev, ctx->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); @@ -254,7 +254,7 @@ static int ssi_hash_map_request(struct device *dev, } SSI_LOG_DEBUG("Mapped digest len %u B at va=%pK to dma=%pad\n", HASH_LEN_SIZE, state->digest_bytes_len, - state->digest_bytes_len_dma_addr); + &state->digest_bytes_len_dma_addr); } else { state->digest_bytes_len_dma_addr = 0; } @@ -269,7 +269,7 @@ static int ssi_hash_map_request(struct device *dev, } SSI_LOG_DEBUG("Mapped opad digest %d B at va=%pK to dma=%pad\n", ctx->inter_digestsize, state->opad_digest_buff, - state->opad_digest_dma_addr); + &state->opad_digest_dma_addr); } else { state->opad_digest_dma_addr = 0; } @@ -317,21 +317,21 @@ static void ssi_hash_unmap_request(struct device *dev, dma_unmap_single(dev, state->digest_buff_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped digest-buffer: digest_buff_dma_addr=%pad\n", - state->digest_buff_dma_addr); + &state->digest_buff_dma_addr); state->digest_buff_dma_addr = 0; } if (state->digest_bytes_len_dma_addr != 0) { dma_unmap_single(dev, state->digest_bytes_len_dma_addr, HASH_LEN_SIZE, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped digest-bytes-len buffer: digest_bytes_len_dma_addr=%pad\n", - state->digest_bytes_len_dma_addr); + &state->digest_bytes_len_dma_addr); state->digest_bytes_len_dma_addr = 0; } if (state->opad_digest_dma_addr != 0) { dma_unmap_single(dev, state->opad_digest_dma_addr, ctx->inter_digestsize, DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped opad-digest: opad_digest_dma_addr=%pad\n", - state->opad_digest_dma_addr); + &state->opad_digest_dma_addr); state->opad_digest_dma_addr = 0; } @@ -355,7 +355,7 @@ static void ssi_hash_unmap_result(struct device *dev, SSI_LOG_DEBUG("unmpa digest result buffer " "va (%pK) pa (%pad) len %u\n", state->digest_result_buff, - state->digest_result_dma_addr, + &state->digest_result_dma_addr, digestsize); memcpy(result, state->digest_result_buff, @@ -999,7 +999,7 @@ static int ssi_hash_setkey(void *hash, return -ENOMEM; } SSI_LOG_DEBUG("mapping key-buffer: key_dma_addr=%pad " - "keylen=%u\n", ctx->key_params.key_dma_addr, + "keylen=%u\n", &ctx->key_params.key_dma_addr, ctx->key_params.keylen); if (keylen > blocksize) { @@ -1143,7 +1143,7 @@ static int ssi_hash_setkey(void *hash, ctx->key_params.key_dma_addr, ctx->key_params.keylen, DMA_TO_DEVICE); SSI_LOG_DEBUG("Unmapped key-buffer: key_dma_addr=%pad keylen=%u\n", - ctx->key_params.key_dma_addr, + &ctx->key_params.key_dma_addr, ctx->key_params.keylen); } return rc; @@ -1182,7 +1182,7 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, } SSI_LOG_DEBUG("mapping key-buffer: key_dma_addr=%pad " "keylen=%u\n", - ctx->key_params.key_dma_addr, + &ctx->key_params.key_dma_addr, ctx->key_params.keylen); ctx->is_hmac = true; @@ -1230,7 +1230,7 @@ static int ssi_xcbc_setkey(struct crypto_ahash *ahash, ctx->key_params.key_dma_addr, ctx->key_params.keylen, DMA_TO_DEVICE); SSI_LOG_DEBUG("Unmapped key-buffer: key_dma_addr=%pad keylen=%u\n", - ctx->key_params.key_dma_addr, + &ctx->key_params.key_dma_addr, ctx->key_params.keylen); return rc; @@ -1286,7 +1286,7 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) sizeof(ctx->digest_buff), DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped digest-buffer: " "digest_buff_dma_addr=%pad\n", - ctx->digest_buff_dma_addr); + &ctx->digest_buff_dma_addr); ctx->digest_buff_dma_addr = 0; } if (ctx->opad_tmp_keys_dma_addr != 0) { @@ -1295,7 +1295,7 @@ static void ssi_hash_free_ctx(struct ssi_hash_ctx *ctx) DMA_BIDIRECTIONAL); SSI_LOG_DEBUG("Unmapped opad-digest: " "opad_tmp_keys_dma_addr=%pad\n", - ctx->opad_tmp_keys_dma_addr); + &ctx->opad_tmp_keys_dma_addr); ctx->opad_tmp_keys_dma_addr = 0; } @@ -1316,7 +1316,7 @@ static int ssi_hash_alloc_ctx(struct ssi_hash_ctx *ctx) } SSI_LOG_DEBUG("Mapped digest %zu B at va=%pK to dma=%pad\n", sizeof(ctx->digest_buff), ctx->digest_buff, - ctx->digest_buff_dma_addr); + &ctx->digest_buff_dma_addr); ctx->opad_tmp_keys_dma_addr = dma_map_single(dev, (void *)ctx->opad_tmp_keys_buff, sizeof(ctx->opad_tmp_keys_buff), DMA_BIDIRECTIONAL); if (dma_mapping_error(dev, ctx->opad_tmp_keys_dma_addr)) { @@ -1327,7 +1327,7 @@ static int ssi_hash_alloc_ctx(struct ssi_hash_ctx *ctx) } SSI_LOG_DEBUG("Mapped opad_tmp_keys %zu B at va=%pK to dma=%pad\n", sizeof(ctx->opad_tmp_keys_buff), ctx->opad_tmp_keys_buff, - ctx->opad_tmp_keys_dma_addr); + &ctx->opad_tmp_keys_dma_addr); ctx->is_hmac = false; return 0; diff --git a/drivers/staging/ccree/ssi_request_mgr.c b/drivers/staging/ccree/ssi_request_mgr.c index 2eda82f317d2..4597aad9a96e 100644 --- a/drivers/staging/ccree/ssi_request_mgr.c +++ b/drivers/staging/ccree/ssi_request_mgr.c @@ -326,9 +326,9 @@ int send_request( if (ssi_req->ivgen_dma_addr_len > 0) { SSI_LOG_DEBUG("Acquire IV from pool into %d DMA addresses %pad, %pad, %pad, IV-size=%u\n", ssi_req->ivgen_dma_addr_len, - ssi_req->ivgen_dma_addr[0], - ssi_req->ivgen_dma_addr[1], - ssi_req->ivgen_dma_addr[2], + &ssi_req->ivgen_dma_addr[0], + &ssi_req->ivgen_dma_addr[1], + &ssi_req->ivgen_dma_addr[2], ssi_req->ivgen_size); /* Acquire IV from pool */
By default, debug logging is disabled by CC_DEBUG not being defined. Convert SSI_LOG_DEBUG to use no_printk instead of an empty define to validate formats and arguments. Fix fallout. Miscellanea: o One of the conversions now uses %pR instead of multiple uses of %pad Signed-off-by: Joe Perches <joe@perches.com> --- On top of next-20170731 drivers/staging/ccree/ssi_aead.c | 8 ++++---- drivers/staging/ccree/ssi_buffer_mgr.c | 29 +++++++++++++--------------- drivers/staging/ccree/ssi_cipher.c | 10 +++++----- drivers/staging/ccree/ssi_driver.c | 5 ++--- drivers/staging/ccree/ssi_driver.h | 2 +- drivers/staging/ccree/ssi_hash.c | 34 ++++++++++++++++----------------- drivers/staging/ccree/ssi_request_mgr.c | 6 +++--- 7 files changed, 45 insertions(+), 49 deletions(-)