1. 07 Mar, 2012 1 commit
    • Olof Johansson's avatar
      Merge tag 'rpmsg-fixes-and-more-for-3.4' of... · 6458acb5
      Olof Johansson authored
      Merge tag 'rpmsg-fixes-and-more-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc into next/rpmsg
      
      Fixing and cleaning up several remoteproc and rpmsg issues.
      
      In addition, remoteproc's resource table is converted to a collection
      of type-value members, instead of a rigid array of homogeneous structs.
      
      This enables remoteproc to support registration of generic virtio devices,
      and not only a single VIRTIO_ID_RPMSG virtio device.
      
      But perhaps more importantly, the resource table overhaul makes it possible
      to easily extend it in the future without breaking older images (simply by
      defining a new member type, while continuing to support older types).
      
      * tag 'rpmsg-fixes-and-more-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
        remoteproc: cleanup resource table parsing paths
        remoteproc: remove the hardcoded vring alignment
        remoteproc/omap: remove the mbox_callback limitation
        remoteproc: remove the single rpmsg vdev limitation
        remoteproc: safer boot/shutdown order
        remoteproc: remoteproc_rpmsg -> remoteproc_virtio
        remoteproc: resource table overhaul
        rpmsg: fix build warning when dma_addr_t is 64-bit
        rpmsg: fix published buffer length in rpmsg_recv_done
        rpmsg: validate incoming message length before propagating
        rpmsg: fix name service endpoint leak
        remoteproc/omap: two Kconfig fixes
        remoteproc: make sure we're parsing a 32bit firmware
      6458acb5
  2. 06 Mar, 2012 7 commits
    • Ohad Ben-Cohen's avatar
      remoteproc: cleanup resource table parsing paths · 1e3e2c7c
      Ohad Ben-Cohen authored
      rproc_handle_resources() looks for the resource table and then
      invokes a resource handler function which it took as a parameter.
      
      This works, but it's a bit unintuitive to follow.
      
      Instead of passing around function pointers, this patch changes
      rproc_handle_resource() to just find and return the resource table,
      and then the calling sites of rproc_handle_resource() invoke their
      resource handlers directly.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      1e3e2c7c
    • Ohad Ben-Cohen's avatar
      remoteproc: remove the hardcoded vring alignment · 63140e0e
      Ohad Ben-Cohen authored
      Remove the hardcoded vring alignment of 4096 bytes,
      and instead utilize tha vring alignment as specified in
      the resource table.
      
      This is needed for remote processors that have rigid
      memory requirement, and which have found the alignment of
      4096 bytes to be excessively big.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      63140e0e
    • Ohad Ben-Cohen's avatar
      remoteproc/omap: remove the mbox_callback limitation · 55f34080
      Ohad Ben-Cohen authored
      Now that remoteproc supports any number of virtio devices,
      the previous sanity check in omap_rproc_mbox_callback
      doesn't make sense anymore.
      
      Remove that so we can start supporting multiple vdevs.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      55f34080
    • Ohad Ben-Cohen's avatar
      remoteproc: remove the single rpmsg vdev limitation · 7a186941
      Ohad Ben-Cohen authored
      Now that the resource table supports publishing a virtio device
      in a single resource entry, firmware images can start supporting
      more than a single vdev.
      
      This patch removes the single vdev limitation of the remoteproc
      framework so multi-vdev firmwares can be leveraged: VDEV resource
      entries are parsed when the rproc is registered, and as a result
      their vrings are set up and the virtio devices are registered
      (and they go away when the rproc goes away).
      
      Moreover, we no longer only support VIRTIO_ID_RPMSG vdevs; any
      virtio device type goes now. As a result, there's no more any
      rpmsg-specific APIs or code in remoteproc: it all becomes generic
      virtio handling.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      7a186941
    • Ohad Ben-Cohen's avatar
      remoteproc: safer boot/shutdown order · 41a6ee09
      Ohad Ben-Cohen authored
      Boot the remote processor only after setting up the virtqueues,
      and shut it down before deleting them.
      
      Remote processors should obey virtio status changes, and
      therefore not manipulate/trigger the virtqueues while the virtio
      driver isn't ready, but it's just safer not to rely on that
      (plus a vq access might already be inflight while a vdev
      status is changed).
      
      We also don't have yet status change notifications, but that's
      a temporary limitation.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      41a6ee09
    • Ohad Ben-Cohen's avatar
      remoteproc: remoteproc_rpmsg -> remoteproc_virtio · 04a9016e
      Ohad Ben-Cohen authored
      At this point remoteproc can only register a single VIRTIO_ID_RPMSG virtio
      device.
      
      This limitation is going away soon: remoteproc is getting support for
      registering any number of virtio devices and of any type (as
      published by the firmware of the remote processor).
      
      Rename remoteproc_rpmsg.c to remoteproc_virtio.c in preparation of
      this generalization work.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      04a9016e
    • Ohad Ben-Cohen's avatar
      remoteproc: resource table overhaul · fd2c15ec
      Ohad Ben-Cohen authored
      The resource table is an array of 'struct fw_resource' members, where
      each resource entry is expressed as a single member of that array.
      
      This approach got us this far, but it has a few drawbacks:
      
      1. Different resource entries end up overloading the same members of 'struct
         fw_resource' with different meanings. The resulting code is error prone
         and hard to read and maintain.
      
      2. It's impossible to extend 'struct fw_resource' without breaking the
         existing firmware images (and we already want to: we can't introduce the
         new virito device resource entry with the current scheme).
      
      3. It doesn't scale: 'struct fw_resource' must be as big as the largest
         resource entry type. As a result, smaller resource entries end up
         utilizing only small part of it.
      
      This is fixed by defining a dedicated structure for every resource type,
      and then converting the resource table to a list of type-value members.
      Instead of a rigid array of homogeneous structs, the resource table
      is turned into a collection of heterogeneous structures.
      
      This way:
      1. Resource entries consume exactly the amount of bytes they need.
      2. It's easy to extend: just create a new resource entry structure, and assign
         it a new type.
      3. The code is easier to read and maintain: the structures' members names are
         meaningful.
      
      While we're at it, this patch has several other resource table changes:
      1. The resource table gains a simple header which contains the
         number of entries in the table and their offsets within the table. This
         makes the parsing code simpler and easier to read.
      2. A version member is added to the resource table. Should we change the
         format again, we'll bump up this version to prevent breakage with
         existing firmware images.
      3. The VRING and VIRTIO_DEV resource entries are combined to a single
         VDEV entry. This paves the way to supporting multiple VDEV entries.
      4. Since we don't really support 64-bit rprocs yet, convert two stray u64
         members to u32.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Brian Swetland <swetland@google.com>
      Cc: Iliyan Malchev <malchev@google.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: John Williams <john.williams@petalogix.com>
      Cc: Michal Simek <monstr@monstr.eu>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Guzman Lugo Fernando <fernando.lugo@ti.com>
      Cc: Anna Suman <s-anna@ti.com>
      Cc: Clark Rob <rob@ti.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Saravana Kannan <skannan@codeaurora.org>
      Cc: David Brown <davidb@codeaurora.org>
      Cc: Kieran Bingham <kieranbingham@gmail.com>
      Cc: Tony Lindgren <tony@atomide.com>
      fd2c15ec
  3. 04 Mar, 2012 1 commit
  4. 28 Feb, 2012 5 commits
    • Ohad Ben-Cohen's avatar
      rpmsg: fix published buffer length in rpmsg_recv_done · f1d9e9c7
      Ohad Ben-Cohen authored
      After processing an incoming message, always publish the real size
      of its containing buffer when putting it back on the available rx ring.
      
      Using any different value might erroneously limit the remote processor
      (leading it to think the buffer is smaller than it really is).
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Suman Anna <s-anna@ti.com>
      Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
      Cc: Rob Clark <rob@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      f1d9e9c7
    • Ohad Ben-Cohen's avatar
      rpmsg: validate incoming message length before propagating · 9648224e
      Ohad Ben-Cohen authored
      When an inbound message arrives, validate its reported length before
      propagating it, otherwise buggy (or malicious) remote processors might
      trick us into accessing memory which we really shouldn't.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Suman Anna <s-anna@ti.com>
      Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
      Cc: Rob Clark <rob@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      9648224e
    • Ohad Ben-Cohen's avatar
      rpmsg: fix name service endpoint leak · fa2d7795
      Ohad Ben-Cohen authored
      The name service endpoint wasn't destroyed, so fix it.
      
      This is achieved by introducing an internal __rpmsg_destroy_ept
      function which doesn't assume the given ept is bound to an rpmsg
      channel (much like the existing __rpmsg_create_ept).
      
      This is needed because the name service ept belongs to the rpmsg bus,
      and is never bound with a specific rpdev.
      Reported-by: default avatarOmar Ramirez Luna <omar.ramirez@ti.com>
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Suman Anna <s-anna@ti.com>
      Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
      Cc: Rob Clark <rob@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
      fa2d7795
    • Ohad Ben-Cohen's avatar
      remoteproc/omap: two Kconfig fixes · 9cd8eb43
      Ohad Ben-Cohen authored
      1. Depend on OMAP_IOMMU instead of selecting it, to fix an unmet
         direct dependency of it (and its imminent build error)
      2. Set default to 'no' (achieved implicitly by dropping the 'default'
         line)
      Reported-by: default avatarRussell King <linux@arm.linux.org.uk>
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Suman Anna <s-anna@ti.com>
      Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
      Cc: Rob Clark <rob@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      Cc: Russell King <linux@arm.linux.org.uk>
      9cd8eb43
    • Ohad Ben-Cohen's avatar
      remoteproc: make sure we're parsing a 32bit firmware · 40b78b2c
      Ohad Ben-Cohen authored
      Make sure we're parsing a 32bit image, since we only support
      the ELF32 binary format at this point.
      
      This should prevent unexpected behavior with non 32bit binaries.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Suman Anna <s-anna@ti.com>
      Cc: Fernando Guzman Lugo <fernando.lugo@ti.com>
      Cc: Rob Clark <rob@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      Cc: Loic PALLARDY <loic.pallardy@stericsson.com>
      Cc: Omar Ramirez Luna <omar.luna@linaro.org>
      40b78b2c
  5. 23 Feb, 2012 1 commit
    • Arnd Bergmann's avatar
      Merge tag 'rpmsg-for-3.4' of... · ab646a24
      Arnd Bergmann authored
      Merge tag 'rpmsg-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc into next/rpmsg
      
      * tag 'rpmsg-for-3.4' of git://git.kernel.org/pub/scm/linux/kernel/git/ohad/remoteproc:
        remoteproc: s/big switch/lookup table/
        remoteproc: bail out if firmware has different endianess
        remoteproc: don't use virtio's weak barriers
        rpmsg: rename virtqueue_add_buf_gfp to virtqueue_add_buf
        rpmsg: depend on EXPERIMENTAL
        remoteproc: depend on EXPERIMENTAL
        rpmsg: add Kconfig menu
        remoteproc: add Kconfig menu
        remoteproc: look for truncated firmware images
        remoteproc/omap: utilize module_platform_driver
        remoteproc: remove unused resource type
        remoteproc: avoid registering a virtio device if not supported
        remoteproc: do not require an iommu
        samples/rpmsg: add an rpmsg driver sample
        rpmsg: add virtio-based remote processor messaging bus
        remoteproc/omap: add a remoteproc driver for OMAP4
        remoteproc: create rpmsg virtio device
        remoteproc: add debugfs entries
        remoteproc: add framework for controlling remote processors
      ab646a24
  6. 22 Feb, 2012 6 commits
    • Ohad Ben-Cohen's avatar
      remoteproc: s/big switch/lookup table/ · e12bc14b
      Ohad Ben-Cohen authored
      A lookup table would be easier to extend, and the resulting
      code is a bit cleaner.
      Reported-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      e12bc14b
    • Ohad Ben-Cohen's avatar
      remoteproc: bail out if firmware has different endianess · cf59d3e9
      Ohad Ben-Cohen authored
      At this point we don't support remote processors that have
      a different endianess than the host.
      
      Look out for these unsupported scenarios, and bail out if
      encountered.
      Reported-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Mark Grosen <mgrosen@ti.com>
      Acked-by: default avatarGrant Likely <grant.likely@secretlab.ca>
      cf59d3e9
    • Ohad Ben-Cohen's avatar
      remoteproc: don't use virtio's weak barriers · dd6da1c5
      Ohad Ben-Cohen authored
      When creating a virtqueue for rpmsg, tell virtio we're not interested
      in "weak" smp barriers, since we're talking to a real device.
      
      On ARM, this means using a DSB instead of a DMB, which is needed
      for platforms that kick the remote processor using some kind of
      a mailbox device mapped to Device memory (otherwise the kick can
      jump ahead and wake the remote processor before it has observed
      the changes to the vrings).
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      dd6da1c5
    • Axel Lin's avatar
      rpmsg: rename virtqueue_add_buf_gfp to virtqueue_add_buf · b719587e
      Axel Lin authored
      Since commit 7bb7aef2 "virtio: rename virtqueue_add_buf_gfp to virtqueue_add_buf",
      virtqueue_add_buf_gfp is already rename to virtqueue_add_buf now.
      
      This patch fixes below build error:
       CC [M]  drivers/rpmsg/virtio_rpmsg_bus.o
      drivers/rpmsg/virtio_rpmsg_bus.c: In function 'rpmsg_send_offchannel_raw':
      drivers/rpmsg/virtio_rpmsg_bus.c:723: error: implicit declaration of function 'virtqueue_add_buf_gfp'
      make[2]: *** [drivers/rpmsg/virtio_rpmsg_bus.o] Error 1
      make[1]: *** [drivers/rpmsg] Error 2
      make: *** [drivers] Error 2
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      b719587e
    • Ohad Ben-Cohen's avatar
      rpmsg: depend on EXPERIMENTAL · 4ba60295
      Ohad Ben-Cohen authored
      There isn't any binary change in sight or evidence of any stability
      issue, but as we just begin to get traction we can't rule them out
      completely.
      
      To be on the safe side, let's mark rpmsg as EXPERIMENTAL, and remove
      it later on after we have several happy users.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Rob Clark <rob@ti.com>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      4ba60295
    • Ohad Ben-Cohen's avatar
      remoteproc: depend on EXPERIMENTAL · 489d129a
      Ohad Ben-Cohen authored
      Remoteproc is still under development and as it gets traction we
      definitely expect to do some changes in the binary format (most probably
      only in the resource table, e.g. the upcoming move to TLV-based entries).
      
      Active testing and use of remoteproc is most welcome, but we don't want
      users to expect backward binary compatibility with the preliminary
      images we have today.
      
      Therefore mark remoteproc as EXPERIMENTAL, and explicitly inform the user
      about this when a new remote processor is registered.
      Signed-off-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
      Cc: Stephen Boyd <sboyd@codeaurora.org>
      Cc: Rob Clark <rob@ti.com>
      Cc: Mark Grosen <mgrosen@ti.com>
      Cc: Ludovic BARRE <ludovic.barre@stericsson.com>
      489d129a
  7. 09 Feb, 2012 11 commits
    • Linus Torvalds's avatar
      Linux 3.3-rc3 · d65b4e98
      Linus Torvalds authored
      d65b4e98
    • Linus Torvalds's avatar
      Merge branch 'iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu · 63082402
      Linus Torvalds authored
      One patch fixes an bug in the ARM/MSM IOMMU code which returned sucess
      in the unmap function even when an error occured and the other patch
      adds a workaround into the AMD IOMMU driver to better handle broken IVRS
      ACPI tables (this patch fixes the case when a device is not listed in
      the table but actually translated by the iommu).
      
      * 'iommu/fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu:
        iommu/msm: Fix error handling in msm_iommu_unmap()
        iommu/amd: Work around broken IVRS tables
      63082402
    • Linus Torvalds's avatar
      Merge branch '3.3-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending · 19e75ed4
      Linus Torvalds authored
      This series contains pending target bug-fixes and cleanups for v3.3-rc3
      that have been addressed the past weeks in lio-core.git.
      
      Some of the highlights include:
      
       - Fix handling for control CDBs with data greater than PAGE_SIZE (andy)
       - Use IP_FREEBIND for iscsi-target to address network portal creation
         issues with systemd (dax)
       - Allow PERSISTENT RESERVE IN for non-reservation holder (marco)
       - Fix iblock se_dev_attrib.unmap_granularity (marco)
       - Fix unsupported WRITE_SAME sense payload handling (martin)
       - Add workaround for zero-length control CDB handling (nab)
       - Fix discovery with INADDR_ANY and IN6ADDR_ANY_INIT (nab)
       - Fix target_submit_cmd() exception handling (nab)
       - Return correct ASC for unimplemented VPD pages (roland)
       - Don't zero pages used for data buffers (roland)
       - Fix return code of core_tpg_.*_lun (sebastian)
      
      * '3.3-rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending: (26 commits)
        target: Fix unsupported WRITE_SAME sense payload
        iscsi: use IP_FREEBIND socket option
        iblock: fix handling of large requests
        target: handle empty string writes in sysfs
        iscsi_target: in_aton needs linux/inet.h
        target: Fix iblock se_dev_attrib.unmap_granularity
        target: Fix target_submit_cmd() exception handling
        target: Change target_submit_cmd() to return void
        target: accept REQUEST_SENSE with 18bytes
        target: Fail INQUIRY commands with EVPD==0 but PAGE CODE!=0
        target: Return correct ASC for unimplemented VPD pages
        iscsi-target: Fix discovery with INADDR_ANY and IN6ADDR_ANY_INIT
        target: Allow control CDBs with data > 1 page
        iscsi-target: Fix up a few assignments
        iscsi-target: make one-bit bitfields unsigned
        iscsi-target: Fix double list_add with iscsit_alloc_buffs reject
        iscsi-target: Fix reject release handling in iscsit_free_cmd()
        target: fix return code of core_tpg_.*_lun
        target: use save/restore lock primitive in core_dec_lacl_count()
        target: avoid multiple outputs in scsi_dump_inquiry()
        ...
      19e75ed4
    • Linus Torvalds's avatar
      Merge tag 'md-3.3-fixes' of git://neil.brown.name/md · 4d39aa1b
      Linus Torvalds authored
      Some simple md-related fixes.
      
      1/ two small fixes to ensure we handle an interrupted resync properly.
      2/ avoid loading the bitmap multiple times in dm-raid
      
      * tag 'md-3.3-fixes' of git://neil.brown.name/md:
        md: two small fixes to handling interrupt resync.
        Prevent DM RAID from loading bitmap twice.
      4d39aa1b
    • Linus Torvalds's avatar
      Merge tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6 · 4a68d54c
      Linus Torvalds authored
      SPI bug fixes for v3.3-rc2
      
      Minor SPI device driver changes.  A rename of the pch_spi_pcidev symbol
      that merely eliminates a modpost warning, and a Kconfig change to allow
      the Samsung spi driver to build on EXYNOS.
      
      * tag 'spi-for-linus' of git://git.secretlab.ca/git/linux-2.6:
        spi-topcliff-pch: rename pch_spi_pcidev to pch_spi_pcidev_driver
        spi: Add spi-s3c64xx driver dependency on ARCH_EXYNOS4
      4a68d54c
    • Linus Torvalds's avatar
      Merge branch 'akpm' (Andrew's tree) · 15a46353
      Linus Torvalds authored
      Five fixes
      
      * branch 'akpm':
        pcmcia: fix socket refcount decrementing on each resume
        mm: fix UP THP spin_is_locked BUGs
        drivers/leds/leds-lm3530.c: fix setting pltfm->als_vmax
        mm: compaction: check for overlapping nodes during isolation for migration
        nilfs2: avoid overflowing segment numbers in nilfs_ioctl_clean_segments()
      15a46353
    • Russell King's avatar
      pcmcia: fix socket refcount decrementing on each resume · 025e4ab3
      Russell King authored
      This fixes a memory-corrupting bug: not only does it cause the warning,
      but as a result of dropping the refcount to zero, it causes the
      pcmcia_socket0 device structure to be freed while it still has
      references, causing slab caches corruption.  A fatal oops quickly
      follows this warning - often even just a 'dmesg' following the warning
      causes the kernel to oops.
      
      While testing suspend/resume on an ARM device with PCMCIA support, and a
      CF card inserted, I found that after five suspend and resumes, the
      kernel would complain, and shortly die after with slab corruption.
      
        WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
      
      As the message doesn't give a clue about which kobject, and the built-in
      debugging in drivers/base/power/main.c happens too late, this was added
      right before each get_device():
      
        printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&dev->kobj), atomic_read(&dev->kobj.kref.refcount));
      
      and on the 3rd s2ram cycle, the following behaviour observed:
      
      On the 3rd suspend/resume cycle:
      
        dpm_prepare: c1a0d998 [pcmcia_socket0] 3
        dpm_suspend: c1a0d998 [pcmcia_socket0] 3
        dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
        dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
        dpm_resume: c1a0d998 [pcmcia_socket0] 3
        dpm_complete: c1a0d998 [pcmcia_socket0] 2
      
      4th:
      
        dpm_prepare: c1a0d998 [pcmcia_socket0] 2
        dpm_suspend: c1a0d998 [pcmcia_socket0] 2
        dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
        dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
        dpm_resume: c1a0d998 [pcmcia_socket0] 2
        dpm_complete: c1a0d998 [pcmcia_socket0] 1
      
      5th:
      
        dpm_prepare: c1a0d998 [pcmcia_socket0] 1
        dpm_suspend: c1a0d998 [pcmcia_socket0] 1
        dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
        dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
        dpm_resume: c1a0d998 [pcmcia_socket0] 1
        dpm_complete: c1a0d998 [pcmcia_socket0] 0
        ------------[ cut here ]------------
        WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
        Modules linked in: ucb1x00_core
        Backtrace:
        [<c0212090>] (dump_backtrace+0x0/0x110) from [<c04799dc>] (dump_stack+0x18/0x1c)
        [<c04799c4>] (dump_stack+0x0/0x1c) from [<c021cba0>] (warn_slowpath_common+0x50/0x68)
        [<c021cb50>] (warn_slowpath_common+0x0/0x68) from [<c021cbdc>] (warn_slowpath_null+0x24/0x28)
        [<c021cbb8>] (warn_slowpath_null+0x0/0x28) from [<c0335374>] (kobject_get+0x28/0x50)
        [<c033534c>] (kobject_get+0x0/0x50) from [<c03804f4>] (get_device+0x1c/0x24)
        [<c0388c90>] (dpm_complete+0x0/0x1a0) from [<c0389cc0>] (dpm_resume_end+0x1c/0x20)
        ...
      
      Looking at commit 7b24e798 ("pcmcia: split up central event handler"),
      the following change was made to cs.c:
      
                      return 0;
              }
       #endif
      -
      -       send_event(skt, CS_EVENT_PM_RESUME, CS_EVENT_PRI_LOW);
      +       if (!(skt->state & SOCKET_CARDBUS) && (skt->callback))
      +               skt->callback->early_resume(skt);
              return 0;
       }
      
      And the corresponding change in ds.c is from:
      
      -static int ds_event(struct pcmcia_socket *skt, event_t event, int priority)
      -{
      -       struct pcmcia_socket *s = pcmcia_get_socket(skt);
      ...
      -       switch (event) {
      ...
      -       case CS_EVENT_PM_RESUME:
      -               if (verify_cis_cache(skt) != 0) {
      -                       dev_dbg(&skt->dev, "cis mismatch - different card\n");
      -                       /* first, remove the card */
      -                       ds_event(skt, CS_EVENT_CARD_REMOVAL, CS_EVENT_PRI_HIGH);
      -                       mutex_lock(&s->ops_mutex);
      -                       destroy_cis_cache(skt);
      -                       kfree(skt->fake_cis);
      -                       skt->fake_cis = NULL;
      -                       s->functions = 0;
      -                       mutex_unlock(&s->ops_mutex);
      -                       /* now, add the new card */
      -                       ds_event(skt, CS_EVENT_CARD_INSERTION,
      -                                CS_EVENT_PRI_LOW);
      -               }
      -               break;
      ...
      -    }
      
      -    pcmcia_put_socket(s);
      
      -    return 0;
      -} /* ds_event */
      
      to:
      
      +static int pcmcia_bus_early_resume(struct pcmcia_socket *skt)
      +{
      +       if (!verify_cis_cache(skt)) {
      +               pcmcia_put_socket(skt);
      +               return 0;
      +       }
      
      +       dev_dbg(&skt->dev, "cis mismatch - different card\n");
      
      +       /* first, remove the card */
      +       pcmcia_bus_remove(skt);
      +       mutex_lock(&skt->ops_mutex);
      +       destroy_cis_cache(skt);
      +       kfree(skt->fake_cis);
      +       skt->fake_cis = NULL;
      +       skt->functions = 0;
      +       mutex_unlock(&skt->ops_mutex);
      
      +       /* now, add the new card */
      +       pcmcia_bus_add(skt);
      +       return 0;
      +}
      
      As can be seen, the original function called pcmcia_get_socket() and
      pcmcia_put_socket() around the guts, whereas the replacement code
      calls pcmcia_put_socket() only in one path.  This creates an imbalance
      in the refcounting.
      
      Testing with pcmcia_put_socket() put removed shows that the bug is gone:
      
        dpm_suspend: c1a10998 [pcmcia_socket0] 5
        dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
        dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
        dpm_resume: c1a10998 [pcmcia_socket0] 5
        dpm_complete: c1a10998 [pcmcia_socket0] 5
      Tested-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: Dominik Brodowski <linux@dominikbrodowski.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      025e4ab3
    • Hugh Dickins's avatar
      mm: fix UP THP spin_is_locked BUGs · b9980cdc
      Hugh Dickins authored
      Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y
      CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false,
      and so triggers some BUGs in Transparent HugePage codepaths.
      
      asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x);
      but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE,
      VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.
      Signed-off-by: default avatarHugh Dickins <hughd@google.com>
      Cc: Andrea Arcangeli <aarcange@redhat.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b9980cdc
    • Axel Lin's avatar
      drivers/leds/leds-lm3530.c: fix setting pltfm->als_vmax · ec44fd42
      Axel Lin authored
      In current code, pltfm->als_vmin is set to LM3530_ALS_WINDOW_mV and
      pltfm->als_vmax is 0.  This does not make sense.  I think what we want
      here is setting pltfm->als_vmax to LM3530_ALS_WINDOW_mV.
      
      Both als_vmin and als_vmax local variables will be set to
      pltfm->als_vmin and pltfm->als_vmax by a few lines latter.  Thus also
      remove a redundant assignment for als_vmin and als_vmax in this patch.
      Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
      Cc: Shreshtha Kumar Sahu <shreshthakumar.sahu@stericsson.com>
      Acked-by: default avatarMilo(Woogyom) Kim <milo.kim@ti.com>
      Tested-by: default avatarMilo(Woogyom) Kim <milo.kim@ti.com>
      Cc: Richard Purdie <rpurdie@rpsys.net>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ec44fd42
    • Mel Gorman's avatar
      mm: compaction: check for overlapping nodes during isolation for migration · dc908600
      Mel Gorman authored
      When isolating pages for migration, migration starts at the start of a
      zone while the free scanner starts at the end of the zone.  Migration
      avoids entering a new zone by never going beyond the free scanned.
      
      Unfortunately, in very rare cases nodes can overlap.  When this happens,
      migration isolates pages without the LRU lock held, corrupting lists
      which will trigger errors in reclaim or during page free such as in the
      following oops
      
        BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
        IP: [<ffffffff810f795c>] free_pcppages_bulk+0xcc/0x450
        PGD 1dda554067 PUD 1e1cb58067 PMD 0
        Oops: 0000 [#1] SMP
        CPU 37
        Pid: 17088, comm: memcg_process_s Tainted: G            X
        RIP: free_pcppages_bulk+0xcc/0x450
        Process memcg_process_s (pid: 17088, threadinfo ffff881c2926e000, task ffff881c2926c0c0)
        Call Trace:
          free_hot_cold_page+0x17e/0x1f0
          __pagevec_free+0x90/0xb0
          release_pages+0x22a/0x260
          pagevec_lru_move_fn+0xf3/0x110
          putback_lru_page+0x66/0xe0
          unmap_and_move+0x156/0x180
          migrate_pages+0x9e/0x1b0
          compact_zone+0x1f3/0x2f0
          compact_zone_order+0xa2/0xe0
          try_to_compact_pages+0xdf/0x110
          __alloc_pages_direct_compact+0xee/0x1c0
          __alloc_pages_slowpath+0x370/0x830
          __alloc_pages_nodemask+0x1b1/0x1c0
          alloc_pages_vma+0x9b/0x160
          do_huge_pmd_anonymous_page+0x160/0x270
          do_page_fault+0x207/0x4c0
          page_fault+0x25/0x30
      
      The "X" in the taint flag means that external modules were loaded but but
      is unrelated to the bug triggering.  The real problem was because the PFN
      layout looks like this
      
        Zone PFN ranges:
          DMA      0x00000010 -> 0x00001000
          DMA32    0x00001000 -> 0x00100000
          Normal   0x00100000 -> 0x01e80000
        Movable zone start PFN for each node
        early_node_map[14] active PFN ranges
            0: 0x00000010 -> 0x0000009b
            0: 0x00000100 -> 0x0007a1ec
            0: 0x0007a354 -> 0x0007a379
            0: 0x0007f7ff -> 0x0007f800
            0: 0x00100000 -> 0x00680000
            1: 0x00680000 -> 0x00e80000
            0: 0x00e80000 -> 0x01080000
            1: 0x01080000 -> 0x01280000
            0: 0x01280000 -> 0x01480000
            1: 0x01480000 -> 0x01680000
            0: 0x01680000 -> 0x01880000
            1: 0x01880000 -> 0x01a80000
            0: 0x01a80000 -> 0x01c80000
            1: 0x01c80000 -> 0x01e80000
      
      The fix is straight-forward.  isolate_migratepages() has to make a
      similar check to isolate_freepage to ensure that it never isolates pages
      from a zone it does not hold the LRU lock for.
      
      This was discovered in a 3.0-based kernel but it affects 3.1.x, 3.2.x
      and current mainline.
      Signed-off-by: default avatarMel Gorman <mgorman@suse.de>
      Acked-by: default avatarMichal Nazarewicz <mina86@mina86.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      dc908600
    • Xi Wang's avatar
      nilfs2: avoid overflowing segment numbers in nilfs_ioctl_clean_segments() · 1ecd3c7e
      Xi Wang authored
      nsegs is read from userspace.  Limit its value and avoid overflowing nsegs
      * sizeof(__u64) in the subsequent call to memdup_user().
      
      This patch complements 481fe17e ("nilfs2: potential integer overflow
      in nilfs_ioctl_clean_segments()").
      Signed-off-by: default avatarXi Wang <xi.wang@gmail.com>
      Cc: Haogang Chen <haogangchen@gmail.com>
      Acked-by: default avatarRyusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1ecd3c7e
  8. 08 Feb, 2012 8 commits