From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: dmukhin@ford.com, xen-devel@lists.xenproject.org,
Andrew Cooper <andrew.cooper3@citrix.com>,
Jan Beulich <jbeulich@suse.com>, Julien Grall <julien@xen.org>
Subject: Re: [PATCH v2 33/35] x86/domain: implement domain_has_vuart()
Date: Mon, 16 Dec 2024 09:40:29 +0100 [thread overview]
Message-ID: <Z1_nfT8YfIkYuikB@macbook.local> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2412131245300.463523@ubuntu-linux-20-04-desktop>
On Fri, Dec 13, 2024 at 12:45:34PM -0800, Stefano Stabellini wrote:
> On Fri, 13 Dec 2024, Roger Pau Monné wrote:
> > On Thu, Dec 05, 2024 at 08:42:03PM -0800, Denis Mukhin via B4 Relay wrote:
> > > From: Denis Mukhin <dmukhin@ford.com>
> > >
> > > Add new emulation flag for virtual UART on x86 and plumb it through the stack.
> > >
> > > This change enables NS8250 emulator initialization.
> > >
> > > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> > > ---
> > > tools/libs/light/libxl_x86.c | 6 +++++-
> > > tools/ocaml/libs/xc/xenctrl.ml | 1 +
> > > tools/ocaml/libs/xc/xenctrl.mli | 1 +
> > > tools/python/xen/lowlevel/xc/xc.c | 4 +---
> > > xen/arch/x86/domain.c | 8 +++++---
> > > xen/arch/x86/include/asm/domain.h | 7 ++++---
> > > xen/include/public/arch-x86/xen.h | 14 +++++++++++++-
> > > 7 files changed, 30 insertions(+), 11 deletions(-)
> > >
> > > diff --git a/tools/libs/light/libxl_x86.c b/tools/libs/light/libxl_x86.c
> > > index a3164a3077fec7e1b81a34074894dc646954a49a..de5f05e18cb0671bb031b101b9a7159eb0fe0178 100644
> > > --- a/tools/libs/light/libxl_x86.c
> > > +++ b/tools/libs/light/libxl_x86.c
> > > @@ -8,7 +8,11 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
> > > {
> > > switch(d_config->c_info.type) {
> > > case LIBXL_DOMAIN_TYPE_HVM:
> > > - config->arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI);
> > > + config->arch.emulation_flags = XEN_X86_EMU_ALL;
> > > + config->arch.emulation_flags &= ~XEN_X86_EMU_VPCI;
> > > + /* Virtual UART is selected at Xen build time */
> > > + config->arch.emulation_flags &= ~XEN_X86_EMU_VUART;
> > > +
> > > if (!libxl_defbool_val(d_config->b_info.u.hvm.pirq))
> > > config->arch.emulation_flags &= ~XEN_X86_EMU_USE_PIRQ;
> > > break;
> > > diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml
> > > index 2690f9a92316b812ad3d3ff0e1c36823070adb4a..647239b3e55e88b00eb8e9773a5267894cbbae54 100644
> > > --- a/tools/ocaml/libs/xc/xenctrl.ml
> > > +++ b/tools/ocaml/libs/xc/xenctrl.ml
> > > @@ -47,6 +47,7 @@ type x86_arch_emulation_flags =
> > > | X86_EMU_PIT
> > > | X86_EMU_USE_PIRQ
> > > | X86_EMU_VPCI
> > > + | X86_EMU_VUART
> > >
> > > type x86_arch_misc_flags =
> > > | X86_MSR_RELAXED
> > > diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.mli
> > > index febbe1f6ae3f10c5abe45eaa3c06a8a67d9ba268..4f5f64c786e83e8a0c3dd3cdb0460f7095de4a62 100644
> > > --- a/tools/ocaml/libs/xc/xenctrl.mli
> > > +++ b/tools/ocaml/libs/xc/xenctrl.mli
> > > @@ -41,6 +41,7 @@ type x86_arch_emulation_flags =
> > > | X86_EMU_PIT
> > > | X86_EMU_USE_PIRQ
> > > | X86_EMU_VPCI
> > > + | X86_EMU_VUART
> > >
> > > type x86_arch_misc_flags =
> > > | X86_MSR_RELAXED
> > > diff --git a/tools/python/xen/lowlevel/xc/xc.c b/tools/python/xen/lowlevel/xc/xc.c
> > > index 9feb12ae2b16e48cb5d0c3c45044ae226f152f2d..e54308956efc7061d58d2166ec9a95bc1dcd1781 100644
> > > --- a/tools/python/xen/lowlevel/xc/xc.c
> > > +++ b/tools/python/xen/lowlevel/xc/xc.c
> > > @@ -159,9 +159,7 @@ static PyObject *pyxc_domain_create(XcObject *self,
> > >
> > > #if defined (__i386) || defined(__x86_64__)
> > > if ( config.flags & XEN_DOMCTL_CDF_hvm )
> > > - config.arch.emulation_flags = XEN_X86_EMU_ALL &
> > > - ~(XEN_X86_EMU_VPCI |
> > > - XEN_X86_EMU_USE_PIRQ);
> > > + config.arch.emulation_flags = XEN_X86_EMU_HVM_ALLOWABLE;
> > > #elif defined (__arm__) || defined(__aarch64__)
> > > config.arch.gic_version = XEN_DOMCTL_CONFIG_GIC_NATIVE;
> > > #else
> > > diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c
> > > index c88d422a64544531c1e1058fa484364bb4277d1e..439da7adc92a3a8eb481075bf834da5f9670dd54 100644
> > > --- a/xen/arch/x86/domain.c
> > > +++ b/xen/arch/x86/domain.c
> > > @@ -752,10 +752,10 @@ static bool emulation_flags_ok(const struct domain *d, uint32_t emflags)
> > > if ( is_hardware_domain(d) &&
> > > emflags != (X86_EMU_VPCI | X86_EMU_LAPIC | X86_EMU_IOAPIC) )
> > > return false;
> > > +
> > > + emflags &= ~X86_EMU_VUART;
> >
> > I think you want to allow X86_EMU_VUART only for domains created by
> > Xen itself, so X86_EMU_VUART can only be valid if system_state <
> > SYS_STATE_active.
> >
> > > if ( !is_hardware_domain(d) &&
> > > - /* HVM PIRQ feature is user-selectable. */
> > > - (emflags & ~X86_EMU_USE_PIRQ) !=
> > > - (X86_EMU_ALL & ~(X86_EMU_VPCI | X86_EMU_USE_PIRQ)) &&
> > > + xen_emflags_allowable(emflags) != XEN_X86_EMU_HVM_ALLOWABLE &&
> > > emflags != X86_EMU_LAPIC )
> > > return false;
> > > }
> > > @@ -806,6 +806,8 @@ int arch_domain_create(struct domain *d,
> > >
> > > emflags = config->arch.emulation_flags;
> > >
> > > + if ( IS_ENABLED(CONFIG_HAS_VUART_NS8250) && is_hvm_domain(d) )
> > > + emflags |= XEN_X86_EMU_VUART;
> >
> > Doesn't this need to be limited to domains created by Xen itself, as
> > otherwise it's the toolstack that should specify the XEN_X86_EMU_VUART
> > flag, and even then the recommendation would be to use the vUART from
> > QEMU?
>
> While I agree with you that this feature is really useful mostly for the
> domains created by Xen, as for those there is no other way to get early
> output, I think Denis has been also testing successfully this feature
> with PVH or HVM domains created by the toolstack.
>
> I'll let you decide whether you want to expose the feature to xl created
> domains, but yes my understanding is that they already work with this
> series. One benefit would be that for PVH domains you could get early
> output without having to start QEMU, but I'll leave this to you.
I'm not opposed to allowing usage of the Xen emulated uart for
toolstack created domains, but then the option needs to be integrated
with xl/libxl IMO, so that it can be specified in the xl.cfg file, and
propagated from the toolstack into Xen using the emulation_flags
field. Just like all other emulated devices that are controlled by
emulation_flags.
Thanks, Roger.
next prev parent reply other threads:[~2024-12-16 8:40 UTC|newest]
Thread overview: 218+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 4:41 [PATCH v2 00/35] Introduce NS8250 UART emulator Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-06 4:41 ` [PATCH v2 01/35] xen: introduce resource.h Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:13 ` Jan Beulich
2025-01-04 2:23 ` Denis Mukhin
2024-12-11 11:01 ` Roger Pau Monné
2025-01-04 3:10 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 02/35] xen/irq: introduce NO_IRQ Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:17 ` Jan Beulich
2025-01-04 2:26 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 03/35] xen/ctype: introduce isconsole() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:22 ` Jan Beulich
2025-01-04 2:31 ` Denis Mukhin
2025-01-06 8:55 ` Jan Beulich
2024-12-06 4:41 ` [PATCH v2 04/35] arm/vuart: use guest_printk() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-06 4:41 ` [PATCH v2 05/35] arm/vuart: make domain_has_vuart() public Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-06 4:41 ` [PATCH v2 06/35] riscv/domain: introduce domain_has_vuart() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-06 4:41 ` [PATCH v2 07/35] ppc/domain: " Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:24 ` Jan Beulich
2024-12-06 4:41 ` [PATCH v2 08/35] x86/domain: " Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:26 ` Jan Beulich
2025-01-04 2:34 ` Denis Mukhin
2024-12-11 15:13 ` Roger Pau Monné
2025-01-04 3:11 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 09/35] x86/domain: print emulation_flags Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:30 ` Jan Beulich
2025-01-04 3:55 ` Denis Mukhin
2024-12-11 15:19 ` Roger Pau Monné
2024-12-12 11:53 ` Jan Beulich
2024-12-12 12:11 ` Roger Pau Monné
2024-12-12 12:50 ` Jan Beulich
2025-01-04 3:56 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 10/35] xen/domain: add get_initial_domain_id() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:50 ` Jan Beulich
2025-01-04 2:50 ` Denis Mukhin
2024-12-11 16:50 ` Roger Pau Monné
2025-01-04 4:44 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 11/35] xen/domain: enable max_init_domid for all architectures Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:57 ` Jan Beulich
2025-01-04 2:51 ` Denis Mukhin
2024-12-11 17:00 ` Roger Pau Monné
2025-01-04 3:13 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 12/35] xen/console: move vpl011-related code to vpl011 emulator Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 13:33 ` Jan Beulich
2025-01-04 2:49 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 13/35] xen/console: rename console_input_domain Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 14:01 ` Jan Beulich
2025-01-04 2:53 ` Denis Mukhin
2024-12-11 17:17 ` Roger Pau Monné
2025-01-04 3:13 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 14/35] xen/console: rename switch_serial_input() to console_find_owner() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 14:13 ` Jan Beulich
2024-12-11 17:22 ` Roger Pau Monné
2025-01-04 3:14 ` Denis Mukhin
2025-01-04 2:54 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 15/35] xen/console: rename console_rx to console_owner Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 14:23 ` Jan Beulich
2024-12-12 8:58 ` Roger Pau Monné
2025-01-04 3:20 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 16/35] xen/console: introduce printk_common() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 14:27 ` Jan Beulich
2025-01-04 2:57 ` Denis Mukhin
2025-01-06 9:04 ` Jan Beulich
2024-12-12 9:14 ` Roger Pau Monné
2024-12-12 11:57 ` Jan Beulich
2024-12-12 12:15 ` Roger Pau Monné
2024-12-12 12:52 ` Jan Beulich
2024-12-12 15:25 ` Roger Pau Monné
2024-12-13 1:03 ` Stefano Stabellini
2025-01-04 4:11 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 17/35] xen/console: introduce consoled_is_enabled() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 14:31 ` Jan Beulich
2025-01-04 3:00 ` Denis Mukhin
2025-01-06 9:05 ` Jan Beulich
2024-12-12 9:31 ` Roger Pau Monné
2025-01-04 3:21 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 18/35] xen/console: introduce use of 'is_console' flag Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 14:52 ` Jan Beulich
2025-01-04 3:05 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 19/35] xen/console: introduce console_set_owner() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 15:02 ` Jan Beulich
2025-01-04 3:07 ` Denis Mukhin
2025-01-06 9:08 ` Jan Beulich
2024-12-12 10:12 ` Roger Pau Monné
2024-12-12 11:59 ` Jan Beulich
2024-12-12 12:16 ` Roger Pau Monné
2025-01-04 3:31 ` Denis Mukhin
2025-01-04 3:30 ` Denis Mukhin
2025-01-06 9:58 ` Jan Beulich
2025-01-06 20:03 ` Denis Mukhin
2025-01-07 8:37 ` Jan Beulich
2024-12-06 4:41 ` [PATCH v2 20/35] xen/console: introduce console_owner_domid() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 22:11 ` Jason Andryuk
2024-12-11 7:33 ` Jan Beulich
2025-01-04 4:16 ` Denis Mukhin
2025-01-04 4:12 ` Denis Mukhin
2024-12-11 7:28 ` Jan Beulich
2025-01-04 4:15 ` Denis Mukhin
2025-01-06 9:14 ` Jan Beulich
2025-01-06 18:48 ` Stefano Stabellini
2025-01-07 8:40 ` Jan Beulich
2025-01-07 23:40 ` Stefano Stabellini
2025-01-08 7:28 ` Jan Beulich
2025-01-08 8:04 ` Roger Pau Monné
2025-01-08 8:13 ` Jan Beulich
2025-01-08 8:35 ` Roger Pau Monné
2025-01-08 22:15 ` Denis Mukhin
2025-01-09 0:29 ` Stefano Stabellini
2025-01-09 8:06 ` Roger Pau Monné
2025-01-09 23:46 ` Stefano Stabellini
2025-01-10 1:39 ` Denis Mukhin
2025-01-09 8:25 ` Jan Beulich
2025-01-09 8:27 ` Jan Beulich
2025-01-10 1:34 ` Denis Mukhin
2024-12-12 10:18 ` Roger Pau Monné
2025-01-04 4:11 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 21/35] xen/console: introduce console_init_owner() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-10 22:30 ` Jason Andryuk
2024-12-11 7:31 ` Jan Beulich
2025-01-04 3:22 ` Denis Mukhin
2024-12-12 10:23 ` Roger Pau Monné
2025-01-04 3:23 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 22/35] xen/console: introduce handle_keypress_in_domain() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 10:51 ` Roger Pau Monné
2025-01-04 3:25 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 23/35] xen/console: introduce console_write() Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 12:04 ` Roger Pau Monné
2025-01-04 3:50 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 24/35] xen/console: introduce hwdom_crashconsole= Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 12:29 ` Roger Pau Monné
2025-01-04 4:48 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 25/35] xen/console: simplify console owner switch hint Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-06 4:41 ` [PATCH v2 26/35] xen/console: make console buffer size configurable Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 12:47 ` Roger Pau Monné
2025-01-04 3:52 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 27/35] xen/console: flush console ring to physical console Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 14:21 ` Roger Pau Monné
2025-01-04 3:56 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 28/35] xen/8250-uart: add missing definitions Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 14:29 ` Roger Pau Monné
2025-01-04 4:01 ` Denis Mukhin
2024-12-12 15:07 ` Jan Beulich
2025-01-04 4:00 ` Denis Mukhin
2024-12-06 4:41 ` [PATCH v2 29/35] x86/hvm: add HVM-specific Kconfig Denis Mukhin
2024-12-06 4:41 ` Denis Mukhin via B4 Relay
2024-12-12 15:06 ` Roger Pau Monné
2025-01-04 3:58 ` Denis Mukhin
2024-12-06 4:42 ` [PATCH v2 30/35] x86/hvm: add helpers for raising guest IRQs Denis Mukhin
2024-12-06 4:42 ` Denis Mukhin via B4 Relay
2024-12-12 16:18 ` Roger Pau Monné
2025-01-04 4:02 ` Denis Mukhin
2024-12-06 4:42 ` [PATCH v2 31/35] x86/hvm: introduce NS8250 UART emulator Denis Mukhin
2024-12-06 4:42 ` Denis Mukhin via B4 Relay
2024-12-13 11:43 ` Roger Pau Monné
2025-01-04 6:28 ` Denis Mukhin
2024-12-16 15:04 ` Jan Beulich
2025-01-04 5:31 ` Denis Mukhin
2025-01-06 9:19 ` Jan Beulich
2025-01-06 20:16 ` Denis Mukhin
2025-01-07 8:43 ` Jan Beulich
2024-12-06 4:42 ` [PATCH v2 32/35] x86/hvm: add debugging facility to " Denis Mukhin
2024-12-06 4:42 ` Denis Mukhin via B4 Relay
2024-12-13 12:08 ` Roger Pau Monné
2025-01-04 4:31 ` Denis Mukhin
2024-12-16 15:08 ` Jan Beulich
2025-01-04 4:37 ` Denis Mukhin
2024-12-06 4:42 ` [PATCH v2 33/35] x86/domain: implement domain_has_vuart() Denis Mukhin
2024-12-06 4:42 ` Denis Mukhin via B4 Relay
2024-12-13 12:23 ` Roger Pau Monné
2024-12-13 20:45 ` Stefano Stabellini
2024-12-16 8:40 ` Roger Pau Monné [this message]
2025-01-04 5:26 ` Denis Mukhin
2025-01-04 5:19 ` Denis Mukhin
2025-01-07 15:16 ` Roger Pau Monné
2025-01-07 17:33 ` Denis Mukhin
2024-12-16 15:11 ` Jan Beulich
2025-01-04 5:26 ` Denis Mukhin
2024-12-06 4:42 ` [PATCH v2 34/35] xen/console: enable console owners w/ emulated NS8250 Denis Mukhin
2024-12-06 4:42 ` Denis Mukhin via B4 Relay
2024-12-10 22:46 ` Jason Andryuk
2024-12-11 7:35 ` Jan Beulich
2024-12-11 7:38 ` Jan Beulich
2025-01-04 3:12 ` Denis Mukhin
2025-01-04 3:08 ` Denis Mukhin
2024-12-06 4:42 ` [PATCH v2 35/35] docs/misc: update console documentation Denis Mukhin
2024-12-06 4:42 ` Denis Mukhin via B4 Relay
2024-12-14 18:05 ` [PATCH v2 00/35] Introduce NS8250 UART emulator Marek Marczykowski-Górecki
2024-12-16 9:04 ` Roger Pau Monné
2025-01-04 4:28 ` Denis Mukhin
2025-01-04 4:27 ` Denis Mukhin
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=Z1_nfT8YfIkYuikB@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=dmukhin@ford.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--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.