The input sanitization should not be fatal. It still is, but add error
messages and return a different number to signify that there may still
be a chance to recover.
Other compilation units do not know how many elements there are in the
array. Add a number with the number of interfaces so other compilation
units can iterate over every interface.
The interface array should be exported for use by the local remotectl
interface. Rename the array to mitigate name collisions and declare it
in the header so it can be used elsewhere.
The program should only attach to sensorspd, which uses the reverse
tunnel the most out of the protection domains. Do not create a static
protection domain for audio so the program communicates with sensorspd.
The number of output buffers set in the remote scalars variable changes
when the next procedure call is received. Set a variable before the
remote scalars change so the correct amount of output buffers can be
freed.
Fixes: e2ba6e8c2e ("fastrpc: listener: add local endpoint")
The amount of input buffers might be different from the amount of output
buffers. Free the correct amount of input buffers so there is no
out-of-bounds memory access.
Before this commit, the compiler must have generated machine code that
returns the context. Since that is not reliable, the created context
should be explicitly returned.
Fixes: 9adc9ea326 ("add fastrpc")
The reverse tunnel has at least some competence in interacting with the
remote processor. Add a local endpoint so the Application Processor can
respond to ADSP requests using this.
The reverse tunnel needs some structure definitions for RPC handlers so
it should have its own header file. Since it exports an event loop, it
should be declared in the header file instead of the source files that
call it.
The listener can't do its entire job in a single 48-line function. The
invocation of the function on the local end can be separate from the
argument processing and adsp_listener_next2 RPC. Move the
remoteproc-side handling to a new function.
The decoder context stores a state that is not useful when there is no
more I/O buffer decoding to be done. The I/O buffers are not only useful
for decoding, but encoding as well. Replace the decoder destructor with
a decoder finish function to free the encapsulating decoder context, and
a generic I/O buffer destructor.
The decoder expects a raw buffer that can be written to, even though
there is no limitation that requires this. Character pointers are
convenient for indexing, but inconvenient for casting to different
objects (like parameter sets of 32-bit named integers). Accept generic
pointers to read-only memory as raw buffers and define the pointers in
the I/O buffers as generic.
The function definitions used to call fastrpc() are silly. They expect
to only be used in one compilation unit, otherwise there is a linker
error. The definitions are not marked as constant, even though changing
the definition at runtime is discouraged and has no practical use.
Properly export the function definitions for the interface.
The function definitions used to call fastrpc() are silly. They expect
to only be used in one compilation unit, otherwise there is a linker
error. The definitions are not marked as constant, even though changing
the definition at runtime is discouraged and has no practical use.
Properly export the function definitions for the interface.
The function definitions used to call fastrpc() are silly. They expect
to only be used in one compilation unit, otherwise there is a linker
error. The definitions are not marked as constant, even though changing
the definition at runtime is discouraged and has no practical use.
Properly export the function definitions for the interface.
These macros are useful every time the client needs to interact with
FastRPC directly, like with the listener. Move them to the main header
so they don't need to be added to every file that uses them.
The listener prints out an error messaage using stdio declarations, but
doesn't include them. Include them now to resolve a compilation error.
Fixes: 774d10286f ("fastrpc: move fastrpc reverse tunnel to its own file")
The format of the returned input buffers is specified in
fastrpc.git/inc/listener_buf.h. Add a decoder for the input buffers so
they can be interpreted by functions on the Application Processor side.
The scalars argument is an output and its initialization does not have
any effect. Instead, the result is set to the highest possible 32-bit
unsigned integer value. The context should always be set to zero. Pass
the correct arguments to the procedure call as specified in
fastrpc.git/src/listener_android.c.