x86: Do not try to disable hpet if it hasn't been initialized before
PATCH 1/1 x86: Do not try to disable hpet if it hasn't been initialized before
[ 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.
arch/x86/kernel/hpet.c +10 -8
@@ -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
H. Peter Anvin
reviewerQuoted 5 lines · Jeremy Fitzhardinge
[ 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 ]
I think it would be best if we took it via tip:x86/urgent, if that is okay with you.
-hpa
Quoted 10 lines · H. Peter Anvin
Quoted 8 lines · Jeremy Fitzhardinge
[ 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 ]
Quoted 2 lines
I think it would be best if we took it via tip:x86/urgent, if that is okay with you.
Sure.
Thanks,
J