* [PATCH] x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked
@ 2011-11-18 15:33 Andreas Herrmann
2011-11-30 12:19 ` Andreas Herrmann
2011-12-08 20:52 ` [tip:x86/urgent] " tip-bot for Mark Langsdorf
0 siblings, 2 replies; 3+ messages in thread
From: Andreas Herrmann @ 2011-11-18 15:33 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel
From: Mark Langsdorf <mark.langsdorf@amd.com>
When HPET is operating in RTC mode, the TN_ENABLE bit
on timer1 controls whether the HPET or the RTC delivers
interrupts to irq8. When the system goes into suspend,
the RTC driver sends a signal to the HPET driver so
that the HPET releases control of irq8, allowing the
RTC to wake the system from suspend. The switchover
is accomplished by a write to the HPET configuration
registers which currently only occurs while servicing
the HPET interrupt.
On some systems, I have seen the system suspend before
an HPET interrupt occurs, preventing the write to the
HPET configuration register and leaving the HPET in
control of the irq8. As the HPET is not active during
suspend, it does not generate a wake signal and RTC
alarms do not work.
This patch forces the HPET driver to immediately transfer
control of the irq8 channel to the RTC instead of waiting
until the next interrupt event.
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Tested-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
---
arch/x86/kernel/hpet.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
Hi,
Resending Mark's patch. Seems that it was lost in space a couple of
weeks ago.
Please apply.
(Patch was built against Linus' git tree as of v3.2-rc2-101-g15bd1cf.)
Thanks,
Andreas
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index b946a9e..1bb0bf4 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -1049,6 +1049,14 @@ int hpet_rtc_timer_init(void)
}
EXPORT_SYMBOL_GPL(hpet_rtc_timer_init);
+static void hpet_disable_rtc_channel(void)
+{
+ unsigned long cfg;
+ cfg = hpet_readl(HPET_T1_CFG);
+ cfg &= ~HPET_TN_ENABLE;
+ hpet_writel(cfg, HPET_T1_CFG);
+}
+
/*
* The functions below are called from rtc driver.
* Return 0 if HPET is not being used.
@@ -1060,6 +1068,9 @@ int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
return 0;
hpet_rtc_flags &= ~bit_mask;
+ if (unlikely(!hpet_rtc_flags))
+ hpet_disable_rtc_channel();
+
return 1;
}
EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit);
@@ -1125,15 +1136,11 @@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq);
static void hpet_rtc_timer_reinit(void)
{
- unsigned int cfg, delta;
+ unsigned int delta;
int lost_ints = -1;
- if (unlikely(!hpet_rtc_flags)) {
- cfg = hpet_readl(HPET_T1_CFG);
- cfg &= ~HPET_TN_ENABLE;
- hpet_writel(cfg, HPET_T1_CFG);
- return;
- }
+ if (unlikely(!hpet_rtc_flags))
+ hpet_disable_rtc_channel();
if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit)
delta = hpet_default_delta;
--
1.7.7
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked
2011-11-18 15:33 [PATCH] x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked Andreas Herrmann
@ 2011-11-30 12:19 ` Andreas Herrmann
2011-12-08 20:52 ` [tip:x86/urgent] " tip-bot for Mark Langsdorf
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Herrmann @ 2011-11-30 12:19 UTC (permalink / raw)
To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner; +Cc: linux-kernel
Hi,
Can you please apply this patch?
Or are there any objections?
Regards,
Andreas
^ permalink raw reply [flat|nested] 3+ messages in thread
* [tip:x86/urgent] x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked
2011-11-18 15:33 [PATCH] x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked Andreas Herrmann
2011-11-30 12:19 ` Andreas Herrmann
@ 2011-12-08 20:52 ` tip-bot for Mark Langsdorf
1 sibling, 0 replies; 3+ messages in thread
From: tip-bot for Mark Langsdorf @ 2011-12-08 20:52 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, hpa, mingo, andreas.herrmann3, mark.langsdorf, tglx
Commit-ID: 2ded6e6a94c98ea453a156748cb7fabaf39a76b9
Gitweb: http://git.kernel.org/tip/2ded6e6a94c98ea453a156748cb7fabaf39a76b9
Author: Mark Langsdorf <mark.langsdorf@amd.com>
AuthorDate: Fri, 18 Nov 2011 16:33:06 +0100
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 8 Dec 2011 21:47:22 +0100
x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked
When HPET is operating in RTC mode, the TN_ENABLE bit on timer1
controls whether the HPET or the RTC delivers interrupts to irq8. When
the system goes into suspend, the RTC driver sends a signal to the
HPET driver so that the HPET releases control of irq8, allowing the
RTC to wake the system from suspend. The switchover is accomplished by
a write to the HPET configuration registers which currently only
occurs while servicing the HPET interrupt.
On some systems, I have seen the system suspend before an HPET
interrupt occurs, preventing the write to the HPET configuration
register and leaving the HPET in control of the irq8. As the HPET is
not active during suspend, it does not generate a wake signal and RTC
alarms do not work.
This patch forces the HPET driver to immediately transfer control of
the irq8 channel to the RTC instead of waiting until the next
interrupt event.
Signed-off-by: Mark Langsdorf <mark.langsdorf@amd.com>
Link: http://lkml.kernel.org/r/20111118153306.GB16319@alberich.amd.com
Tested-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
---
arch/x86/kernel/hpet.c | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index b946a9e..1bb0bf4 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -1049,6 +1049,14 @@ int hpet_rtc_timer_init(void)
}
EXPORT_SYMBOL_GPL(hpet_rtc_timer_init);
+static void hpet_disable_rtc_channel(void)
+{
+ unsigned long cfg;
+ cfg = hpet_readl(HPET_T1_CFG);
+ cfg &= ~HPET_TN_ENABLE;
+ hpet_writel(cfg, HPET_T1_CFG);
+}
+
/*
* The functions below are called from rtc driver.
* Return 0 if HPET is not being used.
@@ -1060,6 +1068,9 @@ int hpet_mask_rtc_irq_bit(unsigned long bit_mask)
return 0;
hpet_rtc_flags &= ~bit_mask;
+ if (unlikely(!hpet_rtc_flags))
+ hpet_disable_rtc_channel();
+
return 1;
}
EXPORT_SYMBOL_GPL(hpet_mask_rtc_irq_bit);
@@ -1125,15 +1136,11 @@ EXPORT_SYMBOL_GPL(hpet_rtc_dropped_irq);
static void hpet_rtc_timer_reinit(void)
{
- unsigned int cfg, delta;
+ unsigned int delta;
int lost_ints = -1;
- if (unlikely(!hpet_rtc_flags)) {
- cfg = hpet_readl(HPET_T1_CFG);
- cfg &= ~HPET_TN_ENABLE;
- hpet_writel(cfg, HPET_T1_CFG);
- return;
- }
+ if (unlikely(!hpet_rtc_flags))
+ hpet_disable_rtc_channel();
if (!(hpet_rtc_flags & RTC_PIE) || hpet_pie_limit)
delta = hpet_default_delta;
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-12-08 20:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-18 15:33 [PATCH] x86, hpet: Immediately disable HPET timer 1 if rtc irq is masked Andreas Herrmann
2011-11-30 12:19 ` Andreas Herrmann
2011-12-08 20:52 ` [tip:x86/urgent] " tip-bot for Mark Langsdorf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox