[PATCH 3/3] fsi: occ: Add dynamic debug to dump command and response

kernel test robot lkp at intel.com
Mon Jul 19 10:26:23 AEST 2021


Hi Eddie,

I love your patch! Yet something to improve:

[auto build test ERROR on hwmon/hwmon-next]
[also build test ERROR on linus/master v5.14-rc2 next-20210716]
[cannot apply to linux/master]
[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/Eddie-James/OCC-fsi-and-hwmon-Set-sequence-number-in-submit-interface/20210718-103535
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: csky-randconfig-r014-20210718 (attached as .config)
compiler: csky-linux-gcc (GCC) 10.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
        # https://github.com/0day-ci/linux/commit/2501575bac95640481d86c6d27cd675055987aa8
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Eddie-James/OCC-fsi-and-hwmon-Set-sequence-number-in-submit-interface/20210718-103535
        git checkout 2501575bac95640481d86c6d27cd675055987aa8
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross ARCH=csky 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All errors (new ones prefixed by >>):

   drivers/fsi/fsi-occ.c: In function 'occ_putsram':
>> drivers/fsi/fsi-occ.c:372:3: error: implicit declaration of function 'DEFINE_DYNAMIC_DEBUG_METADATA' [-Werror=implicit-function-declaration]
     372 |   DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command");
         |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/fsi/fsi-occ.c:372:33: error: 'ddm_occ_cmd' undeclared (first use in this function)
     372 |   DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command");
         |                                 ^~~~~~~~~~~
   drivers/fsi/fsi-occ.c:372:33: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/fsi/fsi-occ.c:374:7: error: implicit declaration of function 'DYNAMIC_DEBUG_BRANCH' [-Werror=implicit-function-declaration]
     374 |   if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) {
         |       ^~~~~~~~~~~~~~~~~~~~
   drivers/fsi/fsi-occ.c: In function 'fsi_occ_submit':
>> drivers/fsi/fsi-occ.c:584:33: error: 'ddm_occ_rsp' undeclared (first use in this function)
     584 |   DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_rsp,
         |                                 ^~~~~~~~~~~
>> drivers/fsi/fsi-occ.c:586:33: error: 'ddm_occ_full_rsp' undeclared (first use in this function)
     586 |   DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_full_rsp,
         |                                 ^~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors


vim +/DEFINE_DYNAMIC_DEBUG_METADATA +372 drivers/fsi/fsi-occ.c

   315	
   316	static int occ_putsram(struct occ *occ, const void *data, ssize_t len,
   317			       u8 seq_no, u16 checksum)
   318	{
   319		size_t cmd_len, buf_len, resp_len, resp_data_len;
   320		u32 data_len = ((len + 7) / 8) * 8;	/* must be multiples of 8 B */
   321		__be32 *buf;
   322		u8 *byte_buf;
   323		int idx = 0, rc;
   324	
   325		cmd_len = (occ->version == occ_p10) ? 6 : 5;
   326	
   327		/*
   328		 * We use the same buffer for command and response, make
   329		 * sure it's big enough
   330		 */
   331		resp_len = OCC_SBE_STATUS_WORDS;
   332		cmd_len += data_len >> 2;
   333		buf_len = max(cmd_len, resp_len);
   334		buf = kzalloc(buf_len << 2, GFP_KERNEL);
   335		if (!buf)
   336			return -ENOMEM;
   337	
   338		/*
   339		 * Magic sequence to do SBE putsram command. SBE will transfer
   340		 * data to specified SRAM address.
   341		 */
   342		buf[0] = cpu_to_be32(cmd_len);
   343		buf[1] = cpu_to_be32(SBEFIFO_CMD_PUT_OCC_SRAM);
   344	
   345		switch (occ->version) {
   346		default:
   347		case occ_p9:
   348			buf[2] = cpu_to_be32(1);	/* Normal mode */
   349			buf[3] = cpu_to_be32(OCC_P9_SRAM_CMD_ADDR);
   350			break;
   351		case occ_p10:
   352			idx = 1;
   353			buf[2] = cpu_to_be32(OCC_P10_SRAM_MODE);
   354			buf[3] = 0;
   355			buf[4] = cpu_to_be32(OCC_P10_SRAM_CMD_ADDR);
   356			break;
   357		}
   358	
   359		buf[4 + idx] = cpu_to_be32(data_len);
   360		memcpy(&buf[5 + idx], data, len);
   361	
   362		byte_buf = (u8 *)&buf[5 + idx];
   363		/*
   364		 * Overwrite the first byte with our sequence number and the last two
   365		 * bytes with the checksum.
   366		 */
   367		byte_buf[0] = seq_no;
   368		byte_buf[len - 2] = checksum >> 8;
   369		byte_buf[len - 1] = checksum & 0xff;
   370	
   371		{
 > 372			DEFINE_DYNAMIC_DEBUG_METADATA(ddm_occ_cmd, "OCC command");
   373	
 > 374			if (DYNAMIC_DEBUG_BRANCH(ddm_occ_cmd)) {
   375				char prefix[64];
   376	
   377				snprintf(prefix, sizeof(prefix), "%s %s: cmd ",
   378					 dev_driver_string(occ->dev),
   379					 dev_name(occ->dev));
   380				print_hex_dump(KERN_DEBUG, prefix, DUMP_PREFIX_OFFSET,
   381					       16, 4, byte_buf, len, false);
   382			}
   383		}
   384	
   385		rc = sbefifo_submit(occ->sbefifo, buf, cmd_len, buf, &resp_len);
   386		if (rc)
   387			goto free;
   388	
   389		rc = sbefifo_parse_status(occ->sbefifo, SBEFIFO_CMD_PUT_OCC_SRAM,
   390					  buf, resp_len, &resp_len);
   391		if (rc)
   392			goto free;
   393	
   394		if (resp_len != 1) {
   395			dev_err(occ->dev, "SRAM write response length invalid: %zd\n",
   396				resp_len);
   397			rc = -EBADMSG;
   398		} else {
   399			resp_data_len = be32_to_cpu(buf[0]);
   400			if (resp_data_len != data_len) {
   401				dev_err(occ->dev,
   402					"SRAM write expected %d bytes got %zd\n",
   403					data_len, resp_data_len);
   404				rc = -EBADMSG;
   405			}
   406		}
   407	
   408	free:
   409		/* Convert positive SBEI status */
   410		if (rc > 0) {
   411			dev_err(occ->dev, "SRAM write returned failure status: %08x\n",
   412				rc);
   413			rc = -EBADMSG;
   414		}
   415	
   416		kfree(buf);
   417		return rc;
   418	}
   419	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 34611 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/linux-fsi/attachments/20210719/8982a51c/attachment-0001.gz>


More information about the linux-fsi mailing list