direct-io.hg

changeset 14326:cedf9e4ac6ff

linux: Use new time hypercalls.
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Mar 09 19:36:24 2007 +0000 (2007-03-09)
parents 83756471416f
children 8fa8de63abf4
files linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c linux-2.6-xen-sparse/drivers/xen/Kconfig
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Fri Mar 09 19:34:52 2007 +0000
     1.2 +++ b/linux-2.6-xen-sparse/arch/i386/kernel/time-xen.c	Fri Mar 09 19:36:24 2007 +0000
     1.3 @@ -907,6 +907,10 @@ static void setup_cpu0_timer_irq(void)
     1.4  	BUG_ON(per_cpu(timer_irq, 0) < 0);
     1.5  }
     1.6  
     1.7 +static struct vcpu_set_periodic_timer xen_set_periodic_tick = {
     1.8 +	.period_ns = NS_PER_TICK
     1.9 +};
    1.10 +
    1.11  void __init time_init(void)
    1.12  {
    1.13  #ifdef CONFIG_HPET_TIMER
    1.14 @@ -919,6 +923,10 @@ void __init time_init(void)
    1.15  		return;
    1.16  	}
    1.17  #endif
    1.18 +
    1.19 +	HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, 0,
    1.20 +			   &xen_set_periodic_tick);
    1.21 +
    1.22  	get_time_values_from_xen(0);
    1.23  
    1.24  	processed_system_time = per_cpu(shadow_time, 0).system_timestamp;
    1.25 @@ -976,8 +984,10 @@ EXPORT_SYMBOL(jiffies_to_st);
    1.26   */
    1.27  static void stop_hz_timer(void)
    1.28  {
    1.29 +	struct vcpu_set_singleshot_timer singleshot;
    1.30  	unsigned int cpu = smp_processor_id();
    1.31  	unsigned long j;
    1.32 +	int rc;
    1.33  
    1.34  	cpu_set(cpu, nohz_cpu_mask);
    1.35  
    1.36 @@ -997,8 +1007,15 @@ static void stop_hz_timer(void)
    1.37  		j = jiffies + 1;
    1.38  	}
    1.39  
    1.40 -	if (HYPERVISOR_set_timer_op(jiffies_to_st(j)) != 0)
    1.41 -		BUG();
    1.42 +	singleshot.timeout_abs_ns = jiffies_to_st(j);
    1.43 +	rc = HYPERVISOR_vcpu_op(VCPUOP_set_singleshot_timer, cpu, &singleshot);
    1.44 +#ifdef XEN_COMPAT_030004
    1.45 +	if (rc) {
    1.46 +		BUG_ON(rc != -ENOSYS);
    1.47 +		rc = HYPERVISOR_set_timer_op(singleshot.timeout_abs_ns);
    1.48 +	}
    1.49 +#endif
    1.50 +	BUG_ON(rc);
    1.51  }
    1.52  
    1.53  static void start_hz_timer(void)
    1.54 @@ -1030,6 +1047,8 @@ void time_resume(void)
    1.55  	init_cpu_khz();
    1.56  
    1.57  	for_each_online_cpu(cpu) {
    1.58 +		HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
    1.59 +				   &xen_set_periodic_tick);
    1.60  		get_time_values_from_xen(cpu);
    1.61  		per_cpu(processed_system_time, cpu) =
    1.62  			per_cpu(shadow_time, 0).system_timestamp;
    1.63 @@ -1050,6 +1069,9 @@ int local_setup_timer(unsigned int cpu)
    1.64  
    1.65  	BUG_ON(cpu == 0);
    1.66  
    1.67 +	HYPERVISOR_vcpu_op(VCPUOP_set_periodic_timer, cpu,
    1.68 +			   &xen_set_periodic_tick);
    1.69 +
    1.70  	do {
    1.71  		seq = read_seqbegin(&xtime_lock);
    1.72  		/* Use cpu0 timestamp: cpu's shadow is not initialised yet. */
     2.1 --- a/linux-2.6-xen-sparse/drivers/xen/Kconfig	Fri Mar 09 19:34:52 2007 +0000
     2.2 +++ b/linux-2.6-xen-sparse/drivers/xen/Kconfig	Fri Mar 09 19:36:24 2007 +0000
     2.3 @@ -227,6 +227,9 @@ choice
     2.4  	config XEN_COMPAT_030002_AND_LATER
     2.5  		bool "3.0.2 and later"
     2.6  
     2.7 +	config XEN_COMPAT_030004_AND_LATER
     2.8 +		bool "3.0.4 and later"
     2.9 +
    2.10  	config XEN_COMPAT_LATEST_ONLY
    2.11  		bool "no compatibility code"
    2.12  
    2.13 @@ -236,6 +239,10 @@ config XEN_COMPAT_030002
    2.14  	bool
    2.15  	default XEN_COMPAT_030002_AND_LATER
    2.16  
    2.17 +config XEN_COMPAT_030004
    2.18 +	bool
    2.19 +	default XEN_COMPAT_030002_AND_LATER || XEN_COMPAT_030004_AND_LATER
    2.20 +
    2.21  endmenu
    2.22  
    2.23  config HAVE_IRQ_IGNORE_UNHANDLED