03 Jul, 2013

1 commit

  • libata/for-3.10-fixes never got submitted during v3.10 cycle. Merge
    it into for-3.11 so that it can be routed together with other changes
    scheduled for v3.11.

    Three trivial conflicts in drivers/ata/sata_rcar.c. All are caused by
    1b20f6a9ad ("sata_rcar: add 'base' local variable to some functions")
    conflicting with logic updates in for-3.10-fixes. The offending
    commit simply adds local variable @base on functions which
    dereferences sata_rcar_priv->base multiple times. The resolutions are
    trivial - applying s/priv->base/base/ in the conflicting logic
    updates.

    Signed-off-by: Tejun Heo

    Tejun Heo
     

25 Jun, 2013

1 commit

  • ahci_hardreset() and ahci_p5wdh_hardreset() use bare numbers for the
    BSY bit of the ATA status register, despite it's #define'd in
    .

    Signed-off-by: Sergei Shtylyov
    Signed-off-by: Tejun Heo

    Sergei Shtylyov
     

10 Jun, 2013

1 commit

  • ata_link_online() check in ahci_error_intr() is unnecessary, it should
    be removed otherwise may lead to lockup with FBS enabled PMP.
    http://marc.info/?l=linux-ide&m=137050421603272&w=2

    Reported-by: Yu Liu
    Signed-off-by: Shane Huang
    Signed-off-by: Tejun Heo
    Cc: stable@vger.kernel.org

    Shane Huang
     

07 Jun, 2013

1 commit


22 May, 2013

1 commit


15 May, 2013

1 commit


25 Jan, 2013

1 commit

  • Take advantage of multiple MSIs implementation on x86 - on
    systems with IRQ remapping AHCI ports not only get assigned
    separate MSI vectors - but also separate IRQs. As result,
    interrupts generated by different ports could be serviced on
    different CPUs rather than on a single one.

    In cases when number of allocated MSIs is less than requested
    the Sharing Last MSI mode does not get used, no matter
    implemented in hardware or not. Instead, the driver assumes the
    advantage of multiple MSIs is negated and falls back to the
    single MSI mode as if MRSM bit was set (some Intel chips
    implement this strategy anyway - MRSM bit gets set even if the
    number of allocated MSIs exceeds the number of implemented ports).

    Signed-off-by: Alexander Gordeev
    Acked-by: Jeff Garzik
    Cc: Bjorn Helgaas
    Cc: Suresh Siddha
    Cc: Yinghai Lu
    Cc: Matthew Wilcox
    Cc: Linus Torvalds
    Cc: Andrew Morton
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Link: http://lkml.kernel.org/r/15bf7ee314dd55f21ec7d2a01c47613cd8190a7c.1353324359.git.agordeev@redhat.com
    Signed-off-by: Ingo Molnar

    Alexander Gordeev
     

15 Jan, 2013

1 commit

  • NCQ capability was used to check availability of SATA Settings page
    from Identify Device Data Log, which contains DevSlp timing variables.
    It does not work on some HDDs and leads to error messages.

    IDENTIFY word 78 bit 5(Hardware Feature Control) can't work either
    because it is only the sufficient condition of Identify Device data
    log, not the necessary condition.

    This patch replaced ata_device->sata_settings with ->devslp_timing
    to only save DevSlp timing variables(8 bytes), instead of the whole
    SATA Settings page(512 bytes).

    Addresses https://bugzilla.kernel.org/show_bug.cgi?id=51881

    Reported-by: Borislav Petkov
    Signed-off-by: Shane Huang
    Cc: stable@vger.kernel.org
    Signed-off-by: Jeff Garzik

    Shane Huang
     

14 Dec, 2012

1 commit


13 Sep, 2012

