* [PATCH 0/15] apic: unification series 5
@ 2008-08-18 16:45 Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
2008-08-18 17:22 ` [PATCH 0/15] apic: unification series 5 H. Peter Anvin
0 siblings, 2 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel
This series is over
commit d5e629a6f88137fb77c4cc857be5ea7c3f27110d
Author: Yinghai Lu <yhlu.kernel@gmail.com>
Date: Sun Aug 17 21:12:27 2008 -0700
x86: apic - unify lapic_resume - fix
Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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 -
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 01/15] x86: apic - rearrange maxcpu definition
2008-08-18 16:45 [PATCH 0/15] apic: unification series 5 Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 02/15] x86: apic - unify setup_boot_APIC_clock Cyrill Gorcunov
` (14 more replies)
2008-08-18 17:22 ` [PATCH 0/15] apic: unification series 5 H. Peter Anvin
1 sibling, 15 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 4 ++--
arch/x86/kernel/apic_64.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 41134d4..8d1febf 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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;
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index ad532dc..46acb9b 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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
*/
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 02/15] x86: apic - unify setup_boot_APIC_clock
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 03/15] x86: apic - unify disable_local_APIC Cyrill Gorcunov
` (13 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 8d1febf..80db3e0 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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;
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 03/15] x86: apic - unify disable_local_APIC
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 02/15] x86: apic - unify setup_boot_APIC_clock Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 04/15] x86: apic - unify lapic_shutdown Cyrill Gorcunov
` (12 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 4 +++-
arch/x86/kernel/apic_64.c | 14 ++++++++++++++
2 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 80db3e0..13c4b79 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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
}
/*
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 46acb9b..4fb903b 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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)
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 04/15] x86: apic - unify lapic_shutdown
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 02/15] x86: apic - unify setup_boot_APIC_clock Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 03/15] x86: apic - unify disable_local_APIC Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 05/15] x86: apic - unify connect_bsp_APIC Cyrill Gorcunov
` (11 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 9 ++++++---
arch/x86/kernel/apic_64.c | 14 +++++++++++++-
2 files changed, 19 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 13c4b79..d4efe86 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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);
}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 4fb903b..4880654 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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);
}
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 05/15] x86: apic - unify connect_bsp_APIC
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (2 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 04/15] x86: apic - unify lapic_shutdown Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 06/15] x86: apic - unify lapic_setup_esr Cyrill Gorcunov
` (10 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 2 ++
arch/x86/kernel/apic_64.c | 20 ++++++++++++++++++--
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index d4efe86..6d230e9 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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();
}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 4880654..5579e21 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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();
}
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 06/15] x86: apic - unify lapic_setup_esr
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (3 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 05/15] x86: apic - unify connect_bsp_APIC Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 07/15] x86: apic - unify __setup_APIC_LVTT Cyrill Gorcunov
` (9 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
We use 32bit code former for 64bit
mode since it's much better implementation
and easier to merge.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 21 +++++++++--------
arch/x86/kernel/apic_64.c | 51 ++++++++++++++++++++++++++++++++++----------
2 files changed, 50 insertions(+), 22 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 6d230e9..3c1562a 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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");
}
}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 5579e21..d74abf7 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -863,6 +863,45 @@ void __init init_bsp_APIC(void)
apic_write(APIC_LVT1, value);
}
+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. */
+ apic_write(APIC_ESR, 0);
+ oldvalue = apic_read(APIC_ESR);
+
+ /* enables sending errors */
+ value = ERROR_APIC_VECTOR;
+ apic_write(APIC_LVTERR, value);
+ /*
+ * spec says clear errors after enabling vector.
+ */
+ if (maxlvt > 3)
+ apic_write(APIC_ESR, 0);
+ value = apic_read(APIC_ESR);
+ if (value != oldvalue)
+ apic_printk(APIC_VERBOSE, "ESR value before enabling "
+ "vector: 0x%08lx after: 0x%08lx\n",
+ oldvalue, value);
+ } else {
+ printk(KERN_INFO "No ESR for 82489DX.\n");
+ }
+}
+
+
/**
* setup_local_APIC - setup the local APIC
*/
@@ -968,18 +1007,6 @@ void __cpuinit setup_local_APIC(void)
preempt_enable();
}
-static void __cpuinit lapic_setup_esr(void)
-{
- unsigned maxlvt = lapic_get_maxlvt();
-
- apic_write(APIC_LVTERR, ERROR_APIC_VECTOR);
- /*
- * spec says clear errors after enabling vector.
- */
- if (maxlvt > 3)
- apic_write(APIC_ESR, 0);
-}
-
void __cpuinit end_local_APIC_setup(void)
{
lapic_setup_esr();
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 07/15] x86: apic - unify __setup_APIC_LVTT
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (4 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 06/15] x86: apic - unify lapic_setup_esr Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 08/15] x86: apic - unify disconnect_bsp_APIC Cyrill Gorcunov
` (8 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 10 +++++++---
arch/x86/kernel/apic_64.c | 12 ++++++++----
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 3c1562a..65419c7 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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);
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index d74abf7..fe57db9 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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);
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 08/15] x86: apic - unify disconnect_bsp_APIC
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (5 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 07/15] x86: apic - unify __setup_APIC_LVTT Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 09/15] x86: apic - generic_processor_info Cyrill Gorcunov
` (7 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
- just #ifdef added
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 66 +++++++++++++++++++++++---------------------
arch/x86/kernel/apic_64.c | 23 ++++++++++++++-
2 files changed, 55 insertions(+), 34 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 65419c7..3095bb7 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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)
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index fe57db9..0d96910 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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 |
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 09/15] x86: apic - generic_processor_info
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (6 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 08/15] x86: apic - unify disconnect_bsp_APIC Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 10/15] x86: apic - unify end_local_APIC_setup Cyrill Gorcunov
` (6 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, 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
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 15 ++++++++-------
arch/x86/kernel/apic_64.c | 41 +++++++++++++++++++++++++++++++++++++++--
2 files changed, 47 insertions(+), 9 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 3095bb7..c3a252b 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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);
}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 0d96910..76c2077 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1215,6 +1215,8 @@ void __init init_apic_mappings(void)
* This initializes the IO-APIC and APIC hardware if this is
* a UP kernel.
*/
+int apic_version[MAX_APICS];
+
int __init APIC_init_uniprocessor(void)
{
if (disable_apic) {
@@ -1409,15 +1411,26 @@ void __cpuinit generic_processor_info(int apicid, int version)
int cpu;
cpumask_t tmp_map;
+ /*
+ * Validate version
+ */
+ if (version == 0x0) {
+ printk(KERN_WARNING "BIOS bug, APIC version is 0 for CPU#%d! "
+ "fixing up to 0x10. (tell your hw vendor)\n",
+ version);
+ version = 0x10;
+ }
+ apic_version[apicid] = version;
+
if (num_processors >= NR_CPUS) {
printk(KERN_WARNING "WARNING: NR_CPUS limit of %i reached."
- " Processor ignored.\n", NR_CPUS);
+ " Processor ignored.\n", NR_CPUS);
return;
}
if (num_processors >= maxcpus) {
printk(KERN_WARNING "WARNING: maxcpus limit of %i reached."
- " Processor ignored.\n", maxcpus);
+ " Processor ignored.\n", maxcpus);
return;
}
@@ -1437,6 +1450,29 @@ void __cpuinit generic_processor_info(int apicid, int version)
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
+ * before this can be done without some confusion.
+ * if (CPU_HOTPLUG_ENABLED || num_processors > 8)
+ * - Ashok Raj <ashok.raj@intel.com>
+ */
+ if (max_physical_apicid >= 8) {
+ switch (boot_cpu_data.x86_vendor) {
+ case X86_VENDOR_INTEL:
+ if (!APIC_XAPIC(version)) {
+ def_to_bigsmp = 0;
+ break;
+ }
+ /* If P4 and above fall through */
+ case X86_VENDOR_AMD:
+ def_to_bigsmp = 1;
+ }
+ }
+#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);
@@ -1448,6 +1484,7 @@ void __cpuinit generic_processor_info(int apicid, int version)
per_cpu(x86_cpu_to_apicid, cpu) = apicid;
per_cpu(x86_bios_cpu_apicid, cpu) = apicid;
}
+#endif
cpu_set(cpu, cpu_possible_map);
cpu_set(cpu, cpu_present_map);
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 10/15] x86: apic - unify end_local_APIC_setup
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (7 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 09/15] x86: apic - generic_processor_info Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 11/15] x86: apic - unify local_apic_timer_interrupt Cyrill Gorcunov
` (5 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 6 ++++--
arch/x86/kernel/apic_64.c | 9 +++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index c3a252b..f188232 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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();
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 76c2077..eec10b3 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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();
}
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 11/15] x86: apic - unify local_apic_timer_interrupt
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (8 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 10/15] x86: apic - unify end_local_APIC_setup Cyrill Gorcunov
@ 2008-08-18 16:45 ` Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 12/15] x86: apic - unify apic_set_verbosity Cyrill Gorcunov
` (4 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:45 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 4 ++++
arch/x86/kernel/apic_64.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index f188232..af227bc 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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);
}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index eec10b3..a9ad2cb 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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);
}
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 12/15] x86: apic - unify apic_set_verbosity
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (9 preceding siblings ...)
2008-08-18 16:45 ` [PATCH 11/15] x86: apic - unify local_apic_timer_interrupt Cyrill Gorcunov
@ 2008-08-18 16:46 ` Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 13/15] x86: apic - unify disableapic and nolapic setup handlers Cyrill Gorcunov
` (3 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:46 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 17 +++++++++++++--
arch/x86/kernel/apic_64.c | 46 ++++++++++++++++++++++++--------------------
2 files changed, 39 insertions(+), 24 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index af227bc..acbc4de 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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;
}
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index a9ad2cb..9997818 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -1759,27 +1759,6 @@ early_param("nox2apic", setup_nox2apic);
/*
* APIC command line parameters
*/
-static int __init apic_set_verbosity(char *str)
-{
- if (str == NULL) {
- skip_ioapic_setup = 0;
- ioapic_force = 1;
- return 0;
- }
- if (strcmp("debug", str) == 0)
- apic_verbosity = APIC_DEBUG;
- else if (strcmp("verbose", str) == 0)
- apic_verbosity = APIC_VERBOSE;
- else {
- printk(KERN_WARNING "APIC Verbosity level %s not recognised"
- " use apic=verbose or apic=debug\n", str);
- return -EINVAL;
- }
-
- return 0;
-}
-early_param("apic", apic_set_verbosity);
-
static __init int setup_disableapic(char *str)
{
disable_apic = 1;
@@ -1824,6 +1803,31 @@ static __init int setup_apicpmtimer(char *s)
}
__setup("apicpmtimer", setup_apicpmtimer);
+static int __init apic_set_verbosity(char *arg)
+{
+ if (!arg) {
+#ifdef CONFIG_X86_64
+ skip_ioapic_setup = 0;
+ ioapic_force = 1;
+ return 0;
+#endif
+ return -EINVAL;
+ }
+
+ if (strcmp("debug", arg) == 0)
+ apic_verbosity = APIC_DEBUG;
+ 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;
+}
+early_param("apic", apic_set_verbosity);
+
static int __init lapic_insert_resource(void)
{
if (!apic_phys)
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 13/15] x86: apic - unify disableapic and nolapic setup handlers
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (10 preceding siblings ...)
2008-08-18 16:46 ` [PATCH 12/15] x86: apic - unify apic_set_verbosity Cyrill Gorcunov
@ 2008-08-18 16:46 ` Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 14/15] x86: apic - rearrange parse_lapic_timer_c2_ok Cyrill Gorcunov
` (2 subsequent siblings)
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:46 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 11 +++++++++--
arch/x86/kernel/apic_64.c | 6 +++---
2 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index acbc4de..5680bda 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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)
{
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 9997818..7a31718 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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);
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 14/15] x86: apic - rearrange parse_lapic_timer_c2_ok
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (11 preceding siblings ...)
2008-08-18 16:46 ` [PATCH 13/15] x86: apic - unify disableapic and nolapic setup handlers Cyrill Gorcunov
@ 2008-08-18 16:46 ` Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 15/15] x86: apic - lapic_resume 32bit - unification fix Cyrill Gorcunov
2008-08-18 16:59 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:46 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 5680bda..885e306 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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) {
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* [PATCH 15/15] x86: apic - lapic_resume 32bit - unification fix
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (12 preceding siblings ...)
2008-08-18 16:46 ` [PATCH 14/15] x86: apic - rearrange parse_lapic_timer_c2_ok Cyrill Gorcunov
@ 2008-08-18 16:46 ` Cyrill Gorcunov
2008-08-18 16:59 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:46 UTC (permalink / raw)
To: mingo, macro; +Cc: hpa, tglx, linux-kernel, Cyrill Gorcunov
Just add parenthesis to be identical of current
64bit implementation (so diff will not complain).
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
arch/x86/kernel/apic_32.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index 885e306..e975562 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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);
--
1.6.0.rc1.34.g0fe8c
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 01/15] x86: apic - rearrange maxcpu definition
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
` (13 preceding siblings ...)
2008-08-18 16:46 ` [PATCH 15/15] x86: apic - lapic_resume 32bit - unification fix Cyrill Gorcunov
@ 2008-08-18 16:59 ` Cyrill Gorcunov
14 siblings, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 16:59 UTC (permalink / raw)
To: mingo, macro, hpa, tglx, linux-kernel
[Cyrill Gorcunov - Mon, Aug 18, 2008 at 08:45:49PM +0400]
| Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
| ---
| 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 -
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/15] apic: unification series 5
2008-08-18 16:45 [PATCH 0/15] apic: unification series 5 Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
@ 2008-08-18 17:22 ` H. Peter Anvin
2008-08-18 17:28 ` Cyrill Gorcunov
2008-08-18 19:12 ` Cyrill Gorcunov
1 sibling, 2 replies; 21+ messages in thread
From: H. Peter Anvin @ 2008-08-18 17:22 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: mingo, macro, tglx, linux-kernel
Cyrill Gorcunov wrote:
>
> 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!
>
Typically, just move the declaration to the top of the function
(followed by a blank line.)
-hpa
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/15] apic: unification series 5
2008-08-18 17:22 ` [PATCH 0/15] apic: unification series 5 H. Peter Anvin
@ 2008-08-18 17:28 ` Cyrill Gorcunov
2008-08-18 19:12 ` Cyrill Gorcunov
1 sibling, 0 replies; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 17:28 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: mingo, macro, tglx, linux-kernel
[H. Peter Anvin - Mon, Aug 18, 2008 at 10:22:12AM -0700]
> Cyrill Gorcunov wrote:
>>
>> 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!
>>
>
> 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 -
^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [PATCH 0/15] apic: unification series 5
2008-08-18 17:22 ` [PATCH 0/15] apic: unification series 5 H. Peter Anvin
2008-08-18 17:28 ` Cyrill Gorcunov
@ 2008-08-18 19:12 ` Cyrill Gorcunov
2008-08-19 0:09 ` Ingo Molnar
1 sibling, 1 reply; 21+ messages in thread
From: Cyrill Gorcunov @ 2008-08-18 19:12 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: mingo, macro, tglx, linux-kernel
[H. Peter Anvin - Mon, Aug 18, 2008 at 10:22:12AM -0700]
> Cyrill Gorcunov wrote:
>>
>> 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!
>>
>
> 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
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
Please check if it's not worse code form now :)
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index e975562..b8d80c2 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -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);
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index 7a31718..37e0376 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -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);
^ permalink raw reply related [flat|nested] 21+ messages in thread
* Re: [PATCH 0/15] apic: unification series 5
2008-08-18 19:12 ` Cyrill Gorcunov
@ 2008-08-19 0:09 ` Ingo Molnar
0 siblings, 0 replies; 21+ messages in thread
From: Ingo Molnar @ 2008-08-19 0:09 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: H. Peter Anvin, macro, tglx, linux-kernel
* Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> [H. Peter Anvin - Mon, Aug 18, 2008 at 10:22:12AM -0700]
> > Cyrill Gorcunov wrote:
> >>
> >> 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!
> >>
> >
> > 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.
> Please check if it's not worse code form now :)
> + {
> + 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
^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2008-08-19 0:09 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-18 16:45 [PATCH 0/15] apic: unification series 5 Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 02/15] x86: apic - unify setup_boot_APIC_clock Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 03/15] x86: apic - unify disable_local_APIC Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 04/15] x86: apic - unify lapic_shutdown Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 05/15] x86: apic - unify connect_bsp_APIC Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 06/15] x86: apic - unify lapic_setup_esr Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 07/15] x86: apic - unify __setup_APIC_LVTT Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 08/15] x86: apic - unify disconnect_bsp_APIC Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 09/15] x86: apic - generic_processor_info Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 10/15] x86: apic - unify end_local_APIC_setup Cyrill Gorcunov
2008-08-18 16:45 ` [PATCH 11/15] x86: apic - unify local_apic_timer_interrupt Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 12/15] x86: apic - unify apic_set_verbosity Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 13/15] x86: apic - unify disableapic and nolapic setup handlers Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 14/15] x86: apic - rearrange parse_lapic_timer_c2_ok Cyrill Gorcunov
2008-08-18 16:46 ` [PATCH 15/15] x86: apic - lapic_resume 32bit - unification fix Cyrill Gorcunov
2008-08-18 16:59 ` [PATCH 01/15] x86: apic - rearrange maxcpu definition Cyrill Gorcunov
2008-08-18 17:22 ` [PATCH 0/15] apic: unification series 5 H. Peter Anvin
2008-08-18 17:28 ` Cyrill Gorcunov
2008-08-18 19:12 ` Cyrill Gorcunov
2008-08-19 0:09 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).