apic: unification series 5
cover apic: unification series 5
This series is over
commit d5e629a6f88137fb77c4cc857be5ea7c3f27110d
Author: Yinghai Lu <[email protected]> Date: Sun Aug 17 21:12:27 2008 -0700
x86: apic - unify lapic_resume - fix
Please review - any comments are quite welcome!
Mostly #ifdef added, code rearrangement - nothing serious (except new bugs have been brought in :-)
So I think the most simple/basic unification is done. Now unif. process will be harder since it will require for much detailed code review - for example smp_spurious_interrupt which uses different call frames on 32/64 bit modes and will require some wrapping I think.
With this series 32bit code compilation warns:
arch/x86/kernel/apic_32.c: In function ‘end_local_APIC_setup’:arch/x86/kernel/apic_32.c:1165: warning: ISO C90 forbids mixed declarations and code arch/x86/kernel/apic_32.c: In function ‘disconnect_bsp_APIC’:arch/x86/kernel/apic_32.c:1446: warning: ISO C90 forbids mixed declarations and code cyrill@lenovo linux-2.6.git $
So parenthesis will be needed to eliminate them... but
I think it could be too ugly... need some time to think.
So patches 8/15 and 10/15 sould be not applied for now - just review them. Thanks for patience!
- Cyrill -
PATCH 1/15 x86: apic - rearrange maxcpu definition
--- arch/x86/kernel/apic_32.c | 4 ++-- arch/x86/kernel/apic_64.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/x86/kernel/apic_32.c +2 -2
@@ -114,6 +114,8 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events);static int enabled_via_apicbase;static unsigned long apic_phys; +unsigned int __cpuinitdata maxcpus =NR_CPUS ; +/* * Get the LAPIC version
@@ -1459,8 +1461,6 @@ void disconnect_bsp_APIC(int virt_wire_setup) } } -unsigned int __cpuinitdata maxcpus =NR_CPUS ; -void __cpuinit generic_processor_info (int apicid,int version) {int cpu;
arch/x86/kernel/apic_64.c +1 -1
@@ -98,10 +98,10 @@ static struct clock_event_device lapic_clockevent = { static DEFINE_PER_CPU(struct clock_event_device, lapic_events);static unsigned long apic_phys; +unsigned int __cpuinitdata maxcpus =NR_CPUS ;unsigned long mp_lapic_addr; -unsigned int __cpuinitdata maxcpus =NR_CPUS ;/* * Get the LAPIC version */
Signature · 1 line
1.6.0.rc1.34.g0fe8c
Re: [PATCH 01/15] x86: apic - rearrange maxcpu definition
[Cyrill Gorcunov - Mon, Aug 18, 2008 at 08:45:49PM +0400]
| Signed-off-by: Cyrill Gorcunov <[email protected]> | --- | arch/x86/kernel/apic_32.c | 4 ++-- | arch/x86/kernel/apic_64.c | 2 +- | 2 files changed, 3 insertions(+), 3 deletions(-) |
Btw - it seems my patches are too 'flooding' the LKML list now. Will _stop_ make them too small. Sorry.
- Cyrill -
PATCH 2/15 x86: apic - unify setup_boot_APIC_clock
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/x86/kernel/apic_32.c +1 -0
@@ -612,6 +612,7 @@ void __init setup_boot_APIC_clock(void)* broadcast mechanism is used. On UP systems simply ignore it. */ if (disable_apic_timer) { +printk (KERN_INFO "Disabling APIC timer\n" );/* No broadcast on UP ! */ if (num_possible_cpus () >1 ) { lapic_clockevent.mult =1 ;
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 3/15 x86: apic - unify disable_local_APIC
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 4 +++- arch/x86/kernel/apic_64.c | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletions(-)
arch/x86/kernel/apic_32.c +3 -1
@@ -796,7 +796,7 @@ void clear_local_APIC(void)*/ void disable_local_APIC (void ) { -unsigned long value; +unsigned int value;clear_local_APIC ();
@@ -808,6 +808,7 @@ void disable_local_APIC(void) value &= ~APIC_SPIV_APIC_ENABLED ;apic_write (APIC_SPIV , value); +#ifdef CONFIG_X86_32 /* * When LAPIC was disabled by the BIOS and enabled by the kernel, * restore the disabled state.
@@ -819,6 +820,7 @@ void disable_local_APIC(void) l &= ~MSR_IA32_APICBASE_ENABLE ; wrmsr(MSR_IA32_APICBASE, l, h); } +#endif }/*
arch/x86/kernel/apic_64.c +14 -0
@@ -691,6 +691,20 @@ void disable_local_APIC(void) value =apic_read (APIC_SPIV ); value &= ~APIC_SPIV_APIC_ENABLED ;apic_write (APIC_SPIV , value); + +#ifdef CONFIG_X86_32 +/* +* When LAPIC was disabled by the BIOS and enabled by the kernel, +* restore the disabled state. +*/ +if (enabled_via_apicbase) { +unsigned int l, h; + +rdmsr (MSR_IA32_APICBASE , l, h); + l &= ~MSR_IA32_APICBASE_ENABLE ; +wrmsr (MSR_IA32_APICBASE , l, h); + } +#endif }void lapic_shutdown (void )
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 4/15 x86: apic - unify lapic_shutdown
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 9 ++++++--- arch/x86/kernel/apic_64.c | 14 +++++++++++++- 2 files changed, 19 insertions(+), 4 deletions(-)
arch/x86/kernel/apic_32.c +6 -3
@@ -838,10 +838,13 @@ void lapic_shutdown(void)local_irq_save (flags); -if (enabled_via_apicbase) -disable_local_APIC (); -else +#ifdef CONFIG_X86_32 +if (!enabled_via_apicbase)clear_local_APIC (); + else +#endif +disable_local_APIC (); +local_irq_restore (flags); }
arch/x86/kernel/apic_64.c +13 -1
@@ -707,6 +707,12 @@ void disable_local_APIC(void)#endif } +/* +* If Linux enabled the LAPIC against the BIOS default disable it down before +* re-entering the BIOS on shutdown. Otherwise the BIOS may get confused and +* not power-off. Additionally clear all LVT entries before disable_local_APIC +* for the case where Linux didn't enable the LAPIC. +*/ void lapic_shutdown (void ) {unsigned long flags;
@@ -716,7 +722,13 @@ void lapic_shutdown(void)local_irq_save (flags); -disable_local_APIC (); +#ifdef CONFIG_X86_32 +if (!enabled_via_apicbase) +clear_local_APIC (); + else +#endif +disable_local_APIC (); +local_irq_restore (flags); }
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 5/15 x86: apic - unify connect_bsp_APIC
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 2 ++ arch/x86/kernel/apic_64.c | 20 ++++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-)
arch/x86/kernel/apic_32.c +2 -0
@@ -1387,6 +1387,7 @@ void smp_error_interrupt(struct pt_regs *regs)*/ void __init connect_bsp_APIC (void ) { +#ifdef CONFIG_X86_32 if (pic_mode) {/* * Do not trust the local APIC being empty at bootup.
@@ -1401,6 +1402,7 @@ void __init connect_bsp_APIC(void)outb (0x70 ,0x22 ); outb(0x01, 0x23); } +#endif enable_apic_mode (); }
arch/x86/kernel/apic_64.c +18 -2
@@ -1285,10 +1285,26 @@ asmlinkage void smp_error_interrupt(void) }/** -* * connect_bsp_APIC - attach the APIC to the interrupt system -* */ +* connect_bsp_APIC - attach the APIC to the interrupt system +*/ void __init connect_bsp_APIC (void ) { +#ifdef CONFIG_X86_32 +if (pic_mode) { +/* +* Do not trust the local APIC being empty at bootup. +*/ +clear_local_APIC (); +/* +* PIC mode, enable APIC mode in the IMCR, i.e. connect BSP's +* local APIC to INT and NMI lines. +*/ +apic_printk (APIC_VERBOSE ,"leaving PIC mode, " +"enabling APIC mode.\n" ); +outb (0x70 ,0x22 ); +outb (0x01 ,0x23 ); + } +#endif enable_apic_mode (); }
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 6/15 x86: apic - unify lapic_setup_esr
In reply to Cyrill GorcunovWe use 32bit code former for 64bit
mode since it's much better implementation
and easier to merge.
--- arch/x86/kernel/apic_32.c | 21 +++++++++-------- arch/x86/kernel/apic_64.c | 51 ++++++++++++++++++++++++++++++++++---------- 2 files changed, 50 insertions(+), 22 deletions(-)
arch/x86/kernel/apic_32.c +11 -10
@@ -983,6 +983,16 @@ static void __cpuinit lapic_setup_esr(void) {unsigned long oldvalue, value, maxlvt;if (lapic_is_integrated () && !esr_disable) { +if (esr_disable) { +/* +* Something untraceable is creating bad interrupts on +* secondary quads ... for the moment, just leave the +* ESR disabled - we can't do anything useful with the +* errors anyway - mbligh +*/ +printk (KERN_INFO "Leaving ESR disabled.\n" ); +return ; + }/* !82489DX */ maxlvt =lapic_get_maxlvt ();if (maxlvt >3 )/* Due to the Pentium erratum 3AP. */
@@ -1003,16 +1013,7 @@ static void __cpuinit lapic_setup_esr(void)"vector: 0x%08lx after: 0x%08lx\n" , oldvalue, value); }else { -if (esr_disable) -/* -* Something untraceable is creating bad interrupts on -* secondary quads ... for the moment, just leave the -* ESR disabled - we can't do anything useful with the -* errors anyway - mbligh -*/ -printk (KERN_INFO "Leaving ESR disabled.\n" ); -else -printk (KERN_INFO "No ESR for 82489DX.\n" ); +printk (KERN_INFO "No ESR for 82489DX.\n" ); } }
arch/x86/kernel/apic_64.c +39 -12
63 lines not on this page · raw message
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 7/15 x86: apic - unify __setup_APIC_LVTT
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 10 +++++++--- arch/x86/kernel/apic_64.c | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-)
arch/x86/kernel/apic_32.c +7 -3
@@ -248,8 +248,12 @@ int lapic_get_maxlvt(void)* Local APIC timer */ -/* Clock divisor is set to 16 */ +/* Clock divisor */ +#ifdef CONFG_X86_64 +#define APIC_DIVISOR 1 +#else #define APIC_DIVISOR 16 +#endif /* * This function sets up the local APIC timer, with a timeout of
@@ -281,8 +285,8 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)*/ tmp_value =apic_read (APIC_TDCR );apic_write (APIC_TDCR , - (tmp_value & ~(APIC_TDR_DIV_1 |APIC_TDR_DIV_TMBASE )) | -APIC_TDR_DIV_16 ); + (tmp_value & ~(APIC_TDR_DIV_1 |APIC_TDR_DIV_TMBASE )) | +APIC_TDR_DIV_16 );if (!oneshot)apic_write (APIC_TMICT , clocks /APIC_DIVISOR );
arch/x86/kernel/apic_64.c +8 -4
@@ -259,8 +259,12 @@ int lapic_get_maxlvt(void)* Local APIC timer */ -/* Clock divisor is set to 1 */ +/* Clock divisor */ +#ifdef CONFG_X86_64 #define APIC_DIVISOR 1 +#else +#define APIC_DIVISOR 16 +#endif /* * This function sets up the local APIC timer, with a timeout of
@@ -291,9 +295,9 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)* Divide PICLK by 16 */ tmp_value =apic_read (APIC_TDCR ); -apic_write (APIC_TDCR , (tmp_value - & ~(APIC_TDR_DIV_1 |APIC_TDR_DIV_TMBASE )) - |APIC_TDR_DIV_16 ); +apic_write (APIC_TDCR , + (tmp_value & ~(APIC_TDR_DIV_1 |APIC_TDR_DIV_TMBASE )) | +APIC_TDR_DIV_16 );if (!oneshot)apic_write (APIC_TMICT , clocks /APIC_DIVISOR );
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 8/15 x86: apic - unify disconnect_bsp_APIC
In reply to Cyrill Gorcunov- just #ifdef added
--- arch/x86/kernel/apic_32.c | 66 +++++++++++++++++++++++--------------------- arch/x86/kernel/apic_64.c | 23 ++++++++++++++- 2 files changed, 55 insertions(+), 34 deletions(-)
arch/x86/kernel/apic_32.c +34 -32
@@ -1420,6 +1420,7 @@ void __init connect_bsp_APIC(void)*/ void disconnect_bsp_APIC (int virt_wire_setup) { +#ifdef CONFIG_X86_32 if (pic_mode) {/* * Put the board back into PIC mode (has an effect only on
@@ -1431,47 +1432,48 @@ void disconnect_bsp_APIC(int virt_wire_setup) "entering PIC mode.\n");outb (0x70 ,0x22 );outb (0x00 ,0x23 ); - }else { -/* Go back to Virtual Wire compatibility mode */ -unsigned long value; +return ; + } +#endif -/* For the spurious interrupt use vector F, and enable it */ - value =apic_read (APIC_SPIV ); - value &= ~APIC_VECTOR_MASK ; - value |=APIC_SPIV_APIC_ENABLED ; - value |=0xf ; -apic_write (APIC_SPIV , value); +/* Go back to Virtual Wire compatibility mode */ +unsigned int value; -if (!virt_wire_setup) { -/* -* For LVT0 make it edge triggered, active high, -* external and enabled -*/ - value =apic_read (APIC_LVT0 ); - value &= ~(APIC_MODE_MASK |APIC_SEND_PENDING | -APIC_INPUT_POLARITY |APIC_LVT_REMOTE_IRR | -APIC_LVT_LEVEL_TRIGGER |APIC_LVT_MASKED ); - value |=APIC_LVT_REMOTE_IRR |APIC_SEND_PENDING ; - value =SET_APIC_DELIVERY_MODE (value,APIC_MODE_EXTINT ); -apic_write (APIC_LVT0 , value); - }else { -/* Disable LVT0 */ -apic_write (APIC_LVT0 ,APIC_LVT_MASKED ); - } +/* For the spurious interrupt use vector F, and enable it */ + value =apic_read (APIC_SPIV ); + value &= ~APIC_VECTOR_MASK ; + value |=APIC_SPIV_APIC_ENABLED ; + value |=0xf ; +apic_write (APIC_SPIV , value); +if (!virt_wire_setup) {/* -* For LVT1 make it edge triggered, active high, nmi and -* enabled +* For LVT0 make it edge triggered, active high, +* external and enabled */ - value =apic_read (APIC_LVT1 ); - value &= ~( -APIC_MODE_MASK |APIC_SEND_PENDING | + value =apic_read (APIC_LVT0 ); + value &= ~(APIC_MODE_MASK |APIC_SEND_PENDING |APIC_INPUT_POLARITY |APIC_LVT_REMOTE_IRR |APIC_LVT_LEVEL_TRIGGER |APIC_LVT_MASKED ); value |=APIC_LVT_REMOTE_IRR |APIC_SEND_PENDING ; - value =SET_APIC_DELIVERY_MODE (value,APIC_MODE_NMI ); -apic_write (APIC_LVT1 , value); + value =SET_APIC_DELIVERY_MODE (value,APIC_MODE_EXTINT ); +apic_write (APIC_LVT0 , value); + }else { +/* Disable LVT0 */ +apic_write (APIC_LVT0 ,APIC_LVT_MASKED ); } + +/* +* For LVT1 make it edge triggered, active high, +* nmi and enabled +*/ + value =apic_read (APIC_LVT1 ); + value &= ~(APIC_MODE_MASK |APIC_SEND_PENDING | +APIC_INPUT_POLARITY |APIC_LVT_REMOTE_IRR | +APIC_LVT_LEVEL_TRIGGER |APIC_LVT_MASKED ); + value |=APIC_LVT_REMOTE_IRR |APIC_SEND_PENDING ; + value =SET_APIC_DELIVERY_MODE (value,APIC_MODE_NMI ); +apic_write (APIC_LVT1 , value); }void __cpuinit generic_processor_info (int apicid,int version)
arch/x86/kernel/apic_64.c +21 -2
@@ -1348,8 +1348,24 @@ void __init connect_bsp_APIC(void)*/ void disconnect_bsp_APIC (int virt_wire_setup) { +#ifdef CONFIG_X86_32 +if (pic_mode) { +/* +* Put the board back into PIC mode (has an effect only on +* certain older boards). Note that APIC interrupts, including +* IPIs, won't work beyond this point! The only exception are +* INIT IPIs. +*/ +apic_printk (APIC_VERBOSE ,"disabling APIC mode, " +"entering PIC mode.\n" ); +outb (0x70 ,0x22 ); +outb (0x00 ,0x23 ); +return ; + } +#endif +/* Go back to Virtual Wire compatibility mode */ -unsigned long value; +unsigned int value;/* For the spurious interrupt use vector F, and enable it */ value =apic_read (APIC_SPIV );
@@ -1375,7 +1391,10 @@ void disconnect_bsp_APIC(int virt_wire_setup)apic_write (APIC_LVT0 ,APIC_LVT_MASKED ); } -/* For LVT1 make it edge triggered, active high, nmi and enabled */ +/* +* For LVT1 make it edge triggered, active high, +* nmi and enabled +*/ value =apic_read (APIC_LVT1 ); value &= ~(APIC_MODE_MASK | APIC_SEND_PENDING | APIC_INPUT_POLARITY | APIC_LVT_REMOTE_IRR |
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 9/15 x86: apic - generic_processor_info
In reply to Cyrill Gorcunov- use physid_set instead of phys_cpu and physids_or
- set phys_cpu_present_map bit AFTER check for allowed number of processors
- add checking for APIC valid version in 64bit mode (mostly not needed but added for merging purpose)
- add apic_version definition for 64bit mode which is used now
--- arch/x86/kernel/apic_32.c | 15 ++++++++------- arch/x86/kernel/apic_64.c | 41 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 47 insertions(+), 9 deletions(-)
arch/x86/kernel/apic_32.c +8 -7
@@ -1480,7 +1480,6 @@ void __cpuinit generic_processor_info(int apicid, int version) {int cpu;cpumask_t tmp_map; -physid_mask_t phys_cpu;/* * Validate version
@@ -1493,9 +1492,6 @@ void __cpuinit generic_processor_info(int apicid, int version) } apic_version[apicid] = version; - phys_cpu =apicid_to_cpu_present (apicid); -physids_or (phys_cpu_present_map, phys_cpu_present_map, phys_cpu); -if (num_processors >=NR_CPUS ) {printk (KERN_WARNING "WARNING: NR_CPUS limit of %i reached." " Processor ignored.\n" ,NR_CPUS );
@@ -1512,17 +1508,19 @@ void __cpuinit generic_processor_info(int apicid, int version)cpus_complement (tmp_map, cpu_present_map); cpu =first_cpu (tmp_map); -if (apicid == boot_cpu_physical_apicid) +physid_set (apicid, phys_cpu_present_map); +if (apicid == boot_cpu_physical_apicid) {/* * x86_bios_cpu_apicid is required to have processors listed * in same order as logical cpu numbers. Hence the first * entry is BSP, and so on. */ cpu =0 ; - + }if (apicid > max_physical_apicid) max_physical_apicid = apicid; +#ifdef CONFIG_X86_32 /* * Would be preferable to switch to bigsmp when CONFIG_HOTPLUG_CPU=y * but we need to work other dependencies like SMP_SUSPEND etc
@@ -1542,7 +1540,9 @@ void __cpuinit generic_processor_info(int apicid, int version) def_to_bigsmp = 1; } } -#ifdef CONFIG_SMP +#endif + +#if defined(CONFIG_X86_SMP ) || defined(CONFIG_X86_64 )/* are we being called early in kernel startup? */ if (early_per_cpu_ptr (x86_cpu_to_apicid)) {u16 *cpu_to_apicid =early_per_cpu_ptr (x86_cpu_to_apicid);
@@ -1555,6 +1555,7 @@ void __cpuinit generic_processor_info(int apicid, int version) per_cpu(x86_bios_cpu_apicid, cpu) = apicid; }#endif +cpu_set (cpu, cpu_possible_map);cpu_set (cpu, cpu_present_map); }
arch/x86/kernel/apic_64.c +39 -2
72 lines not on this page · raw message
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 10/15 x86: apic - unify end_local_APIC_setup
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 6 ++++-- arch/x86/kernel/apic_64.c | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-)
arch/x86/kernel/apic_32.c +4 -2
@@ -1155,13 +1155,15 @@ void __cpuinit setup_local_APIC(void)void __cpuinit end_local_APIC_setup (void ) { -unsigned long value; -lapic_setup_esr (); + +#ifdef CONFIG_X86_32 +unsigned int value;/* Disable the local apic timer */ value =apic_read (APIC_LVTT ); value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR );apic_write (APIC_LVTT , value); +#endif setup_apic_nmi_watchdog (NULL );apic_pm_activate ();
arch/x86/kernel/apic_64.c +9 -0
@@ -1014,6 +1014,15 @@ void __cpuinit setup_local_APIC(void)void __cpuinit end_local_APIC_setup (void ) {lapic_setup_esr (); + +#ifdef CONFIG_X86_32 +unsigned int value; +/* Disable the local apic timer */ + value =apic_read (APIC_LVTT ); + value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR ); +apic_write (APIC_LVTT , value); +#endif +setup_apic_nmi_watchdog (NULL );apic_pm_activate (); }
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 11/15 x86: apic - unify local_apic_timer_interrupt
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 4 ++++ arch/x86/kernel/apic_64.c | 4 ++++ 2 files changed, 8 insertions(+), 0 deletions(-)
arch/x86/kernel/apic_32.c +4 -0
@@ -685,7 +685,11 @@ static void local_apic_timer_interrupt(void)/* * the NMI deadlock-detector uses this. */ +#ifdef CONFIG_X86_64 +add_pda (apic_timer_irqs,1 ); +#else per_cpu (irq_stat, cpu).apic_timer_irqs++; +#endif evt->event_handler (evt); }
arch/x86/kernel/apic_64.c +4 -0
@@ -567,7 +567,11 @@ static void local_apic_timer_interrupt(void)/* * the NMI deadlock-detector uses this. */ +#ifdef CONFIG_X86_64 add_pda (apic_timer_irqs,1 ); +#else +per_cpu (irq_stat, cpu).apic_timer_irqs++; +#endif evt->event_handler (evt); }
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 12/15 x86: apic - unify apic_set_verbosity
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 17 +++++++++++++-- arch/x86/kernel/apic_64.c | 46 ++++++++++++++++++++++++-------------------- 2 files changed, 39 insertions(+), 24 deletions(-)
arch/x86/kernel/apic_32.c +14 -3
@@ -1768,13 +1768,24 @@ early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);static int __init apic_set_verbosity (char *arg) { -if (!arg) +if (!arg) { +#ifdef CONFIG_X86_64 + skip_ioapic_setup =0 ; + ioapic_force =1 ; +return 0 ; +#endif return -EINVAL ; + } -if (strcmp (arg,"debug" ) ==0 ) +if (strcmp ("debug" , arg) ==0 ) apic_verbosity =APIC_DEBUG ; -else if (strcmp (arg,"verbose" ) ==0 ) +else if (strcmp ("verbose" , arg) ==0 ) apic_verbosity =APIC_VERBOSE ; +else { +printk (KERN_WARNING "APIC Verbosity level %s not recognised" +" use apic=verbose or apic=debug\n" , arg); +return -EINVAL ; + }return 0 ; }
arch/x86/kernel/apic_64.c +25 -21
58 lines not on this page · raw message
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 13/15 x86: apic - unify disableapic and nolapic setup handlers
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 11 +++++++++-- arch/x86/kernel/apic_64.c | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-)
arch/x86/kernel/apic_32.c +9 -2
@@ -1737,13 +1737,20 @@ static int __init parse_lapic(char *arg) }early_param ("lapic" , parse_lapic); -static int __init parse_nolapic (char *arg) +static int __init setup_disableapic (char *arg) { disable_apic =1 ;setup_clear_cpu_cap (X86_FEATURE_APIC );return 0 ; } -early_param ("nolapic" , parse_nolapic); +early_param ("disableapic" , setup_disableapic); + +/* same as disableapic, for compatibility */ +static int __init setup_nolapic (char *arg) +{ +return setup_disableapic (arg); +} +early_param ("nolapic" , setup_nolapic);static int __init parse_disable_apic_timer (char *arg) {
arch/x86/kernel/apic_64.c +3 -3
@@ -1759,7 +1759,7 @@ early_param("nox2apic", setup_nox2apic);/* * APIC command line parameters */ -static __init int setup_disableapic (char *str) +static int __init setup_disableapic (char *arg) { disable_apic =1 ;setup_clear_cpu_cap (X86_FEATURE_APIC );
@@ -1768,9 +1768,9 @@ static __init int setup_disableapic(char *str)early_param ("disableapic" , setup_disableapic);/* same as disableapic, for compatibility */ -static __init int setup_nolapic (char *str) +static int __init setup_nolapic (char *arg) { -return setup_disableapic (str); +return setup_disableapic (arg); }early_param ("nolapic" , setup_nolapic);
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 14/15 x86: apic - rearrange parse_lapic_timer_c2_ok
In reply to Cyrill Gorcunov--- arch/x86/kernel/apic_32.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
arch/x86/kernel/apic_32.c +7 -7
@@ -1752,6 +1752,13 @@ static int __init setup_nolapic(char *arg) }early_param ("nolapic" , setup_nolapic); +static int __init parse_lapic_timer_c2_ok (char *arg) +{ + local_apic_timer_c2_ok =1 ; +return 0 ; +} +early_param ("lapic_timer_c2_ok" , parse_lapic_timer_c2_ok); +static int __init parse_disable_apic_timer (char *arg) { disable_apic_timer =1 ;
@@ -1766,13 +1773,6 @@ static int __init parse_nolapic_timer(char *arg) }early_param ("nolapic_timer" , parse_nolapic_timer); -static int __init parse_lapic_timer_c2_ok (char *arg) -{ - local_apic_timer_c2_ok =1 ; -return 0 ; -} -early_param ("lapic_timer_c2_ok" , parse_lapic_timer_c2_ok); -static int __init apic_set_verbosity (char *arg) {if (!arg) {
Signature · 1 line
1.6.0.rc1.34.g0fe8c
PATCH 15/15 x86: apic - lapic_resume 32bit - unification fix
In reply to Cyrill GorcunovJust add parenthesis to be identical of current
64bit implementation (so diff will not complain).
--- arch/x86/kernel/apic_32.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/x86/kernel/apic_32.c +2 -0
@@ -1646,6 +1646,7 @@ static int lapic_resume(struct sys_device *dev)enable_x2apic (); else#endif + {/* * Make sure the APICBASE points to the right address *
@@ -1656,6 +1657,7 @@ static int lapic_resume(struct sys_device *dev) l &= ~MSR_IA32_APICBASE_BASE ; l |=MSR_IA32_APICBASE_ENABLE | mp_lapic_addr;wrmsr (MSR_IA32_APICBASE , l, h); + }apic_write (APIC_LVTERR ,ERROR_APIC_VECTOR |APIC_LVT_MASKED );apic_write (APIC_ID , apic_pm_state.apic_id);
Signature · 1 line
1.6.0.rc1.34.g0fe8c
H. Peter Anvin
reviewerQuoted 9 lines · Cyrill Gorcunov
With this series 32bit code compilation warns:
arch/x86/kernel/apic_32.c: In function ‘end_local_APIC_setup’:arch/x86/kernel/apic_32.c:1165: warning: ISO C90 forbids mixed declarations and codearch/x86/kernel/apic_32.c: In function ‘disconnect_bsp_APIC’:arch/x86/kernel/apic_32.c:1446: warning: ISO C90 forbids mixed declarations and code cyrill@lenovo linux-2.6.git $
Quoted 5 lines
So parenthesis will be needed to eliminate them... but
I think it could be too ugly... need some time to think.
So patches 8/15 and 10/15 sould be not applied for now - just review them. Thanks for patience!
Typically, just move the declaration to the top of the function (followed by a blank line.)
-hpa
[H. Peter Anvin - Mon, Aug 18, 2008 at 10:22:12AM -0700]
Quoted 16 lines
Quoted 9 lines · Cyrill Gorcunov
With this series 32bit code compilation warns:
arch/x86/kernel/apic_32.c: In function ‘end_local_APIC_setup’:arch/x86/kernel/apic_32.c:1165: warning: ISO C90 forbids mixed declarations and codearch/x86/kernel/apic_32.c: In function ‘disconnect_bsp_APIC’:arch/x86/kernel/apic_32.c:1446: warning: ISO C90 forbids mixed declarations and code cyrill@lenovo linux-2.6.git $Quoted 5 lines
So parenthesis will be needed to eliminate them... but
I think it could be too ugly... need some time to think.
So patches 8/15 and 10/15 sould be not applied for now - just review them. Thanks for patience!
Quoted 5 lines
Typically, just move the declaration to the top of the function (followed by a blank line.)
-hpa
well in case of the patch 10/15 it's not good since I don't want to waste even 4 bytes in stack for 64bit APIC :) I guess gcc could find it and just eliminate - will take a look.
- Cyrill -
[H. Peter Anvin - Mon, Aug 18, 2008 at 10:22:12AM -0700]
Quoted 16 lines
Quoted 9 lines · Cyrill Gorcunov
With this series 32bit code compilation warns:
arch/x86/kernel/apic_32.c: In function ‘end_local_APIC_setup’:arch/x86/kernel/apic_32.c:1165: warning: ISO C90 forbids mixed declarations and codearch/x86/kernel/apic_32.c: In function ‘disconnect_bsp_APIC’:arch/x86/kernel/apic_32.c:1446: warning: ISO C90 forbids mixed declarations and code cyrill@lenovo linux-2.6.git $Quoted 5 lines
So parenthesis will be needed to eliminate them... but
I think it could be too ugly... need some time to think.
So patches 8/15 and 10/15 sould be not applied for now - just review them. Thanks for patience!
Quoted 5 lines
Typically, just move the declaration to the top of the function (followed by a blank line.)
-hpa
Here is compilation warnings fix
- Cyrill -
---
x86: apic - compilation wrnings fix
---
Please check if it's not worse code form now :)
arch/x86/kernel/apic_32.c +9 -6
@@ -1162,11 +1162,13 @@ void __cpuinit end_local_APIC_setup(void)lapic_setup_esr ();#ifdef CONFIG_X86_32 -unsigned int value; -/* Disable the local apic timer */ - value =apic_read (APIC_LVTT ); - value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR ); -apic_write (APIC_LVTT , value); + { +unsigned int value; +/* Disable the local apic timer */ + value =apic_read (APIC_LVTT ); + value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR ); +apic_write (APIC_LVTT , value); + }#endif setup_apic_nmi_watchdog (NULL );
@@ -1426,6 +1428,8 @@ void __init connect_bsp_APIC(void)*/ void disconnect_bsp_APIC (int virt_wire_setup) { +unsigned int value; +#ifdef CONFIG_X86_32 if (pic_mode) {/*
@@ -1443,7 +1447,6 @@ void disconnect_bsp_APIC(int virt_wire_setup)#endif /* Go back to Virtual Wire compatibility mode */ -unsigned int value;/* For the spurious interrupt use vector F, and enable it */ value =apic_read (APIC_SPIV );
arch/x86/kernel/apic_64.c +9 -6
@@ -1020,11 +1020,13 @@ void __cpuinit end_local_APIC_setup(void)lapic_setup_esr ();#ifdef CONFIG_X86_32 -unsigned int value; -/* Disable the local apic timer */ - value =apic_read (APIC_LVTT ); - value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR ); -apic_write (APIC_LVTT , value); + { +unsigned int value; +/* Disable the local apic timer */ + value =apic_read (APIC_LVTT ); + value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR ); +apic_write (APIC_LVTT , value); + }#endif setup_apic_nmi_watchdog (NULL );
@@ -1363,6 +1365,8 @@ void __init connect_bsp_APIC(void)*/ void disconnect_bsp_APIC (int virt_wire_setup) { +unsigned int value; +#ifdef CONFIG_X86_32 if (pic_mode) {/*
@@ -1380,7 +1384,6 @@ void disconnect_bsp_APIC(int virt_wire_setup)#endif /* Go back to Virtual Wire compatibility mode */ -unsigned int value;/* For the spurious interrupt use vector F, and enable it */ value =apic_read (APIC_SPIV );
Quoted 17 lines · Cyrill Gorcunov
[H. Peter Anvin - Mon, Aug 18, 2008 at 10:22:12AM -0700]
Quoted 16 lines
Quoted 14 lines · Cyrill Gorcunov
With this series 32bit code compilation warns:
arch/x86/kernel/apic_32.c: In function ‘end_local_APIC_setup’:arch/x86/kernel/apic_32.c:1165: warning: ISO C90 forbids mixed declarations and codearch/x86/kernel/apic_32.c: In function ‘disconnect_bsp_APIC’:arch/x86/kernel/apic_32.c:1446: warning: ISO C90 forbids mixed declarations and code cyrill@lenovo linux-2.6.git $So parenthesis will be needed to eliminate them... but
I think it could be too ugly... need some time to think.
So patches 8/15 and 10/15 sould be not applied for now - just review them. Thanks for patience!
Quoted 6 lines
Quoted 5 lines
Typically, just move the declaration to the top of the function (followed by a blank line.)
-hpa
Here is compilation warnings fix
applied the 15 patches and this fixlet to tip/x86/apic - thanks Cyrill.
arch/x86/kernel/apic_32.c void __cpuinit end_local_APIC_setup(void) · line 1171
Quoted 9 lines
Please check if it's not worse code form now :)
arch/x86/kernel/apic_32.c +7
-0+ { +unsigned int value; +/* Disable the local apic timer */ + value =apic_read (APIC_LVTT ); + value |= (APIC_LVT_MASKED |LOCAL_TIMER_VECTOR ); +apic_write (APIC_LVTT , value); + }
that's OK.
Ingo