diff mbox series

[for-4.14,v2,2/2] x86/passthrough: introduce a flag for GSIs not requiring an EOI or unmask

Message ID 20200610142923.9074-3-roger.pau@citrix.com (mailing list archive)
State New, archived
Headers show
Series x86/passthrough: fixes for PVH dom0 edge triggered interrupts | expand

Commit Message

Roger Pau Monne June 10, 2020, 2:29 p.m. UTC
There's no need to setup a timer for GSIs that are edge triggered,
since those don't require any EIO or unmask, and hence couldn't block
other interrupts.

Note this is only used by PVH dom0, that can setup the passthrough of
edge triggered interrupts from the vIO-APIC. One example of such kind
of interrupt that can be used by a PVH dom0 would be the RTC timer.

While there introduce an out label to do the unlock and reduce code
duplication.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Changes since v1:
 - Introduce an out label that does the unlock.
---
 xen/drivers/passthrough/io.c  | 24 +++++++++++++++---------
 xen/include/asm-x86/hvm/irq.h |  2 ++
 2 files changed, 17 insertions(+), 9 deletions(-)

Comments

Andrew Cooper June 11, 2020, 4:26 p.m. UTC | #1
On 10/06/2020 15:29, Roger Pau Monne wrote:
> There's no need to setup a timer for GSIs that are edge triggered,
> since those don't require any EIO or unmask, and hence couldn't block
> other interrupts.
>
> Note this is only used by PVH dom0, that can setup the passthrough of
> edge triggered interrupts from the vIO-APIC. One example of such kind
> of interrupt that can be used by a PVH dom0 would be the RTC timer.
>
> While there introduce an out label to do the unlock and reduce code
> duplication.
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
Paul Durrant June 11, 2020, 5:11 p.m. UTC | #2
> -----Original Message-----
> From: Andrew Cooper <andrew.cooper3@citrix.com>
> Sent: 11 June 2020 17:26
> To: Roger Pau Monne <roger.pau@citrix.com>; xen-devel@lists.xenproject.org
> Cc: paul@xen.org; Jan Beulich <jbeulich@suse.com>; Wei Liu <wl@xen.org>
> Subject: Re: [PATCH for-4.14 v2 2/2] x86/passthrough: introduce a flag for GSIs not requiring an EOI
> or unmask
> 
> On 10/06/2020 15:29, Roger Pau Monne wrote:
> > There's no need to setup a timer for GSIs that are edge triggered,
> > since those don't require any EIO or unmask, and hence couldn't block
> > other interrupts.
> >
> > Note this is only used by PVH dom0, that can setup the passthrough of
> > edge triggered interrupts from the vIO-APIC. One example of such kind
> > of interrupt that can be used by a PVH dom0 would be the RTC timer.
> >
> > While there introduce an out label to do the unlock and reduce code
> > duplication.
> >
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> 
> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>

Release-acked-by: Paul Durrant <paul@xen.org>
Jan Beulich June 15, 2020, 4:17 p.m. UTC | #3
On 11.06.2020 19:11, Paul Durrant wrote:
>> -----Original Message-----
>> From: Andrew Cooper <andrew.cooper3@citrix.com>
>> Sent: 11 June 2020 17:26
>> To: Roger Pau Monne <roger.pau@citrix.com>; xen-devel@lists.xenproject.org
>> Cc: paul@xen.org; Jan Beulich <jbeulich@suse.com>; Wei Liu <wl@xen.org>
>> Subject: Re: [PATCH for-4.14 v2 2/2] x86/passthrough: introduce a flag for GSIs not requiring an EOI
>> or unmask
>>
>> On 10/06/2020 15:29, Roger Pau Monne wrote:
>>> There's no need to setup a timer for GSIs that are edge triggered,
>>> since those don't require any EIO or unmask, and hence couldn't block
>>> other interrupts.
>>>
>>> Note this is only used by PVH dom0, that can setup the passthrough of
>>> edge triggered interrupts from the vIO-APIC. One example of such kind
>>> of interrupt that can be used by a PVH dom0 would be the RTC timer.
>>>
>>> While there introduce an out label to do the unlock and reduce code
>>> duplication.
>>>
>>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>>
>> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> 
> Release-acked-by: Paul Durrant <paul@xen.org>

Strictly speaking these tags were too little for the patch to go
in - the change to drivers/passthrough/io.c would also have
required Paul's (or my) R-b. I take it that this was sort of
implied by the R-a-b.

Jan
Paul Durrant June 15, 2020, 5:06 p.m. UTC | #4
> -----Original Message-----
> From: Roger Pau Monne <roger.pau@citrix.com>
> Sent: 10 June 2020 15:29
> To: xen-devel@lists.xenproject.org
> Cc: paul@xen.org; Roger Pau Monne <roger.pau@citrix.com>; Jan Beulich <jbeulich@suse.com>; Andrew
> Cooper <andrew.cooper3@citrix.com>; Wei Liu <wl@xen.org>
> Subject: [PATCH for-4.14 v2 2/2] x86/passthrough: introduce a flag for GSIs not requiring an EOI or
> unmask
> 
> There's no need to setup a timer for GSIs that are edge triggered,
> since those don't require any EIO or unmask, and hence couldn't block
> other interrupts.
> 
> Note this is only used by PVH dom0, that can setup the passthrough of
> edge triggered interrupts from the vIO-APIC. One example of such kind
> of interrupt that can be used by a PVH dom0 would be the RTC timer.
> 
> While there introduce an out label to do the unlock and reduce code
> duplication.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Paul Durrant <paul@xen.org>

> ---
> Changes since v1:
>  - Introduce an out label that does the unlock.
> ---
>  xen/drivers/passthrough/io.c  | 24 +++++++++++++++---------
>  xen/include/asm-x86/hvm/irq.h |  2 ++
>  2 files changed, 17 insertions(+), 9 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
> index b292e79382..6b1305a3e5 100644
> --- a/xen/drivers/passthrough/io.c
> +++ b/xen/drivers/passthrough/io.c
> @@ -138,7 +138,8 @@ static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
> 
>  bool pt_irq_need_timer(uint32_t flags)
>  {
> -    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
> +    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
> +                      HVM_IRQ_DPCI_NO_EOI));
>  }
> 
>  static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
> @@ -558,6 +559,12 @@ int pt_irq_create_bind(
>                       */
>                      ASSERT(!mask);
>                      share = trigger_mode;
> +                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
> +                        /*
> +                         * Edge IO-APIC interrupt, no EOI or unmask to perform
> +                         * and hence no timer needed.
> +                         */
> +                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
>                  }
>              }
> 
> @@ -897,17 +904,13 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
>              send_guest_pirq(d, pirq);
> 
>              if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
> -            {
> -                spin_unlock(&d->event_lock);
> -                return;
> -            }
> +                goto out;
>          }
> 
>          if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
>          {
>              vmsi_deliver_pirq(d, pirq_dpci);
> -            spin_unlock(&d->event_lock);
> -            return;
> +            goto out;
>          }
> 
>          list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
> @@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
>          if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
>          {
>              hvm_gsi_assert(d, pirq->pirq);
> +            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
> +                goto out;
>              pirq_dpci->pending++;
>          }
> 
> @@ -927,8 +932,7 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
>          {
>              /* for translated MSI to INTx interrupt, eoi as early as possible */
>              __msi_pirq_eoi(pirq_dpci);
> -            spin_unlock(&d->event_lock);
> -            return;
> +            goto out;
>          }
> 
>          /*
> @@ -941,6 +945,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
>          ASSERT(pt_irq_need_timer(pirq_dpci->flags));
>          set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
>      }
> +
> + out:
>      spin_unlock(&d->event_lock);
>  }
> 
> diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
> index d306cfeade..532880d497 100644
> --- a/xen/include/asm-x86/hvm/irq.h
> +++ b/xen/include/asm-x86/hvm/irq.h
> @@ -121,6 +121,7 @@ struct dev_intx_gsi_link {
>  #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
>  #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
>  #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
> +#define _HVM_IRQ_DPCI_NO_EOI_SHIFT              7
>  #define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
>  #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
>  #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
> @@ -129,6 +130,7 @@ struct dev_intx_gsi_link {
>  #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
>  #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
>  #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
> +#define HVM_IRQ_DPCI_NO_EOI          (1u << _HVM_IRQ_DPCI_NO_EOI_SHIFT)
>  #define HVM_IRQ_DPCI_TRANSLATE       (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
> 
>  struct hvm_gmsi_info {
> --
> 2.26.2
Paul Durrant June 15, 2020, 5:07 p.m. UTC | #5
> -----Original Message-----
> From: Jan Beulich <jbeulich@suse.com>
> Sent: 15 June 2020 17:17
> To: paul@xen.org; 'Andrew Cooper' <andrew.cooper3@citrix.com>
> Cc: 'Roger Pau Monne' <roger.pau@citrix.com>; xen-devel@lists.xenproject.org; 'Wei Liu' <wl@xen.org>
> Subject: Re: [PATCH for-4.14 v2 2/2] x86/passthrough: introduce a flag for GSIs not requiring an EOI
> or unmask
> 
> On 11.06.2020 19:11, Paul Durrant wrote:
> >> -----Original Message-----
> >> From: Andrew Cooper <andrew.cooper3@citrix.com>
> >> Sent: 11 June 2020 17:26
> >> To: Roger Pau Monne <roger.pau@citrix.com>; xen-devel@lists.xenproject.org
> >> Cc: paul@xen.org; Jan Beulich <jbeulich@suse.com>; Wei Liu <wl@xen.org>
> >> Subject: Re: [PATCH for-4.14 v2 2/2] x86/passthrough: introduce a flag for GSIs not requiring an
> EOI
> >> or unmask
> >>
> >> On 10/06/2020 15:29, Roger Pau Monne wrote:
> >>> There's no need to setup a timer for GSIs that are edge triggered,
> >>> since those don't require any EIO or unmask, and hence couldn't block
> >>> other interrupts.
> >>>
> >>> Note this is only used by PVH dom0, that can setup the passthrough of
> >>> edge triggered interrupts from the vIO-APIC. One example of such kind
> >>> of interrupt that can be used by a PVH dom0 would be the RTC timer.
> >>>
> >>> While there introduce an out label to do the unlock and reduce code
> >>> duplication.
> >>>
> >>> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> >>
> >> Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
> >
> > Release-acked-by: Paul Durrant <paul@xen.org>
> 
> Strictly speaking these tags were too little for the patch to go
> in - the change to drivers/passthrough/io.c would also have
> required Paul's (or my) R-b. I take it that this was sort of
> implied by the R-a-b.

FAOD I have added my R-b.

  Paul

> 
> Jan
Jan Beulich June 16, 2020, 6:27 a.m. UTC | #6
On 10.06.2020 16:29, Roger Pau Monne wrote:
> @@ -558,6 +559,12 @@ int pt_irq_create_bind(
>                       */
>                      ASSERT(!mask);
>                      share = trigger_mode;
> +                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
> +                        /*
> +                         * Edge IO-APIC interrupt, no EOI or unmask to perform
> +                         * and hence no timer needed.
> +                         */
> +                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;

Is this really limited to edge triggered IO-APIC interrupts?
MSI ones are effectively edge triggered too, aren't they?
Along the lines of irq_acktype() maskable MSI may then also
not need any such arrangements? The pirq_guest_eoi() ->
desc_guest_eoi() path looks to confirm this.

> @@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
>          if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
>          {
>              hvm_gsi_assert(d, pirq->pirq);
> +            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
> +                goto out;

Immediately ahead of this there's a similar piece of code
dealing with PCI INTx. They're commonly level triggered, but
I don't think there's a strict need for this to be the case.
At least hvm_pci_intx_assert() -> assert_gsi() ->
vioapic_irq_positive_edge() also cover the edge triggered one.

Jan
Roger Pau Monne June 16, 2020, 8:37 a.m. UTC | #7
On Tue, Jun 16, 2020 at 08:27:54AM +0200, Jan Beulich wrote:
> On 10.06.2020 16:29, Roger Pau Monne wrote:
> > @@ -558,6 +559,12 @@ int pt_irq_create_bind(
> >                       */
> >                      ASSERT(!mask);
> >                      share = trigger_mode;
> > +                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
> > +                        /*
> > +                         * Edge IO-APIC interrupt, no EOI or unmask to perform
> > +                         * and hence no timer needed.
> > +                         */
> > +                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
> 
> Is this really limited to edge triggered IO-APIC interrupts?
> MSI ones are effectively edge triggered too, aren't they?

MSIs do sometimes require an EOI, depending on whether they can be
masked, see irq_acktype.

> Along the lines of irq_acktype() maskable MSI may then also
> not need any such arrangements? The pirq_guest_eoi() ->
> desc_guest_eoi() path looks to confirm this.

Yes, that's correct. AFAICT MSI interrupts won't get the EOI timer,
since pt_irq_need_timer will return false because the
HVM_IRQ_DPCI_GUEST_MSI flag will be set.

> > @@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
> >          if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
> >          {
> >              hvm_gsi_assert(d, pirq->pirq);
> > +            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
> > +                goto out;
> 
> Immediately ahead of this there's a similar piece of code
> dealing with PCI INTx. They're commonly level triggered, but
> I don't think there's a strict need for this to be the case.
> At least hvm_pci_intx_assert() -> assert_gsi() ->
> vioapic_irq_positive_edge() also cover the edge triggered one.

Hm, I'm not sure it's safe to passthrough edge triggered IO-APIC
interrupts, as Xen will mark those as 'shared' always, and sharing
edge interrupts cannot reliably work. In any case the EOI timer is
definitely set for those, and needs to be disabled before exiting
hvm_dirq_assist.

Thanks, Roger.
Jan Beulich June 16, 2020, 8:45 a.m. UTC | #8
On 16.06.2020 10:37, Roger Pau Monné wrote:
> On Tue, Jun 16, 2020 at 08:27:54AM +0200, Jan Beulich wrote:
>> On 10.06.2020 16:29, Roger Pau Monne wrote:
>>> @@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
>>>          if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
>>>          {
>>>              hvm_gsi_assert(d, pirq->pirq);
>>> +            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
>>> +                goto out;
>>
>> Immediately ahead of this there's a similar piece of code
>> dealing with PCI INTx. They're commonly level triggered, but
>> I don't think there's a strict need for this to be the case.
>> At least hvm_pci_intx_assert() -> assert_gsi() ->
>> vioapic_irq_positive_edge() also cover the edge triggered one.
> 
> Hm, I'm not sure it's safe to passthrough edge triggered IO-APIC
> interrupts, as Xen will mark those as 'shared' always, and sharing
> edge interrupts cannot reliably work. In any case the EOI timer is
> definitely set for those, and needs to be disabled before exiting
> hvm_dirq_assist.

That's the

                if ( !is_hardware_domain(d) )
                    share = BIND_PIRQ__WILL_SHARE;

in pt_irq_create_bind() aiui? I wonder why we have that ... At a
guess it's to accommodate pciback in Dom0 also registering a handler.
But wasn't it XenoLinux'es pciback only that does so, and upstream's
doesn't?

Jan
Roger Pau Monne June 16, 2020, 9:28 a.m. UTC | #9
On Tue, Jun 16, 2020 at 10:45:51AM +0200, Jan Beulich wrote:
> On 16.06.2020 10:37, Roger Pau Monné wrote:
> > On Tue, Jun 16, 2020 at 08:27:54AM +0200, Jan Beulich wrote:
> >> On 10.06.2020 16:29, Roger Pau Monne wrote:
> >>> @@ -920,6 +923,8 @@ static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
> >>>          if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
> >>>          {
> >>>              hvm_gsi_assert(d, pirq->pirq);
> >>> +            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
> >>> +                goto out;
> >>
> >> Immediately ahead of this there's a similar piece of code
> >> dealing with PCI INTx. They're commonly level triggered, but
> >> I don't think there's a strict need for this to be the case.
> >> At least hvm_pci_intx_assert() -> assert_gsi() ->
> >> vioapic_irq_positive_edge() also cover the edge triggered one.
> > 
> > Hm, I'm not sure it's safe to passthrough edge triggered IO-APIC
> > interrupts, as Xen will mark those as 'shared' always, and sharing
> > edge interrupts cannot reliably work. In any case the EOI timer is
> > definitely set for those, and needs to be disabled before exiting
> > hvm_dirq_assist.
> 
> That's the
> 
>                 if ( !is_hardware_domain(d) )
>                     share = BIND_PIRQ__WILL_SHARE;
> 
> in pt_irq_create_bind() aiui? I wonder why we have that ... At a
> guess it's to accommodate pciback in Dom0 also registering a handler.
> But wasn't it XenoLinux'es pciback only that does so, and upstream's
> doesn't?

I'm not that familiar with pciback in Linux. I've taken a look and
AFAICT modern Linux kernels will register a handler for the PCI
interrupts before doing a device reset and when dealing with PV guests
that use the pciif protocol (note that such IRQ is also
unconditionally marked as shared in Linux).

It might be safe for HVM domU passed through interrupts to set the
share bit based on the triggering mode.

Roger.
Wei Liu June 26, 2020, 10:44 a.m. UTC | #10
On Wed, Jun 10, 2020 at 04:29:23PM +0200, Roger Pau Monne wrote:
> There's no need to setup a timer for GSIs that are edge triggered,
> since those don't require any EIO or unmask, and hence couldn't block

One small nit. I think you meant "EOI" here.
diff mbox series

Patch

diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c
index b292e79382..6b1305a3e5 100644
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -138,7 +138,8 @@  static void pt_pirq_softirq_reset(struct hvm_pirq_dpci *pirq_dpci)
 
 bool pt_irq_need_timer(uint32_t flags)
 {
-    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE));
+    return !(flags & (HVM_IRQ_DPCI_GUEST_MSI | HVM_IRQ_DPCI_TRANSLATE |
+                      HVM_IRQ_DPCI_NO_EOI));
 }
 
 static int pt_irq_guest_eoi(struct domain *d, struct hvm_pirq_dpci *pirq_dpci,
@@ -558,6 +559,12 @@  int pt_irq_create_bind(
                      */
                     ASSERT(!mask);
                     share = trigger_mode;
+                    if ( trigger_mode == VIOAPIC_EDGE_TRIG )
+                        /*
+                         * Edge IO-APIC interrupt, no EOI or unmask to perform
+                         * and hence no timer needed.
+                         */
+                        pirq_dpci->flags |= HVM_IRQ_DPCI_NO_EOI;
                 }
             }
 
@@ -897,17 +904,13 @@  static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
             send_guest_pirq(d, pirq);
 
             if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
-            {
-                spin_unlock(&d->event_lock);
-                return;
-            }
+                goto out;
         }
 
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_GUEST_MSI )
         {
             vmsi_deliver_pirq(d, pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         list_for_each_entry ( digl, &pirq_dpci->digl_list, list )
@@ -920,6 +923,8 @@  static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         if ( pirq_dpci->flags & HVM_IRQ_DPCI_IDENTITY_GSI )
         {
             hvm_gsi_assert(d, pirq->pirq);
+            if ( pirq_dpci->flags & HVM_IRQ_DPCI_NO_EOI )
+                goto out;
             pirq_dpci->pending++;
         }
 
@@ -927,8 +932,7 @@  static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         {
             /* for translated MSI to INTx interrupt, eoi as early as possible */
             __msi_pirq_eoi(pirq_dpci);
-            spin_unlock(&d->event_lock);
-            return;
+            goto out;
         }
 
         /*
@@ -941,6 +945,8 @@  static void hvm_dirq_assist(struct domain *d, struct hvm_pirq_dpci *pirq_dpci)
         ASSERT(pt_irq_need_timer(pirq_dpci->flags));
         set_timer(&pirq_dpci->timer, NOW() + PT_IRQ_TIME_OUT);
     }
+
+ out:
     spin_unlock(&d->event_lock);
 }
 
diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h
index d306cfeade..532880d497 100644
--- a/xen/include/asm-x86/hvm/irq.h
+++ b/xen/include/asm-x86/hvm/irq.h
@@ -121,6 +121,7 @@  struct dev_intx_gsi_link {
 #define _HVM_IRQ_DPCI_GUEST_PCI_SHIFT           4
 #define _HVM_IRQ_DPCI_GUEST_MSI_SHIFT           5
 #define _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT        6
+#define _HVM_IRQ_DPCI_NO_EOI_SHIFT              7
 #define _HVM_IRQ_DPCI_TRANSLATE_SHIFT          15
 #define HVM_IRQ_DPCI_MACH_PCI        (1u << _HVM_IRQ_DPCI_MACH_PCI_SHIFT)
 #define HVM_IRQ_DPCI_MACH_MSI        (1u << _HVM_IRQ_DPCI_MACH_MSI_SHIFT)
@@ -129,6 +130,7 @@  struct dev_intx_gsi_link {
 #define HVM_IRQ_DPCI_GUEST_PCI       (1u << _HVM_IRQ_DPCI_GUEST_PCI_SHIFT)
 #define HVM_IRQ_DPCI_GUEST_MSI       (1u << _HVM_IRQ_DPCI_GUEST_MSI_SHIFT)
 #define HVM_IRQ_DPCI_IDENTITY_GSI    (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT)
+#define HVM_IRQ_DPCI_NO_EOI          (1u << _HVM_IRQ_DPCI_NO_EOI_SHIFT)
 #define HVM_IRQ_DPCI_TRANSLATE       (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
 
 struct hvm_gmsi_info {