Add support to handle receiving the zero copy data command. This will
extract the device address and size from the header and validate that
it is valid memory the device knows about through the memshare
framework. This command expects the memory that is being passed between
host and memshare has already been shared to the glink memshare list.
Change-Id: Ic17035d415ea65d1062be2db9a7e2fb840b0e658
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
In the initial version of zero copy, the memshare driver is supposed to
allocate buffers using the rproc device and GLINK should be able to
access the dma buffer through the rproc helpers.
This approach starts to fall apart when reserved memory regions are
needed for larger allocations. The q6v5_pas rproc can sometimes specify
a reserved region to allocate dma from, when this is present there is
no facility in rproc to point to a different dma region when allocating
from memshare.
This patch adds a interface for the memshare driver to register regions
directly with glink. When glink gets a zero copy packet, it can then
query and prepare cpu access using this interface instead of relying
on remoteproc.
This is a temporary interface until sharing buffers between remoteproc,
memshare and glink is accepeted.
Change-Id: I1438cea517fad55d996852cb17cb2f591190cf04
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Add an implementation for the hooks of rpmsg_rx_done. If a client
signals they want to hold onto a buffer with RPMSG_DEFER in the rx_cb,
glink will move that intent to a deferred cleanup list. On the new
rpmsg rx_done call, the glink transport will search this deferred
cleanup list for the matching buffer and release the intent.
Change-Id: I9184c62c552fc271366f2ecdc2901cad1813dc48
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Expose a direct interface for the signal interface from the glink
transport. This is required for tethered data call functionality. This
change should be reverted once the patch to add the signal interface
into rpmsg is merged upstream.
Change-Id: I1df466579352660a276312a304c9eac88f113c60
Signed-off-by: Chris Lew <quic_clew@quicinc.com>
Glink irq should be wakeup capable, to achieve this irq is marked
with enable_irq_wake().
There are some use cases where glink communication is required in system
suspend path and glink interrupt handler needs to be run immediately.
But wakeup cpabale interrupts even if received during suspend will not
run immediately, this will be marked pending and run when system resumes
from suspend. In such scenario there can be a potential deadock in suspend
path due to any irq thread which is waiting for glink interrupt completion
while glink interrupt cannot be handled immediately.
One such use case is usb plugin interrupt received during suspend, which
calls regulator api to communicate with rpm over glink and waits for rpm
ack. RPM ack cannot be processed because glink interrupt received from rpm
goes in pending state. Suspend path is blocked because regulator irq thread
is still waiting.
So there is requirement to run glink interrupt handler in suspend path at
the same time making it wakeup capable. IRQ frameworks forbids usage of
both IRQF_NO_SUSPEND and enable_irq_wake() together. This patch adds
IRQF_NO_SUSPEND and pm_system_wakeup() for glink irq to implement this
requirement.
Change-Id: I1da199c9e10c640bb84d00e569c4fafc5c104d24
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
Glink pipe indices are reset by apps in the remoteproc
subdev stop path. There is a chance that the remote that
is being shutdown is in the middle of reading from the
pipe. This causes the remote that is shutting down
gracefully to crash as index 0 is invalid.
Remove the fifo reset from the remoteproc subdev stop
path. Register a function pointer with remoteproc for the
subdev to be called during prepare stage of ssr. Split
the glink probe to have pipes initialization, rx thread
creation and setting up glink structures happen in prepare
stage and version negotiation and char device creation in
prepare stage.
Given that the pipes get re-initialized during prepare
stage, the fifo indices will be intact until after the
remote has been shutdown completely and reset before the
remote is up again.
Spliting glink probe to prepare (in BEFORE_POWERUP) and
start (in AFTER_POWERUP) stage in spss results in glink
link up callback arriving earlier on spss when one of the
destination services is not yet created. This results in
spss not finishing the boot flow after ssr.
Adding glink fifo reset to be called as part of BEFORE_SHUTDOWN
if the underlying driver has callbacks setup for it as is the
case in spss rpmsg driver.
Change-Id: I74cae7ce49cb212af9e7ec2391956339c3427aec
Signed-off-by: Jay Jayanna <jayanna@codeaurora.org>
Some remote procs do not initialize the pipe when they are started
and assume the data in the pipe descriptors is valid. Add an optional
handler to clear the pipe descriptors and call this during removal
of the glink device to ensure a clean restart of glink.
Change-Id: I62871cc5d6fd052e234843645299fdc87a71185f
Signed-off-by: Chris Lew <clew@codeaurora.org>
Use the appropriate SPDX license identifier in various rpmsg
glink driver source files 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>
To fully read the received rx data from FIFO both the command and data
has to be read. Currently we read command, data separately and process
them. By adding an offset parameter to RX FIFO peak accessor, command
and data can be read together, simplifying things. So introduce this.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Intents are nothing but pre-allocated buffers of appropriate size that
are allocated on the local side and communicated to the remote side and
the remote stores the list of intent ids that it is informed.
Later when remote side is intenting to send data, it picks up a right
intent (based on the size) and sends the data buffer and the intent id.
Local side receives the data and copies it to the local intent buffer.
The whole idea is to avoid stalls on the transport for allocating
memory, used for copy based transports.
When the remote request to allocate buffers using CMD_RX_INTENT_REQ, we
allocate buffers of requested size, store the buffer id locally and also
communicate the intent id to the remote.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
G-link supports a version number and feature flags for each transport.
A combination of the version number and feature flags enable/disable:
(*) G-Link software updates for each edge
(*) Individual features for each edge
Endpoints negotiate both the version and the supported flags when
the transport is opened and they cannot be changed after negotiation has
been completed.
Each full implementation of G-Link must support a minimum of the current
version, the previous version, and the base negotiation version called v0.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The glink protocol supports different types of transports (shared
memory). With the core protocol remaining the same, the way the
transport's memory is probed and accessed is different. So add support
for glink's smem based transports.
Adding a new smem transport register function and the fifo accessors for
the same.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Move the common part of glink core protocol implementation to
glink_native.c that can be shared with the smem based glink
transport in the later patches.
Acked-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Sricharan R <sricharan@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>