[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 15/15] emul/ns16x50: implement IRQ emulation via vIOAPIC


  • To: <dmukhin@xxxxxxx>
  • From: Stefano Stabellini <stefano.stabellini@xxxxxxx>
  • Date: Fri, 5 Sep 2025 16:01:15 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=urw86vEP5XP4TfLRn0BEWIyixbASdSjSHwutCjQC5mY=; b=wynd2fdRPY5n4lQggGnSTGXvylKZUpEqBIiXxmoFGYEJKgweLiUZ5uN1+qEZw9upqNJ1v2oi/9JoC8Izd4ZbVZ9943LzyCxcLXUTKdfzqMB3sJD/34lp4k1hC3PJ8xE7fZnN8E1DztWtxU+R2SkPsg17AOrahSS71gdDZr6hzYpvEtE+IOB+k/NX8dDySTCUMXN0PZI80+oS643tqBFUai+rZ6hTIiDKP8Tmg7RcG06DAI/Vx4h9fH78trlwscgCO61DAwdAdIPbpQXkuj7OU8x5Cq2CSHXbzenMsxJaYneKZOFvvpQVtvH2N5U+WfcZthL/SrI+jWgbQ+G29LRR0g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=smZvHJG61cCBWlYzq0HdJhsdlIJn0wQMSd0r18lXGWg10ba8AY6YPUZ6R2mvYg3Dp46eT8YkyDV1cIU1OjhPYWyvaa09zbGplgNa2vJDJ2wToIdYgDZ7TPFfyh0z1XJ6+8gAngPnpgeSf6RPizlXKcS47CtTsZR2tbM4ZFrqvUPxL0L2XqMi1vBQ7sW3uwyh4cqv91CwwoiBbAxVq1rlQUR+jnSRyEjNC6h1M/oA2OKICggGJYS5PrFzUhoDbMeerDgBaZS/vI6+PKxZDYjWijQsXrko0yxAORyeDEvRF/wVGzX7Kyb3H9app4S6HD118d+Cobn/mgCTbL4W3xxxnQ==
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>, <andrew.cooper3@xxxxxxxxxx>, <anthony.perard@xxxxxxxxxx>, <jbeulich@xxxxxxxx>, <julien@xxxxxxx>, <michal.orzel@xxxxxxx>, <roger.pau@xxxxxxxxxx>, <dmukhin@xxxxxxxx>
  • Delivery-date: Fri, 05 Sep 2025 23:01:39 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Fri, 5 Sep 2025, dmukhin@xxxxxxx wrote:
> On Fri, Aug 29, 2025 at 03:21:13PM -0700, Stefano Stabellini wrote:
> > On Thu, 28 Aug 2025, dmukhin@xxxxxxx wrote:
> > > From: Denis Mukhin <dmukhin@xxxxxxxx> 
> > > 
> > > PVH domains use vIOAPIC, not vPIC and NS16550 emulates ISA IRQs which 
> > > cannot
> > > be asserted on vIOAPIC.
> > 
> > One option is to enable the vPIT for PVH domains when the NS16550
> > emulator is enabled. Would that resolve the problem? That would be a
> > simpler solution compared to adding IRQ_EMU because the IRQ_* logic is
> > already quite complex.
> 
> vPIC? (PIT is timer).
> 
> I tried to enable vPIC for hwdom, but there's some more work to make it work
> :-/
> 
> > 
> > Alternatively...
> [..]
> > 
> > > --- a/xen/arch/x86/hvm/vioapic.c
> > > +++ b/xen/arch/x86/hvm/vioapic.c
> > > @@ -177,6 +177,16 @@ static int vioapic_hwdom_map_gsi(unsigned int gsi, 
> > > unsigned int trig,
> > >  
> > >      ASSERT(is_hardware_domain(currd));
> > >  
> > > +    /*
> > > +     * Interrupt is claimed by one of the platform virtual devices (e.g.
> > > +     * NS16550); do nothing.
> > > +     */
> > > +    write_lock(&currd->event_lock);
> > > +    ret = domain_irq_to_emuirq(currd, gsi);
> > > +    write_unlock(&currd->event_lock);
> > > +    if ( ret != IRQ_UNBOUND )
> > > +        return 0;
> > 
> > ..alternatively, we could have an add-hoc check here? Not very nice but
> > at least it would be very simple.
> > 
> > In other words, adding vPIT is preferable in my opinion but as a second
> > option I would consider an ad-hoc check. I would try to avoid adding
> > IRQ_EMU -- that should be the last resort in my view.
> 
> In my opinion, IRQ_EMU falls into category of an ad-hoc.
> 
> I think vioapic_hwdom_map_gsi() should not depend on the presence of certain
> virtual devices but rely on some global flag, e.g. via quering
> domain_irq_to_emuirq() infra.

Hi Denis, the reason why IRQ_EMU is dangerous is that there are a bunch
of checks emuirq != IRQ_PT and also emuirq != IRQ_MSI_EMU which I don't
know if they would still behave correctly after the introduction of
IRQ_EMU.

I would prefer to avoid the problem if possible...



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.