Message ID | 20201124061053.10812-1-zhongguohua1@huawei.com |
---|---|
State | Superseded |
Headers | show |
Series | phram: Allow the user to set the erase page size. | expand |
Hi Guohua,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linus/master]
[also build test ERROR on v5.10-rc5 next-20201123]
[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/Guohua-Zhong/phram-Allow-the-user-to-set-the-erase-page-size/20201124-141421
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d5beb3140f91b1c8a3d41b14d729aefa4dcc58bc
config: microblaze-randconfig-r012-20201124 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.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/6ec7a653a663b6a638f767aa844a685fdd1463d2
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Guohua-Zhong/phram-Allow-the-user-to-set-the-erase-page-size/20201124-141421
git checkout 6ec7a653a663b6a638f767aa844a685fdd1463d2
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All errors (new ones prefixed by >>, old ones prefixed by <<):
>> ERROR: modpost: "__umoddi3" [drivers/mtd/devices/phram.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Guohua, Thank you for the patch! Yet something to improve: [auto build test ERROR on linus/master] [also build test ERROR on v5.10-rc5 next-20201123] [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/Guohua-Zhong/phram-Allow-the-user-to-set-the-erase-page-size/20201124-141421 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git d5beb3140f91b1c8a3d41b14d729aefa4dcc58bc config: i386-randconfig-r034-20201124 (attached as .config) compiler: gcc-9 (Debian 9.3.0-15) 9.3.0 reproduce (this is a W=1 build): # https://github.com/0day-ci/linux/commit/6ec7a653a663b6a638f767aa844a685fdd1463d2 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Guohua-Zhong/phram-Allow-the-user-to-set-the-erase-page-size/20201124-141421 git checkout 6ec7a653a663b6a638f767aa844a685fdd1463d2 # save the attached .config to linux build tree make W=1 ARCH=i386 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All errors (new ones prefixed by >>): ld: drivers/mtd/devices/phram.o: in function `phram_setup': >> drivers/mtd/devices/phram.c:266: undefined reference to `__umoddi3' vim +266 drivers/mtd/devices/phram.c 215 216 static int phram_setup(const char *val) 217 { 218 char buf[64 + 20 + 20 + 20], *str = buf; 219 char *token[4]; 220 char *name; 221 uint64_t start; 222 uint64_t len; 223 uint64_t erasesize = PAGE_SIZE; 224 int i, ret; 225 226 if (strnlen(val, sizeof(buf)) >= sizeof(buf)) 227 parse_err("parameter too long\n"); 228 229 strcpy(str, val); 230 kill_final_newline(str); 231 232 for (i = 0; i < 4; i++) 233 token[i] = strsep(&str, ","); 234 235 if (str) 236 parse_err("too many arguments\n"); 237 238 if (!token[2]) 239 parse_err("not enough arguments\n"); 240 241 ret = parse_name(&name, token[0]); 242 if (ret) 243 return ret; 244 245 ret = parse_num64(&start, token[1]); 246 if (ret) { 247 parse_err("illegal start address\n"); 248 goto error; 249 } 250 251 ret = parse_num64(&len, token[2]); 252 if (ret) { 253 parse_err("illegal device length\n"); 254 goto error; 255 } 256 257 if (token[3]) { 258 ret = parse_num64(&erasesize, token[3]); 259 if (ret) { 260 parse_err("illegal erasesize\n"); 261 goto error; 262 } 263 } 264 265 if (len == 0 || erasesize == 0 || erasesize > len > 266 || erasesize > UINT_MAX || len % erasesize != 0) { 267 parse_err("illegal erasesize or len\n"); 268 goto error; 269 } 270 271 ret = register_device(name, start, len, (uint32_t)erasesize); 272 if (ret) 273 goto error; 274 275 pr_info("%s device: %#llx at %#llx for erasesize %#llx\n", name, len, start, erasesize); 276 return 0; 277 278 error: 279 kfree(name); 280 return ret; 281 } 282 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff --git a/drivers/mtd/devices/phram.c b/drivers/mtd/devices/phram.c index 087b5e86d1bf..3ac766b65bf2 100644 --- a/drivers/mtd/devices/phram.c +++ b/drivers/mtd/devices/phram.c @@ -6,14 +6,14 @@ * Usage: * * one commend line parameter per device, each in the form: - * phram=<name>,<start>,<len> + * phram=<name>,<start>,<len>[,<erasesize>] * <name> may be up to 63 characters. - * <start> and <len> can be octal, decimal or hexadecimal. If followed + * <start>, <len>, and <erasesize> can be octal, decimal or hexadecimal. If followed * by "ki", "Mi" or "Gi", the numbers will be interpreted as kilo, mega or - * gigabytes. + * gigabytes. <erasesize> is optional and defaults to PAGE_SIZE. * * Example: - * phram=swap,64Mi,128Mi phram=test,900Mi,1Mi + * phram=swap,64Mi,128Mi phram=test,900Mi,1Mi,64Ki */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt @@ -88,7 +88,7 @@ static void unregister_devices(void) } } -static int register_device(char *name, phys_addr_t start, size_t len) +static int register_device(char *name, phys_addr_t start, size_t len, uint32_t erasesize) { struct phram_mtd_list *new; int ret = -ENOMEM; @@ -115,7 +115,7 @@ static int register_device(char *name, phys_addr_t start, size_t len) new->mtd._write = phram_write; new->mtd.owner = THIS_MODULE; new->mtd.type = MTD_RAM; - new->mtd.erasesize = PAGE_SIZE; + new->mtd.erasesize = erasesize; new->mtd.writesize = 1; ret = -EAGAIN; @@ -204,22 +204,23 @@ static inline void kill_final_newline(char *str) static int phram_init_called; /* * This shall contain the module parameter if any. It is of the form: - * - phram=<device>,<address>,<size> for module case - * - phram.phram=<device>,<address>,<size> for built-in case - * We leave 64 bytes for the device name, 20 for the address and 20 for the - * size. - * Example: phram.phram=rootfs,0xa0000000,512Mi + * - phram=<device>,<address>,<size>[,<erasesize>] for module case + * - phram.phram=<device>,<address>,<size>[,<erasesize>] for built-in case + * We leave 64 bytes for the device name, 20 for the address , 20 for the + * size and 20 for the erasesize. + * Example: phram.phram=rootfs,0xa0000000,512Mi,65536 */ -static char phram_paramline[64 + 20 + 20]; +static char phram_paramline[64 + 20 + 20 + 20]; #endif static int phram_setup(const char *val) { - char buf[64 + 20 + 20], *str = buf; - char *token[3]; + char buf[64 + 20 + 20 + 20], *str = buf; + char *token[4]; char *name; uint64_t start; uint64_t len; + uint64_t erasesize = PAGE_SIZE; int i, ret; if (strnlen(val, sizeof(buf)) >= sizeof(buf)) @@ -228,7 +229,7 @@ static int phram_setup(const char *val) strcpy(str, val); kill_final_newline(str); - for (i = 0; i < 3; i++) + for (i = 0; i < 4; i++) token[i] = strsep(&str, ","); if (str) @@ -253,11 +254,25 @@ static int phram_setup(const char *val) goto error; } - ret = register_device(name, start, len); + if (token[3]) { + ret = parse_num64(&erasesize, token[3]); + if (ret) { + parse_err("illegal erasesize\n"); + goto error; + } + } + + if (len == 0 || erasesize == 0 || erasesize > len + || erasesize > UINT_MAX || len % erasesize != 0) { + parse_err("illegal erasesize or len\n"); + goto error; + } + + ret = register_device(name, start, len, (uint32_t)erasesize); if (ret) goto error; - pr_info("%s device: %#llx at %#llx\n", name, len, start); + pr_info("%s device: %#llx at %#llx for erasesize %#llx\n", name, len, start, erasesize); return 0; error: @@ -298,7 +313,7 @@ static int phram_param_call(const char *val, const struct kernel_param *kp) } module_param_call(phram, phram_param_call, NULL, NULL, 0200); -MODULE_PARM_DESC(phram, "Memory region to map. \"phram=<name>,<start>,<length>\""); +MODULE_PARM_DESC(phram, "Memory region to map. \"phram=<name>,<start>,<length>[,<erasesize>]\""); static int __init init_phram(void)