Skip to contentSkip to conversation

isci updates for 3.2

PATCH Superseded Dan Williams 2 participants 10 messages Sep 29, 2011 – Oct 1, 2011

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover isci updates for 3.2

This series functionally depends on the pending libsas fix for ata lun scanning. For convenience those updates have been queued to "git://github.com:djbw/linux.git libsas".

The following changes since commit 7705375e944ea94be7941b740efd0a77bb109cb1:

libsas: remove unused ata_task_resp fields (2011-09-28 18:06:10 -0700)

are available in the git repository at:
git://github.com:djbw/linux.git isci

The prominent update in this set is atapi support. The rest are small bug fixes and feature enhancements. More error handling and command termination fixes are in the works.

Dan Williams (2):
isci: atapi support
isci: export phy events via ->lldd_control_phy()

Jeff Skirvin (3):
isci: SATA/STP I/O is only returned in the normal path to libsas
isci: fix decode of DONE_CRC_ERR TC completion status
isci: The port state should be set to stopping on the last phy.

 drivers/scsi/aic94xx/aic94xx_scb.c  |    1 +
 drivers/scsi/isci/phy.c             |   11 ++
 drivers/scsi/isci/port.c            |    2 +-
 drivers/scsi/isci/remote_device.c   |   24 +++
 drivers/scsi/isci/remote_device.h   |    9 +
 drivers/scsi/isci/request.c         |  330 +++++++++++++++++++++++++++++++++--
 drivers/scsi/isci/request.h         |   28 +++-
 drivers/scsi/isci/task.h            |   19 ++
 drivers/scsi/libsas/sas_init.c      |   13 +-
 drivers/scsi/libsas/sas_scsi_host.c |    2 +-
 drivers/scsi/mvsas/mv_sas.c         |    2 +-
 drivers/scsi/pm8001/pm8001_sas.c    |    2 +-
 include/scsi/libsas.h               |    5 +
 include/scsi/sas.h                  |    1 +
 14 files changed, 424 insertions(+), 25 deletions(-)
#4 lore raw

PATCH 2/5 isci: SATA/STP I/O is only returned in the normal path to libsas

From: Jeff Skirvin <[email protected]>

Since libsas has it's own means to escalate SATA/STP device error handling depending on task status codes, return all SATA/STP I/O on the normal path.

i.e. skip sas_task_abort() and let sas_ata_task_done() disposition the qc. Longer term we want to audit non-essential calls to sas_task_abort().

---
 drivers/scsi/isci/task.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
drivers/scsi/isci/task.h +19 -0
index 4a7fa90..15b18d1 100644
@@ -286,6 +286,25 @@ isci_task_set_completion_status(
 	task->task_status.resp = response;
 	task->task_status.stat = status;
 
+	switch (task->task_proto) {
+
+	case SAS_PROTOCOL_SATA:
+	case SAS_PROTOCOL_STP:
+	case SAS_PROTOCOL_SATA | SAS_PROTOCOL_STP:
+
+		if (task_notification_selection
+		    == isci_perform_error_io_completion) {
+			/* SATA/STP I/O has it's own means of scheduling device
+			* error handling on the normal path.
+			*/
+			task_notification_selection
+				= isci_perform_normal_io_completion;
+		}
+		break;
+	default:
+		break;
+	}
+
 	switch (task_notification_selection) {
 
 	case isci_perform_error_io_completion:
#1 lore raw

PATCH 1/5 isci: atapi support

In reply to Dan Williams

Based on original implementation from Jiangbi Liu and Maciej Trela.

ATAPI transfers happen in two-to-three stages. The two stage atapi commands are those that include a dma data transfer. The data transfer portion of these operations is handled by the hardware packet-dma acceleration. The three-stage commands do not have a data transfer and are handled without hardware assistance in raw frame mode.

stage1: transmit host-to-device fis to notify the device of an incoming atapi cdb. Upon reception of the pio-setup-fis repost the task_context to perform the dma transfer of the cdb+data (go to stage3), or repost the task_context to transmit the cdb as a raw frame (go to stage 2).

stage2: wait for hardware notification of the cdb transmission and then go to stage 3.

stage3: wait for the arrival of the terminating device-to-host fis and terminate the command.

To keep the implementation simple we only support ATAPI packet-dma protocol (for commands with data) to avoid needing to handle the data transfer manually (like we do for SATA-PIO). This may affect compatibility for a small number of devices (see ATA_HORKAGE_ATAPI_MOD16_DMA).

If the data-transfer underruns, or encounters an error the device-to-host fis is expected to arrive in the unsolicited frame queue to pass to libata for disposition. However, in the DONE_UNEXP_FIS (data underrun) case it appears we need to craft a response. In the DONE_REG_ERR case we do receive the UF and propagate it to libsas.

---
 drivers/scsi/isci/remote_device.c   |   24 +++
 drivers/scsi/isci/remote_device.h   |    9 +
 drivers/scsi/isci/request.c         |  327 ++++++++++++++++++++++++++++++++++-
 drivers/scsi/isci/request.h         |   28 +++
 drivers/scsi/libsas/sas_scsi_host.c |    2 
 include/scsi/libsas.h               |    5 +
 6 files changed, 379 insertions(+), 16 deletions(-)
drivers/scsi/isci/remote_device.c +24 -0
index b6e6368..fbf9ce2 100644
@@ -386,6 +386,18 @@ static bool is_remote_device_ready(struct isci_remote_device *idev)
 	}
 }
 
+/*
+ * called once the remote node context has transisitioned to a ready
+ * state (after suspending RX and/or TX due to early D2H fis)
+ */
+static void atapi_remote_device_resume_done(void *_dev)
+{
+	struct isci_remote_device *idev = _dev;
+	struct isci_request *ireq = idev->working_request;
+
+	sci_change_state(&ireq->sm, SCI_REQ_COMPLETED);
+}
+
 enum sci_status sci_remote_device_event_handler(struct isci_remote_device *idev,
 						     u32 event_code)
 {
@@ -432,6 +444,16 @@ enum sci_status sci_remote_device_event_handler(struct isci_remote_device *idev,
 	if (status != SCI_SUCCESS)
 		return status;
 
+	if (state == SCI_STP_DEV_ATAPI_ERROR) {
+		/* For ATAPI error state resume the RNC right away. */
+		if (scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX ||
+		    scu_get_event_type(event_code) == SCU_EVENT_TYPE_RNC_SUSPEND_TX_RX) {
+			return sci_remote_node_context_resume(&idev->rnc,
+							      atapi_remote_device_resume_done,
+							      idev);
+		}
+	}
+
 	if (state == SCI_STP_DEV_IDLE) {
 
 		/* We pick up suspension events to handle specifically to this
@@ -625,6 +647,7 @@ enum sci_status sci_remote_device_complete_io(struct isci_host *ihost,
 	case SCI_STP_DEV_CMD:
 	case SCI_STP_DEV_NCQ:
 	case SCI_STP_DEV_NCQ_ERROR:
+	case SCI_STP_DEV_ATAPI_ERROR:
 		status = common_complete_io(iport, idev, ireq);
 		if (status != SCI_SUCCESS)
 			break;
@@ -1020,6 +1043,7 @@ static const struct sci_base_state sci_remote_device_state_table[] = {
 	[SCI_STP_DEV_NCQ_ERROR] = {
 		.enter_state = sci_stp_remote_device_ready_ncq_error_substate_enter,
 	},
+	[SCI_STP_DEV_ATAPI_ERROR] = { },
 	[SCI_STP_DEV_AWAIT_RESET] = { },
 	[SCI_SMP_DEV_IDLE] = {
 		.enter_state = sci_smp_remote_device_ready_idle_substate_enter,
drivers/scsi/isci/remote_device.h +9 -0
index 57ccfc3..e1747ea 100644
@@ -244,6 +244,15 @@ enum sci_remote_device_states {
 	SCI_STP_DEV_NCQ_ERROR,
 
 	/**
+	 * This is the ATAPI error state for the STP ATAPI remote device.
+	 * This state is entered when ATAPI device sends error status FIS
+	 * without data while the device object is in CMD state.
+	 * A suspension event is expected in this state.
+	 * The device object will resume right away.
+	 */
+	SCI_STP_DEV_ATAPI_ERROR,
+
+	/**
 	 * This is the READY substate indicates the device is waiting for the RESET task
 	 * coming to be recovered from certain hardware specific error.
 	 */
drivers/scsi/isci/request.c +314 -13

429 lines not on this page · raw message

drivers/scsi/isci/request.h +26 -2
index 7a1d5a9..1fd4f07 100644
@@ -96,7 +96,6 @@ enum sci_request_protocol {
  *	     to wait for another fis or if the transfer is complete.  Upon
  *           receipt of a d2h fis this will be the status field of that fis.
  * @sgl - track pio transfer progress as we iterate through the sgl
- * @device_cdb_len - atapi device advertises it's transfer constraints at setup
  */
 struct isci_stp_request {
 	u32 pio_len;
@@ -107,7 +106,6 @@ struct isci_stp_request {
 		u8 set;
 		u32 offset;
 	} sgl;
-	u32 device_cdb_len;
 };
 
 struct isci_request {
@@ -252,6 +250,32 @@ enum sci_base_request_states {
 	SCI_REQ_STP_PIO_DATA_OUT,
 
 	/*
+	 * While in this state the IO request object is waiting for the TC
+	 * completion notification for the H2D Register FIS
+	 */
+	SCI_REQ_ATAPI_WAIT_H2D,
+
+	/*
+	 * While in this state the IO request object is waiting for either a
+	 * PIO Setup.
+	 */
+	SCI_REQ_ATAPI_WAIT_PIO_SETUP,
+
+	/*
+	 * The non-data IO transit to this state in this state after receiving
+	 * TC completion. While in this state IO request object is waiting for
+	 * D2H status frame as UF.
+	 */
+	SCI_REQ_ATAPI_WAIT_D2H,
+
+	/*
+	 * When transmitting raw frames hardware reports task context completion
+	 * after every frame submission, so in the non-accelerated case we need
+	 * to expect the completion for the "cdb" frame.
+	 */
+	SCI_REQ_ATAPI_WAIT_TC_COMP,
+
+	/*
 	 * The AWAIT_TC_COMPLETION sub-state indicates that the started raw
 	 * task management request is waiting for the transmission of the
 	 * initial frame (i.e. command, task, etc.).
drivers/scsi/libsas/sas_scsi_host.c +1 -1
index ebd1417..b2c4a77 100644
@@ -801,7 +801,7 @@ void sas_slave_destroy(struct scsi_device *scsi_dev)
 	struct domain_device *dev = sdev_to_domain_dev(scsi_dev);
 
 	if (dev_is_sata(dev))
-		dev->sata_dev.ap->link.device[0].class = ATA_DEV_NONE;
+		sas_to_ata_dev(dev)->class = ATA_DEV_NONE;
 }
 
 int sas_change_queue_depth(struct scsi_device *sdev, int depth, int reason)
include/scsi/libsas.h +5 -0
index 0d78bfa..6d5185c 100644
@@ -383,6 +383,11 @@ sdev_to_domain_dev(struct scsi_device *sdev) {
 	return starget_to_domain_dev(sdev->sdev_target);
 }
 
+static inline struct ata_device *sas_to_ata_dev(struct domain_device *dev)
+{
+	return &dev->sata_dev.ap->link.device[0];
+}
+
 static inline struct domain_device *
 cmd_to_domain_dev(struct scsi_cmnd *cmd)
 {
#5 lore raw

PATCH 3/5 isci: fix decode of DONE_CRC_ERR TC completion status

In reply to Dan Williams

From: Jeff Skirvin <[email protected]>

DONE_CRC_ERR is not a RNC suspension condition, so do not change the state to expect the incoming suspension notification.

[djbw: dropped DONE_CMD_LL_R_ERR change]
---
 drivers/scsi/isci/request.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/scsi/isci/request.c +1 -2
index 2bf072f..d431564 100644
@@ -2072,10 +2072,9 @@ static enum sci_status stp_request_udma_await_tc_event(struct isci_request *ireq
 	case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_MAX_PLD_ERR):
 	case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_LL_R_ERR):
 	case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CMD_LL_R_ERR):
-	case SCU_MAKE_COMPLETION_STATUS(SCU_TASK_DONE_CRC_ERR):
 		sci_remote_device_suspend(ireq->target_device,
 			SCU_EVENT_SPECIFIC(SCU_NORMALIZE_COMPLETION_STATUS(completion_code)));
-	/* Fall through to the default case */
+		/* Fall through to the default case */
 	default:
 		/* All other completion status cause the IO to be complete. */
 		ireq->scu_status = SCU_NORMALIZE_COMPLETION_STATUS(completion_code);
#6 lore raw

PATCH 4/5 isci: The port state should be set to stopping on the last phy.

In reply to Dan Williams

From: Jeff Skirvin <[email protected]>

Fixes a bug where any phy removed from the port set the port state to "stopping" - do this only when the last phy removed from the port.

---
 drivers/scsi/isci/port.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/isci/port.c +1 -1
index 8f6f9b7..8e59c88 100644
@@ -294,8 +294,8 @@ static void isci_port_link_down(struct isci_host *isci_host,
 					__func__, isci_device);
 				set_bit(IDEV_GONE, &isci_device->flags);
 			}
+			isci_port_change_state(isci_port, isci_stopping);
 		}
-		isci_port_change_state(isci_port, isci_stopping);
 	}
 
 	/* Notify libsas of the borken link, this will trigger calls to our
#7 lore raw

PATCH 5/5 isci: export phy events via ->lldd_control_phy()

In reply to Dan Williams

Allow the sas-transport-class to update events for local phys via a new PHY_FUNC_GET_EVENTS command to ->lldd_control_phy(). Fixup drivers that are not prepared for new enum phy_func values, and unify ->lldd_control_phy() error codes.

These are the SAS defined phy events that are reported in a smp-report-phy-error-log command:
* /sys/class/sas_phy/<phyX>/invalid_dword_count
* /sys/class/sas_phy/<phyX>/running_disparity_error_count
* /sys/class/sas_phy/<phyX>/loss_of_dword_sync_count
* /sys/class/sas_phy/<phyX>/phy_reset_problem_count

Cc Sreeram Patnam <[email protected]>
---
 drivers/scsi/aic94xx/aic94xx_scb.c |    1 +
 drivers/scsi/isci/phy.c            |   11 +++++++++++
 drivers/scsi/libsas/sas_init.c     |   13 +++++++++----
 drivers/scsi/mvsas/mv_sas.c        |    2 +-
 drivers/scsi/pm8001/pm8001_sas.c   |    2 +-
 include/scsi/sas.h                 |    1 +
 6 files changed, 24 insertions(+), 6 deletions(-)
drivers/scsi/aic94xx/aic94xx_scb.c +1 -0
index 2959327..fdac7c2 100644
@@ -906,6 +906,7 @@ int asd_control_phy(struct asd_sas_phy *phy, enum phy_func func, void *arg)
 
 	switch (func) {
 	case PHY_FUNC_CLEAR_ERROR_LOG:
+	case PHY_FUNC_GET_EVENTS:
 		return -ENOSYS;
 	case PHY_FUNC_SET_LINK_RATE:
 		rates = arg;
drivers/scsi/isci/phy.c +11 -0
index 430fc8f..ab48bb1 100644
@@ -1313,6 +1313,17 @@ int isci_phy_control(struct asd_sas_phy *sas_phy,
 		ret = isci_port_perform_hard_reset(ihost, iport, iphy);
 
 		break;
+	case PHY_FUNC_GET_EVENTS: {
+		struct scu_link_layer_registers __iomem *r;
+		struct sas_phy *phy = sas_phy->phy;
+
+		r = iphy->link_layer_registers;
+		phy->running_disparity_error_count = readl(&r->running_disparity_error_count);
+		phy->loss_of_dword_sync_count = readl(&r->loss_of_sync_error_count);
+		phy->phy_reset_problem_count = readl(&r->phy_reset_problem_count);
+		phy->invalid_dword_count = readl(&r->invalid_dword_counter);
+		break;
+	}
 
 	default:
 		dev_dbg(&ihost->pdev->dev,
drivers/scsi/libsas/sas_init.c +9 -4
index dd56ea8..d81c3b1 100644
@@ -177,10 +177,15 @@ int sas_unregister_ha(struct sas_ha_struct *sas_ha)
 
 static int sas_get_linkerrors(struct sas_phy *phy)
 {
-	if (scsi_is_sas_phy_local(phy))
-		/* FIXME: we have no local phy stats
-		 * gathering at this time */
-		return -EINVAL;
+	if (scsi_is_sas_phy_local(phy)) {
+		struct Scsi_Host *shost = dev_to_shost(phy->dev.parent);
+		struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
+		struct asd_sas_phy *asd_phy = sas_ha->sas_phy[phy->number];
+		struct sas_internal *i =
+			to_sas_internal(sas_ha->core.shost->transportt);
+
+		return i->dft->lldd_control_phy(asd_phy, PHY_FUNC_GET_EVENTS, NULL);
+	}
 
 	return sas_smp_get_phy_events(phy);
 }
drivers/scsi/mvsas/mv_sas.c +1 -1
index f2ac01f..5672bd7 100644
@@ -214,7 +214,7 @@ int mvs_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 		break;
 	case PHY_FUNC_RELEASE_SPINUP_HOLD:
 	default:
-		rc = -EOPNOTSUPP;
+		rc = -ENOSYS;
 	}
 	msleep(200);
 	return rc;
drivers/scsi/pm8001/pm8001_sas.c +1 -1
index 9068f12..2d5494e 100644
@@ -210,7 +210,7 @@ int pm8001_phy_control(struct asd_sas_phy *sas_phy, enum phy_func func,
 		PM8001_CHIP_DISP->phy_stop_req(pm8001_ha, phy_id);
 		break;
 	default:
-		rc = -EOPNOTSUPP;
+		rc = -ENOSYS;
 	}
 	msleep(300);
 	return rc;
include/scsi/sas.h +1 -0
index a3001ad..be6a36c 100644
@@ -121,6 +121,7 @@ enum phy_func {
 	PHY_FUNC_TX_SATA_PS_SIGNAL,
 	PHY_FUNC_RELEASE_SPINUP_HOLD = 0x10, /* LOCAL PORT ONLY! */
 	PHY_FUNC_SET_LINK_RATE,
+	PHY_FUNC_GET_EVENTS,
 };
 
 /* SAS LLDD would need to report only _very_few_ of those, like BROADCAST.
#8 lore raw
In reply to Dan Williams

...need to fix up the git urls.

Quoted 3 lines · Dan Williams

This series functionally depends on the pending libsas fix for ata lun scanning.  For convenience those updates have been queued to "git://github.com:djbw/linux.git libsas".

git://github.com/djbw/linux.git libsas

Quoted 6 lines

The following changes since commit 7705375e944ea94be7941b740efd0a77bb109cb1:

 libsas: remove unused ata_task_resp fields (2011-09-28 18:06:10 -0700)

are available in the git repository at:
 git://github.com:djbw/linux.git isci

git://github.com/djbw/linux.git isci
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Acked-by on v1 1/5
#2 lore raw

Re: [PATCH 1/5] isci: atapi support

In reply to Dan Williams
Quoted 33 lines · Dan Williams

Based on original implementation from Jiangbi Liu and Maciej Trela.

ATAPI transfers happen in two-to-three stages. The two stage atapi commands are those that include a dma data transfer. The data transfer portion of these operations is handled by the hardware packet-dma acceleration. The three-stage commands do not have a data transfer and are handled without hardware assistance in raw frame mode.

stage1: transmit host-to-device fis to notify the device of an incoming atapi cdb. Upon reception of the pio-setup-fis repost the task_context to perform the dma transfer of the cdb+data (go to stage3), or repost the task_context to transmit the cdb as a raw frame (go to stage 2).

stage2: wait for hardware notification of the cdb transmission and then go to stage 3.

stage3: wait for the arrival of the terminating device-to-host fis and terminate the command.

To keep the implementation simple we only support ATAPI packet-dma protocol (for commands with data) to avoid needing to handle the data transfer manually (like we do for SATA-PIO). This may affect compatibility for a small number of devices (see ATA_HORKAGE_ATAPI_MOD16_DMA).

If the data-transfer underruns, or encounters an error the device-to-host fis is expected to arrive in the unsolicited frame queue to pass to libata for disposition. However, in the DONE_UNEXP_FIS (data underrun) case it appears we need to craft a response. In the DONE_REG_ERR case we do receive the UF and propagate it to libsas.

Quoted 8 lines
---
  drivers/scsi/isci/remote_device.c   |   24 +++
  drivers/scsi/isci/remote_device.h   |    9 +
  drivers/scsi/isci/request.c         |  327 ++++++++++++++++++++++++++++++++++-
  drivers/scsi/isci/request.h         |   28 +++
  drivers/scsi/libsas/sas_scsi_host.c |    2
  include/scsi/libsas.h               |    5 +
  6 files changed, 379 insertions(+), 16 deletions(-)
#3 lore raw

Re: [PATCH 1/5] isci: atapi support

In reply to Dan Williams
Quoted 42 lines · Dan Williams

Based on original implementation from Jiangbi Liu and Maciej Trela.

ATAPI transfers happen in two-to-three stages.  The two stage atapi commands are those that include a dma data transfer.  The data transfer portion of these operations is handled by the hardware packet-dma acceleration.  The three-stage commands do not have a data transfer and are handled without hardware assistance in raw frame mode.

stage1: transmit host-to-device fis to notify the device of an incoming atapi cdb.  Upon reception of the pio-setup-fis repost the task_context to perform the dma transfer of the cdb+data (go to stage3), or repost the task_context to transmit the cdb as a raw frame (go to stage 2).

stage2: wait for hardware notification of the cdb transmission and then go to stage 3.

stage3: wait for the arrival of the terminating device-to-host fis and terminate the command.

To keep the implementation simple we only support ATAPI packet-dma protocol (for commands with data) to avoid needing to handle the data transfer manually (like we do for SATA-PIO).  This may affect compatibility for a small number of devices (see ATA_HORKAGE_ATAPI_MOD16_DMA).

If the data-transfer underruns, or encounters an error the device-to-host fis is expected to arrive in the unsolicited frame queue to pass to libata for disposition.  However, in the DONE_UNEXP_FIS (data underrun) case it appears we need to craft a response.  In the DONE_REG_ERR case we do receive the UF and propagate it to libsas.

---
 drivers/scsi/isci/remote_device.c   |   24 +++ drivers/scsi/isci/remote_device.h   |    9 + drivers/scsi/isci/request.c         |  327 ++++++++++++++++++++++++++++++++++- drivers/scsi/isci/request.h         |   28 +++ drivers/scsi/libsas/sas_scsi_host.c |    2
 include/scsi/libsas.h               |    5 +

 6 files changed, 379 insertions(+), 16 deletions(-)

[..]

Quoted 4 lines
drivers/scsi/isci/request.c +0 -0
index b5d3a8c..2bf072f 100644

[..]

Quoted 27 lines
drivers/scsi/isci/request.c +1 -1
@@ -2802,26 +3096,29 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm)
         * substates
         */
        if (!task && dev->dev_type == SAS_END_DEV) {
-               sci_change_state(sm, SCI_REQ_TASK_WAIT_TC_COMP);
+               state = SCI_REQ_TASK_WAIT_TC_COMP;
        } else if (!task &&

                  (isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_high || isci_request_access_tmf(ireq)->tmf_code == isci_tmf_sata_srst_low)) {
-               sci_change_state(sm, SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED);
+               state = SCI_REQ_STP_SOFT_RESET_WAIT_H2D_ASSERTED;
       } else if (task && task->task_proto == SAS_PROTOCOL_SMP) {
-               sci_change_state(sm, SCI_REQ_SMP_WAIT_RESP);
+               state = SCI_REQ_SMP_WAIT_RESP;
       } else if (task && sas_protocol_ata(task->task_proto) && !task->ata_task.use_ncq) {
-               u32 state;
-
-               if (task->data_dir == DMA_NONE)
+               if (dev->sata_dev.command_set == ATAPI_COMMAND_SET &&
+                       task->ata_task.fis.command == ATA_CMD_PACKET) {
+                       state = SCI_REQ_ATAPI_WAIT_H2D;
+               } else if (task->data_dir == DMA_NONE) {
                       state = SCI_REQ_STP_NON_DATA_WAIT_H2D;
-               else if (task->ata_task.dma_xfer)
+               } else if (task->ata_task.dma_xfer) {
                       state = SCI_REQ_STP_UDMA_WAIT_TC_COMP;

Quoted 8 lines

-               else /* PIO */
+               } else /* PIO */ {
                       state = SCI_REQ_STP_PIO_WAIT_H2D; -
-               sci_change_state(sm, state);
+               }
+       } else {
+               BUG();

Unfortunately this was part of a last minute "cleanup" that missed the fact that SSP and STP-NCQ commands are fully accelerated and do not have a substate. To prevent this mistake in the future I changed this to:

@@ -3106,7 +3106,8 @@ static void sci_request_started_state_enter(struct sci_base_state_machine *sm)

                        state = SCI_REQ_STP_PIO_WAIT_H2D;
                }
        } else {
-               BUG();
+               /* SSP or NCQ are fully accelerated, no substates */
+               return;
        }
        sci_change_state(sm, state);

}

A v2 will be posted shortly and the github branch will be updated.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw
In reply to Dan Williams
Quoted 6 lines · Dan Williams

This series functionally depends on the pending libsas fix for ata lun scanning.  For convenience those updates have been queued to "git://github.com:djbw/linux.git libsas".

The following changes since commit 7705375e944ea94be7941b740efd0a77bb109cb1:

Quoted 9 lines

 libsas: remove unused ata_task_resp fields (2011-09-28 18:06:10 -0700)

are available in the git repository at:
 git://github.com:djbw/linux.git isci

The prominent update in this set is atapi support.  The rest are small bug fixes and feature enhancements.  More error handling and command termination fixes are in the works.

Reflowed with the fixed version of the atapi patch.

drivers/scsi/isci/request.c +0 -0
index cb3dd6e..565a9f0 100644
@@ -3106,7 +3106,8 @@ static void

sci_request_started_state_enter(struct sci_base_state_machine *sm)

                        state = SCI_REQ_STP_PIO_WAIT_H2D;
                }
        } else {
-               BUG();
+               /* SSP or NCQ are fully accelerated, no substates */
+               return;
        }
        sci_change_state(sm, state);

}

New diffstat below.

The following changes since commit a265fbf9a7c4321a71394bdce22da2be119fdba1:

libsas: set rphy sas_address and device type correctly (2011-09-30
18:35:16 -0700)

are available in the git repository at:
git://github.com/djbw/linux.git isci

Dan Williams (2):
isci: atapi support
isci: export phy events via ->lldd_control_phy()

Jeff Skirvin (3):
isci: SATA/STP I/O is only returned in the normal path to libsas
isci: fix decode of DONE_CRC_ERR TC completion status
isci: The port state should be set to stopping on the last phy.

 drivers/scsi/aic94xx/aic94xx_scb.c  |    1 +
 drivers/scsi/isci/phy.c             |   11 ++
 drivers/scsi/isci/port.c            |    2 +-
 drivers/scsi/isci/remote_device.c   |   24 +++
 drivers/scsi/isci/remote_device.h   |    9 +
 drivers/scsi/isci/request.c         |  331 +++++++++++++++++++++++++++++++++--
 drivers/scsi/isci/request.h         |   28 +++-
 drivers/scsi/isci/task.h            |   19 ++
 drivers/scsi/libsas/sas_init.c      |   13 +-
 drivers/scsi/libsas/sas_scsi_host.c |    2 +-
 drivers/scsi/mvsas/mv_sas.c         |    2 +-
 drivers/scsi/pm8001/pm8001_sas.c    |    2 +-
 include/scsi/libsas.h               |    5 +
 include/scsi/sas.h                  |    1 +
 14 files changed, 425 insertions(+), 25 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html