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

[Xen-changelog] [xen-unstable] xen: fix hvm_domain_use_pirq's behavior



# HG changeset patch
# User Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
# Date 1314800592 -3600
# Node ID 4226ea1785b5a30df45f3bde2947bc65a685fed9
# Parent  7048810180de0476ff2c5b95c4924e96e6b35875
xen: fix hvm_domain_use_pirq's behavior

hvm_domain_use_pirq should return true when the guest is using a
certain pirq, no matter if the corresponding event channel is
currently enabled or disabled.  As an additional complication, qemu is
going to request pirqs for passthrough devices even for Xen unaware
HVM guests, so we need to wait for an event channel to be connected
before considering the pirq of a passthrough device as "in use".

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
---


diff -r 7048810180de -r 4226ea1785b5 xen/arch/x86/irq.c
--- a/xen/arch/x86/irq.c        Wed Aug 31 15:19:24 2011 +0100
+++ b/xen/arch/x86/irq.c        Wed Aug 31 15:23:12 2011 +0100
@@ -2027,6 +2027,5 @@
 bool_t hvm_domain_use_pirq(const struct domain *d, const struct pirq *pirq)
 {
     return is_hvm_domain(d) && pirq &&
-           pirq->arch.hvm.emuirq != IRQ_UNBOUND &&
-           pirq->evtchn != 0;
+           pirq->arch.hvm.emuirq != IRQ_UNBOUND; 
 }
diff -r 7048810180de -r 4226ea1785b5 xen/arch/x86/physdev.c
--- a/xen/arch/x86/physdev.c    Wed Aug 31 15:19:24 2011 +0100
+++ b/xen/arch/x86/physdev.c    Wed Aug 31 15:23:12 2011 +0100
@@ -196,9 +196,6 @@
     if ( ret == 0 )
         *pirq_p = pirq;
 
-    if ( !ret && is_hvm_domain(d) )
-        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
-
  done:
     spin_unlock(&d->event_lock);
     spin_unlock(&pcidevs_lock);
@@ -271,7 +268,7 @@
              v->domain->arch.pv_domain.pirq_eoi_map )
             evtchn_unmask(pirq->evtchn);
         if ( !is_hvm_domain(v->domain) ||
-             pirq->arch.hvm.emuirq == IRQ_PT )
+             domain_pirq_to_irq(v->domain, eoi.irq) > 0 )
             pirq_guest_eoi(pirq);
         spin_unlock(&v->domain->event_lock);
         ret = 0;
@@ -331,7 +328,7 @@
             break;
         irq_status_query.flags = 0;
         if ( is_hvm_domain(v->domain) &&
-             domain_pirq_to_emuirq(v->domain, irq) != IRQ_PT )
+             domain_pirq_to_irq(v->domain, irq) <= 0 )
         {
             ret = copy_to_guest(arg, &irq_status_query, 1) ? -EFAULT : 0;
             break;
diff -r 7048810180de -r 4226ea1785b5 xen/common/event_channel.c
--- a/xen/common/event_channel.c        Wed Aug 31 15:19:24 2011 +0100
+++ b/xen/common/event_channel.c        Wed Aug 31 15:23:12 2011 +0100
@@ -366,6 +366,9 @@
 
     bind->port = port;
 
+    if ( is_hvm_domain(d) && domain_pirq_to_irq(d, pirq) > 0 )
+        map_domain_emuirq_pirq(d, pirq, IRQ_PT);
+
  out:
     spin_unlock(&d->event_lock);
 
@@ -419,6 +422,8 @@
         pirq->evtchn = 0;
         pirq_cleanup_check(pirq, d1);
         unlink_pirq_port(chn1, d1->vcpu[chn1->notify_vcpu_id]);
+        if ( is_hvm_domain(d1) && domain_pirq_to_irq(d1, pirq->pirq) > 0 )
+            unmap_domain_pirq_emuirq(d1, pirq->pirq);
         break;
     }
 

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


 


Rackspace

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