01 Nov, 2019

1 commit

  • In case a driver wants to return an error from qc_prep, return enum
    ata_completion_errors. sata_mv is one of those drivers -- see the next
    patch. Other drivers return the newly defined AC_ERR_OK.

    [v2] use enum ata_completion_errors and AC_ERR_OK.

    Signed-off-by: Jiri Slaby
    Cc: Jens Axboe
    Cc: linux-ide@vger.kernel.org
    Signed-off-by: Jens Axboe

    Jiri Slaby
     

31 Aug, 2019

1 commit

  • The commit ed08d40cdec4
    ("ahci: Changing two module params with static and __read_mostly")
    moved ahci_em_messages to be static while missing the fact of exporting it.

    WARNING: "ahci_em_messages" [vmlinux] is a static EXPORT_SYMBOL_GPL

    Drop export for the local variable ahci_em_messages.

    Fixes: ed08d40cdec4 ("ahci: Changing two module params with static and __read_mostly")
    Cc: Chuansheng Liu
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Jens Axboe

    Andy Shevchenko
     

29 Jun, 2019

1 commit


21 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license as published by
    the free software foundation either version 2 or at your option any
    later version this program is distributed in the hope that it will
    be useful but without any warranty without even the implied warranty
    of merchantability or fitness for a particular purpose see the gnu
    general public license for more details you should have received a
    copy of the gnu general public license along with this program see
    the file copying if not write to the free software foundation 675
    mass ave cambridge ma 02139 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 52 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Jilayne Lovejoy
    Reviewed-by: Steve Winslow
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190519154042.342335923@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

01 Mar, 2019

1 commit

  • For an AHCI controller with AHCI_HFLAG_MULTI_MSI flag set, we may get the
    following log, regardless of whether a custom irq handler was implemented
    or not:

    [ 14.700238] ahci 0000:74:03.0: both AHCI_HFLAG_MULTI_MSI flag set and custom irq handler implemented

    This is because we can set hpriv->irq_handler to
    ahci_single_level_irq_intr() if not already set, in
    ahci_init_one()->ahci_pci_save_initial_config()->ahci_save_initial_config().

    Stop having this warn being misleading by adding a check for
    hpriv->irq_handler != ahci_single_level_irq_intr.

    Signed-off-by: John Garry
    Signed-off-by: Jens Axboe

    John Garry
     

25 Aug, 2018

1 commit

  • Pull libata updates from Tejun Heo:
    "Nothing too interesting. Mostly ahci and ahci_platform changes, many
    around power management"

    * 'for-4.19' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata: (22 commits)
    ata: ahci_platform: enable to get and control reset
    ata: libahci_platform: add reset control support
    ata: add an extra argument to ahci_platform_get_resources()
    ata: sata_rcar: Add r8a77965 support
    ata: sata_rcar: exclude setting of PHY registers in Gen3
    ata: sata_rcar: really mask all interrupts on Gen2 and later
    Revert "ata: ahci_platform: allow disabling of hotplug to save power"
    ata: libahci: Allow reconfigure of DEVSLP register
    ata: libahci: Correct setting of DEVSLP register
    ata: ahci: Enable DEVSLP by default on x86 with SLP_S0
    ata: ahci: Support state with min power but Partial low power state
    Revert "ata: ahci_platform: convert kcalloc to devm_kcalloc"
    ata: sata_rcar: Add rudimentary Runtime PM support
    ata: sata_rcar: Provide a short-hand for &pdev->dev
    ata: Only output sg element mapped number in verbose debug
    ata: Guard ata_scsi_dump_cdb() by ATA_VERBOSE_DEBUG
    ata: ahci_platform: convert kcalloc to devm_kcalloc
    ata: ahci_platform: convert kzallloc to kcalloc
    ata: ahci_platform: correct parameter documentation for ahci_platform_shutdown
    libata: remove ata_sff_data_xfer_noirq()
    ...

    Linus Torvalds
     

31 Jul, 2018

