From: Oleksii Kurochko <oleksii.kurochko@gmail.com>
To: dmukhin@ford.com, xen-devel@lists.xenproject.org
Cc: andrew.cooper3@citrix.com, anthony.perard@vates.tech,
jbeulich@suse.com, julien@xen.org, michal.orzel@amd.com,
roger@xenproject.org, sstabellini@kernel.org,
xakep.amatop@gmail.com, dmukhin@xen.org
Subject: Re: [PATCH v8 02/26] xen/8250-uart: update definitions
Date: Thu, 12 Nov 2026 17:34:35 +0100 [thread overview]
Message-ID: <eec19191-8ee7-4d65-9d59-63b2bdac2b5f@gmail.com> (raw)
In-Reply-To: <20261111194800.1070016-3-dmukhin@ford.com>
On 11/11/26 8:47 PM, dmukhin@ford.com wrote:
[...]
> diff --git a/xen/include/xen/8250-uart.h b/xen/include/xen/8250-uart.h
> index d13352940c13..15cc4be5ff81 100644
> --- a/xen/include/xen/8250-uart.h
> +++ b/xen/include/xen/8250-uart.h
> @@ -32,6 +32,7 @@
> #define UART_MCR 0x04 /* Modem control */
> #define UART_LSR 0x05 /* line status */
> #define UART_MSR 0x06 /* Modem status */
> +#define UART_SCR 0x07 /* Scratch pad */
> #define UART_USR 0x1f /* Status register (DW) */
> #define UART_DLL 0x00 /* divisor latch (ls) (DLAB=1) */
> #define UART_DLM 0x01 /* divisor latch (ms) (DLAB=1) */
> @@ -42,6 +43,8 @@
> #define UART_IER_ETHREI 0x02 /* tx reg. empty */
> #define UART_IER_ELSI 0x04 /* rx line status */
> #define UART_IER_EMSI 0x08 /* MODEM status */
> +#define UART_IER_ALL_INTR \
> + (UART_IER_ERDAI | UART_IER_ETHREI | UART_IER_ELSI | UART_IER_EMSI)
>
> /* Interrupt Identification Register */
> #define UART_IIR_NOINT 0x01 /* no interrupt pending */
> @@ -51,12 +54,18 @@
> #define UART_IIR_THR 0x02 /* - tx reg. empty */
> #define UART_IIR_MSI 0x00 /* - MODEM status */
> #define UART_IIR_BSY 0x07 /* - busy detect (DW) */
> +#define UART_IIR_FE 0xc0 /* FIFO enabled (2 bits) */
>
> /* FIFO Control Register */
> #define UART_FCR_ENABLE 0x01 /* enable FIFO */
> #define UART_FCR_CLRX 0x02 /* clear Rx FIFO */
> #define UART_FCR_CLTX 0x04 /* clear Tx FIFO */
> -#define UART_FCR_DMA 0x10 /* enter DMA mode */
> +#define UART_FCR_DMA 0x08 /* enter DMA mode */
> +#define UART_FCR_RSRVD0 0x10 /* reserved; always 0 */
> +#define UART_FCR_RSRVD1 0x20 /* reserved; always 0 */
These bits are reserved on a 16550, but this header isn't
16550-specific. A few lines below, the same header defines
UART_FCR_T_TRIG_* as bits 5:4 (TX trigger level on 16650/16654/16C752/
Tegra, see the table there in this header). "reserved; always 0"
contradicts that. Since only the emulator needs to know what *it* treats
as reserved, I'd keep these masks local to ns16x50.c. Am I missing
something?
> +#define UART_FCR_RTB0 0x40 /* receiver trigger bit #0 */
> +#define UART_FCR_RTB1 0x80 /* receiver trigger bit #1 */
> +
These duplicate UART_FCR_TRG4/UART_FCR_TRG8 and UART_FCR_R_TRIG_01/
UART_FCR_R_TRIG_10 right below. The emulator only uses them as the mask
UART_FCR_RTB0 | UART_FCR_RTB1, which is UART_FCR_TRG14
(UART_FCR_R_TRIG_11). Could one of the existing names be used, or a
single mask be introduced, instead of a third set of names for the same
two bits?
> #define UART_FCR_TRG1 0x00 /* Rx FIFO trig lev 1 */
> #define UART_FCR_TRG4 0x40 /* Rx FIFO trig lev 4 */
> #define UART_FCR_TRG8 0x80 /* Rx FIFO trig lev 8 */
> @@ -98,9 +107,26 @@
> /* Modem Control Register */
> #define UART_MCR_DTR 0x01 /* Data Terminal Ready */
> #define UART_MCR_RTS 0x02 /* Request to Send */
> -#define UART_MCR_OUT2 0x08 /* OUT2: interrupt mask */
> +#define UART_MCR_OUT1 0x04 /* Output #1 */
> +#define UART_MCR_OUT2 0x08 /* Output #2 */
> #define UART_MCR_LOOP 0x10 /* Enable loopback test mode */
> +#define UART_MCR_RSRVD0 0x20 /* Reserved #0 */
> #define UART_MCR_TCRTLR 0x40 /* Access TCR/TLR (TI16C752, EFR[4]=1) */
> +#define UART_MCR_RSRVD1 0x80 /* Reserved #1 */
Same concern as for FCR: MCR[5] is the auto flow control enable on the
16750 and on DW_apb_uart (which this header covers, see UART_USR and
UART_IIR_BSY), and MCR[7] is the clock prescaler select on the
TI16C752, whose TCRTLR bit is defined right between the two. Local to
the emulator then?
> +
> +/* Modem Status Register */
> +#define UART_MSR_DCTS 0x01 /* Change in CTS */
> +#define UART_MSR_DDSR 0x02 /* Change in DSR */
> +#define UART_MSR_TERI 0x04 /* Change in RI */
> +#define UART_MSR_DDCD 0x08 /* Change in DCD */
> +#define UART_MSR_CTS 0x10
> +#define UART_MSR_DSR 0x20
> +#define UART_MSR_RI 0x40
> +#define UART_MSR_DCD 0x80
Nit: the last four have no comments, unlike everything else in the
file. Also, TERI is "trailing edge of RI" rather than "change in RI",
which matters because the emulator implements exactly that
(0 -> 1 of RI in ns16x50_io_write8()).
Since ns16x50.c already has UART_MCR_MASK built from the header's
definitions, "reserved" from the emulator's point of view is just
~UART_MCR_MASK (and similarly for FCR with a local mask of ENABLE |
CLRX | CLTX | DMA | TRG14), so neither the RSRVD nor the RTB macros are
needed in the common header.
The ns16550.c conversions look equivalent to me: 0x0A == RTS | OUT2,
and 0x90 == CTS | DCD under UART_MSR_STATUS.
> +#define UART_MSR_CHANGE \
> + (UART_MSR_DCTS | UART_MSR_DDSR | UART_MSR_TERI | UART_MSR_DDCD)
> +#define UART_MSR_STATUS \
> + (UART_MSR_CTS | UART_MSR_DSR | UART_MSR_RI | UART_MSR_DCD)
>
> /* Line Status Register */
> #define UART_LSR_DR 0x01 /* Data ready */
~ Oleksii
next prev parent reply other threads:[~2026-11-12 16:34 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 19:47 [PATCH v8 00/26] x86: introduce NS16550-compatible UART emulator dmukhin
2026-11-11 19:47 ` [PATCH v8 01/26] emul/vuart: introduce framework for UART emulators dmukhin
2026-11-12 15:35 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 02/26] xen/8250-uart: update definitions dmukhin
2026-11-12 14:49 ` Jan Beulich
2026-11-12 16:34 ` Oleksii Kurochko [this message]
2026-11-11 19:47 ` [PATCH v8 03/26] x86: fixup dependencies for asm/x86_emulate.h dmukhin
2026-11-12 20:25 ` Oleksii Kurochko
2026-11-13 7:20 ` Jan Beulich
2026-11-11 19:47 ` [PATCH v8 04/26] emul/ns16x50: implement emulator stub dmukhin
2026-11-13 11:48 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 05/26] emul/ns16x50: implement DLL/DLM registers dmukhin
2026-11-16 10:36 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 06/26] emul/ns16x50: implement SCR register dmukhin
2026-11-16 10:42 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 07/26] emul/ns16x50: implement IER/IIR registers dmukhin
2026-11-16 16:59 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 08/26] emul/ns16x50: implement LCR/LSR registers dmukhin
2026-11-17 16:33 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 09/26] emul/ns16x50: implement MCR/MSR registers dmukhin
2026-11-17 18:32 ` Oleksii Kurochko
2026-11-11 19:47 ` [PATCH v8 10/26] emul/ns16x50: implement RBR register dmukhin
2026-11-11 19:47 ` [PATCH v8 11/26] emul/ns16x50: implement THR register dmukhin
2026-11-11 19:47 ` [PATCH v8 12/26] emul/ns16x50: implement FCR register (write-only) dmukhin
2026-11-11 19:47 ` [PATCH v8 13/26] emul/ns16550: implement dump_state() hook dmukhin
2026-11-11 19:47 ` [PATCH v8 14/26] emul/vuart: add global UART emulator configuration knob dmukhin
2026-11-11 19:47 ` [PATCH v8 15/26] emul/ns16x50: enable emulator dmukhin
2026-11-11 19:47 ` [PATCH v8 16/26] emul/ns16x50: add Kconfig options dmukhin
2026-11-11 19:47 ` [PATCH v8 17/26] x86/domain: enable per-domain I/O port bitmaps dmukhin
2026-11-11 19:47 ` [PATCH v8 18/26] emul/ns16x50: resolve physical I/O port sharing dmukhin
2026-11-11 19:47 ` [PATCH v8 19/26] xen/domain: allocate d->irq_caps before arch-specific initialization dmukhin
2026-11-11 19:47 ` [PATCH v8 20/26] emul/ns16x50: resolve physical IRQ sharing dmukhin
2026-11-11 19:47 ` [PATCH v8 21/26] emul/ns16x50: implement IRQ emulation via vIOAPIC dmukhin
2026-11-11 19:47 ` [PATCH v8 22/26] MAINTAINERS: add myself as vUART framework maintainer dmukhin
2026-11-11 19:47 ` [PATCH v8 23/26] docs/fusa: add NS16x50 UART requirements for x86 dmukhin
2026-11-11 19:47 ` [PATCH v8 24/26] ci: add initial NS16550-compatible XTF test dmukhin
2026-11-11 19:47 ` [PATCH v8 25/26] ci: add smoke NS16550-compatible PVH Linux test dmukhin
2026-11-11 19:48 ` [PATCH v8 26/26] ci: do not merge: test dmukhin
2026-11-12 14:53 ` [PATCH v8 00/26] x86: introduce NS16550-compatible UART emulator Oleksii Kurochko
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=eec19191-8ee7-4d65-9d59-63b2bdac2b5f@gmail.com \
--to=oleksii.kurochko@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=dmukhin@ford.com \
--cc=dmukhin@xen.org \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger@xenproject.org \
--cc=sstabellini@kernel.org \
--cc=xakep.amatop@gmail.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.