1 commit

  • Device Sleep is a feature as described in AHCI 1.3.1 Technical Proposal.
    This feature enables an HBA and SATA storage device to enter the DevSleep
    interface state, enabling lower power SATA-based systems.

    Aggressive Device Sleep enables the HBA to assert the DEVSLP signal as
    soon as there are no commands outstanding to the device and the port
    specific Device Sleep idle timer has expired. This enables autonomous
    entry into the DevSleep interface state without waiting for software
    in power sensitive systems.

    This patch enables Aggressive Device Sleep only if both host controller
    and device support it.

    Tested on AMD reference board together with Device Sleep supported device
    sample.

    Signed-off-by: Shane Huang
    Reviewed-by: Aaron Lu
    Signed-off-by: Jeff Garzik

    Shane Huang
     

18 Aug, 2012

1 commit


14 Mar, 2012

1 commit

  • The following commit was intended to fix problems with specific AHCI
    controller(s) that would become bricks if the AHCI specification was not
    followed strictly (that is, if ahci_start_engine() was called while the
    controller was in the wrong state):

    commit 7faa33da9b7add01db9f1ad92c6a5d9145e940a7
    ahci: start engine only during soft/hard resets

    However, some devices currently have issues with that fix, so we must
    implement a flag that delays the ahci_start_engine() call only for specific
    controllers.

    This commit simply introduces the flag, without enabling it in any driver.

    Note that even when AHCI_HFLAG_DELAY_ENGINE is not enabled, this patch does
    not constitue a full revert to commit 7faa33da; there is still a change in
    behavior to the ahci_port_suspend() failure path.

    Signed-off-by: Brian Norris
    Signed-off-by: Jeff Garzik
    Cc: stable@kernel.org

    Brian Norris
     

09 Jan, 2012

1 commit

  • This is another attempt at fixing the same problem that 270dac35c2
    (libata: ahci_start_engine compliant to AHCI spec) tried to solve.
    Unfortunately, 270dac35c2 created regressions for a lot more common
    controllers and got reverted.

    This specific AHCI IP block becomes a brick if the DMA engine is
    started while DRQ is set. It is not possible to avoid the condition
    completely but the most common occurrence is caused by spurious use of
    ahci_start_engine() from ahci_start_port() during init sequence.

    DMA engine is started after both soft and hard resets and
    ahci_start_port() is always followed by resets, so there is no reason
    to start DMA engine from ahci_start_port().

    This patch removes ahci_start_engine() invocation from
    ahci_start_port(). This change makes failure path of
    ahci_port_suspend() leave engine stopped without following resets.
    This is resolved by replacing ahci_start_port() call with
    ata_port_freeze() which forces resets afterwards, which is the better
    behavior anyway.

    Signed-off-by: Tejun Heo
    Reported-by: Brian Norris
    Reported-by: Jian Peng
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

24 Jul, 2011

3 commits

  • ahci_sb600_softreset was in ahci.c. This function is used
    to fix soft reset failure and renames as ahci_pmp_retry_softreset
    in libahci.c.

    Signed-off-by: Yuan-Hsin Chen
    Signed-off-by: Jeff Garzik

    Yuan-Hsin Chen
     
  • Saves text by removing nearly duplicated text format strings by
    creating ata__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: Joe Perches
    Signed-off-by: Jeff Garzik

    Joe Perches
     
  • Saves a bit of text as the call takes fewer args.

    Coalesce a few formats.
    Convert a few bare printks to pr_cont.

    $ size drivers/ata/built-in.o*
    text data bss dec hex filename
    558429 73893 117864 750186 b726a drivers/ata/built-in.o.allyesconfig.new
    559574 73893 117888 751355 b76fb drivers/ata/built-in.o.allyesconfig.old
    149567 14689 4220 168476 2921c drivers/ata/built-in.o.defconfig.new
    149851 14689 4220 168760 29338 drivers/ata/built-in.o.defconfig.old

    Signed-off-by: Joe Perches
    Signed-off-by: Jeff Garzik

    Joe Perches
     

30 Jun, 2011

1 commit

  • It's not so much an error as a warning about normal Marvell crazines.
    So don't use KERN_ERR that ends up spamming the console even in quiet
    mode, it's not _that_ critical.

    Explained by Jeff:

    "Long explanation, it's a mess:

    Marvell took standard AHCI, and bastardized it to include a weird mode
    whereby PATA devices appear inside the AHCI DMA and interrupt
    infrastructure you're familiar with.

    So, PATA devices appear via pata_marvell driver, using basic legacy
    IDE programming interface. But SATA devices, which might also be
    attached to this chip, either work in under-performing mode or
    simply don't work at all (e.g. newer 6 Gbps devices or port
    multiplier attachments, NCQ, ...)

    On the other hand, 'ahci' driver loads and works with the chip's
    attached SATA devices quite beautifully, but is completely unable to
    drive any attached PATA devices, due to the Marvell-specific
    PATA-under-AHCI interface.

    The "masking port_map 0x7 -> 0x3" message is the ahci driver "hiding"
    the PATA port(s) from itself, making sure it will only drive the SATA
    ports it knows how to drive."

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

    Linus Torvalds
     

15 May, 2011

1 commit

  • This reverts commit 270dac35c26433d06a89150c51e75ca0181ca7e4.

    The commits causes command timeouts on AC plug/unplug. It isn't yet
    clear why. As the commit was for a single rather obscure controller,
    revert the change for now.

    The problem was reported and bisected by Gu Rui in bug#34692.

    https://bugzilla.kernel.org/show_bug.cgi?id=34692

    Also, reported by Rafael and Michael in the following thread.

    http://thread.gmane.org/gmane.linux.kernel/1138771

    Signed-off-by: Tejun Heo
    Reported-by: Gu Rui
    Reported-by: Rafael J. Wysocki
    Reported-by: Michael Leun
    Cc: Jian Peng
    Cc: Jeff Garzik
    Signed-off-by: Linus Torvalds

    Tejun Heo
     

24 Apr, 2011

3 commits

  • At the end of section 10.1 of AHCI spec (rev 1.3), it states

    Software shall not set PxCMD.ST to 1 until it is determined that
    a functoinal device is present on the port as determined by
    PxTFD.STS.BSY=0, PxTFD.STS.DRQ=0 and PxSSTS.DET=3h

    Even though most AHCI host controller works without this check,
    specific controller will fail under this condition.

    Signed-off-by: Jian Peng
    Signed-off-by: Jeff Garzik

    Jian Peng
     
  • The ahci_pmp_attach() & ahci_pmp_detach() unmask port irqs, but they
    are also called during port initialization, before ahci host irq
    handler is registered. On ce4100 platform, this sometimes triggers
    "irq 4: nobody cared" message when loading driver.

    Fixed this by not touching the register if the port is in frozen
    state, and mark all uninitialized port as frozen.

    Signed-off-by: Maxime Bizon
    Acked-by: Tejun Heo
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Maxime Bizon
     
  • This patch adds an sysfs attribute 'em_message_supported' to the
    ahci host device which prints out the supported enclosure management
    message types.

    Signed-off-by: Hannes Reinecke
    Signed-off-by: Jeff Garzik

    Hannes Reinecke
     

06 Jan, 2011

1 commit


22 Oct, 2010

4 commits

  • ATA devices don't send D2H Reg FIS after an successful ATA PIO data-in
    command. The host is supposed to take the TF and E_Status of the
    preceding PIO Setup FIS. Update ahci_qc_fill_rtf() such that it takes
    TF + E_Status from PIO Setup FIS after a successful ATA PIO data-in
    command.

    Without this patch, result_tf for such a command is filled with the
    content of the previous D2H Reg FIS which belongs to a previous
    command, which can make the command incorrectly seen as failed.

    * Patch updated to grab the whole TF + E_Status from PIO Setup FIS
    instead of just E_Status as suggested by Robert Hancock.

    Signed-off-by: Tejun Heo
    Reported-by: Mark Lord
    Cc: Robert Hancock
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • Add optional @ap argument to ata_wait_register() and replace msleep()
    calls with ata_msleep() which take optional @ap in addition to the
    duration. These will be used to implement EH exclusion.

    This patch doesn't cause any behavior difference.

    Signed-off-by: Tejun Heo
    Signed-off-by: Jeff Garzik

    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: Tejun Heo
    Signed-off-by: Jeff Garzik

    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: Tejun Heo
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

