From: Vivian Wang <wangruikang@iscas.ac.cn>
To: qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>,
Luca Bonissi <qemu@bonslack.org>,
Andreas Schwab <schwab@linux-m68k.org>,
Richard Henderson <richard.henderson@linaro.org>,
Vivian Wang <wangruikang@iscas.ac.cn>
Subject: [PATCH] linux-user: Add missing termios baud rates
Date: Tue, 02 Dec 2025 13:14:36 +0800 [thread overview]
Message-ID: <20251202-linux-user-higher-baud-rates-v1-1-14c49ed2474b@iscas.ac.cn> (raw)
Add missing definitions for TARGET_BOTHER for alpha, hppa, ppc, sh4,
sparc, and also missing standard baud rates for hppa.
Also add the missing baud rates in cflag_tbl.
In particular, BOTHER is required for the glibc test tst-termios-linux.
Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
---
checkpatch.pl complains about tabs in linux-user/syscall.c, which I have
used for consistency with existing code. I'm not sure how to handle
this.
The test tst-termios-linux requires termios2, which is provided by [1].
After that the test failure reported in [2] should be resolved by this
patch.
[1]: https://lore.kernel.org/r/745f18b6-ee62-4903-9a56-dcb903b610cf@bonslack.org/
[2]: https://lore.kernel.org/r/87cy606842.fsf@igel.home/
---
linux-user/alpha/termbits.h | 1 +
linux-user/hppa/termbits.h | 12 ++++++++++++
linux-user/ppc/termbits.h | 1 +
linux-user/sh4/termbits.h | 1 +
linux-user/sparc/termbits.h | 1 +
linux-user/syscall.c | 27 +++++++++++++++++++++++++++
6 files changed, 43 insertions(+)
diff --git a/linux-user/alpha/termbits.h b/linux-user/alpha/termbits.h
index 4a4b1e96f2..ad5362b89e 100644
--- a/linux-user/alpha/termbits.h
+++ b/linux-user/alpha/termbits.h
@@ -126,6 +126,7 @@ struct target_termios {
#define TARGET_B3000000 00034
#define TARGET_B3500000 00035
#define TARGET_B4000000 00036
+#define TARGET_BOTHER 00037
#define TARGET_CSIZE 00001400
#define TARGET_CS5 00000000
diff --git a/linux-user/hppa/termbits.h b/linux-user/hppa/termbits.h
index 11fd4eed62..f55748534f 100644
--- a/linux-user/hppa/termbits.h
+++ b/linux-user/hppa/termbits.h
@@ -100,10 +100,22 @@ struct target_termios {
#define TARGET_HUPCL 0002000
#define TARGET_CLOCAL 0004000
#define TARGET_CBAUDEX 0010000
+#define TARGET_BOTHER 0010000
#define TARGET_B57600 0010001
#define TARGET_B115200 0010002
#define TARGET_B230400 0010003
#define TARGET_B460800 0010004
+#define TARGET_B500000 0010005
+#define TARGET_B576000 0010006
+#define TARGET_B921600 0010007
+#define TARGET_B1000000 0010010
+#define TARGET_B1152000 0010011
+#define TARGET_B1500000 0010012
+#define TARGET_B2000000 0010013
+#define TARGET_B2500000 0010014
+#define TARGET_B3000000 0010015
+#define TARGET_B3500000 0010016
+#define TARGET_B4000000 0010017
#define TARGET_CIBAUD 002003600000 /* input baud rate (not used) */
#define TARGET_CMSPAR 010000000000 /* mark or space (stick) parity */
#define TARGET_CRTSCTS 020000000000 /* flow control */
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
index eb226e0999..71b398c83a 100644
--- a/linux-user/ppc/termbits.h
+++ b/linux-user/ppc/termbits.h
@@ -129,6 +129,7 @@ struct target_termios {
#define TARGET_B3000000 00034
#define TARGET_B3500000 00035
#define TARGET_B4000000 00036
+#define TARGET_BOTHER 00037
#define TARGET_CSIZE 00001400
#define TARGET_CS5 00000000
diff --git a/linux-user/sh4/termbits.h b/linux-user/sh4/termbits.h
index 28e79f2c9a..1f7c76e839 100644
--- a/linux-user/sh4/termbits.h
+++ b/linux-user/sh4/termbits.h
@@ -120,6 +120,7 @@ struct target_termios {
#define TARGET_HUPCL 0002000
#define TARGET_CLOCAL 0004000
#define TARGET_CBAUDEX 0010000
+#define TARGET_BOTHER 0010000
#define TARGET_B57600 0010001
#define TARGET_B115200 0010002
#define TARGET_B230400 0010003
diff --git a/linux-user/sparc/termbits.h b/linux-user/sparc/termbits.h
index 704bee1c42..c2082ebd27 100644
--- a/linux-user/sparc/termbits.h
+++ b/linux-user/sparc/termbits.h
@@ -128,6 +128,7 @@ struct target_termios {
#define TARGET_HUPCL 0x00000400
#define TARGET_CLOCAL 0x00000800
#define TARGET_CBAUDEX 0x00001000
+#define TARGET_BOTHER 0x00001000
/* We'll never see these speeds with the Zilogs, but for completeness... */
#define TARGET_B57600 0x00001001
#define TARGET_B115200 0x00001002
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 2060e561a2..9cceb22348 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -5779,6 +5779,33 @@ static const bitmask_transtbl cflag_tbl[] = {
{ TARGET_CBAUD, TARGET_B115200, CBAUD, B115200 },
{ TARGET_CBAUD, TARGET_B230400, CBAUD, B230400 },
{ TARGET_CBAUD, TARGET_B460800, CBAUD, B460800 },
+ { TARGET_CBAUD, TARGET_B500000, CBAUD, B500000 },
+ { TARGET_CBAUD, TARGET_B576000, CBAUD, B576000 },
+ { TARGET_CBAUD, TARGET_B921600, CBAUD, B921600 },
+ { TARGET_CBAUD, TARGET_B1000000, CBAUD, B1000000 },
+ { TARGET_CBAUD, TARGET_B1152000, CBAUD, B1152000 },
+ { TARGET_CBAUD, TARGET_B1500000, CBAUD, B1500000 },
+ { TARGET_CBAUD, TARGET_B2000000, CBAUD, B2000000 },
+
+ /* SPARC in particular is missing these higher baud rates */
+
+#if defined(TARGET_B2500000) && defined(B2500000)
+ { TARGET_CBAUD, TARGET_B2500000, CBAUD, B2500000 },
+#endif
+
+#if defined(TARGET_B3000000) && defined(B3000000)
+ { TARGET_CBAUD, TARGET_B3000000, CBAUD, B3000000 },
+#endif
+
+#if defined(TARGET_B3500000) && defined(B3500000)
+ { TARGET_CBAUD, TARGET_B3500000, CBAUD, B3500000 },
+#endif
+
+#if defined(TARGET_B4000000) && defined(B4000000)
+ { TARGET_CBAUD, TARGET_B4000000, CBAUD, B4000000 },
+#endif
+
+ { TARGET_CBAUD, TARGET_BOTHER, CBAUD, BOTHER },
{ TARGET_CSIZE, TARGET_CS5, CSIZE, CS5 },
{ TARGET_CSIZE, TARGET_CS6, CSIZE, CS6 },
{ TARGET_CSIZE, TARGET_CS7, CSIZE, CS7 },
---
base-commit: e5eb98b3cae77ffe7d142229a8225cedd8b78f07
change-id: 20251202-linux-user-higher-baud-rates-242ca0fb42f3
Best regards,
--
Vivian "dramforever" Wang
next reply other threads:[~2025-12-02 5:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-02 5:14 Vivian Wang [this message]
2025-12-02 11:52 ` [PATCH] linux-user: Add missing termios baud rates Andreas Schwab
2025-12-03 8:30 ` Vivian Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251202-linux-user-higher-baud-rates-v1-1-14c49ed2474b@iscas.ac.cn \
--to=wangruikang@iscas.ac.cn \
--cc=laurent@vivier.eu \
--cc=qemu-devel@nongnu.org \
--cc=qemu@bonslack.org \
--cc=richard.henderson@linaro.org \
--cc=schwab@linux-m68k.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).