* [PATCH 5/7] Add termios2 support to ppc target
@ 2025-08-30 13:18 Luca Bonissi
0 siblings, 0 replies; 4+ messages in thread
From: Luca Bonissi @ 2025-08-30 13:18 UTC (permalink / raw)
To: Richard Henderson, Laurent Vivier; +Cc: qemu-devel
From db847c6abfd73f8d17462cd9358d6ec8dba1c473 Mon Sep 17 00:00:00 2001
From: Luca Bonissi <qemu@bonslack.org>
Date: Sat, 30 Aug 2025 14:52:32 +0200
Subject: [PATCH 5/7] Add termios2 support to ppc target
Signed-off-by: Luca Bonissi <qemu@bonslack.org>
---
linux-user/ppc/termbits.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
index eb226e0999..ae6ee8897c 100644
--- a/linux-user/ppc/termbits.h
+++ b/linux-user/ppc/termbits.h
@@ -20,6 +20,28 @@ struct target_termios {
target_speed_t c_ospeed; /* output speed */
};
+struct target_termios2 {
+ target_tcflag_t c_iflag; /* input mode flags */
+ target_tcflag_t c_oflag; /* output mode flags */
+ target_tcflag_t c_cflag; /* control mode flags */
+ target_tcflag_t c_lflag; /* local mode flags */
+ target_cc_t c_cc[TARGET_NCCS]; /* control characters */
+ target_cc_t c_line; /* line discipline */
+ target_speed_t c_ispeed; /* input speed */
+ target_speed_t c_ospeed; /* output speed */
+};
+
+struct target_ktermios {
+ target_tcflag_t c_iflag; /* input mode flags */
+ target_tcflag_t c_oflag; /* output mode flags */
+ target_tcflag_t c_cflag; /* control mode flags */
+ target_tcflag_t c_lflag; /* local mode flags */
+ target_cc_t c_cc[TARGET_NCCS]; /* control characters */
+ target_cc_t c_line; /* line discipline */
+ target_speed_t c_ispeed; /* input speed */
+ target_speed_t c_ospeed; /* output speed */
+};
+
/* c_cc character offsets */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
@@ -225,6 +247,8 @@ struct target_termios {
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TARGET_TIOCGRS485 0x542e
+#define TARGET_TIOCSRS485 0x542f
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 5/7] Add termios2 support to ppc target
@ 2025-10-31 13:26 Luca Bonissi
2025-12-15 16:52 ` Icenowy Zheng
2025-12-17 6:29 ` Vivian Wang
0 siblings, 2 replies; 4+ messages in thread
From: Luca Bonissi @ 2025-10-31 13:26 UTC (permalink / raw)
To: Richard Henderson, Laurent Vivier; +Cc: qemu-devel
From 2aa0a13da0da6e3a804359f24cc1298b97cda45c Mon Sep 17 00:00:00 2001
From: Luca Bonissi <qemu@bonslack.org>
Date: Fri, 31 Oct 2025 13:31:36 +0100
Subject: [PATCH 5/7] Add termios2 support to ppc target
Signed-off-by: Luca Bonissi <qemu@bonslack.org>
---
linux-user/ppc/termbits.h | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
index eb226e0999..ae6ee8897c 100644
--- a/linux-user/ppc/termbits.h
+++ b/linux-user/ppc/termbits.h
@@ -20,6 +20,28 @@ struct target_termios {
target_speed_t c_ospeed; /* output speed */
};
+struct target_termios2 {
+ target_tcflag_t c_iflag; /* input mode flags */
+ target_tcflag_t c_oflag; /* output mode flags */
+ target_tcflag_t c_cflag; /* control mode flags */
+ target_tcflag_t c_lflag; /* local mode flags */
+ target_cc_t c_cc[TARGET_NCCS]; /* control characters */
+ target_cc_t c_line; /* line discipline */
+ target_speed_t c_ispeed; /* input speed */
+ target_speed_t c_ospeed; /* output speed */
+};
+
+struct target_ktermios {
+ target_tcflag_t c_iflag; /* input mode flags */
+ target_tcflag_t c_oflag; /* output mode flags */
+ target_tcflag_t c_cflag; /* control mode flags */
+ target_tcflag_t c_lflag; /* local mode flags */
+ target_cc_t c_cc[TARGET_NCCS]; /* control characters */
+ target_cc_t c_line; /* line discipline */
+ target_speed_t c_ispeed; /* input speed */
+ target_speed_t c_ospeed; /* output speed */
+};
+
/* c_cc character offsets */
#define TARGET_VINTR 0
#define TARGET_VQUIT 1
@@ -225,6 +247,8 @@ struct target_termios {
#define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
#define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
#define TARGET_TIOCGSID 0x5429 /* Return the session ID of FD */
+#define TARGET_TIOCGRS485 0x542e
+#define TARGET_TIOCSRS485 0x542f
#define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
#define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /* Lock/unlock Pty */
#define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open the slave */
--
2.50.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 5/7] Add termios2 support to ppc target
2025-10-31 13:26 [PATCH 5/7] Add termios2 support to ppc target Luca Bonissi
@ 2025-12-15 16:52 ` Icenowy Zheng
2025-12-17 6:29 ` Vivian Wang
1 sibling, 0 replies; 4+ messages in thread
From: Icenowy Zheng @ 2025-12-15 16:52 UTC (permalink / raw)
To: Luca Bonissi, Richard Henderson, Laurent Vivier; +Cc: qemu-devel
在 2025-10-31星期五的 14:26 +0100,Luca Bonissi写道:
> > From 2aa0a13da0da6e3a804359f24cc1298b97cda45c Mon Sep 17 00:00:00
> > 2001
> From: Luca Bonissi <qemu@bonslack.org>
> Date: Fri, 31 Oct 2025 13:31:36 +0100
> Subject: [PATCH 5/7] Add termios2 support to ppc target
>
> Signed-off-by: Luca Bonissi <qemu@bonslack.org>
> ---
> linux-user/ppc/termbits.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
> index eb226e0999..ae6ee8897c 100644
> --- a/linux-user/ppc/termbits.h
> +++ b/linux-user/ppc/termbits.h
> @@ -20,6 +20,28 @@ struct target_termios {
> target_speed_t c_ospeed; /* output speed */
> };
>
> +struct target_termios2 {
> + target_tcflag_t c_iflag; /* input mode flags */
> + target_tcflag_t c_oflag; /* output mode flags */
> + target_tcflag_t c_cflag; /* control mode flags */
> + target_tcflag_t c_lflag; /* local mode flags */
> + target_cc_t c_cc[TARGET_NCCS]; /* control characters */
> + target_cc_t c_line; /* line discipline */
> + target_speed_t c_ispeed; /* input speed */
> + target_speed_t c_ospeed; /* output speed */
> +};
> +
> +struct target_ktermios {
> + target_tcflag_t c_iflag; /* input mode flags */
> + target_tcflag_t c_oflag; /* output mode flags */
> + target_tcflag_t c_cflag; /* control mode flags */
> + target_tcflag_t c_lflag; /* local mode flags */
> + target_cc_t c_cc[TARGET_NCCS]; /* control characters */
> + target_cc_t c_line; /* line discipline */
> + target_speed_t c_ispeed; /* input speed */
> + target_speed_t c_ospeed; /* output speed */
> +};
> +
Well your this patch seems to be introducing non-needed things for
PowerPC?
All 3 structures are the same here, and PPC never has a termios2
interface (except inside the internal of glibc).
> /* c_cc character offsets */
> #define TARGET_VINTR 0
> #define TARGET_VQUIT 1
> @@ -225,6 +247,8 @@ struct target_termios {
> #define TARGET_TIOCSBRK 0x5427 /* BSD compatibility */
> #define TARGET_TIOCCBRK 0x5428 /* BSD compatibility */
> #define TARGET_TIOCGSID 0x5429 /* Return the session ID of
> FD */
> +#define TARGET_TIOCGRS485 0x542e
> +#define TARGET_TIOCSRS485 0x542f
I don't think these two IOCTL's are related here.
Well they're missing, but they're not implemented either.
> #define TARGET_TIOCGPTN TARGET_IOR('T',0x30, unsigned int) /*
> Get Pty Number (of pty-mux device) */
> #define TARGET_TIOCSPTLCK TARGET_IOW('T',0x31, int) /*
> Lock/unlock Pty */
> #define TARGET_TIOCGPTPEER TARGET_IO('T', 0x41) /* Safely open
> the slave */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 5/7] Add termios2 support to ppc target
2025-10-31 13:26 [PATCH 5/7] Add termios2 support to ppc target Luca Bonissi
2025-12-15 16:52 ` Icenowy Zheng
@ 2025-12-17 6:29 ` Vivian Wang
1 sibling, 0 replies; 4+ messages in thread
From: Vivian Wang @ 2025-12-17 6:29 UTC (permalink / raw)
To: Luca Bonissi, Richard Henderson, Laurent Vivier; +Cc: qemu-devel, Icenowy Zheng
Hi,
As Icenowy has pointed out, there is no termios2 for ppc. The TCGETS2
constant for ppc in glibc is not actually usable in user code. However,
this gave me an idea...
On 10/31/25 21:26, Luca Bonissi wrote:
> >From 2aa0a13da0da6e3a804359f24cc1298b97cda45c Mon Sep 17 00:00:00 2001
> From: Luca Bonissi <qemu@bonslack.org>
> Date: Fri, 31 Oct 2025 13:31:36 +0100
> Subject: [PATCH 5/7] Add termios2 support to ppc target
>
> Signed-off-by: Luca Bonissi <qemu@bonslack.org>
> ---
> linux-user/ppc/termbits.h | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/linux-user/ppc/termbits.h b/linux-user/ppc/termbits.h
> index eb226e0999..ae6ee8897c 100644
> --- a/linux-user/ppc/termbits.h
> +++ b/linux-user/ppc/termbits.h
> @@ -20,6 +20,28 @@ struct target_termios {
> target_speed_t c_ospeed; /* output speed */
> };
>
> +struct target_termios2 {
> + target_tcflag_t c_iflag; /* input mode flags */
> + target_tcflag_t c_oflag; /* output mode flags */
> + target_tcflag_t c_cflag; /* control mode flags */
> + target_tcflag_t c_lflag; /* local mode flags */
> + target_cc_t c_cc[TARGET_NCCS]; /* control characters */
> + target_cc_t c_line; /* line discipline */
> + target_speed_t c_ispeed; /* input speed */
> + target_speed_t c_ospeed; /* output speed */
> +};
> +
The "nonsensical" target_termios2 here is identical to target_termios.
So, can we simply *rename* target_termios into target_termios2, and also
rename the constants like these to add a "2":
#define TARGET_TCGETS TARGET_IOR('t', 19, struct target_termios)
#define TARGET_TCSETS TARGET_IOW('t', 20, struct target_termios)
#define TARGET_TCSETSW TARGET_IOW('t', 21, struct target_termios)
#define TARGET_TCSETSF TARGET_IOW('t', 22, struct target_termios)
So that we repurpose the generic termios2 code to handle termios for
ppc? This would look like we're translating ppc guest TCGETS into host
TCGETS2, but the code would be written like it's doing a straight ppc
guest fake-TCGETS2 to host TCGETS2 translation.
Essentially, instead of thinking of ppc as "termios is different, and
there's no termios2", we can think of it as "termios2 only, no termios".
This would be ABI compatible with user programs and support the
non-standard baud rates use case that are checked in the glibc test
suite on ppc guest.
Icenowy's suggestion [1] to fix ppc host support basically does the
corresponding thing on the ppc host side. This looks slightly less
cursed than my idea but is basically the same deal.
Some extra handling may be needed to print the correct words in syscall
trace output.
Vivian "dramforever" Wang
[1]: https://lore.kernel.org/qemu-devel/4403eb94ddbb2934f1f75d94ce921f0f1078ad9f.camel@icenowy.me/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-12-17 6:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-31 13:26 [PATCH 5/7] Add termios2 support to ppc target Luca Bonissi
2025-12-15 16:52 ` Icenowy Zheng
2025-12-17 6:29 ` Vivian Wang
-- strict thread matches above, loose matches on Subject: below --
2025-08-30 13:18 Luca Bonissi
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).