From patchwork Thu Apr 23 02:27:40 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 19467 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n3N2S9hd016189 for ; Thu, 23 Apr 2009 02:28:09 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752348AbZDWC1t (ORCPT ); Wed, 22 Apr 2009 22:27:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753145AbZDWC1t (ORCPT ); Wed, 22 Apr 2009 22:27:49 -0400 Received: from vms173003pub.verizon.net ([206.46.173.3]:59082 "EHLO vms173003pub.verizon.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752254AbZDWC1s (ORCPT ); Wed, 22 Apr 2009 22:27:48 -0400 Received: from localhost.localdomain ([96.237.168.40]) by vms173003.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KIJ00BV3866E8GW@vms173003.mailsrvcs.net>; Wed, 22 Apr 2009 21:27:42 -0500 (CDT) Received: from localhost.localdomain (d975xbx2 [127.0.0.1]) by localhost.localdomain (8.14.2/8.14.2) with ESMTP id n3N2RfaC030851; Wed, 22 Apr 2009 22:27:41 -0400 Received: from localhost (lenb@localhost) by localhost.localdomain (8.14.2/8.14.2/Submit) with ESMTP id n3N2Rehx030846; Wed, 22 Apr 2009 22:27:41 -0400 X-Authentication-warning: localhost.localdomain: lenb owned process doing -bs Date: Wed, 22 Apr 2009 22:27:40 -0400 (EDT) From: Len Brown X-X-Sender: lenb@localhost.localdomain To: x86@kernel.org Cc: Linux Kernel Mailing List , Venkatesh Pallipadi , linux-acpi@vger.kernel.org Subject: [PATCH] x86/hpet: prevent boot hang when hpet=force used on old ICH Message-id: User-Agent: Alpine 2.00 (LFD 1167 2008-08-23) MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org From: Len Brown Linux tells ICH4 users that they can (manually) invoke "hpet=force" to enable the undocumented HPET. The HPET becomes available for both clocksource and clockevents. But as of ff69f2bba67bd45514923aaedbf40fe351787c59 (acpi: fix of pmtimer overflow that make Cx states time incorrect) the hpet may be used for idle accounting, and hpet=force on an ICH4 box hangs boot. It turns out that reading the HPET timer immediately after return from C3 hangs. Well, the reason we enable the HPET on these systems is primarily for clockevents -- the HPET has a longer maximum timer duration than the PIT. HPET as a clocksource is less interesting. So for "hpet=force" on old ICH, allow HPET clockevents, but do not allow HPET as a clocksource. http://bugzilla.kernel.org/show_bug.cgi?id=13087 Signed-off-by: Len Brown --- Ingo/Peter/Thomas, This regression was filed against ACPI, but the fix is under x86. I'd wait for Venki's ack on anything related to HPET, and I can send via your tree or yours, just let me know. thanks, -Len arch/x86/include/asm/hpet.h | 1 + arch/x86/kernel/hpet.c | 5 +++++ arch/x86/kernel/quirks.c | 4 ++++ 3 files changed, 10 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/hpet.h b/arch/x86/include/asm/hpet.h index 1c22cb0..39d4e86 100644 --- a/arch/x86/include/asm/hpet.h +++ b/arch/x86/include/asm/hpet.h @@ -66,6 +66,7 @@ extern unsigned long hpet_address; extern unsigned long force_hpet_address; extern int hpet_force_user; +extern int hpet_is_forced_old_ich(void); extern int is_hpet_enabled(void); extern int hpet_enable(void); extern void hpet_disable(void); diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c index 3f0019e..8b061c7 100644 --- a/arch/x86/kernel/hpet.c +++ b/arch/x86/kernel/hpet.c @@ -752,6 +752,11 @@ static int hpet_clocksource_register(void) u64 start, now; cycle_t t1; + if (hpet_is_forced_old_ich()) { + printk(KERN_WARNING "hpet: hpet=force on old ICH enables clockevents," + " but not clocksource.\n"); + return -ENODEV; + } /* Start the counter */ hpet_restart_counter(); diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c index e95022e..9e4d73d 100644 --- a/arch/x86/kernel/quirks.c +++ b/arch/x86/kernel/quirks.c @@ -253,6 +253,10 @@ static void old_ich_force_enable_hpet(struct pci_dev *dev) dev_printk(KERN_DEBUG, &dev->dev, "Failed to force enable HPET\n"); } +int hpet_is_forced_old_ich() { + return (force_hpet_resume_type == OLD_ICH_FORCE_HPET_RESUME); +} + /* * Undocumented chipset features. Make sure that the user enforced * this.