19 Mar, 2016

2 commits

  • Pull libata updates from Tejun Heo:

    - ahci grew runtime power management support so that the controller can
    be turned off if no devices are attached.

    - sata_via isn't dead yet. It got hotplug support and more refined
    workaround for certain WD drives.

    - Misc cleanups. There's a merge from for-4.5-fixes to avoid confusing
    conflicts in ahci PCI ID table.

    * 'for-4.6' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata:
    ata: ahci_xgene: dereferencing uninitialized pointer in probe
    AHCI: Remove obsolete Intel Lewisburg SATA RAID device IDs
    ata: sata_rcar: Use ARCH_RENESAS
    sata_via: Implement hotplug for VT6421
    sata_via: Apply WD workaround only when needed on VT6421
    ahci: Add runtime PM support for the host controller
    ahci: Add functions to manage runtime PM of AHCI ports
    ahci: Convert driver to use modern PM hooks
    ahci: Cache host controller version
    scsi: Drop runtime PM usage count after host is added
    scsi: Set request queue runtime PM status back to active on resume
    block: Add blk_set_runtime_active()
    ata: ahci_mvebu: add support for Armada 3700 variant
    libata: fix unbalanced spin_lock_irqsave/spin_unlock_irq() in ata_scsi_park_show()
    libata: support AHCI on OCTEON platform

    Linus Torvalds
     
  • Merge second patch-bomb from Andrew Morton:

    - a couple of hotfixes

    - the rest of MM

    - a new timer slack control in procfs

    - a couple of procfs fixes

    - a few misc things

    - some printk tweaks

    - lib/ updates, notably to radix-tree.

    - add my and Nick Piggin's old userspace radix-tree test harness to
    tools/testing/radix-tree/. Matthew said it was a godsend during the
    radix-tree work he did.

    - a few code-size improvements, switching to __always_inline where gcc
    screwed up.

    - partially implement character sets in sscanf

    * emailed patches from Andrew Morton : (118 commits)
    sscanf: implement basic character sets
    lib/bug.c: use common WARN helper
    param: convert some "on"/"off" users to strtobool
    lib: add "on"/"off" support to kstrtobool
    lib: update single-char callers of strtobool()
    lib: move strtobool() to kstrtobool()
    include/linux/unaligned: force inlining of byteswap operations
    include/uapi/linux/byteorder, swab: force inlining of some byteswap operations
    include/asm-generic/atomic-long.h: force inlining of some atomic_long operations
    usb: common: convert to use match_string() helper
    ide: hpt366: convert to use match_string() helper
    ata: hpt366: convert to use match_string() helper
    power: ab8500: convert to use match_string() helper
    power: charger_manager: convert to use match_string() helper
    drm/edid: convert to use match_string() helper
    pinctrl: convert to use match_string() helper
    device property: convert to use match_string() helper
    lib/string: introduce match_string() helper
    radix-tree tests: add test for radix_tree_iter_next
    radix-tree tests: add regression3 test
    ...

    Linus Torvalds
     

18 Mar, 2016

