[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 1/5] x86/time: refactor init_platform_time()
And accomodate platform time source initialization in try_platform_time(). This is a preparatory patch for deferring TSC clocksource initialization to the stage where all CPUS are up (verify_tsc_reliability init call). Signed-off-by: Joao Martins <joao.m.martins@xxxxxxxxxx> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx> --- xen/arch/x86/time.c | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 73e0f98..0c1ad45 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -576,6 +576,24 @@ static void resume_platform_timer(void) plt_stamp = plt_src.read_counter(); } +static s64 __init try_platform_timer(struct platform_timesource *pts) +{ + s64 rc = pts->init(pts); + + if ( rc <= 0 ) + return rc; + + plt_mask = (u64)~0ull >> (64 - pts->counter_bits); + + set_time_scale(&plt_scale, pts->frequency); + + plt_overflow_period = scale_delta( + 1ull << (pts->counter_bits - 1), &plt_scale); + plt_src = *pts; + + return rc; +} + static u64 __init init_platform_timer(void) { static struct platform_timesource * __initdata plt_timers[] = { @@ -593,7 +611,7 @@ static u64 __init init_platform_timer(void) pts = plt_timers[i]; if ( !strcmp(opt_clocksource, pts->id) ) { - rc = pts->init(pts); + rc = try_platform_timer(pts); break; } } @@ -609,21 +627,13 @@ static u64 __init init_platform_timer(void) for ( i = 0; i < ARRAY_SIZE(plt_timers); i++ ) { pts = plt_timers[i]; - if ( (rc = pts->init(pts)) > 0 ) + if ( (rc = try_platform_timer(pts)) > 0 ) break; } } BUG_ON(rc <= 0); - plt_mask = (u64)~0ull >> (64 - pts->counter_bits); - - set_time_scale(&plt_scale, pts->frequency); - - plt_overflow_period = scale_delta( - 1ull << (pts->counter_bits-1), &plt_scale); - plt_src = *pts; - printk("Platform timer is %s %s\n", freq_string(pts->frequency), pts->name); -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |