WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH v2] x86: re-inject emulated level pirqs in PV on HVM

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH v2] x86: re-inject emulated level pirqs in PV on HVM guests if still asserted
From: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Date: Fri, 18 Nov 2011 11:13:13 +0000
Cc: Jan Beulich <JBeulich@xxxxxxxxxx>
Delivery-date: Fri, 18 Nov 2011 03:13:15 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Alpine 2.00 (DEB 1167 2008-08-23)
This patch is a backport of CS 24007 for xen-4.1-testing.

PV on HVM guests can loose level interrupts coming from emulated
devices if they have been remapped onto event channels.  The reason is
that we are missing the code to inject a pirq again in the guest when
the guest EOIs it, if it corresponds to an emulated level interrupt
and the interrupt is still asserted.

Fix this issue and also return error when the guest tries to get the
irq_status of a non-existing pirq.


Changes in v2:

- move the spinlock afterward to cover the new code only.


Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
CC: Jan Beulich <JBeulich@xxxxxxxx>


diff -r e73ada19a69d xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Thu Nov 17 09:13:25 2011 +0000
+++ b/xen/arch/x86/physdev.c    Fri Nov 18 09:42:03 2011 +0000
@@ -268,6 +268,20 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
             ret = pirq_guest_eoi(v->domain, eoi.irq);
         else
             ret = 0;
+        spin_lock(&v->domain->event_lock);
+        if ( is_hvm_domain(v->domain) &&
+                domain_pirq_to_emuirq(v->domain, eoi.irq) > 0 )
+        {
+            struct hvm_irq *hvm_irq = &v->domain->arch.hvm_domain.irq;
+            int gsi = domain_pirq_to_emuirq(v->domain, eoi.irq);
+
+            /* if this is a level irq and count > 0, send another
+             * notification */ 
+            if ( gsi >= NR_ISAIRQS /* ISA irqs are edge triggered */
+                    && hvm_irq->gsi_assert_count[gsi] )
+                send_guest_pirq(v->domain, eoi.irq);
+        }
+        spin_unlock(&v->domain->event_lock);
         break;
     }
 
@@ -323,9 +337,10 @@ ret_t do_physdev_op(int cmd, XEN_GUEST_H
             break;
         irq_status_query.flags = 0;
         if ( is_hvm_domain(v->domain) &&
-             domain_pirq_to_irq(v->domain, irq) <= 0 )
+                domain_pirq_to_irq(v->domain, irq) <= 0 &&
+                domain_pirq_to_emuirq(v->domain, irq) == IRQ_UNBOUND )
         {
-            ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
+            ret = -EINVAL;
             break;
         }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH v2] x86: re-inject emulated level pirqs in PV on HVM guests if still asserted, Stefano Stabellini <=