Merge tag 'isci-for-3.5' into misc
authorJames Bottomley <JBottomley@Parallels.com>
Mon, 21 May 2012 11:17:30 +0000 (12:17 +0100)
committerJames Bottomley <JBottomley@Parallels.com>
Mon, 21 May 2012 11:17:30 +0000 (12:17 +0100)
isci update for 3.5

1/ Rework remote-node-context (RNC) handling for proper management of
   the silicon state machine in error handling and hot-plug conditions.
   Further details below, suffice to say if the RNC is mismanaged the
   silicon state machines may lock up.

2/ Refactor the initialization code to be reused for suspend/resume support

3/ Miscellaneous bug fixes to address discovery issues and hardware
   compatibility.

RNC rework details from Jeff Skirvin:

In the controller, devices as they appear on a SAS domain (or
direct-attached SATA devices) are represented by memory structures known
as "Remote Node Contexts" (RNCs).  These structures are transferred from
main memory to the controller using a set of register commands; these
commands include setting up the context ("posting"), removing the
context ("invalidating"), and commands to control the scheduling of
commands and connections to that remote device ("suspensions" and
"resumptions").  There is a similar path to control RNC scheduling from
the protocol engine, which interprets the results of command and data
transmission and reception.

In general, the controller chooses among non-suspended RNCs to find one
that has work requiring scheduling the transmission of command and data
frames to a target.  Likewise, when a target tries to return data back
to the initiator, the state of the RNC is used by the controller to
determine how to treat the incoming request. As an example, if the RNC
is in the state "TX/RX Suspended", incoming SSP connection requests from
the target will be rejected by the controller hardware.  When an RNC is
"TX Suspended", it will not be selected by the controller hardware to
start outgoing command or data operations (with certain priority-based
exceptions).

As mentioned above, there are two sources for management of the RNC
states: commands from driver software, and the result of transmission
and reception conditions of commands and data signaled by the controller
hardware.  As an example of the latter, if an outgoing SSP command ends
with a OPEN_REJECT(BAD_DESTINATION) status, the RNC state will
transition to the "TX Suspended" state, and this is signaled by the
controller hardware in the status to the completion of the pending
command as well as signaled in a controller hardware event.  Examples of
the former are included in the patch changelogs.

Driver software is required to suspend the RNC in a "TX/RX Suspended"
condition before any outstanding commands can be terminated.  Failure to
guarantee this can lead to a complete hardware hang condition.  Earlier
versions of the driver software did not guarantee that an RNC was
correctly managed before I/O termination, and so operated in an unsafe
way.

Further, the driver performed unnecessary contortions to preserve the
remote device command state and so was more complicated than it needed
to be.  A simplifying driver assumption is that once an I/O has entered
the error handler path without having completed in the target, the
requirement on the driver is that all use of the sas_task must end.
Beyond that, recovery of operation is dependent on libsas and other
components to reset, rediscover and reconfigure the device before normal
operation can restart.  In the driver, this simplifying assumption meant
that the RNC management could be reduced to entry into the suspended
state, terminating the targeted I/O request, and resuming the RNC as
needed for device-specific management such as an SSP Abort Task or LUN
Reset Management request.

1  2 
MAINTAINERS
drivers/scsi/libfc/fc_lport.c
drivers/scsi/scsi_lib.c

diff --combined MAINTAINERS
index c004782a135926751ba2bd7ce452aa261bb75121,b36270986501dd41fe33280388ea2f7e9c3c9720..879520452133855042a52a89a5ad858cf40f21a5
@@@ -1598,7 -1598,6 +1598,7 @@@ F:      include/linux/bcma
  
  BROCADE BFA FC SCSI DRIVER
  M:    Jing Huang <huangj@brocade.com>
 +M:    Krishna C Gudipati <kgudipat@brocade.com>
  L:    linux-scsi@vger.kernel.org
  S:    Supported
  F:    drivers/scsi/bfa/
@@@ -1969,10 -1968,9 +1969,9 @@@ S:     Maintaine
  F:    drivers/net/ethernet/ti/cpmac.c
  
  CPU FREQUENCY DRIVERS
- M:    Dave Jones <davej@redhat.com>
+ M:    Rafael J. Wysocki <rjw@sisk.pl>
  L:    cpufreq@vger.kernel.org
- W:    http://www.codemonkey.org.uk/projects/cpufreq/
- T:    git git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq.git
+ L:    linux-pm@vger.kernel.org
  S:    Maintained
  F:    drivers/cpufreq/
  F:    include/linux/cpufreq.h
@@@ -3593,6 -3591,7 +3592,7 @@@ S:      Supporte
  F:    drivers/net/wireless/iwlegacy/
  
  INTEL WIRELESS WIFI LINK (iwlwifi)
+ M:    Johannes Berg <johannes.berg@intel.com>
  M:    Wey-Yi Guy <wey-yi.w.guy@intel.com>
  M:    Intel Linux Wireless <ilw@linux.intel.com>
  L:    linux-wireless@vger.kernel.org
@@@ -4037,6 -4036,7 +4037,7 @@@ F:      Documentation/scsi/53c700.tx
  F:    drivers/scsi/53c700*
  
  LED SUBSYSTEM
+ M:    Bryan Wu <bryan.wu@canonical.com>
  M:    Richard Purdie <rpurdie@rpsys.net>
  S:    Maintained
  F:    drivers/leds/
@@@ -5892,11 -5892,11 +5893,11 @@@ F:   Documentation/scsi/st.tx
  F:    drivers/scsi/st*
  
  SCTP PROTOCOL
- M:    Vlad Yasevich <vladislav.yasevich@hp.com>
+ M:    Vlad Yasevich <vyasevich@gmail.com>
  M:    Sridhar Samudrala <sri@us.ibm.com>
  L:    linux-sctp@vger.kernel.org
  W:    http://lksctp.sourceforge.net
- S:    Supported
+ S:    Maintained
  F:    Documentation/networking/sctp.txt
  F:    include/linux/sctp.h
  F:    include/net/sctp/
@@@ -6883,14 -6883,6 +6884,14 @@@ F:    Documentation/cdrom
  F:    drivers/cdrom/cdrom.c
  F:    include/linux/cdrom.h
  
 +UNIVERSAL FLASH STORAGE HOST CONTROLLER DRIVER
 +M:    Vinayak Holikatti <vinholikatti@gmail.com>
 +M:    Santosh Y <santoshsy@gmail.com>
 +L:    linux-scsi@vger.kernel.org
 +S:    Supported
 +F:    Documentation/scsi/ufs.txt
 +F:    drivers/scsi/ufs/
 +
  UNSORTED BLOCK IMAGES (UBI)
  M:    Artem Bityutskiy <dedekind1@gmail.com>
  W:    http://www.linux-mtd.infradead.org/
@@@ -7587,8 -7579,8 +7588,8 @@@ F:      Documentation/filesystems/xfs.tx
  F:    fs/xfs/
  
  XILINX AXI ETHERNET DRIVER
- M:    Ariane Keller <ariane.keller@tik.ee.ethz.ch>
- M:    Daniel Borkmann <daniel.borkmann@tik.ee.ethz.ch>
+ M:    Anirudha Sarangi <anirudh@xilinx.com>
+ M:    John Linn <John.Linn@xilinx.com>
  S:    Maintained
  F:    drivers/net/ethernet/xilinx/xilinx_axienet*
  
index fb6610b249e1295f5da7d362c7bc45a581f1a92b,cc83b66d45b7836aebe4fe55085935922fdb4a56..c1402fb499ab3c3f3038163c907aa2a7538091b2
@@@ -648,7 -648,6 +648,7 @@@ int fc_lport_destroy(struct fc_lport *l
        lport->tt.fcp_abort_io(lport);
        lport->tt.disc_stop_final(lport);
        lport->tt.exch_mgr_reset(lport, 0, 0);
 +      cancel_delayed_work_sync(&lport->retry_work);
        fc_fc4_del_lport(lport);
        return 0;
  }
@@@ -1565,6 -1564,7 +1565,6 @@@ static void fc_lport_timeout(struct wor
  
        switch (lport->state) {
        case LPORT_ST_DISABLED:
 -              WARN_ON(1);
                break;
        case LPORT_ST_READY:
                break;
@@@ -1742,17 -1742,19 +1742,19 @@@ void fc_lport_flogi_resp(struct fc_seq 
  
        mfs = ntohs(flp->fl_csp.sp_bb_data) &
                FC_SP_BB_DATA_MASK;
-       if (mfs >= FC_SP_MIN_MAX_PAYLOAD &&
-           mfs <= lport->mfs) {
-               lport->mfs = mfs;
-               fc_host_maxframe_size(lport->host) = mfs;
-       } else {
+       if (mfs < FC_SP_MIN_MAX_PAYLOAD || mfs > FC_SP_MAX_MAX_PAYLOAD) {
                FC_LPORT_DBG(lport, "FLOGI bad mfs:%hu response, "
                             "lport->mfs:%hu\n", mfs, lport->mfs);
                fc_lport_error(lport, fp);
                goto err;
        }
  
+       if (mfs <= lport->mfs) {
+               lport->mfs = mfs;
+               fc_host_maxframe_size(lport->host) = mfs;
+       }
        csp_flags = ntohs(flp->fl_csp.sp_features);
        r_a_tov = ntohl(flp->fl_csp.sp_r_a_tov);
        e_d_tov = ntohl(flp->fl_csp.sp_e_d_tov);
diff --combined drivers/scsi/scsi_lib.c
index dbe43924d7ae5d6e8f8c525dc6910d2183c621bd,5dfd7495d1a1bc4231123760090aa3d38eb9a764..62ddfd31d4ce3539b129ee3f7763d9422ab32f5e
@@@ -1638,7 -1638,7 +1638,7 @@@ struct request_queue *__scsi_alloc_queu
                                         request_fn_proc *request_fn)
  {
        struct request_queue *q;
-       struct device *dev = shost->shost_gendev.parent;
+       struct device *dev = shost->dma_dev;
  
        q = blk_init_queue(request_fn, NULL);
        if (!q)
@@@ -2348,14 -2348,10 +2348,14 @@@ EXPORT_SYMBOL(scsi_device_quiesce)
   *
   *    Must be called with user context, may sleep.
   */
 -void
 -scsi_device_resume(struct scsi_device *sdev)
 +void scsi_device_resume(struct scsi_device *sdev)
  {
 -      if(scsi_device_set_state(sdev, SDEV_RUNNING))
 +      /* check if the device state was mutated prior to resume, and if
 +       * so assume the state is being managed elsewhere (for example
 +       * device deleted during suspend)
 +       */
 +      if (sdev->sdev_state != SDEV_QUIESCE ||
 +          scsi_device_set_state(sdev, SDEV_RUNNING))
                return;
        scsi_run_queue(sdev->request_queue);
  }