29 Sep, 2010

1 commit

  • libata depends on scsi_host_template for module reference counting and
    sht's should be owned by each low level driver. During libahci split,
    the sht was left with libahci.ko leaving the actual low level drivers
    not reference counted. This made ahci and ahci_platform always
    unloadable even while they're being actively used.

    Fix it by defining AHCI_SHT() macro in ahci.h and defining a sht for
    each low level ahci driver.

    stable: only applicable to 2.6.35.

    Signed-off-by: Tejun Heo
    Reported-by: Pedro Francisco
    Tested-by: Michael Tokarev
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

10 Sep, 2010

1 commit

  • ahci_do_softreset() compared the current time and deadline in reverse
    when calculating timeout for SRST issue. The result is that if
    @deadline is in future, SRST is issued with 0 timeout, which hasn't
    caused any problem because it later waits for DRDY with the correct
    timeout. If deadline is already exceeded by the time SRST is about to
    be issued, the timeout calculation underflows and if the device
    doesn't respond, timeout doesn't trigger for a _very_ long time.

    Reverse the incorrect comparison order.

    Signed-off-by: Tejun Heo
    Reported-by: Anssi Hannula
    Tested-by: Gwendal Grignou
    Cc: stable@kernel.org
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

26 Aug, 2010

1 commit


02 Jul, 2010

1 commit


08 Jun, 2010

1 commit

  • Commit 96d60303fd (ahci: Turn off DMA engines when there's no device)
    implemented stopping DMA engines on empty ports but it used single
    sampling of status registers to determine device presence which led to
    disabling of DMA engines on occupied ports. Do it after all EH
    actions are complete using device presence state determined by EH.
    This avoids spurious disabling of DMA engines and simplifies the code.

    Signed-off-by: Tejun Heo
    Tested-by: Marc Dionne
    Cc: Matthew Garrett
    Cc: Robert Hancock
    Signed-off-by: Jeff Garzik

    Tejun Heo
     

15 May, 2010

5 commits

  • Add "em_buffer" attribute for SATA AHCI hosts to provide a way for
    userland to access AHCI EM (enclosure management) buffer directly if the
    host supports EM.

    AHCI driver should support SGPIO EM messages. However the SATA/AHCI
    specs did not define the SGPIO message format filled in EM buffer.
    Different HW vendors may have different definitions. The mainly purpose
    of this attribute is to solve this issue by allowing HW vendors to
    provide userland drivers and tools for their SGPIO initiators.

    Signed-off-by: Harry Zhang
    Signed-off-by: Jeff Garzik

    Harry Zhang
     
  • Detect enclosure management message type automatically at driver
    initialization, instead of using module parameter "ahci_em_messages".

    Signed-off-by: Harry Zhang
    Signed-off-by: Jeff Garzik

    Harry Zhang
     
  • Implicit slab.h inclusion via percpu.h is about to go away. Make sure
    gfp.h or slab.h is included as necessary.

    Signed-off-by: Tejun Heo
    Cc: Stephen Rothwell
    Cc: Jeff Garzik
    Signed-off-by: Jeff Garzik

    Tejun Heo
     
  • According to section 10.3.1 of the AHCI spec, PxCMD.ST must not be set
    unless there's a device attached. Following this saves us a measurable
    quantity of power and does not impair hotplug support. Based on a patch
    by Kristen Carlson Accardi.

    Signed-off-by: Matthew Garrett
    Cc: Kristen Carlson Accardi
    Signed-off-by: Jeff Garzik

    Matthew Garrett
     
  • This patch should contain no functional changes, just moves code
    around.

    Signed-off-by: Anton Vorontsov
    Signed-off-by: Jeff Garzik

    Anton Vorontsov