[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202210221304.EEmIc53P-lkp@intel.com>
Date: Sat, 22 Oct 2022 13:17:11 +0800
From: kernel test robot <lkp@...el.com>
To: Lorenzo Bianconi <lorenzo@...nel.org>, netdev@...r.kernel.org
Cc: kbuild-all@...ts.01.org, nbd@....name, john@...ozen.org,
sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, matthias.bgg@...il.com,
linux-mediatek@...ts.infradead.org, lorenzo.bianconi@...hat.com,
Bo.Jiao@...iatek.com, sujuan.chen@...iatek.com,
ryder.Lee@...iatek.com, evelyn.tsai@...iatek.com,
devicetree@...r.kernel.org, robh@...nel.org, daniel@...rotopia.org
Subject: Re: [PATCH net-next 3/6] net: ethernet: mtk_wed: introduce wed mcu
support
Hi Lorenzo,
I love your patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
url: https://github.com/intel-lab-lkp/linux/commits/Lorenzo-Bianconi/introduce-WED-RX-support-to-MT7986-SoC/20221022-002107
patch link: https://lore.kernel.org/r/9aeb73670ec404e8e973ee65d7ff1dffb52086d6.1666368566.git.lorenzo%40kernel.org
patch subject: [PATCH net-next 3/6] net: ethernet: mtk_wed: introduce wed mcu support
config: mips-randconfig-s042-20221019
compiler: mips64el-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://github.com/intel-lab-lkp/linux/commit/af5454f36d5ae7d92606e48471a52bcbcb8a66d2
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Lorenzo-Bianconi/introduce-WED-RX-support-to-MT7986-SoC/20221022-002107
git checkout af5454f36d5ae7d92606e48471a52bcbcb8a66d2
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=mips SHELL=/bin/bash drivers/net/ethernet/mediatek/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/mediatek/mtk_wed_mcu.c:279:60: sparse: sparse: restricted __le32 degrades to integer
drivers/net/ethernet/mediatek/mtk_wed_mcu.c:282:55: sparse: sparse: restricted __le32 degrades to integer
drivers/net/ethernet/mediatek/mtk_wed_mcu.c:285:69: sparse: sparse: restricted __le32 degrades to integer
>> drivers/net/ethernet/mediatek/mtk_wed_mcu.c:289:52: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void *__to @@ got void [noderef] __iomem *addr @@
drivers/net/ethernet/mediatek/mtk_wed_mcu.c:289:52: sparse: expected void *__to
drivers/net/ethernet/mediatek/mtk_wed_mcu.c:289:52: sparse: got void [noderef] __iomem *addr
>> drivers/net/ethernet/mediatek/mtk_wed_mcu.c:290:46: sparse: sparse: incorrect type in argument 3 (different base types) @@ expected unsigned long [usertype] __n @@ got restricted __le32 const [usertype] len @@
drivers/net/ethernet/mediatek/mtk_wed_mcu.c:290:46: sparse: expected unsigned long [usertype] __n
drivers/net/ethernet/mediatek/mtk_wed_mcu.c:290:46: sparse: got restricted __le32 const [usertype] len
>> drivers/net/ethernet/mediatek/mtk_wed_mcu.c:298:24: sparse: sparse: invalid assignment: +=
>> drivers/net/ethernet/mediatek/mtk_wed_mcu.c:298:24: sparse: left side has type unsigned int
>> drivers/net/ethernet/mediatek/mtk_wed_mcu.c:298:24: sparse: right side has type restricted __le32
vim +279 drivers/net/ethernet/mediatek/mtk_wed_mcu.c
212
213 static int
214 mtk_wed_mcu_load_firmware(struct mtk_wed_wo *wo)
215 {
216 static struct mtk_wed_fw_region_meta fw_region[] = {
217 [MTK_WED_WO_FW_EMI] = {
218 .name = "mediatek,wocpu_emi",
219 },
220 [MTK_WED_WO_FW_ILM] = {
221 .name = "mediatek,wocpu_ilm",
222 },
223 [MTK_WED_WO_FW_DATA] = {
224 .name = "mediatek,wocpu_data",
225 .shared = true,
226 },
227 };
228 const struct mtk_wed_fw_trailer *trailer;
229 const struct mtk_wed_fw_region *region;
230 const u8 *region_ptr, *trailer_ptr;
231 u32 val, offset = 0, boot_cr;
232 const struct firmware *fw;
233 int ret, i, count = 0;
234 const char *fw_name;
235
236 /* load firmware region metadata */
237 for (i = 0; i < ARRAY_SIZE(fw_region); i++) {
238 ret = mtk_wed_get_firmware_metadata(wo, &fw_region[i]);
239 if (ret)
240 return ret;
241 }
242
243 wo->boot = syscon_regmap_lookup_by_phandle(wo->hw->node,
244 "mediatek,wocpu_boot");
245 if (IS_ERR_OR_NULL(wo->boot))
246 return PTR_ERR(wo->boot);
247
248 /* set dummy cr */
249 wed_w32(wo->hw->wed_dev, MTK_WED_SCR0 + 4 * MTK_WED_DUMMY_CR_FWDL,
250 wo->hw->index + 1);
251
252 /* load firmware */
253 fw_name = wo->hw->index ? MT7986_FIRMWARE_WO1 : MT7986_FIRMWARE_WO0;
254 ret = request_firmware(&fw, fw_name, wo->hw->dev);
255 if (ret)
256 return ret;
257
258 trailer_ptr = fw->data + fw->size - sizeof(*trailer);
259 trailer = (const struct mtk_wed_fw_trailer *)trailer_ptr;
260 dev_info(wo->hw->dev,
261 "MTK WED WO Firmware Version: %.10s, Build Time: %.15s\n",
262 trailer->fw_ver, trailer->build_date);
263 dev_info(wo->hw->dev, "MTK WED WO Chid ID %02x Region %d\n",
264 trailer->chip_id, trailer->num_region);
265
266 if (fw->size - sizeof(*trailer) < trailer->num_region * sizeof(*region)) {
267 dev_err(wo->hw->dev, "Invalid fw num_region %d\n",
268 trailer->num_region);
269 ret = -EINVAL;
270 goto out;
271 }
272
273 region_ptr = trailer_ptr - trailer->num_region * sizeof(*region);
274 while (region_ptr < trailer_ptr) {
275 int j;
276
277 region = (const struct mtk_wed_fw_region *)region_ptr;
278 for (j = 0; j < ARRAY_SIZE(fw_region); j++) {
> 279 if (fw_region[j].phy_addr != region->addr)
280 continue;
281
282 if (fw_region[j].size < region->len)
283 continue;
284
285 if (trailer_ptr < fw->data + offset + region->len)
286 continue;
287
288 if (!fw_region[j].shared || !fw_region[j].consumed) {
> 289 memcpy(fw_region[j].addr, fw->data + offset,
> 290 region->len);
291 fw_region[j].consumed = true;
292 count++;
293 } else if (fw_region[j].shared) {
294 count++;
295 }
296 }
297 region_ptr += sizeof(*region);
> 298 offset += region->len;
299 }
300
301 if (count != ARRAY_SIZE(fw_region)) {
302 dev_err(wo->hw->dev, "Failed to load firmware\n");
303 ret = -EINVAL;
304 goto out;
305 }
306
307 /* set the start address */
308 boot_cr = wo->hw->index ? MTK_WO_MCU_CFG_LS_WA_BOOT_ADDR_ADDR
309 : MTK_WO_MCU_CFG_LS_WM_BOOT_ADDR_ADDR;
310 wo_w32(wo, boot_cr, fw_region[MTK_WED_WO_FW_EMI].phy_addr >> 16);
311 /* wo firmware reset */
312 wo_w32(wo, MTK_WO_MCU_CFG_LS_WF_MCCR_CLR_ADDR, 0xc00);
313
314 val = wo_r32(wo, MTK_WO_MCU_CFG_LS_WF_MCU_CFG_WM_WA_ADDR);
315 val |= wo->hw->index ? MTK_WO_MCU_CFG_LS_WF_WM_WA_WA_CPU_RSTB_MASK
316 : MTK_WO_MCU_CFG_LS_WF_WM_WA_WM_CPU_RSTB_MASK;
317 wo_w32(wo, MTK_WO_MCU_CFG_LS_WF_MCU_CFG_WM_WA_ADDR, val);
318 out:
319 release_firmware(fw);
320
321 return ret;
322 }
323
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (202219 bytes)
Powered by blists - more mailing lists