From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Ingo Molnar <mingo@elte.hu>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>
Subject: [PATCH] x86: disable hpet legacy replacement for kexec
Date: Tue, 27 Nov 2007 06:42:40 +0900 [thread overview]
Message-ID: <87sl2s4ran.fsf@duaron.myhome.or.jp> (raw)
In-Reply-To: <20071126193353.GA1676@elte.hu> (Ingo Molnar's message of "Mon, 26 Nov 2007 20:33:53 +0100")
Hi,
This seems to introduced after 2.6.23, so if possible, I'd like to fix
before 2.6.24. What do you think the following?
Thanks.
--
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
If HPET was enabled by pci quirks, we use i8253 as initial clockevent
because pci quirks doesn't run until pci is initialized.
The above means the kernel (or something) is assuming HPET legacy
replacement is disabled and can use i8253 at boot.
If we used kexec, it isn't true. So, this patch disables HPET legacy
replacement for kexec in machine_shutdown().
Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
---
arch/x86/kernel/hpet.c | 14 ++++++++++++++
arch/x86/kernel/reboot_32.c | 4 ++++
arch/x86/kernel/reboot_64.c | 4 ++++
include/asm-x86/hpet.h | 1 +
4 files changed, 23 insertions(+)
diff -puN arch/x86/kernel/hpet.c~kexec-need-to-disable-hpet arch/x86/kernel/hpet.c
--- linux-2.6/arch/x86/kernel/hpet.c~kexec-need-to-disable-hpet 2007-11-24 09:38:23.000000000 +0900
+++ linux-2.6-hirofumi/arch/x86/kernel/hpet.c 2007-11-27 04:57:00.000000000 +0900
@@ -446,6 +446,20 @@ static __init int hpet_late_init(void)
}
fs_initcall(hpet_late_init);
+void hpet_disable(void)
+{
+ if (is_hpet_capable()) {
+ unsigned long cfg = hpet_readl(HPET_CFG);
+
+ if (hpet_legacy_int_enabled) {
+ cfg &= ~HPET_CFG_LEGACY;
+ hpet_legacy_int_enabled = 0;
+ }
+ cfg &= ~HPET_CFG_ENABLE;
+ hpet_writel(cfg, HPET_CFG);
+ }
+}
+
#ifdef CONFIG_HPET_EMULATE_RTC
/* HPET in LegacyReplacement Mode eats up RTC interrupt line. When, HPET
diff -puN arch/x86/kernel/reboot_32.c~kexec-need-to-disable-hpet arch/x86/kernel/reboot_32.c
--- linux-2.6/arch/x86/kernel/reboot_32.c~kexec-need-to-disable-hpet 2007-11-24 09:38:23.000000000 +0900
+++ linux-2.6-hirofumi/arch/x86/kernel/reboot_32.c 2007-11-27 04:57:50.000000000 +0900
@@ -11,6 +11,7 @@
#include <linux/reboot.h>
#include <asm/uaccess.h>
#include <asm/apic.h>
+#include <asm/hpet.h>
#include <asm/desc.h>
#include "mach_reboot.h"
#include <asm/reboot_fixups.h>
@@ -326,6 +327,9 @@ static void native_machine_shutdown(void
#ifdef CONFIG_X86_IO_APIC
disable_IO_APIC();
#endif
+#ifdef CONFIG_HPET_TIMER
+ hpet_disable();
+#endif
}
void __attribute__((weak)) mach_reboot_fixups(void)
diff -puN arch/x86/kernel/reboot_64.c~kexec-need-to-disable-hpet arch/x86/kernel/reboot_64.c
--- linux-2.6/arch/x86/kernel/reboot_64.c~kexec-need-to-disable-hpet 2007-11-24 09:38:23.000000000 +0900
+++ linux-2.6-hirofumi/arch/x86/kernel/reboot_64.c 2007-11-27 04:57:56.000000000 +0900
@@ -17,6 +17,7 @@
#include <asm/pgtable.h>
#include <asm/tlbflush.h>
#include <asm/apic.h>
+#include <asm/hpet.h>
#include <asm/gart.h>
/*
@@ -113,6 +114,9 @@ void machine_shutdown(void)
disable_IO_APIC();
+#ifdef CONFIG_HPET_TIMER
+ hpet_disable();
+#endif
local_irq_restore(flags);
pci_iommu_shutdown();
diff -puN include/asm-x86/hpet.h~kexec-need-to-disable-hpet include/asm-x86/hpet.h
--- linux-2.6/include/asm-x86/hpet.h~kexec-need-to-disable-hpet 2007-11-24 09:38:23.000000000 +0900
+++ linux-2.6-hirofumi/include/asm-x86/hpet.h 2007-11-27 04:54:32.000000000 +0900
@@ -61,6 +61,7 @@ extern unsigned long force_hpet_address;
extern int hpet_force_user;
extern int is_hpet_enabled(void);
extern int hpet_enable(void);
+extern void hpet_disable(void);
extern unsigned long hpet_readl(unsigned long a);
extern void force_hpet_resume(void);
_
next prev parent reply other threads:[~2007-11-26 21:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-11-26 19:33 [git pull] x86 arch fixes for v2.6.24 Ingo Molnar
2007-11-26 21:42 ` OGAWA Hirofumi [this message]
2007-11-26 23:03 ` [PATCH] x86: disable hpet legacy replacement for kexec Ingo Molnar
2007-11-27 18:17 ` Pallipadi, Venkatesh
2007-12-02 16:40 ` [PATCH] x86: disable hpet legacy replacement for kdump OGAWA Hirofumi
2007-12-02 16:42 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sl2s4ran.fsf@duaron.myhome.or.jp \
--to=hirofumi@mail.parknet.co.jp \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®