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

[Xen-changelog] [xen-unstable] ACPI S3: fix S3 resume fail on system w/ msi capable hpet



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1267193132 0
# Node ID 82661c9ad896470ddfa168028894c5190e462627
# Parent  bb7164fc680a2cb0253d7e4dfaacf0466fa687e4
ACPI S3: fix S3 resume fail on system w/ msi capable hpet

Don't re-allocate memory for irq_channel which will cause a BUG_ON in
hpet_msi_write, and make sure hpet_setup_msi_irq() executed during S3
resuming.

Signed-off-by: Wei Gang <gang.wei@xxxxxxxxx>
---
 xen/arch/x86/hpet.c |   40 +++++++++++++++++++++++-----------------
 1 files changed, 23 insertions(+), 17 deletions(-)

diff -r bb7164fc680a -r 82661c9ad896 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Fri Feb 26 08:13:02 2010 +0000
+++ b/xen/arch/x86/hpet.c       Fri Feb 26 14:05:32 2010 +0000
@@ -39,11 +39,12 @@ struct hpet_event_channel
 
     unsigned int idx;   /* physical channel idx */
     int cpu;            /* msi target */
-    unsigned int irq;/* msi irq */
+    int irq;            /* msi irq */
     unsigned int flags; /* HPET_EVT_x */
 } __cacheline_aligned;
 static struct hpet_event_channel legacy_hpet_event;
-static struct hpet_event_channel hpet_events[MAX_HPET_NUM];
+static struct hpet_event_channel hpet_events[MAX_HPET_NUM] = 
+    { [0 ... MAX_HPET_NUM-1].irq = -1 };
 static unsigned int num_hpets_used; /* msi hpet channels used for broadcast */
 
 DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel);
@@ -353,24 +354,26 @@ static int hpet_setup_msi_irq(unsigned i
 
 static int hpet_assign_irq(struct hpet_event_channel *ch)
 {
-    int irq;
-
-    if ( ch->irq )
-        return 0;
-
-    if ( (irq = create_irq()) < 0 )
-        return irq;
-
-    irq_channel[irq] = ch - &hpet_events[0];
-
+    int irq = ch->irq;
+
+    if ( irq < 0 )
+    {
+        if ( (irq = create_irq()) < 0 )
+            return irq;
+
+        irq_channel[irq] = ch - &hpet_events[0];
+        ch->irq = irq;
+    }
+
+    /* hpet_setup_msi_irq should also be called for S3 resuming */
     if ( hpet_setup_msi_irq(irq) )
     {
         destroy_irq(irq);
         irq_channel[irq] = -1;
+        ch->irq = -1;
         return -EINVAL;
     }
 
-    ch->irq = irq;
     return 0;
 }
 
@@ -532,10 +535,13 @@ void hpet_broadcast_init(void)
     u32 hpet_id, cfg;
     int i;
 
-    irq_channel= xmalloc_array(int, nr_irqs);
-    BUG_ON(!irq_channel);
-    for (i = 0; i < nr_irqs ; i++)
-        irq_channel[i] = -1;
+    if ( irq_channel == NULL )
+    {
+        irq_channel = xmalloc_array(int, nr_irqs);
+        BUG_ON(irq_channel == NULL);
+        for ( i = 0; i < nr_irqs; i++ )
+            irq_channel[i] = -1;
+    }
 
     hpet_rate = hpet_setup();
     if ( hpet_rate == 0 )

_______________________________________________
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®.