16 Oct, 2011

1 commit

  • port->dev_list maintains a list of devices attached to a given sas root port.
    It needs to be mutated under a lock as contexts outside of the
    single-threaded-libsas-workqueue access the list via sas_find_dev_by_rphy().
    Fixup locations where the list was being mutated without a lock.

    This is a follow-up to commit 5911e963 "[SCSI] libsas: remove expander
    from dev list on error", where Luben noted [1]:

    > 2/ We have unlocked list manipulations in sas_ex_discover_end_dev(),
    > sas_unregister_common_dev(), and sas_ex_discover_end_dev()

    Yes, I can see that and that is very unfortunate.

    [1]: http://marc.info/?l=linux-scsi&m=131480962006471&w=2

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

03 Oct, 2011

3 commits

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

    Signed-off-by: Maciej Trela
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • If the user has disabled CONFIG_SCSI_SAS_HOST_SMP then libsas drivers
    will not be receiving smp-gpio frames and do not need this lookup code.

    Reported-by: Randy Dunlap
    Tested-by: Randy Dunlap
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     
  • Allow expander table-to-table attachments for
    expanders that support it.

    Signed-off-by: Luben Tuikov
    Signed-off-by: James Bottomley

    Luben Tuikov
     

22 Sep, 2011

1 commit

  • Add SFF-8485 v0.7 / SAS-1 smp-write-gpio register support to libsas.
    Defer SAS-2 support unless/until it defines an sgpio interface.

    Minimum implementation needed to get the lights blinking.
    try_test_sas_gpio_gp_bit() provides a common method to parse the
    incoming write data (raw bitstream), and the to_sas_gpio_gp_bit() helper
    routine can be used as a basis for the set/clear operations for the
    'read' implementation. Host implementations parse as many bits
    (ODx.[012]) as are locally supported and report the number of registers
    successfully written. If the submitted data overruns the internal
    number of registers available report the write as a success with the
    number of bytes remaining reported in ->resid_len.

    Example (assuming an active backplane) set the "identify" pattern for
    the first 21 devices:

    smp_write_gpio --count=2 --data=92,49,24,92,24,92,49,24 -t 4 --index=1 /dev/bsg/sas_hostX

    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

27 Aug, 2011

1 commit


27 May, 2011

1 commit

  • This allows a libsas driver to optionally provide a soft reset handler
    for libata to drive. The isci driver allows software to control the
    assertion/deassertion of SRST.

    [jejb: checkpatch.pl fixes]
    Signed-off-by: Dave Jiang
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dave Jiang
     

22 Dec, 2010

1 commit

  • To date libsas has only looked at the attached sas address when
    determining the formation of wide ports. The specification and some
    hardware expects that phys with different addresses will not form a wide
    port unless the local peer phys also match each other. Introduce a flag
    to select stricter behavior at sas_register_ha() time. The flag can be
    dropped once it is known that all libsas users expect the same behavior.

    Current drivers just initialize this field to zero and get the
    traditional behavior.

    Reported-by: Patrick Thomson
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Dan Williams
     

17 Nov, 2010

1 commit

  • Move the mid-layer's ->queuecommand() invocation from being locked
    with the host lock to being unlocked to facilitate speeding up the
    critical path for drivers who don't need this lock taken anyway.

    The patch below presents a simple SCSI host lock push-down as an
    equivalent transformation. No locking or other behavior should change
    with this patch. All existing bugs and locking orders are preserved.

    Additionally, add one parameter to queuecommand,
    struct Scsi_Host *
    and remove one parameter from queuecommand,
    void (*done)(struct scsi_cmnd *)

    Scsi_Host* is a convenient pointer that most host drivers need anyway,
    and 'done' is redundant to struct scsi_cmnd->scsi_done.

    Minimal code disturbance was attempted with this change. Most drivers
    needed only two one-line modifications for their host lock push-down.

    Signed-off-by: Jeff Garzik
    Acked-by: James Bottomley
    Signed-off-by: Linus Torvalds

    Jeff Garzik
     

09 Oct, 2010

1 commit

  • sd will get hung up issuing commands to flush write cache if a SAS
    device behind the expander is unplugged without warning. Change libsas
    to reject commands to domain devices that have already gone away.

    [maciej.trela@intel.com: removed setting ->gone in sas_deform_port() to
    permit sync cache commands at module removal]

    Signed-off-by: Darrick J. Wong
    Tested-by: Haipao Fan
    Signed-off-by: Maciej Trela
    Signed-off-by: Dan Williams
    Signed-off-by: James Bottomley

    Darrick J. Wong
     

28 Jul, 2010

1 commit

  • We have two separate definitions for identical constants with nearly the
    same name. One comes from the generic headers in scsi.h; the other is
    an enum in libsas.h ... it's causing confusion about which one is
    correct (fortunately they both are).

    Fix this by eliminating the libsas.h duplicate

    Signed-off-by: James Bottomley

    James Bottomley
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

05 Dec, 2009

1 commit

  • This patch modifies scsi_host_template->change_queue_depth so that
    it takes an argument indicating why it is being called. This will be
    used so that if a LLD needs to do some extra processing when
    handling queue fulls or later ramp ups, it can do so.

    This is a simple port of the drivers setting a change_queue_depth
    callback. In the patch I just have these LLDs adjust the queue depth
    if the user was requesting it.

    Signed-off-by: Mike Christie

    [Vasu.Dev: v2
    Also converted pmcraid_change_queue_depth and then verified
    all modules compile using "make allmodconfig" for any new build
    warnings on X86_64.

    Updated original description after combing two original
    patches from Mike to make this patch git bisectable.]
    Signed-off-by: Vasu Dev
    [jejb: fixed up 53c700]
    Signed-off-by: James Bottomley

    Mike Christie
     

19 Apr, 2008

1 commit


08 Apr, 2008

1 commit


24 Feb, 2008

1 commit


26 Jan, 2008

1 commit


12 Jan, 2008

3 commits


02 Nov, 2007

1 commit


26 Jul, 2007

1 commit


19 Jul, 2007

3 commits

  • This patch adds support for SAS Management Protocol (SMP) passthrough
    support via bsg. aic94xx can use this.

    Signed-off-by: FUJITA Tomonori
    Signed-off-by: James Bottomley

    FUJITA Tomonori
     
  • This is a respin of my earlier patch that migrates the ATA support code
    into a separate file. For now, the controversial linking bits have
    been removed per James Bottomley's request for a patch that contains
    only the migration diffs, which means that libsas continues to require
    libata. I intend to address that problem in a separate patch.

    This patch is against the aic94xx-sas-2.6 git tree, and it has been
    sanity tested on my x206m with Seagate SATA and SAS disks without
    uncovering any new problems.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • Hook the scsi_host_template functions in libsas to delegate
    functionality to libata when appropriate.

    Signed-off-by: Darrick J. Wong

    Misc code changes and merge fixes and update for libata->drivers/ata
    move

    Signed-off-by: James Bottomley

    Darrick J. Wong
     

06 May, 2007

1 commit


12 Feb, 2007

2 commits

  • * master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (97 commits)
    [SCSI] zfcp: removed wrong comment
    [SCSI] zfcp: use of uninitialized variable
    [SCSI] zfcp: Invalid locking order
    [SCSI] aic79xx: use dma_get_required_mask()
    [SCSI] aic79xx: fix bracket mismatch in unused macro
    [SCSI] BusLogic: Replace 'boolean' by 'bool'
    [SCSI] advansys: clean up warnings
    [SCSI] 53c7xx: brackets fix in uncompiled code
    [SCSI] nsp_cs: remove old scsi code
    [SCSI] aic79xx: make ahd_match_scb() static
    [SCSI] DAC960: kmalloc->kzalloc/Casting cleanups
    [SCSI] scsi_kmap_atomic_sg(): check that local irqs are disabled
    [SCSI] Buslogic: local_irq_disable() is redundant after local_irq_save()
    [SCSI] aic94xx: update for v28 firmware
    [SCSI] scsi_error: Fix lost EH commands
    [SCSI] aic94xx: Add default bus reset handler
    [SCSI] aic94xx: Remove TMF result code munging
    [SCSI] libsas: Add an LU reset mechanism to the error handler
    [SCSI] libsas: Don't BUG when connecting two expanders via wide port
    [SCSI] st: fix Tape dies if wrong block size used, bug 7919
    ...

    Linus Torvalds
     
  • Replace appropriate pairs of "kmem_cache_alloc()" + "memset(0)" with the
    corresponding "kmem_cache_zalloc()" call.

    Signed-off-by: Robert P. J. Day
    Cc: "Luck, Tony"
    Cc: Andi Kleen
    Cc: Roland McGrath
    Cc: James Bottomley
    Cc: Greg KH
    Acked-by: Joel Becker
    Cc: Steven Whitehouse
    Cc: Jan Kara
    Cc: Michael Halcrow
    Cc: "David S. Miller"
    Cc: Stephen Smalley
    Cc: James Morris
    Cc: Chris Wright
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     

03 Feb, 2007

1 commit


28 Jan, 2007

1 commit

  • This patch moves the code that handles SAS failures out of the main EH
    function and into a separate function. It also detects commands that have
    no sas_task (i.e. they completed, but with error data) and sends them into
    scsi_error for processing. This allows us to handle SCSI errors (and
    enables auto-spinup as a side effect) instead of dropping them on the
    floor and falling into an infinite loop. It also requires the
    implementation of a device reset function, which the SAS failure code has
    been modified to employ for REQ_DEVICE_RESET.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     

14 Jan, 2007

6 commits

  • Track sas_ha_struct state so that we ignore events that come in while
    we're shutting things down.

    Signed-off-by: Malahal Naineni
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • sas_task_abort() should simply abort the upper-level SCSI command and wait
    until the error handler to send the actual ABORT TASK command. By
    deferring things to the EH we simplify the concurrency coordination and
    eliminate some race conditions. Note that sas_task_abort has a few hooks
    to handle libsas internal commands properly too.

    Also rename do_sas_task_abort to __sas_task_abort just in case we really
    want to abort the task *right now* and we don't have a scsi_cmnd attached
    to the command. This is a hook for libata internal commands to abort.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • When a SAS LLDD needs to request a device port reset, it needs to have all
    commands aborted before it can reset the port. Since commands are put on
    the EH's list in the order that they were queued, the LLDD can set a "need
    reset" flag in the last task to be aborted so that the EH can reset the
    port after all commands are aborted.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • This flag is no longer necessary because we push tasks to be aborted into
    the EH as soon as we possibly can, and let the SCSI EH code take care of
    the coordination for which this flag was used.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • This patch lets a user arbitrarily enable or disable a phy via sysfs.
    Potential applications include shutting down a phy to replace one
    lane of wide port, and (more importantly) providing a method for the
    libata SATL to control the phy.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: James Bottomley

    Darrick J. Wong
     
  • …LLDD or have already returned

    On a system with many SAS targets, it appears possible that a scsi_cmnd
    can time out without ever making it to the SAS LLDD or at the same time
    that a completion is occurring. In both of these cases, telling the
    LLDD to abort the sas_task makes no sense because the LLDD won't know
    about the sas_task; what we really want to do is to increase the timer.
    Note that this involves creating another sas_task bit to indicate
    whether or not the task has been sent to the LLDD; I could have
    implemented this by slightly redefining SAS_TASK_STATE_PENDING, but
    this way seems cleaner.

    This second version amends the aic94xx portion to set the
    TASK_AT_INITIATOR flag for all sas_tasks that were passed to
    lldd_execute_task.

    Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>
    Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

    Darrick J. Wong
     

08 Dec, 2006

1 commit

  • Replace all uses of kmem_cache_t with struct kmem_cache.

    The patch was generated using the following script:

    #!/bin/sh
    #
    # Replace one string by another in all the kernel sources.
    #

    set -e

    for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
    quilt add $file
    sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
    mv /tmp/$$ $file
    quilt refresh
    done

    The script was run like this

    sh replace kmem_cache_t "struct kmem_cache"

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter
     

06 Dec, 2006

3 commits

  • Signed-Off-By: David Howells

    David Howells
     
  • Conflicts:

    drivers/pcmcia/ds.c

    Fix up merge failures with Linus's head and fix new compile failures.

    Signed-Off-By: David Howells

    David Howells
     
  • * master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (73 commits)
    [SCSI] aic79xx: Add ASC-29320LPE ids to driver
    [SCSI] stex: version update
    [SCSI] stex: change wait loop code
    [SCSI] stex: add new device type support
    [SCSI] stex: update device id info
    [SCSI] stex: adjust default queue length
    [SCSI] stex: add value check in hard reset routine
    [SCSI] stex: fix controller_info command handling
    [SCSI] stex: fix biosparam calculation
    [SCSI] megaraid: fix MMIO casts
    [SCSI] tgt: fix undefined flush_dcache_page() problem
    [SCSI] libsas: better error handling in sas_expander.c
    [SCSI] lpfc 8.1.11 : Change version number to 8.1.11
    [SCSI] lpfc 8.1.11 : Misc Fixes
    [SCSI] lpfc 8.1.11 : Add soft_wwnn sysfs attribute, rename soft_wwn_enable
    [SCSI] lpfc 8.1.11 : Removed decoding of PCI Subsystem Id
    [SCSI] lpfc 8.1.11 : Add MSI (Message Signalled Interrupts) support
    [SCSI] lpfc 8.1.11 : Adjust LOG_FCP logging
    [SCSI] lpfc 8.1.11 : Fix Memory leaks
    [SCSI] lpfc 8.1.11 : Fix lpfc_multi_ring_support
    ...

    Linus Torvalds