1. 12 4月, 2013 1 次提交
  2. 04 4月, 2013 2 次提交
    • A
      libata-acpi: remove redundent code for power resource handling · 7381fe73
      Aaron Lu 提交于
      With commit:
      bc9b6407
      ACPI / PM: Rework the handling of devices depending on power resources
      
      The ACPI core now takes care of the power resources an acpi device
      depends on in that when the power resources are turned on, any devices
      that are bound to or in the dependent list of this acpi device will be
      runtime resumed. So there is no need for ata acpi code to duplicate this
      effort, and thus, the ata_acpi_(un)register_power_resource functions are
      no longer needed.
      
      The above commit thinks the scsi device is not bound to the acpi device,
      so needs to be added to the dependent list. But actually, it is. So
      there is no need to add it to the dependent list, or it will be runtime
      resumed twice(though this wouldn't cause any problem).
      
      This patch fixes it, and as a result, the
      ata_acpi_(un)register_power_resource and ata_acpi_(un)bind functions
      are removed.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      7381fe73
    • K
      [libata] Fix HDIO_DRIVE_* ioctl() Linux 3.9 regression · 6d3bfc7b
      Krzysztof Mazur 提交于
      On Mon, Mar 25, 2013 at 06:26:50PM +0100, Ronald wrote:
      > In reply to [1]: I have the same issue. Git bisect took 50+ rebuilds xD
      >
      > Smartd does not work anymore since 84a9a8cd ([libata] Set proper SK
      > when CK_COND is set.).
      
      > [1] http://www.spinics.net/lists/linux-ide/msg45268.html
      
      It seems that the SAM_STAT_CHECK_CONDITION is not cleared
      causing -EIO, because that patch modified sensebuf and
      the check for clearing SAM_STAT_CHECK_CONDITION is no longer valid.
      
      Fix that.
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6d3bfc7b
  3. 21 2月, 2013 1 次提交
    • G
      [libata] Set proper SK when CK_COND is set. · 84a9a8cd
      Gwendal Grignou 提交于
      When the user application sends a ATA_12 or ATA_16 PASSTHROUGH
      scsi command, put the task file register in the sense data with the
      proper Sense Key. Instead of NO SENSE, set RECOVERED, as
      specified in [SAT2]12.2.5 Table 92.
      
      Tested:
      Using udev ata_id to generate a passthrough command, IDENTIFY:
      before:
       sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
      a1 08 2e 00 01 00 00 00 00 ec 00 00
       sd 0:0:0:0: [sda] Sense Key : No Sense [current] [descriptor]
       Descriptor sense data with sense descriptors (in hex):
               72 00 00 00 00 00 00 0e 09 0c 00 00 00 00 00 3f
               00 18 00 a6 e0 50
      
      after
       sd 0:0:0:0: [sda] CDB: ATA command pass through(12)/Blank: \
      a1 08 2e 00 01 00 00 00 00 ec 00 00
       sd 0:0:0:0: [sda]  Sense Key : Recovered Error [current] [descriptor]
       Descriptor sense data with sense descriptors (in hex):
              72 01 00 1d 00 00 00 0e 09 0c 00 00 00 01 00 00
              00 00 00 00 00 50
      Signed-off-by: NGwendal Grignou <gwendal@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      84a9a8cd
  4. 22 1月, 2013 1 次提交
    • A
      libata: identify and init ZPODD devices · afe75951
      Aaron Lu 提交于
      The ODD can be enabled for ZPODD if the following three conditions are
      satisfied:
      1 The ODD supports device attention;
      2 The platform can runtime power off the ODD through ACPI;
      3 The ODD is either slot type or drawer type.
      For such ODDs, zpodd_init is called and a new structure is allocated for
      it to store ZPODD related stuffs.
      
      And the zpodd_dev_enabled function is used to test if ZPODD is currently
      enabled for this ODD.
      
      A new config CONFIG_SATA_ZPODD is added to selectively build ZPODD code.
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Acked-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      afe75951
  5. 14 12月, 2012 1 次提交
    • X
      [libata] fix Null pointer dereference on disk error · 26cd4d65
      Xiaotian Feng 提交于
      Following oops were observed when disk error happened:
      
      [ 4272.896937] sd 0:0:0:0: [sda] Unhandled error code
      [ 4272.896939] sd 0:0:0:0: [sda] Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
      [ 4272.896942] sd 0:0:0:0: [sda] CDB: Read(10): 28 00 00 5a de a7 00 00 08 00
      [ 4272.896951] end_request: I/O error, dev sda, sector 5955239
      [ 4291.574947] BUG: unable to handle kernel NULL pointer dereference at (null)
      [ 4291.658305] IP: [] ahci_activity_show+0x1/0x40
      [ 4291.730090] PGD 76dbbc067 PUD 6c4fba067 PMD 0
      [ 4291.783408] Oops: 0000 [#1] SMP
      [ 4291.822100] last sysfs file: /sys/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/sw_activity
      [ 4291.934235] CPU 9
      [ 4291.958301] Pid: 27942, comm: hwinfo ......
      
      ata_scsi_find_dev could return NULL, so ata_scsi_activity_{show,store} should check if atadev is NULL.
      Signed-off-by: NXiaotian Feng <dannyfeng@tencent.com>
      Cc: James Bottomley <JBottomley@Parallels.com>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      26cd4d65
  6. 14 11月, 2012 2 次提交
    • M
      [SCSI] sd: Implement support for WRITE SAME · 5db44863
      Martin K. Petersen 提交于
      Implement support for WRITE SAME(10) and WRITE SAME(16) in the SCSI disk
      driver.
      
       - We set the default maximum to 0xFFFF because there are several
         devices out there that only support two-byte block counts even with
         WRITE SAME(16). We only enable transfers bigger than 0xFFFF if the
         device explicitly reports MAXIMUM WRITE SAME LENGTH in the BLOCK
         LIMITS VPD.
      
       - max_write_same_blocks can be overriden per-device basis in sysfs.
      
       - The UNMAP discovery heuristics remain unchanged but the discard
         limits are tweaked to match the "real" WRITE SAME commands.
      
       - In the error handling logic we now distinguish between WRITE SAME
         with and without UNMAP set.
      
      The discovery process heuristics are:
      
       - If the device reports a SCSI level of SPC-3 or greater we'll issue
         READ SUPPORTED OPERATION CODES to find out whether WRITE SAME(16) is
         supported. If that's the case we will use it.
      
       - If the device supports the block limits VPD and reports a MAXIMUM
         WRITE SAME LENGTH bigger than 0xFFFF we will use WRITE SAME(16).
      
       - Otherwise we will use WRITE SAME(10) unless the target LBA is beyond
         0xFFFFFFFF or the block count exceeds 0xFFFF.
      
       - no_write_same is set for ATA, FireWire and USB.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Reviewed-by: NMike Snitzer <snitzer@redhat.com>
      Reviewed-by: NJeff Garzik <jgarzik@redhat.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      5db44863
    • M
      [SCSI] Add a report opcode helper · 3c6bdaea
      Martin K. Petersen 提交于
      The REPORT SUPPORTED OPERATION CODES command can be used to query
      whether a given opcode is supported by a device. Add a helper function
      that allows us to look up commands.
      
      We only issue RSOC if the device reports compliance with SPC-3 or
      later. But to err on the side of caution we disable the command for ATA,
      FireWire and USB.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Acked-by: NMike Snitzer <snitzer@redhat.com>
      Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
      3c6bdaea
  7. 18 8月, 2012 3 次提交
  8. 29 6月, 2012 1 次提交
  9. 23 4月, 2012 2 次提交
  10. 13 4月, 2012 1 次提交
  11. 01 3月, 2012 1 次提交
  12. 09 1月, 2012 2 次提交
  13. 09 11月, 2011 1 次提交
  14. 01 11月, 2011 1 次提交
  15. 03 10月, 2011 1 次提交
  16. 24 7月, 2011 1 次提交
    • J
      ata: Convert ata_<foo>_printk(KERN_<LEVEL> to ata_<foo>_<level> · a9a79dfe
      Joe Perches 提交于
      Saves text by removing nearly duplicated text format strings by
      creating ata_<foo>_printk functions and printf extension %pV.
      
      ata defconfig size shrinks ~5% (~8KB), allyesconfig ~2.5% (~13KB)
      
      Format string duplication comes from:
      
       #define ata_link_printk(link, lv, fmt, args...) do { \
             if (sata_pmp_attached((link)->ap) || (link)->ap->slave_link)    \
                     printk("%sata%u.%02u: "fmt, lv, (link)->ap->print_id,   \
                            (link)->pmp , ##args); \
             else \
                     printk("%sata%u: "fmt, lv, (link)->ap->print_id , ##args); \
             } while(0)
      
      Coalesce long formats.
      
      $ size drivers/ata/built-in.*
         text	   data	    bss	    dec	    hex	filename
       544969	  73893	 116584	 735446	  b38d6	drivers/ata/built-in.allyesconfig.ata.o
       558429	  73893	 117864	 750186	  b726a	drivers/ata/built-in.allyesconfig.dev_level.o
       141328	  14689	   4220	 160237	  271ed	drivers/ata/built-in.defconfig.ata.o
       149567	  14689	   4220	 168476	  2921c	drivers/ata/built-in.defconfig.dev_level.o
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      a9a79dfe
  17. 24 6月, 2011 1 次提交
    • N
      libata/sas: only set FROZEN flag if new EH is supported · 3f1e046a
      Nishanth Aravamudan 提交于
      On 16.06.2011 [08:28:39 -0500], Brian King wrote:
      > On 06/16/2011 02:51 AM, Tejun Heo wrote:
      > > On Wed, Jun 15, 2011 at 04:34:17PM -0700, Nishanth Aravamudan wrote:
      > >>> That looks like the right thing to do. For ipr's usage of
      > >>> libata, we don't have the concept of a port frozen state, so this flag
      > >>> should really never get set. The alternate way to fix this would be to
      > >>> only set ATA_PFLAG_FROZEN in ata_port_alloc if ap->ops->error_handler
      > >>> is not NULL.
      > >>
      > >> It seemed like ipr is as you say, but I wasn't sure if it was
      > >> appropriate to make the change above in the common libata-scis code or
      > >> not. I don't want to break some other device on accident.
      > >>
      > >> Also, I tried your suggestion, but I don't think that can happen in
      > >> ata_port_alloc? ata_port_alloc is allocated ap itself, and it seems like
      > >> ap->ops typically gets set only after ata_port_alloc returns?
      > >
      > > Maybe we can test error_handler in ata_sas_port_start()?
      >
      > Good point. Since libsas is converted to the new eh now, we would need to have
      > this test.
      
      Commit 7b3a24c5 ("ahci: don't enable
      port irq before handler is registered") caused a regression for CD-ROMs
      attached to the IPR SATA bus on Power machines:
      
        ata_port_alloc: ENTER
        ata_port_probe: ata1: bus probe begin
        ata1.00: ata_dev_read_id: ENTER
        ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
        ata1.00: ata_dev_read_id: ENTER
        ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
        ata1.00: limiting speed to UDMA7:PIO5
        ata1.00: ata_dev_read_id: ENTER
        ata1.00: failed to IDENTIFY (I/O error, err_mask=0x40)
        ata1.00: disabled
        ata_port_probe: ata1: bus probe end
        scsi_alloc_sdev: Allocation failure during SCSI scanning, some SCSI devices might not be configured
      
      The FROZEN flag added in that commit is only cleared by the new EH code,
      which is not used by ipr. Clear this flag in the SAS code if we don't
      support new EH.
      Reported-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NNishanth Aravamudan <nacc@us.ibm.com>
      Signed-off-by: NJeff Garzik <jgarzik@pobox.com>
      3f1e046a
  18. 20 5月, 2011 1 次提交
  19. 07 5月, 2011 1 次提交
  20. 31 3月, 2011 1 次提交
  21. 14 3月, 2011 1 次提交
  22. 02 3月, 2011 2 次提交
  23. 14 2月, 2011 2 次提交
    • J
      [SCSI] libata: fix locking for sas paths · b8784f77
      James Bottomley 提交于
      For historical reasons, libsas uses the scsi host lock as the ata port
      lock, and libata always uses the ata host.  For the old eh, this was
      largely irrelevant since the two locks were never mixed inside the
      code.  However, the new eh has a case where it nests acquisition of
      the host lock inside the port lock (this does look rather deadlock
      prone).  Obviously this would be an instant deadlock if the port lock
      were the host lock, so switch the libsas paths to use the ata host
      lock as well.
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      b8784f77
    • J
      [SCSI] libata: plumb sas port scan into standard libata paths · 1f723867
      James Bottomley 提交于
      The function ata_sas_port_init() has always really done its own thing.
      However, as a precursor to moving to the libata new eh, it has to be
      properly using the standard libata scan paths.  This means separating
      the current libata scan paths into pieces which can be shared with
      libsas and pieces which cant (really just the async call and the host
      scan).
      
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Jeff Garzik <jeff@garzik.org>
      Signed-off-by: NJames Bottomley <James.Bottomley@suse.de>
      1f723867
  24. 28 1月, 2011 1 次提交
    • T
      libata: set queue DMA alignment to sector size for ATAPI too · 729a6a30
      Tejun Heo 提交于
      ata_pio_sectors() expects buffer for each sector to be contained in a
      single page; otherwise, it ends up overrunning the first page.  This
      is achieved by setting queue DMA alignment.  If sector_size is smaller
      than PAGE_SIZE and all buffers are sector_size aligned, buffer for
      each sector is always contained in a single page.
      
      This wasn't applied to ATAPI devices but IDENTIFY_PACKET is executed
      as ATA_PROT_PIO and thus uses ata_pio_sectors().  Newer versions of
      udev issue IDENTIFY_PACKET with unaligned buffer triggering the
      problem and causing oops.
      
      This patch fixes the problem by setting sdev->sector_size to
      ATA_SECT_SIZE on ATATPI devices and always setting DMA alignment to
      sector_size.  While at it, add a warning for the unlikely but still
      possible scenario where sector_size is larger than PAGE_SIZE, in which
      case the alignment wouldn't be enough.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Reported-by: NJohn Stanley <jpsinthemix@verizon.net>
      Tested-by: NJohn Stanley <jpsinthemix@verizon.net>
      Cc: stable@kernel.org
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      729a6a30
  25. 06 1月, 2011 1 次提交
  26. 18 11月, 2010 1 次提交
  27. 17 11月, 2010 1 次提交
    • J
      SCSI host lock push-down · f281233d
      Jeff Garzik 提交于
      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: NJeff Garzik <jgarzik@redhat.com>
      Acked-by: NJames Bottomley <James.Bottomley@suse.de>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f281233d
  28. 13 11月, 2010 1 次提交
  29. 22 10月, 2010 4 次提交
    • M
      libata: Signal that our SATL supports WRITE SAME(16) with UNMAP · 02e0a604
      Martin K. Petersen 提交于
      Until now identifying that a device supports WRITE SAME(16) with the
      UNMAP bit set has been black magic.  Implement support for the SBC-3
      Thin Provisioning VPD page and set the TPWS bit.
      Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      02e0a604
    • T
      libata: reimplement link power management · 6b7ae954
      Tejun Heo 提交于
      The current LPM implementation has the following issues.
      
      * Operation order isn't well thought-out.  e.g. HIPM should be
        configured after IPM in SControl is properly configured.  Not the
        other way around.
      
      * Suspend/resume paths call ata_lpm_enable/disable() which must only
        be called from EH context directly.  Also, ata_lpm_enable/disable()
        were called whether LPM was in use or not.
      
      * Implementation is per-port when it should be per-link.  As a result,
        it can't be used for controllers with slave links or PMP.
      
      * LPM state isn't managed consistently.  After a link reset for
        whatever reason including suspend/resume the actual LPM state would
        be reset leaving ap->lpm_policy inconsistent.
      
      * Generic/driver-specific logic boundary isn't clear.  Currently,
        libahci has to mangle stuff which libata EH proper should be
        handling.  This makes the implementation unnecessarily complex and
        fragile.
      
      * Tied to ALPM.  Doesn't consider DIPM only cases and doesn't check
        whether the device allows HIPM.
      
      * Error handling isn't implemented.
      
      Given the extent of mismatch with the rest of libata, I don't think
      trying to fix it piecewise makes much sense.  This patch reimplements
      LPM support.
      
      * The new implementation is per-link.  The target policy is still
        port-wide (ap->target_lpm_policy) but all the mechanisms and states
        are per-link and integrate well with the rest of link abstraction
        and can work with slave and PMP links.
      
      * Core EH has proper control of LPM state.  LPM state is reconfigured
        when and only when reconfiguration is necessary.  It makes sure that
        LPM state is reset when probing for new device on the link.
        Controller agnostic logic is now implemented in libata EH proper and
        driver implementation only has to deal with controller specifics.
      
      * Proper error handling.  LPM config failure is attributed to the
        device on the link and LPM is disabled for the link if it fails
        repeatedly.
      
      * ops->enable/disable_pm() are replaced with single ops->set_lpm()
        which takes @policy and @hints.  This simplifies driver specific
        implementation.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      6b7ae954
    • T
      libata: clean up lpm related symbols and sysfs show/store functions · c93b263e
      Tejun Heo 提交于
      Link power management related symbols are in confusing state w/ mixed
      usages of lpm, ipm and pm.  This patch cleans up lpm related symbols
      and sysfs show/store functions as follows.
      
      * lpm states - NOT_AVAILABLE, MIN_POWER, MAX_PERFORMANCE and
        MEDIUM_POWER are renamed to ATA_LPM_UNKNOWN and
        ATA_LPM_{MIN|MAX|MED}_POWER.
      
      * Pre/postfixes are unified to lpm.
      
      * sysfs show/store functions for link_power_management_policy were
        curiously named get/put and unnecessarily complex.  Renamed to
        show/store and simplified.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      c93b263e
    • G
      [libata] support for > 512 byte sectors (e.g. 4K Native) · 295124dc
      Grant Grundler 提交于
      This change enables my x86 machine to recognize and talk to a
      "Native 4K" SATA device.
      
      When I started working on this, I didn't know Matthew Wilcox had
      posted a similar patch 2 years ago:
        http://git.kernel.org/?p=linux/kernel/git/willy/ata.git;a=shortlog;h=refs/heads/ata-large-sectors
      
      Gwendal Grignou pointed me at the the above code and small portions of
      this patch include Matthew's work. That's why Mathew is first on the
      "Signed-off-by:". I've NOT included his use of a bitmap to determine
      512 vs Native for ATA command block size - just used a simple table.
      And bugs are almost certainly mine.
      
      Lastly, the patch has been tested with a native 4K 'Engineering
      Sample' drive provided by Hitachi GST.
      Signed-off-by: NMatthew Wilcox <matthew.r.wilcox@intel.com>
      Signed-off-by: NGrant Grundler <grundler@google.com>
      Reviewed-by: NGwendal Grignou <gwendal@google.com>
      Signed-off-by: NJeff Garzik <jgarzik@redhat.com>
      295124dc