HPET boot option for the new standard interrupt delivery mode
PATCH 7/8 HPET boot option for the new standard interrupt delivery mode
Add a new boot option related to HPET. Current mode of HPET functioning:
(1) If HPET is listed in BIOS:
default: HPET gets detected at boot time and gets enabled in "legacy replacement" mode.
"hpet=standard" boot option: HPET does not get used during early boot and PIT will be used in early boot. HPET gets enabled in "standard" mode during late boot stages.
"hpet=disable" boot option: HPET is disabled and not used.
(2) If HPET is not listed in BIOS and force detected with PCI quirks:
default: HPET does not get used during early boot and
PIT will be used in early boot. HPET gets enabled in "standard" mode during late boot stages.
"hpet=disable" boot option: HPET is disabled and not used.
We can change the default behavior of (1) to match (2) after this patch gets some testing.
include/asm-i386/hpet.h +2 -2
@@ -112,7 +112,7 @@extern int is_hpet_capable (void );extern int hpet_readl (unsigned long a);#else -extern int hpet_enable (void ); +extern int hpet_enable (int early_call);#endif #ifdef CONFIG_HPET_EMULATE_RTC
@@ -127,7 +127,7 @@#else -static inline int hpet_enable (void ) {return 0 ; } +static inline int hpet_enable (int early_call) {return 0 ; }#endif /* CONFIG_HPET_TIMER */ #endif /* _I386_HPET_H */
arch/i386/kernel/time.c +1 -1
@@ -264,7 +264,7 @@/* Duplicate of time_init() below, with hpet_enable part added */ void __init hpet_time_init (void ) { -if (!hpet_enable ()) +if (!hpet_enable (1 ))setup_pit_timer ();time_init_hook (); }
arch/i386/kernel/hpet.c +13 -6
@@ -51,6 +51,8 @@if (str) {if (!strncmp ("disable" , str,7 )) boot_hpet_disable =1 ; +else if (!strncmp ("standard" , str,9 )) + hpet_preferred_int_mode =HPET_INT_STD ; }return 1 ; }
@@ -723,13 +725,16 @@/* * Try to setup the HPET timer */ -int __init hpet_enable (void ) +int __init hpet_enable (int early_call) {unsigned long id;if (hpet_virt_address)return 0 ; +if (early_call && hpet_preferred_int_mode ==HPET_INT_STD ) +return 0 ; +if (!is_hpet_capable ())return 0 ;
@@ -784,13 +789,15 @@if (boot_hpet_disable)return -ENODEV ; -if (!hpet_address) { -if (!force_hpet_address) -return -ENODEV ; +if (!hpet_virt_address) { +if (!hpet_address) { +if (!force_hpet_address) +return -ENODEV ; - hpet_address = force_hpet_address; + hpet_address = force_hpet_address; + } hpet_preferred_int_mode =HPET_INT_STD ; - ret =hpet_enable (); + ret =hpet_enable (0 );if (ret <0 || !hpet_virt_address)return -ENODEV ; }
Documentation/kernel-parameters.txt +2 -2
@@ -384,8 +384,8 @@ over the 8254 in addition to over the IO-APIC. The kernel tries to set a sensible default. - hpet= [IA-32,HPET] option to disable HPET and use PIT. - Format: disable + hpet= [IA-32,HPET] option to choose HPET modes. + Format: {disable | standard} cm206= [HW,CD] Format: { auto | [<io>,][<irq>] }