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 1/2] x86: make domain_spin_lock_irq_desc() a wrapper

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 1/2] x86: make domain_spin_lock_irq_desc() a wrapper of pirq_spin_lock_irq_desc()
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 01 Jul 2011 13:59:52 +0100
Delivery-date: Fri, 01 Jul 2011 06:03:35 -0700
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
At once drop the now unused struct domain * parameter of the latter.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -258,7 +258,7 @@ static int hvm_migrate_pirq(struct domai
          (pirq_dpci->gmsi.dest_vcpu_id == v->vcpu_id) )
     {
         struct irq_desc *desc =
-            pirq_spin_lock_irq_desc(d, dpci_pirq(pirq_dpci), NULL);
+            pirq_spin_lock_irq_desc(dpci_pirq(pirq_dpci), NULL);
 
         if ( !desc )
             return 0;
--- a/xen/arch/x86/hvm/vmsi.c
+++ b/xen/arch/x86/hvm/vmsi.c
@@ -374,7 +374,7 @@ int msixtbl_pt_register(struct domain *d
     if ( !new_entry )
         return -ENOMEM;
 
-    irq_desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
+    irq_desc = pirq_spin_lock_irq_desc(pirq, NULL);
     if ( !irq_desc )
     {
         xfree(new_entry);
@@ -421,7 +421,7 @@ void msixtbl_pt_unregister(struct domain
     ASSERT(spin_is_locked(&pcidevs_lock));
     ASSERT(spin_is_locked(&d->event_lock));
 
-    irq_desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
+    irq_desc = pirq_spin_lock_irq_desc(pirq, NULL);
     if ( !irq_desc )
         return;
 
--- a/xen/arch/x86/irq.c
+++ b/xen/arch/x86/irq.c
@@ -930,32 +930,16 @@ static void __do_IRQ_guest(int irq)
 struct irq_desc *domain_spin_lock_irq_desc(
     struct domain *d, int pirq, unsigned long *pflags)
 {
-    int irq;
-    unsigned long flags;
-    struct irq_desc *desc;
+    const struct pirq *info = pirq_info(d, pirq);
 
-    for ( ; ; )
-    {
-        irq = domain_pirq_to_irq(d, pirq);
-        if ( irq <= 0 )
-            return NULL;
-        desc = irq_to_desc(irq);
-        spin_lock_irqsave(&desc->lock, flags);
-        if ( irq == domain_pirq_to_irq(d, pirq) )
-            break;
-        spin_unlock_irqrestore(&desc->lock, flags);
-    }
-
-    if ( pflags != NULL )
-        *pflags = flags;
-    return desc;
+    return info ? pirq_spin_lock_irq_desc(info, pflags) : NULL;
 }
 
 /*
  * Same with struct pirq already looked up.
  */
 struct irq_desc *pirq_spin_lock_irq_desc(
-    struct domain *d, const struct pirq *pirq, unsigned long *pflags)
+    const struct pirq *pirq, unsigned long *pflags)
 {
     struct irq_desc *desc;
     unsigned long flags;
@@ -1163,7 +1147,7 @@ void pirq_guest_eoi(struct domain *d, st
     struct irq_desc *desc;
 
     ASSERT(local_irq_is_enabled());
-    desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
+    desc = pirq_spin_lock_irq_desc(pirq, NULL);
     if ( desc )
         desc_guest_eoi(d, desc, pirq);
 }
@@ -1322,7 +1306,7 @@ int pirq_guest_bind(struct vcpu *v, stru
     BUG_ON(!local_irq_is_enabled());
 
  retry:
-    desc = pirq_spin_lock_irq_desc(v->domain, pirq, NULL);
+    desc = pirq_spin_lock_irq_desc(pirq, NULL);
     if ( desc == NULL )
     {
         rc = -EINVAL;
@@ -1525,7 +1509,7 @@ void pirq_guest_unbind(struct domain *d,
     WARN_ON(!spin_is_locked(&d->event_lock));
 
     BUG_ON(!local_irq_is_enabled());
-    desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
+    desc = pirq_spin_lock_irq_desc(pirq, NULL);
 
     if ( desc == NULL )
     {
@@ -1560,7 +1544,7 @@ static int pirq_guest_force_unbind(struc
     WARN_ON(!spin_is_locked(&d->event_lock));
 
     BUG_ON(!local_irq_is_enabled());
-    desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
+    desc = pirq_spin_lock_irq_desc(pirq, NULL);
     BUG_ON(desc == NULL);
 
     if ( !(desc->status & IRQ_GUEST) )
--- a/xen/drivers/passthrough/io.c
+++ b/xen/drivers/passthrough/io.c
@@ -431,7 +431,7 @@ static void __msi_pirq_eoi(struct domain
         struct pirq *pirq = dpci_pirq(pirq_dpci);
 
          BUG_ON(!local_irq_is_enabled());
-         desc = pirq_spin_lock_irq_desc(d, pirq, NULL);
+         desc = pirq_spin_lock_irq_desc(pirq, NULL);
          if ( !desc )
             return;
 
--- a/xen/include/xen/irq.h
+++ b/xen/include/xen/irq.h
@@ -171,7 +171,7 @@ extern void pirq_set_affinity(struct dom
 extern irq_desc_t *domain_spin_lock_irq_desc(
     struct domain *d, int irq, unsigned long *pflags);
 extern irq_desc_t *pirq_spin_lock_irq_desc(
-    struct domain *, const struct pirq *, unsigned long *pflags);
+    const struct pirq *, unsigned long *pflags);
 
 static inline void set_native_irq_info(unsigned int irq, const cpumask_t *mask)
 {


Attachment: x86-fold-spin_lock_irq_desc.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 1/2] x86: make domain_spin_lock_irq_desc() a wrapper of pirq_spin_lock_irq_desc(), Jan Beulich <=