Hi Scott, I love your patch! Perhaps something to improve: [auto build test WARNING on driver-core/driver-core-testing] [also build test WARNING on next-20200421] [cannot apply to char-misc/char-misc-testing kselftest/next linus/master v5.7-rc2] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Scott-Branden/firmware-add-partial-read-support-in-request_firmware_into_buf/20200422-114528 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 55623260bb33e2ab849af76edf2253bc04cb241f config: arc-allyesconfig (attached as .config) compiler: arc-elf-gcc (GCC) 9.3.0 reproduce: wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day GCC_VERSION=9.3.0 make.cross ARCH=arc If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot <lkp@xxxxxxxxx> All warnings (new ones prefixed by >>): In file included from include/linux/printk.h:326, from include/linux/kernel.h:15, from include/linux/delay.h:22, from drivers/misc/bcm-vk/bcm_vk_msg.c:6: drivers/misc/bcm-vk/bcm_vk_msg.c: In function 'bcm_vk_read': >> drivers/misc/bcm-vk/bcm_vk_msg.c:1096:15: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=] 1096 | dev_dbg(dev, "Buf count %ld\n", count); | ^~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call' 125 | func(&id, ##__VA_ARGS__); \ | ^~~~~~~~~~~ include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call' 157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:114:2: note: in expansion of macro 'dynamic_dev_dbg' 114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ include/linux/dev_printk.h:114:23: note: in expansion of macro 'dev_fmt' 114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ >> drivers/misc/bcm-vk/bcm_vk_msg.c:1096:2: note: in expansion of macro 'dev_dbg' 1096 | dev_dbg(dev, "Buf count %ld\n", count); | ^~~~~~~ drivers/misc/bcm-vk/bcm_vk_msg.c:1096:28: note: format string is defined here 1096 | dev_dbg(dev, "Buf count %ld\n", count); | ~~^ | | | long int | %d In file included from include/linux/printk.h:326, from include/linux/kernel.h:15, from include/linux/delay.h:22, from drivers/misc/bcm-vk/bcm_vk_msg.c:6: drivers/misc/bcm-vk/bcm_vk_msg.c: In function 'bcm_vk_write': drivers/misc/bcm-vk/bcm_vk_msg.c:1168:15: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'size_t' {aka 'unsigned int'} [-Wformat=] 1168 | dev_dbg(dev, "Msg count %ld\n", count); | ^~~~~~~~~~~~~~~~~ include/linux/dynamic_debug.h:125:15: note: in definition of macro '__dynamic_func_call' 125 | func(&id, ##__VA_ARGS__); \ | ^~~~~~~~~~~ include/linux/dynamic_debug.h:157:2: note: in expansion of macro '_dynamic_func_call' 157 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \ | ^~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:114:2: note: in expansion of macro 'dynamic_dev_dbg' 114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~~~~~~~~~ include/linux/dev_printk.h:114:23: note: in expansion of macro 'dev_fmt' 114 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~~~~~ drivers/misc/bcm-vk/bcm_vk_msg.c:1168:2: note: in expansion of macro 'dev_dbg' 1168 | dev_dbg(dev, "Msg count %ld\n", count); | ^~~~~~~ drivers/misc/bcm-vk/bcm_vk_msg.c:1168:28: note: format string is defined here 1168 | dev_dbg(dev, "Msg count %ld\n", count); | ~~^ | | | long int | %d In file included from include/linux/device.h:15, from include/linux/pci.h:37, from drivers/misc/bcm-vk/bcm_vk.h:11, from drivers/misc/bcm-vk/bcm_vk_msg.c:15: drivers/misc/bcm-vk/bcm_vk_msg.c:1172:16: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'size_t' {aka 'unsigned int'} [-Wformat=] 1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt' 19 | #define dev_fmt(fmt) fmt | ^~~ >> drivers/misc/bcm-vk/bcm_vk_msg.c:1172:3: note: in expansion of macro 'dev_err' 1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n", | ^~~~~~~ drivers/misc/bcm-vk/bcm_vk_msg.c:1172:37: note: format string is defined here 1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n", | ~~^ | | | long int | %d In file included from include/linux/device.h:15, from include/linux/pci.h:37, from drivers/misc/bcm-vk/bcm_vk.h:11, from drivers/misc/bcm-vk/bcm_vk_msg.c:15: >> drivers/misc/bcm-vk/bcm_vk_msg.c:1172:16: warning: format '%ld' expects argument of type 'long int', but argument 4 has type 'unsigned int' [-Wformat=] 1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ include/linux/dev_printk.h:19:22: note: in definition of macro 'dev_fmt' 19 | #define dev_fmt(fmt) fmt | ^~~ >> drivers/misc/bcm-vk/bcm_vk_msg.c:1172:3: note: in expansion of macro 'dev_err' 1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n", | ^~~~~~~ drivers/misc/bcm-vk/bcm_vk_msg.c:1172:57: note: format string is defined here 1172 | dev_err(dev, "Failure with size %ld not multiple of %ld\n", | ~~^ | | | long int | %d vim +1096 drivers/misc/bcm-vk/bcm_vk_msg.c 1076 1077 ssize_t bcm_vk_read(struct file *p_file, 1078 char __user *buf, 1079 size_t count, 1080 loff_t *f_pos) 1081 { 1082 ssize_t rc = -ENOMSG; 1083 struct bcm_vk_ctx *ctx = p_file->private_data; 1084 struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk, 1085 miscdev); 1086 struct device *dev = &vk->pdev->dev; 1087 struct bcm_vk_msg_chan *chan = &vk->to_h_msg_chan; 1088 struct bcm_vk_wkent *entry = NULL; 1089 uint32_t q_num; 1090 uint32_t rsp_length; 1091 bool found = false; 1092 1093 if (!bcm_vk_drv_access_ok(vk)) 1094 return -EPERM; 1095 > 1096 dev_dbg(dev, "Buf count %ld\n", count); 1097 found = false; 1098 1099 /* 1100 * search through the pendq on the to_h chan, and return only those 1101 * that belongs to the same context. Search is always from the high to 1102 * the low priority queues 1103 */ 1104 spin_lock(&chan->pendq_lock); 1105 for (q_num = 0; q_num < chan->q_nr; q_num++) { 1106 list_for_each_entry(entry, &chan->pendq[q_num], node) { 1107 if (entry->ctx->idx == ctx->idx) { 1108 if (count >= 1109 (entry->to_h_blks * VK_MSGQ_BLK_SIZE)) { 1110 list_del(&entry->node); 1111 ctx->pend_cnt--; 1112 found = true; 1113 } else { 1114 /* buffer not big enough */ 1115 rc = -EMSGSIZE; 1116 } 1117 goto read_loop_exit; 1118 } 1119 } 1120 } 1121 read_loop_exit: 1122 spin_unlock(&chan->pendq_lock); 1123 1124 if (found) { 1125 /* retrieve the passed down msg_id */ 1126 BCM_VK_SET_MSG_ID(&entry->to_h_msg[0], entry->usr_msg_id); 1127 rsp_length = entry->to_h_blks * VK_MSGQ_BLK_SIZE; 1128 if (copy_to_user(buf, entry->to_h_msg, rsp_length) == 0) 1129 rc = rsp_length; 1130 1131 bcm_vk_free_wkent(dev, entry); 1132 } else if (rc == -EMSGSIZE) { 1133 struct vk_msg_blk tmp_msg = entry->to_h_msg[0]; 1134 1135 /* 1136 * in this case, return just the first block, so 1137 * that app knows what size it is looking for. 1138 */ 1139 BCM_VK_SET_MSG_ID(&tmp_msg, entry->usr_msg_id); 1140 tmp_msg.size = entry->to_h_blks - 1; 1141 if (copy_to_user(buf, &tmp_msg, VK_MSGQ_BLK_SIZE) != 0) { 1142 dev_err(dev, "Error return 1st block in -EMSGSIZE\n"); 1143 rc = -EFAULT; 1144 } 1145 } 1146 return rc; 1147 } 1148 1149 ssize_t bcm_vk_write(struct file *p_file, 1150 const char __user *buf, 1151 size_t count, 1152 loff_t *f_pos) 1153 { 1154 ssize_t rc; 1155 struct bcm_vk_ctx *ctx = p_file->private_data; 1156 struct bcm_vk *vk = container_of(ctx->miscdev, struct bcm_vk, 1157 miscdev); 1158 struct bcm_vk_msgq *msgq; 1159 struct device *dev = &vk->pdev->dev; 1160 struct bcm_vk_wkent *entry; 1161 uint32_t sgl_extra_blks; 1162 uint32_t q_num; 1163 uint32_t msg_size; 1164 1165 if (!bcm_vk_drv_access_ok(vk)) 1166 return -EPERM; 1167 1168 dev_dbg(dev, "Msg count %ld\n", count); 1169 1170 /* first, do sanity check where count should be multiple of basic blk */ 1171 if (count & (VK_MSGQ_BLK_SIZE - 1)) { > 1172 dev_err(dev, "Failure with size %ld not multiple of %ld\n", 1173 count, VK_MSGQ_BLK_SIZE); 1174 rc = -EINVAL; 1175 goto write_err; 1176 } 1177 1178 /* allocate the work entry + buffer for size count and inband sgl */ 1179 entry = kzalloc(sizeof(*entry) + count + vk->ib_sgl_size, 1180 GFP_KERNEL); 1181 if (!entry) { 1182 rc = -ENOMEM; 1183 goto write_err; 1184 } 1185 1186 /* now copy msg from user space, and then formulate the work entry */ 1187 if (copy_from_user(&entry->to_v_msg[0], buf, count)) { 1188 rc = -EFAULT; 1189 goto write_free_ent; 1190 } 1191 1192 entry->to_v_blks = count >> VK_MSGQ_BLK_SZ_SHIFT; 1193 entry->ctx = ctx; 1194 1195 /* do a check on the blk size which could not exceed queue space */ 1196 q_num = BCM_VK_GET_Q(&entry->to_v_msg[0]); 1197 msgq = vk->to_v_msg_chan.msgq[q_num]; 1198 if (entry->to_v_blks + (vk->ib_sgl_size >> VK_MSGQ_BLK_SZ_SHIFT) 1199 > (msgq->size - 1)) { 1200 dev_err(dev, "Blk size %d exceed max queue size allowed %d\n", 1201 entry->to_v_blks, msgq->size - 1); 1202 rc = -EINVAL; 1203 goto write_free_ent; 1204 } 1205 1206 /* Use internal message id */ 1207 entry->usr_msg_id = BCM_VK_GET_MSG_ID(&entry->to_v_msg[0]); 1208 rc = bcm_vk_get_msg_id(vk); 1209 if (rc == VK_MSG_ID_OVERFLOW) { 1210 dev_err(dev, "msg_id overflow\n"); 1211 rc = -EOVERFLOW; 1212 goto write_free_ent; 1213 } 1214 BCM_VK_SET_MSG_ID(&entry->to_v_msg[0], rc); 1215 1216 dev_dbg(dev, 1217 "Message ctx id %d, usr_msg_id 0x%x sent msg_id 0x%x\n", 1218 ctx->idx, entry->usr_msg_id, 1219 BCM_VK_GET_MSG_ID(&entry->to_v_msg[0])); 1220 1221 /* Convert any pointers to sg list */ 1222 if (entry->to_v_msg[0].function_id == VK_FID_TRANS_BUF) { 1223 unsigned int num_planes; 1224 int dir; 1225 struct _vk_data *data; 1226 1227 /* 1228 * check if we are in reset, if so, no buffer transfer is 1229 * allowed and return error. 1230 */ 1231 if (vk->reset_pid) { 1232 dev_dbg(dev, "No Transfer allowed during reset, pid %d.\n", 1233 ctx->pid); 1234 rc = -EACCES; 1235 goto write_free_msgid; 1236 } 1237 1238 num_planes = entry->to_v_msg[0].args[0] & VK_CMD_PLANES_MASK; 1239 if ((entry->to_v_msg[0].args[0] & VK_CMD_MASK) 1240 == VK_CMD_DOWNLOAD) { 1241 dir = DMA_FROM_DEVICE; 1242 } else { 1243 dir = DMA_TO_DEVICE; 1244 } 1245 1246 /* Calculate vk_data location */ 1247 /* Go to end of the message */ 1248 msg_size = entry->to_v_msg[0].size; 1249 if (msg_size > entry->to_v_blks) { 1250 rc = -EMSGSIZE; 1251 goto write_free_msgid; 1252 } 1253 1254 data = (struct _vk_data *)&entry->to_v_msg[msg_size + 1]; 1255 1256 /* Now back up to the start of the pointers */ 1257 data -= num_planes; 1258 1259 /* Convert user addresses to DMA SG List */ 1260 rc = bcm_vk_sg_alloc(dev, entry->dma, dir, data, num_planes); 1261 if (rc) 1262 goto write_free_msgid; 1263 1264 /* try to embed inband sgl */ 1265 sgl_extra_blks = bcm_vk_append_ib_sgl(vk, entry, data, 1266 num_planes); 1267 entry->to_v_blks += sgl_extra_blks; 1268 entry->to_v_msg[0].size += sgl_extra_blks; 1269 } 1270 1271 /* 1272 * store work entry to pending queue until a response is received. 1273 * This needs to be done before enqueuing the message 1274 */ 1275 bcm_vk_append_pendq(&vk->to_v_msg_chan, q_num, entry); 1276 1277 rc = bcm_to_v_msg_enqueue(vk, entry); 1278 if (rc) { 1279 dev_err(dev, "Fail to enqueue msg to to_v queue\n"); 1280 1281 /* remove message from pending list */ 1282 entry = bcm_vk_dequeue_pending 1283 (vk, 1284 &vk->to_v_msg_chan, 1285 q_num, 1286 BCM_VK_GET_MSG_ID(&entry->to_v_msg[0])); 1287 goto write_free_ent; 1288 } 1289 1290 return count; 1291 1292 write_free_msgid: 1293 bcm_vk_msgid_bitmap_clear(vk, 1294 BCM_VK_GET_MSG_ID(&entry->to_v_msg[0]), 1); 1295 write_free_ent: 1296 kfree(entry); 1297 write_err: 1298 return rc; 1299 } 1300 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip