v5 Moorestown clock related patches
cover v5 Moorestown clock related patches
Besides fixes based on review of v4, one more patches is added to make additional CPU feature available early enough for Moorestown clock selection code. An x86_init.oem.setup_arch functin is added for Moorestown so that we can use boot_cpu_data earlier. Other changes are minor.
Thanks,
*** BLURB HERE ***
Jacob Pan (3):
x86: detect scattered cpuid features earlier
x86/mrst: add cpu type detection
x86/mrst: add more timer config options
arch/x86/include/asm/apb_timer.h | 1 - arch/x86/include/asm/mrst.h | 20 +++++++ arch/x86/kernel/apb_timer.c | 37 +++---------- arch/x86/kernel/cpu/common.c | 2 +- arch/x86/kernel/mrst.c | 110 ++++++++++++++++++++++++++++++-------- 5 files changed, 116 insertions(+), 54 deletions(-)
PATCH 1/3 x86: detect scattered cpuid features earlier
Some extra CPU features such as ARAT is needed in early boot so that x86_init function pointers can be set up properly.
http://lkml.org/lkml/2010/5/18/519
At start_kernel() level, this patch moves init_scattered_cpuid_features() from check_bugs() to setup_arch() -> early_cpu_init() which is earlier than platform specific x86_init layer setup. Suggested by HPA.
--- arch/x86/kernel/cpu/common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -576,6 +576,7 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)if (c->extended_cpuid_level >=0x80000007 ) c->x86_power =cpuid_edx (0x80000007 ); +init_scattered_cpuid_features (c); }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
@@ -731,7 +732,6 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)get_model_name (c);/* Default name */ -init_scattered_cpuid_features (c);detect_nopl (c); }
Signature · 1 line
1.6.3.3
[tip:x86/mrst] x86: detect scattered cpuid features earlier
Commit-ID: 1dedefd1a066a795a87afca9c0236e1a94de9bf6 Gitweb: http://git.kernel.org/tip/1dedefd1a066a795a87afca9c0236e1a94de9bf6 Author: Jacob Pan <[email protected]> AuthorDate: Wed, 19 May 2010 12:01:23 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Wed, 19 May 2010 13:32:12 -0700
x86: detect scattered cpuid features earlier
Some extra CPU features such as ARAT is needed in early boot so that x86_init function pointers can be set up properly.
http://lkml.org/lkml/2010/5/18/519
At start_kernel() level, this patch moves init_scattered_cpuid_features() from check_bugs() to setup_arch() -> early_cpu_init() which is earlier than platform specific x86_init layer setup. Suggested by HPA.
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/cpu/common.c +1 -1
@@ -576,6 +576,7 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)if (c->extended_cpuid_level >=0x80000007 ) c->x86_power =cpuid_edx (0x80000007 ); +init_scattered_cpuid_features (c); }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
@@ -731,7 +732,6 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)get_model_name (c);/* Default name */ -init_scattered_cpuid_features (c);detect_nopl (c); }
PATCH 2/3 x86/mrst: add cpu type detection
In reply to Jacob PanMedfield is the follow-up of Moorestown, it is treated under the same HW sub-architecture. However, we do need to know the CPU type in order for some of the driver to act accordingly.
We also have different optimal clock configuration for each CPU type.
--- arch/x86/include/asm/mrst.h | 19 +++++++++++++++++++ arch/x86/kernel/mrst.c | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 0 deletions(-)
arch/x86/include/asm/mrst.h +19 -0
@@ -11,8 +11,27 @@#ifndef _ASM_X86_MRST_H#define _ASM_X86_MRST_Hextern int pci_mrst_init (void ); +extern int mrst_identify_cpu (void );int __init sfi_parse_mrtc (struct sfi_table_header *table); +/* +* Medfield is the follow-up of Moorestown, it combines two chip solution into +* one. Other than that it also added always-on and constant tsc and lapic +* timers. Medfield is the platform name, and the chip name is called Penwell +* we treat Medfield/Penwell as a variant of Moorestown. Penwell can be +* identified via MSRs. +*/ +enum mrst_cpu_type { +MRST_CPU_CHIP_LINCROFT =1 , +MRST_CPU_CHIP_PENWELL , +}; + +enum mrst_timer_options { +MRST_TIMER_DEFAULT , +MRST_TIMER_APBT_ONLY , +MRST_TIMER_LAPIC_APBT , +}; +#define SFI_MTMR_MAX_NUM 8#define SFI_MRTC_MAX 8
arch/x86/kernel/mrst.c +26 -0
@@ -27,6 +27,8 @@static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM ];static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM ]; +static int mrst_cpu_chip; +int sfi_mtimer_num;struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX ];
@@ -216,6 +218,28 @@ static void __init mrst_setup_boot_clock(void)setup_boot_APIC_clock (); }; +int mrst_identify_cpu (void ) +{ +return mrst_cpu_chip; +} +EXPORT_SYMBOL_GPL (mrst_identify_cpu); + +void __cpuinit mrst_arch_setup (void ) +{ +if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x27 ) + mrst_cpu_chip =MRST_CPU_CHIP_PENWELL ; +else if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x26 ) + mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; +else { +pr_err ("Unknown Moorestown CPU (%d:%d), default to Lincroft\n" , + boot_cpu_data.x86, boot_cpu_data.x86_model); + mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; + } +pr_debug ("Moorestown CPU %s identified\n" , + (mrst_cpu_chip ==MRST_CPU_CHIP_LINCROFT ) ? +"Lincroft" :"Penwell" ); +} +/* * Moorestown specific x86_init function overrides and early setup * calls.
@@ -230,6 +254,8 @@ void __init x86_mrst_early_setup(void) x86_init.irqs.pre_vector_init = x86_init_noop; + x86_init.oem.arch_setup = mrst_arch_setup; + x86_cpuinit.setup_percpu_clockev = mrst_setup_secondary_clock; x86_platform.calibrate_tsc = mrst_calibrate_tsc;
Signature · 1 line
1.6.3.3
[tip:x86/mrst] x86, mrst: add cpu type detection
Commit-ID: a0c173bd8a3fd0541be8e4ef962170e48d8811c7 Gitweb: http://git.kernel.org/tip/a0c173bd8a3fd0541be8e4ef962170e48d8811c7 Author: Jacob Pan <[email protected]> AuthorDate: Wed, 19 May 2010 12:01:24 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Wed, 19 May 2010 13:32:29 -0700
x86, mrst: add cpu type detection
Medfield is the follow-up of Moorestown, it is treated under the same HW sub-architecture. However, we do need to know the CPU type in order for some of the driver to act accordingly.
We also have different optimal clock configuration for each CPU type.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/mrst.h | 19 +++++++++++++++++++ arch/x86/kernel/mrst.c | 26 ++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 0 deletions(-)
arch/x86/include/asm/mrst.h +19 -0
@@ -11,8 +11,27 @@#ifndef _ASM_X86_MRST_H#define _ASM_X86_MRST_Hextern int pci_mrst_init (void ); +extern int mrst_identify_cpu (void );int __init sfi_parse_mrtc (struct sfi_table_header *table); +/* +* Medfield is the follow-up of Moorestown, it combines two chip solution into +* one. Other than that it also added always-on and constant tsc and lapic +* timers. Medfield is the platform name, and the chip name is called Penwell +* we treat Medfield/Penwell as a variant of Moorestown. Penwell can be +* identified via MSRs. +*/ +enum mrst_cpu_type { +MRST_CPU_CHIP_LINCROFT =1 , +MRST_CPU_CHIP_PENWELL , +}; + +enum mrst_timer_options { +MRST_TIMER_DEFAULT , +MRST_TIMER_APBT_ONLY , +MRST_TIMER_LAPIC_APBT , +}; +#define SFI_MTMR_MAX_NUM 8#define SFI_MRTC_MAX 8
arch/x86/kernel/mrst.c +26 -0
@@ -27,6 +27,8 @@static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM ];static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM ]; +static int mrst_cpu_chip; +int sfi_mtimer_num;struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX ];
@@ -216,6 +218,28 @@ static void __init mrst_setup_boot_clock(void)setup_boot_APIC_clock (); }; +int mrst_identify_cpu (void ) +{ +return mrst_cpu_chip; +} +EXPORT_SYMBOL_GPL (mrst_identify_cpu); + +void __cpuinit mrst_arch_setup (void ) +{ +if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x27 ) + mrst_cpu_chip =MRST_CPU_CHIP_PENWELL ; +else if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x26 ) + mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; +else { +pr_err ("Unknown Moorestown CPU (%d:%d), default to Lincroft\n" , + boot_cpu_data.x86, boot_cpu_data.x86_model); + mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; + } +pr_debug ("Moorestown CPU %s identified\n" , + (mrst_cpu_chip ==MRST_CPU_CHIP_LINCROFT ) ? +"Lincroft" :"Penwell" ); +} +/* * Moorestown specific x86_init function overrides and early setup * calls.
@@ -230,6 +254,8 @@ void __init x86_mrst_early_setup(void) x86_init.irqs.pre_vector_init = x86_init_noop; + x86_init.oem.arch_setup = mrst_arch_setup; + x86_cpuinit.setup_percpu_clockev = mrst_setup_secondary_clock; x86_platform.calibrate_tsc = mrst_calibrate_tsc;
[tip:x86/mrst] x86, mrst: make mrst_identify_cpu() an inline returning enum
In reply to Jacob PanCommit-ID: a75af580bb1fd261bf63cc00e4b324e17ceb15cf Gitweb: http://git.kernel.org/tip/a75af580bb1fd261bf63cc00e4b324e17ceb15cf Author: H. Peter Anvin <[email protected]> AuthorDate: Wed, 19 May 2010 13:40:14 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Wed, 19 May 2010 13:47:11 -0700
x86, mrst: make mrst_identify_cpu() an inline returning enum
We have an enum, might as well use it. While we're at it, make it an inline... there is really no point in calling a function for this stuff.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/mrst.h | 7 ++++++- arch/x86/kernel/mrst.c | 17 ++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-)
arch/x86/include/asm/mrst.h +6 -1
@@ -11,7 +11,6 @@#ifndef _ASM_X86_MRST_H#define _ASM_X86_MRST_Hextern int pci_mrst_init (void ); -extern int mrst_identify_cpu (void );extern int mrst_timer_options__cpuinitdata ;int __init sfi_parse_mrtc (struct sfi_table_header *table);
@@ -27,6 +26,12 @@ enum mrst_cpu_type { MRST_CPU_CHIP_PENWELL, }; +extern enum mrst_cpu_type __mrst_cpu_chip; +static enum mrst_cpu_type mrst_identify_cpu (void ) +{ +return __mrst_cpu_chip; +} +enum mrst_timer_options {MRST_TIMER_DEFAULT ,MRST_TIMER_APBT_ONLY ,
arch/x86/kernel/mrst.c +6 -11
@@ -50,7 +50,8 @@ int mrst_timer_options __cpuinitdata;static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM ];static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM ]; -static int mrst_cpu_chip; +enum mrst_cpu_type __mrst_cpu_chip; +EXPORT_SYMBOL_GPL (__mrst_cpu_chip);int sfi_mtimer_num;
@@ -233,25 +234,19 @@ void __init mrst_rtc_init(void)sfi_table_parse (SFI_SIG_MRTC ,NULL ,NULL , sfi_parse_mrtc); } -int mrst_identify_cpu (void ) -{ -return mrst_cpu_chip; -} -EXPORT_SYMBOL_GPL (mrst_identify_cpu); -void __cpuinit mrst_arch_setup (void ) {if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x27 ) - mrst_cpu_chip =MRST_CPU_CHIP_PENWELL ; + __mrst_cpu_chip =MRST_CPU_CHIP_PENWELL ;else if (boot_cpu_data.x86 ==6 && boot_cpu_data.x86_model ==0x26 ) - mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; + __mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ;else {pr_err ("Unknown Moorestown CPU (%d:%d), default to Lincroft\n" , boot_cpu_data.x86, boot_cpu_data.x86_model); - mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; + __mrst_cpu_chip =MRST_CPU_CHIP_LINCROFT ; }pr_debug ("Moorestown CPU %s identified\n" , - (mrst_cpu_chip ==MRST_CPU_CHIP_LINCROFT ) ? + (__mrst_cpu_chip ==MRST_CPU_CHIP_LINCROFT ) ?"Lincroft" :"Penwell" ); }
[tip:x86/mrst] x86, mrst: A function in a header file needs to be marked "inline"
In reply to Jacob PanCommit-ID: 55572b293b3a5929e8c54bc91d14ae6264186bf6 Gitweb: http://git.kernel.org/tip/55572b293b3a5929e8c54bc91d14ae6264186bf6 Author: H. Peter Anvin <[email protected]> AuthorDate: Thu, 7 Oct 2010 16:42:54 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Thu, 7 Oct 2010 16:45:18 -0700
x86, mrst: A function in a header file needs to be marked "inline"
A function in a header file needs to be explicitly marked "inline", or gcc will complain if it is not used.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/mrst.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/include/asm/mrst.h +1 -1
@@ -26,7 +26,7 @@ enum mrst_cpu_type { };extern enum mrst_cpu_type __mrst_cpu_chip; -static enum mrst_cpu_type mrst_identify_cpu (void ) +static inline enum mrst_cpu_type mrst_identify_cpu (void ) {return __mrst_cpu_chip; }
PATCH 3/3 x86/mrst: add more timer config options
In reply to Jacob PanAlways-on local APIC timer (ARAT) has been introduced to Medfield, along with the platform APB timers we have more timer configuration options between Moorestown and Medfield.
This patch adds run-time detection of avaiable timer features so that we can treat Medfield as a variant of Moorestown and set up the optimal timer options for each platform. i.e.
Medfield: per cpu always-on local APIC timer
Moorestown: per cpu APB timer
Manual override is possible via cmdline option x86_mrst_timer.
--- arch/x86/include/asm/apb_timer.h | 1 - arch/x86/include/asm/mrst.h | 1 + arch/x86/kernel/apb_timer.c | 37 +++------------ arch/x86/kernel/mrst.c | 88 +++++++++++++++++++++++++++----------- 4 files changed, 72 insertions(+), 55 deletions(-)
arch/x86/include/asm/apb_timer.h +0 -1
@@ -55,7 +55,6 @@ 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 struct sfi_timer_table_entry *sfi_get_mtmr (int hint);extern void sfi_free_mtmr (struct sfi_timer_table_entry *mtmr);
arch/x86/include/asm/mrst.h +1 -0
@@ -12,6 +12,7 @@#define _ASM_X86_MRST_Hextern int pci_mrst_init (void );extern int mrst_identify_cpu (void ); +extern int mrst_timer_options__cpuinitdata ;int __init sfi_parse_mrtc (struct sfi_table_header *table);/*
arch/x86/kernel/apb_timer.c +8 -29
@@ -43,10 +43,11 @@#include <asm/fixmap.h> #include <asm/apb_timer.h> +#include <asm/mrst.h> #define APBT_MASK CLOCKSOURCE_MASK(32)#define APBT_SHIFT 22 -#define APBT_CLOCKEVENT_RATING 150 +#define APBT_CLOCKEVENT_RATING 110#define APBT_CLOCKSOURCE_RATING 250#define APBT_MIN_DELTA_USEC 200
@@ -83,8 +84,6 @@ struct apbt_dev {char name[10 ]; }; -int disable_apbt_percpu__cpuinitdata ; - static DEFINE_PER_CPU(struct apbt_dev, cpu_apbt_dev);#ifdef CONFIG_SMP
@@ -195,29 +194,6 @@ static struct clock_event_device apbt_clockevent = { };/* -* if user does not want to use per CPU apb timer, just give it a lower rating -* than local apic timer and skip the late per cpu timer init. -*/ -static inline int __init setup_x86_mrst_timer (char *arg) -{ -if (!arg) -return -EINVAL ; - -if (strcmp ("apbt_only" , arg) ==0 ) - disable_apbt_percpu =0 ; -else if (strcmp ("lapic_and_apbt" , arg) ==0 ) - disable_apbt_percpu =1 ; -else { -pr_warning ("X86 MRST timer option %s not recognised" -" use x86_mrst_timer=apbt_only or lapic_and_apbt\n" , - arg); -return -EINVAL ; - } -return 0 ; -} -__setup ("x86_mrst_timer=" , setup_x86_mrst_timer); - -/* * start count down from 0xffff_ffff. this is done by toggling the enable bit * then load initial load count to ~0. */
@@ -335,7 +311,7 @@ static int __init apbt_clockevent_register(void) adev->num =smp_processor_id ();memcpy (&adev->evt, &apbt_clockevent,sizeof (struct clock_event_device )); -if (disable_apbt_percpu) { +if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT ) { apbt_clockevent.rating =APBT_CLOCKEVENT_RATING -100 ; global_clock_event = &adev->evt; printk(KERN_DEBUG "%s clockevent registered as global\n",
@@ -429,7 +405,8 @@ static int apbt_cpuhp_notify(struct notifier_block *n,static __init int apbt_late_init (void ) { -if (disable_apbt_percpu || !apb_timer_block_enabled) +if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT || + !apb_timer_block_enabled)return 0 ;/* This notifier should be called after workqueue is ready */ hotcpu_notifier (apbt_cpuhp_notify,-20 );
@@ -450,6 +427,8 @@ static void apbt_set_mode(enum clock_event_mode mode,int timer_num;struct apbt_dev *adev =EVT_TO_APBT_DEV (evt); +BUG_ON (!apbt_virt_address); + timer_num = adev->num;pr_debug ("%s CPU %d timer %d mode=%d\n" , __func__,first_cpu (*evt->cpumask), timer_num, mode);
@@ -676,7 +655,7 @@ void __init apbt_time_init(void) }#ifdef CONFIG_SMP /* kernel cmdline disable apb timer, so we will use lapic timers */ -if (disable_apbt_percpu) { +if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT ) {printk (KERN_INFO "apbt: disabled per cpu timer\n" );return ; }
arch/x86/kernel/mrst.c +63 -25
126 lines not on this page · raw message
Signature · 1 line
1.6.3.3
[tip:x86/mrst] x86, mrst: add more timer config options
Commit-ID: a875c01944f0d750eeb1ef3133feceb13f13c4b3 Gitweb: http://git.kernel.org/tip/a875c01944f0d750eeb1ef3133feceb13f13c4b3 Author: Jacob Pan <[email protected]> AuthorDate: Wed, 19 May 2010 12:01:25 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Wed, 19 May 2010 13:45:39 -0700
x86, mrst: add more timer config options
Always-on local APIC timer (ARAT) has been introduced to Medfield, along with the platform APB timers we have more timer configuration options between Moorestown and Medfield.
This patch adds run-time detection of avaiable timer features so that we can treat Medfield as a variant of Moorestown and set up the optimal timer options for each platform. i.e.
Medfield: per cpu always-on local APIC timer
Moorestown: per cpu APB timer
Manual override is possible via cmdline option x86_mrst_timer.
LKML-Reference: <[email protected]>
--- arch/x86/include/asm/apb_timer.h | 1 - arch/x86/include/asm/mrst.h | 1 + arch/x86/kernel/apb_timer.c | 37 +++------------ arch/x86/kernel/mrst.c | 88 +++++++++++++++++++++++++++----------- 4 files changed, 72 insertions(+), 55 deletions(-)
arch/x86/include/asm/apb_timer.h +0 -1
@@ -55,7 +55,6 @@ 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 struct sfi_timer_table_entry *sfi_get_mtmr (int hint);extern void sfi_free_mtmr (struct sfi_timer_table_entry *mtmr);
arch/x86/include/asm/mrst.h +1 -0
@@ -12,6 +12,7 @@#define _ASM_X86_MRST_Hextern int pci_mrst_init (void );extern int mrst_identify_cpu (void ); +extern int mrst_timer_options__cpuinitdata ;int __init sfi_parse_mrtc (struct sfi_table_header *table);/*
arch/x86/kernel/apb_timer.c +8 -29
@@ -43,10 +43,11 @@#include <asm/fixmap.h> #include <asm/apb_timer.h> +#include <asm/mrst.h> #define APBT_MASK CLOCKSOURCE_MASK(32)#define APBT_SHIFT 22 -#define APBT_CLOCKEVENT_RATING 150 +#define APBT_CLOCKEVENT_RATING 110#define APBT_CLOCKSOURCE_RATING 250#define APBT_MIN_DELTA_USEC 200
@@ -83,8 +84,6 @@ struct apbt_dev {char name[10 ]; }; -int disable_apbt_percpu__cpuinitdata ; - static DEFINE_PER_CPU(struct apbt_dev, cpu_apbt_dev);#ifdef CONFIG_SMP
@@ -195,29 +194,6 @@ static struct clock_event_device apbt_clockevent = { };/* -* if user does not want to use per CPU apb timer, just give it a lower rating -* than local apic timer and skip the late per cpu timer init. -*/ -static inline int __init setup_x86_mrst_timer (char *arg) -{ -if (!arg) -return -EINVAL ; - -if (strcmp ("apbt_only" , arg) ==0 ) - disable_apbt_percpu =0 ; -else if (strcmp ("lapic_and_apbt" , arg) ==0 ) - disable_apbt_percpu =1 ; -else { -pr_warning ("X86 MRST timer option %s not recognised" -" use x86_mrst_timer=apbt_only or lapic_and_apbt\n" , - arg); -return -EINVAL ; - } -return 0 ; -} -__setup ("x86_mrst_timer=" , setup_x86_mrst_timer); - -/* * start count down from 0xffff_ffff. this is done by toggling the enable bit * then load initial load count to ~0. */
@@ -335,7 +311,7 @@ static int __init apbt_clockevent_register(void) adev->num =smp_processor_id ();memcpy (&adev->evt, &apbt_clockevent,sizeof (struct clock_event_device )); -if (disable_apbt_percpu) { +if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT ) { apbt_clockevent.rating =APBT_CLOCKEVENT_RATING -100 ; global_clock_event = &adev->evt; printk(KERN_DEBUG "%s clockevent registered as global\n",
@@ -429,7 +405,8 @@ static int apbt_cpuhp_notify(struct notifier_block *n,static __init int apbt_late_init (void ) { -if (disable_apbt_percpu || !apb_timer_block_enabled) +if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT || + !apb_timer_block_enabled)return 0 ;/* This notifier should be called after workqueue is ready */ hotcpu_notifier (apbt_cpuhp_notify,-20 );
@@ -450,6 +427,8 @@ static void apbt_set_mode(enum clock_event_mode mode,int timer_num;struct apbt_dev *adev =EVT_TO_APBT_DEV (evt); +BUG_ON (!apbt_virt_address); + timer_num = adev->num;pr_debug ("%s CPU %d timer %d mode=%d\n" , __func__,first_cpu (*evt->cpumask), timer_num, mode);
@@ -676,7 +655,7 @@ void __init apbt_time_init(void) }#ifdef CONFIG_SMP /* kernel cmdline disable apb timer, so we will use lapic timers */ -if (disable_apbt_percpu) { +if (mrst_timer_options ==MRST_TIMER_LAPIC_APBT ) {printk (KERN_INFO "apbt: disabled per cpu timer\n" );return ; }
arch/x86/kernel/mrst.c +63 -25
126 lines not on this page · raw message
[tip:x86/mrst] x86, mrst: make mrst_timer_options an enum
In reply to Jacob PanCommit-ID: 14671386dcbafb3086bbda3cb6f9f27d34c7bf6d Gitweb: http://git.kernel.org/tip/14671386dcbafb3086bbda3cb6f9f27d34c7bf6d Author: H. Peter Anvin <[email protected]> AuthorDate: Wed, 19 May 2010 14:37:40 -0700 Committer: H. Peter Anvin <[email protected]> CommitDate: Wed, 19 May 2010 14:37:40 -0700
x86, mrst: make mrst_timer_options an enum
We have an enum mrst_timer_options, use it so that the kernel knows if we're missing something from a switch statement or equivalent.
LKML-Reference: <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Jacob Pan <[email protected]>
--- arch/x86/include/asm/mrst.h | 3 ++- arch/x86/kernel/mrst.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-)
arch/x86/include/asm/mrst.h +2 -1
@@ -11,7 +11,6 @@#ifndef _ASM_X86_MRST_H#define _ASM_X86_MRST_Hextern int pci_mrst_init (void ); -extern int mrst_timer_options__cpuinitdata ;int __init sfi_parse_mrtc (struct sfi_table_header *table);/*
@@ -38,6 +37,8 @@ enum mrst_timer_options { MRST_TIMER_LAPIC_APBT, }; +extern enum mrst_timer_options mrst_timer_options; +#define SFI_MTMR_MAX_NUM 8#define SFI_MRTC_MAX 8
arch/x86/kernel/mrst.c +1 -1
@@ -46,7 +46,7 @@* lapic (always-on,ARAT) ------ 150 */ -int mrst_timer_options__cpuinitdata ; +__cpuinitdata enum mrst_timer_options mrst_timer_options;static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM ];static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM ];