ia64/xen-unstable

changeset 18074:806e66a6cb1a

x86 Cx: Add option hpetbroadcast to force enabling hpet_broadcast.

This option can be used for test & experiment purpose.

Signed-off-by: Wei Gang <gang.wei@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 16 13:57:34 2008 +0100 (2008-07-16)
parents 099aaca15ae6
children cdece2b30df6
files xen/arch/x86/time.c
line diff
     1.1 --- a/xen/arch/x86/time.c	Wed Jul 16 13:54:02 2008 +0100
     1.2 +++ b/xen/arch/x86/time.c	Wed Jul 16 13:57:34 2008 +0100
     1.3 @@ -1079,23 +1079,38 @@ void __init early_time_init(void)
     1.4      setup_irq(0, &irq0);
     1.5  }
     1.6  
     1.7 +/* force_hpet_broadcast: if true, force using hpet_broadcast to fix lapic stop
     1.8 +   issue for deep C state with pit disabled */
     1.9 +static int force_hpet_broadcast;
    1.10 +boolean_param("hpetbroadcast", force_hpet_broadcast);
    1.11 +
    1.12  /* keep pit enabled for pit_broadcast working while cpuidle enabled */
    1.13  static int disable_pit_irq(void)
    1.14  {
    1.15 -    if ( !using_pit && cpu_has_apic && !xen_cpuidle )
    1.16 -    {
    1.17 -        /* Disable PIT CH0 timer interrupt. */
    1.18 -        outb_p(0x30, PIT_MODE);
    1.19 -        outb_p(0, PIT_CH0);
    1.20 -        outb_p(0, PIT_CH0);
    1.21 +    if ( using_pit || !cpu_has_apic || (xen_cpuidle && !force_hpet_broadcast) )
    1.22 +        return 0;
    1.23  
    1.24 -        /*
    1.25 -         * If we do not rely on PIT CH0 then we can use HPET for one-shot
    1.26 -         * timer emulation when entering deep C states.
    1.27 -         */
    1.28 -        /*hpet_broadcast_init(); XXX dom0 may rely on RTC interrupt delivery */
    1.29 +    /*
    1.30 +     * If we do not rely on PIT CH0 then we can use HPET for one-shot timer 
    1.31 +     * emulation when entering deep C states.
    1.32 +     * XXX dom0 may rely on RTC interrupt delivery, so only enable
    1.33 +     * hpet_broadcast if force_hpet_broadcast.
    1.34 +     */
    1.35 +    if ( xen_cpuidle && force_hpet_broadcast )
    1.36 +    {
    1.37 +        hpet_broadcast_init();
    1.38 +        if ( !hpet_broadcast_is_available() )
    1.39 +        {
    1.40 +            printk("HPET broadcast init failed, turn to PIT broadcast.\n");
    1.41 +            return 0;
    1.42 +        }
    1.43      }
    1.44  
    1.45 +    /* Disable PIT CH0 timer interrupt. */
    1.46 +    outb_p(0x30, PIT_MODE);
    1.47 +    outb_p(0, PIT_CH0);
    1.48 +    outb_p(0, PIT_CH0);
    1.49 +
    1.50      return 0;
    1.51  }
    1.52  __initcall(disable_pit_irq);