Re: [PATCH v2 08/14] qla2xxx: Add support for multiple fwdump templates/segments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Joe,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on scsi/for-next]
[cannot apply to v5.0]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Himanshu-Madhani/qla2xxx-Add-support-for-ISP28XX-Gen7-adapter/20190309-120215
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi.git for-next
config: sparc64-allyesconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 8.2.0-11) 8.2.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
        GCC_VERSION=8.2.0 make.cross ARCH=sparc64 

All warnings (new ones prefixed by >>):

   drivers/scsi/qla2xxx/qla_init.c: In function 'qla24xx_load_risc_blob':
>> drivers/scsi/qla2xxx/qla_init.c:7658:42: warning: format '%x' expects argument of type 'unsigned int', but argument 7 has type 'long int' [-Wformat=]
           "-> Loading fragment %u: %#x <- %#x (%#lx words)...\n",
                                           ~~^
                                           %#lx
   drivers/scsi/qla2xxx/qla_init.c:7660:8:
           fwcode - (typeof(fwcode))blob->fw->data, dlen);
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/scsi/qla2xxx/qla_init.c:7692:38: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'long int' [-Wformat=]
          "-> fwdt%u template array at %#x (%#x dwords)\n",
                                       ~~^
                                       %#lx
          j, (void *)fwcode - (void *)blob->fw->data, risc_size);
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