2 commits

  • There are two modes in which DEVSLP can be entered. The OS initiated or
    hardware autonomous.

    In hardware autonomous mode, BIOS configures the AHCI controller and the
    device to enable DEVSLP. But they may not be ideal for all cases. So in
    this case, OS should be able to reconfigure DEVSLP register.

    Currently if the DEVSLP is already enabled, we can't set again as it will
    simply return. There are some systems where the firmware is setting high
    DITO by default, in this case we can't modify here to correct settings.
    With the default in several seconds, we are not able to transition to
    DEVSLP.

    This change will allow reconfiguration of devslp register if DITO is
    different.

    Signed-off-by: Srinivas Pandruvada
    Reviewed-by: Hans de Goede
    Signed-off-by: Tejun Heo

    Srinivas Pandruvada
     
  • We have seen that on some platforms, SATA device never show any DEVSLP
    residency. This prevent power gating of SATA IP, which prevent system
    to transition to low power mode in systems with SLP_S0 aka modern
    standby systems. The PHY logic is off only in DEVSLP not in slumber.
    Reference:
    https://www.intel.com/content/dam/www/public/us/en/documents/datasheets
    /332995-skylake-i-o-platform-datasheet-volume-1.pdf
    Section 28.7.6.1

    Here driver is trying to do read-modify-write the devslp register. But
    not resetting the bits for which this driver will modify values (DITO,
    MDAT and DETO). So simply reset those bits before updating to new values.

    Signed-off-by: Srinivas Pandruvada
    Reviewed-by: Rafael J. Wysocki
    Reviewed-by: Hans de Goede
    Signed-off-by: Tejun Heo

    Srinivas Pandruvada
     

30 Jul, 2018

1 commit

  • Currently when min_power policy is selected, the partial low power state
    is not entered and link will try aggressively enter to only slumber state.
    Add a new policy which still enable DEVSLP but also try to enter partial
    low power state. This policy is presented as "min_power_with_partial".

    For information the difference between partial and slumber
    Partial – PHY logic is powered up, and in a reduced power state. The link
    PM exit latency to active state maximum is 10 ns.
    Slumber – PHY logic is powered up, and in a reduced power state. The link
    PM exit latency to active state maximum is 10 ms.
    Devslp – PHY logic is powered down. The link PM exit latency from this
    state to active state maximum is 20 ms, unless otherwise specified by
    DETO.

    Suggested-and-reviewed-by: Hans de Goede
    Signed-off-by: Srinivas Pandruvada
    Signed-off-by: Tejun Heo

    Srinivas Pandruvada
     

19 Jun, 2018

2 commits


06 Jun, 2018

1 commit

  • Pull libata updates from Tejun Heo:

    - libata has always been limiting the maximum queue depth to 31, with
    one entry set aside mostly for historical reasons. This didn't use to
    make much difference but Jens found out that modern hard drives can
    actually perform measurably better with the extra one queue depth.
    Jens updated libata core so that it can make use of full 32 queue
    depth

    - Damien updated command retry logic in error handling so that it
    doesn't unnecessarily retry when upper layer (SCSI) is gonna handle
    them

    - A couple misc changes

    * 'for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    sata_fsl: use the right type for tag bitshift
    ahci: enable full queue depth of 32
    libata: don't clamp queue depth to ATA_MAX_QUEUE - 1
    libata: add extra internal command
    sata_nv: set host can_queue count appropriately
    libata: remove assumption that ATA_MAX_QUEUE - 1 is the max
    libata: use ata_tag_internal() consistently
    libata: bump ->qc_active to a 64-bit type
    libata: convert core and drivers to ->hw_tag usage
    libata: introduce notion of separate hardware tags
    libata: Fix command retry decision
    libata: Honor RQF_QUIET flag
    libata: Make ata_dev_set_mode() less verbose
    libata: Fix ata_err_string()
    libata: Fix comment typo in ata_eh_analyze_tf()
    sata_nv: don't use block layer bounce buffer
    ata: hpt37x: Convert to use match_string() helper

    Linus Torvalds
     

