All of lore.kernel.org
 help / color / mirror / Atom feed
From: kbuild test robot <lkp@intel.com>
To: Deepak Ukey <deepak.ukey@microchip.com>
Cc: kbuild-all@lists.01.org, linux-scsi@vger.kernel.org,
	Vasanthalakshmi.Tharmarajan@microchip.com,
	Viswas.G@microchip.com, deepak.ukey@microchip.com,
	jinpu.wang@profitbricks.com, martin.petersen@oracle.com,
	dpf@google.com, jsperbeck@google.com, auradkar@google.com,
	ianyar@google.com
Subject: Re: [PATCH 12/12] pm80xx : Modified the logic to collect fatal dump.
Date: Thu, 7 Nov 2019 05:25:37 +0800	[thread overview]
Message-ID: <201911070549.Q5hz8VVP%lkp@intel.com> (raw)
In-Reply-To: <20191031051241.6762-13-deepak.ukey@microchip.com>

[-- Attachment #1: Type: text/plain, Size: 14774 bytes --]

Hi Deepak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[cannot apply to v5.4-rc6 next-20191105]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Deepak-Ukey/pm80xx-Updates-for-the-driver-version-0-1-39/20191102-082024
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-a004-201944 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.2-10+deb8u1) 4.9.2
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/scsi/pm8001/pm80xx_hwi.c: In function 'pm80xx_get_fatal_dump':
>> drivers/scsi/pm8001/pm80xx_hwi.c:239:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
       PM8001_IO_DBG(pm8001_ha,
       ^
   drivers/scsi/pm8001/pm80xx_hwi.c:261:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
       PM8001_IO_DBG(pm8001_ha,
       ^
   drivers/scsi/pm8001/pm80xx_hwi.c:287:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
      PM8001_IO_DBG(pm8001_ha,
      ^
   drivers/scsi/pm8001/pm80xx_hwi.c:385:2: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
     PM8001_IO_DBG(pm8001_ha,
     ^

vim +239 drivers/scsi/pm8001/pm80xx_hwi.c

    87	
    88	ssize_t pm80xx_get_fatal_dump(struct device *cdev,
    89		struct device_attribute *attr, char *buf)
    90	{
    91		struct Scsi_Host *shost = class_to_shost(cdev);
    92		struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
    93		struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
    94		void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr;
    95		u32 accum_len , reg_val, index, *temp;
    96		u32 status = 1;
    97		unsigned long start;
    98		u8 *direct_data;
    99		char *fatal_error_data = buf;
   100		u32 length_to_read;
   101	
   102		pm8001_ha->forensic_info.data_buf.direct_data = buf;
   103		if (pm8001_ha->chip_id == chip_8001) {
   104			pm8001_ha->forensic_info.data_buf.direct_data +=
   105				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   106				"Not supported for SPC controller");
   107			return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   108				(char *)buf;
   109		}
   110		/* initialize variables for very first call from host application */
   111		if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) {
   112			PM8001_IO_DBG(pm8001_ha,
   113			pm8001_printk("forensic_info TYPE_NON_FATAL..............\n"));
   114			direct_data = (u8 *)fatal_error_data;
   115			pm8001_ha->forensic_info.data_type = TYPE_NON_FATAL;
   116			pm8001_ha->forensic_info.data_buf.direct_len = SYSFS_OFFSET;
   117			pm8001_ha->forensic_info.data_buf.direct_offset = 0;
   118			pm8001_ha->forensic_info.data_buf.read_len = 0;
   119			pm8001_ha->forensic_preserved_accumulated_transfer = 0;
   120	
   121			/* Write signature to fatal dump table */
   122			pm8001_mw32(fatal_table_address,
   123					MPI_FATAL_EDUMP_TABLE_SIGNATURE, 0x1234abcd);
   124	
   125			pm8001_ha->forensic_info.data_buf.direct_data = direct_data;
   126			PM8001_IO_DBG(pm8001_ha,
   127				pm8001_printk("ossaHwCB: status1 %d\n", status));
   128			PM8001_IO_DBG(pm8001_ha,
   129				pm8001_printk("ossaHwCB: read_len 0x%x\n",
   130				pm8001_ha->forensic_info.data_buf.read_len));
   131			PM8001_IO_DBG(pm8001_ha,
   132				pm8001_printk("ossaHwCB: direct_len 0x%x\n",
   133				pm8001_ha->forensic_info.data_buf.direct_len));
   134			PM8001_IO_DBG(pm8001_ha,
   135				pm8001_printk("ossaHwCB: direct_offset 0x%x\n",
   136				pm8001_ha->forensic_info.data_buf.direct_offset));
   137		}
   138		if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) {
   139			/* start to get data */
   140			/* Program the MEMBASE II Shifting Register with 0x00.*/
   141			pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER,
   142					pm8001_ha->fatal_forensic_shift_offset);
   143			pm8001_ha->forensic_last_offset = 0;
   144			pm8001_ha->forensic_fatal_step = 0;
   145			pm8001_ha->fatal_bar_loc = 0;
   146		}
   147	
   148		/* Read until accum_len is retrived */
   149		accum_len = pm8001_mr32(fatal_table_address,
   150					MPI_FATAL_EDUMP_TABLE_ACCUM_LEN);
   151		/* Determine length of data between previously stored transfer length
   152		 * and current accumulated transfer length
   153		 */
   154		length_to_read =
   155			accum_len - pm8001_ha->forensic_preserved_accumulated_transfer;
   156		PM8001_IO_DBG(pm8001_ha,
   157			pm8001_printk("get_fatal_spcv: accum_len 0x%x\n", accum_len));
   158		PM8001_IO_DBG(pm8001_ha,
   159			pm8001_printk("get_fatal_spcv: length_to_read 0x%x\n",
   160			length_to_read));
   161		PM8001_IO_DBG(pm8001_ha,
   162			pm8001_printk("get_fatal_spcv: last_offset 0x%x\n",
   163			pm8001_ha->forensic_last_offset));
   164		PM8001_IO_DBG(pm8001_ha,
   165			pm8001_printk("get_fatal_spcv: read_len 0x%x\n",
   166			pm8001_ha->forensic_info.data_buf.read_len));
   167		PM8001_IO_DBG(pm8001_ha,
   168			pm8001_printk("get_fatal_spcv:: direct_len 0x%x\n",
   169			pm8001_ha->forensic_info.data_buf.direct_len));
   170		PM8001_IO_DBG(pm8001_ha,
   171			pm8001_printk("get_fatal_spcv:: direct_offset 0x%x\n",
   172			pm8001_ha->forensic_info.data_buf.direct_offset));
   173	
   174		/* If accumulated length failed to read correctly fail the attempt.*/
   175		if (accum_len == 0xFFFFFFFF) {
   176			PM8001_IO_DBG(pm8001_ha,
   177				pm8001_printk("Possible PCI issue 0x%x not expected\n",
   178				accum_len));
   179			return status;
   180		}
   181		/* If accumulated length is zero fail the attempt */
   182		if (accum_len == 0) {
   183			pm8001_ha->forensic_info.data_buf.direct_data +=
   184				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   185				"%08x ", 0xFFFFFFFF);
   186			return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   187				(char *)buf;
   188		}
   189		/* Accumulated length is good so start capturing the first data */
   190		temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr;
   191		if (pm8001_ha->forensic_fatal_step == 0) {
   192	moreData:
   193			/* If data to read is less than SYSFS_OFFSET then reduce the
   194			 * length of dataLen
   195			 */
   196			if (pm8001_ha->forensic_last_offset + SYSFS_OFFSET
   197					> length_to_read) {
   198				pm8001_ha->forensic_info.data_buf.direct_len =
   199					length_to_read -
   200					pm8001_ha->forensic_last_offset;
   201			} else {
   202				pm8001_ha->forensic_info.data_buf.direct_len =
   203					SYSFS_OFFSET;
   204			}
   205			if (pm8001_ha->forensic_info.data_buf.direct_data) {
   206				/* Data is in bar, copy to host memory */
   207				pm80xx_pci_mem_copy(pm8001_ha,
   208				pm8001_ha->fatal_bar_loc,
   209				pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr,
   210				pm8001_ha->forensic_info.data_buf.direct_len, 1);
   211			}
   212			pm8001_ha->fatal_bar_loc +=
   213				pm8001_ha->forensic_info.data_buf.direct_len;
   214			pm8001_ha->forensic_info.data_buf.direct_offset +=
   215				pm8001_ha->forensic_info.data_buf.direct_len;
   216			pm8001_ha->forensic_last_offset	+=
   217				pm8001_ha->forensic_info.data_buf.direct_len;
   218			pm8001_ha->forensic_info.data_buf.read_len =
   219				pm8001_ha->forensic_info.data_buf.direct_len;
   220	
   221			if (pm8001_ha->forensic_last_offset  >= length_to_read) {
   222				pm8001_ha->forensic_info.data_buf.direct_data +=
   223				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   224					"%08x ", 3);
   225				for (index = 0; index <
   226					(pm8001_ha->forensic_info.data_buf.direct_len
   227					 / 4); index++) {
   228					pm8001_ha->forensic_info.data_buf.direct_data +=
   229					sprintf(
   230					pm8001_ha->forensic_info.data_buf.direct_data,
   231					"%08x ", *(temp + index));
   232				}
   233	
   234				pm8001_ha->fatal_bar_loc = 0;
   235				pm8001_ha->forensic_fatal_step = 1;
   236				pm8001_ha->fatal_forensic_shift_offset = 0;
   237				pm8001_ha->forensic_last_offset	= 0;
   238				status = 0;
 > 239				PM8001_IO_DBG(pm8001_ha,
   240				pm8001_printk("get_fatal_spcv: return1 0x%lx\n",
   241				((char *)pm8001_ha->forensic_info.data_buf.direct_data
   242				- (char *)buf)));
   243				return (char *)pm8001_ha->
   244					forensic_info.data_buf.direct_data -
   245					(char *)buf;
   246			}
   247			if (pm8001_ha->fatal_bar_loc < (64 * 1024)) {
   248				pm8001_ha->forensic_info.data_buf.direct_data +=
   249					sprintf(pm8001_ha->
   250						forensic_info.data_buf.direct_data,
   251						"%08x ", 2);
   252				for (index = 0; index <
   253					(pm8001_ha->forensic_info.data_buf.direct_len
   254					 / 4); index++) {
   255					pm8001_ha->forensic_info.data_buf.direct_data
   256						+= sprintf(pm8001_ha->
   257						forensic_info.data_buf.direct_data,
   258						"%08x ", *(temp + index));
   259				}
   260				status = 0;
   261				PM8001_IO_DBG(pm8001_ha,
   262				pm8001_printk("get_fatal_spcv: return2 0x%lx\n",
   263				((char *)pm8001_ha->forensic_info.data_buf.direct_data
   264				- (char *)buf)));
   265				return (char *)pm8001_ha->
   266					forensic_info.data_buf.direct_data -
   267					(char *)buf;
   268			}
   269	
   270			/* Increment the MEMBASE II Shifting Register value by 0x100.*/
   271			pm8001_ha->forensic_info.data_buf.direct_data +=
   272				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   273					"%08x ", 2);
   274			for (index = 0; index <
   275				(pm8001_ha->forensic_info.data_buf.direct_len
   276				 / 4) ; index++) {
   277				pm8001_ha->forensic_info.data_buf.direct_data +=
   278					sprintf(pm8001_ha->
   279					forensic_info.data_buf.direct_data,
   280					"%08x ", *(temp + index));
   281			}
   282			pm8001_ha->fatal_forensic_shift_offset += 0x100;
   283			pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER,
   284				pm8001_ha->fatal_forensic_shift_offset);
   285			pm8001_ha->fatal_bar_loc = 0;
   286			status = 0;
   287			PM8001_IO_DBG(pm8001_ha,
   288			pm8001_printk("get_fatal_spcv: return3 0x%lx\n",
   289			((char *)pm8001_ha->forensic_info.data_buf.direct_data
   290			- (char *)buf)));
   291			return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   292				(char *)buf;
   293		}
   294		if (pm8001_ha->forensic_fatal_step == 1) {
   295			/* store previous accumulated length before triggering next
   296			 * accumulated length update
   297			 */
   298			pm8001_ha->forensic_preserved_accumulated_transfer =
   299				pm8001_mr32(fatal_table_address,
   300				MPI_FATAL_EDUMP_TABLE_ACCUM_LEN);
   301	
   302			/* continue capturing the fatal log until Dump status is 0x3 */
   303			if (pm8001_mr32(fatal_table_address,
   304				MPI_FATAL_EDUMP_TABLE_STATUS) <
   305				MPI_FATAL_EDUMP_TABLE_STAT_NF_SUCCESS_DONE) {
   306	
   307				/* reset fddstat bit by writing to zero*/
   308				pm8001_mw32(fatal_table_address,
   309						MPI_FATAL_EDUMP_TABLE_STATUS, 0x0);
   310	
   311				/* set dump control value to '1' so that new data will
   312				 * be transferred to shared memory
   313				 */
   314				pm8001_mw32(fatal_table_address,
   315					MPI_FATAL_EDUMP_TABLE_HANDSHAKE,
   316					MPI_FATAL_EDUMP_HANDSHAKE_RDY);
   317	
   318				/*Poll FDDHSHK  until clear */
   319				start = jiffies + (2 * HZ); /* 2 sec */
   320	
   321				do {
   322					reg_val = pm8001_mr32(fatal_table_address,
   323						MPI_FATAL_EDUMP_TABLE_HANDSHAKE);
   324				} while ((reg_val) && time_before(jiffies, start));
   325	
   326				if (reg_val != 0) {
   327					PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
   328					"TIMEOUT:MPI_FATAL_EDUMP_TABLE_HDSHAKE 0x%x\n",
   329					reg_val));
   330				       /* Fail the dump if a timeout occurs */
   331					pm8001_ha->forensic_info.data_buf.direct_data +=
   332					sprintf(
   333					pm8001_ha->forensic_info.data_buf.direct_data,
   334					"%08x ", 0xFFFFFFFF);
   335					return((char *)
   336					pm8001_ha->forensic_info.data_buf.direct_data
   337					- (char *)buf);
   338				}
   339				/* Poll status register until set to 2 or
   340				 * 3 for up to 2 seconds
   341				 */
   342				start = jiffies + (2 * HZ); /* 2 sec */
   343	
   344				do {
   345					reg_val = pm8001_mr32(fatal_table_address,
   346						MPI_FATAL_EDUMP_TABLE_STATUS);
   347				} while (((reg_val != 2) || (reg_val != 3)) &&
   348						time_before(jiffies, start));
   349	
   350				if (reg_val < 2) {
   351					PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
   352					"TIMEOUT:MPI_FATAL_EDUMP_TABLE_STATUS = 0x%x\n",
   353					reg_val));
   354					/* Fail the dump if a timeout occurs */
   355					pm8001_ha->forensic_info.data_buf.direct_data +=
   356					sprintf(
   357					pm8001_ha->forensic_info.data_buf.direct_data,
   358					"%08x ", 0xFFFFFFFF);
   359					pm8001_cw32(pm8001_ha, 0,
   360						MEMBASE_II_SHIFT_REGISTER,
   361						pm8001_ha->fatal_forensic_shift_offset);
   362				}
   363				/* Read the next block of the debug data.*/
   364				length_to_read = pm8001_mr32(fatal_table_address,
   365				MPI_FATAL_EDUMP_TABLE_ACCUM_LEN) -
   366				pm8001_ha->forensic_preserved_accumulated_transfer;
   367				if (length_to_read != 0x0) {
   368					pm8001_ha->forensic_fatal_step = 0;
   369					goto moreData;
   370				} else {
   371					pm8001_ha->forensic_info.data_buf.direct_data +=
   372					sprintf(
   373					pm8001_ha->forensic_info.data_buf.direct_data,
   374					"%08x ", 4);
   375					pm8001_ha->forensic_info.data_buf.read_len
   376									= 0xFFFFFFFF;
   377					pm8001_ha->forensic_info.data_buf.direct_len
   378									=  0;
   379					pm8001_ha->forensic_info.data_buf.direct_offset
   380									= 0;
   381					pm8001_ha->forensic_info.data_buf.read_len = 0;
   382				}
   383			}
   384		}
   385		PM8001_IO_DBG(pm8001_ha,
   386			pm8001_printk("get_fatal_spcv: return4 0x%lx\n",
   387			((char *)pm8001_ha->forensic_info.data_buf.direct_data -
   388			 (char *)buf)));
   389		return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   390			(char *)buf;
   391	}
   392	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34343 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: kbuild test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH 12/12] pm80xx : Modified the logic to collect fatal dump.
