From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: the arch/x86 maintainers <x86@kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
Venkatesh Pallipadi <venki@google.com>
Subject: [PATCH] x86: Do not try to disable hpet if it hasn't been initialized before
Date: Thu, 22 Jul 2010 16:22:42 -0700 [thread overview]
Message-ID: <4C48D2C2.20303@goop.org> (raw)
[ x86 folk: While this patch is just a generic x86 bugfix, it really only affects
the Xen pv-on-hvm patch series that I'm going to post shortly. Do you want to
commit it separately via tip.git, or are you OK with me sending it to Linus
directly? - J ]
hpet_disable is called unconditionally on machine reboot if hpet support
is compiled in the kernel.
hpet_disable only checks if the machine is hpet capable but doesn't make
sure that hpet has been initialized.
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Venkatesh Pallipadi <venki@google.com>
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index a198b7c..9e90dac 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -964,16 +964,18 @@ fs_initcall(hpet_late_init);
void hpet_disable(void)
{
- if (is_hpet_capable()) {
- unsigned int cfg = hpet_readl(HPET_CFG);
+ unsigned int cfg;
- if (hpet_legacy_int_enabled) {
- cfg &= ~HPET_CFG_LEGACY;
- hpet_legacy_int_enabled = 0;
- }
- cfg &= ~HPET_CFG_ENABLE;
- hpet_writel(cfg, HPET_CFG);
+ if (!is_hpet_capable() || !hpet_address || !hpet_virt_address)
+ return;
+
+ 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
next reply other threads:[~2010-07-22 23:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-22 23:22 Jeremy Fitzhardinge [this message]
2010-07-22 23:37 ` [PATCH] x86: Do not try to disable hpet if it hasn't been initialized before H. Peter Anvin
2010-07-23 0:12 ` Jeremy Fitzhardinge
-- strict thread matches above, loose matches on Subject: below --
2010-07-21 17:32 Stefano Stabellini
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=4C48D2C2.20303@goop.org \
--to=jeremy@goop.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=venki@google.com \
--cc=x86@kernel.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 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.