ipr: Add delay to ensure coherent dumps.
Subsystems (2)
PATCH 1/5 ipr: Add delay to ensure coherent dumps.
Add a holding pattern prior to collecting dump data, to wait for the IOA indication that the Mailbox register is stable and won't change without an explicit reset. This ensures we'll be collecting meaningful dump data, even when dumping right after an adapter reset.
In the event of a timeout, we still force the dump, since a partial dump still might be useful.
--- drivers/scsi/ipr.c | 51 +++++++++++++++++++++++++++++++++++++++------------ drivers/scsi/ipr.h | 3 +++ 2 files changed, 42 insertions(+), 12 deletions(-)
drivers/scsi/ipr.c +39 -12
@@ -8277,6 +8277,42 @@ static int ipr_reset_get_unit_check_job(struct ipr_cmnd *ipr_cmd)return IPR_RC_JOB_RETURN ; } +static int ipr_dump_mailbox_wait (struct ipr_cmnd *ipr_cmd) +{ +struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; + +ENTER ; + +if (ioa_cfg->sdt_state !=GET_DUMP ) +return IPR_RC_JOB_RETURN ; + +if (!ioa_cfg->sis64 || !ipr_cmd->u.time_left || +readl (ioa_cfg->regs.sense_interrupt_reg) &IPR_PCII_MAILBOX_STABLE ) { + +if (!ipr_cmd->u.time_left) +dev_err (&ioa_cfg->pdev->dev, +"Timed out waiting for Mailbox register. " +"Dump might be truncated.\n" ); + + ioa_cfg->sdt_state =READ_DUMP ; + ioa_cfg->dump_timeout =0 ; +if (ioa_cfg->sis64) +ipr_reset_start_timer (ipr_cmd,IPR_SIS64_DUMP_TIMEOUT ); +else +ipr_reset_start_timer (ipr_cmd,IPR_SIS32_DUMP_TIMEOUT ); + ipr_cmd->job_step = ipr_reset_wait_for_dump; +schedule_work (&ioa_cfg->work_q); + + }else { + ipr_cmd->u.time_left -=IPR_CHECK_FOR_RESET_TIMEOUT ; +ipr_reset_start_timer (ipr_cmd, +IPR_CHECK_FOR_RESET_TIMEOUT ); + } + +LEAVE ; +return IPR_RC_JOB_RETURN ; +} +/** * ipr_reset_restore_cfg_space - Restore PCI config space. * @ipr_cmd: ipr command struct
@@ -8326,20 +8362,11 @@ static int ipr_reset_restore_cfg_space(struct ipr_cmnd *ipr_cmd)if (ioa_cfg->in_ioa_bringdown) { ipr_cmd->job_step = ipr_ioa_bringdown_done; + }else if (ioa_cfg->sdt_state ==GET_DUMP ) { + ipr_cmd->job_step = ipr_dump_mailbox_wait; + ipr_cmd->u.time_left =IPR_WAIT_FOR_MAILBOX ; }else { ipr_cmd->job_step = ipr_reset_enable_ioa; - -if (GET_DUMP == ioa_cfg->sdt_state) { - ioa_cfg->sdt_state =READ_DUMP ; - ioa_cfg->dump_timeout =0 ; -if (ioa_cfg->sis64) -ipr_reset_start_timer (ipr_cmd,IPR_SIS64_DUMP_TIMEOUT ); -else -ipr_reset_start_timer (ipr_cmd,IPR_SIS32_DUMP_TIMEOUT ); - ipr_cmd->job_step = ipr_reset_wait_for_dump; -schedule_work (&ioa_cfg->work_q); -return IPR_RC_JOB_RETURN ; - } }LEAVE ;
drivers/scsi/ipr.h +3 -0
@@ -279,6 +279,9 @@#define IPR_IPL_INIT_STAGE_TIME_MASK 0x0000ffff#define IPR_PCII_IPL_STAGE_CHANGE (0x80000000 >> 0) +#define IPR_PCII_MAILBOX_STABLE (0x80000000 >> 4) +#define IPR_WAIT_FOR_MAILBOX (2 * HZ) +#define IPR_PCII_IOA_TRANS_TO_OPER (0x80000000 >> 0)#define IPR_PCII_IOARCB_XFER_FAILED (0x80000000 >> 3)#define IPR_PCII_IOA_UNIT_CHECKED (0x80000000 >> 4)
Signature · 1 line
2.1.0
PATCH 2/5 ipr: Clear NO_ULEN_CHK bit when resource is a vset.
According to the IPR specification, Inhibit Underlength Checking bit must be disabled when sending commands to vsets. Enabling this bit for vset might cause SCSI commands to fail with an Illegal Request.
--- drivers/scsi/ipr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ipr.c +1 -1
@@ -6364,7 +6364,7 @@ static int ipr_queuecommand(struct Scsi_Host *shost, ipr_cmd->done = ipr_scsi_eh_done;if (ipr_is_gscsi (res) ||ipr_is_vset_device (res)) { -if (scsi_cmd->underflow ==0 ) +if (scsi_cmd->underflow ==0 && !ipr_is_vset_device (res)) ioarcb->cmd_pkt.flags_hi |=IPR_FLAGS_HI_NO_ULEN_CHK ; ioarcb->cmd_pkt.flags_hi |=IPR_FLAGS_HI_NO_LINK_DESC ;
Signature · 1 line
2.1.0
Re: [PATCH 2/5] ipr: Clear NO_ULEN_CHK bit when resource is a vset.
drivers/scsi/ipr.c static int ipr_queuecommand(struct Scsi_Host *shost, · line 6367
Quoted 4 lines · Gabriel Krisman Bertazi
if (ipr_is_gscsi(res) || ipr_is_vset_device(res)) {drivers/scsi/ipr.c +1
-1-if (scsi_cmd->underflow ==0 ) +if (scsi_cmd->underflow ==0 && !ipr_is_vset_device (res))
This section is getting quite convoluted. If there isn't really that much common between ipr_is_gscsi(res) and ipr_is_vset_device(res) anymore, it would read much better as distinct segments:
if (ipr_is_gscsi(res))
...
if (ipr_is_vset_devices(res))
...
This will avoid having multiple calls to ipr_is_gscsi() and ipr_is_vset_device() in the same section of code.
---
Manoj Kumar
PATCH 3/5 ipr: Inquiry IOA page 0xC4 during initialization.
In reply to Gabriel Krisman BertaziAdd an IOA Inquiry command for Page 0xC4 during IOA initialization to collect cache capabilities, particularly to check if Sync IOA Write Cache is supported.
Inquiry will happen right after Cap Inquiry on page 0xD0; and will execute only if the "Supported Pages" field in Inquiry Page 0x0 shows support for Page 0xC4. Otherwise, assume Sync IOA Write Cache is not supported.
--- drivers/scsi/ipr.c | 35 ++++++++++++++++++++++++++++++++++- drivers/scsi/ipr.h | 11 +++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-)
drivers/scsi/ipr.c +34 -1
@@ -7722,6 +7722,39 @@ static int ipr_inquiry_page_supported(struct ipr_inquiry_page0 *page0, u8 page) }/** +* ipr_ioafp_pageC4_inquiry - Send a Page 0xC4 Inquiry to the adapter. +* @ipr_cmd: ipr command struct +* +* This function sends a Page 0xC4 inquiry to the adapter +* to retrieve software VPD information. +* +* Return value: +* IPR_RC_JOB_CONTINUE / IPR_RC_JOB_RETURN +**/ +static int ipr_ioafp_pageC4_inquiry (struct ipr_cmnd *ipr_cmd) +{ +struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; +struct ipr_inquiry_page0 *page0 = &ioa_cfg->vpd_cbs->page0_data; +struct ipr_inquiry_pageC4 *pageC4 = &ioa_cfg->vpd_cbs->pageC4_data; +ENTER ; + + ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; +memset (pageC4,0 ,sizeof (*pageC4)); + +if (ipr_inquiry_page_supported (page0,0xC4 )) { +ipr_ioafp_inquiry (ipr_cmd,1 ,0xC4 , + (ioa_cfg->vpd_cbs_dma + + offsetof(struct ipr_misc_cbs , + pageC4_data)), +sizeof (struct ipr_inquiry_pageC4 )); +return IPR_RC_JOB_RETURN ; + } + +LEAVE ; +return IPR_RC_JOB_CONTINUE ; +} + +/** * ipr_ioafp_cap_inquiry - Send a Page 0xD0 Inquiry to the adapter. * @ipr_cmd: ipr command struct *
@@ -7738,7 +7771,7 @@ static int ipr_ioafp_cap_inquiry(struct ipr_cmnd *ipr_cmd)struct ipr_inquiry_cap *cap = &ioa_cfg->vpd_cbs->cap;ENTER ; - ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; + ipr_cmd->job_step = ipr_ioafp_pageC4_inquiry;memset (cap,0 ,sizeof (*cap));if (ipr_inquiry_page_supported (page0,0xD0 )) {
drivers/scsi/ipr.h +11 -0
@@ -849,6 +849,16 @@ struct ipr_inquiry_page0 {u8 page[IPR_INQUIRY_PAGE0_ENTRIES ]; }__attribute__((packed)); +struct ipr_inquiry_pageC4 { +u8 peri_qual_dev_type; +u8 page_code; +u8 reserved1; +u8 len; +u8 cache_cap[4 ]; +#define IPR_CAP_SYNC_CACHE 0x08 +u8 reserved2[20 ]; +}__attribute__((packed)); +struct ipr_hostrcb_device_data_entry {struct ipr_vpd vpd;struct ipr_res_addr dev_res_addr;
@@ -1322,6 +1332,7 @@ struct ipr_misc_cbs {struct ipr_inquiry_page0 page0_data;struct ipr_inquiry_page3 page3_data;struct ipr_inquiry_cap cap; +struct ipr_inquiry_pageC4 pageC4_data;struct ipr_mode_pages mode_pages;struct ipr_supported_device supp_dev; };
Signature · 1 line
2.1.0
Re: [PATCH 3/5] ipr: Inquiry IOA page 0xC4 during initialization.
Quoted 7 lines · Gabriel Krisman Bertazi
drivers/scsi/ipr.h +0
-0@@ -849,6 +849,16 @@ struct ipr_inquiry_page0 {u8 page[IPR_INQUIRY_PAGE0_ENTRIES ]; }__attribute__((packed));
drivers/scsi/ipr.h struct ipr_inquiry_page0 { · line 860
Quoted 10 lines
drivers/scsi/ipr.h +9
-0+struct ipr_inquiry_pageC4 { +u8 peri_qual_dev_type; +u8 page_code; +u8 reserved1; +u8 len; +u8 cache_cap[4 ]; +#define IPR_CAP_SYNC_CACHE 0x08 +u8 reserved2[20 ]; +}__attribute__((packed));
This triggers a couple complaints from checkpatch. You need a space after the }, which checkpatch flags as an error and __packed is preferred to __attribute__((packed)), which is flagged as a warning. There are a couple of other warnings that checkpatch issues in this series, so you might want to take a look at them, fixup, and resend. We should probably spin a follow up patch to fix up the __attribute__ usage in ipr.h, since you were simply being consistent with that.
Thanks,
Brian
Signature · 3 lines
Brian King Power Linux I/O IBM Linux Technology Center
PATCH 4/5 ipr: Issue Configure Cache Parameters command.
In reply to Gabriel Krisman BertaziSome new adapters require a special Configure Cache Parameters command to enable the adapter write cache, so send this during the adapter initialization if the adapter requires it.
--- drivers/scsi/ipr.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++- drivers/scsi/ipr.h | 4 ++++ 2 files changed, 62 insertions(+), 1 deletion(-)
drivers/scsi/ipr.c +58 -1
@@ -7671,6 +7671,63 @@ static int ipr_ioafp_query_ioa_cfg(struct ipr_cmnd *ipr_cmd)return IPR_RC_JOB_RETURN ; } +static int ipr_ioa_service_action_failed (struct ipr_cmnd *ipr_cmd) +{ +u32 ioasc =be32_to_cpu (ipr_cmd->s.ioasa.hdr.ioasc); + +if (ioasc ==IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT ) +return IPR_RC_JOB_CONTINUE ; + +return ipr_reset_cmd_failed (ipr_cmd); +} + +static void ipr_build_ioa_service_action (struct ipr_cmnd *ipr_cmd, +__be32 res_handle,u8 sa_code) +{ +struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; + + ioarcb->res_handle = res_handle; + ioarcb->cmd_pkt.cdb[0 ] =IPR_IOA_SERVICE_ACTION ; + ioarcb->cmd_pkt.cdb[1 ] = sa_code; + ioarcb->cmd_pkt.request_type =IPR_RQTYPE_IOACMD ; +} + +/** +* ipr_ioafp_set_caching_parameters - Issue Set Cache parameters service +* action +* +* Return value: +* none +**/ +static int ipr_ioafp_set_caching_parameters (struct ipr_cmnd *ipr_cmd) +{ +struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; +struct ipr_ioa_cfg *ioa_cfg = ipr_cmd->ioa_cfg; +struct ipr_inquiry_pageC4 *pageC4 = &ioa_cfg->vpd_cbs->pageC4_data; + +ENTER ; + + ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; + +if (pageC4->cache_cap[0 ] &IPR_CAP_SYNC_CACHE ) { +ipr_build_ioa_service_action (ipr_cmd, +cpu_to_be32 (IPR_IOA_RES_HANDLE ), +IPR_IOA_SA_CHANGE_CACHE_PARAMS ); + + ioarcb->cmd_pkt.cdb[2 ] =0x40 ; + + ipr_cmd->job_step_failed = ipr_ioa_service_action_failed; +ipr_do_req (ipr_cmd, ipr_reset_ioa_job, ipr_timeout, +IPR_SET_SUP_DEVICE_TIMEOUT ); + +LEAVE ; +return IPR_RC_JOB_RETURN ; + } + +LEAVE ; +return IPR_RC_JOB_CONTINUE ; +} +/** * ipr_ioafp_inquiry - Send an Inquiry to the adapter. * @ipr_cmd: ipr command struct
@@ -7738,7 +7795,7 @@ static int ipr_ioafp_pageC4_inquiry(struct ipr_cmnd *ipr_cmd)struct ipr_inquiry_pageC4 *pageC4 = &ioa_cfg->vpd_cbs->pageC4_data;ENTER ; - ipr_cmd->job_step = ipr_ioafp_query_ioa_cfg; + ipr_cmd->job_step = ipr_ioafp_set_caching_parameters;memset (pageC4,0 ,sizeof (*pageC4));if (ipr_inquiry_page_supported (page0,0xC4 )) {
drivers/scsi/ipr.h +4 -0
@@ -216,6 +216,10 @@#define IPR_SET_ALL_SUPPORTED_DEVICES 0x80#define IPR_IOA_SHUTDOWN 0xF7#define IPR_WR_BUF_DOWNLOAD_AND_SAVE 0x05 +#define IPR_IOA_SERVICE_ACTION 0xD2 + +/* IOA Service Actions */ +#define IPR_IOA_SA_CHANGE_CACHE_PARAMS 0x14/* * Timeouts
Signature · 1 line
2.1.0
PATCH 5/5 ipr: Driver version 2.6.3.
In reply to Gabriel Krisman Bertazi--- drivers/scsi/ipr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/ipr.h +2 -2
@@ -39,8 +39,8 @@/* * Literals */ -#define IPR_DRIVER_VERSION "2.6.2" -#define IPR_DRIVER_DATE "(June 11, 2015)" +#define IPR_DRIVER_VERSION "2.6.3" +#define IPR_DRIVER_DATE "(October 17, 2015)"/* * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
Signature · 1 line
2.1.0