12 May, 2018

1 commit


27 Apr, 2018

1 commit

  • Marvell armada37xx, armada7k and armada8k share the same
    AHCI sata controller IP, and currently there is an issue
    (Errata Ref#226)that the SATA can not be detected via SATA
    Port-MultiPlayer(PMP). After debugging, the reason is
    found that the value of Port-x FIS-based Switching Control
    (PxFBS@0x40) became wrong.
    According to design, the bits[11:8, 0] of register PxFBS
    are cleared when Port Command and Status (0x18) bit[0]
    changes its value from 1 to 0, i.e. falling edge of Port
    Command and Status bit[0] sends PULSE that resets PxFBS
    bits[11:8; 0].
    So it needs save the port PxFBS register before PxCMD
    ST write and restore the port PxFBS register afterwards
    in ahci_stop_engine().

    This commit allows drivers to override ahci_stop_engine
    behavior for use by the Marvell AHCI driver(and potentially
    other drivers in the future).

    Signed-off-by: Evan Wang
    Cc: Ofer Heifetz
    Cc: Tejun Heo
    Cc: Thomas Petazzoni
    Signed-off-by: Tejun Heo

    Evan Wang
     

13 Feb, 2018

1 commit


20 Oct, 2017

1 commit

  • In preparation for unconditionally passing the struct timer_list pointer to
    all timer callbacks, switch to using the new timer_setup() and from_timer()
    to pass the timer pointer explicitly. Adds a pointer back to link
    structure.

    Signed-off-by: Kees Cook
    Signed-off-by: Thomas Gleixner
    Acked-by: Tejun Heo
    Cc: linux-ide@vger.kernel.org
    Link: https://lkml.kernel.org/r/20171016215658.GA101965@beast

    Kees Cook
     

23 Jun, 2017

2 commits

  • While most hardware will simply ignore a write to a read-only register,
    some hardware will signal an abort if this occurs.

    This commit introduces the flag AHCI_HFLAG_NO_WRITE_TO_RO to prevent the
    AHCI library from attempting to write to the HOST_CAP, HOST_CAP2, and
    HOST_PORTS_IMPL registers which may be read-only.

    Signed-off-by: Doug Berger
    Signed-off-by: Tejun Heo

    Doug Berger
     
  • Some hardware is capable of supporting Aggresive Link Power Management
    even though it is not indicated by the Host Capability register.

    This commit adds the AHCI_HFLAG_YES_ALPM flag to the AHCI library to
    allow indication of this quirk when the Host Capability register is
    Read Only and therefore cannot be changed.

    Signed-off-by: Doug Berger
    Signed-off-by: Tejun Heo

    Doug Berger
     

13 Jun, 2017

1 commit


16 May, 2017

1 commit


31 Jan, 2017

1 commit

  • We need a way to retrieve the information about the online state of
    the link in the ahci-da850 driver.

    Create a new function: ahci_do_hardreset() which is called from
    ahci_hardreset() for backwards compatibility, but has an additional
    argument: 'online' - which can be used to check if the link is online
    after this function returns.

    The new routine will be used in the ahci-da850 driver to avoid code
    duplication when implementing a workaround for tha da850 SATA
    controller quirk/instability.

    Signed-off-by: Bartosz Golaszewski
    Acked-by: Tejun Heo
    Signed-off-by: Sekhar Nori

    Bartosz Golaszewski
     

20 Oct, 2016

1 commit

  • Add a sysfs entry to turn on priority information being passed
    to a ATA device. By default this feature is turned off.

    This patch depends on ata: Enabling ATA Command Priorities

    tj: Renamed ncq_prio_on to ncq_prio_enable and removed trivial
    ata_ncq_prio_on() and open-coded the test.

    Signed-off-by: Adam Manzanares
    Signed-off-by: Tejun Heo

    Adam Manzanares
     

07 Sep, 2016

2 commits

  • Use the new pci_alloc_irq_vectors API to allocate MSI-X and MSI vectors.
    The big advantage over the old code is that we can use the same API for
    MSI and MSI-X, and that we don't need to store the MSI-X vector mapping
    in driver-private data structures.

    This first conversion keeps the probe order as-is: MSI-X multi vector,
    MSI multi vector, MSI single vector, MSI-X single vector and last a
    single least legacy interrupt line. There is one small change of
    behavior: we now check the "MSI Revert to Single Message" flag for
    MSI-X in addition to MSI.

    Because the API to find the Linux IRQ number for a MSI/MSI-X vector
    is PCI specific, but libahaci is bus-agnostic I had to a
    get_irq_vector function pointer to struct ahci_host_priv. The
    alternative would be to move the multi-vector case of ahci_host_activate
    to ahci.c and just call ata_host_activate directly from the others
    users of ahci_host_activate.

    Signed-off-by: Christoph Hellwig
    Signed-off-by: Tejun Heo

    Christoph Hellwig
     
  • Tejun Heo
     

12 Aug, 2016

2 commits


20 Jul, 2016

1 commit

  • Due to PCI subsystem behaviour, unloading AHCI driver will disable
    MSI and enable INTx. When HBA supports MSIx or Multiple MSI, Driver's
    irq handler doesn't clear GHC.IS register. It works well when reading or
    writing data and GHC.IS is always non-zero. But when unloading driver
    (or any other operation which causes disable MSIx and enable INTx), PCI
    subsystem uses config write(Rx04.bit10) to enable INTx. Because
    GHC.IS is non-zero, HBA will falsely assume some port needs interrupt
    service. Then it asserts INTx. To make things worse, when AHCI controller
    shares the same interrupt pin with other PCI device, that PCI device's ISR
    will be called and nobody de-asserts previous INTx.
    This patch clears GHC.IS in ahci_port_stop() even when using MSIx or
    MMSI to prevent this case. It ensures GHC.IS is zero before PCI subsystem
    enables INTx.

    tj: Minor updates to the comment.

    Signed-off-by: Raymond Pang
    Signed-off-by: Tejun Heo

    Pang Raymond
     

14 Jul, 2016

1 commit


14 May, 2016

1 commit


01 Apr, 2016

1 commit

  • In usecases where force_port_map is used saved_port_map is never set,
    resulting in not programming the PORTS_IMPL register as part of initial
    config. This patch fixes this by setting it to port_map even in case
    where force_port_map is used, making it more inline with other parts of
    the code.

    Fixes: 566d1827df2e ("libata: disable forced PORTS_IMPL for >= AHCI 1.3")
    Cc: stable@vger.kernel.org # v4.5+
    Signed-off-by: Srinivas Kandagatla
    Acked-by: Tejun Heo
    Reviewed-by: Andy Gross
    Signed-off-by: Tejun Heo

    Srinivas Kandagatla
     

31 Mar, 2016

1 commit


12 Mar, 2016

1 commit


01 Mar, 2016

1 commit

  • The HPCP bit is set by bioses for on-board sata ports either because
    they think sata is hotplug capable in general or to allow Windows
    to display a "device eject" icon on ports which are routed to an
    external connector bracket.

    However in Redhat Bugzilla #1310682, users report that with kernel 4.4,
    where this bit test first appeared, a lot of partitions on sata drives
    are now mounted automatically.

    This patch should fix redhat and a lot of other distros which
    unconditionally automount all devices which have the "removable"
    bit set.

    Signed-off-by: Manuel Lauss
    Signed-off-by: Tejun Heo
    Fixes: 8a3e33cf92c7 ("ata: ahci: find eSATA ports and flag them as removable" changes userspace behavior)
    Link: http://lkml.kernel.org/g/56CF35FA.1070500@redhat.com
    Cc: stable@vger.kernel.org #v4.4+

    Manuel Lauss
     

19 Feb, 2016

2 commits

  • Add new functions ahci_rpm_get_port()/ahci_rpm_put_port() that change
    runtime PM status of AHCI ports. Depending if the AHCI host has runtime PM
    enabled or disabled calling these may trigger runtime suspend/resume of the
    host controller.

    We also call these functions in appropriate places to make sure host
    controller registers are available before using them.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Tejun Heo

    Mika Westerberg
     
  • This allows sysfs nodes to read the cached value directly instead of
    powering up possibly runtime suspended controller.

    Signed-off-by: Mika Westerberg
    Signed-off-by: Tejun Heo

    Mika Westerberg
     

11 Feb, 2016

2 commits

  • The flexibility to override the irq handles in the LLD's are already
    present, so controllers implementing a edge trigger latch can
    implement their own interrupt handler inside the driver. This patch
    removes the AHCI_HFLAG_EDGE_IRQ support from libahci and moves edge
    irq handling to ahci_xgene.

    tj: Minor update to description.

    Signed-off-by: Suman Tripathi
    Signed-off-by: Tejun Heo

    Suman Tripathi
     
  • This patch implements the capability to override the generic AHCI
    interrupt handler so that specific ahci drivers can implement their
    own custom interrupt handler routines. It also exports
    ahci_handle_port_intr so that custom irq_handler implementations can
    use it.

    tj: s/ahci_irq_handler/irq_handler/ and updated description.

    Signed-off-by: Suman Tripathi
    Signed-off-by: Tejun Heo

    Suman Tripathi
     

26 Jan, 2016

2 commits

  • Some early controllers incorrectly reported zero ports in PORTS_IMPL
    register and the ahci driver fabricates PORTS_IMPL from the number of
    ports in those cases. This hasn't mattered but with the new nvme
    controllers there are cases where zero PORTS_IMPL is valid and should
    be honored.

    Disable the workaround for >= AHCI 1.3.

    Signed-off-by: Tejun Heo
    Reported-by: Andy Lutomirski
    Link: http://lkml.kernel.org/g/CALCETrU7yMvXEDhjAUShoHEhDwifJGapdw--BKxsP0jmjKGmRw@mail.gmail.com
    Cc: Sergei Shtylyov
    Cc: stable@vger.kernel.org

    Tejun Heo
     
  • The AHCI driver code stops and starts port DMA engines at will
    without considering the power state of the particular port. The
    AHCI specification isn't very clear on how to handle this scenario,
    leaving implementation open to interpretation.

    Broadcom's STB SATA host controller is unable to handle port DMA
    controller restarts when the port in question is in low power mode.
    When a port enters partial or slumber mode, its PHY is powered down.
    When a controller restart is requested, the controller's internal
    state machine expects the PHY to be brought back up by software which
    never happens in this case, resulting in failures.

    To avoid this situation, logic is added to manually wake up the port
    just before its DMA engine is stopped, if the port happens to be in
    a low power state. HBA initiated power management ensures that the port
    eventually returns to its configured low power state, when the link is
    idle (as per the conditions listed in the spec). A new host flag is also
    added to ensure this logic is only exercised for hosts with the above
    limitation.

    tj: Formatting changes.

    Signed-off-by: Danesh Petigara
    Reviewed-by: Markus Mayer
    Signed-off-by: Tejun Heo

    Danesh Petigara
     

12 Jan, 2016

1 commit

  • Pull libata updates from Tejun Heo:
    "Mostly low level driver specific changes.

    Two changes are somewhat noteworthy. First, Dan's patchset to support
    per-port msix interrupt handling for ahci, which was tried last cycle
    but had to be backed out due to a couple issues, is back and seems to
    be working fine. Second, libata exception handling now uses
    usleep_range() instead of msleep() for sleeps < 20ms which can make
    things snappier in some corner cases"

    * 'for-4.5' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    libata: skip debounce delay on link resume
    ata: ahci_brcmstb: disable DIPM support
    ata: ahci_brcmstb: enable support for ALPM
    drivers: libata-core: Use usleep_range() instead of msleep() for short sleeps ( interrupt handling
    ahci: per-port msix support

    Linus Torvalds