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] ACPI S3: fix S3 resume fail on system w/ msi capable

To: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] ACPI S3: fix S3 resume fail on system w/ msi capable hpet
From: "Wei, Gang" <gang.wei@xxxxxxxxx>
Date: Fri, 26 Feb 2010 17:39:05 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Fri, 26 Feb 2010 01:41:27 -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
Thread-index: Acq2x4lvvg1tT78yTSaZMWE9t5CY6w==
Thread-topic: [PATCH] ACPI S3: fix S3 resume fail on system w/ msi capable hpet
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>

diff -r 927fd1587daf xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Fri Feb 26 16:00:41 2010 +0800
+++ b/xen/arch/x86/hpet.c       Fri Feb 26 17:18:11 2010 +0800
@@ -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,14 @@ 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;
+    /* irq_channel should not be re-initialized during S3 resuming */
+    if ( !irq_channel )
+    {
+        irq_channel= xmalloc_array(int, nr_irqs);
+        BUG_ON(!irq_channel);
+        for ( i = 0; i < nr_irqs ; i++ )
+            irq_channel[i] = -1;
+    }
 
     hpet_rate = hpet_setup();
     if ( hpet_rate == 0 )

Attachment: fix_msi_hpet_s3_v2.patch
Description: fix_msi_hpet_s3_v2.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] ACPI S3: fix S3 resume fail on system w/ msi capable hpet, Wei, Gang <=