2 commits

  • Pull GPIO updates from Linus Walleij:
    "This is the bulk of GPIO changes for kernel v4.6. There is quite a
    lot of interesting stuff going on.

    The patches to other subsystems and arch-wide are ACKed as far as
    possible, though I consider things like per-arch as
    essentially a part of the GPIO subsystem so it should not be needed.

    Core changes:

    - The gpio_chip is now a *real device*. Until now the gpio chips
    were just piggybacking the parent device or (gasp) floating in
    space outside of the device model.

    We now finally make GPIO chips devices. The gpio_chip will create
    a gpio_device which contains a struct device, and this gpio_device
    struct is kept private. Anything that needs to be kept private
    from the rest of the kernel will gradually be moved over to the
    gpio_device.

    - As a result of making the gpio_device a real device, we have added
    resource management, so devm_gpiochip_add_data() will cut down on
    overhead and reduce code lines. A huge slew of patches convert
    almost all drivers in the subsystem to use this.

    - Building on making the GPIO a real device, we add the first step of
    a new userspace ABI: the GPIO character device. We take small
    steps here, so we first add a pure *information* ABI and the tool
    "lsgpio" that will list all GPIO devices on the system and all
    lines on these devices.

    We can now discover GPIOs properly from userspace. We still have
    not come up with a way to actually *use* GPIOs from userspace.

    - To encourage people to use the character device for the future, we
    have it always-enabled when using GPIO. The old sysfs ABI is still
    opt-in (and can be used in parallel), but is marked as deprecated.

    We will keep it around for the foreseeable future, but it will not
    be extended to cover ever more use cases.

    Cleanup:

    - Bjorn Helgaas removed a whole slew of per-architecture
    includes.

    This dates back to when GPIO was an opt-in feature and no shared
    library even existed: just a header file with proper prototypes was
    provided and all semantics were up to the arch to implement. These
    patches make the GPIO chip even more a proper device and cleans out
    leftovers of the old in-kernel API here and there.

    Still some cruft is left but it's very little now.

    - There is still some clamping of return values for .get() going on,
    but we now return sane values in the vast majority of drivers and
    the errorpath is sanitized. Some patches for powerpc, blackfin and
    unicore still drop in.

    - We continue to switch the ARM, MIPS, blackfin, m68k local GPIO
    implementations to use gpiochip_add_data() and cut down on code
    lines.

    - MPC8xxx is converted to use the generic GPIO helpers.

    - ATH79 is converted to use the generic GPIO helpers.

    New drivers:

    - WinSystems WS16C48

    - Acces 104-DIO-48E

    - F81866 (a F7188x variant)

    - Qoric (a MPC8xxx variant)

    - TS-4800

    - SPI serializers (pisosr): simple 74xx shift registers connected to
    SPI to obtain a dirt-cheap output-only GPIO expander.

    - Texas Instruments TPIC2810

    - Texas Instruments TPS65218

    - Texas Instruments TPS65912

    - X-Gene (ARM64) standby GPIO controller"

    * tag 'gpio-v4.6-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (194 commits)
    Revert "Share upstreaming patches"
    gpio: mcp23s08: Fix clearing of interrupt.
    gpiolib: Fix comment referring to gpio_*() in gpiod_*()
    gpio: pca953x: Fix pca953x_gpio_set_multiple() on 64-bit
    gpio: xgene: Fix kconfig for standby GIPO contoller
    gpio: Add generic serializer DT binding
    gpio: uapi: use 0xB4 as ioctl() major
    gpio: tps65912: fix bad merge
    Revert "gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free"
    gpio: omap: drop dev field from gpio_bank structure
    gpio: mpc8xxx: Slightly update the code for better readability
    gpio: mpc8xxx: Remove *read_reg and *write_reg from struct mpc8xxx_gpio_chip
    gpio: mpc8xxx: Fixup setting gpio direction output
    gpio: mcp23s08: Add support for mcp23s18
    dt-bindings: gpio: altera: Fix altr,interrupt-type property
    gpio: add driver for MEN 16Z127 GPIO controller
    gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free
    gpio: timberdale: Switch to devm_ioremap_resource()
    gpio: ts4800: Add IMX51 dependency
    gpiolib: rewrite gpiodev_add_to_list
    ...

    Linus Torvalds
     
  • The new helper returns index of the mathing string in an array. We
    would use it here.

    Signed-off-by: Andy Shevchenko
    Acked-by: Tejun Heo
    Cc: Bartlomiej Zolnierkiewicz
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Andy Shevchenko
     

17 Mar, 2016

