[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070329174735.GA3216@elte.hu>
Date: Thu, 29 Mar 2007 19:47:35 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Maxim Levitsky <maximlevitsky@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Jeff Chua <jeff.chua.linux@...il.com>,
Adrian Bunk <bunk@...sta.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
"Eric W. Biederman" <ebiederm@...ssion.com>,
"Rafael J. Wysocki" <rjw@...k.pl>, pavel@...e.cz,
linux-pm@...ts.osdl.org, gregkh@...e.de,
linux-pci@...ey.karlin.mff.cuni.cz,
Jens Axboe <jens.axboe@...cle.com>,
Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org,
jgarzik@...ox.com, linux-ide@...r.kernel.org,
"Michael S. Tsirkin" <mst@...lanox.co.il>
Subject: Re: [patch, v2] add suspend/resume for HPET
update: i've tested Maxim's v2 patch on both a hpet-capable and a
hpet-less system, and it works fine here.
on a dual-core hpet-capable system, running a NO_HZ+!HIGH_RES_TIMERS
kernel:
europe:~> grep Clock /proc/timer_list
Clock Event Device: hpet
Clock Event Device: lapic
Clock Event Device: lapic
s2ram works fine now - it hung on resume before.
on a dual-core non-hpet system, with a NO_HZ+!HIGH_RES_TIMERS kernel:
neptune:~> grep Clock /proc/timer_list
Clock Event Device: pit
Clock Event Device: lapic
Clock Event Device: lapic
s2ram worked fine before - and it still works now.
(The combination of NO_HZ+!HIGH_RES_TIMERS was the most fragile wrt.
suspend because in the !HIGH_RES_TIMERS there's just a single instance
after resume that we touch the timer hardware, and we very much rely on
the periodic interrupt being set to the precise value.)
So this is a go on my systems - good work Maxim! (I've reproduced
Maxim's patch below with minor patch-metadata updates.)
Ingo
---------------------------->
Subject: [patch] add suspend/resume for HPET
From: Maxim Levitsky <maximlevitsky@...il.com>
This adds support for suspend/resume on i386 for HPET.
Signed-off-by: Ingo Molnar <mingo@...e.hu>
Signed-off-by: Maxim Levitsky <maximlevitsky@...il.com>
---
arch/i386/kernel/hpet.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+)
Index: linux/arch/i386/kernel/hpet.c
===================================================================
--- linux.orig/arch/i386/kernel/hpet.c
+++ linux/arch/i386/kernel/hpet.c
@@ -3,6 +3,8 @@
#include <linux/errno.h>
#include <linux/hpet.h>
#include <linux/init.h>
+#include <linux/sysdev.h>
+#include <linux/pm.h>
#include <asm/hpet.h>
#include <asm/io.h>
@@ -307,6 +309,7 @@ int __init hpet_enable(void)
out_nohpet:
iounmap(hpet_virt_address);
hpet_virt_address = NULL;
+ boot_hpet_disable = 1;
return 0;
}
@@ -523,3 +526,68 @@ irqreturn_t hpet_rtc_interrupt(int irq,
return IRQ_HANDLED;
}
#endif
+
+
+/*
+ * Suspend/resume part
+ */
+
+#ifdef CONFIG_PM
+
+static int hpet_suspend(struct sys_device *sys_device, pm_message_t state)
+{
+ unsigned long cfg = hpet_readl(HPET_CFG);
+
+ cfg &= ~(HPET_CFG_ENABLE|HPET_CFG_LEGACY);
+ hpet_writel(cfg, HPET_CFG);
+
+ return 0;
+}
+
+static int hpet_resume(struct sys_device *sys_device)
+{
+ unsigned int id;
+
+ hpet_start_counter();
+
+ id = hpet_readl(HPET_ID);
+
+ if (id & HPET_ID_LEGSUP)
+ hpet_enable_int();
+
+ return 0;
+}
+
+static struct sysdev_class hpet_class = {
+ set_kset_name("hpet"),
+ .suspend = hpet_suspend,
+ .resume = hpet_resume,
+};
+
+static struct sys_device hpet_device = {
+ .id = 0,
+ .cls = &hpet_class,
+};
+
+
+static __init int hpet_register_sysfs(void)
+{
+ int err;
+
+ if (!is_hpet_capable())
+ return 0;
+
+ err = sysdev_class_register(&hpet_class);
+
+ if (!err) {
+ err = sysdev_register(&hpet_device);
+ if (err)
+ sysdev_class_unregister(&hpet_class);
+ }
+
+ return err;
+}
+
+device_initcall(hpet_register_sysfs);
+
+#endif
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists