All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konstantin Baydarov <kbaidarov@ru.mvista.com>
To: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: vgoyal@in.ibm.com, RT <linux-rt-users@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	Andi Kleen <ak@suse.de>
Subject: Re: [PATCH] kexec: reenable HPET before kexec
Date: Tue, 28 Aug 2007 16:58:32 +0400	[thread overview]
Message-ID: <20070828165832.5047d4de@windmill.dev.rtsoft.ru> (raw)
In-Reply-To: <653FFBB4508B9042B5D43DC9E18836F501522051@scsmsx415.amr.corp.intel.com>

On Mon, 27 Aug 2007 11:26:29 -0700
"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com> wrote:

> 
> 
> - Another thing to try is to disable HPET and boot with PIT in the
> first kernel. Just to check whether PIT never works on this platform
> or the first kernel is doing something to stop PIT. You can try
> "hpet=disable" boot option for that.
> 
> Thanks,
> Venki

I've tried kernel 1 with HPET disabled - it boots fine, PIT works!
Then I made additional investigations and found out that PIT won't work
in kernel 2 if bit HPET_CFG_LEGACY is set.
Bit HPET_CFG_LEGACY is set by hpet_enable_int() during HPET
initialization, so if this bit is cleared in machine_kexec() kernel 2
boots fine.
I can't explain this magic, maybe someone can explain this. Thanks.

Here is new version of workaround for 2.6.23-rc3

Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>

 arch/i386/kernel/hpet.c          |   12 ++++++++++++
 arch/i386/kernel/machine_kexec.c |    6 ++++++
 include/asm-i386/hpet.h          |    3 +++
 3 files changed, 21 insertions(+)

Index: linux-2.6.23-rc3/arch/i386/kernel/hpet.c
===================================================================
--- linux-2.6.23-rc3.orig/arch/i386/kernel/hpet.c
+++ linux-2.6.23-rc3/arch/i386/kernel/hpet.c
@@ -149,6 +149,18 @@ static void hpet_enable_int(void)
 	hpet_legacy_int_enabled = 1;
 }
 
+#ifdef CONFIG_KEXEC
+void hpet_disable_int(void)
+{
+	unsigned long cfg = hpet_readl(HPET_CFG);
+
+	cfg &= ~HPET_CFG_LEGACY;
+	hpet_writel(cfg, HPET_CFG);
+	hpet_legacy_int_enabled = 0;
+
+}
+#endif
+
 static void hpet_set_mode(enum clock_event_mode mode,
 			  struct clock_event_device *evt)
 {
Index: linux-2.6.23-rc3/arch/i386/kernel/machine_kexec.c
===================================================================
--- linux-2.6.23-rc3.orig/arch/i386/kernel/machine_kexec.c
+++ linux-2.6.23-rc3/arch/i386/kernel/machine_kexec.c
@@ -19,6 +19,7 @@
 #include <asm/cpufeature.h>
 #include <asm/desc.h>
 #include <asm/system.h>
+#include <asm/hpet.h>
 
 #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
 static u32 kexec_pgd[1024] PAGE_ALIGNED;
@@ -109,6 +110,11 @@ NORET_TYPE void machine_kexec(struct kim
 	/* Interrupts aren't acceptable while we reboot */
 	local_irq_disable();
 
+#ifdef CONFIG_HPET_TIMER
+	/* Without this PIT won't work in executed kernel */
+	hpet_disable_int();
+#endif
+
 	control_page = page_address(image->control_code_page);
 	memcpy(control_page, relocate_kernel, PAGE_SIZE);
 
Index: linux-2.6.23-rc3/include/asm-i386/hpet.h
===================================================================
--- linux-2.6.23-rc3.orig/include/asm-i386/hpet.h
+++ linux-2.6.23-rc3/include/asm-i386/hpet.h
@@ -66,6 +66,9 @@
 extern unsigned long hpet_address;
 extern int is_hpet_enabled(void);
 extern int hpet_enable(void);
+#ifdef CONFIG_KEXEC
+extern void hpet_disable_int(void);
+#endif
 
 #ifdef CONFIG_HPET_EMULATE_RTC
 

WARNING: multiple messages have this Message-ID (diff)
From: Konstantin Baydarov <kbaidarov@ru.mvista.com>
To: "Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com>
Cc: <vgoyal@in.ibm.com>, "RT" <linux-rt-users@vger.kernel.org>,
	"linux-kernel" <linux-kernel@vger.kernel.org>,
	"Eric W. Biederman" <ebiederm@xmission.com>,
	"Andi Kleen" <ak@suse.de>
Subject: Re: [PATCH] kexec: reenable HPET before kexec
Date: Tue, 28 Aug 2007 16:58:32 +0400	[thread overview]
Message-ID: <20070828165832.5047d4de@windmill.dev.rtsoft.ru> (raw)
In-Reply-To: <653FFBB4508B9042B5D43DC9E18836F501522051@scsmsx415.amr.corp.intel.com>

On Mon, 27 Aug 2007 11:26:29 -0700
"Pallipadi, Venkatesh" <venkatesh.pallipadi@intel.com> wrote:

> 
> 
> - Another thing to try is to disable HPET and boot with PIT in the
> first kernel. Just to check whether PIT never works on this platform
> or the first kernel is doing something to stop PIT. You can try
> "hpet=disable" boot option for that.
> 
> Thanks,
> Venki

I've tried kernel 1 with HPET disabled - it boots fine, PIT works!
Then I made additional investigations and found out that PIT won't work
in kernel 2 if bit HPET_CFG_LEGACY is set.
Bit HPET_CFG_LEGACY is set by hpet_enable_int() during HPET
initialization, so if this bit is cleared in machine_kexec() kernel 2
boots fine.
I can't explain this magic, maybe someone can explain this. Thanks.

Here is new version of workaround for 2.6.23-rc3

Signed-off-by: Konstantin Baydarov <kbaidarov@ru.mvista.com>

 arch/i386/kernel/hpet.c          |   12 ++++++++++++
 arch/i386/kernel/machine_kexec.c |    6 ++++++
 include/asm-i386/hpet.h          |    3 +++
 3 files changed, 21 insertions(+)

Index: linux-2.6.23-rc3/arch/i386/kernel/hpet.c
===================================================================
--- linux-2.6.23-rc3.orig/arch/i386/kernel/hpet.c
+++ linux-2.6.23-rc3/arch/i386/kernel/hpet.c
@@ -149,6 +149,18 @@ static void hpet_enable_int(void)
 	hpet_legacy_int_enabled = 1;
 }
 
+#ifdef CONFIG_KEXEC
+void hpet_disable_int(void)
+{
+	unsigned long cfg = hpet_readl(HPET_CFG);
+
+	cfg &= ~HPET_CFG_LEGACY;
+	hpet_writel(cfg, HPET_CFG);
+	hpet_legacy_int_enabled = 0;
+
+}
+#endif
+
 static void hpet_set_mode(enum clock_event_mode mode,
 			  struct clock_event_device *evt)
 {
Index: linux-2.6.23-rc3/arch/i386/kernel/machine_kexec.c
===================================================================
--- linux-2.6.23-rc3.orig/arch/i386/kernel/machine_kexec.c
+++ linux-2.6.23-rc3/arch/i386/kernel/machine_kexec.c
@@ -19,6 +19,7 @@
 #include <asm/cpufeature.h>
 #include <asm/desc.h>
 #include <asm/system.h>
+#include <asm/hpet.h>
 
 #define PAGE_ALIGNED __attribute__ ((__aligned__(PAGE_SIZE)))
 static u32 kexec_pgd[1024] PAGE_ALIGNED;
@@ -109,6 +110,11 @@ NORET_TYPE void machine_kexec(struct kim
 	/* Interrupts aren't acceptable while we reboot */
 	local_irq_disable();
 
+#ifdef CONFIG_HPET_TIMER
+	/* Without this PIT won't work in executed kernel */
+	hpet_disable_int();
+#endif
+
 	control_page = page_address(image->control_code_page);
 	memcpy(control_page, relocate_kernel, PAGE_SIZE);
 
Index: linux-2.6.23-rc3/include/asm-i386/hpet.h
===================================================================
--- linux-2.6.23-rc3.orig/include/asm-i386/hpet.h
+++ linux-2.6.23-rc3/include/asm-i386/hpet.h
@@ -66,6 +66,9 @@
 extern unsigned long hpet_address;
 extern int is_hpet_enabled(void);
 extern int hpet_enable(void);
+#ifdef CONFIG_KEXEC
+extern void hpet_disable_int(void);
+#endif
 
 #ifdef CONFIG_HPET_EMULATE_RTC
 

  parent reply	other threads:[~2007-08-28 12:52 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-20 16:55 [PATCH] kexec: reenable HPET before kexec Konstantin Baydarov
2007-08-20 18:26 ` Andi Kleen
2007-08-20 21:10 ` Konstantin Baydarov
2007-08-20 21:31   ` Daniel Walker
2007-08-21 13:01     ` Konstantin Baydarov
2007-08-23  9:08 ` Vivek Goyal
2007-08-23 11:49   ` Konstantin Baydarov
2007-08-27  5:36     ` Vivek Goyal
2007-08-27 18:26       ` Pallipadi, Venkatesh
2007-08-27 18:33         ` Eric W. Biederman
2007-08-28 12:58         ` Konstantin Baydarov [this message]
2007-08-28 12:58           ` Konstantin Baydarov
2007-08-30  7:32           ` Eric W. Biederman
2007-08-30  7:32             ` Eric W. Biederman
2007-08-30 16:07             ` Konstantin Baydarov
2007-08-30 16:07               ` Konstantin Baydarov
2007-08-30 18:04               ` Eric W. Biederman
2007-08-30 18:04                 ` Eric W. Biederman
2007-08-30 18:04                 ` Eric W. Biederman
2007-08-31 10:31                 ` Konstantin Baydarov
2007-08-31 10:31                   ` Konstantin Baydarov
2007-09-17  9:47                   ` Konstantin Baydarov
2007-09-17  9:47                     ` Konstantin Baydarov

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=20070828165832.5047d4de@windmill.dev.rtsoft.ru \
    --to=kbaidarov@ru.mvista.com \
    --cc=ak@suse.de \
    --cc=ebiederm@xmission.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=venkatesh.pallipadi@intel.com \
    --cc=vgoyal@in.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.