Skip to contentSkip to conversation

isci: fixes and cleanups from review

GIT Dan Williams 3 participants 6 messages Mar 27, 2011 – Apr 4, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

isci.git [1] has been updated with some fixes as well as some upstream cleanups. The cleanups are too large to include in their entirety (~3000 deletions), but the full log (since the last [GIT] isci message) is below along with the diffs from the smaller patches.

Of course more cleanups are still in progress, this is the set that is easily verified with a compile check.

--
Dan

[1]: http://git.kernel.org/?p=linux/kernel/git/djbw/isci.git;a=summary

The following changes since commit fa3fa74342e372611ce79636f8fdba69f96c84c4:

Merge branch 'x86-pending' into upstream-pending (2011-03-17 08:59:58 -0700)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git upstream-pending

Dan Williams (11):
Revert "isci: SATA/STP and SMP tasks are never explicitly put in the error path." Revert "isci: only call sas_task_abort for tasks with NEED_DEV_RESET"
isci: reset hardware at init
isci: fix apc mode definition
isci: fix a build warning
Merge branch 'x86-pending' into devel
isci: reorder init to cleanup unneeded declarations
isci: kill some long macros
isci: namespacecheck cleanups
isci: remove unused "remote_device_started"
Merge branch 'libsas-pending' into upstream-pending

Dave Jiang (2):
isci: Remove event_* calls as they are just wrappers
isci: Remove "screaming" data types

 drivers/scsi/isci/Makefile                         |    2 +-
 drivers/scsi/isci/core/sati_translator_sequence.h  |   16 +-
 drivers/scsi/isci/core/sci_base_port.h             |   56 +-
 drivers/scsi/isci/core/sci_base_request.h          |   10 +-
 drivers/scsi/isci/core/sci_base_state.h            |    8 +-
 drivers/scsi/isci/core/sci_base_state_machine.c    |    4 +-
 drivers/scsi/isci/core/sci_status.h                |    6 +-
 drivers/scsi/isci/core/scic_config_parameters.h    |   13 -
 drivers/scsi/isci/core/scic_controller.h           |  348 ------
 drivers/scsi/isci/core/scic_io_request.h           |    2 +-
 drivers/scsi/isci/core/scic_port.h                 |  100 +--
 drivers/scsi/isci/core/scic_sds_controller.c       | 1274 ++++++++++----------
 drivers/scsi/isci/core/scic_sds_controller.h       |  109 +--
 drivers/scsi/isci/core/scic_sds_phy.c              |  893 +++++---------
 drivers/scsi/isci/core/scic_sds_phy.h              |   91 +--
 drivers/scsi/isci/core/scic_sds_port.c             | 1147 +++++++-----------
 drivers/scsi/isci/core/scic_sds_port.h             |  141 +--
 .../isci/core/scic_sds_port_configuration_agent.c  |   99 +-
 .../isci/core/scic_sds_port_configuration_agent.h  |    6 +-
 drivers/scsi/isci/core/scic_sds_remote_device.c    |  679 +++--------
 drivers/scsi/isci/core/scic_sds_remote_device.h    |   21 -
 .../scsi/isci/core/scic_sds_remote_node_context.c  |   46 +-
 .../scsi/isci/core/scic_sds_remote_node_context.h  |   15 +-
 drivers/scsi/isci/core/scic_sds_request.c          |  345 ++----
 drivers/scsi/isci/core/scic_sds_request.h          |   15 +-
 .../scsi/isci/core/scic_sds_smp_remote_device.c    |   44 +-
 drivers/scsi/isci/core/scic_sds_smp_request.c      |  137 ++--
 drivers/scsi/isci/core/scic_sds_ssp_request.c      |    2 +-
 .../scsi/isci/core/scic_sds_stp_packet_request.c   |    4 +-
 .../scsi/isci/core/scic_sds_stp_packet_request.h   |    2 +-
 drivers/scsi/isci/core/scic_sds_stp_pio_request.h  |   13 +-
 .../scsi/isci/core/scic_sds_stp_remote_device.c    |   76 +-
 drivers/scsi/isci/core/scic_sds_stp_request.c      |  251 ++---
 drivers/scsi/isci/core/scic_sds_stp_request.h      |   35 +-
 .../isci/core/scic_sds_unsolicited_frame_control.h |    6 +-
 drivers/scsi/isci/core/scu_registers.h             |   62 +-
 drivers/scsi/isci/core/scu_task_context.h          |   48 +-
 drivers/scsi/isci/events.c                         |  609 ----------
 drivers/scsi/isci/events.h                         |  373 ------
 drivers/scsi/isci/firmware/README                  |    2 +-
 drivers/scsi/isci/host.c                           |   44 +-
 drivers/scsi/isci/init.c                           |   26 +-
 drivers/scsi/isci/isci.h                           |    1 -
 drivers/scsi/isci/port.c                           |   53 +-
 drivers/scsi/isci/port.h                           |   10 +
 drivers/scsi/isci/probe_roms.c                     |    5 +-
 drivers/scsi/isci/probe_roms.h                     |   10 +-
 drivers/scsi/isci/request.c                        |  132 +--
 drivers/scsi/isci/request.h                        |    6 -
 drivers/scsi/isci/task.c                           |   13 +-
 drivers/scsi/isci/task.h                           |   30 +-
 firmware/isci/isci_firmware.bin.ihex               |    4 +-
 52 files changed, 2253 insertions(+), 5191 deletions(-)
 delete mode 100644 drivers/scsi/isci/events.c
 delete mode 100644 drivers/scsi/isci/events.h

commit 2fdebe19b880dbf1e3d5b265da2f2aab887d9522

Author: Dave Jiang <[email protected]>
Date:   Sat Mar 26 17:14:07 2011 -0700

isci: Remove "screaming" data types

Converting the all CAPS data types to lower case.

commit 26b604703fb4f8c55a11dcb26d43448b6b3b7a9e

Author: Dan Williams <[email protected]>
Date:   Sat Mar 26 16:56:55 2011 -0700

isci: remove unused "remote_device_started"

These routines are just stubs, re-add them when / if they are needed. Also cleanup remote_device_stopped.

commit fad023f98205a4852ff12ac3b2f5ba82c528e344

Author: Dan Williams <[email protected]>
Date:   Sat Mar 26 16:43:01 2011 -0700

isci: namespacecheck cleanups

* mark needlessly global routines static
* delete unused functions
* move kernel-doc blocks from header files to source
* reorder some functions to delete declarations
* more default handler cleanups phy

commit 92314c6110081a0060f913acd26767e9886e009e

Author: Dan Williams <[email protected]>
Date:   Sat Mar 26 16:30:35 2011 -0700

isci: kill some long macros

Delete some macros that are longer to type than the open coded operation that they perform.

scic_sds_phy_get_base_state_machine scic_sds_phy_get_starting_substate_machine scic_sds_port_get_base_state_machine scic_sds_port_get_ready_substate_machine scic_sds_remote_device_get_base_state_machine scic_sds_remote_device_get_ready_substate_machine scic_sds_remote_node_context_set_remote_node_index scic_sds_controller_get_base_state_machine

Also performs some collateral cleanups like killing casts that assume structure member ordering, and consolidating a lot of duplicated default handler code (the primary callers of the *_get_base_state_machine macros) via a helper.

commit 0711f8f8ccee3137cd19a327e9232e9777ec5bb2

Author: Dan Williams <[email protected]>
Date:   Sat Mar 26 16:30:06 2011 -0700

isci: reorder init to cleanup unneeded declarations

Just move isci_pci_driver below the function definitions and delete the declarations. A couple other whitespace fixups, and unused symbol deletions.

drivers/scsi/isci/init.c +9 -17
index 7ca2a08..dd96113 100644
@@ -88,23 +88,8 @@ static DEFINE_PCI_DEVICE_TABLE(isci_id_table) = {
 	{}
 };
 
-struct isci_firmware *isci_firmware;
-
-static int __devinit isci_pci_probe(
-	struct pci_dev *pdev,
-	const struct pci_device_id *device_id_p);
-
-static void __devexit isci_pci_remove(struct pci_dev *pdev);
-
 MODULE_DEVICE_TABLE(pci, isci_id_table);
 
-static struct pci_driver isci_pci_driver = {
-	.name		= DRV_NAME,
-	.id_table	= isci_id_table,
-	.probe		= isci_pci_probe,
-	.remove		= __devexit_p(isci_pci_remove),
-};
-
 /* linux isci specific settings */
 
 #if defined(CONFIG_PBG_HBA_A0)
@@ -343,7 +328,7 @@ static int num_controllers(struct pci_dev *pdev)
 	 */
 	resource_size_t scu_bar_size = pci_resource_len(pdev, SCI_SCU_BAR*2);
 	resource_size_t smu_bar_size = pci_resource_len(pdev, SCI_SMU_BAR*2);
-	
+
 	if (scu_bar_size >= SCI_SCU_BAR_SIZE*SCI_MAX_CONTROLLERS &&
 	    smu_bar_size >= SCI_SMU_BAR_SIZE*SCI_MAX_CONTROLLERS)
 		return SCI_MAX_CONTROLLERS;
@@ -488,7 +473,7 @@ static void check_si_rev(struct pci_dev *pdev)
 	dev_info(&pdev->dev, "driver configured for %s silicon (rev: %d)\n",
 		 isci_si_rev == ISCI_SI_REVA0 ? "A0" :
 		 isci_si_rev == ISCI_SI_REVA2 ? "A2" : "B0", pdev->revision);
-		
+
 }
 
 static int __devinit isci_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
@@ -577,6 +562,13 @@ static void __devexit isci_pci_remove(struct pci_dev *pdev)
 	}
 }
 
+static struct pci_driver isci_pci_driver = {
+	.name		= DRV_NAME,
+	.id_table	= isci_id_table,
+	.probe		= isci_pci_probe,
+	.remove		= __devexit_p(isci_pci_remove),
+};
+
 static __init int isci_init(void)
 {
 	int err;

commit cc41fde7c95fa8672ae32d3f696ba860621ce956

Author: Dave Jiang <[email protected]>
Date:   Sat Mar 26 16:11:51 2011 -0700

isci: Remove event_* calls as they are just wrappers

Removed isci_event_* calls and call those functions directly.

commit f498041a46e7f9f2c931d157661914cdfdbd66bd
Merge: b1d1718 4ac5ee3
Author: Dan Williams <[email protected]>
Date: Sat Mar 26 16:07:05 2011 -0700

Merge branch 'x86-pending' into devel

pci_map_biosrom() has been accepted into tip.git/x86/platform, so unblock the backlog of changes that were pinned behind this patch.

* x86-pending:
isci: fix a build warning
isci: fix apc mode definition
isci: exposing user parameters via module params
isci: fix oem parameter initialization and mode detection
isci: Fixup for OEM parameter EFI variable retrieval
isci: fixup with testing from isci OROM in BIOS
isci: copy the oem parameters instead of assign
isci: update efi variable name and guid
isci: add support for 2 more oem parmeters
isci: Adding EFI variable skeletal support
isci: Add support for probing OROM for OEM params
x86: introduce pci_map_biosrom()

commit 4ac5ee33ded761273337fef0e0f32332be57b349

Author: Dan Williams <[email protected]>
Date:   Fri Mar 25 10:05:58 2011 -0700

isci: fix a build warning

Use min_t to address:
drivers/scsi/isci/probe_roms.c: In function ‘isci_get_efi_var’:
drivers/scsi/isci/probe_roms.c:241: warning: comparison of distinct pointer types lacks a cast

drivers/scsi/isci/probe_roms.c +2 -3
index a69be59..b53d1c2 100644
@@ -238,9 +238,8 @@ struct isci_orom *isci_get_efi_var(struct pci_dev *pdev)
 		return NULL;
 	}
 
-	copy_len = min(evar->DataSize,
-		       min(oem_hdr->len - sizeof(*oem_hdr),
-			   sizeof(*rom)));
+	copy_len = min_t(u16, evar->DataSize,
+			 min_t(u16, oem_hdr->len - sizeof(*oem_hdr), sizeof(*rom)));
 
 	memcpy(rom, (char *)evar->Data + sizeof(*oem_hdr), copy_len);
 

commit d9d38c386335cd1247cf3d5f7ce51bdc24417ca7

Author: Dan Williams <[email protected]>
Date:   Fri Mar 25 09:58:15 2011 -0700

isci: fix apc mode definition

The original apc mode definition is the correct one, the fix from commit f7ec5db1 "isci: fix oem parameter initialization and mode detection" was based on a typo from a specification update.

drivers/scsi/isci/probe_roms.h +2 -6
index 1b44483..c2162cf 100644
@@ -96,10 +96,6 @@ struct isci_oem_hdr {
 #define ISCI_ROM_SIG		"ISCUOEMB"
 #define ISCI_ROM_SIG_SIZE	8
 
-#define ISCI_PREBOOT_SOURCE_INIT     (0x00)
-#define ISCI_PREBOOT_SOURCE_OROM     (0x80)
-#define ISCI_PREBOOT_SOURCE_EFI      (0x81)
-
 #define ISCI_EFI_VENDOR_GUID	\
 	EFI_GUID(0x193dfefa, 0xa445, 0x4302, 0x99, 0xd8, 0xef, 0x3a, 0xad, \
 			0x1a, 0x04, 0xc6)
@@ -116,8 +112,8 @@ struct isci_oem_hdr {
  * being assigned is sufficient to declare manual PORT configuration.
  */
 enum SCIC_PORT_CONFIGURATION_MODE {
-	SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE = 0,
-	SCIC_PORT_MANUAL_CONFIGURATION_MODE = 1
+	SCIC_PORT_MANUAL_CONFIGURATION_MODE = 0,
+	SCIC_PORT_AUTOMATIC_CONFIGURATION_MODE = 1
 };
 
 struct sci_bios_oem_param_block_hdr {
firmware/isci/isci_firmware.bin.ihex +2 -2
index 4f8767c..31b5ecf 100644
@@ -1,11 +1,11 @@
 :10000000495343554F454D42E70017100002000089
-:10001000000000000000000001000000000000FFE0
+:10001000000000000000000101000000000000FFDF
 :10002000FFCF5F01000000037C0E00037C0E000385
 :100030007C0E00037C0E00FFFFCF5F010000000379
 :100040007C0E00037C0E00037C0E00037C0E00FF80
 :10005000FFCF5F01000000037C0E00037C0E000355
 :100060007C0E00037C0E00FFFFCF5F010000000349
-:100070007C0E00037C0E00037C0E00037C0E00004F
+:100070007C0E00037C0E00037C0E00037C0E00014E
 :1000800001000000000000FFFFCF5F02000000033E
 :100090007C0E00037C0E00037C0E00037C0E00FF30
 :1000A000FFCF5F02000000037C0E00037C0E000304

commit b1d171853724d7cd5e151785535aff242ce98860

Author: Dan Williams <[email protected]>
Date:   Wed Mar 23 17:31:27 2011 -0700

isci: reset hardware at init

Don't assume the hardware is in a known state at init.

drivers/scsi/isci/core/scic_sds_controller.c +2 -1
index 180bb1e..799a04b 100644
@@ -2116,7 +2116,7 @@ enum sci_status scic_controller_construct(struct scic_sds_controller *controller
 	/* Initialize the User and OEM parameters to default values. */
 	scic_sds_controller_set_default_config_parameters(controller);
 
-	return SCI_SUCCESS;
+	return scic_controller_reset(controller);
 }
 
 /* --------------------------------------------------------------------------- */
@@ -3562,6 +3562,7 @@ const struct scic_sds_controller_state_handler scic_sds_controller_state_handler
 		.terminate_request = scic_sds_controller_default_request_handler,
 	},
 	[SCI_BASE_CONTROLLER_STATE_RESET] = {
+		.base.reset        = scic_sds_controller_general_reset_handler,
 		.base.initialize   = scic_sds_controller_reset_state_initialize_handler,
 		.base.start_io     = scic_sds_controller_default_start_operation_handler,
 		.base.complete_io  = scic_sds_controller_default_request_handler,

commit 7f218d67ce8de2c3390f319137d96cafe946f38b

Author: Dan Williams <[email protected]>
Date:   Tue Mar 22 17:45:11 2011 -0700

Revert "isci: only call sas_task_abort for tasks with NEED_DEV_RESET"

This reverts commit 8dc962d12c66ebacf1ce60f510b3a41d6aa5ffe1.

Gating which tasks are eligible for sas_task_abort is already handled by libsas no need to add explicit handling.

drivers/scsi/isci/request.c +1 -2
index 1d2e417..eba8e0b 100644
@@ -798,8 +798,7 @@ static void isci_task_save_for_upper_layer_completion(
 
 	task_notification_selection
 		= isci_task_set_completion_status(task, response, status,
-						  task_notification_selection,
-						  request->status);
+						  task_notification_selection);
 
 	/* Tasks aborted specifically by a call to the lldd_abort_task
 	 * function should not be completed to the host in the regular path.
drivers/scsi/isci/task.c +1 -1
index a80685f..d483680 100644
@@ -84,7 +84,7 @@ static void isci_task_refuse(struct isci_host *ihost, struct sas_task *task,
 
 	disposition = isci_perform_normal_io_completion;
 	disposition = isci_task_set_completion_status(task, response, status,
-						      disposition, completed);
+						      disposition);
 
 	/* Tasks aborted specifically by a call to the lldd_abort_task
 	 * function should not be completed to the host in the regular path.
drivers/scsi/isci/task.h +8 -12
index 11c0b8a..9754b43 100644
@@ -293,23 +293,19 @@ static inline void isci_task_all_done(
 */
 static inline enum isci_completion_selection
 isci_task_set_completion_status(
-	struct sas_task                *task,
-	enum service_response          response,
-	enum exec_status               status,
-	enum isci_completion_selection task_notification_selection,
-	enum isci_request_status       request_status)
+	struct sas_task *task,
+	enum service_response response,
+	enum exec_status status,
+	enum isci_completion_selection task_notification_selection)
 {
 	unsigned long flags;
 
 	spin_lock_irqsave(&task->task_state_lock, flags);
 
-	/* Only let an I/O into the error path for reset purposes
-	 * if it's not already being aborted; if "completed", and if a device
-	 * reset is being indicated, make sure the I/O is in the error path.
-	 */
-	if (request_status == completed &&
-	    (task->task_state_flags & SAS_TASK_NEED_DEV_RESET)) {
-
+	/* If a device reset is being indicated, make sure the I/O
+	* is in the error path.
+	*/
+	if (task->task_state_flags & SAS_TASK_NEED_DEV_RESET) {
 		/* Fail the I/O to make sure it goes into the error path. */
 		response = SAS_TASK_UNDELIVERED;
 		status = SAM_STAT_TASK_ABORTED;

commit bcc5d45c87ee5a0adee4558f10b578b2cf3106e9

Author: Dan Williams <[email protected]>
Date:   Tue Mar 22 17:41:00 2011 -0700

Revert "isci: SATA/STP and SMP tasks are never explicitly put in the error path."

This reverts commit 7a18a48e0f70b8d17064523d8473d48a87d0400a.

sas_task_abort already handles internal commands so this determination is not needed in lldd's.

drivers/scsi/isci/host.c +13 -31

52 lines not on this page · raw message

drivers/scsi/isci/request.c +31 -25

85 lines not on this page · raw message

--
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

#1 lore raw

[GIT] isci: update for 4/1

isci.git has been updated with bug fixes around error handling and cleanups driven by the ongoing review, details below. The patches that have not appeared on the mailing list are included inline.

--
Dan

The following changes since commit 2fdebe19b880dbf1e3d5b265da2f2aab887d9522:

isci: Remove "screaming" data types (2011-03-26 19:23:23 -0700)

are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/djbw/isci.git master

Christoph Hellwig (5):
isci: remove mmio wrappers
isci: remove base_controller abstraction
isci: remove base_request abstraction
isci: kill dead data structures in scic_io_request.h
isci: simplify request state handlers

Dan Williams (2):
isci: cleanup isci_remote_device[_not]_ready interface
isci: fix fragile/conditional isci_host lookups

Jeff Skirvin (4):
isci: Properly handle requests in the "aborting" state.
isci: Free host lock for SATA/STP abort escalation at submission time.
isci: Fix use of SATA soft reset state machine.
isci: Qualify when the host lock is managed for STP/SATA callbacks.

 drivers/scsi/isci/core/sci_base_controller.h       |  304 ---------
 drivers/scsi/isci/core/sci_base_remote_device.h    |    6 +-
 drivers/scsi/isci/core/sci_base_request.h          |  195 ------
 drivers/scsi/isci/core/sci_controller.h            |   29 -
 drivers/scsi/isci/core/scic_io_request.h           |  180 -----
 drivers/scsi/isci/core/scic_sds_controller.c       |  713 +++++++++-----------
 drivers/scsi/isci/core/scic_sds_controller.h       |  231 +++++--
 .../scsi/isci/core/scic_sds_controller_registers.h |  463 -------------
 drivers/scsi/isci/core/scic_sds_pci.h              |   94 ---
 drivers/scsi/isci/core/scic_sds_phy.c              |  146 +++--
 drivers/scsi/isci/core/scic_sds_phy_registers.h    |  248 -------
 drivers/scsi/isci/core/scic_sds_port.c             |  125 ++---
 drivers/scsi/isci/core/scic_sds_port.h             |   23 -
 drivers/scsi/isci/core/scic_sds_port_registers.h   |   81 ---
 drivers/scsi/isci/core/scic_sds_remote_device.c    |  160 ++---
 drivers/scsi/isci/core/scic_sds_remote_device.h    |    7 +-
 drivers/scsi/isci/core/scic_sds_request.c          |  572 +++++------------
 drivers/scsi/isci/core/scic_sds_request.h          |  138 +++--
 .../scsi/isci/core/scic_sds_smp_remote_device.c    |   69 +-
 drivers/scsi/isci/core/scic_sds_smp_request.c      |   54 +-
 drivers/scsi/isci/core/scic_sds_ssp_request.c      |   59 +--
 .../scsi/isci/core/scic_sds_stp_packet_request.c   |   36 +-
 .../scsi/isci/core/scic_sds_stp_remote_device.c    |  274 +++-----
 drivers/scsi/isci/core/scic_sds_stp_request.c      |  177 ++----
 drivers/scsi/isci/core/scic_sds_stp_request.h      |    4 -
 .../isci/core/scic_sds_unsolicited_frame_control.c |    5 +-
 drivers/scsi/isci/host.c                           |   10 +-
 drivers/scsi/isci/host.h                           |   13 +-
 drivers/scsi/isci/isci.h                           |    2 +-
 drivers/scsi/isci/phy.c                            |    2 +-
 drivers/scsi/isci/port.c                           |   68 +--
 drivers/scsi/isci/port.h                           |    5 +-
 drivers/scsi/isci/remote_device.c                  |   92 +--
 drivers/scsi/isci/remote_device.h                  |   71 +--
 drivers/scsi/isci/request.c                        |   50 +-
 drivers/scsi/isci/request.h                        |    2 +-
 drivers/scsi/isci/sata.c                           |   37 +-
 drivers/scsi/isci/task.c                           |  130 ++---
 drivers/scsi/isci/task.h                           |   37 +
 39 files changed, 1347 insertions(+), 3565 deletions(-)
 delete mode 100644 drivers/scsi/isci/core/sci_base_controller.h
 delete mode 100644 drivers/scsi/isci/core/sci_base_request.h
 delete mode 100644 drivers/scsi/isci/core/scic_sds_controller_registers.h
 delete mode 100644 drivers/scsi/isci/core/scic_sds_pci.h
 delete mode 100644 drivers/scsi/isci/core/scic_sds_phy_registers.h

commit b940f7fbc060ae202f7be4c8cb66b1c2193bcec9

Author: Jeff Skirvin <[email protected]>
Date:   Thu Mar 31 13:10:34 2011 -0700

isci: Properly handle requests in the "aborting" state.

When a TMF times-out, the request is set back to "aborting". Requests in the "aborting" state must be terminated when LUN and device resets occur.

drivers/scsi/isci/request.h +1 -1
index 4a63bb6..0c08da6 100644
@@ -199,7 +199,7 @@ static inline enum isci_request_status isci_request_change_started_to_newstate(
 
 	old_state = isci_request->status;
 
-	if (old_state == started) {
+	if (old_state == started || old_state == aborting) {
 		BUG_ON(isci_request->io_request_completion != NULL);
 
 		isci_request->io_request_completion = completion_ptr;
drivers/scsi/isci/task.c +11 -3
index 7e96684..338f08e 100644
@@ -903,7 +903,9 @@ static void isci_terminate_request(
 		new_request_state
 		);
 
-	if ((old_state == started) || (old_state == completed)) {
+	if ((old_state == started) ||
+	    (old_state == completed) ||
+	    (old_state == aborting)) {
 
 		/* If the old_state is started:
 		 * This request was not already being aborted. If it had been,
@@ -920,6 +922,10 @@ static void isci_terminate_request(
 		 * This request completed from the SCU hardware perspective
 		 * and now just needs cleaning up in terms of freeing the
 		 * request and potentially calling up to libsas.
+		 *
+		 * If old_state == aborting:
+		 * This request has already gone through a TMF timeout, but may
+		 * not have been terminated; needs cleaning up at least.
 		 */
 		isci_terminate_request_core(isci_host, isci_device,
 					    isci_request);
@@ -1297,14 +1303,16 @@ int isci_task_abort_task(struct sas_task *task)
 
 	spin_lock_irqsave(&isci_host->scic_lock, flags);
 
-	/* Check the request status and change to "aborting" if currently
+	/* Check the request status and change to "aborted" if currently
 	 * "starting"; if true then set the I/O kernel completion
 	 * struct that will be triggered when the request completes.
 	 */
 	old_state = isci_task_validate_request_to_abort(
 				old_request, isci_host, isci_device,
 				&aborted_io_completion);
-	if ((old_state != started) && (old_state != completed)) {
+	if ((old_state != started) &&
+	    (old_state != completed) &&
+	    (old_state != aborting)) {
 
 		spin_unlock_irqrestore(&isci_host->scic_lock, flags);
 

commit b5a2fc10a57529f61960679b9ce79d638330d132

Author: Jeff Skirvin <[email protected]>
Date:   Thu Mar 31 13:10:36 2011 -0700

isci: Free host lock for SATA/STP abort escalation at submission time.

In the case of I/O requests that fail at submit time because of a pending reset condition, the host lock for SATA/STP devices must be managed for any SCSI-initiated I/O before sas_task_abort is called.

drivers/scsi/isci/request.c +30 -30

87 lines not on this page · raw message

commit 6834c1ea09d40c334521a916bb6b765993df72eb

Author: Jeff Skirvin <[email protected]>
Date:   Thu Mar 31 13:10:38 2011 -0700

isci: Fix use of SATA soft reset state machine.

The driver SATA LUN reset function incorrectly sent an SRST deassert FIS, which is unnecessary because the core initiates the entire SATA soft reset state machine from the assert request.

drivers/scsi/isci/sata.c +2 -34
index 7a1b586..794ab7c 100644
@@ -301,8 +301,8 @@ int isci_task_send_lu_reset_sata(
 	int ret = TMF_RESP_FUNC_FAILED;
 	unsigned long flags;
 
-	/* Send the initial SRST to the target */
-	#define ISCI_SRST_TIMEOUT_MS 20 /* 20 ms timeout. */
+	/* Send the soft reset to the target */
+	#define ISCI_SRST_TIMEOUT_MS 25000 /* 25 second timeout. */
 	isci_task_build_tmf(&tmf, isci_device, isci_tmf_sata_srst_high,
 			    NULL, NULL
 			    );
@@ -319,38 +319,6 @@ int isci_task_send_lu_reset_sata(
 		/* Return the failure so that the LUN reset is escalated
 		 * to a target reset.
 		 */
-		goto out;
 	}
-
-	/* Leave SRST high for a bit. */
-	#define ISCI_SRST_ASSERT_DELAY 100 /* usecs */
-	udelay(ISCI_SRST_ASSERT_DELAY);
-
-	/* Deassert SRST. */
-	isci_task_build_tmf(&tmf, isci_device, isci_tmf_sata_srst_low,
-			    NULL, NULL
-			    );
-	ret = isci_task_execute_tmf(isci_host, &tmf, ISCI_SRST_TIMEOUT_MS);
-
-	if (ret == TMF_RESP_FUNC_COMPLETE)
-		dev_dbg(&isci_host->pdev->dev,
-			"%s: SATA LUN reset passed (%p)\n",
-			__func__,
-			isci_device);
-	else
-		dev_warn(&isci_host->pdev->dev,
-			 "%s: Deassert SRST failed (%p)=%x\n",
-			 __func__,
-			 isci_device,
-			 ret);
-
- out:
-	spin_lock_irqsave(&isci_host->scic_lock, flags);
-
-	/* Resume the device. */
-	scic_sds_remote_device_resume(to_sci_dev(isci_device));
-
-	spin_unlock_irqrestore(&isci_host->scic_lock, flags);
-
 	return ret;
 }

commit 40da93d97d03ca25355bea3ac4bc1203bbb17c92

Author: Jeff Skirvin <[email protected]>
Date:   Thu Mar 31 13:10:40 2011 -0700

isci: Qualify when the host lock is managed for STP/SATA callbacks.

In the case of internal discovery related STP/SATA I/O started through sas_execute_task the host lock is not taken by libsas before calling lldd_execute_task, so the lock should not be managed before calling back to libsas through task->task_done or sas_task_abort.

drivers/scsi/isci/request.c +4 -16
index 946caae..b519373 100644
@@ -53,7 +53,6 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <scsi/sas_ata.h>
 #include "isci.h"
 #include "scic_remote_device.h"
 #include "scic_io_request.h"
@@ -452,22 +451,11 @@ int isci_request_execute(
 			task->task_state_flags |= SAS_TASK_NEED_DEV_RESET;
 			spin_unlock_irqrestore(&task->task_state_lock, flags);
 
-			/* Cause this task to be scheduled in the SCSI error handler
-			* thread.
+			/* Cause this task to be scheduled in the SCSI error
+			* handler thread.
 			*/
-			if (dev_is_sata(task->dev)) {
-				/* Since we are still in the submit path, and since
-				* libsas takes the host lock on behalf of SATA
-				* devices before I/O starts, we need to unlock
-				* before we can put the task in the error path.
-				*/
-				raw_local_irq_save(flags);
-				spin_unlock(isci_host->shost->host_lock);
-				sas_task_abort(task);
-				spin_lock(isci_host->shost->host_lock);
-				raw_local_irq_restore(flags);
-			} else
-				sas_task_abort(task);
+			isci_execpath_callback(isci_host, task,
+					       sas_task_abort);
 
 			/* Change the status, since we are holding
 			* the I/O until it is managed by the SCSI
drivers/scsi/isci/sata.c +0 -1
index 794ab7c..c941d909 100644
@@ -299,7 +299,6 @@ int isci_task_send_lu_reset_sata(
 {
 	struct isci_tmf tmf;
 	int ret = TMF_RESP_FUNC_FAILED;
-	unsigned long flags;
 
 	/* Send the soft reset to the target */
 	#define ISCI_SRST_TIMEOUT_MS 25000 /* 25 second timeout. */
drivers/scsi/isci/task.c +9 -20
index 338f08e..5bcea60 100644
@@ -55,7 +55,6 @@
 
 #include <linux/completion.h>
 #include <linux/irqflags.h>
-#include <scsi/sas_ata.h>
 #include "scic_task_request.h"
 #include "scic_remote_device.h"
 #include "scic_io_request.h"
@@ -93,26 +92,13 @@ static void isci_task_refuse(struct isci_host *ihost, struct sas_task *task,
 		case isci_perform_normal_io_completion:
 			/* Normal notification (task_done) */
 			dev_dbg(&ihost->pdev->dev,
-				"%s: Normal - task = %p, response=%d, status=%d\n",
+				"%s: Normal - task = %p, response=%d, "
+				"status=%d\n",
 				__func__, task, response, status);
 
 			task->lldd_task = NULL;
-			if (dev_is_sata(task->dev)) {
-				/* Since we are still in the submit path, and since
-				* libsas takes the host lock on behalf of SATA
-				* devices before I/O starts, we need to unlock
-				* before we can call back and report the I/O
-				* submission error.
-				*/
-				unsigned long flags;
 
-				raw_local_irq_save(flags);
-				spin_unlock(ihost->shost->host_lock);
-				task->task_done(task);
-				spin_lock(ihost->shost->host_lock);
-				raw_local_irq_restore(flags);
-			} else
-				task->task_done(task);
+			isci_execpath_callback(ihost, task, task->task_done);
 			break;
 
 		case isci_perform_aborted_io_completion:
@@ -120,16 +106,19 @@ static void isci_task_refuse(struct isci_host *ihost, struct sas_task *task,
 			* abort path.
 			*/
 			dev_warn(&ihost->pdev->dev,
-				 "%s: Aborted - task = %p, response=%d, status=%d\n",
+				 "%s: Aborted - task = %p, response=%d, "
+				"status=%d\n",
 				 __func__, task, response, status);
 			break;
 
 		case isci_perform_error_io_completion:
 			/* Use sas_task_abort */
 			dev_warn(&ihost->pdev->dev,
-				 "%s: Error - task = %p, response=%d, status=%d\n",
+				 "%s: Error - task = %p, response=%d, "
+				"status=%d\n",
 				 __func__, task, response, status);
-			sas_task_abort(task);
+
+			isci_execpath_callback(ihost, task, sas_task_abort);
 			break;
 
 		default:
drivers/scsi/isci/task.h +37 -0
index d7cb6fe..c5afd1c 100644
@@ -56,6 +56,8 @@
 #if !defined(_ISCI_TASK_H_)
 #define _ISCI_TASK_H_
 
+#include <scsi/sas_ata.h>
+
 struct isci_request;
 struct isci_host;
 
@@ -332,5 +334,40 @@ isci_task_set_completion_status(
 	return task_notification_selection;
 
 }
+/**
+* isci_execpath_callback() - This function is called from the task
+* execute path when the task needs to callback libsas about the submit-time
+* task failure.  The callback occurs either through the task's done function
+* or through sas_task_abort.  In the case of regular non-discovery SATA/STP I/O
+* requests, libsas takes the host lock before calling execute task.  Therefore
+* in this situation the host lock must be managed before calling the func.
+*
+* @ihost: This parameter is the controller to which the I/O request was sent.
+* @task: This parameter is the I/O request.
+* @func: This parameter is the function to call in the correct context.
+* @status: This parameter is the status code for the completed task.
+*
+*/
+static inline void isci_execpath_callback(
+	struct isci_host *ihost,
+	struct sas_task  *task,
+	void (*func)(struct sas_task *))
+{
+	unsigned long flags;
+
+	if (dev_is_sata(task->dev) && task->uldd_task) {
+		/* Since we are still in the submit path, and since
+		* libsas takes the host lock on behalf of SATA
+		* devices before I/O starts (in the non-discovery case),
+		* we need to unlock before we can call the callback function.
+		*/
+		raw_local_irq_save(flags);
+		spin_unlock(ihost->shost->host_lock);
+		func(task);
+		spin_lock(ihost->shost->host_lock);
+		raw_local_irq_restore(flags);
+	} else
+		func(task);
+}
 
 #endif /* !defined(_SCI_TASK_H_) */

commit 9c1551f60d8c84ac168c92dbc956e6bfac7f14f4

Author: Dan Williams <[email protected]>
Date:   Thu Mar 31 13:10:42 2011 -0700

isci: cleanup isci_remote_device[_not]_ready interface

Require a valid isci_host in support of the general cleanup to not re-lookup the host via potentially fragile methods when more robust methods are available. Also cleans up some more casting that should be using container_of() to up-cast a base structure in a more type-safe manner.

drivers/scsi/isci/core/scic_sds_remote_device.c +25 -29

86 lines not on this page · raw message

drivers/scsi/isci/core/scic_sds_smp_remote_device.c +22 -24

74 lines not on this page · raw message

drivers/scsi/isci/core/scic_sds_stp_remote_device.c +31 -70

138 lines not on this page · raw message

drivers/scsi/isci/remote_device.c +10 -12
index 6fe6815..0fdaa6d 100644
@@ -281,13 +281,12 @@ isci_remote_device_alloc(struct isci_host *ihost, struct isci_port *iport)
  * isci_remote_device_ready() - This function is called by the scic when the
  *    remote device is ready. We mark the isci device as ready and signal the
  *    waiting proccess.
- * @idev: This parameter specifies the remote device
+ * @ihost: our valid isci_host
+ * @idev: remote device
  *
  */
-void isci_remote_device_ready(struct isci_remote_device *idev)
+void isci_remote_device_ready(struct isci_host *ihost, struct isci_remote_device *idev)
 {
-	struct isci_host *ihost = idev->isci_port->isci_host;
-
 	dev_dbg(&ihost->pdev->dev,
 		"%s: idev = %p\n", __func__, idev);
 
@@ -304,18 +303,17 @@ void isci_remote_device_ready(struct isci_remote_device *idev)
  * @isci_device: This parameter specifies the remote device
  *
  */
-void isci_remote_device_not_ready(
-	struct isci_remote_device *isci_device,
-	u32 reason_code)
+void isci_remote_device_not_ready(struct isci_host *ihost,
+				  struct isci_remote_device *idev, u32 reason)
 {
-	dev_dbg(&isci_device->isci_port->isci_host->pdev->dev,
-		"%s: isci_device = %p\n", __func__, isci_device);
+	dev_dbg(&ihost->pdev->dev,
+		"%s: isci_device = %p\n", __func__, idev);
 
-	if (reason_code == SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED)
-		isci_remote_device_change_state(isci_device, isci_stopping);
+	if (reason == SCIC_REMOTE_DEVICE_NOT_READY_STOP_REQUESTED)
+		isci_remote_device_change_state(idev, isci_stopping);
 	else
 		/* device ready is actually a "not ready for io" state. */
-		isci_remote_device_change_state(isci_device, isci_ready);
+		isci_remote_device_change_state(idev, isci_ready);
 }
 
 /**
drivers/scsi/isci/remote_device.h +4 -5
index f45a5f0..cf5302a 100644
@@ -109,12 +109,11 @@ enum sci_status isci_remote_device_stop(struct isci_host *ihost,
 void isci_remote_device_nuke_requests(
 	struct isci_remote_device *isci_device);
 
-void isci_remote_device_ready(
-	struct isci_remote_device *);
+void isci_remote_device_ready(struct isci_host *ihost,
+			      struct isci_remote_device *idev);
 
-void isci_remote_device_not_ready(
-	struct isci_remote_device *,
-	u32);
+void isci_remote_device_not_ready(struct isci_host *ihost,
+				  struct isci_remote_device *idev, u32 reason);
 
 void isci_remote_device_gone(
 	struct domain_device *domain_dev);

commit 495126b08f8834381b58030645c8208c401b32fc

Author: Dan Williams <[email protected]>
Date:   Thu Mar 31 13:10:44 2011 -0700

isci: fix fragile/conditional isci_host lookups

A domain_device can always reference back to ->lldd_ha unlike local lldd structures. Fix up cases where the driver uses local objects to look up the isci_host. This also changes the calling conventions of some routines to expect a valid isci_host parameter rather than re-lookup the pointer on entry.

Incidentally cleans up some macros that are longer to type than the open-coded equivalent:
isci_host_from_sas_ha
isci_dev_from_domain_dev

drivers/scsi/isci/host.c +2 -2
index 79515be..6644959 100644
@@ -129,7 +129,7 @@ void isci_host_start_complete(struct isci_host *ihost, enum sci_status completio
 
 int isci_host_scan_finished(struct Scsi_Host *shost, unsigned long time)
 {
-	struct isci_host *ihost = isci_host_from_sas_ha(SHOST_TO_SAS_HA(shost));
+	struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha;
 
 	if (test_bit(IHOST_START_PENDING, &ihost->flags))
 		return 0;
@@ -149,7 +149,7 @@ int isci_host_scan_finished(struct Scsi_Host *shost, unsigned long time)
 
 void isci_host_scan_start(struct Scsi_Host *shost)
 {
-	struct isci_host *ihost = isci_host_from_sas_ha(SHOST_TO_SAS_HA(shost));
+	struct isci_host *ihost = SHOST_TO_SAS_HA(shost)->lldd_ha;
 	struct scic_sds_controller *scic = ihost->core_controller;
 	unsigned long tmo = scic_controller_get_suggested_start_timeout(scic);
 
drivers/scsi/isci/host.h +4 -9
index d012b69..8372094 100644
@@ -233,15 +233,10 @@ static inline void wait_for_device_stop(struct isci_host *ihost, struct isci_rem
 	wait_event(ihost->eventq, !test_bit(IDEV_STOP_PENDING, &idev->flags));
 }
 
-/**
- * isci_host_from_sas_ha() - This accessor retrieves the isci_host object
- *    reference from the Linux sas_ha_struct reference.
- * @ha_struct,: This parameter points to the Linux sas_ha_struct object
- *
- * A reference to the associated isci_host structure.
- */
-#define isci_host_from_sas_ha(ha_struct) \
-	((struct isci_host *)(ha_struct)->lldd_ha)
+static inline struct isci_host *dev_to_ihost(struct domain_device *dev)
+{
+	return dev->port->ha->lldd_ha;
+}
 
 /**
  * isci_host_scan_finished() -
drivers/scsi/isci/phy.c +1 -1
index decc0c0..9e081a4 100644
@@ -163,7 +163,7 @@ int isci_phy_control(struct asd_sas_phy *sas_phy,
 			return -ENODEV;
 
 		/* Perform the port reset. */
-		ret = isci_port_perform_hard_reset(iport, iphy);
+		ret = isci_port_perform_hard_reset(ihost, iport, iphy);
 
 		break;
 
drivers/scsi/isci/port.c +24 -44

106 lines not on this page · raw message

drivers/scsi/isci/port.h +2 -3
index dfdd12a..76546fd 100644
@@ -143,9 +143,8 @@ void isci_port_hard_reset_complete(
 	struct isci_port *isci_port,
 	enum sci_status completion_status);
 
-int isci_port_perform_hard_reset(
-	struct isci_port *isci_port_ptr,
-	struct isci_phy *isci_phy_ptr);
+int isci_port_perform_hard_reset(struct isci_host *ihost, struct isci_port *iport,
+				 struct isci_phy *iphy);
 
 void isci_port_invalid_link_up(
 		struct scic_sds_controller *scic,
drivers/scsi/isci/remote_device.c +17 -53

129 lines not on this page · raw message

drivers/scsi/isci/remote_device.h +16 -46

75 lines not on this page · raw message

drivers/scsi/isci/request.c +1 -1
index b519373..37ffedc 100644
@@ -379,7 +379,7 @@ int isci_request_execute(
 	struct isci_request *request;
 	unsigned long flags;
 
-	isci_device = isci_dev_from_domain_dev(task->dev);
+	isci_device = task->dev->lldd_dev;
 	sci_device = to_sci_dev(isci_device);
 
 	/* do common allocation and init of request object. */
drivers/scsi/isci/task.c +27 -60

197 lines not on this page · raw message

commit f1cef7d518628b2e03e02893257733505bcc37a0

Author: Christoph Hellwig <[email protected]>
Date:   Sun Mar 27 20:07:54 2011 -0400

isci: remove mmio wrappers

Remove a couple of layers around read/writel to make the driver readable.

commit 13ca34a2560b0348a1819514f71beceb86fc2583

Author: Christoph Hellwig <[email protected]>
Date:   Mon Mar 28 09:21:04 2011 -0400

isci: remove base_controller abstraction

Merge struct sci_base_controller into scic_sds_controller, and also factor the two types of state machine handlers into one function. While we're at it also remove lots of duplicate incorrect kerneldoc comments for the state machine handlers.

commit 96a7f153bef7841fceacbd475b0e08e2d948796e

Author: Christoph Hellwig <[email protected]>
Date:   Mon Mar 28 09:21:14 2011 -0400

isci: remove base_request abstraction

Merge struct sci_base_request into scic_sds_request, and also factor the two types of state machine handlers into one function. While we're at it also remove lots of duplicate incorrect kerneldoc comments for the state machine handlers.

commit 7b783f341b464cd12b51d2da09835b058a2e9d70

Author: Christoph Hellwig <[email protected]>
Date:   Thu Mar 31 11:01:39 2011 -0400

isci: kill dead data structurs in scic_io_request.h

commit 3e7cb6c0c44c01a0e701c6227f8d7351ea04aa14

Author: Christoph Hellwig <[email protected]>
Date:   Thu Mar 31 11:06:16 2011 -0400

isci: simplify request state handlers

Instead of filling up tables with default handlers call the default handler in the only caller.

IMHO the whole state handlers concept is not very suitable for the isci request. For example there is a single real instance of the start handler, and we'd be much better off just having a check for the right state in the only caller, than all this mess. It's quite similar for the abort handler as well.

Even the actual state machine has a lot of states that are rather pointless. The initial and constructed states are not needed at all as the request is not reachable for calls before it's fully set up and started. And the abort state should be replaced with an abort actions and a state transition to the completed state.

#2 lore raw

Re: [GIT] isci: update for 4/1

Quoted 3 lines · Dan Williams

isci.git has been updated with bug fixes around error handling and cleanups driven by the ongoing review, details below. The patches that have not appeared on the mailing list are included inline.

BTW, what the plan for the STP packet command code? It's ifdef out in a rather ugly way and already starting to bitrot. Unless you plan to resurrect it real soon I think we're better off removing it entirely for now.

#3 lore raw

RE: [GIT] isci: update for 4/1

Quoted 8 lines

-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Saturday, April 02, 2011 5:17 AM
To: Williams, Dan J
Cc: linux-scsi; David Milburn; Jiang, Dave; Ciechanowski, Ed; Nadolski, Edmund; Danecki, Jacek; [email protected]; Skirvin, Jeffrey D
Subject: Re: [GIT] isci: update for 4/1

Quoted 8 lines
Quoted 3 lines · Dan Williams

isci.git has been updated with bug fixes around error handling and cleanups driven by the ongoing review, details below. The patches that have not appeared on the mailing list are included inline.

BTW, what the plan for the STP packet command code? It's ifdef out in a rather ugly way and already starting to bitrot. Unless you plan to resurrect it real soon I think we're better off removing it entirely for now.

I think this will have to be removed for this go around. It is one of the features that has been moved to target 2.6.40.

#4 lore raw

RE: [GIT] isci: update for 4/1

In reply to Christoph Hellwig
Quoted 8 lines

-----Original Message-----
From: Christoph Hellwig [mailto:[email protected]]
Sent: Saturday, April 02, 2011 5:17 AM
To: Williams, Dan J
Cc: linux-scsi; David Milburn; Jiang, Dave; Ciechanowski, Ed; Nadolski, Edmund; Danecki, Jacek; [email protected]; Skirvin, Jeffrey D
Subject: Re: [GIT] isci: update for 4/1

Quoted 8 lines
Quoted 3 lines · Dan Williams

isci.git has been updated with bug fixes around error handling and cleanups driven by the ongoing review, details below. The patches that have not appeared on the mailing list are included inline.

BTW, what the plan for the STP packet command code? It's ifdef out in a rather ugly way and already starting to bitrot. Unless you plan to resurrect it real soon I think we're better off removing it entirely for now.

Christoph,
Would it be possible for you to let us know if you are working on any particular cleanup right now for the driver or plan to in the next week or so? Just want to make sure there isn't any duplicated effort. Thank you!

#5 lore raw

Re: [GIT] isci: update for 4/1

Quoted 1 line · Dave

Would it be possible for you to let us know if you are working on any particular cleanup right now for the driver or plan to in the next week or so? Just want to make sure there isn't any duplicated effort. Thank you!

I'm pretty busy this week, so don't expect much more from me in this timeframe.