Re: [PATCH v3 2/3] misc: bcm-vk: add Broadcom VK driver

From: kernel test robot
Date: Tue Aug 25 2020 - 19:16:58 EST


Hi Scott,

I love your patch! Yet something to improve:

[auto build test ERROR on char-misc/char-misc-testing]
[also build test ERROR on soc/for-next kees/for-next/pstore linus/master v5.9-rc2 next-20200825]
[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/Scott-Branden/Add-Broadcom-VK-driver/20200826-034531
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git d162219c655c8cf8003128a13840d6c1e183fb80
config: ia64-allmodconfig (attached as .config)
compiler: ia64-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=ia64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

drivers/misc/bcm-vk/bcm_vk_dev.c: In function 'bcm_vk_load_image_by_type':
>> drivers/misc/bcm-vk/bcm_vk_dev.c:592:8: error: implicit declaration of function 'request_partial_firmware_into_buf'; did you mean 'request_firmware_into_buf'? [-Werror=implicit-function-declaration]
592 | ret = request_partial_firmware_into_buf(&fw, filename, dev,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| request_firmware_into_buf
cc1: some warnings being treated as errors

# https://github.com/0day-ci/linux/commit/829bb182b6fcada015394adff99b914d9415c8b6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Scott-Branden/Add-Broadcom-VK-driver/20200826-034531
git checkout 829bb182b6fcada015394adff99b914d9415c8b6
vim +592 drivers/misc/bcm-vk/bcm_vk_dev.c

514
515 static int bcm_vk_load_image_by_type(struct bcm_vk *vk, uint32_t load_type,
516 const char *filename)
517 {
518 struct device *dev = &vk->pdev->dev;
519 const struct firmware *fw = NULL;
520 void *bufp = NULL;
521 size_t max_buf, offset;
522 int ret;
523 uint64_t offset_codepush;
524 uint32_t codepush;
525 uint32_t value;
526 dma_addr_t boot_dma_addr;
527 bool is_stdalone;
528
529 if (load_type == VK_IMAGE_TYPE_BOOT1) {
530 /*
531 * After POR, enable VK soft BOOTSRC so bootrom do not clear
532 * the pushed image (the TCM memories).
533 */
534 value = vkread32(vk, BAR_0, BAR_BOOTSRC_SELECT);
535 value |= BOOTSRC_SOFT_ENABLE;
536 vkwrite32(vk, value, BAR_0, BAR_BOOTSRC_SELECT);
537
538 codepush = CODEPUSH_BOOTSTART + CODEPUSH_BOOT1_ENTRY;
539 offset_codepush = BAR_CODEPUSH_SBL;
540
541 /* Write a 1 to request SRAM open bit */
542 vkwrite32(vk, CODEPUSH_BOOTSTART, BAR_0, offset_codepush);
543
544 /* Wait for VK to respond */
545 ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS, SRAM_OPEN,
546 SRAM_OPEN, LOAD_IMAGE_TIMEOUT_MS);
547 if (ret < 0) {
548 dev_err(dev, "boot1 wait SRAM err - ret(%d)\n", ret);
549 goto err_buf_out;
550 }
551
552 max_buf = SZ_256K;
553 bufp = dma_alloc_coherent(dev,
554 max_buf,
555 &boot_dma_addr, GFP_KERNEL);
556 if (!bufp) {
557 dev_err(dev, "Error allocating 0x%zx\n", max_buf);
558 ret = -ENOMEM;
559 goto err_buf_out;
560 }
561 } else if (load_type == VK_IMAGE_TYPE_BOOT2) {
562 codepush = CODEPUSH_BOOT2_ENTRY;
563 offset_codepush = BAR_CODEPUSH_SBI;
564
565 /* Wait for VK to respond */
566 ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS, DDR_OPEN,
567 DDR_OPEN, LOAD_IMAGE_TIMEOUT_MS);
568 if (ret < 0) {
569 dev_err(dev, "boot2 wait DDR open error - ret(%d)\n",
570 ret);
571 goto err_buf_out;
572 }
573
574 max_buf = SZ_4M;
575 bufp = dma_alloc_coherent(dev,
576 max_buf,
577 &boot_dma_addr, GFP_KERNEL);
578 if (!bufp) {
579 dev_err(dev, "Error allocating 0x%zx\n", max_buf);
580 ret = -ENOMEM;
581 goto err_buf_out;
582 }
583
584 bcm_vk_buf_notify(vk, bufp, boot_dma_addr, max_buf);
585 } else {
586 dev_err(dev, "Error invalid image type 0x%x\n", load_type);
587 ret = -EINVAL;
588 goto err_buf_out;
589 }
590
591 offset = 0;
> 592 ret = request_partial_firmware_into_buf(&fw, filename, dev,
593 bufp, max_buf, offset);
594 if (ret) {
595 dev_err(dev, "Error %d requesting firmware file: %s\n",
596 ret, filename);
597 goto err_firmware_out;
598 }
599 dev_dbg(dev, "size=0x%zx\n", fw->size);
600 if (load_type == VK_IMAGE_TYPE_BOOT1)
601 memcpy_toio(vk->bar[BAR_1] + BAR1_CODEPUSH_BASE_BOOT1,
602 bufp,
603 fw->size);
604
605 dev_dbg(dev, "Signaling 0x%x to 0x%llx\n", codepush, offset_codepush);
606 vkwrite32(vk, codepush, BAR_0, offset_codepush);
607
608 if (load_type == VK_IMAGE_TYPE_BOOT1) {
609 /* wait until done */
610 ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS,
611 BOOT1_RUNNING,
612 BOOT1_RUNNING,
613 BOOT1_STARTUP_TIMEOUT_MS);
614
615 is_stdalone = vkread32(vk, BAR_0, BAR_BOOT_STATUS) &
616 BOOT_STDALONE_RUNNING;
617 if (ret && !is_stdalone) {
618 dev_err(dev,
619 "Timeout %ld ms waiting for boot1 to come up - ret(%d)\n",
620 BOOT1_STARTUP_TIMEOUT_MS, ret);
621 goto err_firmware_out;
622 } else if (is_stdalone) {
623 uint32_t reg;
624
625 reg = vkread32(vk, BAR_0, BAR_BOOT1_STDALONE_PROGRESS);
626 if ((reg & BOOT1_STDALONE_PROGRESS_MASK) ==
627 BOOT1_STDALONE_SUCCESS) {
628 dev_info(dev, "Boot1 standalone success\n");
629 ret = 0;
630 } else {
631 dev_err(dev, "Timeout %ld ms - Boot1 standalone failure\n",
632 BOOT1_STARTUP_TIMEOUT_MS);
633 ret = -EINVAL;
634 goto err_firmware_out;
635 }
636 }
637 } else if (load_type == VK_IMAGE_TYPE_BOOT2) {
638 unsigned long timeout;
639
640 timeout = jiffies + msecs_to_jiffies(LOAD_IMAGE_TIMEOUT_MS);
641
642 /* To send more data to VK than max_buf allowed at a time */
643 do {
644 /*
645 * Check for ack from card. when Ack is received,
646 * it means all the data is received by card.
647 * Exit the loop after ack is received.
648 */
649 ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS,
650 FW_LOADER_ACK_RCVD_ALL_DATA,
651 FW_LOADER_ACK_RCVD_ALL_DATA,
652 TXFR_COMPLETE_TIMEOUT_MS);
653 if (ret == 0) {
654 dev_info(dev, "Exit boot2 download\n");
655 break;
656 } else if (ret == -EFAULT) {
657 dev_err(dev, "Error detected during ACK waiting");
658 goto err_firmware_out;
659 }
660
661 /* exit the loop, if there is no response from card */
662 if (time_after(jiffies, timeout)) {
663 dev_err(dev, "Error. No reply from card\n");
664 ret = -ETIMEDOUT;
665 goto err_firmware_out;
666 }
667
668 /* Wait for VK to open BAR space to copy new data */
669 ret = bcm_vk_wait(vk, BAR_0, offset_codepush,
670 codepush, 0,
671 TXFR_COMPLETE_TIMEOUT_MS);
672 if (ret == 0) {
673 offset += max_buf;
674 ret = request_partial_firmware_into_buf
675 (&fw,
676 filename,
677 dev, bufp,
678 max_buf,
679 offset);
680 if (ret) {
681 dev_err(dev,
682 "Error %d requesting firmware file: %s offset: 0x%zx\n",
683 ret, filename, offset);
684 goto err_firmware_out;
685 }
686 dev_dbg(dev, "size=0x%zx\n", fw->size);
687 dev_dbg(dev, "Signaling 0x%x to 0x%llx\n",
688 codepush, offset_codepush);
689 vkwrite32(vk, codepush, BAR_0, offset_codepush);
690 /* reload timeout after every codepush */
691 timeout = jiffies +
692 msecs_to_jiffies(LOAD_IMAGE_TIMEOUT_MS);
693 } else if (ret == -EFAULT) {
694 dev_err(dev, "Error detected waiting for transfer\n");
695 goto err_firmware_out;
696 }
697 } while (1);
698
699 /* wait for fw status bits to indicate app ready */
700 ret = bcm_vk_wait(vk, BAR_0, VK_BAR_FWSTS,
701 VK_FWSTS_READY,
702 VK_FWSTS_READY,
703 BOOT2_STARTUP_TIMEOUT_MS);
704 if (ret < 0) {
705 dev_err(dev, "Boot2 not ready - ret(%d)\n", ret);
706 goto err_firmware_out;
707 }
708
709 is_stdalone = vkread32(vk, BAR_0, BAR_BOOT_STATUS) &
710 BOOT_STDALONE_RUNNING;
711 if (!is_stdalone) {
712 ret = bcm_vk_intf_ver_chk(vk);
713 if (ret) {
714 dev_err(dev, "failure in intf version check\n");
715 goto err_firmware_out;
716 }
717
718 /*
719 * Next, initialize Message Q if we are loading boot2.
720 * Do a force sync
721 */
722 ret = bcm_vk_sync_msgq(vk, true);
723 if (ret) {
724 dev_err(dev, "Boot2 Error reading comm msg Q info\n");
725 ret = -EIO;
726 goto err_firmware_out;
727 }
728
729 /* sync & channel other info */
730 ret = bcm_vk_sync_card_info(vk);
731 if (ret) {
732 dev_err(dev, "Syncing Card Info failure\n");
733 goto err_firmware_out;
734 }
735 }
736 }
737
738 err_firmware_out:
739 release_firmware(fw);
740
741 err_buf_out:
742 if (bufp)
743 dma_free_coherent(dev, max_buf, bufp, boot_dma_addr);
744
745 return ret;
746 }
747

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip