* [PATCH] linux-user: Add missing termios baud rates
@ 2025-12-02 5:14 Vivian Wang
2025-12-02 11:52 ` Andreas Schwab
0 siblings, 1 reply; 3+ messages in thread
From: Vivian Wang @ 2025-12-02 5:14 UTC (permalink / raw)
To: qemu-devel
Cc: Laurent Vivier, Luca Bonissi, Andreas Schwab, Richard Henderson,
Vivian Wang
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Add missing termios baud rates
2025-12-02 5:14 [PATCH] linux-user: Add missing termios baud rates Vivian Wang
@ 2025-12-02 11:52 ` Andreas Schwab
2025-12-03 8:30 ` Vivian Wang
0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2025-12-02 11:52 UTC (permalink / raw)
To: Vivian Wang; +Cc: qemu-devel, Laurent Vivier, Luca Bonissi, Richard Henderson
On Dez 02 2025, Vivian Wang wrote:
> 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.
I still get a lot of errors with the two patches:
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:196: c_ispeed = 75, expected 1200
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:269: ospeed 75 ispeed 1200: kernel c_ispeed == 75, expected 1200
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:274: ospeed 75 ispeed 1200: kernel CIBAUD = __B0 (000000), expected __B1200 (000011)
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:196: c_ispeed = 9600, expected 456789
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:269: ospeed 9600 ispeed 456789: kernel c_ispeed == 9600, expected 456789
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:274: ospeed 9600 ispeed 456789: kernel CIBAUD = __B0 (000000), expected __BOTHER (010000)
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:196: c_ispeed = 54321, expected 1234567890
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:269: ospeed 54321 ispeed 1234567890: kernel c_ispeed == 54321, expected 1234567890
error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:274: ospeed 54321 ispeed 1234567890: kernel CIBAUD = __B0 (000000), expected __BOTHER (010000)
...
error: 8343 test failures
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] linux-user: Add missing termios baud rates
2025-12-02 11:52 ` Andreas Schwab
@ 2025-12-03 8:30 ` Vivian Wang
0 siblings, 0 replies; 3+ messages in thread
From: Vivian Wang @ 2025-12-03 8:30 UTC (permalink / raw)
To: Andreas Schwab
Cc: qemu-devel, Laurent Vivier, Luca Bonissi, Richard Henderson
Hi Andreas,
On 12/2/25 19:52, Andreas Schwab wrote:
> On Dez 02 2025, Vivian Wang wrote:
>
>> 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.
> I still get a lot of errors with the two patches:
>
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:196: c_ispeed = 75, expected 1200
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:269: ospeed 75 ispeed 1200: kernel c_ispeed == 75, expected 1200
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:274: ospeed 75 ispeed 1200: kernel CIBAUD = __B0 (000000), expected __B1200 (000011)
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:196: c_ispeed = 9600, expected 456789
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:269: ospeed 9600 ispeed 456789: kernel c_ispeed == 9600, expected 456789
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:274: ospeed 9600 ispeed 456789: kernel CIBAUD = __B0 (000000), expected __BOTHER (010000)
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:196: c_ispeed = 54321, expected 1234567890
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:269: ospeed 54321 ispeed 1234567890: kernel c_ispeed == 54321, expected 1234567890
> error: ../sysdeps/unix/sysv/linux/tst-termios-linux.c:274: ospeed 54321 ispeed 1234567890: kernel CIBAUD = __B0 (000000), expected __BOTHER (010000)
> ...
> error: 8343 test failures
>
Thanks for catching this, and sorry for the mistake. I had apparently
had a dirty version of the test files that missed these split speed tests.
I will fix these in the next version.
Vivian "dramforever" Wang
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-03 8:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-02 5:14 [PATCH] linux-user: Add missing termios baud rates Vivian Wang
2025-12-02 11:52 ` Andreas Schwab
2025-12-03 8:30 ` Vivian Wang
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).