vim +7658 drivers/scsi/qla2xxx/qla_init.c

  7586	
  7587	static int
  7588	qla24xx_load_risc_blob(scsi_qla_host_t *vha, uint32_t *srisc_addr)
  7589	{
  7590		int	rval;
  7591		uint templates, segments, fragment;
  7592		uint32_t *dcode;
  7593		ulong dlen;
  7594		uint32_t risc_addr, risc_size, risc_attr = 0;
  7595		ulong i;
  7596		uint j;
  7597		struct fw_blob *blob;
  7598		uint32_t *fwcode;
  7599		struct qla_hw_data *ha = vha->hw;
  7600		struct req_que *req = ha->req_q_map[0];
  7601		struct fwdt *fwdt = ha->fwdt;
  7602	
  7603		ql_dbg(ql_dbg_init, vha, 0x0090,
  7604		    "-> FW: Loading via request-firmware.\n");
  7605	
  7606		blob = qla2x00_request_firmware(vha);
  7607		if (!blob) {
  7608			ql_log(ql_log_warn, vha, 0x0092,
  7609			    "-> Firmware file not found.\n");
  7610	
  7611			return QLA_FUNCTION_FAILED;
  7612		}
  7613	
  7614		fwcode = (void *)blob->fw->data;
  7615		dcode = fwcode + 4;
  7616		if (qla24xx_risc_firmware_invalid(dcode)) {
  7617			ql_log(ql_log_fatal, vha, 0x0093,
  7618			    "Unable to verify integrity of firmware image (%zd).\n",
  7619			    blob->fw->size);
  7620			return QLA_FUNCTION_FAILED;
  7621		}
  7622		for (i = 0; i < 4; i++)
  7623			dcode[i] = be32_to_cpu(fwcode[i + 4]);
  7624		if ((dcode[0] == 0xffffffff && dcode[1] == 0xffffffff &&
  7625		    dcode[2] == 0xffffffff && dcode[3] == 0xffffffff) ||
  7626		    (dcode[0] == 0 && dcode[1] == 0 && dcode[2] == 0 &&
  7627			dcode[3] == 0)) {
  7628			ql_log(ql_log_fatal, vha, 0x0094,
  7629			    "Unable to verify integrity of firmware image (%zd).\n",
  7630			    blob->fw->size);
  7631			ql_log(ql_log_fatal, vha, 0x0095,
  7632			    "Firmware data: %08x %08x %08x %08x.\n",
  7633			    dcode[0], dcode[1], dcode[2], dcode[3]);
  7634			return QLA_FUNCTION_FAILED;
  7635		}
  7636	
  7637		dcode = (void *)req->ring;
  7638		*srisc_addr = 0;
  7639		segments = FA_RISC_CODE_SEGMENTS;
  7640		for (j = 0; j < segments; j++) {
  7641			ql_dbg(ql_dbg_init, vha, 0x0096,
  7642			    "-> Loading segment %u...\n", j);
  7643			risc_addr = be32_to_cpu(fwcode[2]);
  7644			risc_size = be32_to_cpu(fwcode[3]);
  7645	
  7646			if (!*srisc_addr) {
  7647				*srisc_addr = risc_addr;
  7648				risc_attr = be32_to_cpu(fwcode[9]);
  7649			}
  7650	
  7651			dlen = ha->fw_transfer_size >> 2;
  7652			for (fragment = 0; risc_size; fragment++) {
  7653				dlen = (uint32_t)(ha->fw_transfer_size >> 2);
  7654				if (dlen > risc_size)
  7655					dlen = risc_size;
  7656	
  7657				ql_dbg(ql_dbg_init, vha, 0x0097,
> 7658				    "-> Loading fragment %u: %#x <- %#x (%#lx words)...\n",
  7659				    fragment, risc_addr,
  7660				    fwcode - (typeof(fwcode))blob->fw->data, dlen);
  7661	
  7662				for (i = 0; i < dlen; i++)
  7663					dcode[i] = swab32(fwcode[i]);
  7664	
  7665				rval = qla2x00_load_ram(vha, req->dma, risc_addr, dlen);
  7666				if (rval) {
  7667					ql_log(ql_log_fatal, vha, 0x0098,
  7668					    "-> Failed load firmware fragment %u.\n",
  7669					    fragment);
  7670					return QLA_FUNCTION_FAILED;
  7671				}
  7672	
  7673				fwcode += dlen;
  7674				risc_addr += dlen;
  7675				risc_size -= dlen;
  7676			}
  7677		}
  7678	
  7679		if (!IS_QLA27XX(ha) && !IS_QLA28XX(ha))
  7680			return QLA_SUCCESS;
  7681	
  7682		templates = (risc_attr & BIT_9) ? 2 : 1;
  7683		ql_dbg(ql_dbg_init, vha, 0x0170, "-> templates = %u\n", templates);
  7684		for (j = 0; j < templates; j++, fwdt++) {
  7685			if (fwdt->template)
  7686				vfree(fwdt->template);
  7687			fwdt->template = NULL;
  7688			fwdt->length = 0;
  7689	
  7690			risc_size = be32_to_cpu(fwcode[2]);
  7691			ql_dbg(ql_dbg_init, vha, 0x0171,
  7692			    "-> fwdt%u template array at %#x (%#x dwords)\n",
  7693			    j, (void *)fwcode - (void *)blob->fw->data, risc_size);
  7694			if (!risc_size || !~risc_size) {
  7695				ql_dbg(ql_dbg_init, vha, 0x0172,
  7696				    "-> fwdt%u failed to read array\n", j);
  7697				goto failed;
  7698			}
  7699	
  7700			/* skip header and ignore checksum */
  7701			fwcode += 7;
  7702			risc_size -= 8;
  7703	
  7704			ql_dbg(ql_dbg_init, vha, 0x0173,
  7705			    "-> fwdt%u template allocate template %#x words...\n",
  7706			    j, risc_size);
  7707			fwdt->template = vmalloc(risc_size * sizeof(*dcode));
  7708			if (!fwdt->template) {
  7709				ql_log(ql_log_warn, vha, 0x0174,
  7710				    "-> fwdt%u failed allocate template.\n", j);
  7711				goto failed;
  7712			}
  7713	
  7714			dcode = fwdt->template;
  7715			for (i = 0; i < risc_size; i++)
  7716				dcode[i] = le32_to_cpu(fwcode[i]);
  7717	
  7718			if (!qla27xx_fwdt_template_valid(dcode)) {
  7719				ql_log(ql_log_warn, vha, 0x0175,
  7720				    "-> fwdt%u failed template validate\n", j);
  7721				goto failed;
  7722			}
  7723	
  7724			dlen = qla27xx_fwdt_template_size(dcode);
  7725			ql_dbg(ql_dbg_init, vha, 0x0176,
  7726			    "-> fwdt%u template size %#lx bytes (%#lx words)\n",
  7727			    j, dlen, dlen / sizeof(*dcode));
  7728			if (dlen > risc_size * sizeof(*dcode)) {
  7729				ql_log(ql_log_warn, vha, 0x0177,
  7730				    "-> fwdt%u template exceeds array (%-lu bytes)\n",
  7731				    j, dlen - risc_size * sizeof(*dcode));
  7732				goto failed;
  7733			}
  7734	
  7735			fwdt->length = dlen;
  7736			ql_dbg(ql_dbg_init, vha, 0x0178,
  7737			    "-> fwdt%u loaded template ok\n", j);
  7738	
  7739			fwcode += risc_size + 1;
  7740		}
  7741	
  7742		return QLA_SUCCESS;
  7743	
  7744	failed:
  7745		if (fwdt->template)
  7746			vfree(fwdt->template);
  7747		fwdt->template = NULL;
  7748		fwdt->length = 0;
  7749	
  7750		return QLA_SUCCESS;
  7751	}
  7752	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux