Repository navigation
Conversation
uart_rpmsg_init() ignored the result of uart_register(). When the name was already taken it still returned 0 and left the rpmsg callback registered, so the device created a second endpoint with no tty behind it. Return the error and undo the callback registration, and unregister the tty when only the console registration fails. Signed-off-by: yintao <yintao@xiaomi.com> Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
…ound Data written to the tty before the endpoint is bound to the remote side stays in the tx buffer until the next write. The nsh prompt is written that way, so it does not show up when cu connects. Start a tx transfer from the ns_bound callback. Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
uart_rpmsg_init() stored the caller's devname and cpuname pointers, so a caller passing a temporary buffer left them dangling. Copy both into the private data. Signed-off-by: wangshaoxin <wangshaoxin@xiaomi.com> Signed-off-by: Bowen Wang <wangbowen6@xiaomi.com>
CV-Bowen
requested review from
GUIDINGLI,
anchao and
xiaoxiang781216
as code owners
November 18, 2026 17:34
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Three fixes to the rpmsg tty (
drivers/serial/uart_rpmsg.c):handle the uart_register() failures:uart_rpmsg_init()ignored theresult of
uart_register(). With a name that is already taken itreturned 0 and left its rpmsg callback registered, so the device
created a second endpoint with no tty behind it. Return the error and
undo the registration; unregister the tty when only the console
registration fails.
flush the tx buffer once the endpoint is bound: data written beforethe endpoint is bound (for example the nsh prompt) stayed in the tx
buffer until the next write, so
cushowed no prompt on connect.keep a copy of the device and cpu names: the driver stored thecaller's string pointers.
Impact
uart_rpmsg_init()can now return an error where it returned 0 before.No other change.
Testing
Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
sim:rpserver + sim:rpproxy: the proxy's nsh console is a uart_rpmsg tty,
reached from the server with
cu /dev/ttyproxy; every proxy command ofthe baseline below goes through it.
Error path: a test-only patch (not in this PR) makes the server register
the same rpmsg tty twice in
rpmsg_serialinit():uart_rpmsg_init()-EEXIST)rpmsg dump all, endpoints namedrpmsg-ttyproxydest=4294967295)Prompt on connect: boot both, run
cu /dev/ttyproxyon the server andwait 5 s without pressing Enter (test-only script driving the two sim
processes):
cu /dev/ttyproxy(3 runs)master
this PR
No regression in rpmsg: sim:rpserver/rpproxy and qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC disabled, which current master needs for nxinit to start nsh there; unrelated to this change.