Use the appropriate SPDX license identifier in the rpmsg SMD backend
driver source file and drop the previous boilerplate license text.
Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Attempt to acquire the APCS IPC through the mailbox framework and fall
back to the old syscon based approach, to allow us to move away from
using the syscon.
Reviewed-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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@linaro.org>
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@linaro.org>
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 c12fc4519f ("rpmsg: smd: Create device for all channels")
Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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 <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
if device_register() returned an error! Always use put_device()
to give up the reference initialized. unregister device for
other return error.
Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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/^\([^\"]*\)\(\<POLL$V\>\)/\\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 <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
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.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJaeJV5AAoJEAsfOT8Nma3FN8YP/1UjlQmor7yTeWUg37nordmy
ELjpNdjhBI6570XbeUdtBLi5LZLdYxkAxqt2J67YdnBkyL+EedlYS3tto7Rupo0e
P/kLokPJ6I+6FxwKftBi27mt8uyNdIx2nXXof2QhnjtVvXChoOj4e3BEi9KTfuMk
1LPOjldIXHN8ORibcYT5beEcyhZKdOJIsgC5qVsxJ27sLtFPVT9YHpSVVUPZIqO8
EAmSMUqzwCOaiOoEztl29izobYfBH2zR1wvLkq6TWyJXT9uhzkMuyBALbEzwzdBz
pgOm1YadEL8rHoSc2TI1sOGAfsQLxHN2h2/QwSeMeRGI1bF7w1EEmjlTKJkDdUug
+1om6t8XL08oodrCnkltSF2GGhVHaNOkdm0+sYySsWr6fPDAGO8rd4SimzMr1+9J
xIhOBeFfj4Q1xlreVgvvGPlJu1UBaJO9xK8bNShNy3irRLLRKObIAy9RkKfVD+qq
sW7xjjsDZ94rSSVGq7vs041ozBZKwa67YBn3eRuZvRHJqKyfVVIGduNx5Ld28qJJ
0Au8a4+g7fxXA0NdxYhwmHGOVEi7pb39U4aREzlJjy4fw1dGlTaEOCfjTXG2DRhs
TOuCpn2Rr9fbWjDDXUUEVQCNl8R3IoQfqUDF1VyXdPrGVeDtQvFgn9rlQFPZirt6
b184EJEuQCylkMTRqwV3
=J7N0
-----END PGP SIGNATURE-----
Merge tag 'rpmsg-v4.16' of git://github.com/andersson/remoteproc
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
We're not holding the lock here, so we shouldn't unlock.
Fixes: 178f3f75bb ("rpmsg: smd: Don't hold the tx lock during wait")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
[bjorn: renamed "out" label to further distinguish the two exit paths]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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@linaro.org>
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@linaro.org>
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@linaro.org>
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 <will.newton@gmail.com>
Reported-by: Jeremy McNicoll <jmcnicol@redhat.com>
Reported-by: Will Newton <will.newton@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
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 <will.newton@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This patch assigns the device node to the edge device, so that the edge
device drivers could read required device tree properties.
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Create and register a rpmsg device for use with the rpmsg user space
interface, allowing user space to access SMD channels.
Also provide the "rpmsg_name" device attribute to expose the edge name
in sysfs, allowing the user to write udev rules for specific rpmsg
devices and their children.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Add support for polling the status of the write buffer so that user
space can use rpmsg character devices in non-blocking mode.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Add support for the "label" property, used to give the edge a name other
than the one of the DT node. This allows the implementor to provide
consistently named edges when using the rpmsg character device.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Argument validation in public functions, function stubs for COMPILE_TEST-ing
clients, preparation for exposing rpmsg endponts to user space and minor
Qualcomm SMD fixes.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAABAgAGBQJYTz1VAAoJEAsfOT8Nma3FhPEP/RtU0W3x/rkjLzEECJBTyEDF
DUXnl8et2mi9mGaRN4FZ/1lgUXl2P0D/MlS6hnH/ScZEH6NNioS1t5lit0SSpcHq
oqM9i6gUYYRJbW6m3a4OECpX+hZ1R/en1B5AAJ9Hu+jNr8ZB2/pcafCfaH651v32
0tUng7rNa0icdm1lc7FGDHw/P0NYFmPkQmG8L/eExOafSLL/P2G+SyMMamBNlKZc
iZzZ6Vww7Le4mMst61hM9GSRlxslm/AeP8dPQYhV+7pLCXztKAAsUQJX74GynBLe
/pewePo+ZNlip//Okyodjz2iPkn3Yt6WFIHhVLuhlxDRZr/TOmqXsk2jBlS4oChh
mBkHk42OybywJp+wWWIPplfZQ5sJYBd1kNOGLX7f6aC9ngSK3u3PfKVFqFxB1Wrn
2Nuis2or+5fv84fIZcAAuyvm72BUrikLUjiKu0d7dCnR3B2/2voPAu8Lhb4AgVH6
qchqfX7LH5fdnBGkFIpIujQ2SjOGT+5zT+72IlPdqkCEHUy4eukUAC7WqMzCiDwO
i0IPREkddYX+6yhWrIRIX08u/sQ/r/VldpatSuuTlLsMWdBVRhZH4K8e2KBgtimB
0JkJPb/1sde1NH31k4V+WsJ4vp0FEj0MUbeHkyhWiC6DwH1GaG/KETX5oy9zhj6n
gTb8+gZvk1IaJPaDvUqe
=yDjM
-----END PGP SIGNATURE-----
Merge tag 'rpmsg-v4.10' of git://github.com/andersson/remoteproc
Pull rpmsg updates from Bjorn Andersson:
"Argument validation in public functions, function stubs for
COMPILE_TEST-ing clients, preparation for exposing rpmsg endponts
to user space and minor Qualcomm SMD fixes"
* tag 'rpmsg-v4.10' of git://github.com/andersson/remoteproc:
dt-binding: soc: qcom: smd: Add label property
rpmsg: qcom_smd: Correct return value for O_NONBLOCK
rpmsg: Provide function stubs for API
rpmsg: Handle invalid parameters in public API
rpmsg: Support drivers without primary endpoint
rpmsg: Introduce a driver override mechanism
rpmsg: smd: Reduce restrictions when finding channel
qcom_smd_send() should return -EAGAIN for non-blocking channels with
insufficient space, so that we can propagate this event to user space.
Fixes: 53e2822e56 ("rpmsg: Introduce Qualcomm SMD backend")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The edge registration functions is to be used from a remoteproc driver
to register and unregister an edge as the remote processor comes and
goes.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
SMD channels are created by the remotes in "opening" state, but
sometimes as we close and try to reopen them they linger in closing
state.
Following the search for a matching channel the create_ept() will verify
that the channel is in a suitable state, so we can lax the restrictions
of the search function to work around above difference in behaviour.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This introduces a new rpmsg backend for the Qualcomm SMD system,
allowing communication with various remote processors found in Qualcomm
platforms. The implementation is based on, and intends to replace,
drivers/soc/qcom/smd.c with the necessary adaptions for fitting with the
rpmsg core.
Based on original work by Sricharan R <sricharan@codeaurora.org>
Cc: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>