Date: Thu, 07 Nov 2019 05:25:37 +0800	[thread overview]
Message-ID: <201911070549.Q5hz8VVP%lkp@intel.com> (raw)
In-Reply-To: <20191031051241.6762-13-deepak.ukey@microchip.com>

[-- Attachment #1: Type: text/plain, Size: 15125 bytes --]

Hi Deepak,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on mkp-scsi/for-next]
[cannot apply to v5.4-rc6 next-20191105]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Deepak-Ukey/pm80xx-Updates-for-the-driver-version-0-1-39/20191102-082024
base:   https://git.kernel.org/pub/scm/linux/kernel/git/mkp/scsi.git for-next
config: i386-randconfig-a004-201944 (attached as .config)
compiler: gcc-4.9 (Debian 4.9.2-10+deb8u1) 4.9.2
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/scsi/pm8001/pm80xx_hwi.c: In function 'pm80xx_get_fatal_dump':
>> drivers/scsi/pm8001/pm80xx_hwi.c:239:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
       PM8001_IO_DBG(pm8001_ha,
       ^
   drivers/scsi/pm8001/pm80xx_hwi.c:261:4: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
       PM8001_IO_DBG(pm8001_ha,
       ^
   drivers/scsi/pm8001/pm80xx_hwi.c:287:3: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
      PM8001_IO_DBG(pm8001_ha,
      ^
   drivers/scsi/pm8001/pm80xx_hwi.c:385:2: warning: format '%lx' expects argument of type 'long unsigned int', but argument 5 has type 'int' [-Wformat=]
     PM8001_IO_DBG(pm8001_ha,
     ^

vim +239 drivers/scsi/pm8001/pm80xx_hwi.c

    87	
    88	ssize_t pm80xx_get_fatal_dump(struct device *cdev,
    89		struct device_attribute *attr, char *buf)
    90	{
    91		struct Scsi_Host *shost = class_to_shost(cdev);
    92		struct sas_ha_struct *sha = SHOST_TO_SAS_HA(shost);
    93		struct pm8001_hba_info *pm8001_ha = sha->lldd_ha;
    94		void __iomem *fatal_table_address = pm8001_ha->fatal_tbl_addr;
    95		u32 accum_len , reg_val, index, *temp;
    96		u32 status = 1;
    97		unsigned long start;
    98		u8 *direct_data;
    99		char *fatal_error_data = buf;
   100		u32 length_to_read;
   101	
   102		pm8001_ha->forensic_info.data_buf.direct_data = buf;
   103		if (pm8001_ha->chip_id == chip_8001) {
   104			pm8001_ha->forensic_info.data_buf.direct_data +=
   105				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   106				"Not supported for SPC controller");
   107			return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   108				(char *)buf;
   109		}
   110		/* initialize variables for very first call from host application */
   111		if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) {
   112			PM8001_IO_DBG(pm8001_ha,
   113			pm8001_printk("forensic_info TYPE_NON_FATAL..............\n"));
   114			direct_data = (u8 *)fatal_error_data;
   115			pm8001_ha->forensic_info.data_type = TYPE_NON_FATAL;
   116			pm8001_ha->forensic_info.data_buf.direct_len = SYSFS_OFFSET;
   117			pm8001_ha->forensic_info.data_buf.direct_offset = 0;
   118			pm8001_ha->forensic_info.data_buf.read_len = 0;
   119			pm8001_ha->forensic_preserved_accumulated_transfer = 0;
   120	
   121			/* Write signature to fatal dump table */
   122			pm8001_mw32(fatal_table_address,
   123					MPI_FATAL_EDUMP_TABLE_SIGNATURE, 0x1234abcd);
   124	
   125			pm8001_ha->forensic_info.data_buf.direct_data = direct_data;
   126			PM8001_IO_DBG(pm8001_ha,
   127				pm8001_printk("ossaHwCB: status1 %d\n", status));
   128			PM8001_IO_DBG(pm8001_ha,
   129				pm8001_printk("ossaHwCB: read_len 0x%x\n",
   130				pm8001_ha->forensic_info.data_buf.read_len));
   131			PM8001_IO_DBG(pm8001_ha,
   132				pm8001_printk("ossaHwCB: direct_len 0x%x\n",
   133				pm8001_ha->forensic_info.data_buf.direct_len));
   134			PM8001_IO_DBG(pm8001_ha,
   135				pm8001_printk("ossaHwCB: direct_offset 0x%x\n",
   136				pm8001_ha->forensic_info.data_buf.direct_offset));
   137		}
   138		if (pm8001_ha->forensic_info.data_buf.direct_offset == 0) {
   139			/* start to get data */
   140			/* Program the MEMBASE II Shifting Register with 0x00.*/
   141			pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER,
   142					pm8001_ha->fatal_forensic_shift_offset);
   143			pm8001_ha->forensic_last_offset = 0;
   144			pm8001_ha->forensic_fatal_step = 0;
   145			pm8001_ha->fatal_bar_loc = 0;
   146		}
   147	
   148		/* Read until accum_len is retrived */
   149		accum_len = pm8001_mr32(fatal_table_address,
   150					MPI_FATAL_EDUMP_TABLE_ACCUM_LEN);
   151		/* Determine length of data between previously stored transfer length
   152		 * and current accumulated transfer length
   153		 */
   154		length_to_read =
   155			accum_len - pm8001_ha->forensic_preserved_accumulated_transfer;
   156		PM8001_IO_DBG(pm8001_ha,
   157			pm8001_printk("get_fatal_spcv: accum_len 0x%x\n", accum_len));
   158		PM8001_IO_DBG(pm8001_ha,
   159			pm8001_printk("get_fatal_spcv: length_to_read 0x%x\n",
   160			length_to_read));
   161		PM8001_IO_DBG(pm8001_ha,
   162			pm8001_printk("get_fatal_spcv: last_offset 0x%x\n",
   163			pm8001_ha->forensic_last_offset));
   164		PM8001_IO_DBG(pm8001_ha,
   165			pm8001_printk("get_fatal_spcv: read_len 0x%x\n",
   166			pm8001_ha->forensic_info.data_buf.read_len));
   167		PM8001_IO_DBG(pm8001_ha,
   168			pm8001_printk("get_fatal_spcv:: direct_len 0x%x\n",
   169			pm8001_ha->forensic_info.data_buf.direct_len));
   170		PM8001_IO_DBG(pm8001_ha,
   171			pm8001_printk("get_fatal_spcv:: direct_offset 0x%x\n",
   172			pm8001_ha->forensic_info.data_buf.direct_offset));
   173	
   174		/* If accumulated length failed to read correctly fail the attempt.*/
   175		if (accum_len == 0xFFFFFFFF) {
   176			PM8001_IO_DBG(pm8001_ha,
   177				pm8001_printk("Possible PCI issue 0x%x not expected\n",
   178				accum_len));
   179			return status;
   180		}
   181		/* If accumulated length is zero fail the attempt */
   182		if (accum_len == 0) {
   183			pm8001_ha->forensic_info.data_buf.direct_data +=
   184				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   185				"%08x ", 0xFFFFFFFF);
   186			return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   187				(char *)buf;
   188		}
   189		/* Accumulated length is good so start capturing the first data */
   190		temp = (u32 *)pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr;
   191		if (pm8001_ha->forensic_fatal_step == 0) {
   192	moreData:
   193			/* If data to read is less than SYSFS_OFFSET then reduce the
   194			 * length of dataLen
   195			 */
   196			if (pm8001_ha->forensic_last_offset + SYSFS_OFFSET
   197					> length_to_read) {
   198				pm8001_ha->forensic_info.data_buf.direct_len =
   199					length_to_read -
   200					pm8001_ha->forensic_last_offset;
   201			} else {
   202				pm8001_ha->forensic_info.data_buf.direct_len =
   203					SYSFS_OFFSET;
   204			}
   205			if (pm8001_ha->forensic_info.data_buf.direct_data) {
   206				/* Data is in bar, copy to host memory */
   207				pm80xx_pci_mem_copy(pm8001_ha,
   208				pm8001_ha->fatal_bar_loc,
   209				pm8001_ha->memoryMap.region[FORENSIC_MEM].virt_ptr,
   210				pm8001_ha->forensic_info.data_buf.direct_len, 1);
   211			}
   212			pm8001_ha->fatal_bar_loc +=
   213				pm8001_ha->forensic_info.data_buf.direct_len;
   214			pm8001_ha->forensic_info.data_buf.direct_offset +=
   215				pm8001_ha->forensic_info.data_buf.direct_len;
   216			pm8001_ha->forensic_last_offset	+=
   217				pm8001_ha->forensic_info.data_buf.direct_len;
   218			pm8001_ha->forensic_info.data_buf.read_len =
   219				pm8001_ha->forensic_info.data_buf.direct_len;
   220	
   221			if (pm8001_ha->forensic_last_offset  >= length_to_read) {
   222				pm8001_ha->forensic_info.data_buf.direct_data +=
   223				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   224					"%08x ", 3);
   225				for (index = 0; index <
   226					(pm8001_ha->forensic_info.data_buf.direct_len
   227					 / 4); index++) {
   228					pm8001_ha->forensic_info.data_buf.direct_data +=
   229					sprintf(
   230					pm8001_ha->forensic_info.data_buf.direct_data,
   231					"%08x ", *(temp + index));
   232				}
   233	
   234				pm8001_ha->fatal_bar_loc = 0;
   235				pm8001_ha->forensic_fatal_step = 1;
   236				pm8001_ha->fatal_forensic_shift_offset = 0;
   237				pm8001_ha->forensic_last_offset	= 0;
   238				status = 0;
 > 239				PM8001_IO_DBG(pm8001_ha,
   240				pm8001_printk("get_fatal_spcv: return1 0x%lx\n",
   241				((char *)pm8001_ha->forensic_info.data_buf.direct_data
   242				- (char *)buf)));
   243				return (char *)pm8001_ha->
   244					forensic_info.data_buf.direct_data -
   245					(char *)buf;
   246			}
   247			if (pm8001_ha->fatal_bar_loc < (64 * 1024)) {
   248				pm8001_ha->forensic_info.data_buf.direct_data +=
   249					sprintf(pm8001_ha->
   250						forensic_info.data_buf.direct_data,
   251						"%08x ", 2);
   252				for (index = 0; index <
   253					(pm8001_ha->forensic_info.data_buf.direct_len
   254					 / 4); index++) {
   255					pm8001_ha->forensic_info.data_buf.direct_data
   256						+= sprintf(pm8001_ha->
   257						forensic_info.data_buf.direct_data,
   258						"%08x ", *(temp + index));
   259				}
   260				status = 0;
   261				PM8001_IO_DBG(pm8001_ha,
   262				pm8001_printk("get_fatal_spcv: return2 0x%lx\n",
   263				((char *)pm8001_ha->forensic_info.data_buf.direct_data
   264				- (char *)buf)));
   265				return (char *)pm8001_ha->
   266					forensic_info.data_buf.direct_data -
   267					(char *)buf;
   268			}
   269	
   270			/* Increment the MEMBASE II Shifting Register value by 0x100.*/
   271			pm8001_ha->forensic_info.data_buf.direct_data +=
   272				sprintf(pm8001_ha->forensic_info.data_buf.direct_data,
   273					"%08x ", 2);
   274			for (index = 0; index <
   275				(pm8001_ha->forensic_info.data_buf.direct_len
   276				 / 4) ; index++) {
   277				pm8001_ha->forensic_info.data_buf.direct_data +=
   278					sprintf(pm8001_ha->
   279					forensic_info.data_buf.direct_data,
   280					"%08x ", *(temp + index));
   281			}
   282			pm8001_ha->fatal_forensic_shift_offset += 0x100;
   283			pm8001_cw32(pm8001_ha, 0, MEMBASE_II_SHIFT_REGISTER,
   284				pm8001_ha->fatal_forensic_shift_offset);
   285			pm8001_ha->fatal_bar_loc = 0;
   286			status = 0;
   287			PM8001_IO_DBG(pm8001_ha,
   288			pm8001_printk("get_fatal_spcv: return3 0x%lx\n",
   289			((char *)pm8001_ha->forensic_info.data_buf.direct_data
   290			- (char *)buf)));
   291			return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   292				(char *)buf;
   293		}
   294		if (pm8001_ha->forensic_fatal_step == 1) {
   295			/* store previous accumulated length before triggering next
   296			 * accumulated length update
   297			 */
   298			pm8001_ha->forensic_preserved_accumulated_transfer =
   299				pm8001_mr32(fatal_table_address,
   300				MPI_FATAL_EDUMP_TABLE_ACCUM_LEN);
   301	
   302			/* continue capturing the fatal log until Dump status is 0x3 */
   303			if (pm8001_mr32(fatal_table_address,
   304				MPI_FATAL_EDUMP_TABLE_STATUS) <
   305				MPI_FATAL_EDUMP_TABLE_STAT_NF_SUCCESS_DONE) {
   306	
   307				/* reset fddstat bit by writing to zero*/
   308				pm8001_mw32(fatal_table_address,
   309						MPI_FATAL_EDUMP_TABLE_STATUS, 0x0);
   310	
   311				/* set dump control value to '1' so that new data will
   312				 * be transferred to shared memory
   313				 */
   314				pm8001_mw32(fatal_table_address,
   315					MPI_FATAL_EDUMP_TABLE_HANDSHAKE,
   316					MPI_FATAL_EDUMP_HANDSHAKE_RDY);
   317	
   318				/*Poll FDDHSHK  until clear */
   319				start = jiffies + (2 * HZ); /* 2 sec */
   320	
   321				do {
   322					reg_val = pm8001_mr32(fatal_table_address,
   323						MPI_FATAL_EDUMP_TABLE_HANDSHAKE);
   324				} while ((reg_val) && time_before(jiffies, start));
   325	
   326				if (reg_val != 0) {
   327					PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
   328					"TIMEOUT:MPI_FATAL_EDUMP_TABLE_HDSHAKE 0x%x\n",
   329					reg_val));
   330				       /* Fail the dump if a timeout occurs */
   331					pm8001_ha->forensic_info.data_buf.direct_data +=
   332					sprintf(
   333					pm8001_ha->forensic_info.data_buf.direct_data,
   334					"%08x ", 0xFFFFFFFF);
   335					return((char *)
   336					pm8001_ha->forensic_info.data_buf.direct_data
   337					- (char *)buf);
   338				}
   339				/* Poll status register until set to 2 or
   340				 * 3 for up to 2 seconds
   341				 */
   342				start = jiffies + (2 * HZ); /* 2 sec */
   343	
   344				do {
   345					reg_val = pm8001_mr32(fatal_table_address,
   346						MPI_FATAL_EDUMP_TABLE_STATUS);
   347				} while (((reg_val != 2) || (reg_val != 3)) &&
   348						time_before(jiffies, start));
   349	
   350				if (reg_val < 2) {
   351					PM8001_FAIL_DBG(pm8001_ha, pm8001_printk(
   352					"TIMEOUT:MPI_FATAL_EDUMP_TABLE_STATUS = 0x%x\n",
   353					reg_val));
   354					/* Fail the dump if a timeout occurs */
   355					pm8001_ha->forensic_info.data_buf.direct_data +=
   356					sprintf(
   357					pm8001_ha->forensic_info.data_buf.direct_data,
   358					"%08x ", 0xFFFFFFFF);
   359					pm8001_cw32(pm8001_ha, 0,
   360						MEMBASE_II_SHIFT_REGISTER,
   361						pm8001_ha->fatal_forensic_shift_offset);
   362				}
   363				/* Read the next block of the debug data.*/
   364				length_to_read = pm8001_mr32(fatal_table_address,
   365				MPI_FATAL_EDUMP_TABLE_ACCUM_LEN) -
   366				pm8001_ha->forensic_preserved_accumulated_transfer;
   367				if (length_to_read != 0x0) {
   368					pm8001_ha->forensic_fatal_step = 0;
   369					goto moreData;
   370				} else {
   371					pm8001_ha->forensic_info.data_buf.direct_data +=
   372					sprintf(
   373					pm8001_ha->forensic_info.data_buf.direct_data,
   374					"%08x ", 4);
   375					pm8001_ha->forensic_info.data_buf.read_len
   376									= 0xFFFFFFFF;
   377					pm8001_ha->forensic_info.data_buf.direct_len
   378									=  0;
   379					pm8001_ha->forensic_info.data_buf.direct_offset
   380									= 0;
   381					pm8001_ha->forensic_info.data_buf.read_len = 0;
   382				}
   383			}
   384		}
   385		PM8001_IO_DBG(pm8001_ha,
   386			pm8001_printk("get_fatal_spcv: return4 0x%lx\n",
   387			((char *)pm8001_ha->forensic_info.data_buf.direct_data -
   388			 (char *)buf)));
   389		return (char *)pm8001_ha->forensic_info.data_buf.direct_data -
   390			(char *)buf;
   391	}
   392	

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 34343 bytes --]

  parent reply	other threads:[~2019-11-06 21:26 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-31  5:12 [PATCH 00/12] pm80xx : Updates for the driver version 0.1.39 Deepak Ukey
2019-10-31  5:12 ` [PATCH 01/12] pm80xx : Fix for SATA device discovery Deepak Ukey
2019-11-01  9:16   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 02/12] pm80xx : Initialize variable used as return status Deepak Ukey
2019-11-01  9:17   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 03/12] pm80xx : Convert 'long' mdelay to msleep Deepak Ukey
2019-11-01  9:19   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 04/12] pm80xx : Squashed logging cleanup changes Deepak Ukey
2019-11-06 10:22   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 05/12] pm80xx : Increase timeout for pm80xx mpi_uninit_check Deepak Ukey
2019-11-06 10:24   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 06/12] pm80xx : Fix dereferencing dangling pointer Deepak Ukey
2019-11-06 10:28   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 07/12] pm80xx : Fix command issue sizing Deepak Ukey
2019-11-06 10:33   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 08/12] pm80xx : Cleanup command when a reset times out Deepak Ukey
2019-11-06 10:39   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 09/12] pm80xx : Do not request 12G sas speeds Deepak Ukey
2019-11-06 10:43   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 10/12] pm80xx : Controller fatal error through sysfs Deepak Ukey
2019-11-06 10:49   ` Jinpu Wang
2019-11-07  6:20     ` Deepak.Ukey
2019-11-07  8:36       ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 11/12] pm80xx : Tie the interrupt name to the module instance Deepak Ukey
2019-11-06 10:52   ` Jinpu Wang
2019-10-31  5:12 ` [PATCH 12/12] pm80xx : Modified the logic to collect fatal dump Deepak Ukey
2019-11-02  2:52   ` kbuild test robot
2019-11-02  2:52     ` kbuild test robot
2019-11-06 21:25   ` kbuild test robot [this message]
2019-11-06 21:25     ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201911070549.Q5hz8VVP%lkp@intel.com \
    --to=lkp@intel.com \
    --cc=Vasanthalakshmi.Tharmarajan@microchip.com \
    --cc=Viswas.G@microchip.com \
    --cc=auradkar@google.com \
    --cc=deepak.ukey@microchip.com \
    --cc=dpf@google.com \
    --cc=ianyar@google.com \
    --cc=jinpu.wang@profitbricks.com \
    --cc=jsperbeck@google.com \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.