08 Jan, 2013

14 commits

  • Do DMA unmap on ->device_prep_dma_memcpy failure.

    Cc: Dan Williams
    Cc: Tomasz Figa
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Bartlomiej Zolnierkiewicz
     
  • Use memchr_inv() to check the specified page is filled with zero.

    Signed-off-by: Akinobu Mita
    Cc: Vinod Koul
    Cc: Dan Williams
    Signed-off-by: Vinod Koul

    Akinobu Mita
     
  • dev_ calls take less code than dev_printk(KERN_
    and reducing object size is good.
    Coalesce formats for easier grep.

    Signed-off-by: Joe Perches
    Signed-off-by: Vinod Koul

    Joe Perches
     
  • DMA Engine test module has module parameters to set the number of source
    buffers for xor and pq operations. We can set these values larger than the
    maximum number of sources that the device can support. These values are
    not adjusted and the unsupported number of source buffers are passed to the
    device. But most drivers don't check it, so unexpected results will happen.

    This makes an appropriate adjustment for these module parameters before use.

    Signed-off-by: Akinobu Mita
    Cc: Vinod Koul
    Cc: Dan Williams
    Signed-off-by: Vinod Koul

    Akinobu Mita
     
  • vchan_dma_desc_free_list() iterates through each virt_dma_desc in the
    specified list_head and calls vchan->desc_free().

    We can use it instead of repeated execution of pl08x_desc_free() for each
    virt_dma_desc in the list_head. Because vchan->desc_free callback is set
    as pl08x_desc_free() for amba-pl08x driver.

    Signed-off-by: Akinobu Mita
    Cc: Vinod Koul
    Cc: Dan Williams
    Signed-off-by: Vinod Koul

    Akinobu Mita
     
  • Use for_each_set_bit() to implement for_each_dma_cap_mask() and
    remove unused first_dma_cap() and next_dma_cap().

    Signed-off-by: Akinobu Mita
    Cc: Vinod Koul
    Cc: Dan Williams
    Acked-by: Linus Walleij
    Signed-off-by: Vinod Koul

    Akinobu Mita
     
  • The to_dw_desc() macro helps to retrieve the dw_desc node from the
    corresponding list_head structure.

    Signed-off-by: Andy Shevchenko
    Acked-by: Viresh Kumar
    Reviewed-by: Felipe Balbi
    Signed-off-by: Vinod Koul

    Andy Shevchenko
     
  • In case of handling a bad descriptor the dwc_handle_error() will dump a stack
    as well. It's a lot more verbose and more likely to get user's attention.

    Signed-off-by: Andy Shevchenko
    Acked-by: Viresh Kumar
    Reviewed-by: Felipe Balbi
    Signed-off-by: Vinod Koul

    Andy Shevchenko
     
  • There is no need to call platform_get_drvdata twice as we have it already in dw
    variable.

    Signed-off-by: Andy Shevchenko
    Acked-by: Viresh Kumar
    Reviewed-by: Felipe Balbi
    Signed-off-by: Vinod Koul

    Andy Shevchenko
     
  • Change printk(KERN_INFO ..., dev_name(...), ...) to dev_info() as well.

    Signed-off-by: Andy Shevchenko
    Acked-by: Viresh Kumar
    Reviewed-by: Felipe Balbi
    Signed-off-by: Vinod Koul

    Andy Shevchenko
     
  • The driver will be used as a core part for various implementations of the
    DesignWare DMA device. The patch adjusts description on the top and corrects
    paragraph indentation in few places across the code.

    Signed-off-by: Heikki Krogerus
    Signed-off-by: Andy Shevchenko
    Acked-by: Viresh Kumar
    Reviewed-by: Felipe Balbi
    Signed-off-by: Vinod Koul

    Heikki Krogerus
     
  • This driver could be used on different platforms. Thus, the HAVE_CLK dependency
    is dropped away.

    Signed-off-by: Heikki Krogerus
    Signed-off-by: Andy Shevchenko
    Reviewed-by: Felipe Balbi
    Acked-by: Viresh Kumar
    Signed-off-by: Vinod Koul

    Heikki Krogerus
     
  • This patch adds dw_dmac's platform data to DT node. It also creates slave info
    node for SPEAr13xx, for the devices which were using dw_dmac.

    Signed-off-by: Viresh Kumar
    Signed-off-by: Vinod Koul

    Viresh Kumar
     
  • dw_dmac driver already supports device tree but it used to have its platform
    data passed the non-DT way.

    This patch does following changes:
    - pass platform data via DT, non-DT way still takes precedence if both are used.
    - create generic filter routine
    - Earlier slave information was made available by slave specific filter routines
    in chan->private field. Now, this information would be passed from within dmac
    DT node. Slave drivers would now be required to pass bus_id (a string) as
    parameter to this generic filter(), which would be compared against the slave
    data passed from DT, by the generic filter routine.
    - Update binding document

    Signed-off-by: Viresh Kumar
    Reviewed-by: Andy Shevchenko
    [Fixed __devinit usage]
    Signed-off-by: Vinod Koul

    Viresh Kumar
     

07 Jan, 2013

8 commits

  • Documentation style comments were missing for few fields in struct
    dw_dma_platform_data. Add these.

    Signed-off-by: Viresh Kumar
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Vinod Koul

    Viresh Kumar
     
  • Use the module_pci_driver() macro to make the code simpler
    by eliminating module_init and module_exit calls.

    dpatch engine is used to auto generate this patch.
    (https://github.com/weiyj/dpatch)

    Signed-off-by: Wei Yongjun
    Signed-off-by: Vinod Koul

    Wei Yongjun
     
  • This config item has not carried much meaning for a while now and is
    almost always enabled by default. As agreed during the Linux kernel
    summit, remove it.

    CC: Vinod Koul
    CC: Dan Williams
    Signed-off-by: Kees Cook
    Signed-off-by: Vinod Koul

    Kees Cook
     
  • Reported-by: Fengguang Wu
    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • Some semicolons were left out in the examples.

    The #dma-channels and #dma-requests properties have a prefix
    that is, by convention, reserved for cell size properties.
    Rename those properties to dma-channels and dma-requests.

    Signed-off-by: Matt Porter
    Acked-by: Arnd Bergmann
    Acked-by: Jon Hunter
    Signed-off-by: Vinod Koul

    Matt Porter
     
  • Signed-off-by: Vinod Koul

    Vinod Koul
     
  • This is based upon the work by Benoit Cousson [1] and Nicolas Ferre [2]
    to add some basic helpers to retrieve a DMA controller device_node and the
    DMA request/channel information.

    Aim of DMA helpers
    - The purpose of device-tree is to describe the capabilites of the hardware.
    Thinking about DMA controllers purely from the context of the hardware to
    begin with, we can describe a device in terms of a DMA controller as
    follows ...
    1. Number of DMA controllers
    2. Number of channels (maybe physical or logical)
    3. Mapping of DMA requests signals to DMA controller
    4. Number of DMA interrupts
    5. Mapping of DMA interrupts to channels
    - With the above in mind the aim of the DT DMA helper functions is to extract
    the above information from the DT and provide to the appropriate driver.
    However, due to the vast number of DMA controllers and not all are using a
    common driver (such as DMA Engine) it has been seen that this is not a
    trivial task. In previous discussions on this topic the following concerns
    have been raised ...
    1. How does the binding support devices with multiple DMA controllers?
    2. How to support both legacy DMA controllers not using DMA Engine as
    well as those that support DMA Engine.
    3. When using with DMA Engine how do we support the various
    implementations where the opaque filter function parameter differs
    between implementations?
    4. How do we handle DMA channels that are identified with a string
    versus a integer?
    - Hence the design of the DMA helpers has to accomodate the above or align on
    an agreement what can be or should be supported.

    Design of DMA helpers

    1. Registering DMA controllers

    In the case of DMA controllers that are using DMA Engine, requesting a
    channel is performed by calling the following function.

    struct dma_chan *dma_request_channel(dma_cap_mask_t mask,
    dma_filter_fn filter_fn,
    void *filter_param);

    The mask variable is used to match a type of the device controller in a list
    of controllers. The filter_fn and filter_param are used to identify the
    required dma channel and return a handle to the dma channel of type dma_chan.

    From the examples I have seen, the mask and filter_fn are constant
    for a given DMA controller and therefore, we can specify these as controller
    specific data when registering the DMA controller with the device-tree DMA
    helpers.

    The filter_param variable is of an unknown type and is typically specific
    to the DMA engine implementation for a given DMA controller. To allow some
    flexibility in the type and formating of this filter_param we employ an
    xlate to translate the device-tree binding information into the appropriate
    format. The xlate function used for a DMA controller can also be specified
    when registering the DMA controller with the device-tree DMA helpers.

    Based upon the above, a function for registering the DMA controller with the
    DMA helpers now looks like the below. The data variable is used to pass a
    pointer to DMA controller specific data used by the xlate function.

    int of_dma_controller_register(struct device_node *np,
    struct dma_chan *(*of_dma_xlate)
    (struct of_phandle_args *, struct of_dma *),
    void *data)

    For example, in the case where DMA engine is used, we define the following
    structure (that stores the DMA engine capability mask and filter function)
    and pass this to the data variable in the above function.

    struct of_dma_filter_info {
    dma_cap_mask_t dma_cap;
    dma_filter_fn filter_fn;
    };

    2. Representing and requesting channel information

    Please see the dma binding documentation included in this patch for a
    description of how DMA controllers and client information should be
    represented with device-tree. For more information on how this binding
    came about please see [3]. In addition to this, feedback received from
    the Linux kernel summit showed a consensus (among those who attended) to
    use a name to identify DMA client information [4].

    A DMA channel can be requested by calling the following function, where name
    is a required parameter used for identifying a DMA channel. This function
    has been designed to return a structure of type dma_chan to work with the
    DMA engine driver. Note that if DMA engine is used then drivers should be
    using the DMA engine API dma_request_slave_channel() (implemented in part 2
    of this series, "dmaengine: add helper function to request a slave DMA
    channel") which will in turn call the below function if device-tree is
    present. The aim being to have a common DMA engine interface regardless of
    whether device tree is being used.

    struct dma_chan *of_dma_request_slave_channel(struct device_node *np,
    char *name)

    3. Supporting legacy devices not using DMA Engine

    These devices present a problem, as there may not be a uniform way to easily
    support them with regard to device tree. Ideally, these should be migrated
    to DMA engine. However, if this is not possible, then they should still be
    able to use this binding, the only constaint imposed by this implementation
    is that when requesting a DMA channel via of_dma_request_slave_channel(), it
    will return a type of dma_chan.

    This implementation has been tested on OMAP4430 using the kernel v3.6-rc5. I
    have validated that MMC is working on the PANDA board with this implementation.
    My development branch for testing on OMAP can be found here [5].

    v6: - minor corrections in DMA binding documentation
    v5: - minor update to binding documentation
    - added loop to exhaustively search for a slave channel in the case where
    there could be alternative channels available
    v4: - revert the removal of xlate function from v3
    - update the proposed binding format and APIs based upon discussions [3]
    v3: - avoid passing an xlate function and instead pass DMA engine parameters
    - define number of dma channels and requests in dma-controller node
    v2: - remove of_dma_to_resource API
    - make property #dma-cells required (no fallback anymore)
    - another check in of_dma_xlate_onenumbercell() function

    [1] http://article.gmane.org/gmane.linux.drivers.devicetree/12022
    [2] http://article.gmane.org/gmane.linux.ports.arm.omap/73622
    [3] http://marc.info/?l=linux-omap&m=133582085008539&w=2
    [4] http://pad.linaro.org/arm-mini-summit-2012
    [5] https://github.com/jonhunter/linux/tree/dev-dt-dma

    Cc: Nicolas Ferre
    Cc: Benoit Cousson
    Cc: Stephen Warren
    Cc: Grant Likely
    Cc: Russell King
    Cc: Rob Herring
    Cc: Arnd Bergmann
    Cc: Vinod Koul
    Cc: Dan Williams

    Reviewed-by: Arnd Bergmann
    Reviewed-by: Nicolas Ferre
    Signed-off-by: Jon Hunter
    Reviewed-by: Stephen Warren
    Acked-by: Rob Herring
    Signed-off-by: Vinod Koul

    Jon Hunter
     
  • Currently slave DMA channels are requested by calling dma_request_channel()
    and requires DMA clients to pass various filter parameters to obtain the
    appropriate channel.

    With device-tree being used by architectures such as arm and the addition of
    device-tree helper functions to extract the relevant DMA client information
    from device-tree, add a new function to request a slave DMA channel using
    device-tree. This function is currently a simple wrapper that calls the
    device-tree of_dma_request_slave_channel() function.

    Cc: Nicolas Ferre
    Cc: Benoit Cousson
    Cc: Stephen Warren
    Cc: Grant Likely
    Cc: Russell King
    Cc: Rob Herring
    Cc: Arnd Bergmann
    Cc: Vinod Koul
    Cc: Dan Williams

    Acked-by: Arnd Bergmann
    Signed-off-by: Jon Hunter
    Reviewed-by: Stephen Warren
    Acked-by: Rob Herring
    Signed-off-by: Vinod Koul

    Jon Hunter
     

03 Jan, 2013

14 commits

  • Linus Torvalds
     
  • Pull LED fix from Bryan Wu.

    * 'fixes-for-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds:
    leds: leds-gpio: set devm_gpio_request_one() flags param correctly

    Linus Torvalds
     
  • commit a99d76f leds: leds-gpio: use gpio_request_one

    changed the leds-gpio driver to use gpio_request_one() instead
    of gpio_request() + gpio_direction_output()

    Unfortunately, it also made a semantic change that breaks the
    leds-gpio driver.

    The gpio_request_one() flags parameter was set to:

    GPIOF_DIR_OUT | (led_dat->active_low ^ state)

    Since GPIOF_DIR_OUT is 0, the final flags value will just be the
    XOR'ed value of led_dat->active_low and state.

    This value were used to distinguish between HIGH/LOW output initial
    level and call gpio_direction_output() accordingly.

    With this new semantic gpio_request_one() will take the flags value
    of 1 as a configuration of input direction (GPIOF_DIR_IN) and will
    call gpio_direction_input() instead of gpio_direction_output().

    int gpio_request_one(unsigned gpio, unsigned long flags, const char *label)
    {
    ..
    if (flags & GPIOF_DIR_IN)
    err = gpio_direction_input(gpio);
    else
    err = gpio_direction_output(gpio,
    (flags & GPIOF_INIT_HIGH) ? 1 : 0);
    ..
    }

    The right semantic is to evaluate led_dat->active_low ^ state and
    set the output initial level explicitly.

    Signed-off-by: Javier Martinez Canillas
    Reported-by: Arnaud Patard
    Tested-by: Ezequiel Garcia
    Signed-off-by: Bryan Wu

    Javier Martinez Canillas
     
  • Pull watchdog fixes from Wim Van Sebroeck:
    "This fixes some small errors in the new da9055 driver, eliminates a
    compiler warning and adds DT support for the twl4030_wdt driver (so
    that we can have multiple watchdogs with DT on the omap platforms)."

    * git://www.linux-watchdog.org/linux-watchdog:
    watchdog: twl4030_wdt: add DT support
    watchdog: omap_wdt: eliminate unused variable and a compiler warning
    watchdog: da9055: Don't update wdt_dev->timeout in da9055_wdt_set_timeout error path
    watchdog: da9055: Fix invalid free of devm_ allocated data

    Linus Torvalds
     
  • Pull PCI updates from Bjorn Helgaas:
    "Some fixes for v3.8. They include a fix for the new SR-IOV sysfs
    management support, an expanded quirk for Ricoh SD card readers, a
    Stratus DMI quirk fix, and a PME polling fix."

    * tag '3.8-pci-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci:
    PCI: Reduce Ricoh 0xe822 SD card reader base clock frequency to 50MHz
    PCI/PM: Do not suspend port if any subordinate device needs PME polling
    PCI: Add PCIe Link Capability link speed and width names
    PCI: Work around Stratus ftServer broken PCIe hierarchy (fix DMI check)
    PCI: Remove spurious error for sriov_numvfs store and simplify flow

    Linus Torvalds
     
  • Commit 56c176c9cac9 ("UAPI: strip the _UAPI prefix from header guards
    during header installation") strips the _UAPI prefix from header guards,
    but only if there's a single space between the cpp directive and the
    label.

    Make it more flexible and able to handle tabs and multiple white space
    characters.

    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Empty files can get deleted by the patch program, so remove empty Kbuild
    files and their links from the parent Kbuilds.

    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    David Howells
     
  • Pull ecryptfs fixes from Tyler Hicks:
    "Two self-explanatory fixes and a third patch which improves
    performance: when overwriting a full page in the eCryptfs page cache,
    skip reading in and decrypting the corresponding lower page."

    * tag 'ecryptfs-3.8-rc2-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
    fs/ecryptfs/crypto.c: make ecryptfs_encode_for_filename() static
    eCryptfs: fix to use list_for_each_entry_safe() when delete items
    eCryptfs: Avoid unnecessary disk read and data decryption during writing

    Linus Torvalds
     
  • Pull Ceph fixes from Sage Weil:
    "Two of Alex's patches deal with a race when reseting server
    connections for open RBD images, one demotes some non-fatal BUGs to
    WARNs, and my patch fixes a protocol feature bit failure path."

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/sage/ceph-client:
    libceph: fix protocol feature mismatch failure path
    libceph: WARN, don't BUG on unexpected connection states
    libceph: always reset osds when kicking
    libceph: move linger requests sooner in kick_requests()

    Linus Torvalds
     
  • Sasha was fuzzing with trinity and reported the following problem:

    BUG: sleeping function called from invalid context at kernel/mutex.c:269
    in_atomic(): 1, irqs_disabled(): 0, pid: 6361, name: trinity-main
    2 locks held by trinity-main/6361:
    #0: (&mm->mmap_sem){++++++}, at: [] __do_page_fault+0x1e4/0x4f0
    #1: (&(&mm->page_table_lock)->rlock){+.+...}, at: [] handle_pte_fault+0x3f7/0x6a0
    Pid: 6361, comm: trinity-main Tainted: G W
    3.7.0-rc2-next-20121024-sasha-00001-gd95ef01-dirty #74
    Call Trace:
    __might_sleep+0x1c3/0x1e0
    mutex_lock_nested+0x29/0x50
    mpol_shared_policy_lookup+0x2e/0x90
    shmem_get_policy+0x2e/0x30
    get_vma_policy+0x5a/0xa0
    mpol_misplaced+0x41/0x1d0
    handle_pte_fault+0x465/0x6a0

    This was triggered by a different version of automatic NUMA balancing
    but in theory the current version is vunerable to the same problem.

    do_numa_page
    -> numa_migrate_prep
    -> mpol_misplaced
    -> get_vma_policy
    -> shmem_get_policy

    It's very unlikely this will happen as shared pages are not marked
    pte_numa -- see the page_mapcount() check in change_pte_range() -- but
    it is possible.

    To address this, this patch restores sp->lock as originally implemented
    by Kosaki Motohiro. In the path where get_vma_policy() is called, it
    should not be calling sp_alloc() so it is not necessary to treat the PTL
    specially.

    Signed-off-by: KOSAKI Motohiro
    Tested-by: KOSAKI Motohiro
    Signed-off-by: Mel Gorman
    Signed-off-by: Linus Torvalds

    Mel Gorman
     
  • Pull ext4 bug fixes from Ted Ts'o:
    "Various bug fixes for ext4. Perhaps the most serious bug fixed is one
    which could cause file system corruptions when performing file punch
    operations."

    * tag 'ext4_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
    ext4: avoid hang when mounting non-journal filesystems with orphan list
    ext4: lock i_mutex when truncating orphan inodes
    ext4: do not try to write superblock on ro remount w/o journal
    ext4: include journal blocks in df overhead calcs
    ext4: remove unaligned AIO warning printk
    ext4: fix an incorrect comment about i_mutex
    ext4: fix deadlock in journal_unmap_buffer()
    ext4: split off ext4_journalled_invalidatepage()
    jbd2: fix assertion failure in jbd2_journal_flush()
    ext4: check dioread_nolock on remount
    ext4: fix extent tree corruption caused by hole punch

    Linus Torvalds
     
  • Remove the unused argument (formerly no_context) from mpol_parse_str()
    and from mpol_to_str().

    Signed-off-by: Hugh Dickins
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     
  • Recently I suggested using "mount -o remount,mpol=local /tmp" in NUMA
    mempolicy testing. Very nasty. Reading /proc/mounts, /proc/pid/mounts
    or /proc/pid/mountinfo may then corrupt one bit of kernel memory, often
    in a page table (causing "Bad swap" or "Bad page map" warning or "Bad
    pagetable" oops), sometimes in a vm_area_struct or rbnode or somewhere
    worse. "mpol=prefer" and "mpol=prefer:Node" are equally toxic.

    Recent NUMA enhancements are not to blame: this dates back to 2.6.35,
    when commit e17f74af351c "mempolicy: don't call mpol_set_nodemask() when
    no_context" skipped mpol_parse_str()'s call to mpol_set_nodemask(),
    which used to initialize v.preferred_node, or set MPOL_F_LOCAL in flags.
    With slab poisoning, you can then rely on mpol_to_str() to set the bit
    for node 0x6b6b, probably in the next page above the caller's stack.

    mpol_parse_str() is only called from shmem_parse_options(): no_context
    is always true, so call it unused for now, and remove !no_context code.
    Set v.nodes or v.preferred_node or MPOL_F_LOCAL as mpol_to_str() might
    expect. Then mpol_to_str() can ignore its no_context argument also,
    the mpol being appropriately initialized whether contextualized or not.
    Rename its no_context unused too, and let subsequent patch remove them
    (that's not needed for stable backporting, which would involve rejects).

    I don't understand why MPOL_LOCAL is described as a pseudo-policy:
    it's a reasonable policy which suffers from a confusing implementation
    in terms of MPOL_PREFERRED with MPOL_F_LOCAL. I believe this would be
    much more robust if MPOL_LOCAL were recognized in switch statements
    throughout, MPOL_F_LOCAL deleted, and MPOL_PREFERRED use the (possibly
    empty) nodes mask like everyone else, instead of its preferred_node
    variant (I presume an optimization from the days before MPOL_LOCAL).
    But that would take me too long to get right and fully tested.

    Signed-off-by: Hugh Dickins
    Cc: stable@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Hugh Dickins
     
  • EPOLL_CTL_MOD sets the interest mask before calling f_op->poll() to
    ensure events are not missed. Since the modifications to the interest
    mask are not protected by the same lock as ep_poll_callback, we need to
    ensure the change is visible to other CPUs calling ep_poll_callback.

    We also need to ensure f_op->poll() has an up-to-date view of past
    events which occured before we modified the interest mask. So this
    barrier also pairs with the barrier in wq_has_sleeper().

    This should guarantee either ep_poll_callback or f_op->poll() (or both)
    will notice the readiness of a recently-ready/modified item.

    This issue was encountered by Andreas Voellmy and Junchang(Jason) Wang in:
    http://thread.gmane.org/gmane.linux.kernel/1408782/

    Signed-off-by: Eric Wong
    Cc: Hans Verkuil
    Cc: Jiri Olsa
    Cc: Jonathan Corbet
    Cc: Al Viro
    Cc: Davide Libenzi
    Cc: Hans de Goede
    Cc: Mauro Carvalho Chehab
    Cc: David Miller
    Cc: Eric Dumazet
    Cc: Andrew Morton
    Cc: Andreas Voellmy
    Tested-by: "Junchang(Jason) Wang"
    Cc: netdev@vger.kernel.org
    Cc: linux-fsdevel@vger.kernel.org
    Signed-off-by: Linus Torvalds

    Eric Wong
     

02 Jan, 2013

4 commits