28 Mar, 2018

4 commits

  • It is possible that incoming data arrives before the client driver has
    reached a point in the probe method where adequate context for handling
    the incoming message has been established.

    In the event that the client's callback function returns an error the
    message will be left on the FIFO and by invoking the receive handler
    after the device has been probed the message will be picked off the FIFO
    and the callback invoked again.

    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • For special rpmsg devices without a primary endpoint there is nothing to
    announce so don't call the backend announce create function if we didn't
    create an endpoint.

    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • The container_of macros should not use the same name for the parameter
    as the member to use for lookup, as this will result in a compilation
    error unless the passed parameter has the same name as the member.

    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • In an effort to pick up channels that are in a funky state we
    optimistically tried to open all channels that we found, with the
    addition that we failed if the other side did not handshake the opening.

    But as we're starting the modem a second time all channels are found -
    in a "funky" state - and we try to open them. But the modem firmware
    requires the IPCRTR to be up in order to initialize. So any channels we
    try to open before that will fail and will not be opened again.

    This takes care of the regression, at the cost of reintroducing the
    previous behavior of handling of channels with "funky" states.

    Reverts commit c12fc4519f60 ("rpmsg: smd: Create device for all channels")

    Reported-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

20 Mar, 2018

2 commits

  • Switch the tx_lock to a spinlock we allow clients to use rpmsg_trysend()
    from atomic context.

    In order to allow clients to sleep while waiting for space in the FIFO
    we release the lock temporarily around the delay; which should be
    replaced by sending a READ_NOTIF and waiting for the remote to signal
    us that space has been made available.

    Tested-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • By switching the tx_lock to a spinlock we allow clients to use
    rpmsg_trysend() from atomic context.

    The mutex was interruptable as it was previously held for the duration
    of some client waiting for available space in the FIFO, but this was
    recently changed to only be held temporarily - allowing us to replace it
    with a spinlock.

    Tested-by: Srinivas Kandagatla
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

18 Mar, 2018

2 commits


12 Feb, 2018

1 commit

  • This is the mindless scripted replacement of kernel use of POLL*
    variables as described by Al, done by this script:

    for V in IN OUT PRI ERR RDNORM RDBAND WRNORM WRBAND HUP RDHUP NVAL MSG; do
    L=`git grep -l -w POLL$V | grep -v '^t' | grep -v /um/ | grep -v '^sa' | grep -v '/poll.h$'|grep -v '^D'`
    for f in $L; do sed -i "-es/^\([^\"]*\)\(\\)/\\1E\\2/" $f; done
    done

    with de-mangling cleanups yet to come.

    NOTE! On almost all architectures, the EPOLL* constants have the same
    values as the POLL* constants do. But they keyword here is "almost".
    For various bad reasons they aren't the same, and epoll() doesn't
    actually work quite correctly in some cases due to this on Sparc et al.

    The next patch from Al will sort out the final differences, and we
    should be all done.

    Scripted-by: Al Viro
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

06 Feb, 2018

1 commit

  • Pull rpmsg updates from Bjorn Andersson:
    "This fixes a few issues found in the SMD and GLINK drivers and
    corrects the handling of SMD channels that are found in an
    (previously) unexpected state"

    * tag 'rpmsg-v4.16' of git://github.com/andersson/remoteproc:
    rpmsg: smd: Fix double unlock in __qcom_smd_send()
    rpmsg: glink: Fix missing mutex_init() in qcom_glink_alloc_channel()
    rpmsg: smd: Don't hold the tx lock during wait
    rpmsg: smd: Fail send on a closed channel
    rpmsg: smd: Wake up all waiters
    rpmsg: smd: Create device for all channels
    rpmsg: smd: Perform handshake during open
    rpmsg: glink: smem: Ensure ordering during tx
    drivers: rpmsg: remove duplicate includes
    remoteproc: qcom: Use PTR_ERR_OR_ZERO() in glink prob

    Linus Torvalds
     

19 Jan, 2018

1 commit


03 Jan, 2018

1 commit


19 Dec, 2017

6 commits

  • Holding the tx lock while waiting for tx-drain events from the remote
    side blocks try_send requests from failing quickly, so temporarily drop
    the tx lock while waiting.

    While this allows try_send to fail quickly it also could allow a
    subsequent send to succeed putting a smaller packet in the FIFO while
    we're waiting for room for our large packet. But as this lock is per
    channel we expect that clients with ordering concerns implements their
    own ordering mechanism.

    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • Move the check for a closed channel out from the tx-full loop to fail
    any send request on a non-open channel.

    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • It's possible to have multiple contexts waiting for new channel events
    and with an upcoming change it's possible to have multiple contexts
    waiting for a full FIFO. As such we need to wake them all up.

    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • Rather than selectively creating devices only for the channels that the
    remote have moved to "opening" state let's create devices for all
    channels found. The driver model will match drivers to the ones we care
    about and attempt to open these.

    The one case where this fails is if the user loads a firmware that lacks
    a particular channel of the previous firmware that was running, in which
    case we would find the old channel and attempt to probe it. The channel
    opening handshake will ensure this will result in a graceful failure.

    The result of this patch is that we will actively open the RPM channel
    even though it's left in a state other than "opening" after the boot
    loader's closing of the channel.

    Tested-by: Will Newton
    Reported-by: Jeremy McNicoll
    Reported-by: Will Newton
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • Validate the the remote side is opening the channel that we've found by
    performing a handshake when opening the channel.

    Tested-by: Will Newton
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     
  • Ensure the ordering of the fifo write and the update of the write index,
    so that the index is not updated before the data has landed in the fifo.

    Acked-By: Chris Lew
    Reported-by: Arun Kumar Neelakantam
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

07 Dec, 2017

1 commit


29 Nov, 2017

1 commit


18 Nov, 2017

1 commit

  • Pull rpmsg updates from Bjorn Andersson:

    - turn RPMSG_VIRTIO into a user selectable config

    - fix few bugs in GLINK

    - provide the support for specifying initial buffer sizes for GLINK
    channels.

    * tag 'rpmsg-v4.15' of git://github.com/andersson/remoteproc:
    rpmsg: glink: The mbox client knows_txdone
    rpmsg: glink: Add missing MODULE_LICENSE
    rpmsg: glink: Use best fit intent during tx
    rpmsg: glink: Add support to preallocate intents
    dt-bindings: soc: qcom: Support GLINK intents
    rpmsg: glink: Initialize the "intent_req_comp" completion variable
    rpmsg: Allow RPMSG_VIRTIO to be enabled via menuconfig or defconfig

    Linus Torvalds
     

16 Nov, 2017

1 commit


15 Nov, 2017

1 commit

  • The qcom_glink_native driver is missing a MODULE_LICENSE(), correct
    this.

    Fixes: 835764ddd9af ("rpmsg: glink: Move the common glink protocol implementation to glink_native.c")
    Cc: stable@vger.kernel.org
    Reported-by: Randy Dunlap
    Signed-off-by: Bjorn Andersson

    Bjorn Andersson
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

31 Oct, 2017

3 commits


26 Oct, 2017

1 commit

  • Currently, RPMSG_VIRTIO can only be enabled if some other kconfig
    option selects it. This does not allow it to be enabled for
    virtualized systems where Virtio RPMSG is available over Virtio
    MMIO or PCI transport.

    This patch updates RPMSG_VIRTIO kconfig option so that we can
    enable the VirtIO RPMSG driver via menuconfig or defconfig. The
    patch also removes "select RPMSG_VIRTIO" from various remoteproc
    kconfig options because it is now user selectable.

    Signed-off-by: Anup Patel
    Signed-off-by: Bjorn Andersson

    Anup Patel
     

11 Oct, 2017

2 commits


05 Sep, 2017

2 commits

  • The new switch cases for RPM_CMD_RX_DONE, RPM_CMD_RX_DONE_W_REUSE,
    RPM_CMD_RX_INTENT_REQ_ACK, RPM_CMD_INTENT and RPM_CMD_RX_INTENT_REQ from
    4 recent commits are not setting ret and so a later non-zero check on ret
    is testing on a garbage value in ret. Fix this by initializing ret to zero.

    Detected by CoverityScan CID#1455249 ("Uninitialized scalar variable")

    Fixes: 933b45da5d1d ("rpmsg: glink: Add support for TX intents)
    Fixes: dacbb35e930f ("glink: Receive and store the remote intent buffers")
    Fixes: 27b9c5b66b23 ("rpmsg: glink: Request for intents when unavailable")
    Fixes: 88c6060f5a7f ("rpmsg: glink: Handle remote rx done command")
    Signed-off-by: Colin Ian King
    Signed-off-by: Bjorn Andersson

    Colin Ian King
     
  • In the case where glink->intentless is true and the call
    to qcom_glink_tx fails then we have a condition where ret is
    non-zero and intent is null, causing a null pointer deference
    when setting intent->in_use to false. Add an extra check to
    only dereference intent if intent is non-null.

    Detected by: CoverityScan CID#1455247 ("Explicit null dereferenced")

    Fixes: 88c6060f5a7f ("rpmsg: glink: Handle remote rx done command")
    Signed-off-by: Colin Ian King
    Signed-off-by: Bjorn Andersson

    Colin Ian King
     

01 Sep, 2017

1 commit


31 Aug, 2017

1 commit


30 Aug, 2017

6 commits

  • Once the remote side sends a rx done ack, check for the intent reuse
    information from it and suitably discard or reuse the remote passed
    intent buffers.

    Acked-by: Arun Kumar Neelakantam
    Signed-off-by: Sricharan R
    Signed-off-by: Bjorn Andersson

    Sricharan R
     
  • While sending data, we search for suitable sized intent to map and
    simply fail if a intent is not found. Instead request for a intent of
    required size and wait till one is alloted.

    Acked-by: Arun Kumar Neelakantam
    Signed-off-by: Sricharan R
    Signed-off-by: Bjorn Andersson

    Sricharan R
     
  • While sending data, use the remote intent id buffer of suitable size
    that was passed by remote previously.

    Acked-by: Arun Kumar Neelakantam
    Signed-off-by: Sricharan R
    Signed-off-by: Bjorn Andersson

    Sricharan R
     
  • Just like we allocating and sending intent ids to remote, remote side
    allocates and sends us the intents as well. So save the intent ids and
    use it later while sending data targeting the appropriate intents based
    on the size.

    Acked-by: Arun Kumar Neelakantam
    Signed-off-by: Sricharan R
    Signed-off-by: Bjorn Andersson

    Sricharan R
     
  • Preallocate local intent buffers and pass the intent ids to the remote.
    This way there are some default intents available for the remote to
    start sending data without having to wait by sending intent requests. Do
    this by adding the rpmsg announce_create ops, which gets called right
    after the rpmsg device gets probed.

    Acked-by: Arun Kumar Neelakantam
    Signed-off-by: Sricharan R
    Signed-off-by: Bjorn Andersson

    Sricharan R
     
  • Send RX data receive ack to remote and also inform that local intent
    buffer is used and freed. This informs the remote to request for next
    set of intent buffers before doing a send operation.

    Acked-by: Arun Kumar Neelakantam
    Signed-off-by: Sricharan R
    Signed-off-by: Bjorn Andersson

    Sricharan R