From: Thomas Gleixner <tglx@linutronix.de>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Alan Cox <alan@linux.intel.com>
Subject: Re: [PATCH 2/2] x86/mrst: add more timer config options
Date: Mon, 17 May 2010 22:27:43 +0200 (CEST) [thread overview]
Message-ID: <alpine.LFD.2.00.1005172138170.3368@localhost.localdomain> (raw)
In-Reply-To: <1274124183-23431-3-git-send-email-jacob.jun.pan@linux.intel.com>
On Mon, 17 May 2010, Jacob Pan wrote:
> diff --git a/arch/x86/include/asm/apb_timer.h b/arch/x86/include/asm/apb_timer.h
> index c74a2ee..4127fd1 100644
> --- a/arch/x86/include/asm/apb_timer.h
> +++ b/arch/x86/include/asm/apb_timer.h
> @@ -55,7 +55,7 @@ extern unsigned long apbt_quick_calibrate(void);
> extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
> extern void apbt_setup_secondary_clock(void);
> extern unsigned int boot_cpu_id;
> -extern int disable_apbt_percpu;
> +extern int mrst_timer_options;
Please remove this, it belongs to and is in mrst.h
> #ifdef CONFIG_SMP
> @@ -204,9 +203,9 @@ static inline int __init setup_x86_mrst_timer(char *arg)
> return -EINVAL;
>
> if (strcmp("apbt_only", arg) == 0)
> - disable_apbt_percpu = 0;
> + mrst_timer_options = MRST_TIMER_APBT_ONLY;
> else if (strcmp("lapic_and_apbt", arg) == 0)
> - disable_apbt_percpu = 1;
> + mrst_timer_options = MRST_TIMER_LAPIC_APBT;
> else {
> pr_warning("X86 MRST timer option %s not recognised"
> " use x86_mrst_timer=apbt_only or lapic_and_apbt\n",
Please move that to msrt.c It's not apbt specific. We parse the
options where we have the variable.
> static void __init mrst_setup_boot_clock(void)
> {
> - pr_info("%s: per cpu apbt flag %d \n", __func__, disable_apbt_percpu);
> - if (disable_apbt_percpu)
> + switch (mrst_timer_options) {
> + case MRST_TIMER_APBT_ONLY:
> + break;
> + case MRST_TIMER_LAPIC_APBT:
> setup_boot_APIC_clock();
> + break;
> + default:
> + /* check if this is Penwell */
> + if (cpu_has(&boot_cpu_data, X86_FEATURE_ARAT))
> + setup_boot_APIC_clock();
> + break;
> + }
> };
Did you notice that you are copying these checks all over the place ?
The first call into that code is mrst_time_init(), right ? So why not
check there and setup the function pointers once ?
void __init mrst_time_init(void)
{
switch (mrst_timer_options) {
case MRST_TIMER_APBT_ONLY:
break;
default:
if (!cpu_has(&boot_cpu_data, X86_FEATURE_ARAT))
break;
x86_init.timers.timer_init = x86_init_noop;
case MRST_TIMER_LAPIC_APBT:
x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
return;
}
sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr);
....
and change the code in x86_mrst_early_setup()
- x86_init.timers.setup_percpu_clockev = mrst_setup_boot_clock;
+ x86_init.timers.setup_percpu_clockev = x86_init_noop;
- x86_cpuinit.setup_percpu_clockev = mrst_setup_secondary_clock;
+ x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock;
So this makes everything default to apbt and in case of lapic selected
by command line or cpu type you switch everything over in one place.
That removes mrst_setup_boot_clock and mrst_setup_secondary_clock
along with all the duplicated code.
Thanks,
tglx
prev parent reply other threads:[~2010-05-17 20:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-17 19:23 [PATCH 0/2] v3 Moorestown updated patches 2,3,4 of v2 Jacob Pan
2010-05-17 19:23 ` [PATCH 1/2] x86/mrst: add cpu type detection Jacob Pan
2010-05-17 19:23 ` [PATCH 2/2] x86/mrst: add more timer config options Jacob Pan
2010-05-17 19:56 ` Randy Dunlap
2010-05-17 20:26 ` jacob pan
2010-05-17 20:28 ` Randy Dunlap
2010-05-17 20:27 ` Thomas Gleixner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LFD.2.00.1005172138170.3368@localhost.localdomain \
--to=tglx@linutronix.de \
--cc=alan@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jacob.jun.pan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox