linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] convert voyager over to the x86 quirks model
@ 2009-03-08 16:48 James Bottomley
  2009-03-08 16:48 ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops James Bottomley
                   ` (3 more replies)
  0 siblings, 4 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

Given the lack of feedback, I went ahead and implemented the additions
to smp_ops and x86_quirks (and a dynamic mca NMI hook) to allow
voyager to be plumbed in.

There also needs to be changes in the boot setup to make voyager work
dynamically: It has to be detected first, so the a20 gate check is
only executed if a voyager is not found.

I also completed some of the subarchitecture eliminations, so all the
include file infrastructure should be gone.

The result is that I can boot both my PC SMP x86 boxes and voyager
with the same kernel.

This patch series applies on the x86/apic branch of the x86 tree
(obviously with 965c7ecaf2e2b083d711a01ab33735a4bdeee1a4 reverted)

James

---

  [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops
  [VOYAGER] x86/mca: make mca_nmi_hook external
  [VOYAGER] x86: add prefill_possible_map to x86_quirks
  [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot
    processor
  [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area
  [VOYAGER] x86: eliminate subarchitecture file setup_arch.h
  [VOYAGER] x86: eliminate subarchitecture file entry_arch.h
  [VOYAGER] x86: eliminate subarchitecture file do_timer.h
  [VOYAGER] x86: redo irq2 cascade setup
  [VOYAGER] x86: make disabling the apics functional instead of a flag
  [VOYAGER] x86/Voyager: add missing QIC call function single gate
  [VOYAGER] x86/Voyager: replace inline io area reads with readX
    accessors
  [VOYAGER] x86/Voyager: Plumb voyager back into the build

 arch/x86/Kconfig                               |    4 +-
 arch/x86/Makefile                              |    2 +
 arch/x86/boot/Makefile                         |    4 +-
 arch/x86/boot/a20.c                            |   13 +-
 arch/x86/boot/boot.h                           |    2 +-
 arch/x86/boot/voyager.c                        |    5 +-
 arch/x86/include/asm/apic.h                    |    6 +
 arch/x86/include/asm/bootparam.h               |    5 +-
 arch/x86/include/asm/do_timer.h                |   16 -
 arch/x86/include/asm/entry_arch.h              |   57 ---
 arch/x86/include/asm/hw_irq.h                  |   11 +
 arch/x86/include/asm/mach-voyager/do_timer.h   |   17 -
 arch/x86/include/asm/mach-voyager/entry_arch.h |   26 --
 arch/x86/include/asm/mach-voyager/setup_arch.h |   12 -
 arch/x86/include/asm/mca.h                     |    3 +
 arch/x86/include/asm/setup.h                   |    6 +-
 arch/x86/include/asm/setup_arch.h              |    3 -
 arch/x86/include/asm/smp.h                     |   13 +-
 arch/x86/include/asm/voyager.h                 |   80 ++---
 arch/x86/include/asm/voyager_bios.h            |   21 +
 arch/x86/include/asm/voyager_boot.h            |   27 ++
 arch/x86/include/asm/voyager_vectors.h         |   37 ++
 arch/x86/kernel/apic/apic.c                    |    8 +-
 arch/x86/kernel/apic/ipi.c                     |    2 +-
 arch/x86/kernel/apic/probe_32.c                |    3 +
 arch/x86/kernel/entry_32.S                     |   70 +++-
 arch/x86/kernel/irqinit_32.c                   |   15 +-
 arch/x86/kernel/mca_32.c                       |   12 +
 arch/x86/kernel/probe_roms_32.c                |    1 -
 arch/x86/kernel/setup.c                        |   35 +--
 arch/x86/kernel/smp.c                          |    7 +
 arch/x86/kernel/smpboot.c                      |    2 +-
 arch/x86/kernel/time_32.c                      |   11 +-
 arch/x86/kernel/visws_quirks.c                 |    7 -
 arch/x86/mach-voyager/setup.c                  |   66 ++--
 arch/x86/mach-voyager/voyager_basic.c          |   98 ++---
 arch/x86/mach-voyager/voyager_smp.c            |  544 ++++++++----------------
 arch/x86/mach-voyager/voyager_thread.c         |    5 +-
 arch/x86/xen/smp.c                             |    7 +
 39 files changed, 550 insertions(+), 713 deletions(-)
 delete mode 100644 arch/x86/include/asm/do_timer.h
 delete mode 100644 arch/x86/include/asm/entry_arch.h
 delete mode 100644 arch/x86/include/asm/mach-voyager/do_timer.h
 delete mode 100644 arch/x86/include/asm/mach-voyager/entry_arch.h
 delete mode 100644 arch/x86/include/asm/mach-voyager/setup_arch.h
 delete mode 100644 arch/x86/include/asm/setup_arch.h
 create mode 100644 arch/x86/include/asm/voyager_bios.h
 create mode 100644 arch/x86/include/asm/voyager_boot.h
 create mode 100644 arch/x86/include/asm/voyager_vectors.h


^ permalink raw reply	[flat|nested] 24+ messages in thread

* [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops
  2009-03-08 16:48 [PATCH 00/13] convert voyager over to the x86 quirks model James Bottomley
@ 2009-03-08 16:48 ` James Bottomley
  2009-03-08 16:48   ` [PATCH 02/13] [VOYAGER] x86/mca: make mca_nmi_hook external James Bottomley
  2009-03-08 17:15   ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops Jeremy Fitzhardinge
  2009-03-09 20:54 ` [PATCH 00/13] convert voyager over to the x86 quirks model Sam Ravnborg
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML
  Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley,
	Jeremy Fitzhardinge

Not having apics, Voyager can't use the default apic implementation of
these, it has to read from a special port in the VIC to get the
processor ID, so abstract these functions in smp_ops to allow voyager
to live simultaneously with the apic code.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>
---
 arch/x86/include/asm/smp.h  |   13 +++++++++++--
 arch/x86/kernel/apic/apic.c |    5 -----
 arch/x86/kernel/apic/ipi.c  |    2 +-
 arch/x86/kernel/smp.c       |    7 +++++++
 arch/x86/xen/smp.c          |    7 +++++++
 5 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 47d0e21..d11687e 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -60,6 +60,8 @@ struct smp_ops {
 
 	void (*send_call_func_ipi)(const struct cpumask *mask);
 	void (*send_call_func_single_ipi)(int cpu);
+	int (*hard_smp_processor_id)(void);
+	int (*safe_smp_processor_id)(void);
 };
 
 /* Globals due to paravirt */
@@ -158,7 +160,11 @@ extern unsigned disabled_cpus __cpuinitdata;
  * so this is correct in the x86 case.
  */
 #define raw_smp_processor_id() (percpu_read(cpu_number))
-extern int safe_smp_processor_id(void);
+int apic_safe_smp_processor_id(void);
+static inline int safe_smp_processor_id(void)
+{
+	return smp_ops.safe_smp_processor_id();
+}
 
 #elif defined(CONFIG_X86_64_SMP)
 #define raw_smp_processor_id() (percpu_read(cpu_number))
@@ -184,7 +190,10 @@ static inline int logical_smp_processor_id(void)
 
 #endif
 
-extern int hard_smp_processor_id(void);
+static inline int hard_smp_processor_id(void)
+{
+	return smp_ops.hard_smp_processor_id();
+}
 
 #else /* CONFIG_X86_LOCAL_APIC */
 
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index f9cecdf..ee68005 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1856,11 +1856,6 @@ void __cpuinit generic_processor_info(int apicid, int version)
 	set_cpu_present(cpu, true);
 }
 
-int hard_smp_processor_id(void)
-{
-	return read_apic_id();
-}
-
 void default_init_apic_ldr(void)
 {
 	unsigned long val;
diff --git a/arch/x86/kernel/apic/ipi.c b/arch/x86/kernel/apic/ipi.c
index dbf5445..90bb775 100644
--- a/arch/x86/kernel/apic/ipi.c
+++ b/arch/x86/kernel/apic/ipi.c
@@ -146,7 +146,7 @@ static int convert_apicid_to_cpu(int apic_id)
 	return -1;
 }
 
-int safe_smp_processor_id(void)
+int apic_safe_smp_processor_id(void)
 {
 	int apicid, cpuid;
 
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 13f33ea..29d0af7 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -192,6 +192,11 @@ void smp_call_function_single_interrupt(struct pt_regs *regs)
 	irq_exit();
 }
 
+static int native_hard_smp_processor_id(void)
+{
+	return read_apic_id();
+}
+
 struct smp_ops smp_ops = {
 	.smp_prepare_boot_cpu = native_smp_prepare_boot_cpu,
 	.smp_prepare_cpus = native_smp_prepare_cpus,
@@ -207,5 +212,7 @@ struct smp_ops smp_ops = {
 
 	.send_call_func_ipi = native_send_call_func_ipi,
 	.send_call_func_single_ipi = native_send_call_func_single_ipi,
+	.hard_smp_processor_id = native_hard_smp_processor_id,
+	.safe_smp_processor_id = apic_safe_smp_processor_id,
 };
 EXPORT_SYMBOL_GPL(smp_ops);
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index 035582a..0dfb8c0 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -450,6 +450,11 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
+static int xen_hard_smp_processor_id(void)
+{
+	return read_apic_id();
+}
+
 static const struct smp_ops xen_smp_ops __initdata = {
 	.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
 	.smp_prepare_cpus = xen_smp_prepare_cpus,
@@ -465,6 +470,8 @@ static const struct smp_ops xen_smp_ops __initdata = {
 
 	.send_call_func_ipi = xen_smp_send_call_function_ipi,
 	.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
+	.hard_smp_processor_id = xen_hard_smp_processor_id,
+	.safe_smp_processor_id = apic_safe_smp_processor_id,
 };
 
 void __init xen_smp_init(void)
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 02/13] [VOYAGER] x86/mca: make mca_nmi_hook external
  2009-03-08 16:48 ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops James Bottomley
@ 2009-03-08 16:48   ` James Bottomley
  2009-03-08 16:48     ` [PATCH 03/13] [VOYAGER] x86: add prefill_possible_map to x86_quirks James Bottomley
  2009-03-08 17:15   ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops Jeremy Fitzhardinge
  1 sibling, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

Part of the apic rework brought the mca_nmi_hook to a place where it
can't be accessed by architecture specific code.  Publish it again,
this time as a settable function vector so that voyager can use it.

If there were more than one possible architecture wanting to use this,
it could become a call chain, but there's only one and MCA is an old
bus, so leave it as a single call hook.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/mca.h |    3 +++
 arch/x86/kernel/mca_32.c   |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/mca.h b/arch/x86/include/asm/mca.h
index eedbb6c..785a2a4 100644
--- a/arch/x86/include/asm/mca.h
+++ b/arch/x86/include/asm/mca.h
@@ -4,6 +4,9 @@
 #ifndef _ASM_X86_MCA_H
 #define _ASM_X86_MCA_H
 
+/* hook for the bus chain of the MCA NMI */
+extern void (*mca_nmi_hook)(void);
+
 /* Maximal number of MCA slots - actually, some machines have less, but
  * they all have sufficient number of POS registers to cover 8.
  */
diff --git a/arch/x86/kernel/mca_32.c b/arch/x86/kernel/mca_32.c
index 845d80c..4bb3cc9 100644
--- a/arch/x86/kernel/mca_32.c
+++ b/arch/x86/kernel/mca_32.c
@@ -466,6 +466,13 @@ static int __kprobes mca_handle_nmi_callback(struct device *dev, void *data)
 	return 0;
 }
 
+/*
+ *     The MCA (Microchannel Architecture) has an NMI chain for NMI sources
+ *     along the MCA bus.  Use this to hook into that chain if you will need
+ *     it.
+ */
+void (*mca_nmi_hook)(void) = NULL;
+
 void __kprobes mca_handle_nmi(void)
 {
 	/*
@@ -473,4 +480,9 @@ void __kprobes mca_handle_nmi(void)
 	 * adapter was responsible for the error.
 	 */
 	bus_for_each_dev(&mca_bus_type, NULL, NULL, mca_handle_nmi_callback);
+
+	if (mca_nmi_hook)
+		mca_nmi_hook();
+	else
+		pr_warning("NMI generated from unknown source!\n");
 }
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 03/13] [VOYAGER] x86: add prefill_possible_map to x86_quirks
  2009-03-08 16:48   ` [PATCH 02/13] [VOYAGER] x86/mca: make mca_nmi_hook external James Bottomley
@ 2009-03-08 16:48     ` James Bottomley
  2009-03-08 16:48       ` [PATCH 04/13] [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot processor James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

Voyager needs a different prefill of the possible map, so abstract the
operation through the x86 quirks mechanism.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/setup.h |    1 +
 arch/x86/kernel/setup.c      |    5 ++++-
 2 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 05c6f6b..7782327 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -31,6 +31,7 @@ struct x86_quirks {
 	void (*smp_read_mpc_oem)(struct mpc_oemtable *oemtable,
 				unsigned short oemsize);
 	int (*setup_ioapic_ids)(void);
+	void (*prefill_possible_map)(void);
 };
 
 extern void x86_quirk_pre_intr_init(void);
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 4c54bc0..797f7d7 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -937,7 +937,10 @@ void __init setup_arch(char **cmdline_p)
 		get_smp_config();
 #endif
 
-	prefill_possible_map();
+	if (x86_quirks->prefill_possible_map)
+		x86_quirks->prefill_possible_map();
+	else
+		prefill_possible_map();
 
 #ifdef CONFIG_X86_64
 	init_cpu_to_node();
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 04/13] [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot processor
  2009-03-08 16:48     ` [PATCH 03/13] [VOYAGER] x86: add prefill_possible_map to x86_quirks James Bottomley
@ 2009-03-08 16:48       ` James Bottomley
  2009-03-08 16:48         ` [PATCH 05/13] [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

The function smp_store_cpu_info() checks zero to see if it's
identifying a secondary.  It should check boot_cpu_id.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/kernel/smpboot.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index 249334f..070fa13 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -421,7 +421,7 @@ void __cpuinit smp_store_cpu_info(int id)
 
 	*c = boot_cpu_data;
 	c->cpu_index = id;
-	if (id != 0)
+	if (id != boot_cpu_id)
 		identify_secondary_cpu(c);
 	smp_apply_quirks(c);
 }
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 05/13] [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area
  2009-03-08 16:48       ` [PATCH 04/13] [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot processor James Bottomley
@ 2009-03-08 16:48         ` James Bottomley
  2009-03-08 16:48           ` [PATCH 06/13] [VOYAGER] x86: eliminate subarchitecture file setup_arch.h James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

For voyager to be detected in arbitrary configurations, it can no
longer hijack the apm_bios area and must have a bios area of its own,
which this patch implements.

Since the a20 test can't be done on voyager because of VIC
incompatibilities, the voyager detection must come first so the a20
test can do a runtime check of voyager presence.  The runtime check in
is_voyager() relies on boot_params, so move this outside of the _SETUP
include guard in asm/setup.h and remove the separate definition from
boot/boot.h.

Also added is an early printk if voyager is detected to aid in
debugging problems as they arise.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/boot/Makefile                |    4 +++-
 arch/x86/boot/a20.c                   |   13 +++++++------
 arch/x86/boot/boot.h                  |    2 +-
 arch/x86/boot/voyager.c               |    5 +++--
 arch/x86/include/asm/bootparam.h      |    5 ++++-
 arch/x86/include/asm/setup.h          |    4 ++--
 arch/x86/include/asm/voyager.h        |   13 +++----------
 arch/x86/include/asm/voyager_bios.h   |   21 +++++++++++++++++++++
 arch/x86/include/asm/voyager_boot.h   |   27 +++++++++++++++++++++++++++
 arch/x86/mach-voyager/voyager_basic.c |    2 +-
 10 files changed, 72 insertions(+), 24 deletions(-)
 create mode 100644 arch/x86/include/asm/voyager_bios.h
 create mode 100644 arch/x86/include/asm/voyager_boot.h

diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index cd48c72..7bc64fa 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -28,11 +28,13 @@ SVGA_MODE := -DSVGA_MODE=NORMAL_VGA
 targets		:= vmlinux.bin setup.bin setup.elf zImage bzImage
 subdir-		:= compressed
 
+# Voyager must come first because there's a condition in a20.c
+# that depends on voyager detection
+setup-$(CONFIG_X86_VOYAGER) += voyager.o
 setup-y		+= a20.o cmdline.o copy.o cpu.o cpucheck.o edd.o
 setup-y		+= header.o main.o mca.o memory.o pm.o pmjump.o
 setup-y		+= printf.o string.o tty.o video.o video-mode.o version.o
 setup-$(CONFIG_X86_APM_BOOT) += apm.o
-setup-$(CONFIG_X86_VOYAGER) += voyager.o
 
 # The link order of the video-*.o modules can matter.  In particular,
 # video-vga.o *must* be listed first, followed by video-vesa.o.
diff --git a/arch/x86/boot/a20.c b/arch/x86/boot/a20.c
index fba8e9c..ecd9561 100644
--- a/arch/x86/boot/a20.c
+++ b/arch/x86/boot/a20.c
@@ -126,11 +126,13 @@ static void enable_a20_fast(void)
 
 int enable_a20(void)
 {
-#ifdef CONFIG_X86_VOYAGER
-	/* On Voyager, a20_test() is unsafe? */
-	enable_a20_kbc();
-	return 0;
-#else
+	if (is_voyager()) {
+		/* On Voyager, a20_test() is unsafe becuase it pokes
+		 * about in areas that are VIC specific and causes
+		 * a crash */
+		enable_a20_kbc();
+		return 0;
+	}
        int loops = A20_ENABLE_LOOPS;
        int kbc_err;
 
@@ -164,5 +166,4 @@ int enable_a20(void)
        }
        
        return -1;
-#endif
 }
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index cc0ef13..d70323d 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -24,6 +24,7 @@
 #include <linux/edd.h>
 #include <asm/boot.h>
 #include <asm/setup.h>
+#include <asm/voyager_boot.h>
 #include "bitops.h"
 #include <asm/cpufeature.h>
 
@@ -33,7 +34,6 @@
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
 
 extern struct setup_header hdr;
-extern struct boot_params boot_params;
 
 /* Basic port I/O */
 static inline void outb(u8 v, u16 port)
diff --git a/arch/x86/boot/voyager.c b/arch/x86/boot/voyager.c
index 433909d..c599ff7 100644
--- a/arch/x86/boot/voyager.c
+++ b/arch/x86/boot/voyager.c
@@ -19,9 +19,9 @@ int query_voyager(void)
 	u8 err;
 	u16 es, di;
 	/* Abuse the apm_bios_info area for this */
-	u8 *data_ptr = (u8 *)&boot_params.apm_bios_info;
+	u8 *data_ptr = (u8 *)&boot_params.voyager_bios_info;
 
-	data_ptr[0] = 0xff;	/* Flag on config not found(?) */
+	data_ptr[0] = NOT_VOYAGER_BIOS_SIG;
 
 	asm("pushw %%es ; "
 	    "int $0x15 ; "
@@ -33,6 +33,7 @@ int query_voyager(void)
 
 	if (err)
 		return -1;	/* Not Voyager */
+	printf("Voyager detected\n");
 
 	set_fs(es);
 	copy_from_fs(data_ptr, di, 7);	/* Table is 7 bytes apparently */
diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
index 433adae..2a388a5 100644
--- a/arch/x86/include/asm/bootparam.h
+++ b/arch/x86/include/asm/bootparam.h
@@ -7,6 +7,7 @@
 #include <linux/edd.h>
 #include <asm/e820.h>
 #include <asm/ist.h>
+#include <asm/voyager_bios.h>
 #include <video/edid.h>
 
 /* setup data types */
@@ -105,7 +106,9 @@ struct boot_params {
 	struct e820entry e820_map[E820MAX];		/* 0x2d0 */
 	__u8  _pad8[48];				/* 0xcd0 */
 	struct edd_info eddbuf[EDDMAXNR];		/* 0xd00 */
-	__u8  _pad9[276];				/* 0xeec */
+	__u8  _pad9[20];				/* 0xeec */
+	struct voyager_bios_info voyager_bios_info;	/* 0xf00 */
+	__u8  _pad10[249];				/* 0xf07 */
 } __attribute__((packed));
 
 #endif /* _ASM_X86_BOOTPARAM_H */
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 7782327..8bbaffa 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -88,13 +88,13 @@ extern unsigned long saved_video_mode;
 #define paravirt_post_allocator_init()	do {} while (0)
 #endif
 
-#ifndef _SETUP
-
 /*
  * This is set up by the setup-routine at boot-time
  */
 extern struct boot_params boot_params;
 
+#ifndef _SETUP
+
 /*
  * Do NOT EVER look at the BIOS memory size location.
  * It does not work on many machines.
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h
index c1635d4..04fd0c9 100644
--- a/arch/x86/include/asm/voyager.h
+++ b/arch/x86/include/asm/voyager.h
@@ -4,6 +4,9 @@
  *
  * Standard include definitions for the NCR Voyager system */
 
+#include <asm/voyager_bios.h>
+#include <asm/voyager_boot.h>
+
 #undef	VOYAGER_DEBUG
 #undef	VOYAGER_CAT_DEBUG
 
@@ -305,16 +308,6 @@ typedef struct voyager_asic_data_table {
 
 
 
-struct voyager_bios_info {
-	__u8	len;
-	__u8	major;
-	__u8	minor;
-	__u8	debug;
-	__u8	num_classes;
-	__u8	class_1;
-	__u8	class_2;
-};
-
 /* The following structures and definitions are for the Kernel/SUS
  * interface these are needed to find out how SUS initialised any Quad
  * boards in the system */
diff --git a/arch/x86/include/asm/voyager_bios.h b/arch/x86/include/asm/voyager_bios.h
new file mode 100644
index 0000000..37b18ec
--- /dev/null
+++ b/arch/x86/include/asm/voyager_bios.h
@@ -0,0 +1,21 @@
+/*
+ * This file is designed to be included in the boot system
+ * so must be as minimal as possible
+ */
+#ifndef _ASM_VOYAGER_BIOS_H
+#define _ASM_VOYAGER_BIOS_H
+
+/* non voyager signature in the len field (voyager bios length is small) */
+#define NOT_VOYAGER_BIOS_SIG	0xff
+
+struct voyager_bios_info {
+	__u8	len;
+	__u8	major;
+	__u8	minor;
+	__u8	debug;
+	__u8	num_classes;
+	__u8	class_1;
+	__u8	class_2;
+};
+
+#endif /* _ASM_VOYAGER_BIOS_H */
diff --git a/arch/x86/include/asm/voyager_boot.h b/arch/x86/include/asm/voyager_boot.h
new file mode 100644
index 0000000..20656b7
--- /dev/null
+++ b/arch/x86/include/asm/voyager_boot.h
@@ -0,0 +1,27 @@
+/*
+ * This file is designed to be included in the boot system
+ * so must be as minimal as possible
+ */
+#ifndef _ASM_VOYAGER_BOOT_H
+#define _ASM_VOYAGER_BOOT_H
+
+#include <asm/setup.h>
+#include <asm/voyager_bios.h>
+
+#ifdef CONFIG_X86_VOYAGER
+
+static inline int is_voyager(void)
+{
+	return boot_params.voyager_bios_info.len != NOT_VOYAGER_BIOS_SIG;
+}
+
+#else
+
+static inline int is_voyager(void)
+{
+	return 0;
+}
+
+#endif /* CONFIG_X86_VOYAGER */
+
+#endif
diff --git a/arch/x86/mach-voyager/voyager_basic.c b/arch/x86/mach-voyager/voyager_basic.c
index 46d6f80..7581b5f 100644
--- a/arch/x86/mach-voyager/voyager_basic.c
+++ b/arch/x86/mach-voyager/voyager_basic.c
@@ -56,7 +56,7 @@ static struct sysrq_key_op sysrq_voyager_dump_op = {
 
 void voyager_detect(struct voyager_bios_info *bios)
 {
-	if (bios->len != 0xff) {
+	if (bios->len != NOT_VOYAGER_BIOS_SIG) {
 		int class = (bios->class_1 << 8)
 		    | (bios->class_2 & 0xff);
 
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 06/13] [VOYAGER] x86: eliminate subarchitecture file setup_arch.h
  2009-03-08 16:48         ` [PATCH 05/13] [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area James Bottomley
@ 2009-03-08 16:48           ` James Bottomley
  2009-03-08 16:48             ` [PATCH 07/13] [VOYAGER] x86: eliminate subarchitecture file entry_arch.h James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

This serves no purpose any longer since voyager will reappear as an
explicit quirk function call instead of via the ARCH_SETUP code
insertion.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/mach-voyager/setup_arch.h |   12 ------------
 arch/x86/include/asm/setup_arch.h              |    3 ---
 arch/x86/kernel/probe_roms_32.c                |    1 -
 arch/x86/kernel/setup.c                        |    7 -------
 4 files changed, 0 insertions(+), 23 deletions(-)
 delete mode 100644 arch/x86/include/asm/mach-voyager/setup_arch.h
 delete mode 100644 arch/x86/include/asm/setup_arch.h

diff --git a/arch/x86/include/asm/mach-voyager/setup_arch.h b/arch/x86/include/asm/mach-voyager/setup_arch.h
deleted file mode 100644
index 71729ca..0000000
--- a/arch/x86/include/asm/mach-voyager/setup_arch.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#include <asm/voyager.h>
-#include <asm/setup.h>
-#define VOYAGER_BIOS_INFO ((struct voyager_bios_info *) \
-			(&boot_params.apm_bios_info))
-
-/* Hook to call BIOS initialisation function */
-
-/* for voyager, pass the voyager BIOS/SUS info area to the detection
- * routines */
-
-#define ARCH_SETUP	voyager_detect(VOYAGER_BIOS_INFO);
-
diff --git a/arch/x86/include/asm/setup_arch.h b/arch/x86/include/asm/setup_arch.h
deleted file mode 100644
index 3884620..0000000
--- a/arch/x86/include/asm/setup_arch.h
+++ /dev/null
@@ -1,3 +0,0 @@
-/* Hook to call BIOS initialisation function */
-
-/* no action for generic */
diff --git a/arch/x86/kernel/probe_roms_32.c b/arch/x86/kernel/probe_roms_32.c
index 071e7fe..d683a43 100644
--- a/arch/x86/kernel/probe_roms_32.c
+++ b/arch/x86/kernel/probe_roms_32.c
@@ -18,7 +18,6 @@
 #include <asm/setup.h>
 #include <asm/sections.h>
 #include <asm/io.h>
-#include <asm/setup_arch.h>
 
 static struct resource system_rom_resource = {
 	.name	= "System ROM",
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 797f7d7..7f5d968 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -82,7 +82,6 @@
 #include <asm/io_apic.h>
 #include <asm/ist.h>
 #include <asm/vmi.h>
-#include <asm/setup_arch.h>
 #include <asm/bios_ebda.h>
 #include <asm/cacheflush.h>
 #include <asm/processor.h>
@@ -108,10 +107,6 @@
 #include <asm/numa_64.h>
 #endif
 
-#ifndef ARCH_SETUP
-#define ARCH_SETUP
-#endif
-
 unsigned int boot_cpu_id __read_mostly;
 
 #ifdef CONFIG_X86_64
@@ -701,8 +696,6 @@ void __init setup_arch(char **cmdline_p)
 	}
 #endif
 
-	ARCH_SETUP
-
 	setup_memory_map();
 	parse_setup_data();
 	/* update the e820_saved too */
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 07/13] [VOYAGER] x86: eliminate subarchitecture file entry_arch.h
  2009-03-08 16:48           ` [PATCH 06/13] [VOYAGER] x86: eliminate subarchitecture file setup_arch.h James Bottomley
@ 2009-03-08 16:48             ` James Bottomley
  2009-03-08 16:48               ` [PATCH 08/13] [VOYAGER] x86: eliminate subarchitecture file do_timer.h James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

This was a subarchitecture file designed to customise the vector gate
building functions.  Since only voyager and the standard PC
subarchitectures now have a copy, they can both be merged into
entry_32.S surrounded by the appropriate ifdefs.

As part of this reorganisation, split the voyager interrupt vectors
out into a separate include file (asm/voyager_vectors.h) that can be
included into a .S file rather than hacking voyager.h up to include
the appropriate _ASSEMBLY_ gates.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/entry_arch.h              |   57 -------------------
 arch/x86/include/asm/hw_irq.h                  |   11 ++++
 arch/x86/include/asm/mach-voyager/entry_arch.h |   26 ---------
 arch/x86/include/asm/voyager.h                 |   34 +-----------
 arch/x86/include/asm/voyager_vectors.h         |   37 +++++++++++++
 arch/x86/kernel/entry_32.S                     |   70 +++++++++++++++++++++++-
 6 files changed, 117 insertions(+), 118 deletions(-)
 delete mode 100644 arch/x86/include/asm/entry_arch.h
 delete mode 100644 arch/x86/include/asm/mach-voyager/entry_arch.h
 create mode 100644 arch/x86/include/asm/voyager_vectors.h

diff --git a/arch/x86/include/asm/entry_arch.h b/arch/x86/include/asm/entry_arch.h
deleted file mode 100644
index 854d538..0000000
--- a/arch/x86/include/asm/entry_arch.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is designed to contain the BUILD_INTERRUPT specifications for
- * all of the extra named interrupt vectors used by the architecture.
- * Usually this is the Inter Process Interrupts (IPIs)
- */
-
-/*
- * The following vectors are part of the Linux architecture, there
- * is no hardware IRQ pin equivalent for them, they are triggered
- * through the ICC by us (IPIs)
- */
-#ifdef CONFIG_SMP
-BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
-BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
-BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
-BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR)
-
-BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6,
-		 smp_invalidate_interrupt)
-BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7,
-		 smp_invalidate_interrupt)
-#endif
-
-/*
- * every pentium local APIC has two 'local interrupts', with a
- * soft-definable vector attached to both interrupts, one of
- * which is a timer interrupt, the other one is error counter
- * overflow. Linux uses the local APIC timer interrupt to get
- * a much simpler SMP time architecture:
- */
-#ifdef CONFIG_X86_LOCAL_APIC
-
-BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR)
-BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR)
-BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR)
-
-#ifdef CONFIG_PERF_COUNTERS
-BUILD_INTERRUPT(perf_counter_interrupt, LOCAL_PERF_VECTOR)
-#endif
-
-#ifdef CONFIG_X86_MCE_P4THERMAL
-BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR)
-#endif
-
-#endif
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 370e1c8..bef2e94 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -74,6 +74,17 @@ extern atomic_t irq_mis_count;
 /* EISA */
 extern void eisa_set_level_irq(unsigned int irq);
 
+/* Voyager functions */
+extern asmlinkage void vic_cpi_interrupt(void);
+extern asmlinkage void vic_sys_interrupt(void);
+extern asmlinkage void vic_cmn_interrupt(void);
+extern asmlinkage void qic_timer_interrupt(void);
+extern asmlinkage void qic_invalidate_interrupt(void);
+extern asmlinkage void qic_reschedule_interrupt(void);
+extern asmlinkage void qic_enable_irq_interrupt(void);
+extern asmlinkage void qic_call_function_interrupt(void);
+extern asmlinkage void qic_call_function_single_interrupt(void);
+
 /* SMP */
 extern void smp_apic_timer_interrupt(struct pt_regs *);
 extern void smp_spurious_interrupt(struct pt_regs *);
diff --git a/arch/x86/include/asm/mach-voyager/entry_arch.h b/arch/x86/include/asm/mach-voyager/entry_arch.h
deleted file mode 100644
index ae52624..0000000
--- a/arch/x86/include/asm/mach-voyager/entry_arch.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- mode: c; c-basic-offset: 8 -*- */
-
-/* Copyright (C) 2002
- *
- * Author: James.Bottomley@HansenPartnership.com
- *
- * linux/arch/i386/voyager/entry_arch.h
- *
- * This file builds the VIC and QIC CPI gates
- */
-
-/* initialise the voyager interrupt gates 
- *
- * This uses the macros in irq.h to set up assembly jump gates.  The
- * calls are then redirected to the same routine with smp_ prefixed */
-BUILD_INTERRUPT(vic_sys_interrupt, VIC_SYS_INT)
-BUILD_INTERRUPT(vic_cmn_interrupt, VIC_CMN_INT)
-BUILD_INTERRUPT(vic_cpi_interrupt, VIC_CPI_LEVEL0);
-
-/* do all the QIC interrupts */
-BUILD_INTERRUPT(qic_timer_interrupt, QIC_TIMER_CPI);
-BUILD_INTERRUPT(qic_invalidate_interrupt, QIC_INVALIDATE_CPI);
-BUILD_INTERRUPT(qic_reschedule_interrupt, QIC_RESCHEDULE_CPI);
-BUILD_INTERRUPT(qic_enable_irq_interrupt, QIC_ENABLE_IRQ_CPI);
-BUILD_INTERRUPT(qic_call_function_interrupt, QIC_CALL_FUNCTION_CPI);
-BUILD_INTERRUPT(qic_call_function_single_interrupt, QIC_CALL_FUNCTION_SINGLE_CPI);
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h
index 04fd0c9..c03a6aa 100644
--- a/arch/x86/include/asm/voyager.h
+++ b/arch/x86/include/asm/voyager.h
@@ -6,6 +6,7 @@
 
 #include <asm/voyager_bios.h>
 #include <asm/voyager_boot.h>
+#include <asm/voyager_vectors.h>
 
 #undef	VOYAGER_DEBUG
 #undef	VOYAGER_CAT_DEBUG
@@ -521,39 +522,6 @@ extern void voyager_smp_intr_init(void);
 #define VOYAGER_PSI_SUBWRITE	3
 extern void voyager_cat_psi(__u8, __u16, __u8 *);
 
-/* These define the CPIs we use in linux */
-#define VIC_CPI_LEVEL0			0
-#define VIC_CPI_LEVEL1			1
-/* now the fake CPIs */
-#define VIC_TIMER_CPI			2
-#define VIC_INVALIDATE_CPI		3
-#define VIC_RESCHEDULE_CPI		4
-#define VIC_ENABLE_IRQ_CPI		5
-#define VIC_CALL_FUNCTION_CPI		6
-#define VIC_CALL_FUNCTION_SINGLE_CPI	7
-
-/* Now the QIC CPIs:  Since we don't need the two initial levels,
- * these are 2 less than the VIC CPIs */
-#define QIC_CPI_OFFSET			1
-#define QIC_TIMER_CPI			(VIC_TIMER_CPI - QIC_CPI_OFFSET)
-#define QIC_INVALIDATE_CPI		(VIC_INVALIDATE_CPI - QIC_CPI_OFFSET)
-#define QIC_RESCHEDULE_CPI		(VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET)
-#define QIC_ENABLE_IRQ_CPI		(VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET)
-#define QIC_CALL_FUNCTION_CPI		(VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET)
-#define QIC_CALL_FUNCTION_SINGLE_CPI	(VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET)
-
-#define VIC_START_FAKE_CPI		VIC_TIMER_CPI
-#define VIC_END_FAKE_CPI		VIC_CALL_FUNCTION_SINGLE_CPI
-
-/* this is the SYS_INT CPI. */
-#define VIC_SYS_INT			8
-#define VIC_CMN_INT			15
-
-/* This is the boot CPI for alternate processors.  It gets overwritten
- * by the above once the system has activated all available processors */
-#define VIC_CPU_BOOT_CPI		VIC_CPI_LEVEL0
-#define VIC_CPU_BOOT_ERRATA_CPI		(VIC_CPI_LEVEL0 + 8)
-
 extern asmlinkage void vic_cpi_interrupt(void);
 extern asmlinkage void vic_sys_interrupt(void);
 extern asmlinkage void vic_cmn_interrupt(void);
diff --git a/arch/x86/include/asm/voyager_vectors.h b/arch/x86/include/asm/voyager_vectors.h
new file mode 100644
index 0000000..bd6c87b
--- /dev/null
+++ b/arch/x86/include/asm/voyager_vectors.h
@@ -0,0 +1,37 @@
+#ifndef _ASM_VOYAGER_VECTORS_H
+#define _ASM_VOYAGER_VECTORS_H
+
+/* These define the CPIs we use in linux */
+#define VIC_CPI_LEVEL0			0
+#define VIC_CPI_LEVEL1			1
+/* now the fake CPIs */
+#define VIC_TIMER_CPI			2
+#define VIC_INVALIDATE_CPI		3
+#define VIC_RESCHEDULE_CPI		4
+#define VIC_ENABLE_IRQ_CPI		5
+#define VIC_CALL_FUNCTION_CPI		6
+#define VIC_CALL_FUNCTION_SINGLE_CPI	7
+
+/* Now the QIC CPIs:  Since we don't need the two initial levels,
+ * these are 2 less than the VIC CPIs */
+#define QIC_CPI_OFFSET			1
+#define QIC_TIMER_CPI			(VIC_TIMER_CPI - QIC_CPI_OFFSET)
+#define QIC_INVALIDATE_CPI		(VIC_INVALIDATE_CPI - QIC_CPI_OFFSET)
+#define QIC_RESCHEDULE_CPI		(VIC_RESCHEDULE_CPI - QIC_CPI_OFFSET)
+#define QIC_ENABLE_IRQ_CPI		(VIC_ENABLE_IRQ_CPI - QIC_CPI_OFFSET)
+#define QIC_CALL_FUNCTION_CPI		(VIC_CALL_FUNCTION_CPI - QIC_CPI_OFFSET)
+#define QIC_CALL_FUNCTION_SINGLE_CPI	(VIC_CALL_FUNCTION_SINGLE_CPI - QIC_CPI_OFFSET)
+
+#define VIC_START_FAKE_CPI		VIC_TIMER_CPI
+#define VIC_END_FAKE_CPI		VIC_CALL_FUNCTION_SINGLE_CPI
+
+/* this is the SYS_INT CPI. */
+#define VIC_SYS_INT			8
+#define VIC_CMN_INT			15
+
+/* This is the boot CPI for alternate processors.  It gets overwritten
+ * by the above once the system has activated all available processors */
+#define VIC_CPU_BOOT_CPI		VIC_CPI_LEVEL0
+#define VIC_CPU_BOOT_ERRATA_CPI		(VIC_CPI_LEVEL0 + 8)
+
+#endif
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index 899e893..8107870 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -54,6 +54,7 @@
 #include <asm/processor-flags.h>
 #include <asm/ftrace.h>
 #include <asm/irq_vectors.h>
+#include <asm/voyager_vectors.h>
 
 /* Avoid __ASSEMBLER__'ifying <linux/audit.h> just for this.  */
 #include <linux/elf-em.h>
@@ -811,8 +812,73 @@ ENDPROC(name)
 
 #define BUILD_INTERRUPT(name, nr)	BUILD_INTERRUPT3(name, nr, smp_##name)
 
-/* The include is where all of the SMP etc. interrupts come from */
-#include <asm/entry_arch.h>
+/*
+ * The following vectors are part of the Linux architecture, there
+ * is no hardware IRQ pin equivalent for them, they are triggered
+ * through the ICC by us (IPIs)
+ */
+#ifdef CONFIG_SMP
+BUILD_INTERRUPT(reschedule_interrupt,RESCHEDULE_VECTOR)
+BUILD_INTERRUPT(call_function_interrupt,CALL_FUNCTION_VECTOR)
+BUILD_INTERRUPT(call_function_single_interrupt,CALL_FUNCTION_SINGLE_VECTOR)
+BUILD_INTERRUPT(irq_move_cleanup_interrupt,IRQ_MOVE_CLEANUP_VECTOR)
+
+BUILD_INTERRUPT3(invalidate_interrupt0,INVALIDATE_TLB_VECTOR_START+0,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt1,INVALIDATE_TLB_VECTOR_START+1,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt2,INVALIDATE_TLB_VECTOR_START+2,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt3,INVALIDATE_TLB_VECTOR_START+3,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt4,INVALIDATE_TLB_VECTOR_START+4,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt5,INVALIDATE_TLB_VECTOR_START+5,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt6,INVALIDATE_TLB_VECTOR_START+6,
+		 smp_invalidate_interrupt)
+BUILD_INTERRUPT3(invalidate_interrupt7,INVALIDATE_TLB_VECTOR_START+7,
+		 smp_invalidate_interrupt)
+#endif
+
+/*
+ * every pentium local APIC has two 'local interrupts', with a
+ * soft-definable vector attached to both interrupts, one of
+ * which is a timer interrupt, the other one is error counter
+ * overflow. Linux uses the local APIC timer interrupt to get
+ * a much simpler SMP time architecture:
+ */
+#ifdef CONFIG_X86_LOCAL_APIC
+
+BUILD_INTERRUPT(apic_timer_interrupt,LOCAL_TIMER_VECTOR)
+BUILD_INTERRUPT(error_interrupt,ERROR_APIC_VECTOR)
+BUILD_INTERRUPT(spurious_interrupt,SPURIOUS_APIC_VECTOR)
+
+#ifdef CONFIG_PERF_COUNTERS
+BUILD_INTERRUPT(perf_counter_interrupt, LOCAL_PERF_VECTOR)
+#endif
+
+#ifdef CONFIG_X86_MCE_P4THERMAL
+BUILD_INTERRUPT(thermal_interrupt,THERMAL_APIC_VECTOR)
+#endif
+
+#if defined(CONFIG_X86_VOYAGER) && defined(CONFIG_SMP)
+BUILD_INTERRUPT(vic_sys_interrupt, VIC_SYS_INT)
+BUILD_INTERRUPT(vic_cmn_interrupt, VIC_CMN_INT)
+BUILD_INTERRUPT(vic_cpi_interrupt, VIC_CPI_LEVEL0);
+
+/* do all the QIC interrupts */
+BUILD_INTERRUPT(qic_timer_interrupt, QIC_TIMER_CPI);
+BUILD_INTERRUPT(qic_invalidate_interrupt, QIC_INVALIDATE_CPI);
+BUILD_INTERRUPT(qic_reschedule_interrupt, QIC_RESCHEDULE_CPI);
+BUILD_INTERRUPT(qic_enable_irq_interrupt, QIC_ENABLE_IRQ_CPI);
+BUILD_INTERRUPT(qic_call_function_interrupt, QIC_CALL_FUNCTION_CPI);
+BUILD_INTERRUPT(qic_call_function_single_interrupt,
+		 QIC_CALL_FUNCTION_SINGLE_CPI);
+#endif
+
+#endif
+
 
 ENTRY(coprocessor_error)
 	RING0_INT_FRAME
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 08/13] [VOYAGER] x86: eliminate subarchitecture file do_timer.h
  2009-03-08 16:48             ` [PATCH 07/13] [VOYAGER] x86: eliminate subarchitecture file entry_arch.h James Bottomley
@ 2009-03-08 16:48               ` James Bottomley
  2009-03-08 16:48                 ` [PATCH 09/13] [VOYAGER] x86: redo irq2 cascade setup James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

This one's a bit complex: voyager still needs a timer interrupt hook
because it doesn't have local apic timers and the scheduler relies on
each CPU ticking, so voyager must rebroadcast the pit clock.

Pull in the standard do_timer.h to time_32.c: all it was doing was
calling the global_clock_event event_handler.  However, also add a
specific voyager hook: voyager_timer_interrupt().

Hedge the asm/voyager.h file around with proper include guards and
make sure voyager_timer_interrupt() is inline empty if
CONFIG_X86_VOYAGER isn't defined.  Also add an is_voyager() check to
terminate the voyager_timer_interrupt() hook in case voyager is
compiled in but booted on a non-voayger architecture.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/do_timer.h              |   16 ----------------
 arch/x86/include/asm/mach-voyager/do_timer.h |   17 -----------------
 arch/x86/include/asm/voyager.h               |   14 ++++++++++++++
 arch/x86/kernel/time_32.c                    |   11 +++++++----
 arch/x86/mach-voyager/voyager_basic.c        |    3 +++
 5 files changed, 24 insertions(+), 37 deletions(-)
 delete mode 100644 arch/x86/include/asm/do_timer.h
 delete mode 100644 arch/x86/include/asm/mach-voyager/do_timer.h

diff --git a/arch/x86/include/asm/do_timer.h b/arch/x86/include/asm/do_timer.h
deleted file mode 100644
index 23ecda0..0000000
--- a/arch/x86/include/asm/do_timer.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* defines for inline arch setup functions */
-#include <linux/clockchips.h>
-
-#include <asm/i8259.h>
-#include <asm/i8253.h>
-
-/**
- * do_timer_interrupt_hook - hook into timer tick
- *
- * Call the pit clock event handler. see asm/i8253.h
- **/
-
-static inline void do_timer_interrupt_hook(void)
-{
-	global_clock_event->event_handler(global_clock_event);
-}
diff --git a/arch/x86/include/asm/mach-voyager/do_timer.h b/arch/x86/include/asm/mach-voyager/do_timer.h
deleted file mode 100644
index 9e5a459..0000000
--- a/arch/x86/include/asm/mach-voyager/do_timer.h
+++ /dev/null
@@ -1,17 +0,0 @@
-/* defines for inline arch setup functions */
-#include <linux/clockchips.h>
-
-#include <asm/voyager.h>
-#include <asm/i8253.h>
-
-/**
- * do_timer_interrupt_hook - hook into timer tick
- *
- * Call the pit clock event handler. see asm/i8253.h
- **/
-static inline void do_timer_interrupt_hook(void)
-{
-	global_clock_event->event_handler(global_clock_event);
-	voyager_timer_interrupt();
-}
-
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h
index c03a6aa..b38a241 100644
--- a/arch/x86/include/asm/voyager.h
+++ b/arch/x86/include/asm/voyager.h
@@ -3,11 +3,15 @@
  * Author: J.E.J.Bottomley@HansenPartnership.com
  *
  * Standard include definitions for the NCR Voyager system */
+#ifndef _ASM_VOYAGER_H
+#define _ASM_VOYAGER_H
 
 #include <asm/voyager_bios.h>
 #include <asm/voyager_boot.h>
 #include <asm/voyager_vectors.h>
 
+#ifdef CONFIG_X86_VOYAGER
+
 #undef	VOYAGER_DEBUG
 #undef	VOYAGER_CAT_DEBUG
 
@@ -530,3 +534,13 @@ extern asmlinkage void qic_invalidate_interrupt(void);
 extern asmlinkage void qic_reschedule_interrupt(void);
 extern asmlinkage void qic_enable_irq_interrupt(void);
 extern asmlinkage void qic_call_function_interrupt(void);
+
+#else /* CONFIG_X86_VOYAGER */
+
+static inline void voyager_timer_interrupt(void)
+{
+}
+
+#endif /* CONFIG_X86_VOYAGER */
+
+#endif
diff --git a/arch/x86/kernel/time_32.c b/arch/x86/kernel/time_32.c
index 5c5d87f..dcbe82a 100644
--- a/arch/x86/kernel/time_32.c
+++ b/arch/x86/kernel/time_32.c
@@ -28,6 +28,7 @@
  *	serialize accesses to xtime/lost_ticks).
  */
 
+#include <linux/clockchips.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/time.h>
@@ -37,8 +38,9 @@
 #include <asm/hpet.h>
 #include <asm/time.h>
 #include <asm/timer.h>
-
-#include <asm/do_timer.h>
+#include <asm/i8253.h>
+#include <asm/i8259.h>
+#include <asm/voyager.h>
 
 int timer_ack;
 
@@ -91,8 +93,9 @@ irqreturn_t timer_interrupt(int irq, void *dev_id)
 		spin_unlock(&i8259A_lock);
 	}
 #endif
-
-	do_timer_interrupt_hook();
+	if (global_clock_event->event_handler)
+		global_clock_event->event_handler(global_clock_event);
+	voyager_timer_interrupt();
 
 #ifdef CONFIG_MCA
 	if (MCA_bus) {
diff --git a/arch/x86/mach-voyager/voyager_basic.c b/arch/x86/mach-voyager/voyager_basic.c
index 7581b5f..7c97c9a 100644
--- a/arch/x86/mach-voyager/voyager_basic.c
+++ b/arch/x86/mach-voyager/voyager_basic.c
@@ -161,6 +161,9 @@ int __init voyager_memory_detect(int region, __u32 * start, __u32 * length)
  * internal timer (The QIC does, but that's another story). */
 void voyager_timer_interrupt(void)
 {
+	if (!is_voyager())
+		return;
+
 	if ((jiffies & 0x3ff) == 0) {
 
 		/* There seems to be something flaky in either
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 09/13] [VOYAGER] x86: redo irq2 cascade setup
  2009-03-08 16:48               ` [PATCH 08/13] [VOYAGER] x86: eliminate subarchitecture file do_timer.h James Bottomley
@ 2009-03-08 16:48                 ` James Bottomley
  2009-03-08 16:48                   ` [PATCH 10/13] [VOYAGER] x86: make disabling the apics functional instead of a flag James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

The cascade setup really needs to be done as part of the
arch_intr_init() because you might need the machine vectors all
plumbed in before you set up the cascade.

Fix this by moving the current check in irqinit_32.c to the correct
place and also directly calling the x86_quirk hook from there.  Tidy
up visws (and eventually voyager) which do their own irq2
initialisation but which could quite easily use the generic one.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/setup.h   |    1 -
 arch/x86/kernel/irqinit_32.c   |   15 +++++++++------
 arch/x86/kernel/setup.c        |   17 -----------------
 arch/x86/kernel/visws_quirks.c |    7 -------
 arch/x86/mach-voyager/setup.c  |   11 -----------
 5 files changed, 9 insertions(+), 42 deletions(-)

diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 8bbaffa..ab0fa26 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -35,7 +35,6 @@ struct x86_quirks {
 };
 
 extern void x86_quirk_pre_intr_init(void);
-extern void x86_quirk_intr_init(void);
 
 extern void x86_quirk_trap_init(void);
 
diff --git a/arch/x86/kernel/irqinit_32.c b/arch/x86/kernel/irqinit_32.c
index 50b8c3a..0374593 100644
--- a/arch/x86/kernel/irqinit_32.c
+++ b/arch/x86/kernel/irqinit_32.c
@@ -185,14 +185,17 @@ void __init native_init_IRQ(void)
 	alloc_intr_gate(THERMAL_APIC_VECTOR, thermal_interrupt);
 #endif
 
-	if (!acpi_ioapic)
-		setup_irq(2, &irq2);
-
 	/*
-	 * Call quirks after call gates are initialised (usually add in
-	 * the architecture specific gates):
+	 * setup after call gates are initialised (usually add in the
+	 * architecture specific gates).  Populating the
+	 * arch_intr_init x86_quirk allows final gate setup.  If the
+	 * quirk returns true, the cascade interrupt will not be setup
+	 * unless acpi_ioapic is zero
 	 */
-	x86_quirk_intr_init();
+
+	if ((x86_quirks->arch_intr_init && !x86_quirks->arch_intr_init()) ||
+	    (!x86_quirks->arch_intr_init && !acpi_ioapic))
+		setup_irq(2, &irq2);
 
 	/*
 	 * External FPU? Set up irq13 if so, for
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 7f5d968..bae35f9 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -988,23 +988,6 @@ void __init x86_quirk_pre_intr_init(void)
 }
 
 /**
- * x86_quirk_intr_init - post gate setup interrupt initialisation
- *
- * Description:
- *	Fill in any interrupts that may have been left out by the general
- *	init_IRQ() routine.  interrupts having to do with the machine rather
- *	than the devices on the I/O bus (like APIC interrupts in intel MP
- *	systems) are started here.
- **/
-void __init x86_quirk_intr_init(void)
-{
-	if (x86_quirks->arch_intr_init) {
-		if (x86_quirks->arch_intr_init())
-			return;
-	}
-}
-
-/**
  * x86_quirk_trap_init - initialise system specific traps
  *
  * Description:
diff --git a/arch/x86/kernel/visws_quirks.c b/arch/x86/kernel/visws_quirks.c
index 191a876..d808bd5 100644
--- a/arch/x86/kernel/visws_quirks.c
+++ b/arch/x86/kernel/visws_quirks.c
@@ -645,12 +645,6 @@ static struct irqaction master_action = {
 	.name =		"PIIX4-8259",
 };
 
-static struct irqaction cascade_action = {
-	.handler = 	no_action,
-	.name =		"cascade",
-};
-
-
 void init_VISWS_APIC_irqs(void)
 {
 	int i;
@@ -683,5 +677,4 @@ void init_VISWS_APIC_irqs(void)
 	}
 
 	setup_irq(CO_IRQ_8259, &master_action);
-	setup_irq(2, &cascade_action);
 }
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index 88c3c55..e4516a8 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -16,22 +16,11 @@ void __init pre_intr_init_hook(void)
 	init_ISA_irqs();
 }
 
-/*
- * IRQ2 is cascade interrupt to second interrupt controller
- */
-static struct irqaction irq2 = {
-	.handler = no_action,
-	.mask = CPU_MASK_NONE,
-	.name = "cascade",
-};
-
 void __init intr_init_hook(void)
 {
 #ifdef CONFIG_SMP
 	voyager_smp_intr_init();
 #endif
-
-	setup_irq(2, &irq2);
 }
 
 static void voyager_disable_tsc(void)
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 10/13] [VOYAGER] x86: make disabling the apics functional instead of a flag
  2009-03-08 16:48                 ` [PATCH 09/13] [VOYAGER] x86: redo irq2 cascade setup James Bottomley
@ 2009-03-08 16:48                   ` James Bottomley
  2009-03-08 16:48                     ` [PATCH 11/13] [VOYAGER] x86/Voyager: add missing QIC call function single gate James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

This allows the elimination of some ifdef guards in setup.c.
Additionally probe_32.c doesn't need to run through the apics in
generic_apic_probe() if they're disabled.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/include/asm/apic.h     |    6 ++++++
 arch/x86/kernel/apic/apic.c     |    3 +++
 arch/x86/kernel/apic/probe_32.c |    3 +++
 arch/x86/kernel/setup.c         |    4 +---
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 4ef949c..930ebf5 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -230,12 +230,18 @@ static inline int apic_is_clustered_box(void)
 extern u8 setup_APIC_eilvt_mce(u8 vector, u8 msg_type, u8 mask);
 extern u8 setup_APIC_eilvt_ibs(u8 vector, u8 msg_type, u8 mask);
 
+static inline void disable_APIC(void)
+{
+	disable_local_APIC();
+	disable_apic = 1;
+}
 
 #else /* !CONFIG_X86_LOCAL_APIC */
 static inline void lapic_shutdown(void) { }
 #define local_apic_timer_c2_ok		1
 static inline void init_apic_mappings(void) { }
 static inline void disable_local_APIC(void) { }
+static inline void disable_APIC(void) { }
 
 #endif /* !CONFIG_X86_LOCAL_APIC */
 
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index ee68005..cb6e5b8 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1508,6 +1508,9 @@ void __init early_init_lapic_mapping(void)
  */
 void __init init_apic_mappings(void)
 {
+	if (disable_apic)
+		return;
+
 #ifdef CONFIG_X86_X2APIC
 	if (x2apic) {
 		boot_cpu_physical_apicid = read_apic_id();
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index 141c99a..770b5c4 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -225,6 +225,9 @@ void __init generic_bigsmp_probe(void)
 
 void __init generic_apic_probe(void)
 {
+	if (disable_apic)
+		return;
+
 	if (!cmdline_apic) {
 		int i;
 		for (i = 0; apic_probe[i]; i++) {
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index bae35f9..62e9f59 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -750,9 +750,7 @@ void __init setup_arch(char **cmdline_p)
 	reserve_early_setup_data();
 
 	if (acpi_mps_check()) {
-#ifdef CONFIG_X86_LOCAL_APIC
-		disable_apic = 1;
-#endif
+		disable_APIC();
 		setup_clear_cpu_cap(X86_FEATURE_APIC);
 	}
 
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 11/13] [VOYAGER] x86/Voyager: add missing QIC call function single gate
  2009-03-08 16:48                   ` [PATCH 10/13] [VOYAGER] x86: make disabling the apics functional instead of a flag James Bottomley
@ 2009-03-08 16:48                     ` James Bottomley
  2009-03-08 16:48                       ` [PATCH 12/13] [VOYAGER] x86/Voyager: replace inline io area reads with readX accessors James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

Apparently this was never plugged into the QIC (it was plugged into
the VIC).  The lack was detected during testing of smp_call_function()
based flushing.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/mach-voyager/voyager_smp.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 98e3c2b..84d1d7f 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -1266,6 +1266,8 @@ void __init voyager_smp_intr_init(void)
 	QIC_SET_GATE(QIC_RESCHEDULE_CPI, qic_reschedule_interrupt);
 	QIC_SET_GATE(QIC_ENABLE_IRQ_CPI, qic_enable_irq_interrupt);
 	QIC_SET_GATE(QIC_CALL_FUNCTION_CPI, qic_call_function_interrupt);
+	QIC_SET_GATE(QIC_CALL_FUNCTION_SINGLE_CPI,
+		     qic_call_function_single_interrupt);
 
 	/* now put the VIC descriptor into the first 48 IRQs
 	 *
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 12/13] [VOYAGER] x86/Voyager: replace inline io area reads with readX accessors
  2009-03-08 16:48                     ` [PATCH 11/13] [VOYAGER] x86/Voyager: add missing QIC call function single gate James Bottomley
@ 2009-03-08 16:48                       ` James Bottomley
  2009-03-08 16:48                         ` [PATCH 13/13] [VOYAGER] x86/Voyager: Plumb voyager back into the build James Bottomley
  0 siblings, 1 reply; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

Some of the memory manipulations done to reset QIC CPIs and to check
on booted processors rely on the read actually being issued.  With
newer versions of gcc this is no longer happening (presumably it sees
the read with no effect and optimises it away).  Replace the reads
with readX to assure volatile semantics for issuing the access.  This
fixes a bug where QIC based voyagers won't boot with certain versions
of gcc.

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/mach-voyager/voyager_smp.c |   22 ++++++----------------
 1 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index 84d1d7f..d7c2a6a 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -70,7 +70,7 @@ cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
 /* The internal functions */
 static void send_CPI(__u32 cpuset, __u8 cpi);
 static void ack_CPI(__u8 cpi);
-static int ack_QIC_CPI(__u8 cpi);
+static inline void ack_QIC_CPI(__u8 cpi);
 static void ack_special_QIC_CPI(__u8 cpi);
 static void ack_VIC_CPI(__u8 cpi);
 static void send_CPI_allbutself(__u8 cpi);
@@ -433,14 +433,9 @@ static void __init start_secondary(void *unused)
 
 	qic_setup();
 
-	if (is_cpu_quad() && !is_cpu_vic_boot()) {
+	if (is_cpu_quad() && !is_cpu_vic_boot())
 		/* clear the boot CPI */
-		__u8 dummy;
-
-		dummy =
-		    voyager_quad_cpi_addr[cpuid]->qic_cpi[VIC_CPU_BOOT_CPI].cpi;
-		printk("read dummy %d\n", dummy);
-	}
+		readw(&voyager_quad_cpi_addr[cpuid]->qic_cpi[VIC_CPU_BOOT_CPI].cpi);
 
 	/* lower the mask to receive CPIs */
 	vic_enable_cpi();
@@ -603,9 +598,7 @@ static void __init do_boot_cpu(__u8 cpu)
 		cpu_set(cpu, cpu_present_map);
 	} else {
 		printk("CPU%d FAILED TO BOOT: ", cpu);
-		if (*
-		    ((volatile unsigned char *)phys_to_virt(start_phys_address))
-		    == 0xA5)
+		if (readb(phys_to_virt(start_phys_address)) == 0xA5)
 			printk("Stuck.\n");
 		else
 			printk("Not responding.\n");
@@ -1306,18 +1299,15 @@ static void send_CPI(__u32 cpuset, __u8 cpi)
 
 /* Acknowledge receipt of CPI in the QIC, clear in QIC hardware and
  * set the cache line to shared by reading it.
- *
- * DON'T make this inline otherwise the cache line read will be
- * optimised away
  * */
-static int ack_QIC_CPI(__u8 cpi)
+static inline void ack_QIC_CPI(__u8 cpi)
 {
 	__u8 cpu = hard_smp_processor_id();
 
 	cpi &= 7;
 
 	outb(1 << cpi, QIC_INTERRUPT_CLEAR1);
-	return voyager_quad_cpi_addr[cpu]->qic_cpi[cpi].cpi;
+	readw(&voyager_quad_cpi_addr[cpu]->qic_cpi[cpi].cpi);
 }
 
 static void ack_special_QIC_CPI(__u8 cpi)
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* [PATCH 13/13] [VOYAGER] x86/Voyager: Plumb voyager back into the build
  2009-03-08 16:48                       ` [PATCH 12/13] [VOYAGER] x86/Voyager: replace inline io area reads with readX accessors James Bottomley
@ 2009-03-08 16:48                         ` James Bottomley
  0 siblings, 0 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-08 16:48 UTC (permalink / raw)
  To: LKML; +Cc: Thomas Gleixner, H. Peter Anvin, Ingo Molnar, James Bottomley

Voyager can now be converted over to using x86 quirks thanks to the
prior additions.  Most of the internal voyager code is made static and
the rest has a voyager_ prefix to avoid symbol clashes.

The TLB flushing functions still have an apic entanglement, so give
voyager a temporary work around which can be removed when they're all
converted to smp_call_function().

Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
---
 arch/x86/Kconfig                       |    4 +-
 arch/x86/Makefile                      |    2 +
 arch/x86/include/asm/voyager.h         |   19 +-
 arch/x86/kernel/setup.c                |    2 +
 arch/x86/mach-voyager/setup.c          |   57 +++--
 arch/x86/mach-voyager/voyager_basic.c  |   95 +++---
 arch/x86/mach-voyager/voyager_smp.c    |  520 ++++++++++----------------------
 arch/x86/mach-voyager/voyager_thread.c |    5 +-
 8 files changed, 262 insertions(+), 442 deletions(-)

diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 35efba5..eb12f50 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -425,8 +425,8 @@ config X86_ES7000
 
 config X86_VOYAGER
 	bool "Voyager (NCR)"
-	depends on SMP && !PCI && BROKEN
-	depends on X86_32_NON_STANDARD
+	depends on SMP && X86_32_NON_STANDARD
+	select MCA
 	---help---
 	  Voyager is an MCA-based 32-way capable SMP architecture proprietary
 	  to NCR Corp.  Machine classes 345x/35xx/4100/51xx are Voyager-based.
diff --git a/arch/x86/Makefile b/arch/x86/Makefile
index 1836191..d4393ed 100644
--- a/arch/x86/Makefile
+++ b/arch/x86/Makefile
@@ -127,6 +127,8 @@ core-$(CONFIG_XEN) += arch/x86/xen/
 # lguest paravirtualization support
 core-$(CONFIG_LGUEST_GUEST) += arch/x86/lguest/
 
+core-$(CONFIG_X86_VOYAGER) += arch/x86/mach-voyager/
+
 core-y += arch/x86/kernel/
 core-y += arch/x86/mm/
 
diff --git a/arch/x86/include/asm/voyager.h b/arch/x86/include/asm/voyager.h
index b38a241..a652890 100644
--- a/arch/x86/include/asm/voyager.h
+++ b/arch/x86/include/asm/voyager.h
@@ -503,22 +503,19 @@ extern struct voyager_status voyager_status;
 /* functions exported by the voyager and voyager_smp modules */
 extern int voyager_cat_readb(__u8 module, __u8 asic, int reg);
 extern void voyager_cat_init(void);
-extern void voyager_detect(struct voyager_bios_info *);
-extern void voyager_trap_init(void);
-extern void voyager_setup_irqs(void);
+extern void voyager_early_detect(void);
+extern void voyager_detect(void);
 extern int voyager_memory_detect(int region, __u32 *addr, __u32 *length);
-extern void voyager_smp_intr_init(void);
 extern __u8 voyager_extended_cmos_read(__u16 cmos_address);
 extern void voyager_smp_dump(void);
 extern void voyager_timer_interrupt(void);
-extern void smp_local_timer_interrupt(void);
 extern void voyager_power_off(void);
-extern void smp_voyager_power_off(void *dummy);
 extern void voyager_restart(void);
 extern void voyager_cat_power_off(void);
 extern void voyager_cat_do_common_interrupt(void);
 extern void voyager_handle_nmi(void);
 extern void voyager_smp_intr_init(void);
+
 /* Commands for the following are */
 #define	VOYAGER_PSI_READ	0
 #define VOYAGER_PSI_WRITE	1
@@ -535,12 +532,22 @@ extern asmlinkage void qic_reschedule_interrupt(void);
 extern asmlinkage void qic_enable_irq_interrupt(void);
 extern asmlinkage void qic_call_function_interrupt(void);
 
+#ifdef CONFIG_SMP
+extern void voyager_smp_detect(struct x86_quirks *);
+#else
+static inline void voyager_smp_detect(struct x86_quirks *) { }
+#endif
+
 #else /* CONFIG_X86_VOYAGER */
 
 static inline void voyager_timer_interrupt(void)
 {
 }
 
+static inline void voyager_early_detect(void)
+{
+}
+
 #endif /* CONFIG_X86_VOYAGER */
 
 #endif
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 62e9f59..f2ea265 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -99,6 +99,7 @@
 
 #include <asm/paravirt.h>
 #include <asm/hypervisor.h>
+#include <asm/voyager.h>
 
 #include <asm/percpu.h>
 #include <asm/topology.h>
@@ -652,6 +653,7 @@ void __init setup_arch(char **cmdline_p)
 #ifdef CONFIG_X86_32
 	memcpy(&boot_cpu_data, &new_cpu_data, sizeof(new_cpu_data));
 	visws_early_detect();
+	voyager_early_detect();
 #else
 	printk(KERN_INFO "Command line: %s\n", boot_command_line);
 #endif
diff --git a/arch/x86/mach-voyager/setup.c b/arch/x86/mach-voyager/setup.c
index e4516a8..3fc2df7 100644
--- a/arch/x86/mach-voyager/setup.c
+++ b/arch/x86/mach-voyager/setup.c
@@ -4,23 +4,22 @@
 
 #include <linux/init.h>
 #include <linux/interrupt.h>
-#include <asm/arch_hooks.h>
+#include <asm/apic.h>
 #include <asm/voyager.h>
 #include <asm/e820.h>
 #include <asm/io.h>
 #include <asm/setup.h>
+#include <asm/timer.h>
 #include <asm/cpu.h>
 
-void __init pre_intr_init_hook(void)
-{
-	init_ISA_irqs();
-}
-
-void __init intr_init_hook(void)
+static int __init voyager_intr_init(void)
 {
 #ifdef CONFIG_SMP
 	voyager_smp_intr_init();
 #endif
+
+	/* need to do the irq2 cascade setup */
+	return 0;
 }
 
 static void voyager_disable_tsc(void)
@@ -30,18 +29,10 @@ static void voyager_disable_tsc(void)
 	setup_clear_cpu_cap(X86_FEATURE_TSC);
 }
 
-void __init pre_setup_arch_hook(void)
+int __init voyager_pre_time_init(void)
 {
 	voyager_disable_tsc();
-}
-
-void __init pre_time_init_hook(void)
-{
-	voyager_disable_tsc();
-}
-
-void __init trap_init_hook(void)
-{
+	return 0;
 }
 
 static struct irqaction irq0 = {
@@ -51,18 +42,20 @@ static struct irqaction irq0 = {
 	.name = "timer"
 };
 
-void __init time_init_hook(void)
+static int __init voyager_time_init(void)
 {
 	irq0.mask = cpumask_of_cpu(safe_smp_processor_id());
 	setup_irq(0, &irq0);
+
+	/* return 1 to not do standard timer setup */
+	return 1;
 }
 
 /* Hook for machine specific memory setup. */
 
-char *__init machine_specific_memory_setup(void)
+static char *__init voyager_memory_setup(void)
 {
 	char *who;
-	int new_nr;
 
 	who = "NOT VOYAGER";
 
@@ -104,5 +97,27 @@ char *__init machine_specific_memory_setup(void)
 		return who;
 	}
 
-	return default_machine_specific_memory_setup();
+	return NULL;
+}
+
+static struct x86_quirks voyager_x86_quirks __initdata = {
+	.arch_time_init		= voyager_time_init,
+	.arch_intr_init		= voyager_intr_init,
+	.arch_pre_time_init	= voyager_pre_time_init,
+	.arch_memory_setup	= voyager_memory_setup,
+};
+
+void __init voyager_early_detect(void)
+{
+	if (!is_voyager())
+		return;
+
+	voyager_detect();
+
+	skip_ioapic_setup = 1;
+	voyager_disable_tsc();
+	disable_APIC();
+	voyager_smp_detect(&voyager_x86_quirks);
+	x86_quirks = &voyager_x86_quirks;
+
 }
diff --git a/arch/x86/mach-voyager/voyager_basic.c b/arch/x86/mach-voyager/voyager_basic.c
index 7c97c9a..be883b8 100644
--- a/arch/x86/mach-voyager/voyager_basic.c
+++ b/arch/x86/mach-voyager/voyager_basic.c
@@ -22,24 +22,26 @@
 #include <linux/sysrq.h>
 #include <linux/smp.h>
 #include <linux/nodemask.h>
+#include <linux/mca.h>
 #include <asm/io.h>
 #include <asm/voyager.h>
 #include <asm/vic.h>
 #include <linux/pm.h>
 #include <asm/tlbflush.h>
-#include <asm/arch_hooks.h>
+#include <asm/hpet.h>
 #include <asm/i8253.h>
-
-/*
- * Power off function, if any
- */
-void (*pm_power_off) (void);
-EXPORT_SYMBOL(pm_power_off);
+#include <asm/setup.h>
+#include <asm/timer.h>
+#include <asm/reboot.h>
 
 int voyager_level = 0;
 
 struct voyager_SUS *voyager_SUS = NULL;
 
+static void voyager_machine_emergency_restart(void);
+static void voyager_machine_restart(char *);
+static void voyager_mca_nmi_hook(void);
+
 #ifdef CONFIG_SMP
 static void voyager_dump(int dummy1, struct tty_struct *dummy3)
 {
@@ -54,33 +56,41 @@ static struct sysrq_key_op sysrq_voyager_dump_op = {
 };
 #endif
 
-void voyager_detect(struct voyager_bios_info *bios)
+static void voyager_machine_shutdown(void)
 {
-	if (bios->len != NOT_VOYAGER_BIOS_SIG) {
-		int class = (bios->class_1 << 8)
-		    | (bios->class_2 & 0xff);
-
-		printk("Voyager System detected.\n"
-		       "        Class %x, Revision %d.%d\n",
-		       class, bios->major, bios->minor);
-		if (class == VOYAGER_LEVEL4)
-			voyager_level = 4;
-		else if (class < VOYAGER_LEVEL5_AND_ABOVE)
-			voyager_level = 3;
-		else
-			voyager_level = 5;
-		printk("        Architecture Level %d\n", voyager_level);
-		if (voyager_level < 4)
-			printk
-			    ("\n**WARNING**: Voyager HAL only supports Levels 4 and 5 Architectures at the moment\n\n");
-		/* install the power off handler */
-		pm_power_off = voyager_power_off;
+	/* Need to skip the usual x86 shutdown */
+}
+
+void voyager_detect(void)
+{
+	struct voyager_bios_info *bios = &boot_params.voyager_bios_info;
+
+	int class = (bios->class_1 << 8)
+		| (bios->class_2 & 0xff);
+
+	printk("Voyager System detected.\n"
+	       "        Class %x, Revision %d.%d\n",
+	       class, bios->major, bios->minor);
+	if (class == VOYAGER_LEVEL4)
+		voyager_level = 4;
+	else if (class < VOYAGER_LEVEL5_AND_ABOVE)
+		voyager_level = 3;
+	else
+		voyager_level = 5;
+	printk("        Architecture Level %d\n", voyager_level);
+	if (voyager_level < 4)
+		printk
+			("\n**WARNING**: Voyager HAL only supports Levels 4 and 5 Architectures at the moment\n\n");
+	/* install the power off handler */
+	pm_power_off = voyager_power_off;
+	machine_ops.emergency_restart = voyager_machine_emergency_restart;
+	machine_ops.restart = voyager_machine_restart;
+	machine_ops.shutdown = voyager_machine_shutdown;
+	mca_nmi_hook = voyager_mca_nmi_hook;
+	timer_ack = 0;
 #ifdef CONFIG_SMP
-		register_sysrq_key('v', &sysrq_voyager_dump_op);
+	register_sysrq_key('v', &sysrq_voyager_dump_op);
 #endif
-	} else {
-		printk("\n\n**WARNING**: No Voyager Subsystem Found\n");
-	}
 }
 
 void voyager_system_interrupt(int cpl, void *dev_id)
@@ -244,12 +254,7 @@ static inline void kb_wait(void)
 			break;
 }
 
-void machine_shutdown(void)
-{
-	/* Architecture specific shutdown needed before a kexec */
-}
-
-void machine_restart(char *cmd)
+static void voyager_machine_restart(char *cmd)
 {
 	printk("Voyager Warm Restart\n");
 	kb_wait();
@@ -274,13 +279,13 @@ void machine_restart(char *cmd)
 		halt();
 }
 
-void machine_emergency_restart(void)
+static void voyager_machine_emergency_restart(void)
 {
 	/*for now, just hook this to a warm restart */
 	machine_restart(NULL);
 }
 
-void mca_nmi_hook(void)
+static void voyager_mca_nmi_hook(void)
 {
 	__u8 dumpval __maybe_unused = inb(0xf823);
 	__u8 swnmi __maybe_unused = inb(0xf813);
@@ -306,15 +311,3 @@ void mca_nmi_hook(void)
 	show_stack(NULL, NULL);
 	show_state();
 }
-
-void machine_halt(void)
-{
-	/* treat a halt like a power off */
-	machine_power_off();
-}
-
-void machine_power_off(void)
-{
-	if (pm_power_off)
-		pm_power_off();
-}
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index d7c2a6a..9714975 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -19,30 +19,20 @@
 #include <linux/kernel.h>
 #include <linux/bootmem.h>
 #include <linux/completion.h>
+#include <asm/cpu.h>
 #include <asm/desc.h>
+#include <asm/hardirq.h>
 #include <asm/voyager.h>
 #include <asm/vic.h>
 #include <asm/mtrr.h>
 #include <asm/pgalloc.h>
 #include <asm/tlbflush.h>
-#include <asm/arch_hooks.h>
 #include <asm/trampoline.h>
 
-/* TLB state -- visible externally, indexed physically */
-DEFINE_PER_CPU_SHARED_ALIGNED(struct tlb_state, cpu_tlbstate) = { &init_mm, 0 };
-
 /* CPU IRQ affinity -- set to all ones initially */
 static unsigned long cpu_irq_affinity[NR_CPUS] __cacheline_aligned =
 	{[0 ... NR_CPUS-1]  = ~0UL };
 
-/* per CPU data structure (for /proc/cpuinfo et al), visible externally
- * indexed physically */
-DEFINE_PER_CPU_SHARED_ALIGNED(struct cpuinfo_x86, cpu_info);
-EXPORT_PER_CPU_SYMBOL(cpu_info);
-
-/* physical ID of the CPU used to boot the system */
-unsigned char boot_cpu_id;
-
 /* The memory line addresses for the Quad CPIs */
 struct voyager_qic_cpi *voyager_quad_cpi_addr[NR_CPUS] __cacheline_aligned;
 
@@ -60,12 +50,9 @@ __u32 voyager_quad_processors = 0;
  * activity count.  Finally exported by i386_ksyms.c */
 static int voyager_extended_cpus = 1;
 
-/* Used for the invalidate map that's also checked in the spinlock */
-static volatile unsigned long smp_invalidate_needed;
-
 /* Bitmask of CPUs present in the system - exported by i386_syms.c, used
  * by scheduler but indexed physically */
-cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
+static cpumask_t voyager_cpu_present_map = CPU_MASK_NONE;
 
 /* The internal functions */
 static void send_CPI(__u32 cpuset, __u8 cpi);
@@ -87,9 +74,22 @@ static void vic_enable_cpi(void);
 static void do_boot_cpu(__u8 cpuid);
 static void do_quad_bootstrap(void);
 static void initialize_secondary(void);
+static void smp_local_timer_interrupt(void);
 
-int hard_smp_processor_id(void);
-int safe_smp_processor_id(void);
+static int voyager_hard_smp_processor_id(void)
+{
+	__u8 i;
+	__u8 cpumask = inb(VIC_PROC_WHO_AM_I);
+	if ((cpumask & QUAD_IDENTIFIER) == QUAD_IDENTIFIER)
+		return cpumask & 0x1F;
+
+	for (i = 0; i < 8; i++) {
+		if (cpumask & (1 << i))
+			return i;
+	}
+	printk(KERN_ERR "** WARNING ** Illegal cpuid returned by VIC: %d", cpumask);
+	return 0;
+}
 
 /* Inline functions */
 static inline void send_one_QIC_CPI(__u8 cpu, __u8 cpi)
@@ -108,14 +108,15 @@ static inline void send_QIC_CPI(__u32 cpuset, __u8 cpi)
 			if (!cpu_online(cpu))
 				VDEBUG(("CPU%d sending cpi %d to CPU%d not in "
 					"cpu_online_map\n",
-					hard_smp_processor_id(), cpi, cpu));
+					voyager_hard_smp_processor_id(), cpi, cpu));
 #endif
+
 			send_one_QIC_CPI(cpu, cpi - QIC_CPI_OFFSET);
 		}
 	}
 }
 
-static inline void wrapper_smp_local_timer_interrupt(void)
+static inline void voyager_local_timer_interrupt(void)
 {
 	irq_enter();
 	smp_local_timer_interrupt();
@@ -145,14 +146,14 @@ static inline int is_cpu_quad(void)
 
 static inline int is_cpu_extended(void)
 {
-	__u8 cpu = hard_smp_processor_id();
+	__u8 cpu = voyager_hard_smp_processor_id();
 
 	return (voyager_extended_vic_processors & (1 << cpu));
 }
 
 static inline int is_cpu_vic_boot(void)
 {
-	__u8 cpu = hard_smp_processor_id();
+	__u8 cpu = voyager_hard_smp_processor_id();
 
 	return (voyager_extended_vic_processors
 		& voyager_allowed_boot_processors & (1 << cpu));
@@ -198,11 +199,6 @@ static struct irq_chip vic_chip = {
 /* used to count up as CPUs are brought on line (starts at 0) */
 static int cpucount = 0;
 
-/* The per cpu profile stuff - used in smp_local_timer_interrupt */
-static DEFINE_PER_CPU(int, prof_multiplier) = 1;
-static DEFINE_PER_CPU(int, prof_old_multiplier) = 1;
-static DEFINE_PER_CPU(int, prof_counter) = 1;
-
 /* the map used to check if a CPU has booted */
 static __u32 cpu_booted_map;
 
@@ -316,7 +312,7 @@ static void do_quad_bootstrap(void)
 	if (is_cpu_quad() && is_cpu_vic_boot()) {
 		int i;
 		unsigned long flags;
-		__u8 cpuid = hard_smp_processor_id();
+		__u8 cpuid = voyager_hard_smp_processor_id();
 
 		local_irq_save(flags);
 
@@ -337,28 +333,23 @@ static void do_quad_bootstrap(void)
 	}
 }
 
-void prefill_possible_map(void)
-{
-	/* This is empty on voyager because we need a much
-	 * earlier detection which is done in find_smp_config */
-}
-
 /* Set up all the basic stuff: read the SMP config and make all the
  * SMP information reflect only the boot cpu.  All others will be
  * brought on-line later. */
-void __init find_smp_config(void)
+static int __init voyager_find_smp_config(unsigned int early)
 {
 	int i;
 
-	boot_cpu_id = hard_smp_processor_id();
+	if (!early)
+		return 1;
+
+	boot_cpu_id = voyager_hard_smp_processor_id();
 
 	printk("VOYAGER SMP: Boot cpu is %d\n", boot_cpu_id);
 
 	/* initialize the CPU structures (moved from smp_boot_cpus) */
 	for (i = 0; i < nr_cpu_ids; i++)
 		cpu_irq_affinity[i] = ~0;
-	cpu_online_map = cpumask_of_cpu(boot_cpu_id);
-
 	/* The boot CPU must be extended */
 	voyager_extended_vic_processors = 1 << boot_cpu_id;
 	/* initially, all of the first 8 CPUs can boot */
@@ -366,19 +357,18 @@ void __init find_smp_config(void)
 	/* set up everything for just this CPU, we can alter
 	 * this as we start the other CPUs later */
 	/* now get the CPU disposition from the extended CMOS */
-	cpus_addr(phys_cpu_present_map)[0] =
+	cpus_addr(voyager_cpu_present_map)[0] =
 	    voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK);
-	cpus_addr(phys_cpu_present_map)[0] |=
+	cpus_addr(voyager_cpu_present_map)[0] |=
 	    voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK + 1) << 8;
-	cpus_addr(phys_cpu_present_map)[0] |=
+	cpus_addr(voyager_cpu_present_map)[0] |=
 	    voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
 				       2) << 16;
-	cpus_addr(phys_cpu_present_map)[0] |=
+	cpus_addr(voyager_cpu_present_map)[0] |=
 	    voyager_extended_cmos_read(VOYAGER_PROCESSOR_PRESENT_MASK +
 				       3) << 24;
-	init_cpu_possible(&phys_cpu_present_map);
-	printk("VOYAGER SMP: phys_cpu_present_map = 0x%lx\n",
-	       cpus_addr(phys_cpu_present_map)[0]);
+	printk("VOYAGER SMP: voyager_cpu_present_map = 0x%lx\n",
+	       cpus_addr(voyager_cpu_present_map)[0]);
 	/* Here we set up the VIC to enable SMP */
 	/* enable the CPIs by writing the base vector to their register */
 	outb(VIC_DEFAULT_CPI_BASE, VIC_CPI_BASE_REGISTER);
@@ -399,27 +389,13 @@ void __init find_smp_config(void)
 	outb(inb(VOYAGER_SUS_IN_CONTROL_PORT) | VOYAGER_IN_CONTROL_FLAG,
 	     VOYAGER_SUS_IN_CONTROL_PORT);
 
-	current_thread_info()->cpu = boot_cpu_id;
-	percpu_write(cpu_number, boot_cpu_id);
-}
-
-/*
- *	The bootstrap kernel entry code has set these up. Save them
- *	for a given CPU, id is physical */
-void __init smp_store_cpu_info(int id)
-{
-	struct cpuinfo_x86 *c = &cpu_data(id);
-
-	*c = boot_cpu_data;
-	c->cpu_index = id;
-
-	identify_secondary_cpu(c);
+	return 1;
 }
 
 /* Routine initially called when a non-boot CPU is brought online */
 static void __init start_secondary(void *unused)
 {
-	__u8 cpuid = hard_smp_processor_id();
+	__u8 cpuid = voyager_hard_smp_processor_id();
 
 	cpu_init();
 
@@ -442,8 +418,6 @@ static void __init start_secondary(void *unused)
 
 	VDEBUG(("VOYAGER SMP: CPU%d, stack at about %p\n", cpuid, &cpuid));
 
-	notify_cpu_starting(cpuid);
-
 	/* enable interrupts */
 	local_irq_enable();
 
@@ -453,6 +427,8 @@ static void __init start_secondary(void *unused)
 	/* save our processor parameters */
 	smp_store_cpu_info(cpuid);
 
+	set_cpu_sibling_map(cpuid);
+
 	/* if we're a quad, we may need to bootstrap other CPUs */
 	do_quad_bootstrap();
 
@@ -461,18 +437,21 @@ static void __init start_secondary(void *unused)
 	 * permission to proceed.  Without this, the new per CPU stuff
 	 * in the softirqs will fail */
 	local_irq_disable();
-	cpu_set(cpuid, cpu_callin_map);
+	cpumask_set_cpu(cpuid, cpu_callin_mask);
 
 	/* signal that we're done */
 	cpu_booted_map = 1;
 
 	while (!cpu_isset(cpuid, smp_commenced_mask))
 		rep_nop();
+
+	notify_cpu_starting(cpuid);
+
 	local_irq_enable();
 
 	local_flush_tlb();
 
-	cpu_set(cpuid, cpu_online_map);
+	set_cpu_online(cpuid, true);
 	wmb();
 	cpu_idle();
 }
@@ -594,8 +573,8 @@ static void __init do_boot_cpu(__u8 cpu)
 		printk("CPU%d: ", cpu);
 		print_cpu_info(&cpu_data(cpu));
 		wmb();
-		cpu_set(cpu, cpu_callout_map);
-		cpu_set(cpu, cpu_present_map);
+		cpumask_set_cpu(cpu, cpu_callout_mask);
+		set_cpu_present(cpu, true);
 	} else {
 		printk("CPU%d FAILED TO BOOT: ", cpu);
 		if (readb(phys_to_virt(start_phys_address)) == 0xA5)
@@ -607,7 +586,7 @@ static void __init do_boot_cpu(__u8 cpu)
 	}
 }
 
-void __init smp_boot_cpus(void)
+static void __init smp_boot_cpus(void)
 {
 	int i;
 
@@ -620,15 +599,15 @@ void __init smp_boot_cpus(void)
 		/* now that the cat has probed the Voyager System Bus, sanity
 		 * check the cpu map */
 		if (((voyager_quad_processors | voyager_extended_vic_processors)
-		     & cpus_addr(phys_cpu_present_map)[0]) !=
-		    cpus_addr(phys_cpu_present_map)[0]) {
+		     & cpus_addr(voyager_cpu_present_map)[0]) !=
+		    cpus_addr(voyager_cpu_present_map)[0]) {
 			/* should panic */
 			printk("\n\n***WARNING*** "
 			       "Sanity check of CPU present map FAILED\n");
 		}
 	} else if (voyager_level == 4)
 		voyager_extended_vic_processors =
-		    cpus_addr(phys_cpu_present_map)[0];
+		    cpus_addr(voyager_cpu_present_map)[0];
 
 	/* this sets up the idle task to run on the current cpu */
 	voyager_extended_cpus = 1;
@@ -641,6 +620,7 @@ void __init smp_boot_cpus(void)
 	 smp_tune_scheduling();
 	 */
 	smp_store_cpu_info(boot_cpu_id);
+	set_cpu_sibling_map(boot_cpu_id);
 	/* setup the jump vector */
 	initial_code = (unsigned long)initialize_secondary;
 	printk("CPU%d: ", boot_cpu_id);
@@ -656,13 +636,10 @@ void __init smp_boot_cpus(void)
 	/* enable our own CPIs */
 	vic_enable_cpi();
 
-	cpu_set(boot_cpu_id, cpu_online_map);
-	cpu_set(boot_cpu_id, cpu_callout_map);
-
 	/* loop over all the extended VIC CPUs and boot them.  The
 	 * Quad CPUs must be bootstrapped by their extended VIC cpu */
 	for (i = 0; i < nr_cpu_ids; i++) {
-		if (i == boot_cpu_id || !cpu_isset(i, phys_cpu_present_map))
+		if (i == boot_cpu_id || !cpu_isset(i, voyager_cpu_present_map))
 			continue;
 		do_boot_cpu(i);
 		/* This udelay seems to be needed for the Quad boots
@@ -755,166 +732,13 @@ void smp_vic_cmn_interrupt(struct pt_regs *regs)
 /*
  * Reschedule call back. Nothing to do, all the work is done
  * automatically when we return from the interrupt.  */
-static void smp_reschedule_interrupt(void)
-{
-	/* do nothing */
-}
-
-static struct mm_struct *flush_mm;
-static unsigned long flush_va;
-static DEFINE_SPINLOCK(tlbstate_lock);
-
-/*
- * We cannot call mmdrop() because we are in interrupt context,
- * instead update mm->cpu_vm_mask.
- *
- * We need to reload %cr3 since the page tables may be going
- * away from under us..
- */
-static inline void voyager_leave_mm(unsigned long cpu)
+static void voyager_reschedule_interrupt(void)
 {
-	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK)
-		BUG();
-	cpu_clear(cpu, per_cpu(cpu_tlbstate, cpu).active_mm->cpu_vm_mask);
-	load_cr3(swapper_pg_dir);
+	inc_irq_stat(irq_resched_count);
 }
 
-/*
- * Invalidate call-back
- */
-static void smp_invalidate_interrupt(void)
-{
-	__u8 cpu = smp_processor_id();
-
-	if (!test_bit(cpu, &smp_invalidate_needed))
-		return;
-	/* This will flood messages.  Don't uncomment unless you see
-	 * Problems with cross cpu invalidation
-	 VDEBUG(("VOYAGER SMP: CPU%d received INVALIDATE_CPI\n",
-	 smp_processor_id()));
-	 */
-
-	if (flush_mm == per_cpu(cpu_tlbstate, cpu).active_mm) {
-		if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_OK) {
-			if (flush_va == TLB_FLUSH_ALL)
-				local_flush_tlb();
-			else
-				__flush_tlb_one(flush_va);
-		} else
-			voyager_leave_mm(cpu);
-	}
-	smp_mb__before_clear_bit();
-	clear_bit(cpu, &smp_invalidate_needed);
-	smp_mb__after_clear_bit();
-}
-
-/* All the new flush operations for 2.4 */
-
-/* This routine is called with a physical cpu mask */
-static void
-voyager_flush_tlb_others(unsigned long cpumask, struct mm_struct *mm,
-			 unsigned long va)
-{
-	int stuck = 50000;
-
-	if (!cpumask)
-		BUG();
-	if ((cpumask & cpus_addr(cpu_online_map)[0]) != cpumask)
-		BUG();
-	if (cpumask & (1 << smp_processor_id()))
-		BUG();
-	if (!mm)
-		BUG();
-
-	spin_lock(&tlbstate_lock);
-
-	flush_mm = mm;
-	flush_va = va;
-	atomic_set_mask(cpumask, &smp_invalidate_needed);
-	/*
-	 * We have to send the CPI only to
-	 * CPUs affected.
-	 */
-	send_CPI(cpumask, VIC_INVALIDATE_CPI);
-
-	while (smp_invalidate_needed) {
-		mb();
-		if (--stuck == 0) {
-			printk("***WARNING*** Stuck doing invalidate CPI "
-			       "(CPU%d)\n", smp_processor_id());
-			break;
-		}
-	}
-
-	/* Uncomment only to debug invalidation problems
-	   VDEBUG(("VOYAGER SMP: Completed invalidate CPI (CPU%d)\n", cpu));
-	 */
-
-	flush_mm = NULL;
-	flush_va = 0;
-	spin_unlock(&tlbstate_lock);
-}
-
-void flush_tlb_current_task(void)
-{
-	struct mm_struct *mm = current->mm;
-	unsigned long cpu_mask;
-
-	preempt_disable();
-
-	cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id());
-	local_flush_tlb();
-	if (cpu_mask)
-		voyager_flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL);
-
-	preempt_enable();
-}
-
-void flush_tlb_mm(struct mm_struct *mm)
-{
-	unsigned long cpu_mask;
-
-	preempt_disable();
-
-	cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id());
-
-	if (current->active_mm == mm) {
-		if (current->mm)
-			local_flush_tlb();
-		else
-			voyager_leave_mm(smp_processor_id());
-	}
-	if (cpu_mask)
-		voyager_flush_tlb_others(cpu_mask, mm, TLB_FLUSH_ALL);
-
-	preempt_enable();
-}
-
-void flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
-{
-	struct mm_struct *mm = vma->vm_mm;
-	unsigned long cpu_mask;
-
-	preempt_disable();
-
-	cpu_mask = cpus_addr(mm->cpu_vm_mask)[0] & ~(1 << smp_processor_id());
-	if (current->active_mm == mm) {
-		if (current->mm)
-			__flush_tlb_one(va);
-		else
-			voyager_leave_mm(smp_processor_id());
-	}
-
-	if (cpu_mask)
-		voyager_flush_tlb_others(cpu_mask, mm, va);
-
-	preempt_enable();
-}
-
-EXPORT_SYMBOL(flush_tlb_page);
-
 /* enable the requested IRQs */
-static void smp_enable_irq_interrupt(void)
+static void voyager_enable_irq_interrupt(void)
 {
 	__u8 irq;
 	__u8 cpu = get_cpu();
@@ -939,7 +763,7 @@ static void smp_enable_irq_interrupt(void)
 static void smp_stop_cpu_function(void *dummy)
 {
 	VDEBUG(("VOYAGER SMP: CPU%d is STOPPING\n", smp_processor_id()));
-	cpu_clear(smp_processor_id(), cpu_online_map);
+	set_cpu_online(smp_processor_id(), false);
 	local_irq_disable();
 	for (;;)
 		halt();
@@ -949,80 +773,59 @@ static void smp_stop_cpu_function(void *dummy)
  * previously set up.  This is used to schedule a function for
  * execution on all CPUs - set up the function then broadcast a
  * function_interrupt CPI to come here on each CPU */
-static void smp_call_function_interrupt(void)
+static void voyager_call_function_interrupt(void)
 {
 	irq_enter();
 	generic_smp_call_function_interrupt();
-	__get_cpu_var(irq_stat).irq_call_count++;
+	inc_irq_stat(irq_call_count);
 	irq_exit();
 }
 
-static void smp_call_function_single_interrupt(void)
+static void voyager_call_function_single_interrupt(void)
 {
 	irq_enter();
 	generic_smp_call_function_single_interrupt();
-	__get_cpu_var(irq_stat).irq_call_count++;
+	inc_irq_stat(irq_call_count);
 	irq_exit();
 }
 
-/* Sorry about the name.  In an APIC based system, the APICs
- * themselves are programmed to send a timer interrupt.  This is used
- * by linux to reschedule the processor.  Voyager doesn't have this,
- * so we use the system clock to interrupt one processor, which in
- * turn, broadcasts a timer CPI to all the others --- we receive that
- * CPI here.  We don't use this actually for counting so losing
- * ticks doesn't matter
- *
- * FIXME: For those CPUs which actually have a local APIC, we could
- * try to use it to trigger this interrupt instead of having to
- * broadcast the timer tick.  Unfortunately, all my pentium DYADs have
- * no local APIC, so I can't do this
- *
- * This function is currently a placeholder and is unused in the code */
-void smp_apic_timer_interrupt(struct pt_regs *regs)
-{
-	struct pt_regs *old_regs = set_irq_regs(regs);
-	wrapper_smp_local_timer_interrupt();
-	set_irq_regs(old_regs);
-}
-
 /* All of the QUAD interrupt GATES */
 void smp_qic_timer_interrupt(struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
 	ack_QIC_CPI(QIC_TIMER_CPI);
-	wrapper_smp_local_timer_interrupt();
+	voyager_local_timer_interrupt();
 	set_irq_regs(old_regs);
 }
 
 void smp_qic_invalidate_interrupt(struct pt_regs *regs)
 {
 	ack_QIC_CPI(QIC_INVALIDATE_CPI);
-	smp_invalidate_interrupt();
+	smp_invalidate_interrupt(regs);
 }
 
 void smp_qic_reschedule_interrupt(struct pt_regs *regs)
 {
 	ack_QIC_CPI(QIC_RESCHEDULE_CPI);
-	smp_reschedule_interrupt();
+	voyager_reschedule_interrupt();
 }
 
 void smp_qic_enable_irq_interrupt(struct pt_regs *regs)
 {
 	ack_QIC_CPI(QIC_ENABLE_IRQ_CPI);
-	smp_enable_irq_interrupt();
+	voyager_enable_irq_interrupt();
 }
 
 void smp_qic_call_function_interrupt(struct pt_regs *regs)
 {
 	ack_QIC_CPI(QIC_CALL_FUNCTION_CPI);
-	smp_call_function_interrupt();
+	voyager_call_function_interrupt();
 }
 
 void smp_qic_call_function_single_interrupt(struct pt_regs *regs)
 {
 	ack_QIC_CPI(QIC_CALL_FUNCTION_SINGLE_CPI);
-	smp_call_function_single_interrupt();
+	voyager_call_function_single_interrupt();
 }
 
 void smp_vic_cpi_interrupt(struct pt_regs *regs)
@@ -1036,61 +839,26 @@ void smp_vic_cpi_interrupt(struct pt_regs *regs)
 		ack_VIC_CPI(VIC_CPI_LEVEL0);
 
 	if (test_and_clear_bit(VIC_TIMER_CPI, &vic_cpi_mailbox[cpu]))
-		wrapper_smp_local_timer_interrupt();
+		voyager_local_timer_interrupt();
 	if (test_and_clear_bit(VIC_INVALIDATE_CPI, &vic_cpi_mailbox[cpu]))
-		smp_invalidate_interrupt();
+		smp_invalidate_interrupt(regs);
 	if (test_and_clear_bit(VIC_RESCHEDULE_CPI, &vic_cpi_mailbox[cpu]))
-		smp_reschedule_interrupt();
+		voyager_reschedule_interrupt();
 	if (test_and_clear_bit(VIC_ENABLE_IRQ_CPI, &vic_cpi_mailbox[cpu]))
-		smp_enable_irq_interrupt();
+		voyager_enable_irq_interrupt();
 	if (test_and_clear_bit(VIC_CALL_FUNCTION_CPI, &vic_cpi_mailbox[cpu]))
-		smp_call_function_interrupt();
+		voyager_call_function_interrupt();
 	if (test_and_clear_bit(VIC_CALL_FUNCTION_SINGLE_CPI, &vic_cpi_mailbox[cpu]))
-		smp_call_function_single_interrupt();
+		voyager_call_function_single_interrupt();
 	set_irq_regs(old_regs);
 }
 
-static void do_flush_tlb_all(void *info)
-{
-	unsigned long cpu = smp_processor_id();
-
-	__flush_tlb_all();
-	if (per_cpu(cpu_tlbstate, cpu).state == TLBSTATE_LAZY)
-		voyager_leave_mm(cpu);
-}
-
-/* flush the TLB of every active CPU in the system */
-void flush_tlb_all(void)
-{
-	on_each_cpu(do_flush_tlb_all, 0, 1);
-}
-
 /* send a reschedule CPI to one CPU by physical CPU number*/
 static void voyager_smp_send_reschedule(int cpu)
 {
 	send_one_CPI(cpu, VIC_RESCHEDULE_CPI);
 }
 
-int hard_smp_processor_id(void)
-{
-	__u8 i;
-	__u8 cpumask = inb(VIC_PROC_WHO_AM_I);
-	if ((cpumask & QUAD_IDENTIFIER) == QUAD_IDENTIFIER)
-		return cpumask & 0x1F;
-
-	for (i = 0; i < 8; i++) {
-		if (cpumask & (1 << i))
-			return i;
-	}
-	printk("** WARNING ** Illegal cpuid returned by VIC: %d", cpumask);
-	return 0;
-}
-
-int safe_smp_processor_id(void)
-{
-	return hard_smp_processor_id();
-}
-
 /* broadcast a halt to all other CPUs */
 static void voyager_smp_send_stop(void)
 {
@@ -1113,31 +881,14 @@ void smp_vic_timer_interrupt(void)
  * multiplier is 1 and it can be changed by writing the new multiplier
  * value into /proc/profile.
  */
-void smp_local_timer_interrupt(void)
+static void smp_local_timer_interrupt(void)
 {
 	int cpu = smp_processor_id();
 	long weight;
 
+	inc_irq_stat(apic_timer_irqs);
 	profile_tick(CPU_PROFILING);
-	if (--per_cpu(prof_counter, cpu) <= 0) {
-		/*
-		 * The multiplier may have changed since the last time we got
-		 * to this point as a result of the user writing to
-		 * /proc/profile. In this case we need to adjust the APIC
-		 * timer accordingly.
-		 *
-		 * Interrupts are already masked off at this point.
-		 */
-		per_cpu(prof_counter, cpu) = per_cpu(prof_multiplier, cpu);
-		if (per_cpu(prof_counter, cpu) !=
-		    per_cpu(prof_old_multiplier, cpu)) {
-			/* FIXME: need to update the vic timer tick here */
-			per_cpu(prof_old_multiplier, cpu) =
-			    per_cpu(prof_counter, cpu);
-		}
-
-		update_process_times(user_mode_vm(get_irq_regs()));
-	}
+	update_process_times(user_mode(get_irq_regs()));
 
 	if (((1 << cpu) & voyager_extended_vic_processors) == 0)
 		/* only extended VIC processors participate in
@@ -1203,25 +954,6 @@ void smp_local_timer_interrupt(void)
 #endif
 }
 
-/* setup the profiling timer */
-int setup_profiling_timer(unsigned int multiplier)
-{
-	int i;
-
-	if ((!multiplier))
-		return -EINVAL;
-
-	/*
-	 * Set the new multiplier for each CPU. CPUs don't start using the
-	 * new values until the next timer interrupt in which they do process
-	 * accounting.
-	 */
-	for (i = 0; i < nr_cpu_ids; ++i)
-		per_cpu(prof_multiplier, i) = multiplier;
-
-	return 0;
-}
-
 /* This is a bit of a mess, but forced on us by the genirq changes
  * there's no genirq handler that really does what voyager wants
  * so hack it up with the simple IRQ handler */
@@ -1262,12 +994,17 @@ void __init voyager_smp_intr_init(void)
 	QIC_SET_GATE(QIC_CALL_FUNCTION_SINGLE_CPI,
 		     qic_call_function_single_interrupt);
 
-	/* now put the VIC descriptor into the first 48 IRQs
+	/* now put the VIC descriptor into the first 16 IRQs
+	 *
+	 * This is for later: first 16 correspond to PC IRQs;
 	 *
-	 * This is for later: first 16 correspond to PC IRQs; next 16
-	 * are Primary MC IRQs and final 16 are Secondary MC IRQs */
-	for (i = 0; i < 48; i++)
-		set_irq_chip_and_handler(i, &vic_chip, handle_vic_irq);
+	 * Should have next 16 as Primary MC IRQs and final 16 as
+	 * Secondary MC IRQs but in order to fit into the Linux
+	 * scheme, we start each of the separate MC interrupts in the
+	 * same 0-16 legacy space */
+	for (i = 0; i < 16; i++)
+		set_irq_chip_and_handler_name(i, &vic_chip, handle_vic_irq,
+					      "level");
 }
 
 /* send a CPI at level cpi to a set of cpus in cpuset (set 1 bit per
@@ -1280,7 +1017,7 @@ static void send_CPI(__u32 cpuset, __u8 cpi)
 	if (cpi < VIC_START_FAKE_CPI) {
 		/* fake CPI are only used for booting, so send to the
 		 * extended quads as well---Quads must be VIC booted */
-		outb((__u8) (cpuset), VIC_CPI_Registers[cpi]);
+		outb((__u8) cpuset, VIC_CPI_Registers[cpi]);
 		return;
 	}
 	if (quad_cpuset)
@@ -1293,8 +1030,7 @@ static void send_CPI(__u32 cpuset, __u8 cpi)
 		if (cpuset & (1 << cpu))
 			set_bit(cpi, &vic_cpi_mailbox[cpu]);
 	}
-	if (cpuset)
-		outb((__u8) cpuset, VIC_CPI_Registers[VIC_CPI_LEVEL0]);
+	outb((__u8) cpuset, VIC_CPI_Registers[VIC_CPI_LEVEL0]);
 }
 
 /* Acknowledge receipt of CPI in the QIC, clear in QIC hardware and
@@ -1302,7 +1038,7 @@ static void send_CPI(__u32 cpuset, __u8 cpi)
  * */
 static inline void ack_QIC_CPI(__u8 cpi)
 {
-	__u8 cpu = hard_smp_processor_id();
+	__u8 cpu = voyager_hard_smp_processor_id();
 
 	cpi &= 7;
 
@@ -1588,7 +1324,7 @@ static void after_handle_vic_irq(unsigned int irq)
  * change the mask and then do an interrupt enable CPI to re-enable on
  * the selected processors */
 
-void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask)
+static void set_vic_irq_affinity(unsigned int irq, const struct cpumask *mask)
 {
 	/* Only extended processors handle interrupts */
 	unsigned long real_mask;
@@ -1720,7 +1456,7 @@ void voyager_smp_dump()
 	}
 }
 
-void smp_voyager_power_off(void *dummy)
+static void smp_voyager_power_off(void)
 {
 	if (smp_processor_id() == boot_cpu_id)
 		voyager_power_off();
@@ -1734,16 +1470,23 @@ static void __init voyager_smp_prepare_cpus(unsigned int max_cpus)
 	smp_boot_cpus();
 }
 
+static void __init voyager_prefill_possible_map(void)
+{
+	/* present map is initialised in voyager_find_smp_config */
+	init_cpu_possible(&voyager_cpu_present_map);
+}
+
 static void __cpuinit voyager_smp_prepare_boot_cpu(void)
 {
 	int cpu = smp_processor_id();
 	switch_to_new_gdt(cpu);
 
-	cpu_set(cpu, cpu_online_map);
-	cpu_set(cpu, cpu_callout_map);
-	cpu_set(cpu, cpu_possible_map);
-	cpu_set(cpu, cpu_present_map);
+	init_cpu_online(&cpumask_of_cpu(cpu));
+
+	cpumask_copy(cpu_callout_mask, &cpumask_of_cpu(cpu));
+	cpumask_copy(cpu_callin_mask, &CPU_MASK_NONE);
 
+	init_cpu_present(&cpumask_of_cpu(cpu));
 }
 
 static int __cpuinit voyager_cpu_up(unsigned int cpu)
@@ -1753,7 +1496,7 @@ static int __cpuinit voyager_cpu_up(unsigned int cpu)
 		return -ENOSYS;
 
 	/* In case one didn't come up */
-	if (!cpu_isset(cpu, cpu_callin_map))
+	if (!cpumask_test_cpu(cpu, cpu_callin_mask))
 		return -EIO;
 	/* Unleash the CPU! */
 	cpu_set(cpu, smp_commenced_mask);
@@ -1769,7 +1512,12 @@ static void __init voyager_smp_cpus_done(unsigned int max_cpus)
 
 void __init smp_setup_processor_id(void)
 {
-	current_thread_info()->cpu = hard_smp_processor_id();
+	if (is_voyager()) {
+		int cpu = voyager_hard_smp_processor_id();
+
+		current_thread_info()->cpu = cpu;
+		percpu_write(cpu_number, cpu);
+	}
 }
 
 static void voyager_send_call_func(const struct cpumask *callmask)
@@ -1783,7 +1531,7 @@ static void voyager_send_call_func_single(int cpu)
 	send_CPI(1 << cpu, VIC_CALL_FUNCTION_SINGLE_CPI);
 }
 
-struct smp_ops smp_ops = {
+static struct smp_ops voyager_smp_ops = {
 	.smp_prepare_boot_cpu = voyager_smp_prepare_boot_cpu,
 	.smp_prepare_cpus = voyager_smp_prepare_cpus,
 	.cpu_up = voyager_cpu_up,
@@ -1794,4 +1542,54 @@ struct smp_ops smp_ops = {
 
 	.send_call_func_ipi = voyager_send_call_func,
 	.send_call_func_single_ipi = voyager_send_call_func_single,
+	.hard_smp_processor_id = voyager_hard_smp_processor_id,
+	.safe_smp_processor_id = voyager_hard_smp_processor_id,
 };
+
+static int __init voyager_get_smp_config(unsigned int early)
+{
+	/* Don't do any MP parsing ... we'll crash */
+	return 1;
+}
+
+/*
+ * FIXME: Voyager shouldn't be using apics, so this is temporary
+ * until mm/tlb.c gets sorted out (probably by using smp_call_function)
+ *
+ * What we currently do is hijack apic->send_IPI_mask to send the
+ * flush function (via smp_call_function_many) and apic->write (so
+ * that the entangled ack_APIC_irq also doesn't crash.
+ */
+
+static void voyager_IPI_flush(void *data)
+{
+	unsigned int vector = (unsigned int)(unsigned long)data;
+	struct pt_regs regs;
+
+	regs.orig_ax = ~vector;
+
+	smp_invalidate_interrupt(&regs);
+}
+
+static void voyager_IPI_mask_for_tlb(const cpumask_t *mask, int vector)
+{
+	smp_call_function_many(mask, voyager_IPI_flush, (void *)vector, 1);
+}
+
+#include <asm/apic.h>
+
+static void voyager_apic_write(u32 reg, u32 v)
+{
+}
+
+void voyager_smp_detect(struct x86_quirks *voyager_x86_quirks)
+{
+	smp_ops = voyager_smp_ops;
+	nr_ioapics = 0;
+	voyager_x86_quirks->mach_find_smp_config = voyager_find_smp_config;
+	voyager_x86_quirks->mach_get_smp_config = voyager_get_smp_config;
+	voyager_x86_quirks->prefill_possible_map = voyager_prefill_possible_map;
+	pm_power_off = smp_voyager_power_off;
+	apic->send_IPI_mask = voyager_IPI_mask_for_tlb;
+	apic->write = voyager_apic_write;
+}
diff --git a/arch/x86/mach-voyager/voyager_thread.c b/arch/x86/mach-voyager/voyager_thread.c
index 15464a2..217ccc7 100644
--- a/arch/x86/mach-voyager/voyager_thread.c
+++ b/arch/x86/mach-voyager/voyager_thread.c
@@ -110,6 +110,8 @@ static int thread(void *unused)
 
 static int __init voyager_thread_start(void)
 {
+	if (!is_voyager())
+		return 0;
 	voyager_thread = kthread_run(thread, NULL, "kvoyagerd");
 	if (IS_ERR(voyager_thread)) {
 		printk(KERN_ERR
@@ -121,7 +123,8 @@ static int __init voyager_thread_start(void)
 
 static void __exit voyager_thread_stop(void)
 {
-	kthread_stop(voyager_thread);
+	if (is_voyager())
+		kthread_stop(voyager_thread);
 }
 
 module_init(voyager_thread_start);
-- 
1.6.1.3


^ permalink raw reply related	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops
  2009-03-08 16:48 ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops James Bottomley
  2009-03-08 16:48   ` [PATCH 02/13] [VOYAGER] x86/mca: make mca_nmi_hook external James Bottomley
@ 2009-03-08 17:15   ` Jeremy Fitzhardinge
  2009-03-08 17:23     ` James Bottomley
  1 sibling, 1 reply; 24+ messages in thread
From: Jeremy Fitzhardinge @ 2009-03-08 17:15 UTC (permalink / raw)
  To: James Bottomley; +Cc: LKML, Thomas Gleixner, H. Peter Anvin, Ingo Molnar

James Bottomley wrote:
> Not having apics, Voyager can't use the default apic implementation of
> these, it has to read from a special port in the VIC to get the
> processor ID, so abstract these functions in smp_ops to allow voyager
> to live simultaneously with the apic code.
>   

These aren't performance-sensitive at all, are they?  smp_ops is not 
subject to patching/inlining optimisations happen to more hotpath pvops.

Is safe_smp_processor_id needed at all?  It's only got two callers, and 
x86-64 just implements it as smp_processor_id().

> diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
> index 035582a..0dfb8c0 100644
> --- a/arch/x86/xen/smp.c
> +++ b/arch/x86/xen/smp.c
> @@ -450,6 +450,11 @@ static irqreturn_t xen_call_function_single_interrupt(int irq, void *dev_id)
>  	return IRQ_HANDLED;
>  }
>  
> +static int xen_hard_smp_processor_id(void)
> +{
> +	return read_apic_id();
> +}
> +
>  static const struct smp_ops xen_smp_ops __initdata = {
>  	.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu,
>  	.smp_prepare_cpus = xen_smp_prepare_cpus,
> @@ -465,6 +470,8 @@ static const struct smp_ops xen_smp_ops __initdata = {
>  
>  	.send_call_func_ipi = xen_smp_send_call_function_ipi,
>  	.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi,
> +	.hard_smp_processor_id = xen_hard_smp_processor_id,
> +	.safe_smp_processor_id = apic_safe_smp_processor_id,
>   

Hm, there's no meaningful apic-based implementation for these under 
Xen.  DomU has no access to apics, and Dom0's vcpus don't have any fixed 
relationship to physical cpu apics.  They should both just return 
smp_processor_id(), I guess.

    J

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops
  2009-03-08 17:15   ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops Jeremy Fitzhardinge
@ 2009-03-08 17:23     ` James Bottomley
  0 siblings, 0 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-08 17:23 UTC (permalink / raw)
  To: Jeremy Fitzhardinge; +Cc: LKML, Thomas Gleixner, H. Peter Anvin, Ingo Molnar

On Sun, 2009-03-08 at 10:15 -0700, Jeremy Fitzhardinge wrote:
> James Bottomley wrote:
> > Not having apics, Voyager can't use the default apic implementation of
> > these, it has to read from a special port in the VIC to get the
> > processor ID, so abstract these functions in smp_ops to allow voyager
> > to live simultaneously with the apic code.
> >   
> 
> These aren't performance-sensitive at all, are they?  smp_ops is not 
> subject to patching/inlining optimisations happen to more hotpath pvops.

No more than the function pointer indirection of smp_call_function().
Fortunately, the hard version is called in very few places, so the
overhead is minimal.

> Is safe_smp_processor_id needed at all?  It's only got two callers, and 
> x86-64 just implements it as smp_processor_id().

I can't see a reason, no.  If you look at voyager it uses the same
function for both, but x86 seems to have extra gunk in the safe path, so
I didn't feel entitled to remove it.

James



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-08 16:48 [PATCH 00/13] convert voyager over to the x86 quirks model James Bottomley
  2009-03-08 16:48 ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops James Bottomley
@ 2009-03-09 20:54 ` Sam Ravnborg
  2009-03-10 21:58 ` Yinghai Lu
  2009-03-10 22:37 ` Ingo Molnar
  3 siblings, 0 replies; 24+ messages in thread
From: Sam Ravnborg @ 2009-03-09 20:54 UTC (permalink / raw)
  To: James Bottomley; +Cc: LKML, Thomas Gleixner, H. Peter Anvin, Ingo Molnar

Hi James.

>  39 files changed, 550 insertions(+), 713 deletions(-)

These numbers looks god considering that you integrated Voyager
more thight with x86 using this serie.

	Sam

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-08 16:48 [PATCH 00/13] convert voyager over to the x86 quirks model James Bottomley
  2009-03-08 16:48 ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops James Bottomley
  2009-03-09 20:54 ` [PATCH 00/13] convert voyager over to the x86 quirks model Sam Ravnborg
@ 2009-03-10 21:58 ` Yinghai Lu
  2009-03-10 22:02   ` James Bottomley
  2009-03-10 22:37 ` Ingo Molnar
  3 siblings, 1 reply; 24+ messages in thread
From: Yinghai Lu @ 2009-03-10 21:58 UTC (permalink / raw)
  To: James Bottomley; +Cc: LKML, Thomas Gleixner, H. Peter Anvin, Ingo Molnar

On Sun, Mar 8, 2009 at 9:48 AM, James Bottomley
<James.Bottomley@hansenpartnership.com> wrote:
> Given the lack of feedback, I went ahead and implemented the additions
> to smp_ops and x86_quirks (and a dynamic mca NMI hook) to allow
> voyager to be plumbed in.
>
> There also needs to be changes in the boot setup to make voyager work
> dynamically: It has to be detected first, so the a20 gate check is
> only executed if a voyager is not found.
>
> I also completed some of the subarchitecture eliminations, so all the
> include file infrastructure should be gone.
>
> The result is that I can boot both my PC SMP x86 boxes and voyager
> with the same kernel.
>
> This patch series applies on the x86/apic branch of the x86 tree
> (obviously with 965c7ecaf2e2b083d711a01ab33735a4bdeee1a4 reverted)
>
> James
>
> ---
>
>  [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops
>  [VOYAGER] x86/mca: make mca_nmi_hook external
>  [VOYAGER] x86: add prefill_possible_map to x86_quirks
>  [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot
>    processor
>  [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area
>  [VOYAGER] x86: eliminate subarchitecture file setup_arch.h
>  [VOYAGER] x86: eliminate subarchitecture file entry_arch.h
>  [VOYAGER] x86: eliminate subarchitecture file do_timer.h
>  [VOYAGER] x86: redo irq2 cascade setup
>  [VOYAGER] x86: make disabling the apics functional instead of a flag
>  [VOYAGER] x86/Voyager: add missing QIC call function single gate
>  [VOYAGER] x86/Voyager: replace inline io area reads with readX
>    accessors
>  [VOYAGER] x86/Voyager: Plumb voyager back into the build
>
>  arch/x86/Kconfig                               |    4 +-
>  arch/x86/Makefile                              |    2 +
>  arch/x86/boot/Makefile                         |    4 +-
>  arch/x86/boot/a20.c                            |   13 +-
>  arch/x86/boot/boot.h                           |    2 +-
>  arch/x86/boot/voyager.c                        |    5 +-
>  arch/x86/include/asm/apic.h                    |    6 +
>  arch/x86/include/asm/bootparam.h               |    5 +-
>  arch/x86/include/asm/do_timer.h                |   16 -
>  arch/x86/include/asm/entry_arch.h              |   57 ---
>  arch/x86/include/asm/hw_irq.h                  |   11 +
>  arch/x86/include/asm/mach-voyager/do_timer.h   |   17 -
>  arch/x86/include/asm/mach-voyager/entry_arch.h |   26 --
>  arch/x86/include/asm/mach-voyager/setup_arch.h |   12 -

could remove "mach-" here.

>  arch/x86/include/asm/mca.h                     |    3 +
>  arch/x86/include/asm/setup.h                   |    6 +-
>  arch/x86/include/asm/setup_arch.h              |    3 -
>  arch/x86/include/asm/smp.h                     |   13 +-
>  arch/x86/include/asm/voyager.h                 |   80 ++---
>  arch/x86/include/asm/voyager_bios.h            |   21 +
>  arch/x86/include/asm/voyager_boot.h            |   27 ++
>  arch/x86/include/asm/voyager_vectors.h         |   37 ++
>  arch/x86/kernel/apic/apic.c                    |    8 +-
>  arch/x86/kernel/apic/ipi.c                     |    2 +-
>  arch/x86/kernel/apic/probe_32.c                |    3 +
>  arch/x86/kernel/entry_32.S                     |   70 +++-
>  arch/x86/kernel/irqinit_32.c                   |   15 +-
>  arch/x86/kernel/mca_32.c                       |   12 +
>  arch/x86/kernel/probe_roms_32.c                |    1 -
>  arch/x86/kernel/setup.c                        |   35 +--
>  arch/x86/kernel/smp.c                          |    7 +
>  arch/x86/kernel/smpboot.c                      |    2 +-
>  arch/x86/kernel/time_32.c                      |   11 +-
>  arch/x86/kernel/visws_quirks.c                 |    7 -
>  arch/x86/mach-voyager/setup.c                  |   66 ++--
>  arch/x86/mach-voyager/voyager_basic.c          |   98 ++---
>  arch/x86/mach-voyager/voyager_smp.c            |  544 ++++++++----------------
>  arch/x86/mach-voyager/voyager_thread.c         |    5 +-

same here

YH

>

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-10 21:58 ` Yinghai Lu
@ 2009-03-10 22:02   ` James Bottomley
  0 siblings, 0 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-10 22:02 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: LKML, Thomas Gleixner, H. Peter Anvin, Ingo Molnar

On Tue, 2009-03-10 at 14:58 -0700, Yinghai Lu wrote:
> On Sun, Mar 8, 2009 at 9:48 AM, James Bottomley
> <James.Bottomley@hansenpartnership.com> wrote:
> > Given the lack of feedback, I went ahead and implemented the additions
> > to smp_ops and x86_quirks (and a dynamic mca NMI hook) to allow
> > voyager to be plumbed in.
> >
> > There also needs to be changes in the boot setup to make voyager work
> > dynamically: It has to be detected first, so the a20 gate check is
> > only executed if a voyager is not found.
> >
> > I also completed some of the subarchitecture eliminations, so all the
> > include file infrastructure should be gone.
> >
> > The result is that I can boot both my PC SMP x86 boxes and voyager
> > with the same kernel.
> >
> > This patch series applies on the x86/apic branch of the x86 tree
> > (obviously with 965c7ecaf2e2b083d711a01ab33735a4bdeee1a4 reverted)
> >
> > James
> >
> > ---
> >
> >  [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops
> >  [VOYAGER] x86/mca: make mca_nmi_hook external
> >  [VOYAGER] x86: add prefill_possible_map to x86_quirks
> >  [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot
> >    processor
> >  [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area
> >  [VOYAGER] x86: eliminate subarchitecture file setup_arch.h
> >  [VOYAGER] x86: eliminate subarchitecture file entry_arch.h
> >  [VOYAGER] x86: eliminate subarchitecture file do_timer.h
> >  [VOYAGER] x86: redo irq2 cascade setup
> >  [VOYAGER] x86: make disabling the apics functional instead of a flag
> >  [VOYAGER] x86/Voyager: add missing QIC call function single gate
> >  [VOYAGER] x86/Voyager: replace inline io area reads with readX
> >    accessors
> >  [VOYAGER] x86/Voyager: Plumb voyager back into the build
> >
> >  arch/x86/Kconfig                               |    4 +-
> >  arch/x86/Makefile                              |    2 +
> >  arch/x86/boot/Makefile                         |    4 +-
> >  arch/x86/boot/a20.c                            |   13 +-
> >  arch/x86/boot/boot.h                           |    2 +-
> >  arch/x86/boot/voyager.c                        |    5 +-
> >  arch/x86/include/asm/apic.h                    |    6 +
> >  arch/x86/include/asm/bootparam.h               |    5 +-
> >  arch/x86/include/asm/do_timer.h                |   16 -
> >  arch/x86/include/asm/entry_arch.h              |   57 ---
> >  arch/x86/include/asm/hw_irq.h                  |   11 +
> >  arch/x86/include/asm/mach-voyager/do_timer.h   |   17 -
> >  arch/x86/include/asm/mach-voyager/entry_arch.h |   26 --
> >  arch/x86/include/asm/mach-voyager/setup_arch.h |   12 -
> 
> could remove "mach-" here.

This directory is actually gone after the patch.

> >  arch/x86/include/asm/mca.h                     |    3 +
> >  arch/x86/include/asm/setup.h                   |    6 +-
> >  arch/x86/include/asm/setup_arch.h              |    3 -
> >  arch/x86/include/asm/smp.h                     |   13 +-
> >  arch/x86/include/asm/voyager.h                 |   80 ++---
> >  arch/x86/include/asm/voyager_bios.h            |   21 +
> >  arch/x86/include/asm/voyager_boot.h            |   27 ++
> >  arch/x86/include/asm/voyager_vectors.h         |   37 ++
> >  arch/x86/kernel/apic/apic.c                    |    8 +-
> >  arch/x86/kernel/apic/ipi.c                     |    2 +-
> >  arch/x86/kernel/apic/probe_32.c                |    3 +
> >  arch/x86/kernel/entry_32.S                     |   70 +++-
> >  arch/x86/kernel/irqinit_32.c                   |   15 +-
> >  arch/x86/kernel/mca_32.c                       |   12 +
> >  arch/x86/kernel/probe_roms_32.c                |    1 -
> >  arch/x86/kernel/setup.c                        |   35 +--
> >  arch/x86/kernel/smp.c                          |    7 +
> >  arch/x86/kernel/smpboot.c                      |    2 +-
> >  arch/x86/kernel/time_32.c                      |   11 +-
> >  arch/x86/kernel/visws_quirks.c                 |    7 -
> >  arch/x86/mach-voyager/setup.c                  |   66 ++--
> >  arch/x86/mach-voyager/voyager_basic.c          |   98 ++---
> >  arch/x86/mach-voyager/voyager_smp.c            |  544 ++++++++----------------
> >  arch/x86/mach-voyager/voyager_thread.c         |    5 +-
> 
> same here

Heh, that would blow my nice diffstat out of the water ...

It's useful to keep code like this separated, since you don't
necessarily want some kernelnewby wandering across it as an example of
how to do SMP on x86 ... I'm not wedded to the name, but mach-voyager is
as good a descriptive directory name as any other.

James



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-08 16:48 [PATCH 00/13] convert voyager over to the x86 quirks model James Bottomley
                   ` (2 preceding siblings ...)
  2009-03-10 21:58 ` Yinghai Lu
@ 2009-03-10 22:37 ` Ingo Molnar
  2009-03-11 15:41   ` James Bottomley
  3 siblings, 1 reply; 24+ messages in thread
From: Ingo Molnar @ 2009-03-10 22:37 UTC (permalink / raw)
  To: James Bottomley; +Cc: LKML, Thomas Gleixner, H. Peter Anvin


* James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> Given the lack of feedback, I went ahead and implemented the 
> additions to smp_ops and x86_quirks (and a dynamic mca NMI 
> hook) to allow voyager to be plumbed in.
> 
> There also needs to be changes in the boot setup to make 
> voyager work dynamically: It has to be detected first, so the 
> a20 gate check is only executed if a voyager is not found.
> 
> I also completed some of the subarchitecture eliminations, so 
> all the include file infrastructure should be gone.
> 
> The result is that I can boot both my PC SMP x86 boxes and 
> voyager with the same kernel.
> 
> This patch series applies on the x86/apic branch of the x86 
> tree (obviously with 965c7ecaf2e2b083d711a01ab33735a4bdeee1a4 
> reverted)

The question is, why would we want to merge Voyager back ever 
again?

The hardware is obsolete and is not being produced anymore, 
nobody but you uses development kernels on it, and it caused all 
sorts of x86 maintenance overhead all along. It did not even 
build since August 2008, up until the point we removed it - 
2.6.26.0 was the last time it built.

	Ingo

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-10 22:37 ` Ingo Molnar
@ 2009-03-11 15:41   ` James Bottomley
  2009-03-11 17:26     ` H. Peter Anvin
  2009-03-11 22:55     ` Ingo Molnar
  0 siblings, 2 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-11 15:41 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: LKML, Thomas Gleixner, H. Peter Anvin

On Tue, 2009-03-10 at 23:37 +0100, Ingo Molnar wrote: 
> * James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> 
> > Given the lack of feedback, I went ahead and implemented the 
> > additions to smp_ops and x86_quirks (and a dynamic mca NMI 
> > hook) to allow voyager to be plumbed in.
> > 
> > There also needs to be changes in the boot setup to make 
> > voyager work dynamically: It has to be detected first, so the 
> > a20 gate check is only executed if a voyager is not found.
> > 
> > I also completed some of the subarchitecture eliminations, so 
> > all the include file infrastructure should be gone.
> > 
> > The result is that I can boot both my PC SMP x86 boxes and 
> > voyager with the same kernel.
> > 
> > This patch series applies on the x86/apic branch of the x86 
> > tree (obviously with 965c7ecaf2e2b083d711a01ab33735a4bdeee1a4 
> > reverted)
> 
> The question is, why would we want to merge Voyager back ever 
> again?

What do you mean merge back?  It's an existing and supported
architecture in git head.

> The hardware is obsolete and is not being produced anymore,

That goes for a huge number of drivers we have in the kernel currently,
and several whole architectures, so it's not a barrier to keeping
something maintained.

> nobody but you uses development kernels on it,

I don't think we've ever had a problem with a downstream community being
supported by a single upstream developer.

>  and it caused all 
> sorts of x86 maintenance overhead all along. It did not even 
> build since August 2008, up until the point we removed it - 
> 2.6.26.0 was the last time it built.

2.6.29-rc7 builds and boots just fine from git head.

Your prior statement was that you wanted it moved to the x86 quirks
infrastructure to make it easily maintainable, which this patch series
does ... I don't quite see what your problem is now ... are you saying
that x86 quirks isn't as maintainable as you previously thought?  In
which case, how can I help?

James



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-11 15:41   ` James Bottomley
@ 2009-03-11 17:26     ` H. Peter Anvin
  2009-03-11 18:53       ` James Bottomley
  2009-03-11 22:55     ` Ingo Molnar
  1 sibling, 1 reply; 24+ messages in thread
From: H. Peter Anvin @ 2009-03-11 17:26 UTC (permalink / raw)
  To: James Bottomley; +Cc: Ingo Molnar, LKML, Thomas Gleixner, H. Peter Anvin

James Bottomley wrote:
> 
> That goes for a huge number of drivers we have in the kernel currently,
> and several whole architectures, so it's not a barrier to keeping
> something maintained.
> 
>> nobody but you uses development kernels on it,
> 
> I don't think we've ever had a problem with a downstream community being
> supported by a single upstream developer.
> 

What "downstream community"?  There is none, and you know it.

That is the whole point.  Voyager isn't just a driver -- it's an
odd-man-out variant of the most used architecture in the world.  If it
was just a driver, it would make sense.  However, its very existence
forces constraints on the upstream x86 architecture, and it imposes a
real and considerable workload on the upstream maintainers -- and that
is not you, but on us.  When that happens with drivers for obsolete
hardware, we remove them.

Hence, Ingo rather logically asks you to justify this impact on our
workload.  I would like to know as well.  I'm personally sick of the
extra overhead this museum piece imposes.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-11 17:26     ` H. Peter Anvin
@ 2009-03-11 18:53       ` James Bottomley
  0 siblings, 0 replies; 24+ messages in thread
From: James Bottomley @ 2009-03-11 18:53 UTC (permalink / raw)
  To: H. Peter Anvin; +Cc: Ingo Molnar, LKML, Thomas Gleixner, H. Peter Anvin

On Wed, 2009-03-11 at 10:26 -0700, H. Peter Anvin wrote:
> James Bottomley wrote:
> > 
> > That goes for a huge number of drivers we have in the kernel currently,
> > and several whole architectures, so it's not a barrier to keeping
> > something maintained.
> > 
> >> nobody but you uses development kernels on it,
> > 
> > I don't think we've ever had a problem with a downstream community being
> > supported by a single upstream developer.
> > 
> 
> What "downstream community"?  There is none, and you know it.

There are actually two ... as you've heard me say before.  However,
upstream development is driven by willing maintainers, not by user
popularity contests.

> That is the whole point.  Voyager isn't just a driver -- it's an
> odd-man-out variant of the most used architecture in the world.  If it
> was just a driver, it would make sense.  However, its very existence
> forces constraints on the upstream x86 architecture, and it imposes a
> real and considerable workload on the upstream maintainers -- and that
> is not you, but on us.  When that happens with drivers for obsolete
> hardware, we remove them.

The last I heard from you was that the Subarchitecture infrastructure
was the cause of your increased workload.  Fine, it's gone.  Let me ask
again, what is the *current* problem?  This patch set moves voyager to
the x86_quirks setup as you x86 maintainers requested with the given
reason of reducing your workload.

> Hence, Ingo rather logically asks you to justify this impact on our
> workload.  I would like to know as well.  I'm personally sick of the
> extra overhead this museum piece imposes.

Well, I've already answered your workload above, but given the general
question, there are at least three reasons

     1. It's a currently supported architecture.
     2. It works.
     3. It has a committed maintainer.

It's also important to demonstrate that Linux development is based on
technical merit not personal prejudice.

James



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [PATCH 00/13] convert voyager over to the x86 quirks model
  2009-03-11 15:41   ` James Bottomley
  2009-03-11 17:26     ` H. Peter Anvin
@ 2009-03-11 22:55     ` Ingo Molnar
  1 sibling, 0 replies; 24+ messages in thread
From: Ingo Molnar @ 2009-03-11 22:55 UTC (permalink / raw)
  To: James Bottomley; +Cc: LKML, Thomas Gleixner, H. Peter Anvin


* James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> On Tue, 2009-03-10 at 23:37 +0100, Ingo Molnar wrote: 
> > * James Bottomley <James.Bottomley@HansenPartnership.com> wrote:
> > 
> > > Given the lack of feedback, I went ahead and implemented the 
> > > additions to smp_ops and x86_quirks (and a dynamic mca NMI 
> > > hook) to allow voyager to be plumbed in.
> > > 
> > > There also needs to be changes in the boot setup to make 
> > > voyager work dynamically: It has to be detected first, so the 
> > > a20 gate check is only executed if a voyager is not found.
> > > 
> > > I also completed some of the subarchitecture eliminations, so 
> > > all the include file infrastructure should be gone.
> > > 
> > > The result is that I can boot both my PC SMP x86 boxes and 
> > > voyager with the same kernel.
> > > 
> > > This patch series applies on the x86/apic branch of the x86 
> > > tree (obviously with 965c7ecaf2e2b083d711a01ab33735a4bdeee1a4 
> > > reverted)
> > 
> > The question is, why would we want to merge Voyager back ever 
> > again?
> 
> What do you mean merge back?  It's an existing and supported 
> architecture in git head.

That's revisionist history that ignores a few inconvenient 
facts. The x86/Voyager subarch last built successfully in 
v2.6.26.0 - in the summer of last year (!):

  v2.6.27.0:   Voyager was broken - it did not even build.
  v2.6.28.0:   Voyager was broken - it did not even build.
  v2.6.29-rc5: Voyager was broken - it did not even build.

... then we removed it from the x86 development tree and 
mentioned that it did not even build for a long time, and Cc:-ed 
you to all that. A few days later you finally sent a fix patch 
for mainline.

We merged that fix into -rc6 as it was small so yes, technically 
'git head works now', but that ignores the long negative track 
record of that code that we as x86 maintainers have experienced.

I.e. by all means it was broken code for almost 3 full kernel 
cycles, up until the very last minute when you saw us removing 
it. Talking about any sort of 'downstream community' and 
'supported architecture' is mocking these terms.

With regards to v2.6.30 it's simply too late - at least as far 
as my schedule goes. v2.6.29-final is maybe a week or two away, 
the merge window is very crowded already and we've pretty much 
closed down APIC related changes already.

You can still try to convince Thomas or Peter (i'm not the only 
x86 maintainer so merge decisions do not depend on me alone and 
you can convince them if you disagree with my position - they 
have symmetric commit rights to the x86 devel tree), but as far 
as i'm concerned personally, this merge window is too tight 
already.

In any case, if you find that code useful feel free to maintain 
it in a separate git tree (where any interested people/users can 
access it easily) and we can revisit this issue in the next 
development cycle, in 2-3 weeks or so, after the merge window.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2009-03-11 22:56 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-08 16:48 [PATCH 00/13] convert voyager over to the x86 quirks model James Bottomley
2009-03-08 16:48 ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops James Bottomley
2009-03-08 16:48   ` [PATCH 02/13] [VOYAGER] x86/mca: make mca_nmi_hook external James Bottomley
2009-03-08 16:48     ` [PATCH 03/13] [VOYAGER] x86: add prefill_possible_map to x86_quirks James Bottomley
2009-03-08 16:48       ` [PATCH 04/13] [VOYAGER] x86: use boot_cpu_id instead of zero for checking boot processor James Bottomley
2009-03-08 16:48         ` [PATCH 05/13] [VOYAGER] x86/voyager: Move voyager detection to a new bootparam area James Bottomley
2009-03-08 16:48           ` [PATCH 06/13] [VOYAGER] x86: eliminate subarchitecture file setup_arch.h James Bottomley
2009-03-08 16:48             ` [PATCH 07/13] [VOYAGER] x86: eliminate subarchitecture file entry_arch.h James Bottomley
2009-03-08 16:48               ` [PATCH 08/13] [VOYAGER] x86: eliminate subarchitecture file do_timer.h James Bottomley
2009-03-08 16:48                 ` [PATCH 09/13] [VOYAGER] x86: redo irq2 cascade setup James Bottomley
2009-03-08 16:48                   ` [PATCH 10/13] [VOYAGER] x86: make disabling the apics functional instead of a flag James Bottomley
2009-03-08 16:48                     ` [PATCH 11/13] [VOYAGER] x86/Voyager: add missing QIC call function single gate James Bottomley
2009-03-08 16:48                       ` [PATCH 12/13] [VOYAGER] x86/Voyager: replace inline io area reads with readX accessors James Bottomley
2009-03-08 16:48                         ` [PATCH 13/13] [VOYAGER] x86/Voyager: Plumb voyager back into the build James Bottomley
2009-03-08 17:15   ` [PATCH 01/13] [VOYAGER] x86: add {safe,hard}_smp_processor_id to smp_ops Jeremy Fitzhardinge
2009-03-08 17:23     ` James Bottomley
2009-03-09 20:54 ` [PATCH 00/13] convert voyager over to the x86 quirks model Sam Ravnborg
2009-03-10 21:58 ` Yinghai Lu
2009-03-10 22:02   ` James Bottomley
2009-03-10 22:37 ` Ingo Molnar
2009-03-11 15:41   ` James Bottomley
2009-03-11 17:26     ` H. Peter Anvin
2009-03-11 18:53       ` James Bottomley
2009-03-11 22:55     ` 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).