All of lore.kernel.org
 help / color / mirror / Atom feed
From: dmkhn@proton.me
To: Jan Beulich <jbeulich@suse.com>
Cc: andrew.cooper3@citrix.com, anthony.perard@vates.tech,
	julien@xen.org, michal.orzel@amd.com, roger.pau@citrix.com,
	sstabellini@kernel.org, dmukhin@ford.com,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v4 7/8] tools/xl: enable NS16550-compatible UART emulator for PVH (x86)
Date: Thu, 07 Aug 2025 19:38:40 +0000	[thread overview]
Message-ID: <aJUAu46dcUzwrclZ@kraken> (raw)
In-Reply-To: <549bde88-38a3-4920-9309-f898b48d3bda@suse.com>

On Mon, Aug 04, 2025 at 01:06:32PM +0200, Jan Beulich wrote:
> On 31.07.2025 21:22, dmkhn@proton.me wrote:
> > From: Denis Mukhin <dmukhin@ford.com>
> >
> > Enable virtual NS16550 for PVH domains in xl.
> >
> > {map,unmap}_domain_emuirq_pirq() infrastructure is modified by adding new
> > type of interrupt resources 'IRQ_EMU' which means 'emulated device IRQ'
> > (similarly to IRQ_MSI_EMU).
> >
> > This is necessary to for IOAPIC emulation code to skip IRQ->PIRQ mapping
> > (vioapic_hwdom_map_gsi()) when guest OS unmasks vIOAPIC pin corresponding to
> > virtual device's IRQ.
> >
> > Also, hvm_gsi_eoi() is modified to trigger assertion in hvm_gsi_deassert()
> > path for ISA IRQs.
> >
> > Signed-off-by: Denis Mukhin <dmukhin@ford.com>
> > ---
> > Changes since v3:
> > - new patch
> > ---
> >  tools/libs/light/libxl_x86.c          |  2 +-
> >  xen/arch/x86/domain.c                 |  2 ++
> >  xen/arch/x86/hvm/vioapic.c            | 10 ++++++++++
> >  xen/arch/x86/include/asm/irq.h        |  1 +
> >  xen/common/emul/vuart/vuart-ns16550.c | 27 +++++++++++++++++++++++++--
> >  xen/drivers/passthrough/x86/hvm.c     |  9 ++++-----
> >  6 files changed, 43 insertions(+), 8 deletions(-)
> 
> Given this diffstat, how come the patch prefix is "tools/xl:"? You don't even
> touch xl ...

Yeah, my bad, that should have been saying something like
"enable IRQ emulation via vIOAPIC"

Will update.

> 
> > --- a/xen/common/emul/vuart/vuart-ns16550.c
> > +++ b/xen/common/emul/vuart/vuart-ns16550.c
> > @@ -355,7 +355,9 @@ static void ns16550_irq_assert(const struct vuart_ns16550 *vdev)
> >      struct domain *d = vdev->owner;
> >      int vector;
> >
> > -    if ( has_vpic(d) ) /* HVM */
> > +    if ( has_vioapic(d) && !has_vpic(d) ) /* PVH */
> > +        vector = hvm_ioapic_assert(d, vdev->irq, false);
> > +    else if ( has_vpic(d) ) /* HVM */
> >          vector = hvm_isa_irq_assert(d, vdev->irq, vioapic_get_vector);
> 
> Why not
> 
>     if ( has_vpic(d) ) /* HVM */
>          vector = hvm_isa_irq_assert(d, vdev->irq, vioapic_get_vector);
>     else if ( has_vioapic(d) ) /* PVH */
>         vector = hvm_ioapic_assert(d, vdev->irq, false);
> 
> Less code churn and maybe even less generated code.
> 
> > @@ -367,7 +369,9 @@ static void ns16550_irq_deassert(const struct vuart_ns16550 *vdev)
> >  {
> >      struct domain *d = vdev->owner;
> >
> > -    if ( has_vpic(d) ) /* HVM */
> > +    if ( has_vioapic(d) && !has_vpic(d) ) /* PVH */
> > +        hvm_ioapic_deassert(d, vdev->irq);
> > +    else if ( has_vpic(d) ) /* HVM */
> >          hvm_isa_irq_deassert(d, vdev->irq);
> 
> Same here then.
> 
> > --- a/xen/drivers/passthrough/x86/hvm.c
> > +++ b/xen/drivers/passthrough/x86/hvm.c
> > @@ -924,12 +924,11 @@ static void hvm_gsi_eoi(struct domain *d, unsigned int gsi)
> >  {
> >      struct pirq *pirq = pirq_info(d, gsi);
> >
> > -    /* Check if GSI is actually mapped. */
> > -    if ( !pirq_dpci(pirq) )
> > -        return;
> > -
> >      hvm_gsi_deassert(d, gsi);
> > -    hvm_pirq_eoi(pirq);
> > +
> > +    /* Check if GSI is actually mapped. */
> > +    if ( pirq_dpci(pirq) )
> > +        hvm_pirq_eoi(pirq);
> >  }
> 
> The correctness of this change (in particular hvm_gsi_deassert() now always
> running) wants reasoning about in the description.
> 
> Jan
> 



  reply	other threads:[~2025-08-07 19:39 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31 19:21 [PATCH v4 0/8] x86: introduce NS16550-compatible UART emulator dmkhn
2025-07-31 19:21 ` [PATCH v4 1/8] xen/domain: introduce common emulation flags dmkhn
2025-08-04  9:46   ` Jan Beulich
2025-08-05  0:54     ` dmkhn
2025-08-06 13:56       ` Roger Pau Monné
2025-08-07 17:54         ` dmkhn
2025-08-07 14:28       ` Oleksii Kurochko
2025-08-07 17:43         ` dmkhn
2025-07-31 19:21 ` [PATCH v4 2/8] emul/vuart: introduce framework for UART emulators dmkhn
2025-08-01  0:08   ` Stefano Stabellini
2025-08-01  2:54     ` dmkhn
2025-08-04 10:11   ` Jan Beulich
2025-08-09 18:55     ` dmkhn
2025-08-11  7:34       ` Jan Beulich
2025-08-11 23:55         ` dmkhn
2025-08-12  6:52           ` Jan Beulich
2025-08-14  6:32             ` dmkhn
2025-08-06 14:24   ` Roger Pau Monné
2025-08-07 19:12     ` dmkhn
2025-07-31 19:21 ` [PATCH v4 3/8] x86/domain: allocate d->{iomem,irq}_caps before arch-specific initialization dmkhn
2025-07-31 19:52   ` Grygorii Strashko
2025-07-31 20:21     ` dmkhn
2025-08-01  2:57       ` dmkhn
2025-07-31 23:20   ` Stefano Stabellini
2025-08-04 10:20   ` Jan Beulich
2025-08-07 18:59     ` dmkhn
2025-08-06 14:37   ` Roger Pau Monné
2025-08-07 18:57     ` dmkhn
2025-07-31 19:22 ` [PATCH v4 4/8] xen/8250-uart: update definitions dmkhn
2025-07-31 23:23   ` Stefano Stabellini
2025-08-04 10:23   ` Jan Beulich
2025-08-07 19:41     ` dmkhn
2025-07-31 19:22 ` [PATCH v4 5/8] emul/vuart-ns16550: introduce NS16550-compatible UART emulator (x86) dmkhn
2025-07-31 23:57   ` Stefano Stabellini
2025-08-01  3:28     ` dmkhn
2025-08-04 10:53   ` Jan Beulich
2025-08-09 18:37     ` dmkhn
2025-08-11  7:39       ` Jan Beulich
2025-08-12  0:06         ` dmkhn
2025-08-06 15:06   ` Roger Pau Monné
2025-08-06 17:24     ` Roger Pau Monné
2025-08-07 18:49     ` dmkhn
2025-07-31 19:22 ` [PATCH v4 6/8] tools/xl: enable NS16550-compatible UART emulator for HVM (x86) dmkhn
2025-08-04 10:54   ` Jan Beulich
2025-08-06 15:21   ` Roger Pau Monné
2025-08-25 14:49   ` Anthony PERARD
2025-08-25 15:03     ` Jan Beulich
2025-08-25 15:13       ` Anthony PERARD
2025-08-25 15:27         ` Jan Beulich
2025-08-25 15:39           ` Anthony PERARD
2025-08-25 15:45             ` Jan Beulich
2025-08-26  9:26     ` dmkhn
2025-07-31 19:22 ` [PATCH v4 7/8] tools/xl: enable NS16550-compatible UART emulator for PVH (x86) dmkhn
2025-08-01  0:46   ` Stefano Stabellini
2025-08-01  1:53     ` dmkhn
2025-08-04 11:06   ` Jan Beulich
2025-08-07 19:38     ` dmkhn [this message]
2025-07-31 19:22 ` [PATCH v4 8/8] emul/vuart: introduce console forwarding enforcement via vUART dmkhn
2025-08-01  0:10   ` Stefano Stabellini
2025-08-01  1:51     ` dmkhn
2025-08-06 13:48 ` [PATCH v4 0/8] x86: introduce NS16550-compatible UART emulator Roger Pau Monné

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=aJUAu46dcUzwrclZ@kraken \
    --to=dmkhn@proton.me \
    --cc=andrew.cooper3@citrix.com \
    --cc=anthony.perard@vates.tech \
    --cc=dmukhin@ford.com \
    --cc=jbeulich@suse.com \
    --cc=julien@xen.org \
    --cc=michal.orzel@amd.com \
    --cc=roger.pau@citrix.com \
    --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.