1 commit

  • Pull PCI updates from Bjorn Helgaas:
    "PCI changes for v4.6:

    Enumeration:
    - Disable IO/MEM decoding for devices with non-compliant BARs (Bjorn Helgaas)
    - Mark Broadwell-EP Home Agent & PCU as having non-compliant BARs (Bjorn Helgaas

    Resource management:
    - Mark shadow copy of VGA ROM as IORESOURCE_PCI_FIXED (Bjorn Helgaas)
    - Don't assign or reassign immutable resources (Bjorn Helgaas)
    - Don't enable/disable ROM BAR if we're using a RAM shadow copy (Bjorn Helgaas)
    - Set ROM shadow location in arch code, not in PCI core (Bjorn Helgaas)
    - Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs (Bjorn Helgaas)
    - ia64: Use ioremap() instead of open-coded equivalent (Bjorn Helgaas)
    - ia64: Keep CPU physical (not virtual) addresses in shadow ROM resource (Bjorn Helgaas)
    - MIPS: Keep CPU physical (not virtual) addresses in shadow ROM resource (Bjorn Helgaas)
    - Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY (Bjorn Helgaas)
    - Don't leak memory if sysfs_create_bin_file() fails (Bjorn Helgaas)
    - rcar: Remove PCI_PROBE_ONLY handling (Lorenzo Pieralisi)
    - designware: Remove PCI_PROBE_ONLY handling (Lorenzo Pieralisi)

    Virtualization:
    - Wait for up to 1000ms after FLR reset (Alex Williamson)
    - Support SR-IOV on any function type (Kelly Zytaruk)
    - Add ACS quirk for all Cavium devices (Manish Jaggi)

    AER:
    - Rename pci_ops_aer to aer_inj_pci_ops (Bjorn Helgaas)
    - Restore pci_ops pointer while calling original pci_ops (David Daney)
    - Fix aer_inject error codes (Jean Delvare)
    - Use dev_warn() in aer_inject (Jean Delvare)
    - Log actual error causes in aer_inject (Jean Delvare)
    - Log aer_inject error injections (Jean Delvare)

    VPD:
    - Prevent VPD access for buggy devices (Babu Moger)
    - Move pci_read_vpd() and pci_write_vpd() close to other VPD code (Bjorn Helgaas)
    - Move pci_vpd_release() from header file to pci/access.c (Bjorn Helgaas)
    - Remove struct pci_vpd_ops.release function pointer (Bjorn Helgaas)
    - Rename VPD symbols to remove unnecessary "pci22" (Bjorn Helgaas)
    - Fold struct pci_vpd_pci22 into struct pci_vpd (Bjorn Helgaas)
    - Sleep rather than busy-wait for VPD access completion (Bjorn Helgaas)
    - Update VPD definitions (Hannes Reinecke)
    - Allow access to VPD attributes with size 0 (Hannes Reinecke)
    - Determine actual VPD size on first access (Hannes Reinecke)

    Generic host bridge driver:
    - Move structure definitions to separate header file (David Daney)
    - Add pci_host_common_probe(), based on gen_pci_probe() (David Daney)
    - Expose pci_host_common_probe() for use by other drivers (David Daney)

    Altera host bridge driver:
    - Fix altera_pcie_link_is_up() (Ley Foon Tan)

    Cavium ThunderX host bridge driver:
    - Add PCIe host driver for ThunderX processors (David Daney)
    - Add driver for ThunderX-pass{1,2} on-chip devices (David Daney)

    Freescale i.MX6 host bridge driver:
    - Add DT bindings to configure PHY Tx driver settings (Justin Waters)
    - Move imx6_pcie_reset_phy() near other PHY handling functions (Lucas Stach)
    - Move PHY reset into imx6_pcie_establish_link() (Lucas Stach)
    - Remove broken Gen2 workaround (Lucas Stach)
    - Move link up check into imx6_pcie_wait_for_link() (Lucas Stach)

    Freescale Layerscape host bridge driver:
    - Add "fsl,ls2085a-pcie" compatible ID (Yang Shi)

    Intel VMD host bridge driver:
    - Attach VMD resources to parent domain's resource tree (Jon Derrick)
    - Set bus resource start to 0 (Keith Busch)

    Microsoft Hyper-V host bridge driver:
    - Add fwnode_handle to x86 pci_sysdata (Jake Oshins)
    - Look up IRQ domain by fwnode_handle (Jake Oshins)
    - Add paravirtual PCI front-end for Microsoft Hyper-V VMs (Jake Oshins)

    NVIDIA Tegra host bridge driver:
    - Add pci_ops.{add,remove}_bus() callbacks (Thierry Reding)
    - Implement ->{add,remove}_bus() callbacks (Thierry Reding)
    - Remove unused struct tegra_pcie.num_ports field (Thierry Reding)
    - Track bus -> CPU mapping (Thierry Reding)
    - Remove misleading PHYS_OFFSET (Thierry Reding)

    Renesas R-Car host bridge driver:
    - Depend on ARCH_RENESAS, not ARCH_SHMOBILE (Simon Horman)

    Synopsys DesignWare host bridge driver:
    - ARC: Add PCI support (Joao Pinto)
    - Add generic dw_pcie_wait_for_link() (Joao Pinto)
    - Add default link up check if sub-driver doesn't override (Joao Pinto)
    - Add driver for prototyping kits based on ARC SDP (Joao Pinto)

    TI Keystone host bridge driver:
    - Defer probing if devm_phy_get() returns -EPROBE_DEFER (Shawn Lin)

    Xilinx AXI host bridge driver:
    - Use of_pci_get_host_bridge_resources() to parse DT (Bharat Kumar Gogada)
    - Remove dependency on ARM-specific struct hw_pci (Bharat Kumar Gogada)
    - Don't call pci_fixup_irqs() on Microblaze (Bharat Kumar Gogada)
    - Update Zynq binding with Microblaze node (Bharat Kumar Gogada)
    - microblaze: Support generic Xilinx AXI PCIe Host Bridge IP driver (Bharat Kumar Gogada)

    Xilinx NWL host bridge driver:
    - Add support for Xilinx NWL PCIe Host Controller (Bharat Kumar Gogada)

    Miscellaneous:
    - Check device_attach() return value always (Bjorn Helgaas)
    - Move pci_set_flags() from asm-generic/pci-bridge.h to linux/pci.h (Bjorn Helgaas)
    - Remove includes of empty asm-generic/pci-bridge.h (Bjorn Helgaas)
    - ARM64: Remove generated include of asm-generic/pci-bridge.h (Bjorn Helgaas)
    - Remove empty asm-generic/pci-bridge.h (Bjorn Helgaas)
    - Remove includes of asm/pci-bridge.h (Bjorn Helgaas)
    - Consolidate PCI DMA constants and interfaces in linux/pci-dma-compat.h (Bjorn Helgaas)
    - unicore32: Remove unused HAVE_ARCH_PCI_SET_DMA_MASK definition (Bjorn Helgaas)
    - Cleanup pci/pcie/Kconfig whitespace (Andreas Ziegler)
    - Include pci/hotplug Kconfig directly from pci/Kconfig (Bjorn Helgaas)
    - Include pci/pcie/Kconfig directly from pci/Kconfig (Bogicevic Sasa)
    - frv: Remove stray pci_{alloc,free}_consistent() declaration (Christoph Hellwig)
    - Move pci_dma_* helpers to common code (Christoph Hellwig)
    - Add PCI_CLASS_SERIAL_USB_DEVICE definition (Heikki Krogerus)
    - Add QEMU top-level IDs for (sub)vendor & device (Robin H. Johnson)
    - Fix broken URL for Dell biosdevname (Naga Venkata Sai Indubhaskar Jupudi)"

    * tag 'pci-v4.6-changes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci: (94 commits)
    PCI: Add PCI_CLASS_SERIAL_USB_DEVICE definition
    PCI: designware: Add driver for prototyping kits based on ARC SDP
    PCI: designware: Add default link up check if sub-driver doesn't override
    PCI: designware: Add generic dw_pcie_wait_for_link()
    PCI: Cleanup pci/pcie/Kconfig whitespace
    PCI: Simplify pci_create_attr() control flow
    PCI: Don't leak memory if sysfs_create_bin_file() fails
    PCI: Simplify sysfs ROM cleanup
    PCI: Remove unused IORESOURCE_ROM_COPY and IORESOURCE_ROM_BIOS_COPY
    MIPS: Loongson 3: Keep CPU physical (not virtual) addresses in shadow ROM resource
    MIPS: Loongson 3: Use temporary struct resource * to avoid repetition
    ia64/PCI: Keep CPU physical (not virtual) addresses in shadow ROM resource
    ia64/PCI: Use ioremap() instead of open-coded equivalent
    ia64/PCI: Use temporary struct resource * to avoid repetition
    PCI: Clean up pci_map_rom() whitespace
    PCI: Remove arch-specific IORESOURCE_ROM_SHADOW size from sysfs
    PCI: thunder: Add driver for ThunderX-pass{1,2} on-chip devices
    PCI: thunder: Add PCIe host driver for ThunderX processors
    PCI: generic: Expose pci_host_common_probe() for use by other drivers
    PCI: generic: Add pci_host_common_probe(), based on gen_pci_probe()
    ...

    Linus Torvalds
     

12 Mar, 2016

3 commits


04 Mar, 2016

1 commit

  • Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

    This is part of an ongoing process to migrate from ARCH_SHMOBILE to
    ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
    appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

    Signed-off-by: Simon Horman
    Signed-off-by: Tejun Heo
    Acked-by: Geert Uytterhoeven

    Simon Horman
     

01 Mar, 2016

2 commits

  • 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
     
  • Due to Errata in ThunderX, HOST_IRQ_STAT should be
    cleared before leaving the interrupt handler.
    The patch attempts to satisfy the need.

    Changes from V2:
    - removed newfile
    - code is now under CONFIG_ARM64

    Changes from V1:
    - Rebased on top of libata/for-4.6
    - Moved ThunderX intr handler to new file

    tj: Minor adjustments to comments.

    Signed-off-by: Tirumalesh Chalamarla
    Signed-off-by: Tejun Heo

    Tirumalesh Chalamarla
     

26 Feb, 2016

2 commits

  • Enable IRQ on hotplug and add an interrupt handler to handle it.

    This allows hotplug to work:
    ata5: exception Emask 0x10 SAct 0x0 SErr 0x70000 action 0xe frozen
    ata5: SError: { PHYRdyChg PHYInt CommWake }
    ata5: hard resetting link
    ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
    ata5.00: LPM support broken, forcing max_power
    ata5.00: ATA-7: WDC WD800JD-75MSA3, 10.01E04, max UDMA/133
    ata5.00: 156250000 sectors, multi 0: LBA48 NCQ (depth 0/32)
    ata5.00: LPM support broken, forcing max_power
    ata5.00: configured for UDMA/133
    ata5: EH complete
    scsi 4:0:0:0: Direct-Access ATA WDC WD800JD-75MS 1E04 PQ: 0 ANSI: 5
    sd 4:0:0:0: [sdb] 156250000 512-byte logical blocks: (80.0 GB/74.5 GiB)
    sd 4:0:0:0: [sdb] Write Protect is off
    sd 4:0:0:0: [sdb] Mode Sense: 00 3a 00 00
    sd 4:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
    sd 4:0:0:0: Attached scsi generic sg1 type 0
    sd 4:0:0:0: [sdb] Attached SCSI disk

    And also hot unplug:
    ata5: exception Emask 0x10 SAct 0x0 SErr 0x1b0000 action 0xe frozen
    ata5: SError: { PHYRdyChg PHYInt 10B8B Dispar }
    ata5: hard resetting link
    ata5: SATA link down (SStatus 0 SControl 310)
    ata5: hard resetting link
    ata5: SATA link down (SStatus 0 SControl 310)
    ata5: hard resetting link
    ata5: SATA link down (SStatus 0 SControl 310)
    ata5.00: disabled
    ata5: EH complete
    ata5.00: detaching (SCSI 4:0:0:0)
    sd 4:0:0:0: [sdb] Synchronizing SCSI cache
    sd 4:0:0:0: [sdb] Synchronize Cache(10) failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK
    sd 4:0:0:0: [sdb] Stopping disk
    sd 4:0:0:0: [sdb] Start/Stop Unit failed: Result: hostbyte=DID_BAD_TARGET driverbyte=DRIVER_OK

    Signed-off-by: Ondrej Zary
    Signed-off-by: Tejun Heo

    Ondrej Zary
     
  • Currently, workaround for broken WD drives is applied always, slowing
    down all drives. And it has a bug - it's not applied after resume.

    Apply the workaround only if the error really appears
    (SErr == 0x1000500). This allows unaffected drives to run at full speed
    (provided that no affected drive is connected to the controller).
    Also make sure the workaround is re-applied on resume.

    Tested on VT6421.
    As SCR registers access is known to cause problems on VT6420 (and I
    don't have it to test), keep the workaround applied always on VT6420.

    Unaffected drive (Hitachi HDS721680PLA380):
    Before:
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
    Timing O_DIRECT disk reads: 160 MB in 3.01 seconds = 53.16 MB/sec

    After:
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
    Timing O_DIRECT disk reads: 200 MB in 3.01 seconds = 66.47 MB/sec

    Affected drive (WDC WD5003ABYX-18WERA0):
    Before:
    $ hdparm -t --direct /dev/sda

    /dev/sda:
    Timing O_DIRECT disk reads: 180 MB in 3.02 seconds = 59.51 MB/sec

    After:
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
    Timing O_DIRECT disk reads: 156 MB in 3.03 seconds = 51.48 MB/sec
    $ hdparm -t --direct /dev/sdb
    /dev/sdb:
    Timing O_DIRECT disk reads: 180 MB in 3.02 seconds = 59.64 MB/sec

    The first hdparm is slower because of the error:
    [ 50.408042] ata5: Incompatible drive: enabling workaround. This slows down transfer rate to ~60 MB/s
    [ 50.728052] ata5: SATA link up 1.5 Gbps (SStatus 113 SControl 310)
    [ 50.744834] ata5.00: configured for UDMA/133

    Signed-off-by: Ondrej Zary
    Signed-off-by: Tejun Heo

    Ondrej Zary
     

19 Feb, 2016

8 commits

  • This patch adds runtime PM support for the AHCI host controller driver so
    that the host controller is powered down when all SATA ports are runtime
    suspended. Powering down the AHCI host controller can reduce power
    consumption and possibly allow the CPU to enter lower power idle states
    (S0ix) during runtime.

    Runtime PM is blocked by default and needs to be unblocked from userspace
    as needed (via power/* sysfs nodes).

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

    Mika Westerberg
     
  • 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
     
  • In order to add support for runtime PM to the ahci driver we first need to
    convert the driver to use modern non-legacy system suspend hooks. There
    should be no functional changes.

    tj: Updated .driver.pm init for older compilers as suggested by Andy
    and Chrsitoph.

    Signed-off-by: Mika Westerberg
    Cc: Andy Shevchenko
    Cc: Christoph Hellwig
    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
     
  • The main difference in the new Armada 3700 is that no address
    decoding needs to take place in the driver probe.

    [gregory.clement@free-electrons.com: reformulate the commit log]

    Signed-off-by: Lior Amsalem
    Reviewed-by: Nadav Haklai
    Tested-by: Nadav Haklai
    Signed-off-by: Gregory CLEMENT
    Signed-off-by: Tejun Heo

    Lior Amsalem
     
  • ata_scsi_park_show() was pairing spin_lock_irqsave() with
    spin_unlock_irq(). As the function is always called with irq enabled,
    it didn't actually break anything. Use spin_lock_irq() instead.

    Signed-off-by: Tejun Heo
    Reported-by: Dan Carpenter
    Cc: Elias Oltmanns

    Tejun Heo
     
  • This patch complements the list of device IDs previously
    added for lewisburg sata.

    Signed-off-by: Alexandra Yates
    Signed-off-by: Tejun Heo
    Cc: stable@vger.kernel.org

    Alexandra Yates
     
  • The RB532 platform specific irq_to_gpio() implementation has been
    removed with commit 832f5dacfa0b ("MIPS: Remove all the uses of
    custom gpio.h"). Now the platform uses the generic stub which causes
    the following error:

    pata-rb532-cf pata-rb532-cf: no GPIO found for irq149
    pata-rb532-cf: probe of pata-rb532-cf failed with error -2

    Drop the irq_to_gpio() call and get the GPIO number from platform
    data instead. After this change, the driver works again:

    scsi host0: pata-rb532-cf
    ata1: PATA max PIO4 irq 149
    ata1.00: CFA: CF 1GB, 20080820, max MWDMA4
    ata1.00: 1989792 sectors, multi 0: LBA
    ata1.00: configured for PIO4
    scsi 0:0:0:0: Direct-Access ATA CF 1GB 0820 PQ: 0\
    ANSI: 5
    sd 0:0:0:0: [sda] 1989792 512-byte logical blocks: (1.01 GB/971 MiB)
    sd 0:0:0:0: [sda] Write Protect is off
    sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't\
    support DPO or FUA
    sda: sda1 sda2
    sd 0:0:0:0: [sda] Attached SCSI disk

    Fixes: 832f5dacfa0b ("MIPS: Remove all the uses of custom gpio.h")
    Cc: Alban Bedel
    Cc: Ralf Baechle
    Cc: Arnd Bergmann
    Cc: #v4.3+
    Signed-off-by: Gabor Juhos
    Signed-off-by: Tejun Heo

    Gabor Juhos
     

16 Feb, 2016

1 commit

  • Most arches have an asm/gpio.h that merely includes linux/gpio.h. The
    others select ARCH_HAVE_CUSTOM_GPIO_H, and when that's selected,
    linux/gpio.h includes asm/gpio.h.

    Therefore, code should include linux/gpio.h instead of including asm/gpio.h
    directly.

    Remove includes of asm/gpio.h, adding an include of linux/gpio.h when
    necessary.

    This is a follow-on to 7563bbf89d06 ("gpiolib/arches: Centralise
    bolierplate asm/gpio.h").

    Signed-off-by: Bjorn Helgaas
    Acked-by: Thomas Gleixner
    Acked-by: Arnd Bergmann
    Acked-by: Alexandre Courbot
    Signed-off-by: Linus Walleij

    Bjorn Helgaas
     

11 Feb, 2016

6 commits

  • The OCTEON SATA controller is currently found on cn71XX devices.

    Acked-by: Arnd Bergmann
    Acked-by: Hans de Goede
    Acked-by: Rob Herring
    Signed-off-by: David Daney
    Signed-off-by: Vinita Gupta
    Signed-off-by: Aleksey Makarov
    Signed-off-by: Zubair Lutfullah Kakakhel
    Signed-off-by: Tejun Heo

    Aleksey Makarov
     
  • As reported by Soohoon Lee, the HDIO_GET_32BIT ioctl does not
    work correctly in compat mode with libata.

    I have investigated the issue further and found multiple problems
    that all appeared with the same commit that originally introduced
    HDIO_GET_32BIT handling in libata back in linux-2.6.8 and presumably
    also linux-2.4, as the code uses "copy_to_user(arg, &val, 1)" to copy
    a 'long' variable containing either 0 or 1 to user space.

    The problems with this are:

    * On big-endian machines, this will always write a zero because it
    stores the wrong byte into user space.

    * In compat mode, the upper three bytes of the variable are updated
    by the compat_hdio_ioctl() function, but they now contain
    uninitialized stack data.

    * The hdparm tool calling this ioctl uses a 'static long' variable
    to store the result. This means at least the upper bytes are
    initialized to zero, but calling another ioctl like HDIO_GET_MULTCOUNT
    would fill them with data that remains stale when the low byte
    is overwritten. Fortunately libata doesn't implement any of the
    affected ioctl commands, so this would only happen when we query
    both an IDE and an ATA device in the same command such as
    "hdparm -N -c /dev/hda /dev/sda"

    * The libata code for unknown reasons started using ATA_IOC_GET_IO32
    and ATA_IOC_SET_IO32 as aliases for HDIO_GET_32BIT and HDIO_SET_32BIT,
    while the ioctl commands that were added later use the normal
    HDIO_* names. This is harmless but rather confusing.

    This addresses all four issues by changing the code to use put_user()
    on an 'unsigned long' variable in HDIO_GET_32BIT, like the IDE subsystem
    does, and by clarifying the names of the ioctl commands.

    Signed-off-by: Arnd Bergmann
    Reported-by: Soohoon Lee
    Tested-by: Soohoon Lee
    Cc: stable@vger.kernel.org
    Signed-off-by: Tejun Heo

    Arnd Bergmann
     
  • Due to H/W errata, the HOST_IRQ_STAT register misses the edge interrupt
    when clearing the HOST_IRQ_STAT register and hardware reporting the
    PORT_IRQ_STAT register happens to be at the same clock cycle.

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

    Suman Tripathi
     
  • 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
     
  • Adding Intel codename DNV platform device IDs for SATA.

    Signed-off-by: Alexandra Yates
    Signed-off-by: Tejun Heo
    Cc: stable@vger.kernel.org

    Alexandra Yates
     

06 Feb, 2016

1 commit

  • Drivers should include asm/pci-bridge.h only when they need the arch-
    specific things provided there. Outside of the arch/ directories, the only
    drivers that actually need things provided by asm/pci-bridge.h are the
    powerpc RPA hotplug drivers in drivers/pci/hotplug/rpa*.

    Remove the includes of asm/pci-bridge.h from the other drivers, adding an
    include of linux/pci.h if necessary.

    Signed-off-by: Bjorn Helgaas

    Bjorn Helgaas
     

02 Feb, 2016

1 commit

  • The bulk of ATA host state machine is implemented by
    ata_sff_hsm_move(). The function is called from either the interrupt
    handler or, if polling, a work item. Unlike from the interrupt path,
    the polling path calls the function without holding the host lock and
    ata_sff_hsm_move() selectively grabs the lock.

    This is completely broken. If an IRQ triggers while polling is in
    progress, the two can easily race and end up accessing the hardware
    and updating state machine state at the same time. This can put the
    state machine in an illegal state and lead to a crash like the
    following.

    kernel BUG at drivers/ata/libata-sff.c:1302!
    invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN
    Modules linked in:
    CPU: 1 PID: 10679 Comm: syz-executor Not tainted 4.5.0-rc1+ #300
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    task: ffff88002bd00000 ti: ffff88002e048000 task.ti: ffff88002e048000
    RIP: 0010:[] [] ata_sff_hsm_move+0x619/0x1c60
    ...
    Call Trace:

    [] __ata_sff_port_intr+0x1e1/0x3a0 drivers/ata/libata-sff.c:1584
    [] ata_bmdma_port_intr+0x71/0x400 drivers/ata/libata-sff.c:2877
    [< inline >] __ata_sff_interrupt drivers/ata/libata-sff.c:1629
    [] ata_bmdma_interrupt+0x253/0x580 drivers/ata/libata-sff.c:2902
    [] handle_irq_event_percpu+0x108/0x7e0 kernel/irq/handle.c:157
    [] handle_irq_event+0xa7/0x140 kernel/irq/handle.c:205
    [] handle_edge_irq+0x1e3/0x8d0 kernel/irq/chip.c:623
    [< inline >] generic_handle_irq_desc include/linux/irqdesc.h:146
    [] handle_irq+0x10c/0x2a0 arch/x86/kernel/irq_64.c:78
    [] do_IRQ+0x7d/0x1a0 arch/x86/kernel/irq.c:240
    [] common_interrupt+0x8c/0x8c arch/x86/entry/entry_64.S:520

    [< inline >] rcu_lock_acquire include/linux/rcupdate.h:490
    [< inline >] rcu_read_lock include/linux/rcupdate.h:874
    [] filemap_map_pages+0x131/0xba0 mm/filemap.c:2145
    [< inline >] do_fault_around mm/memory.c:2943
    [< inline >] do_read_fault mm/memory.c:2962
    [< inline >] do_fault mm/memory.c:3133
    [< inline >] handle_pte_fault mm/memory.c:3308
    [< inline >] __handle_mm_fault mm/memory.c:3418
    [] handle_mm_fault+0x2516/0x49a0 mm/memory.c:3447
    [] __do_page_fault+0x376/0x960 arch/x86/mm/fault.c:1238
    [] trace_do_page_fault+0xe8/0x420 arch/x86/mm/fault.c:1331
    [] do_async_page_fault+0x14/0xd0 arch/x86/kernel/kvm.c:264
    [] async_page_fault+0x28/0x30 arch/x86/entry/entry_64.S:986

    Fix it by ensuring that the polling path is holding the host lock
    before entering ata_sff_hsm_move() so that all hardware accesses and
    state updates are performed under the host lock.

    Signed-off-by: Tejun Heo
    Reported-and-tested-by: Dmitry Vyukov
    Link: http://lkml.kernel.org/g/CACT4Y+b_JsOxJu2EZyEf+mOXORc_zid5V1-pLZSroJVxyWdSpw@mail.gmail.com
    Cc: stable@vger.kernel.org

    Tejun Heo
     

29 Jan, 2016

1 commit

  • ata_sff_hsm_move() triggers BUG if it sees a host state machine state
    that it dind't expect. The risk for data corruption when the
    condition occurs is low as it's highly unlikely that it would lead to
    spurious completion of commands. The BUG occasionally triggered for
    subtle race conditions in the driver. Let's downgrade it to WARN so
    that it doesn't kill the machine unnecessarily.

    Signed-off-by: Tejun Heo
    Cc: Dmitry Vyukov

    Tejun Heo
     

26 Jan, 2016

3 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
     
  • Viking flash model VRFDFC22048UCHC-TE causes data corruption in MWDMA mode.

    Cc: xe-kernel@external.cisco.com
    Signed-off-by: Shikha Jain
    Signed-off-by: Anil Veliyankara Madam
    Signed-off-by: Tejun Heo

    Shikha Jain
     
  • 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
     

09 Jan, 2016

3 commits

  • The link resume logic uses a 200msec delay while debouncing
    the SControl register. The rationale behind that delay is
    to accommodate some PHYs that behave badly if their SStatus/
    SControl registers are pounded immediately on resume.
    The Broadcom STB SATA PHY does not seem to have this issue.
    This patch introduces a new link flag that allows platforms
    to skip the debounce delay if it isn't needed.

    Signed-off-by: Danesh Petigara
    Signed-off-by: Florian Fainelli
    Signed-off-by: Tejun Heo

    Danesh Petigara
     
  • The Broadcom STB SATA host controller does not support device
    initiated power management. Disable support for this feature
    so the driver never sends SETFEATURES commands to the device
    to enable/disable DIPM.

    Signed-off-by: Danesh Petigara
    Signed-off-by: Florian Fainelli
    Signed-off-by: Tejun Heo

    Danesh Petigara
     
  • Enable support for ALPM in the host controller's capabilities
    register. Also adjust the PLL timeout to give it enough time
    to lock when the port exits slumber mode.

    tj: minor style updates

    Signed-off-by: Danesh Petigara
    Signed-off-by: Florian Fainelli
    Signed-off-by: Tejun Heo

    Danesh Petigara
     

08 Jan, 2016

1 commit

  • Since msleep() may sleep longer than intended time for values less
    than 20ms, this patch allows the use of usleep_range for waits less
    that 20ms. usleep_range is a finer precision implementation of
    msleep and is designed to be a drop-in replacement for udelay
    where a precise sleep/busy-wait is unnecessary.

    More details can be found at http://lkml.org/lkml/2007/8/3/250
    and in Documentation/timers/timers-howto.txt.

    This change has been done to improve the performace in PIO6 mode
    which is used by viking flash.

    Cc: xe-kernel@external.cisco.com
    Signed-off-by: Anil Veliyankara Madam
    Signed-off-by: Shikha Jain
    Signed-off-by: Tejun Heo

    Anil Veliyankara Madam
     

01 Jan, 2016

1 commit