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.8-rc7 next-20200731]
[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/20200730-054729
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git 
22362aa30bad6f03b5bcbbeee3cdc61950d40086
config: i386-allyesconfig (attached as .config)
compiler: gcc-9 (Debian 9.3.0-14) 9.3.0
reproduce (this is a W=1 build):
        # 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 <[email protected]>

All errors (new ones prefixed by >>):

   drivers/misc/bcm-vk/bcm_vk_dev.c:138:5: warning: no previous prototype for 
'bcm_vk_intf_ver_chk' [-Wmissing-prototypes]
     138 | int bcm_vk_intf_ver_chk(struct bcm_vk *vk)
         |     ^~~~~~~~~~~~~~~~~~~
   drivers/misc/bcm-vk/bcm_vk_dev.c: In function 'bcm_vk_load_image_by_type':
>> drivers/misc/bcm-vk/bcm_vk_dev.c:539:8: error: implicit declaration of 
>> function 'request_partial_firmware_into_buf'; did you mean 
>> 'request_firmware_into_buf'? [-Werror=implicit-function-declaration]
     539 |  ret = request_partial_firmware_into_buf(&fw, filename, dev,
         |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |        request_firmware_into_buf
   cc1: some warnings being treated as errors

vim +539 drivers/misc/bcm-vk/bcm_vk_dev.c

   462  
   463  static int bcm_vk_load_image_by_type(struct bcm_vk *vk, uint32_t 
load_type,
   464                                       const char *filename)
   465  {
   466          struct device *dev = &vk->pdev->dev;
   467          const struct firmware *fw = NULL;
   468          void *bufp = NULL;
   469          size_t max_buf, offset;
   470          int ret;
   471          uint64_t offset_codepush;
   472          uint32_t codepush;
   473          uint32_t value;
   474          dma_addr_t boot_dma_addr;
   475          bool is_stdalone;
   476  
   477          if (load_type == VK_IMAGE_TYPE_BOOT1) {
   478                  /*
   479                   * After POR, enable VK soft BOOTSRC so bootrom do not 
clear
   480                   * the pushed image (the TCM memories).
   481                   */
   482                  value = vkread32(vk, BAR_0, BAR_BOOTSRC_SELECT);
   483                  value |= BOOTSRC_SOFT_ENABLE;
   484                  vkwrite32(vk, value, BAR_0, BAR_BOOTSRC_SELECT);
   485  
   486                  codepush = CODEPUSH_BOOTSTART + CODEPUSH_BOOT1_ENTRY;
   487                  offset_codepush = BAR_CODEPUSH_SBL;
   488  
   489                  /* Write a 1 to request SRAM open bit */
   490                  vkwrite32(vk, CODEPUSH_BOOTSTART, BAR_0, 
offset_codepush);
   491  
   492                  /* Wait for VK to respond */
   493                  ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS, SRAM_OPEN,
   494                                    SRAM_OPEN, LOAD_IMAGE_TIMEOUT_MS);
   495                  if (ret < 0) {
   496                          dev_err(dev, "boot1 timeout\n");
   497                          goto err_buf_out;
   498                  }
   499  
   500                  max_buf = SZ_256K;
   501                  bufp = dma_alloc_coherent(dev,
   502                                            max_buf,
   503                                            &boot_dma_addr, GFP_KERNEL);
   504                  if (!bufp) {
   505                          dev_err(dev, "Error allocating 0x%zx\n", 
max_buf);
   506                          ret = -ENOMEM;
   507                          goto err_buf_out;
   508                  }
   509          } else if (load_type == VK_IMAGE_TYPE_BOOT2) {
   510                  codepush = CODEPUSH_BOOT2_ENTRY;
   511                  offset_codepush = BAR_CODEPUSH_SBI;
   512  
   513                  /* Wait for VK to respond */
   514                  ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS, DDR_OPEN,
   515                                    DDR_OPEN, LOAD_IMAGE_TIMEOUT_MS);
   516                  if (ret < 0) {
   517                          dev_err(dev, "boot2 timeout\n");
   518                          goto err_buf_out;
   519                  }
   520  
   521                  max_buf = SZ_4M;
   522                  bufp = dma_alloc_coherent(dev,
   523                                            max_buf,
   524                                            &boot_dma_addr, GFP_KERNEL);
   525                  if (!bufp) {
   526                          dev_err(dev, "Error allocating 0x%zx\n", 
max_buf);
   527                          ret = -ENOMEM;
   528                          goto err_buf_out;
   529                  }
   530  
   531                  bcm_vk_buf_notify(vk, bufp, boot_dma_addr, max_buf);
   532          } else {
   533                  dev_err(dev, "Error invalid image type 0x%x\n", 
load_type);
   534                  ret = -EINVAL;
   535                  goto err_buf_out;
   536          }
   537  
   538          offset = 0;
 > 539          ret = request_partial_firmware_into_buf(&fw, filename, dev,
   540                                                  bufp, max_buf, offset);
   541          if (ret) {
   542                  dev_err(dev, "Error %d requesting firmware file: %s\n",
   543                          ret, filename);
   544                  goto err_firmware_out;
   545          }
   546          dev_dbg(dev, "size=0x%zx\n", fw->size);
   547          if (load_type == VK_IMAGE_TYPE_BOOT1)
   548                  memcpy_toio(vk->bar[BAR_1] + BAR1_CODEPUSH_BASE_BOOT1,
   549                              bufp,
   550                              fw->size);
   551  
   552          dev_dbg(dev, "Signaling 0x%x to 0x%llx\n", codepush, 
offset_codepush);
   553          vkwrite32(vk, codepush, BAR_0, offset_codepush);
   554  
   555          if (load_type == VK_IMAGE_TYPE_BOOT1) {
   556                  /* wait until done */
   557                  ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS,
   558                                    BOOT1_RUNNING,
   559                                    BOOT1_RUNNING,
   560                                    BOOT1_STARTUP_TIMEOUT_MS);
   561  
   562                  is_stdalone = vkread32(vk, BAR_0, BAR_BOOT_STATUS) &
   563                                BOOT_STDALONE_RUNNING;
   564                  if (ret && !is_stdalone) {
   565                          dev_err(dev,
   566                                  "Timeout %ld ms waiting for boot1 to 
come up\n",
   567                                  BOOT1_STARTUP_TIMEOUT_MS);
   568                          goto err_firmware_out;
   569                  } else if (is_stdalone) {
   570                          uint32_t reg;
   571  
   572                          reg = vkread32(vk, BAR_0, 
BAR_BOOT1_STDALONE_PROGRESS);
   573                          if ((reg & BOOT1_STDALONE_PROGRESS_MASK) ==
   574                                       BOOT1_STDALONE_SUCCESS) {
   575                                  dev_info(dev, "Boot1 standalone 
success\n");
   576                                  ret = 0;
   577                          } else {
   578                                  dev_err(dev, "Timeout %ld ms - Boot1 
standalone failure\n",
   579                                          BOOT1_STARTUP_TIMEOUT_MS);
   580                                  ret = -EINVAL;
   581                                  goto err_firmware_out;
   582                          }
   583                  }
   584          } else if (load_type == VK_IMAGE_TYPE_BOOT2) {
   585                  unsigned long timeout;
   586  
   587                  timeout = jiffies + 
msecs_to_jiffies(LOAD_IMAGE_TIMEOUT_MS);
   588  
   589                  /* To send more data to VK than max_buf allowed at a 
time */
   590                  do {
   591                          /*
   592                           * Check for ack from card. when Ack is 
received,
   593                           * it means all the data is received by card.
   594                           * Exit the loop after ack is received.
   595                           */
   596                          ret = bcm_vk_wait(vk, BAR_0, BAR_BOOT_STATUS,
   597                                            FW_LOADER_ACK_RCVD_ALL_DATA,
   598                                            FW_LOADER_ACK_RCVD_ALL_DATA,
   599                                            TXFR_COMPLETE_TIMEOUT_MS);
   600                          if (ret == 0) {
   601                                  dev_info(dev, "Exit boot2 download\n");
   602                                  break;
   603                          }
   604  
   605                          /* exit the loop, if there is no response from 
card */
   606                          if (time_after(jiffies, timeout)) {
   607                                  dev_err(dev, "Error. No reply from 
card\n");
   608                                  ret = -ETIMEDOUT;
   609                                  goto err_firmware_out;
   610                          }
   611  
   612                          /* Wait for VK to open BAR space to copy new 
data */
   613                          ret = bcm_vk_wait(vk, BAR_0, offset_codepush,
   614                                            codepush, 0,
   615                                            TXFR_COMPLETE_TIMEOUT_MS);
   616                          if (ret == 0) {
   617                                  offset += max_buf;
   618                                  ret = request_partial_firmware_into_buf
   619                                                  (&fw,
   620                                                   filename,
   621                                                   dev, bufp,
   622                                                   max_buf,
   623                                                   offset);
   624                                  if (ret) {
   625                                          dev_err(dev,
   626                                                  "Error %d requesting 
firmware file: %s offset: 0x%zx\n",
   627                                                  ret, filename, offset);
   628                                          goto err_firmware_out;
   629                                  }
   630                                  dev_dbg(dev, "size=0x%zx\n", fw->size);
   631                                  dev_dbg(dev, "Signaling 0x%x to 
0x%llx\n",
   632                                          codepush, offset_codepush);
   633                                  vkwrite32(vk, codepush, BAR_0, 
offset_codepush);
   634                                  /* reload timeout after every codepush 
*/
   635                                  timeout = jiffies +
   636                                      
msecs_to_jiffies(LOAD_IMAGE_TIMEOUT_MS);
   637                          }
   638                  } while (1);
   639  
   640                  /* wait for fw status bits to indicate app ready */
   641                  ret = bcm_vk_wait(vk, BAR_0, VK_BAR_FWSTS,
   642                                    VK_FWSTS_READY,
   643                                    VK_FWSTS_READY,
   644                                    BOOT2_STARTUP_TIMEOUT_MS);
   645                  if (ret < 0) {
   646                          dev_err(dev, "Boot2 not ready - timeout\n");
   647                          goto err_firmware_out;
   648                  }
   649  
   650                  is_stdalone = vkread32(vk, BAR_0, BAR_BOOT_STATUS) &
   651                                BOOT_STDALONE_RUNNING;
   652                  if (!is_stdalone) {
   653                          ret = bcm_vk_intf_ver_chk(vk);
   654                          if (ret) {
   655                                  dev_err(dev, "failure in intf version 
check\n");
   656                                  goto err_firmware_out;
   657                          }
   658  
   659                          /*
   660                           * Next, initialize Message Q if we are loading 
boot2.
   661                           * Do a force sync
   662                           */
   663                          ret = bcm_vk_sync_msgq(vk, true);
   664                          if (ret) {
   665                                  dev_err(dev, "Boot2 Error reading comm 
msg Q info\n");
   666                                  ret = -EIO;
   667                                  goto err_firmware_out;
   668                          }
   669  
   670                          /* sync & channel other info */
   671                          ret = bcm_vk_sync_card_info(vk);
   672                          if (ret) {
   673                                  dev_err(dev, "Syncing Card Info 
failure\n");
   674                                  goto err_firmware_out;
   675                          }
   676                  }
   677          }
   678  
   679  err_firmware_out:
   680          release_firmware(fw);
   681  
   682  err_buf_out:
   683          if (bufp)
   684                  dma_free_coherent(dev, max_buf, bufp, boot_dma_addr);
   685  
   686          return ret;
   687  }
   688  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

Reply via email to