Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 204188
b: refs/heads/master
c: 3cb5469
h: refs/heads/master
v: v3
  • Loading branch information
Eric Moore authored and James Bottomley committed Jul 27, 2010
1 parent 9cbc193 commit a4a29c9
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a2f1d139df42df6f3a2641591dea9e068b68f68c
refs/heads/master: 3cb5469a2ab4b87a7c63dd218fdc1625bc73eccc
13 changes: 13 additions & 0 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -1311,6 +1311,9 @@ mpt2sas_base_map_resources(struct MPT2SAS_ADAPTER *ioc)
printk(MPT2SAS_INFO_FMT "ioport(0x%016llx), size(%d)\n",
ioc->name, (unsigned long long)pio_chip, pio_sz);

/* Save PCI configuration state for recovery from PCI AER/EEH errors */
pci_save_state(pdev);

return 0;

out_fail:
Expand Down Expand Up @@ -3407,6 +3410,9 @@ _base_make_ioc_ready(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
dinitprintk(ioc, printk(MPT2SAS_INFO_FMT "%s\n", ioc->name,
__func__));

if (ioc->pci_error_recovery)
return 0;

ioc_state = mpt2sas_base_get_iocstate(ioc, 0);
dhsprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: ioc_state(0x%08x)\n",
ioc->name, __func__, ioc_state));
Expand Down Expand Up @@ -3869,6 +3875,13 @@ mpt2sas_base_hard_reset_handler(struct MPT2SAS_ADAPTER *ioc, int sleep_flag,
dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: enter\n", ioc->name,
__func__));

if (ioc->pci_error_recovery) {
printk(MPT2SAS_ERR_FMT "%s: pci error recovery reset\n",
ioc->name, __func__);
r = 0;
goto out;
}

if (mpt2sas_fwfault_debug)
mpt2sas_halt_firmware(ioc);

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ typedef void (*MPT_ADD_SGE)(void *paddr, u32 flags_length, dma_addr_t dma_addr);
* @ioc_link_reset_in_progress: phy/hard reset in progress
* @ignore_loginfos: ignore loginfos during task managment
* @remove_host: flag for when driver unloads, to avoid sending dev resets
* @pci_error_recovery: flag to prevent ioc access until slot reset completes
* @wait_for_port_enable_to_complete:
* @msix_enable: flag indicating msix is enabled
* @msix_vector_count: number msix vectors
Expand Down Expand Up @@ -617,6 +618,7 @@ struct MPT2SAS_ADAPTER {

u8 ignore_loginfos;
u8 remove_host;
u8 pci_error_recovery;
u8 wait_for_port_enable_to_complete;

u8 msix_enable;
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/mpt2sas/mpt2sas_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ _config_request(struct MPT2SAS_ADAPTER *ioc, Mpi2ConfigRequest_t
if (ioc->config_cmds.smid == smid)
mpt2sas_base_free_smid(ioc, smid);
if ((ioc->shost_recovery) || (ioc->config_cmds.status &
MPT2_CMD_RESET))
MPT2_CMD_RESET) || ioc->pci_error_recovery)
goto retry_config;
issue_host_reset = 1;
r = -EFAULT;
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2156,7 +2156,7 @@ _ctl_ioctl_main(struct file *file, unsigned int cmd, void __user *arg)
!ioc)
return -ENODEV;

if (ioc->shost_recovery)
if (ioc->shost_recovery || ioc->pci_error_recovery)
return -EAGAIN;

if (_IOC_SIZE(cmd) == sizeof(struct mpt2_ioctl_command)) {
Expand Down Expand Up @@ -2275,7 +2275,7 @@ _ctl_compat_mpt_command(struct file *file, unsigned cmd, unsigned long arg)
if (_ctl_verify_adapter(karg32.hdr.ioc_number, &ioc) == -1 || !ioc)
return -ENODEV;

if (ioc->shost_recovery)
if (ioc->shost_recovery || ioc->pci_error_recovery)
return -EAGAIN;

memset(&karg, 0, sizeof(struct mpt2_ioctl_command));
Expand Down
47 changes: 35 additions & 12 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_scsih.c
Original file line number Diff line number Diff line change
Expand Up @@ -1997,7 +1997,8 @@ mpt2sas_scsih_issue_tm(struct MPT2SAS_ADAPTER *ioc, u16 handle, uint channel,
goto err_out;
}

if (ioc->shost_recovery || ioc->remove_host) {
if (ioc->shost_recovery || ioc->remove_host ||
ioc->pci_error_recovery) {
printk(MPT2SAS_INFO_FMT "%s: host reset in progress!\n",
__func__, ioc->name);
rc = FAILED;
Expand Down Expand Up @@ -2644,7 +2645,8 @@ _scsih_tm_tr_send(struct MPT2SAS_ADAPTER *ioc, u16 handle)
unsigned long flags;
struct _tr_list *delayed_tr;

if (ioc->shost_recovery || ioc->remove_host) {
if (ioc->shost_recovery || ioc->remove_host ||
ioc->pci_error_recovery) {
dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host reset in "
"progress!\n", __func__, ioc->name));
return;
Expand Down Expand Up @@ -2742,7 +2744,8 @@ _scsih_tm_tr_volume_send(struct MPT2SAS_ADAPTER *ioc, u16 handle)
u16 smid;
struct _tr_list *delayed_tr;

if (ioc->shost_recovery || ioc->remove_host) {
if (ioc->shost_recovery || ioc->remove_host ||
ioc->pci_error_recovery) {
dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host reset in "
"progress!\n", __func__, ioc->name));
return;
Expand Down Expand Up @@ -2793,7 +2796,8 @@ _scsih_tm_volume_tr_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid,
Mpi2SCSITaskManagementReply_t *mpi_reply =
mpt2sas_base_get_reply_virt_addr(ioc, reply);

if (ioc->shost_recovery || ioc->remove_host) {
if (ioc->shost_recovery || ioc->remove_host ||
ioc->pci_error_recovery) {
dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host reset in "
"progress!\n", __func__, ioc->name));
return 1;
Expand Down Expand Up @@ -2845,7 +2849,8 @@ _scsih_tm_tr_complete(struct MPT2SAS_ADAPTER *ioc, u16 smid, u8 msix_index,
Mpi2SasIoUnitControlRequest_t *mpi_request;
u16 smid_sas_ctrl;

if (ioc->shost_recovery || ioc->remove_host) {
if (ioc->shost_recovery || ioc->remove_host ||
ioc->pci_error_recovery) {
dewtprintk(ioc, printk(MPT2SAS_INFO_FMT "%s: host reset in "
"progress!\n", __func__, ioc->name));
return 1;
Expand Down Expand Up @@ -3187,7 +3192,10 @@ _scsih_flush_running_cmds(struct MPT2SAS_ADAPTER *ioc)
count++;
mpt2sas_base_free_smid(ioc, smid);
scsi_dma_unmap(scmd);
scmd->result = DID_RESET << 16;
if (ioc->pci_error_recovery)
scmd->result = DID_NO_CONNECT << 16;
else
scmd->result = DID_RESET << 16;
scmd->scsi_done(scmd);
}
dtmprintk(ioc, printk(MPT2SAS_INFO_FMT "completing %d cmds\n",
Expand Down Expand Up @@ -3324,6 +3332,12 @@ _scsih_qcmd(struct scsi_cmnd *scmd, void (*done)(struct scsi_cmnd *))
return 0;
}

if (ioc->pci_error_recovery) {
scmd->result = DID_NO_CONNECT << 16;
scmd->scsi_done(scmd);
return 0;
}

sas_target_priv_data = sas_device_priv_data->sas_target;
/* invalid device handle */
if (sas_target_priv_data->handle == MPT2SAS_INVALID_DEVICE_HANDLE) {
Expand Down Expand Up @@ -4156,7 +4170,7 @@ _scsih_expander_add(struct MPT2SAS_ADAPTER *ioc, u16 handle)
if (!handle)
return -1;

if (ioc->shost_recovery)
if (ioc->shost_recovery || ioc->pci_error_recovery)
return -1;

if ((mpt2sas_config_get_expander_pg0(ioc, &mpi_reply, &expander_pg0,
Expand Down Expand Up @@ -4734,7 +4748,7 @@ _scsih_sas_topology_change_event(struct MPT2SAS_ADAPTER *ioc,
_scsih_sas_topology_change_event_debug(ioc, event_data);
#endif

if (ioc->shost_recovery || ioc->remove_host)
if (ioc->shost_recovery || ioc->remove_host || ioc->pci_error_recovery)
return;

if (!ioc->sas_hba.num_phys)
Expand Down Expand Up @@ -4773,7 +4787,8 @@ _scsih_sas_topology_change_event(struct MPT2SAS_ADAPTER *ioc,
"expander event\n", ioc->name));
return;
}
if (ioc->shost_recovery || ioc->remove_host)
if (ioc->shost_recovery || ioc->remove_host ||
ioc->pci_error_recovery)
return;
phy_number = event_data->StartPhyNum + i;
reason_code = event_data->PHY[i].PhyStatus &
Expand Down Expand Up @@ -6273,7 +6288,8 @@ _firmware_event_work(struct work_struct *work)
struct MPT2SAS_ADAPTER *ioc = fw_event->ioc;

/* the queue is being flushed so ignore this event */
if (ioc->remove_host || fw_event->cancel_pending_work) {
if (ioc->remove_host || fw_event->cancel_pending_work ||
ioc->pci_error_recovery) {
_scsih_fw_event_free(ioc, fw_event);
return;
}
Expand Down Expand Up @@ -6355,7 +6371,7 @@ mpt2sas_scsih_event_callback(struct MPT2SAS_ADAPTER *ioc, u8 msix_index,
u16 sz;

/* events turned off due to host reset or driver unloading */
if (ioc->remove_host)
if (ioc->remove_host || ioc->pci_error_recovery)
return 1;

mpi_reply = mpt2sas_base_get_reply_virt_addr(ioc, reply);
Expand Down Expand Up @@ -7058,12 +7074,17 @@ _scsih_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)
case pci_channel_io_normal:
return PCI_ERS_RESULT_CAN_RECOVER;
case pci_channel_io_frozen:
/* Fatal error, prepare for slot reset */
ioc->pci_error_recovery = 1;
scsi_block_requests(ioc->shost);
mpt2sas_base_stop_watchdog(ioc);
mpt2sas_base_free_resources(ioc);
return PCI_ERS_RESULT_NEED_RESET;
case pci_channel_io_perm_failure:
_scsih_remove(pdev);
/* Permanent error, prepare for device removal */
ioc->pci_error_recovery = 1;
mpt2sas_base_stop_watchdog(ioc);
_scsih_flush_running_cmds(ioc);
return PCI_ERS_RESULT_DISCONNECT;
}
return PCI_ERS_RESULT_NEED_RESET;
Expand All @@ -7087,7 +7108,9 @@ _scsih_pci_slot_reset(struct pci_dev *pdev)
printk(MPT2SAS_INFO_FMT "PCI error: slot reset callback!!\n",
ioc->name);

ioc->pci_error_recovery = 0;
ioc->pdev = pdev;
pci_restore_state(pdev);
rc = mpt2sas_base_map_resources(ioc);
if (rc)
return PCI_ERS_RESULT_DISCONNECT;
Expand Down
8 changes: 4 additions & 4 deletions trunk/drivers/scsi/mpt2sas/mpt2sas_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ _transport_set_identify(struct MPT2SAS_ADAPTER *ioc, u16 handle,
u32 device_info;
u32 ioc_status;

if (ioc->shost_recovery) {
if (ioc->shost_recovery || ioc->pci_error_recovery) {
printk(MPT2SAS_INFO_FMT "%s: host reset in progress!\n",
__func__, ioc->name);
return -EFAULT;
Expand Down Expand Up @@ -302,7 +302,7 @@ _transport_expander_report_manufacture(struct MPT2SAS_ADAPTER *ioc,
u64 *sas_address_le;
u16 wait_state_count;

if (ioc->shost_recovery) {
if (ioc->shost_recovery || ioc->pci_error_recovery) {
printk(MPT2SAS_INFO_FMT "%s: host reset in progress!\n",
__func__, ioc->name);
return -EFAULT;
Expand Down Expand Up @@ -894,7 +894,7 @@ mpt2sas_transport_update_links(struct MPT2SAS_ADAPTER *ioc,
struct _sas_node *sas_node;
struct _sas_phy *mpt2sas_phy;

if (ioc->shost_recovery)
if (ioc->shost_recovery || ioc->pci_error_recovery)
return;

spin_lock_irqsave(&ioc->sas_node_lock, flags);
Expand Down Expand Up @@ -997,7 +997,7 @@ _transport_get_expander_phy_error_log(struct MPT2SAS_ADAPTER *ioc,
u64 *sas_address_le;
u16 wait_state_count;

if (ioc->shost_recovery) {
if (ioc->shost_recovery || ioc->pci_error_recovery) {
printk(MPT2SAS_INFO_FMT "%s: host reset in progress!\n",
__func__, ioc->name);
return -EFAULT;
Expand Down

0 comments on commit a4a29c9

Please sign in to comment.