Skip to contentSkip to conversation

x86: unify genapic code, unify subarchitectures, remove old subarchitecture code

PATCH New Ingo Molnar 7 participants 129 messages Jan 28, 2009 – Jan 30, 2009 Page 1 of 2

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

This series of 114 patches implements a long desired restructuring, unification and cleanup of the x86 APIC/SMP/subarch code:

- unifies the 32-bit and 64-bit genapic code

- sorts out all the subarch details into standalone and boot-time probable quirk modules

- removes the build-time subarch hacks that we had on 32-bit.

This inevitably touches an awful lot of x86 code, and rather intrusively so:

    112 files changed, 3277 insertions(+), 3209 deletions(-)

So breakages are to be expected. The commits are queued up in tip/x86/apic and are in tip/master as well:

http://people.redhat.com/mingo/tip.git/README

I ported the NUMAQ / Summit / bigsmp and ES7000 subarchitectures to the new setup. They build and boot on regular hardware but are otherwise untested. The x86/Voyager subarch is not fully ported yet (i cleaned up its Kconfig impact) and hence disabled it for the time being. It ought to be relatively straightforward to port it to the new code.

Ingo

----------------------->

 arch/x86/Kconfig                                  |  203 ++++-----
 arch/x86/Kconfig.debug                            |    2 +-
 arch/x86/Makefile                                 |   26 --
 arch/x86/include/asm/apic.h                       |   33 ++
 arch/x86/include/asm/apm.h                        |   73 ++++
 arch/x86/include/asm/bigsmp/apic.h                |   71 ++--
 arch/x86/include/asm/bigsmp/apicdef.h             |    8 +-
 arch/x86/include/asm/bigsmp/ipi.h                 |   16 +-
 arch/x86/include/asm/cpu.h                        |    6 +-
 arch/x86/include/asm/do_timer.h                   |   16 +
 arch/x86/include/asm/entry_arch.h                 |   57 +++
 arch/x86/include/asm/es7000/apic.h                |  242 -----------
 arch/x86/include/asm/es7000/apicdef.h             |   13 -
 arch/x86/include/asm/es7000/ipi.h                 |   22 -
 arch/x86/include/asm/es7000/mpparse.h             |   29 --
 arch/x86/include/asm/es7000/wakecpu.h             |   37 --
 arch/x86/include/asm/genapic.h                    |  262 ++++++++++++-
 arch/x86/include/asm/genapic_32.h                 |  141 ------
 arch/x86/include/asm/genapic_64.h                 |   60 ---
 arch/x86/include/asm/hw_irq.h                     |    6 +-
 arch/x86/include/asm/ipi.h                        |   95 ++++-
 arch/x86/include/asm/mach-default/apm.h           |   73 ----
 arch/x86/include/asm/mach-default/do_timer.h      |   16 -
 arch/x86/include/asm/mach-default/entry_arch.h    |   52 ---
 arch/x86/include/asm/mach-default/mach_apic.h     |  168 --------
 arch/x86/include/asm/mach-default/mach_apicdef.h  |   24 -
 arch/x86/include/asm/mach-default/mach_ipi.h      |   64 ---
 arch/x86/include/asm/mach-default/mach_mpparse.h  |   17 -
 arch/x86/include/asm/mach-default/mach_mpspec.h   |   12 -
 arch/x86/include/asm/mach-default/mach_timer.h    |   48 ---
 arch/x86/include/asm/mach-default/mach_traps.h    |   33 --
 arch/x86/include/asm/mach-default/mach_wakecpu.h  |   41 --
 arch/x86/include/asm/mach-default/pci-functions.h |   19 -
 arch/x86/include/asm/mach-default/setup_arch.h    |    3 -
 arch/x86/include/asm/mach-default/smpboot_hooks.h |   61 ---
 arch/x86/include/asm/mach-generic/gpio.h          |   15 -
 arch/x86/include/asm/mach-generic/mach_apic.h     |   35 --
 arch/x86/include/asm/mach-generic/mach_apicdef.h  |   11 -
 arch/x86/include/asm/mach-generic/mach_ipi.h      |   10 -
 arch/x86/include/asm/mach-generic/mach_mpparse.h  |    9 -
 arch/x86/include/asm/mach-generic/mach_mpspec.h   |   12 -
 arch/x86/include/asm/mach-generic/mach_wakecpu.h  |   12 -
 arch/x86/include/asm/mach_timer.h                 |   48 +++
 arch/x86/include/asm/mach_traps.h                 |   33 ++
 arch/x86/include/asm/mpspec.h                     |   33 ++-
 arch/x86/include/asm/numaq/apic.h                 |  142 -------
 arch/x86/include/asm/numaq/apicdef.h              |   14 -
 arch/x86/include/asm/numaq/ipi.h                  |   22 -
 arch/x86/include/asm/numaq/mpparse.h              |    6 -
 arch/x86/include/asm/numaq/wakecpu.h              |   45 --
 arch/x86/include/asm/pci-functions.h              |   19 +
 arch/x86/include/asm/proto.h                      |    4 -
 arch/x86/include/asm/setup_arch.h                 |    3 +
 arch/x86/include/asm/smp.h                        |   19 -
 arch/x86/include/asm/smpboot_hooks.h              |   61 +++
 arch/x86/include/asm/summit/apic.h                |  202 ---------
 arch/x86/include/asm/summit/apicdef.h             |   13 -
 arch/x86/include/asm/summit/ipi.h                 |   26 --
 arch/x86/include/asm/summit/mpparse.h             |  109 -----
 arch/x86/kernel/Makefile                          |   11 +-
 arch/x86/kernel/acpi/boot.c                       |   25 +-
 arch/x86/kernel/apic.c                            |   46 ++-
 arch/x86/kernel/apm_32.c                          |    2 +-
 arch/x86/kernel/bigsmp_32.c                       |  268 ++++++++++++
 arch/x86/kernel/cpu/addon_cpuid_features.c        |   20 +-
 arch/x86/kernel/cpu/amd.c                         |    2 +-
 arch/x86/kernel/cpu/common.c                      |   19 +-
 arch/x86/kernel/cpu/intel.c                       |    2 +-
 arch/x86/kernel/crash.c                           |    2 +-
 arch/x86/kernel/entry_32.S                        |    2 +-
 arch/x86/kernel/es7000_32.c                       |  468 ++++++++++++++++++++-
 arch/x86/kernel/genapic_64.c                      |   22 +-
 arch/x86/kernel/genapic_flat_64.c                 |  176 ++++++---
 arch/x86/kernel/genx2apic_cluster.c               |  133 ++++--
 arch/x86/kernel/genx2apic_phys.c                  |  125 ++++---
 arch/x86/kernel/genx2apic_uv_x.c                  |  111 ++++--
 arch/x86/kernel/io_apic.c                         |  197 ++++-----
 arch/x86/kernel/ipi.c                             |   33 +-
 arch/x86/kernel/irq_32.c                          |    2 +-
 arch/x86/kernel/kgdb.c                            |    4 +-
 arch/x86/kernel/mpparse.c                         |   26 +-
 arch/x86/kernel/nmi.c                             |    2 +-
 arch/x86/kernel/numaq_32.c                        |  280 ++++++++++++-
 arch/x86/kernel/probe_32.c                        |  411 ++++++++++++++++++
 arch/x86/kernel/probe_roms_32.c                   |    2 +-
 arch/x86/kernel/process.c                         |    2 +-
 arch/x86/kernel/reboot.c                          |    4 +-
 arch/x86/kernel/setup.c                           |   30 +-
 arch/x86/kernel/smp.c                             |   13 +-
 arch/x86/kernel/smpboot.c                         |   37 +-
 arch/x86/kernel/summit_32.c                       |  417 ++++++++++++++++++-
 arch/x86/kernel/time_32.c                         |    2 +-
 arch/x86/kernel/tlb_uv.c                          |    2 +-
 arch/x86/kernel/traps.c                           |    2 +-
 arch/x86/kernel/tsc.c                             |    2 +-
 arch/x86/kernel/visws_quirks.c                    |    6 +-
 arch/x86/kernel/vmiclock_32.c                     |    2 +-
 arch/x86/mach-default/setup.c                     |  162 -------
 arch/x86/mach-generic/Makefile                    |   11 -
 arch/x86/mach-generic/bigsmp.c                    |   60 ---
 arch/x86/mach-generic/default.c                   |   27 --
 arch/x86/mach-generic/es7000.c                    |  103 -----
 arch/x86/mach-generic/numaq.c                     |   53 ---
 arch/x86/mach-generic/probe.c                     |  152 -------
 arch/x86/mach-generic/summit.c                    |   40 --
 arch/x86/mm/Makefile                              |    2 +-
 arch/x86/mm/tlb.c                                 |    4 +-
 arch/x86/pci/numaq_32.c                           |    2 +-
 arch/x86/pci/pcbios.c                             |    2 +-
 drivers/clocksource/acpi_pm.c                     |    2 +-
 drivers/clocksource/cyclone.c                     |    2 +-
 drivers/mtd/nand/Kconfig                          |    2 +-
 112 files changed, 3277 insertions(+), 3209 deletions(-)

Ingo Molnar (114):
x86, genapic: refactor genapic_64.h
x86, genapic: refactor genapic_32.h
x86, genapic: unify struct genapic
x86, genapic: finish unification
x86, genapic: cleanups
x86, genapic: provide IPI callbacks unconditionally
x86: rename 'genapic' to 'apic'
x86: clean up genapic_flat
x86: clean up genapic_phys_flat
x86: clean up apic_x2apic_uv_x
x86: clean up apic_x2apic_phys
x86: clean up apic_x2apic_cluster
x86, genapic: cleanup 32-bit apic_default template
x86, genapic: cleanup 32-bit apic_bigsmp template
x86, genapic: cleanup 32-bit apic_numaq template
x86, genapic: cleanup 32-bit apic_es7000 template
x86, genapic: cleanup 32-bit apic_summit template
x86: remove APIC_INIT / APICFUNC / IPIFUNC
x86: clean up apic->acpi_madt_oem_check methods
x86: clean up apic->apic_id_registered() methods
x86, genapic: rename int_delivery_mode, et. al.
x86, apic: remove IRQ_DEST_MODE / IRQ_DELIVERY_MODE
x86, apic: remove DEFAULT_IRQ_DELIVERY_MODE and DEFAULT_IRQ_DEST_MODE x86, apic: remove SUMMIT_IRQ_DELIVERY_MODE and SUMMIT_IRQ_DEST_MODE x86, apic: remove NUMAQ_IRQ_DELIVERY_MODE and NUMAQ_IRQ_DEST_MODE x86, apic: remove BIGSMP_IRQ_DELIVERY_MODE and BIGSMP_IRQ_DEST_MODE x86, apic: remove ES7000_IRQ_DELIVERY_MODE and ES7000_IRQ_DEST_MODE x86, apic: remove IRQ_DEST_MODE
x86, apic: clean up target_cpus methods
x86, apic: clean up / remove TARGET_CPUS
x86: clean up esr_disable() methods
x86: rename ->ESR_DISABLE to ->disable_esr
x86: clean up the APIC_DEST_LOGICAL logic
x86, apic: rename genapic::apic_destination_logical to genapic::dest_logical x86, apic: clean up check_apicid*() callbacks
x86, apic: remove no_balance_irq and no_ioapic_check flags
x86, apic: clean up ->vector_allocation_domain()
x86, apic: clean up ->init_apic_ldr()
x86, apic: clean up ->ioapic_phys_id_map()
x86, apic: clean up ->setup_apic_routing()
x86, apic: streamline the ->multi_timer_check() quirk
x86, apic: clean up ->apicid_to_node()
x86, apic: clean up ->cpu_to_logical_apicid()
x86, apic: clean up ->cpu_present_to_apicid()
x86, apic: clean up ->apicid_to_cpu_present()
x86: refactor ->setup_portio_remap() subarch methods
x86: refactor ->check_phys_apicid_present() subarch methods
x86: refactor ->enable_apic_mode() subarch methods
x86, es7000: clean up es7000_enable_apic_mode()
x86, apic: unify phys_pkg_id()
x86, apic: refactor ->phys_pkg_id()
x86, smp: clean up mps_oem_check()
x86, mpparse: call the generic quirk handlers early
x86: consolidate the ->mps_oem_check() code
x86, apic: refactor ->get_apic_id() & GET_APIC_ID()
x86, apic: refactor ->apic_id_mask & APIC_ID_MASK
x86, apic: get rid of *_APIC_ID_MASK definitions
x86, apic: refactor ->cpu_mask_to_apicid*()
x86, apic: untangle the send_IPI_*() jungle
x86, smp: clean up ->trampoline_phys_low/high handling
x86: set ->trampoline_phys_low/high on 64-bit too
x86, smp: refactor ->wait_for_init_deassert()
x86, smp: refactor ->smp_callin_clear_local_apic() methods
x86, smp: refactor ->store/restore_NMI_vector() methods
x86, smp: remove ->restore_NMI_vector()
x86, smp: refactor ->inquire_remote_apic() methods
x86, ES7000: consolidate the APIC code
x86, smp: eliminate asm/mach-default/mach_wakecpu.h
x86: eliminate asm/mach-*/mach_mpparse.h
x86: remove mach_mpspec.h
x86: remove mach_apicdef.h
x86, smp: refactor ->wake_cpu
x86, numaq: consolidate code
x86, summit: consolidate code
x86: remove mach_apic.h
x86, ES7000: Consolidate code
x86, NUMAQ: Consolidate code
x86, bigsmp: consolidate code
x86, bigsmp: consolidate header code
x86, smp: remove mach_ipi.h
x86: remove subarchitecture support code
x86: move mach-default/*.h files to asm/
x86: remove subarchitecture support
x86/Voyager: clean up BROKEN Kconfig reference
x86: disable Voyager temporarily
x86/Voyager: remove MCA Kconfig quirk
x86/Voyager: remove NATSEMI Kconfig quirk
x86/Voyager: remove KVM Kconfig quirk
x86/Voyager: remove KGDB Kconfig quirk
x86/Voyager: remove HIBERNATION Kconfig quirk
x86/Voyager: remove ARCH_SUSPEND_POSSIBLE Kconfig quirk
x86: replace CONFIG_X86_SMP with CONFIG_SMP
x86: generalize boot_cpu_id
x86/Voyager: remove X86_HT Kconfig quirk
x86/Voyager: remove X86_BIOS_REBOOT Kconfig quirk
x86/Voyager: remove X86_FIND_SMP_CONFIG Kconfig quirk x86/VisWS: remove Kconfig quirk
x86/Voyager: remove VMI Kconfig quirk
x86/Voyager: remove KVM_CLOCK quirk
x86/Voyager: remove KVM_GUEST quirk
x86/Voyager: remove PARAVIRT Kconfig quirk
x86/Voyager: remove APIC/IO-APIC Kbuild quirk
x86/Voyager: remove MCE quirk
x86/Voyager: remove HOTPLUG_CPU Kconfig quirk
x86/Voyager: remove power management Kconfig quirk
x86/Voyager: remove ISA quirk
x86: cleanup, introduce CONFIG_NON_STANDARD_PLATFORMS
x86: move ELAN to the NON_STANDARD_PLATFORM section
x86: move VOYAGER to the NON_STANDARD_PLATFORM section
x86: move non-standard 32-bit platform Kconfig entries
x86: move X86_VSMP from subarch menu
x86: remove the subarch menu
x86: rename X86_GENERICARCH to X86_32_NON_STANDARD
x86/Voyager: move to the X86_32_NON_STANDARD code section

#1 lore raw

PATCH 1/114 x86, genapic: refactor genapic_64.h

Impact: pre unification cleanup

Make genapic_64.h similar to genapic_32.h: reorder fields, unify types and bring in new entries.

No existing functionality is affected.

---
 arch/x86/include/asm/genapic_64.h |   68 ++++++++++++++++++++++++++++++++-----
 1 files changed, 59 insertions(+), 9 deletions(-)
arch/x86/include/asm/genapic_64.h +59 -9
index 7bb092c..0a5f712 100644
@@ -16,13 +16,62 @@
 
 struct genapic {
 	char *name;
+
+	int (*probe)(void);
 	int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
+	int (*apic_id_registered)(void);
+
 	u32 int_delivery_mode;
 	u32 int_dest_mode;
-	int (*apic_id_registered)(void);
+
 	const struct cpumask *(*target_cpus)(void);
+
+	int ESR_DISABLE;
+
+	int apic_destination_logical;
+	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
+	unsigned long (*check_apicid_present)(int apicid);
+
+	int no_balance_irq;
+	int no_ioapic_check;
+
 	void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
 	void (*init_apic_ldr)(void);
+
+	physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
+
+	void (*setup_apic_routing)(void);
+	int (*multi_timer_check)(int apic, int irq);
+	int (*apicid_to_node)(int logical_apicid);
+	int (*cpu_to_logical_apicid)(int cpu);
+	int (*cpu_present_to_apicid)(int mps_cpu);
+	physid_mask_t (*apicid_to_cpu_present)(int phys_apicid);
+	void (*setup_portio_remap)(void);
+	int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
+	void (*enable_apic_mode)(void);
+#ifdef CONFIG_X86_32
+	u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
+#else
+	unsigned int (*phys_pkg_id)(int index_msb);
+#endif
+
+	/*
+	 * When one of the next two hooks returns 1 the genapic
+	 * is switched to this. Essentially they are additional
+	 * probe functions:
+	 */
+	int (*mps_oem_check)(struct mpc_table *mpc, char *oem,
+			     char *productid);
+
+	unsigned int (*get_apic_id)(unsigned long x);
+	unsigned long (*set_apic_id)(unsigned int id);
+	unsigned long apic_id_mask;
+
+	unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
+	unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
+					       const struct cpumask *andmask);
+
+#ifdef CONFIG_SMP
 	/* ipi */
 	void (*send_IPI_mask)(const struct cpumask *mask, int vector);
 	void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
@@ -30,16 +79,17 @@ struct genapic {
 	void (*send_IPI_allbutself)(int vector);
 	void (*send_IPI_all)(int vector);
 	void (*send_IPI_self)(int vector);
-	/* */
-	unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
-	unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
-					       const struct cpumask *andmask);
-	unsigned int (*phys_pkg_id)(int index_msb);
-	unsigned int (*get_apic_id)(unsigned long x);
-	unsigned long (*set_apic_id)(unsigned int id);
-	unsigned long apic_id_mask;
+#endif
 	/* wakeup_secondary_cpu */
 	int (*wakeup_cpu)(int apicid, unsigned long start_eip);
+
+	int trampoline_phys_low;
+	int trampoline_phys_high;
+	void (*wait_for_init_deassert)(atomic_t *deassert);
+	void (*smp_callin_clear_local_apic)(void);
+	void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
+	void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
+	void (*inquire_remote_apic)(int apicid);
 };
 
 extern struct genapic *genapic;
Signature · 1 line
1.6.0.2
#2 lore raw

PATCH 2/114 x86, genapic: refactor genapic_32.h

In reply to Ingo Molnar

Impact: pre unification cleanup

Make genapic_32.h similar to genapic_64.h: reorder fields, unify types and bring in new entries.

No existing functionality is affected.

---
 arch/x86/include/asm/genapic_32.h |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)
arch/x86/include/asm/genapic_32.h +27 -10
index 4334502..5808b7d 100644
@@ -21,19 +21,28 @@ struct mpc_cpu;
 
 struct genapic {
 	char *name;
-	int (*probe)(void);
 
+	int (*probe)(void);
+	int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
 	int (*apic_id_registered)(void);
+
+	u32 int_delivery_mode;
+	u32 int_dest_mode;
+
 	const struct cpumask *(*target_cpus)(void);
-	int int_delivery_mode;
-	int int_dest_mode;
+
 	int ESR_DISABLE;
+
 	int apic_destination_logical;
 	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
 	unsigned long (*check_apicid_present)(int apicid);
+
 	int no_balance_irq;
 	int no_ioapic_check;
+
+	void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
 	void (*init_apic_ldr)(void);
+
 	physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
 
 	void (*setup_apic_routing)(void);
@@ -45,22 +54,27 @@ struct genapic {
 	void (*setup_portio_remap)(void);
 	int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
 	void (*enable_apic_mode)(void);
+#ifdef CONFIG_X86_32
 	u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
+#else
+	unsigned int (*phys_pkg_id)(int index_msb);
+#endif
 
-	/* mpparse */
-	/* When one of the next two hooks returns 1 the genapic
-	   is switched to this. Essentially they are additional probe
-	   functions. */
+	/*
+	 * When one of the next two hooks returns 1 the genapic
+	 * is switched to this. Essentially they are additional
+	 * probe functions:
+	 */
 	int (*mps_oem_check)(struct mpc_table *mpc, char *oem,
 			     char *productid);
-	int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
 
-	unsigned (*get_apic_id)(unsigned long x);
+	unsigned int (*get_apic_id)(unsigned long x);
+	unsigned long (*set_apic_id)(unsigned int id);
 	unsigned long apic_id_mask;
+
 	unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
 	unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
 					       const struct cpumask *andmask);
-	void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
 
 #ifdef CONFIG_SMP
 	/* ipi */
@@ -69,8 +83,11 @@ struct genapic {
 					 int vector);
 	void (*send_IPI_allbutself)(int vector);
 	void (*send_IPI_all)(int vector);
+	void (*send_IPI_self)(int vector);
 #endif
+	/* wakeup_secondary_cpu */
 	int (*wakeup_cpu)(int apicid, unsigned long start_eip);
+
 	int trampoline_phys_low;
 	int trampoline_phys_high;
 	void (*wait_for_init_deassert)(atomic_t *deassert);
Signature · 1 line
1.6.0.2
#3 lore raw

PATCH 3/114 x86, genapic: unify struct genapic

In reply to Ingo Molnar

Move over the (now identical) struct genapic definitions from genapic_32/64.h to genapic.h.

---
 arch/x86/include/asm/genapic.h    |   96 +++++++++++++++++++++++++++
 arch/x86/include/asm/genapic_32.h |   93 --------------------------
 arch/x86/include/asm/genapic_64.h |  129 ++++++-------------------------------
 3 files changed, 115 insertions(+), 203 deletions(-)

rewrite arch/x86/include/asm/genapic_64.h (84%)

arch/x86/include/asm/genapic.h +96 -0
index d48bee6..3dea66a 100644
@@ -1,5 +1,101 @@
+#ifndef _ASM_X86_GENAPIC_H
+#define _ASM_X86_GENAPIC_H
+
+#include <linux/cpumask.h>
+
+/*
+ * Copyright 2004 James Cleverdon, IBM.
+ * Subject to the GNU Public License, v.2
+ *
+ * Generic APIC sub-arch data struct.
+ *
+ * Hacked for x86-64 by James Cleverdon from i386 architecture code by
+ * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
+ * James Cleverdon.
+ */
+
+struct genapic {
+	char *name;
+
+	int (*probe)(void);
+	int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
+	int (*apic_id_registered)(void);
+
+	u32 int_delivery_mode;
+	u32 int_dest_mode;
+
+	const struct cpumask *(*target_cpus)(void);
+
+	int ESR_DISABLE;
+
+	int apic_destination_logical;
+	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
+	unsigned long (*check_apicid_present)(int apicid);
+
+	int no_balance_irq;
+	int no_ioapic_check;
+
+	void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
+	void (*init_apic_ldr)(void);
+
+	physid_mask_t (*ioapic_phys_id_map)(physid_mask_t map);
+
+	void (*setup_apic_routing)(void);
+	int (*multi_timer_check)(int apic, int irq);
+	int (*apicid_to_node)(int logical_apicid);
+	int (*cpu_to_logical_apicid)(int cpu);
+	int (*cpu_present_to_apicid)(int mps_cpu);
+	physid_mask_t (*apicid_to_cpu_present)(int phys_apicid);
+	void (*setup_portio_remap)(void);
+	int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
+	void (*enable_apic_mode)(void);
+#ifdef CONFIG_X86_32
+	u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
+#else
+	unsigned int (*phys_pkg_id)(int index_msb);
+#endif
+
+	/*
+	 * When one of the next two hooks returns 1 the genapic
+	 * is switched to this. Essentially they are additional
+	 * probe functions:
+	 */
+	int (*mps_oem_check)(struct mpc_table *mpc, char *oem,
+			     char *productid);
+
+	unsigned int (*get_apic_id)(unsigned long x);
+	unsigned long (*set_apic_id)(unsigned int id);
+	unsigned long apic_id_mask;
+
+	unsigned int (*cpu_mask_to_apicid)(const struct cpumask *cpumask);
+	unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
+					       const struct cpumask *andmask);
+
+#ifdef CONFIG_SMP
+	/* ipi */
+	void (*send_IPI_mask)(const struct cpumask *mask, int vector);
+	void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
+					 int vector);
+	void (*send_IPI_allbutself)(int vector);
+	void (*send_IPI_all)(int vector);
+	void (*send_IPI_self)(int vector);
+#endif
+	/* wakeup_secondary_cpu */
+	int (*wakeup_cpu)(int apicid, unsigned long start_eip);
+
+	int trampoline_phys_low;
+	int trampoline_phys_high;
+	void (*wait_for_init_deassert)(atomic_t *deassert);
+	void (*smp_callin_clear_local_apic)(void);
+	void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
+	void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
+	void (*inquire_remote_apic)(int apicid);
+};
+
 #ifdef CONFIG_X86_32
 # include "genapic_32.h"
 #else
 # include "genapic_64.h"
 #endif
+
+#endif /* _ASM_X86_GENAPIC_64_H */
arch/x86/include/asm/genapic_32.h +0 -93

99 lines not on this page · raw message

arch/x86/include/asm/genapic_64.h +19 -110

129 lines not on this page · raw message

Signature · 1 line
1.6.0.2
#4 lore raw

PATCH 4/114 x86, genapic: finish unification

In reply to Ingo Molnar

Unify remaining bits of genapic_32/64.h.

---
 arch/x86/include/asm/genapic.h    |   80 ++++++++++++++++++++++++++++++++++++-
 arch/x86/include/asm/genapic_32.h |   65 ------------------------------
 arch/x86/include/asm/genapic_64.h |   19 ---------
 3 files changed, 78 insertions(+), 86 deletions(-)
 delete mode 100644 arch/x86/include/asm/genapic_32.h
 delete mode 100644 arch/x86/include/asm/genapic_64.h
arch/x86/include/asm/genapic.h +78 -2
index 3dea66a..7df1b48 100644
@@ -93,9 +93,85 @@ struct genapic {
 };
 
 #ifdef CONFIG_X86_32
-# include "genapic_32.h"
+
+#include <asm/mpspec.h>
+#include <asm/atomic.h>
+
+#define APICFUNC(x) .x = x,
+
+/* More functions could be probably marked IPIFUNC and save some space
+   in UP GENERICARCH kernels, but I don't have the nerve right now
+   to untangle this mess. -AK  */
+#ifdef CONFIG_SMP
+#define IPIFUNC(x) APICFUNC(x)
 #else
-# include "genapic_64.h"
+#define IPIFUNC(x)
 #endif
 
+#define APIC_INIT(aname, aprobe)			\
+{							\
+	.name = aname,					\
+	.probe = aprobe,				\
+	.int_delivery_mode = INT_DELIVERY_MODE,		\
+	.int_dest_mode = INT_DEST_MODE,			\
+	.no_balance_irq = NO_BALANCE_IRQ,		\
+	.ESR_DISABLE = esr_disable,			\
+	.apic_destination_logical = APIC_DEST_LOGICAL,	\
+	APICFUNC(apic_id_registered)			\
+	APICFUNC(target_cpus)				\
+	APICFUNC(check_apicid_used)			\
+	APICFUNC(check_apicid_present)			\
+	APICFUNC(init_apic_ldr)				\
+	APICFUNC(ioapic_phys_id_map)			\
+	APICFUNC(setup_apic_routing)			\
+	APICFUNC(multi_timer_check)			\
+	APICFUNC(apicid_to_node)			\
+	APICFUNC(cpu_to_logical_apicid)			\
+	APICFUNC(cpu_present_to_apicid)			\
+	APICFUNC(apicid_to_cpu_present)			\
+	APICFUNC(setup_portio_remap)			\
+	APICFUNC(check_phys_apicid_present)		\
+	APICFUNC(mps_oem_check)				\
+	APICFUNC(get_apic_id)				\
+	.apic_id_mask = APIC_ID_MASK,			\
+	APICFUNC(cpu_mask_to_apicid)			\
+	APICFUNC(cpu_mask_to_apicid_and)		\
+	APICFUNC(vector_allocation_domain)		\
+	APICFUNC(acpi_madt_oem_check)			\
+	IPIFUNC(send_IPI_mask)				\
+	IPIFUNC(send_IPI_allbutself)			\
+	IPIFUNC(send_IPI_all)				\
+	APICFUNC(enable_apic_mode)			\
+	APICFUNC(phys_pkg_id)				\
+	.trampoline_phys_low = TRAMPOLINE_PHYS_LOW,		\
+	.trampoline_phys_high = TRAMPOLINE_PHYS_HIGH,		\
+	APICFUNC(wait_for_init_deassert)		\
+	APICFUNC(smp_callin_clear_local_apic)		\
+	APICFUNC(store_NMI_vector)			\
+	APICFUNC(restore_NMI_vector)			\
+	APICFUNC(inquire_remote_apic)			\
+}
+
+extern struct genapic *genapic;
+extern void es7000_update_genapic_to_cluster(void);
+
+#else /* CONFIG_X86_64: */
+
+extern struct genapic *genapic;
+
+extern struct genapic apic_flat;
+extern struct genapic apic_physflat;
+extern struct genapic apic_x2apic_cluster;
+extern struct genapic apic_x2apic_phys;
+extern int acpi_madt_oem_check(char *, char *);
+
+extern void apic_send_IPI_self(int vector);
+
+extern struct genapic apic_x2apic_uv_x;
+DECLARE_PER_CPU(int, x2apic_extra_bits);
+
+extern void setup_apic_routing(void);
+
+#endif /* CONFIG_X86_64 */
+
 #endif /* _ASM_X86_GENAPIC_64_H */
arch/x86/include/asm/genapic_32.h deleted +0 -65

65 lines not on this page · raw message

arch/x86/include/asm/genapic_64.h deleted +0 -19
deleted file mode 100644
index c70ca0d..0000000
@@ -1,19 +0,0 @@
-#ifndef _ASM_X86_GENAPIC_64_H
-#define _ASM_X86_GENAPIC_64_H
-
-extern struct genapic *genapic;
-
-extern struct genapic apic_flat;
-extern struct genapic apic_physflat;
-extern struct genapic apic_x2apic_cluster;
-extern struct genapic apic_x2apic_phys;
-extern int acpi_madt_oem_check(char *, char *);
-
-extern void apic_send_IPI_self(int vector);
-
-extern struct genapic apic_x2apic_uv_x;
-DECLARE_PER_CPU(int, x2apic_extra_bits);
-
-extern void setup_apic_routing(void);
-
-#endif /* _ASM_X86_GENAPIC_64_H */
Signature · 1 line
1.6.0.2
#5 lore raw

PATCH 5/114 x86, genapic: cleanups

In reply to Ingo Molnar

Unify genapic.h some more.

---
 arch/x86/include/asm/genapic.h |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)
arch/x86/include/asm/genapic.h +8 -9
index 7df1b48..19a5193 100644
@@ -3,6 +3,9 @@
 
 #include <linux/cpumask.h>
 
+#include <asm/mpspec.h>
+#include <asm/atomic.h>
+
 /*
  * Copyright 2004 James Cleverdon, IBM.
  * Subject to the GNU Public License, v.2
@@ -13,7 +16,6 @@
  * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
  * James Cleverdon.
  */
-
 struct genapic {
 	char *name;
 
@@ -85,6 +87,7 @@ struct genapic {
 
 	int trampoline_phys_low;
 	int trampoline_phys_high;
+
 	void (*wait_for_init_deassert)(atomic_t *deassert);
 	void (*smp_callin_clear_local_apic)(void);
 	void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
@@ -92,10 +95,9 @@ struct genapic {
 	void (*inquire_remote_apic)(int apicid);
 };
 
-#ifdef CONFIG_X86_32
+extern struct genapic *genapic;
 
-#include <asm/mpspec.h>
-#include <asm/atomic.h>
+#ifdef CONFIG_X86_32
 
 #define APICFUNC(x) .x = x,
 
@@ -143,8 +145,8 @@ struct genapic {
 	IPIFUNC(send_IPI_all)				\
 	APICFUNC(enable_apic_mode)			\
 	APICFUNC(phys_pkg_id)				\
-	.trampoline_phys_low = TRAMPOLINE_PHYS_LOW,		\
-	.trampoline_phys_high = TRAMPOLINE_PHYS_HIGH,		\
+	.trampoline_phys_low = TRAMPOLINE_PHYS_LOW,	\
+	.trampoline_phys_high = TRAMPOLINE_PHYS_HIGH,	\
 	APICFUNC(wait_for_init_deassert)		\
 	APICFUNC(smp_callin_clear_local_apic)		\
 	APICFUNC(store_NMI_vector)			\
@@ -152,13 +154,10 @@ struct genapic {
 	APICFUNC(inquire_remote_apic)			\
 }
 
-extern struct genapic *genapic;
 extern void es7000_update_genapic_to_cluster(void);
 
 #else /* CONFIG_X86_64: */
 
-extern struct genapic *genapic;
-
 extern struct genapic apic_flat;
 extern struct genapic apic_physflat;
 extern struct genapic apic_x2apic_cluster;
Signature · 1 line
1.6.0.2
#6 lore raw

PATCH 6/114 x86, genapic: provide IPI callbacks unconditionally

In reply to Ingo Molnar

64-bit x86 uses the IPI callbacks even on UP - so provide them generally.

---
 arch/x86/include/asm/genapic.h |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
arch/x86/include/asm/genapic.h +1 -2
index 19a5193..c27efde 100644
@@ -73,7 +73,6 @@ struct genapic {
 	unsigned int (*cpu_mask_to_apicid_and)(const struct cpumask *cpumask,
 					       const struct cpumask *andmask);
 
-#ifdef CONFIG_SMP
 	/* ipi */
 	void (*send_IPI_mask)(const struct cpumask *mask, int vector);
 	void (*send_IPI_mask_allbutself)(const struct cpumask *mask,
@@ -81,7 +80,7 @@ struct genapic {
 	void (*send_IPI_allbutself)(int vector);
 	void (*send_IPI_all)(int vector);
 	void (*send_IPI_self)(int vector);
-#endif
+
 	/* wakeup_secondary_cpu */
 	int (*wakeup_cpu)(int apicid, unsigned long start_eip);
 
Signature · 1 line
1.6.0.2
#7 lore raw

PATCH 7/114 x86: rename 'genapic' to 'apic'

In reply to Ingo Molnar

Rename genapic-> to apic-> references because in a future chagne we'll open-code all the indirect calls (instead of obscuring them via macros), so we want this reference to be as short as possible.

---
 arch/x86/include/asm/genapic.h                   |    2 +-
 arch/x86/include/asm/mach-default/mach_apic.h    |   22 +++---
 arch/x86/include/asm/mach-default/mach_apicdef.h |    6 +-
 arch/x86/include/asm/mach-default/mach_ipi.h     |    8 +-
 arch/x86/include/asm/mach-generic/mach_apic.h    |   70 ++++++++++----------
 arch/x86/include/asm/mach-generic/mach_apicdef.h |    4 +-
 arch/x86/include/asm/mach-generic/mach_ipi.h     |    6 +-
 arch/x86/include/asm/mach-generic/mach_wakecpu.h |   24 +++---
 arch/x86/kernel/es7000_32.c                      |    6 +-
 arch/x86/kernel/genapic_64.c                     |   16 ++--
 arch/x86/kernel/io_apic.c                        |   80 +++++++++++-----------
 arch/x86/kernel/numaq_32.c                       |    2 +-
 arch/x86/kernel/setup.c                          |    2 +-
 arch/x86/mach-generic/es7000.c                   |   12 ++--
 arch/x86/mach-generic/probe.c                    |   24 +++---
 15 files changed, 142 insertions(+), 142 deletions(-)

rewrite arch/x86/include/asm/mach-generic/mach_apic.h (86%) rewrite arch/x86/include/asm/mach-generic/mach_wakecpu.h (75%)

arch/x86/include/asm/genapic.h +1 -1
index c27efde..3970da3 100644
@@ -94,7 +94,7 @@ struct genapic {
 	void (*inquire_remote_apic)(int apicid);
 };
 
-extern struct genapic *genapic;
+extern struct genapic *apic;
 
 #ifdef CONFIG_X86_32
 
arch/x86/include/asm/mach-default/mach_apic.h +11 -11
index cc09cbb..2448b92 100644
@@ -22,18 +22,18 @@ static inline const struct cpumask *target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define INT_DELIVERY_MODE (genapic->int_delivery_mode)
-#define INT_DEST_MODE (genapic->int_dest_mode)
-#define TARGET_CPUS	  (genapic->target_cpus())
-#define apic_id_registered (genapic->apic_id_registered)
-#define init_apic_ldr (genapic->init_apic_ldr)
-#define cpu_mask_to_apicid (genapic->cpu_mask_to_apicid)
-#define cpu_mask_to_apicid_and (genapic->cpu_mask_to_apicid_and)
-#define phys_pkg_id	(genapic->phys_pkg_id)
-#define vector_allocation_domain    (genapic->vector_allocation_domain)
+#define INT_DELIVERY_MODE (apic->int_delivery_mode)
+#define INT_DEST_MODE (apic->int_dest_mode)
+#define TARGET_CPUS	  (apic->target_cpus())
+#define apic_id_registered (apic->apic_id_registered)
+#define init_apic_ldr (apic->init_apic_ldr)
+#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
+#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
+#define phys_pkg_id	(apic->phys_pkg_id)
+#define vector_allocation_domain    (apic->vector_allocation_domain)
 #define read_apic_id()  (GET_APIC_ID(apic_read(APIC_ID)))
-#define send_IPI_self (genapic->send_IPI_self)
-#define wakeup_secondary_cpu (genapic->wakeup_cpu)
+#define send_IPI_self (apic->send_IPI_self)
+#define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void setup_apic_routing(void);
 #else
 #define INT_DELIVERY_MODE dest_LowestPrio
arch/x86/include/asm/mach-default/mach_apicdef.h +3 -3
index 5317993..b4dcc09 100644
@@ -4,9 +4,9 @@
 #include <asm/apic.h>
 
 #ifdef CONFIG_X86_64
-#define	APIC_ID_MASK		(genapic->apic_id_mask)
-#define GET_APIC_ID(x)		(genapic->get_apic_id(x))
-#define	SET_APIC_ID(x)		(genapic->set_apic_id(x))
+#define	APIC_ID_MASK		(apic->apic_id_mask)
+#define GET_APIC_ID(x)		(apic->get_apic_id(x))
+#define	SET_APIC_ID(x)		(apic->set_apic_id(x))
 #else
 #define		APIC_ID_MASK		(0xF<<24)
 static inline unsigned get_apic_id(unsigned long x) 
arch/x86/include/asm/mach-default/mach_ipi.h +4 -4
index 191312d..0893996 100644
@@ -12,8 +12,8 @@ extern int no_broadcast;
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define send_IPI_mask (genapic->send_IPI_mask)
-#define send_IPI_mask_allbutself (genapic->send_IPI_mask_allbutself)
+#define send_IPI_mask (apic->send_IPI_mask)
+#define send_IPI_mask_allbutself (apic->send_IPI_mask_allbutself)
 #else
 static inline void send_IPI_mask(const struct cpumask *mask, int vector)
 {
@@ -39,8 +39,8 @@ static inline void __local_send_IPI_all(int vector)
 }
 
 #ifdef CONFIG_X86_64
-#define send_IPI_allbutself (genapic->send_IPI_allbutself)
-#define send_IPI_all (genapic->send_IPI_all)
+#define send_IPI_allbutself (apic->send_IPI_allbutself)
+#define send_IPI_all (apic->send_IPI_all)
 #else
 static inline void send_IPI_allbutself(int vector)
 {
arch/x86/include/asm/mach-generic/mach_apic.h +35 -35

70 lines not on this page · raw message

arch/x86/include/asm/mach-generic/mach_apicdef.h +2 -2
index 68041f3..acc9add 100644
@@ -4,8 +4,8 @@
 #ifndef APIC_DEFINITION
 #include <asm/genapic.h>
 
-#define GET_APIC_ID (genapic->get_apic_id)
-#define APIC_ID_MASK (genapic->apic_id_mask)
+#define GET_APIC_ID (apic->get_apic_id)
+#define APIC_ID_MASK (apic->apic_id_mask)
 #endif
 
 #endif /* _ASM_X86_MACH_GENERIC_MACH_APICDEF_H */
arch/x86/include/asm/mach-generic/mach_ipi.h +3 -3
index ffd637e..75e54bd 100644
@@ -3,8 +3,8 @@
 
 #include <asm/genapic.h>
 
-#define send_IPI_mask (genapic->send_IPI_mask)
-#define send_IPI_allbutself (genapic->send_IPI_allbutself)
-#define send_IPI_all (genapic->send_IPI_all)
+#define send_IPI_mask (apic->send_IPI_mask)
+#define send_IPI_allbutself (apic->send_IPI_allbutself)
+#define send_IPI_all (apic->send_IPI_all)
 
 #endif /* _ASM_X86_MACH_GENERIC_MACH_IPI_H */
arch/x86/include/asm/mach-generic/mach_wakecpu.h +12 -12
dissimilarity index 75%
index 1ab16b1..22006bb 100644
@@ -1,12 +1,12 @@
-#ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
-#define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
-
-#define TRAMPOLINE_PHYS_LOW (genapic->trampoline_phys_low)
-#define TRAMPOLINE_PHYS_HIGH (genapic->trampoline_phys_high)
-#define wait_for_init_deassert (genapic->wait_for_init_deassert)
-#define smp_callin_clear_local_apic (genapic->smp_callin_clear_local_apic)
-#define store_NMI_vector (genapic->store_NMI_vector)
-#define restore_NMI_vector (genapic->restore_NMI_vector)
-#define inquire_remote_apic (genapic->inquire_remote_apic)
-
-#endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */
+#ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
+#define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
+
+#define TRAMPOLINE_PHYS_LOW (apic->trampoline_phys_low)
+#define TRAMPOLINE_PHYS_HIGH (apic->trampoline_phys_high)
+#define wait_for_init_deassert (apic->wait_for_init_deassert)
+#define smp_callin_clear_local_apic (apic->smp_callin_clear_local_apic)
+#define store_NMI_vector (apic->store_NMI_vector)
+#define restore_NMI_vector (apic->restore_NMI_vector)
+#define inquire_remote_apic (apic->inquire_remote_apic)
+
+#endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */
arch/x86/kernel/es7000_32.c +3 -3
index 53699c9..20a2a43 100644
@@ -188,14 +188,14 @@ static void noop_wait_for_deassert(atomic_t *deassert_not_used)
 
 static int __init es7000_update_genapic(void)
 {
-	genapic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
+	apic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
 
 	/* MPENTIUMIII */
 	if (boot_cpu_data.x86 == 6 &&
 	    (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) {
 		es7000_update_genapic_to_cluster();
-		genapic->wait_for_init_deassert = noop_wait_for_deassert;
-		genapic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
+		apic->wait_for_init_deassert = noop_wait_for_deassert;
+		apic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
 	}
 
 	return 0;
arch/x86/kernel/genapic_64.c +8 -8
index e656c27..2b98638 100644
@@ -29,7 +29,7 @@ extern struct genapic apic_x2xpic_uv_x;
 extern struct genapic apic_x2apic_phys;
 extern struct genapic apic_x2apic_cluster;
 
-struct genapic __read_mostly *genapic = &apic_flat;
+struct genapic __read_mostly *apic = &apic_flat;
 
 static struct genapic *apic_probe[] __initdata = {
 #ifdef CONFIG_X86_UV
@@ -46,15 +46,15 @@ static struct genapic *apic_probe[] __initdata = {
  */
 void __init setup_apic_routing(void)
 {
-	if (genapic == &apic_x2apic_phys || genapic == &apic_x2apic_cluster) {
+	if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) {
 		if (!intr_remapping_enabled)
-			genapic = &apic_flat;
+			apic = &apic_flat;
 	}
 
-	if (genapic == &apic_flat) {
+	if (apic == &apic_flat) {
 		if (max_physical_apicid >= 8)
-			genapic = &apic_physflat;
-		printk(KERN_INFO "Setting APIC routing to %s\n", genapic->name);
+			apic = &apic_physflat;
+		printk(KERN_INFO "Setting APIC routing to %s\n", apic->name);
 	}
 
 	if (x86_quirks->update_genapic)
@@ -74,9 +74,9 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 
 	for (i = 0; apic_probe[i]; ++i) {
 		if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
-			genapic = apic_probe[i];
+			apic = apic_probe[i];
 			printk(KERN_INFO "Setting APIC routing to %s.\n",
-				genapic->name);
+				apic->name);
 			return 1;
 		}
 	}
arch/x86/kernel/io_apic.c +40 -40

230 lines not on this page · raw message

arch/x86/kernel/numaq_32.c +1 -1
index f2191d4..3928280 100644
@@ -236,7 +236,7 @@ static int __init numaq_setup_ioapic_ids(void)
 
 static int __init numaq_update_genapic(void)
 {
-	genapic->wakeup_cpu = wakeup_secondary_cpu_via_nmi;
+	apic->wakeup_cpu = wakeup_secondary_cpu_via_nmi;
 
 	return 0;
 }
arch/x86/kernel/setup.c +1 -1
index f41c448..a58e9f5 100644
@@ -590,7 +590,7 @@ static int __init default_update_genapic(void)
 {
 #ifdef CONFIG_X86_SMP
 # if defined(CONFIG_X86_GENERICARCH) || defined(CONFIG_X86_64)
-	genapic->wakeup_cpu = wakeup_secondary_cpu_via_init;
+	apic->wakeup_cpu = wakeup_secondary_cpu_via_init;
 # endif
 #endif
 
arch/x86/mach-generic/es7000.c +6 -6
index c2ded14..2f4f4a6 100644
@@ -20,14 +20,14 @@
 
 void __init es7000_update_genapic_to_cluster(void)
 {
-	genapic->target_cpus = target_cpus_cluster;
-	genapic->int_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
-	genapic->int_dest_mode = INT_DEST_MODE_CLUSTER;
-	genapic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER;
+	apic->target_cpus = target_cpus_cluster;
+	apic->int_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
+	apic->int_dest_mode = INT_DEST_MODE_CLUSTER;
+	apic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER;
 
-	genapic->init_apic_ldr = init_apic_ldr_cluster;
+	apic->init_apic_ldr = init_apic_ldr_cluster;
 
-	genapic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
+	apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
 }
 
 static int probe_es7000(void)
arch/x86/mach-generic/probe.c +12 -12
index 15a38da..82bf0f5 100644
@@ -23,7 +23,7 @@ extern struct genapic apic_bigsmp;
 extern struct genapic apic_es7000;
 extern struct genapic apic_default;
 
-struct genapic *genapic = &apic_default;
+struct genapic *apic = &apic_default;
 
 static struct genapic *apic_probe[] __initdata = {
 #ifdef CONFIG_X86_NUMAQ
@@ -52,7 +52,7 @@ static int __init parse_apic(char *arg)
 
 	for (i = 0; apic_probe[i]; i++) {
 		if (!strcmp(apic_probe[i]->name, arg)) {
-			genapic = apic_probe[i];
+			apic = apic_probe[i];
 			cmdline_apic = 1;
 			return 0;
 		}
@@ -76,13 +76,13 @@ void __init generic_bigsmp_probe(void)
 	 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
 	 */
 
-	if (!cmdline_apic && genapic == &apic_default) {
+	if (!cmdline_apic && apic == &apic_default) {
 		if (apic_bigsmp.probe()) {
-			genapic = &apic_bigsmp;
+			apic = &apic_bigsmp;
 			if (x86_quirks->update_genapic)
 				x86_quirks->update_genapic();
 			printk(KERN_INFO "Overriding APIC driver with %s\n",
-			       genapic->name);
+			       apic->name);
 		}
 	}
 #endif
@@ -94,7 +94,7 @@ void __init generic_apic_probe(void)
 		int i;
 		for (i = 0; apic_probe[i]; i++) {
 			if (apic_probe[i]->probe()) {
-				genapic = apic_probe[i];
+				apic = apic_probe[i];
 				break;
 			}
 		}
@@ -105,7 +105,7 @@ void __init generic_apic_probe(void)
 		if (x86_quirks->update_genapic)
 			x86_quirks->update_genapic();
 	}
-	printk(KERN_INFO "Using APIC driver %s\n", genapic->name);
+	printk(KERN_INFO "Using APIC driver %s\n", apic->name);
 }
 
 /* These functions can switch the APIC even after the initial ->probe() */
@@ -116,11 +116,11 @@ int __init mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 	for (i = 0; apic_probe[i]; ++i) {
 		if (apic_probe[i]->mps_oem_check(mpc, oem, productid)) {
 			if (!cmdline_apic) {
-				genapic = apic_probe[i];
+				apic = apic_probe[i];
 				if (x86_quirks->update_genapic)
 					x86_quirks->update_genapic();
 				printk(KERN_INFO "Switched to APIC driver `%s'.\n",
-				       genapic->name);
+				       apic->name);
 			}
 			return 1;
 		}
@@ -134,11 +134,11 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 	for (i = 0; apic_probe[i]; ++i) {
 		if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
 			if (!cmdline_apic) {
-				genapic = apic_probe[i];
+				apic = apic_probe[i];
 				if (x86_quirks->update_genapic)
 					x86_quirks->update_genapic();
 				printk(KERN_INFO "Switched to APIC driver `%s'.\n",
-				       genapic->name);
+				       apic->name);
 			}
 			return 1;
 		}
@@ -148,5 +148,5 @@ int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 
 int hard_smp_processor_id(void)
 {
-	return genapic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID));
+	return apic->get_apic_id(*(unsigned long *)(APIC_BASE+APIC_ID));
 }
Signature · 1 line
1.6.0.2
#8 lore raw

PATCH 8/114 x86: clean up genapic_flat

In reply to Ingo Molnar

- reorder fields so that they appear in struct genapic field ordering

- add zero-initialized fields too so that it's apparent which functionality is default / missing.

---
 arch/x86/kernel/genapic_flat_64.c |   73 +++++++++++++++++++++++++++----------
 1 files changed, 54 insertions(+), 19 deletions(-)
arch/x86/kernel/genapic_flat_64.c +54 -19
index 3418548..f1bfdd3 100644
@@ -175,25 +175,60 @@ static unsigned int phys_pkg_id(int index_msb)
 }
 
 struct genapic apic_flat =  {
-	.name = "flat",
-	.acpi_madt_oem_check = flat_acpi_madt_oem_check,
-	.int_delivery_mode = dest_LowestPrio,
-	.int_dest_mode = (APIC_DEST_LOGICAL != 0),
-	.target_cpus = flat_target_cpus,
-	.vector_allocation_domain = flat_vector_allocation_domain,
-	.apic_id_registered = flat_apic_id_registered,
-	.init_apic_ldr = flat_init_apic_ldr,
-	.send_IPI_all = flat_send_IPI_all,
-	.send_IPI_allbutself = flat_send_IPI_allbutself,
-	.send_IPI_mask = flat_send_IPI_mask,
-	.send_IPI_mask_allbutself = flat_send_IPI_mask_allbutself,
-	.send_IPI_self = apic_send_IPI_self,
-	.cpu_mask_to_apicid = flat_cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and = flat_cpu_mask_to_apicid_and,
-	.phys_pkg_id = phys_pkg_id,
-	.get_apic_id = get_apic_id,
-	.set_apic_id = set_apic_id,
-	.apic_id_mask = (0xFFu<<24),
+	.name				= "flat",
+	.probe				= NULL,
+	.acpi_madt_oem_check		= flat_acpi_madt_oem_check,
+	.apic_id_registered		= flat_apic_id_registered,
+
+	.int_delivery_mode		= dest_LowestPrio,
+	.int_dest_mode			= (APIC_DEST_LOGICAL != 0),
+
+	.target_cpus			= flat_target_cpus,
+	.ESR_DISABLE			= 0,
+	.apic_destination_logical	= 0,
+	.check_apicid_used		= NULL,
+	.check_apicid_present		= NULL,
+
+	.no_balance_irq			= 0,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= flat_vector_allocation_domain,
+	.init_apic_ldr			= flat_init_apic_ldr,
+
+	.ioapic_phys_id_map		= NULL,
+	.setup_apic_routing		= NULL,
+	.multi_timer_check		= NULL,
+	.apicid_to_node			= NULL,
+	.cpu_to_logical_apicid		= NULL,
+	.cpu_present_to_apicid		= NULL,
+	.apicid_to_cpu_present		= NULL,
+	.setup_portio_remap		= NULL,
+	.check_phys_apicid_present	= NULL,
+	.enable_apic_mode		= NULL,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= NULL,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= set_apic_id,
+	.apic_id_mask			= 0xFFu << 24,
+
+	.cpu_mask_to_apicid		= flat_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= flat_cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= flat_send_IPI_mask,
+	.send_IPI_mask_allbutself	= flat_send_IPI_mask_allbutself,
+	.send_IPI_allbutself		= flat_send_IPI_allbutself,
+	.send_IPI_all			= flat_send_IPI_all,
+	.send_IPI_self			= apic_send_IPI_self,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= 0,
+	.trampoline_phys_high		= 0,
+	.wait_for_init_deassert		= NULL,
+	.smp_callin_clear_local_apic	= NULL,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
+	.inquire_remote_apic		= NULL,
 };
 
 /*
Signature · 1 line
1.6.0.2
#9 lore raw

PATCH 9/114 x86: clean up genapic_phys_flat

In reply to Ingo Molnar

- reorder fields so that they appear in struct genapic field ordering

- add zero-initialized fields too so that it's apparent which functionality is default / missing.

---
 arch/x86/kernel/genapic_flat_64.c |   75 +++++++++++++++++++++++++++---------
 1 files changed, 56 insertions(+), 19 deletions(-)
arch/x86/kernel/genapic_flat_64.c +56 -19
index f1bfdd3..e923337 100644
@@ -320,23 +320,60 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 }
 
 struct genapic apic_physflat =  {
-	.name = "physical flat",
-	.acpi_madt_oem_check = physflat_acpi_madt_oem_check,
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = (APIC_DEST_PHYSICAL != 0),
-	.target_cpus = physflat_target_cpus,
-	.vector_allocation_domain = physflat_vector_allocation_domain,
-	.apic_id_registered = flat_apic_id_registered,
-	.init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/
-	.send_IPI_all = physflat_send_IPI_all,
-	.send_IPI_allbutself = physflat_send_IPI_allbutself,
-	.send_IPI_mask = physflat_send_IPI_mask,
-	.send_IPI_mask_allbutself = physflat_send_IPI_mask_allbutself,
-	.send_IPI_self = apic_send_IPI_self,
-	.cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and = physflat_cpu_mask_to_apicid_and,
-	.phys_pkg_id = phys_pkg_id,
-	.get_apic_id = get_apic_id,
-	.set_apic_id = set_apic_id,
-	.apic_id_mask = (0xFFu<<24),
+
+	.name				= "physical flat",
+	.probe				= NULL,
+	.acpi_madt_oem_check		= physflat_acpi_madt_oem_check,
+	.apic_id_registered		= flat_apic_id_registered,
+
+	.int_delivery_mode		= dest_Fixed,
+	.int_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+
+	.target_cpus			= physflat_target_cpus,
+	.ESR_DISABLE			= 0,
+	.apic_destination_logical	= 0,
+	.check_apicid_used		= NULL,
+	.check_apicid_present		= NULL,
+
+	.no_balance_irq			= 0,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= physflat_vector_allocation_domain,
+	/* not needed, but shouldn't hurt: */
+	.init_apic_ldr			= flat_init_apic_ldr,
+
+	.ioapic_phys_id_map		= NULL,
+	.setup_apic_routing		= NULL,
+	.multi_timer_check		= NULL,
+	.apicid_to_node			= NULL,
+	.cpu_to_logical_apicid		= NULL,
+	.cpu_present_to_apicid		= NULL,
+	.apicid_to_cpu_present		= NULL,
+	.setup_portio_remap		= NULL,
+	.check_phys_apicid_present	= NULL,
+	.enable_apic_mode		= NULL,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= NULL,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= set_apic_id,
+	.apic_id_mask			= 0xFFu<<24,
+
+	.cpu_mask_to_apicid		= physflat_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= physflat_cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= physflat_send_IPI_mask,
+	.send_IPI_mask_allbutself	= physflat_send_IPI_mask_allbutself,
+	.send_IPI_allbutself		= physflat_send_IPI_allbutself,
+	.send_IPI_all			= physflat_send_IPI_all,
+	.send_IPI_self			= apic_send_IPI_self,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= 0,
+	.trampoline_phys_high		= 0,
+	.wait_for_init_deassert		= NULL,
+	.smp_callin_clear_local_apic	= NULL,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
+	.inquire_remote_apic		= NULL,
 };
Signature · 1 line
1.6.0.2
#10 lore raw

PATCH 10/114 x86: clean up apic_x2apic_uv_x

In reply to Ingo Molnar

- reorder fields so that they appear in struct genapic field ordering

- add zero-initialized fields too so that it's apparent which functionality is default / missing.

---
 arch/x86/kernel/genx2apic_uv_x.c |   74 ++++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 19 deletions(-)
arch/x86/kernel/genx2apic_uv_x.c +55 -19
index bfe3624..94f606f 100644
@@ -237,25 +237,61 @@ static void uv_send_IPI_self(int vector)
 }
 
 struct genapic apic_x2apic_uv_x = {
-	.name = "UV large system",
-	.acpi_madt_oem_check = uv_acpi_madt_oem_check,
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = (APIC_DEST_PHYSICAL != 0),
-	.target_cpus = uv_target_cpus,
-	.vector_allocation_domain = uv_vector_allocation_domain,
-	.apic_id_registered = uv_apic_id_registered,
-	.init_apic_ldr = uv_init_apic_ldr,
-	.send_IPI_all = uv_send_IPI_all,
-	.send_IPI_allbutself = uv_send_IPI_allbutself,
-	.send_IPI_mask = uv_send_IPI_mask,
-	.send_IPI_mask_allbutself = uv_send_IPI_mask_allbutself,
-	.send_IPI_self = uv_send_IPI_self,
-	.cpu_mask_to_apicid = uv_cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and = uv_cpu_mask_to_apicid_and,
-	.phys_pkg_id = phys_pkg_id,
-	.get_apic_id = get_apic_id,
-	.set_apic_id = set_apic_id,
-	.apic_id_mask = (0xFFFFFFFFu),
+
+	.name				= "UV large system",
+	.probe				= NULL,
+	.acpi_madt_oem_check		= uv_acpi_madt_oem_check,
+	.apic_id_registered		= uv_apic_id_registered,
+
+	.int_delivery_mode		= dest_Fixed,
+	.int_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+
+	.target_cpus			= uv_target_cpus,
+	.ESR_DISABLE			= 0,
+	.apic_destination_logical	= 0,
+	.check_apicid_used		= NULL,
+	.check_apicid_present		= NULL,
+
+	.no_balance_irq			= 0,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= uv_vector_allocation_domain,
+	.init_apic_ldr			= uv_init_apic_ldr,
+
+	.ioapic_phys_id_map		= NULL,
+	.setup_apic_routing		= NULL,
+	.multi_timer_check		= NULL,
+	.apicid_to_node			= NULL,
+	.cpu_to_logical_apicid		= NULL,
+	.cpu_present_to_apicid		= NULL,
+	.apicid_to_cpu_present		= NULL,
+	.setup_portio_remap		= NULL,
+	.check_phys_apicid_present	= NULL,
+	.enable_apic_mode		= NULL,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= NULL,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= set_apic_id,
+	.apic_id_mask			= 0xFFFFFFFFu,
+
+	.cpu_mask_to_apicid		= uv_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= uv_cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= uv_send_IPI_mask,
+	.send_IPI_mask_allbutself	= uv_send_IPI_mask_allbutself,
+	.send_IPI_allbutself		= uv_send_IPI_allbutself,
+	.send_IPI_all			= uv_send_IPI_all,
+	.send_IPI_self			= uv_send_IPI_self,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= 0,
+	.trampoline_phys_high		= 0,
+	.wait_for_init_deassert		= NULL,
+	.smp_callin_clear_local_apic	= NULL,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
+	.inquire_remote_apic		= NULL,
 };
 
 static __cpuinit void set_x2apic_extra_bits(int pnode)
Signature · 1 line
1.6.0.2
#11 lore raw

PATCH 11/114 x86: clean up apic_x2apic_phys

In reply to Ingo Molnar

- reorder fields so that they appear in struct genapic field ordering

- add zero-initialized fields too so that it's apparent which functionality is default / missing.

---
 arch/x86/kernel/genx2apic_phys.c |   74 ++++++++++++++++++++++++++++----------
 1 files changed, 55 insertions(+), 19 deletions(-)
arch/x86/kernel/genx2apic_phys.c +55 -19
index 21bcc0e..c98361f 100644
@@ -172,23 +172,59 @@ static void init_x2apic_ldr(void)
 }
 
 struct genapic apic_x2apic_phys = {
-	.name = "physical x2apic",
-	.acpi_madt_oem_check = x2apic_acpi_madt_oem_check,
-	.int_delivery_mode = dest_Fixed,
-	.int_dest_mode = (APIC_DEST_PHYSICAL != 0),
-	.target_cpus = x2apic_target_cpus,
-	.vector_allocation_domain = x2apic_vector_allocation_domain,
-	.apic_id_registered = x2apic_apic_id_registered,
-	.init_apic_ldr = init_x2apic_ldr,
-	.send_IPI_all = x2apic_send_IPI_all,
-	.send_IPI_allbutself = x2apic_send_IPI_allbutself,
-	.send_IPI_mask = x2apic_send_IPI_mask,
-	.send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself,
-	.send_IPI_self = x2apic_send_IPI_self,
-	.cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and,
-	.phys_pkg_id = phys_pkg_id,
-	.get_apic_id = get_apic_id,
-	.set_apic_id = set_apic_id,
-	.apic_id_mask = (0xFFFFFFFFu),
+
+	.name				= "physical x2apic",
+	.probe				= NULL,
+	.acpi_madt_oem_check		= x2apic_acpi_madt_oem_check,
+	.apic_id_registered		= x2apic_apic_id_registered,
+
+	.int_delivery_mode		= dest_Fixed,
+	.int_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+
+	.target_cpus			= x2apic_target_cpus,
+	.ESR_DISABLE			= 0,
+	.apic_destination_logical	= 0,
+	.check_apicid_used		= NULL,
+	.check_apicid_present		= NULL,
+
+	.no_balance_irq			= 0,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= x2apic_vector_allocation_domain,
+	.init_apic_ldr			= init_x2apic_ldr,
+
+	.ioapic_phys_id_map		= NULL,
+	.setup_apic_routing		= NULL,
+	.multi_timer_check		= NULL,
+	.apicid_to_node			= NULL,
+	.cpu_to_logical_apicid		= NULL,
+	.cpu_present_to_apicid		= NULL,
+	.apicid_to_cpu_present		= NULL,
+	.setup_portio_remap		= NULL,
+	.check_phys_apicid_present	= NULL,
+	.enable_apic_mode		= NULL,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= NULL,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= set_apic_id,
+	.apic_id_mask			= 0xFFFFFFFFu,
+
+	.cpu_mask_to_apicid		= x2apic_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= x2apic_cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= x2apic_send_IPI_mask,
+	.send_IPI_mask_allbutself	= x2apic_send_IPI_mask_allbutself,
+	.send_IPI_allbutself		= x2apic_send_IPI_allbutself,
+	.send_IPI_all			= x2apic_send_IPI_all,
+	.send_IPI_self			= x2apic_send_IPI_self,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= 0,
+	.trampoline_phys_high		= 0,
+	.wait_for_init_deassert		= NULL,
+	.smp_callin_clear_local_apic	= NULL,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
+	.inquire_remote_apic		= NULL,
 };
Signature · 1 line
1.6.0.2
#12 lore raw

PATCH 12/114 x86: clean up apic_x2apic_cluster

In reply to Ingo Molnar

- reorder fields so that they appear in struct genapic field ordering

- add zero-initialized fields too so that it's apparent which functionality is default / missing.

---
 arch/x86/kernel/genx2apic_cluster.c |   74 ++++++++++++++++++++++++++---------
 1 files changed, 55 insertions(+), 19 deletions(-)
arch/x86/kernel/genx2apic_cluster.c +55 -19
index 6ce497c..fc855e5 100644
@@ -176,23 +176,59 @@ static void init_x2apic_ldr(void)
 }
 
 struct genapic apic_x2apic_cluster = {
-	.name = "cluster x2apic",
-	.acpi_madt_oem_check = x2apic_acpi_madt_oem_check,
-	.int_delivery_mode = dest_LowestPrio,
-	.int_dest_mode = (APIC_DEST_LOGICAL != 0),
-	.target_cpus = x2apic_target_cpus,
-	.vector_allocation_domain = x2apic_vector_allocation_domain,
-	.apic_id_registered = x2apic_apic_id_registered,
-	.init_apic_ldr = init_x2apic_ldr,
-	.send_IPI_all = x2apic_send_IPI_all,
-	.send_IPI_allbutself = x2apic_send_IPI_allbutself,
-	.send_IPI_mask = x2apic_send_IPI_mask,
-	.send_IPI_mask_allbutself = x2apic_send_IPI_mask_allbutself,
-	.send_IPI_self = x2apic_send_IPI_self,
-	.cpu_mask_to_apicid = x2apic_cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and = x2apic_cpu_mask_to_apicid_and,
-	.phys_pkg_id = phys_pkg_id,
-	.get_apic_id = get_apic_id,
-	.set_apic_id = set_apic_id,
-	.apic_id_mask = (0xFFFFFFFFu),
+
+	.name				= "cluster x2apic",
+	.probe				= NULL,
+	.acpi_madt_oem_check		= x2apic_acpi_madt_oem_check,
+	.apic_id_registered		= x2apic_apic_id_registered,
+
+	.int_delivery_mode		= dest_LowestPrio,
+	.int_dest_mode			= (APIC_DEST_LOGICAL != 0),
+
+	.target_cpus			= x2apic_target_cpus,
+	.ESR_DISABLE			= 0,
+	.apic_destination_logical	= 0,
+	.check_apicid_used		= NULL,
+	.check_apicid_present		= NULL,
+
+	.no_balance_irq			= 0,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= x2apic_vector_allocation_domain,
+	.init_apic_ldr			= init_x2apic_ldr,
+
+	.ioapic_phys_id_map		= NULL,
+	.setup_apic_routing		= NULL,
+	.multi_timer_check		= NULL,
+	.apicid_to_node			= NULL,
+	.cpu_to_logical_apicid		= NULL,
+	.cpu_present_to_apicid		= NULL,
+	.apicid_to_cpu_present		= NULL,
+	.setup_portio_remap		= NULL,
+	.check_phys_apicid_present	= NULL,
+	.enable_apic_mode		= NULL,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= NULL,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= set_apic_id,
+	.apic_id_mask			= 0xFFFFFFFFu,
+
+	.cpu_mask_to_apicid		= x2apic_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= x2apic_cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= x2apic_send_IPI_mask,
+	.send_IPI_mask_allbutself	= x2apic_send_IPI_mask_allbutself,
+	.send_IPI_allbutself		= x2apic_send_IPI_allbutself,
+	.send_IPI_all			= x2apic_send_IPI_all,
+	.send_IPI_self			= x2apic_send_IPI_self,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= 0,
+	.trampoline_phys_high		= 0,
+	.wait_for_init_deassert		= NULL,
+	.smp_callin_clear_local_apic	= NULL,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
+	.inquire_remote_apic		= NULL,
 };
Signature · 1 line
1.6.0.2
#13 lore raw

PATCH 13/114 x86, genapic: cleanup 32-bit apic_default template

In reply to Ingo Molnar

Clean up the APIC driver template:

- order fields properly
- use the macro names explicitly (so that they can be renamed later)
- fill in NULL entries as well

---
 arch/x86/mach-generic/default.c |   58 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
arch/x86/mach-generic/default.c +57 -1
index e63a4a7..d5fec76 100644
@@ -24,4 +24,60 @@ static int probe_default(void)
 	return 1;
 }
 
-struct genapic apic_default = APIC_INIT("default", probe_default);
+struct genapic apic_default = {
+
+	.name				= "default",
+	.probe				= probe_default,
+	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.apic_id_registered		= apic_id_registered,
+
+	.int_delivery_mode		= INT_DELIVERY_MODE,
+	.int_dest_mode			= INT_DEST_MODE,
+
+	.target_cpus			= target_cpus,
+	.ESR_DISABLE			= esr_disable,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.check_apicid_used		= check_apicid_used,
+	.check_apicid_present		= check_apicid_present,
+
+	.no_balance_irq			= NO_BALANCE_IRQ,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= vector_allocation_domain,
+	.init_apic_ldr			= init_apic_ldr,
+
+	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.setup_apic_routing		= setup_apic_routing,
+	.multi_timer_check		= multi_timer_check,
+	.apicid_to_node			= apicid_to_node,
+	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.setup_portio_remap		= setup_portio_remap,
+	.check_phys_apicid_present	= check_phys_apicid_present,
+	.enable_apic_mode		= enable_apic_mode,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= mps_oem_check,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= NULL,
+	.apic_id_mask			= APIC_ID_MASK,
+
+	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask_allbutself	= NULL,
+	.send_IPI_allbutself		= send_IPI_allbutself,
+	.send_IPI_all			= send_IPI_all,
+	.send_IPI_self			= NULL,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.wait_for_init_deassert		= wait_for_init_deassert,
+	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.store_NMI_vector		= store_NMI_vector,
+	.restore_NMI_vector		= restore_NMI_vector,
+	.inquire_remote_apic		= inquire_remote_apic,
+};
Signature · 1 line
1.6.0.2
#14 lore raw

PATCH 14/114 x86, genapic: cleanup 32-bit apic_bigsmp template

In reply to Ingo Molnar

Clean up the APIC driver template:

- order fields properly
- use the macro names explicitly (so that they can be renamed later)
- fill in NULL entries as well

---
 arch/x86/mach-generic/bigsmp.c |   58 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
arch/x86/mach-generic/bigsmp.c +57 -1
index bc4c784..13e82bc 100644
@@ -57,4 +57,60 @@ static int probe_bigsmp(void)
 	return dmi_bigsmp;
 }
 
-struct genapic apic_bigsmp = APIC_INIT("bigsmp", probe_bigsmp);
+struct genapic apic_bigsmp = {
+
+	.name				= "bigsmp",
+	.probe				= probe_bigsmp,
+	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.apic_id_registered		= apic_id_registered,
+
+	.int_delivery_mode		= INT_DELIVERY_MODE,
+	.int_dest_mode			= INT_DEST_MODE,
+
+	.target_cpus			= target_cpus,
+	.ESR_DISABLE			= esr_disable,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.check_apicid_used		= check_apicid_used,
+	.check_apicid_present		= check_apicid_present,
+
+	.no_balance_irq			= NO_BALANCE_IRQ,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= vector_allocation_domain,
+	.init_apic_ldr			= init_apic_ldr,
+
+	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.setup_apic_routing		= setup_apic_routing,
+	.multi_timer_check		= multi_timer_check,
+	.apicid_to_node			= apicid_to_node,
+	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.setup_portio_remap		= setup_portio_remap,
+	.check_phys_apicid_present	= check_phys_apicid_present,
+	.enable_apic_mode		= enable_apic_mode,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= mps_oem_check,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= NULL,
+	.apic_id_mask			= APIC_ID_MASK,
+
+	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask_allbutself	= NULL,
+	.send_IPI_allbutself		= send_IPI_allbutself,
+	.send_IPI_all			= send_IPI_all,
+	.send_IPI_self			= NULL,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.wait_for_init_deassert		= wait_for_init_deassert,
+	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.store_NMI_vector		= store_NMI_vector,
+	.restore_NMI_vector		= restore_NMI_vector,
+	.inquire_remote_apic		= inquire_remote_apic,
+};
Signature · 1 line
1.6.0.2
#15 lore raw

PATCH 15/114 x86, genapic: cleanup 32-bit apic_numaq template

In reply to Ingo Molnar

Clean up the APIC driver template:

- order fields properly
- use the macro names explicitly (so that they can be renamed later)
- fill in NULL entries as well

---
 arch/x86/mach-generic/numaq.c |   58 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
arch/x86/mach-generic/numaq.c +57 -1
index 3679e22..fa486ca 100644
@@ -50,4 +50,60 @@ static void vector_allocation_domain(int cpu, cpumask_t *retmask)
 	*retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
 }
 
-struct genapic apic_numaq = APIC_INIT("NUMAQ", probe_numaq);
+struct genapic apic_numaq = {
+
+	.name				= "NUMAQ",
+	.probe				= probe_numaq,
+	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.apic_id_registered		= apic_id_registered,
+
+	.int_delivery_mode		= INT_DELIVERY_MODE,
+	.int_dest_mode			= INT_DEST_MODE,
+
+	.target_cpus			= target_cpus,
+	.ESR_DISABLE			= esr_disable,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.check_apicid_used		= check_apicid_used,
+	.check_apicid_present		= check_apicid_present,
+
+	.no_balance_irq			= NO_BALANCE_IRQ,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= vector_allocation_domain,
+	.init_apic_ldr			= init_apic_ldr,
+
+	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.setup_apic_routing		= setup_apic_routing,
+	.multi_timer_check		= multi_timer_check,
+	.apicid_to_node			= apicid_to_node,
+	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.setup_portio_remap		= setup_portio_remap,
+	.check_phys_apicid_present	= check_phys_apicid_present,
+	.enable_apic_mode		= enable_apic_mode,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= mps_oem_check,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= NULL,
+	.apic_id_mask			= APIC_ID_MASK,
+
+	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask_allbutself	= NULL,
+	.send_IPI_allbutself		= send_IPI_allbutself,
+	.send_IPI_all			= send_IPI_all,
+	.send_IPI_self			= NULL,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.wait_for_init_deassert		= wait_for_init_deassert,
+	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.store_NMI_vector		= store_NMI_vector,
+	.restore_NMI_vector		= restore_NMI_vector,
+	.inquire_remote_apic		= inquire_remote_apic,
+};
Signature · 1 line
1.6.0.2
#16 lore raw

PATCH 16/114 x86, genapic: cleanup 32-bit apic_es7000 template

In reply to Ingo Molnar

Clean up the APIC driver template:

- order fields properly
- use the macro names explicitly (so that they can be renamed later)
- fill in NULL entries as well

---
 arch/x86/mach-generic/es7000.c |   58 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
arch/x86/mach-generic/es7000.c +57 -1
index 2f4f4a6..4a404ea 100644
@@ -100,4 +100,60 @@ static void vector_allocation_domain(int cpu, cpumask_t *retmask)
 	*retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
 }
 
-struct genapic __initdata_refok apic_es7000 = APIC_INIT("es7000", probe_es7000);
+struct genapic apic_es7000 = {
+
+	.name				= "es7000",
+	.probe				= probe_es7000,
+	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.apic_id_registered		= apic_id_registered,
+
+	.int_delivery_mode		= INT_DELIVERY_MODE,
+	.int_dest_mode			= INT_DEST_MODE,
+
+	.target_cpus			= target_cpus,
+	.ESR_DISABLE			= esr_disable,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.check_apicid_used		= check_apicid_used,
+	.check_apicid_present		= check_apicid_present,
+
+	.no_balance_irq			= NO_BALANCE_IRQ,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= vector_allocation_domain,
+	.init_apic_ldr			= init_apic_ldr,
+
+	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.setup_apic_routing		= setup_apic_routing,
+	.multi_timer_check		= multi_timer_check,
+	.apicid_to_node			= apicid_to_node,
+	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.setup_portio_remap		= setup_portio_remap,
+	.check_phys_apicid_present	= check_phys_apicid_present,
+	.enable_apic_mode		= enable_apic_mode,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= mps_oem_check,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= NULL,
+	.apic_id_mask			= APIC_ID_MASK,
+
+	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask_allbutself	= NULL,
+	.send_IPI_allbutself		= send_IPI_allbutself,
+	.send_IPI_all			= send_IPI_all,
+	.send_IPI_self			= NULL,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.wait_for_init_deassert		= wait_for_init_deassert,
+	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.store_NMI_vector		= store_NMI_vector,
+	.restore_NMI_vector		= restore_NMI_vector,
+	.inquire_remote_apic		= inquire_remote_apic,
+};
Signature · 1 line
1.6.0.2
#17 lore raw

PATCH 17/114 x86, genapic: cleanup 32-bit apic_summit template

In reply to Ingo Molnar

Clean up the APIC driver template:

- order fields properly
- use the macro names explicitly (so that they can be renamed later)
- fill in NULL entries as well

---
 arch/x86/mach-generic/summit.c |   58 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 57 insertions(+), 1 deletions(-)
arch/x86/mach-generic/summit.c +57 -1
index 2821ffc..479c1d4 100644
@@ -37,4 +37,60 @@ static void vector_allocation_domain(int cpu, cpumask_t *retmask)
 	*retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
 }
 
-struct genapic apic_summit = APIC_INIT("summit", probe_summit);
+struct genapic apic_summit = {
+
+	.name				= "summit",
+	.probe				= probe_summit,
+	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.apic_id_registered		= apic_id_registered,
+
+	.int_delivery_mode		= INT_DELIVERY_MODE,
+	.int_dest_mode			= INT_DEST_MODE,
+
+	.target_cpus			= target_cpus,
+	.ESR_DISABLE			= esr_disable,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.check_apicid_used		= check_apicid_used,
+	.check_apicid_present		= check_apicid_present,
+
+	.no_balance_irq			= NO_BALANCE_IRQ,
+	.no_ioapic_check		= 0,
+
+	.vector_allocation_domain	= vector_allocation_domain,
+	.init_apic_ldr			= init_apic_ldr,
+
+	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.setup_apic_routing		= setup_apic_routing,
+	.multi_timer_check		= multi_timer_check,
+	.apicid_to_node			= apicid_to_node,
+	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.setup_portio_remap		= setup_portio_remap,
+	.check_phys_apicid_present	= check_phys_apicid_present,
+	.enable_apic_mode		= enable_apic_mode,
+	.phys_pkg_id			= phys_pkg_id,
+	.mps_oem_check			= mps_oem_check,
+
+	.get_apic_id			= get_apic_id,
+	.set_apic_id			= NULL,
+	.apic_id_mask			= APIC_ID_MASK,
+
+	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+
+	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask_allbutself	= NULL,
+	.send_IPI_allbutself		= send_IPI_allbutself,
+	.send_IPI_all			= send_IPI_all,
+	.send_IPI_self			= NULL,
+
+	.wakeup_cpu			= NULL,
+	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.wait_for_init_deassert		= wait_for_init_deassert,
+	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.store_NMI_vector		= store_NMI_vector,
+	.restore_NMI_vector		= restore_NMI_vector,
+	.inquire_remote_apic		= inquire_remote_apic,
+};
Signature · 1 line
1.6.0.2
#18 lore raw

PATCH 18/114 x86: remove APIC_INIT / APICFUNC / IPIFUNC

In reply to Ingo Molnar

The APIC_INIT() / APICFUNC / IPIFUNC macros were ugly and obfuscated the true identity of various APIC driver methods.

Now that they are not used anymore, remove them.

---
 arch/x86/include/asm/genapic.h |   63 +--------------------------------------
 1 files changed, 2 insertions(+), 61 deletions(-)
arch/x86/include/asm/genapic.h +2 -61
index 3970da3..26c5e82 100644
@@ -97,66 +97,8 @@ struct genapic {
 extern struct genapic *apic;
 
 #ifdef CONFIG_X86_32
-
-#define APICFUNC(x) .x = x,
-
-/* More functions could be probably marked IPIFUNC and save some space
-   in UP GENERICARCH kernels, but I don't have the nerve right now
-   to untangle this mess. -AK  */
-#ifdef CONFIG_SMP
-#define IPIFUNC(x) APICFUNC(x)
-#else
-#define IPIFUNC(x)
-#endif
-
-#define APIC_INIT(aname, aprobe)			\
-{							\
-	.name = aname,					\
-	.probe = aprobe,				\
-	.int_delivery_mode = INT_DELIVERY_MODE,		\
-	.int_dest_mode = INT_DEST_MODE,			\
-	.no_balance_irq = NO_BALANCE_IRQ,		\
-	.ESR_DISABLE = esr_disable,			\
-	.apic_destination_logical = APIC_DEST_LOGICAL,	\
-	APICFUNC(apic_id_registered)			\
-	APICFUNC(target_cpus)				\
-	APICFUNC(check_apicid_used)			\
-	APICFUNC(check_apicid_present)			\
-	APICFUNC(init_apic_ldr)				\
-	APICFUNC(ioapic_phys_id_map)			\
-	APICFUNC(setup_apic_routing)			\
-	APICFUNC(multi_timer_check)			\
-	APICFUNC(apicid_to_node)			\
-	APICFUNC(cpu_to_logical_apicid)			\
-	APICFUNC(cpu_present_to_apicid)			\
-	APICFUNC(apicid_to_cpu_present)			\
-	APICFUNC(setup_portio_remap)			\
-	APICFUNC(check_phys_apicid_present)		\
-	APICFUNC(mps_oem_check)				\
-	APICFUNC(get_apic_id)				\
-	.apic_id_mask = APIC_ID_MASK,			\
-	APICFUNC(cpu_mask_to_apicid)			\
-	APICFUNC(cpu_mask_to_apicid_and)		\
-	APICFUNC(vector_allocation_domain)		\
-	APICFUNC(acpi_madt_oem_check)			\
-	IPIFUNC(send_IPI_mask)				\
-	IPIFUNC(send_IPI_allbutself)			\
-	IPIFUNC(send_IPI_all)				\
-	APICFUNC(enable_apic_mode)			\
-	APICFUNC(phys_pkg_id)				\
-	.trampoline_phys_low = TRAMPOLINE_PHYS_LOW,	\
-	.trampoline_phys_high = TRAMPOLINE_PHYS_HIGH,	\
-	APICFUNC(wait_for_init_deassert)		\
-	APICFUNC(smp_callin_clear_local_apic)		\
-	APICFUNC(store_NMI_vector)			\
-	APICFUNC(restore_NMI_vector)			\
-	APICFUNC(inquire_remote_apic)			\
-}
-
 extern void es7000_update_genapic_to_cluster(void);
-
-#else /* CONFIG_X86_64: */
-
+#else
 extern struct genapic apic_flat;
 extern struct genapic apic_physflat;
 extern struct genapic apic_x2apic_cluster;
@@ -169,7 +111,6 @@ extern struct genapic apic_x2apic_uv_x;
 DECLARE_PER_CPU(int, x2apic_extra_bits);
 
 extern void setup_apic_routing(void);
-
-#endif /* CONFIG_X86_64 */
+#endif
 
 #endif /* _ASM_X86_GENAPIC_64_H */
Signature · 1 line
1.6.0.2
#19 lore raw

PATCH 19/114 x86: clean up apic->acpi_madt_oem_check methods

In reply to Ingo Molnar

Impact: refactor code

x86 subarchitectures each defined a "acpi_madt_oem_check()" method, which could be an inline function, or an extern, or a static function, and which was also the name of a genapic field.

Untangle this namespace spaghetti by setting ->acpi_madt_oem_check() to NULL on those subarchitectures that have no detection quirks, and rename the other ones (summit, es7000) that do.

Also change default_acpi_madt_oem_check() to handle NULL entries, and clean its control flow up as well.

---
 arch/x86/include/asm/es7000/mpparse.h            |    2 +-
 arch/x86/include/asm/genapic.h                   |    2 +-
 arch/x86/include/asm/mach-default/mach_mpparse.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_mpparse.h |    2 +-
 arch/x86/include/asm/summit/mpparse.h            |    2 +-
 arch/x86/kernel/acpi/boot.c                      |    3 +-
 arch/x86/kernel/genapic_64.c                     |    2 +-
 arch/x86/mach-generic/bigsmp.c                   |    2 +-
 arch/x86/mach-generic/default.c                  |    2 +-
 arch/x86/mach-generic/es7000.c                   |    6 ++--
 arch/x86/mach-generic/numaq.c                    |    8 +------
 arch/x86/mach-generic/probe.c                    |   24 ++++++++++++---------
 arch/x86/mach-generic/summit.c                   |    2 +-
 13 files changed, 29 insertions(+), 30 deletions(-)
arch/x86/include/asm/es7000/mpparse.h +1 -1
index c1629b0..30692c4 100644
@@ -9,7 +9,7 @@ extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
 extern void setup_unisys(void);
 
 #ifndef CONFIG_X86_GENERICARCH
-extern int acpi_madt_oem_check(char *oem_id, char *oem_table_id);
+extern int default_acpi_madt_oem_check(char *oem_id, char *oem_table_id);
 extern int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid);
 #endif
 
arch/x86/include/asm/genapic.h +1 -1
index 26c5e82..108abdf 100644
@@ -103,7 +103,7 @@ extern struct genapic apic_flat;
 extern struct genapic apic_physflat;
 extern struct genapic apic_x2apic_cluster;
 extern struct genapic apic_x2apic_phys;
-extern int acpi_madt_oem_check(char *, char *);
+extern int default_acpi_madt_oem_check(char *, char *);
 
 extern void apic_send_IPI_self(int vector);
 
arch/x86/include/asm/mach-default/mach_mpparse.h +1 -1
index c70a263..8fa0177 100644
@@ -8,7 +8,7 @@ mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 }
 
 /* Hook from generic ACPI tables.c */
-static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static inline int default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	return 0;
 }
arch/x86/include/asm/mach-generic/mach_mpparse.h +1 -1
index 9444ab8..f497d96 100644
@@ -4,6 +4,6 @@
 
 extern int mps_oem_check(struct mpc_table *, char *, char *);
 
-extern int acpi_madt_oem_check(char *, char *);
+extern int default_acpi_madt_oem_check(char *, char *);
 
 #endif /* _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H */
arch/x86/include/asm/summit/mpparse.h +1 -1
index 380e86c..555ed82 100644
@@ -27,7 +27,7 @@ static inline int mps_oem_check(struct mpc_table *mpc, char *oem,
 }
 
 /* Hook from generic ACPI tables.c */
-static inline int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static inline int summit_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	if (!strncmp(oem_id, "IBM", 3) &&
 	    (!strncmp(oem_table_id, "SERVIGIL", 8)
arch/x86/kernel/acpi/boot.c +2 -1
index 4cb5964..314fe0d 100644
@@ -239,7 +239,8 @@ static int __init acpi_parse_madt(struct acpi_table_header *table)
 		       madt->address);
 	}
 
-	acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
+	default_acpi_madt_oem_check(madt->header.oem_id,
+				    madt->header.oem_table_id);
 
 	return 0;
 }
arch/x86/kernel/genapic_64.c +1 -1
index 2b98638..060945b 100644
@@ -68,7 +68,7 @@ void apic_send_IPI_self(int vector)
 	__send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 }
 
-int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	int i;
 
arch/x86/mach-generic/bigsmp.c +1 -1
index 13e82bc..22c3608 100644
@@ -61,7 +61,7 @@ struct genapic apic_bigsmp = {
 
 	.name				= "bigsmp",
 	.probe				= probe_bigsmp,
-	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
arch/x86/mach-generic/default.c +1 -1
index d5fec76..cfec349 100644
@@ -28,7 +28,7 @@ struct genapic apic_default = {
 
 	.name				= "default",
 	.probe				= probe_default,
-	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
arch/x86/mach-generic/es7000.c +3 -3
index 4a404ea..23fe6f1 100644
@@ -57,7 +57,7 @@ mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 
 #ifdef CONFIG_ACPI
 /* Hook from generic ACPI tables.c */
-static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	unsigned long oem_addr = 0;
 	int check_dsdt;
@@ -81,7 +81,7 @@ static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 	return ret;
 }
 #else
-static int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	return 0;
 }
@@ -104,7 +104,7 @@ struct genapic apic_es7000 = {
 
 	.name				= "es7000",
 	.probe				= probe_es7000,
-	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.acpi_madt_oem_check		= es7000_acpi_madt_oem_check,
 	.apic_id_registered		= apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
arch/x86/mach-generic/numaq.c +1 -7
index fa486ca..9691b4e 100644
@@ -31,12 +31,6 @@ static int probe_numaq(void)
 	return found_numaq;
 }
 
-/* Hook from generic ACPI tables.c */
-static int acpi_madt_oem_check(char *oem_id, char *oem_table_id)
-{
-	return 0;
-}
-
 static void vector_allocation_domain(int cpu, cpumask_t *retmask)
 {
 	/* Careful. Some cpus do not strictly honor the set of cpus
@@ -54,7 +48,7 @@ struct genapic apic_numaq = {
 
 	.name				= "NUMAQ",
 	.probe				= probe_numaq,
-	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
arch/x86/mach-generic/probe.c +14 -10
index 82bf0f5..a21e2b1 100644
@@ -128,20 +128,24 @@ int __init mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 	return 0;
 }
 
-int __init acpi_madt_oem_check(char *oem_id, char *oem_table_id)
+int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 {
 	int i;
+
 	for (i = 0; apic_probe[i]; ++i) {
-		if (apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id)) {
-			if (!cmdline_apic) {
-				apic = apic_probe[i];
-				if (x86_quirks->update_genapic)
-					x86_quirks->update_genapic();
-				printk(KERN_INFO "Switched to APIC driver `%s'.\n",
-				       apic->name);
-			}
-			return 1;
+		if (!apic_probe[i]->acpi_madt_oem_check)
+			continue;
+		if (!apic_probe[i]->acpi_madt_oem_check(oem_id, oem_table_id))
+			continue;
+
+		if (!cmdline_apic) {
+			apic = apic_probe[i];
+			if (x86_quirks->update_genapic)
+				x86_quirks->update_genapic();
+			printk(KERN_INFO "Switched to APIC driver `%s'.\n",
+			       apic->name);
 		}
+		return 1;
 	}
 	return 0;
 }
arch/x86/mach-generic/summit.c +1 -1
index 479c1d4..0eea9fb 100644
@@ -41,7 +41,7 @@ struct genapic apic_summit = {
 
 	.name				= "summit",
 	.probe				= probe_summit,
-	.acpi_madt_oem_check		= acpi_madt_oem_check,
+	.acpi_madt_oem_check		= summit_acpi_madt_oem_check,
 	.apic_id_registered		= apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
Signature · 1 line
1.6.0.2
#20 lore raw

PATCH 20/114 x86: clean up apic->apic_id_registered() methods

In reply to Ingo Molnar

Impact: cleanup

x86 subarchitectures each defined a "apic_id_registered()" method, which could be an inline function depending on which subarch we build for, and which was also the name of a genapic field.

Untangle this namespace spaghetti by giving each of the instances a separate name.

Also remove wrapper macro obfuscation.

---
 arch/x86/include/asm/bigsmp/apic.h            |    4 ++--
 arch/x86/include/asm/es7000/apic.h            |    4 ++--
 arch/x86/include/asm/mach-default/mach_apic.h |    3 +--
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/apic.c                        |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 13 insertions(+), 15 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +2 -2
index d8dd9f5..42c56df 100644
@@ -4,9 +4,9 @@
 #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
 #define esr_disable (1)
 
-static inline int apic_id_registered(void)
+static inline int bigsmp_apic_id_registered(void)
 {
-	return (1);
+	return 1;
 }
 
 static inline const cpumask_t *target_cpus(void)
arch/x86/include/asm/es7000/apic.h +2 -2
index c58b9cc..a1819b5 100644
@@ -6,9 +6,9 @@
 #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
 #define esr_disable (1)
 
-static inline int apic_id_registered(void)
+static inline int es7000_apic_id_registered(void)
 {
-	        return (1);
+	        return 1;
 }
 
 static inline const cpumask_t *target_cpus_cluster(void)
arch/x86/include/asm/mach-default/mach_apic.h +1 -2
index 2448b92..6a454fa 100644
@@ -25,7 +25,6 @@ static inline const struct cpumask *target_cpus(void)
 #define INT_DELIVERY_MODE (apic->int_delivery_mode)
 #define INT_DEST_MODE (apic->int_dest_mode)
 #define TARGET_CPUS	  (apic->target_cpus())
-#define apic_id_registered (apic->apic_id_registered)
 #define init_apic_ldr (apic->init_apic_ldr)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
@@ -57,7 +56,7 @@ static inline void init_apic_ldr(void)
 	apic_write(APIC_LDR, val);
 }
 
-static inline int apic_id_registered(void)
+static inline int default_apic_id_registered(void)
 {
 	return physid_isset(read_apic_id(), phys_cpu_present_map);
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 59972d9..cc6e9d7 100644
@@ -10,7 +10,6 @@
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL (apic->apic_destination_logical)
 #define TARGET_CPUS	  (apic->target_cpus())
-#define apic_id_registered (apic->apic_id_registered)
 #define init_apic_ldr (apic->init_apic_ldr)
 #define ioapic_phys_id_map (apic->ioapic_phys_id_map)
 #define setup_apic_routing (apic->setup_apic_routing)
arch/x86/include/asm/numaq/apic.h +1 -1
index bf37bc4..59b62b1 100644
@@ -28,7 +28,7 @@ static inline unsigned long check_apicid_present(int bit)
 }
 #define apicid_cluster(apicid) (apicid & 0xF0)
 
-static inline int apic_id_registered(void)
+static inline int numaq_apic_id_registered(void)
 {
 	return 1;
 }
arch/x86/include/asm/summit/apic.h +1 -1
index 93d2c86..a36ef6e 100644
@@ -74,7 +74,7 @@ static inline int multi_timer_check(int apic, int irq)
 	return 0;
 }
 
-static inline int apic_id_registered(void)
+static inline int summit_apic_id_registered(void)
 {
 	return 1;
 }
arch/x86/kernel/apic.c +1 -1
index c6f1564..b6740de 100644
@@ -1171,7 +1171,7 @@ void __cpuinit setup_local_APIC(void)
 	 * Double-check whether this APIC is really registered.
 	 * This is meaningless in clustered apic mode, so we skip it.
 	 */
-	if (!apic_id_registered())
+	if (!apic->apic_id_registered())
 		BUG();
 
 	/*
arch/x86/mach-generic/bigsmp.c +1 -1
index 22c3608..17abf5c 100644
@@ -62,7 +62,7 @@ struct genapic apic_bigsmp = {
 	.name				= "bigsmp",
 	.probe				= probe_bigsmp,
 	.acpi_madt_oem_check		= NULL,
-	.apic_id_registered		= apic_id_registered,
+	.apic_id_registered		= bigsmp_apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
 	.int_dest_mode			= INT_DEST_MODE,
arch/x86/mach-generic/default.c +1 -1
index cfec349..1f30559 100644
@@ -29,7 +29,7 @@ struct genapic apic_default = {
 	.name				= "default",
 	.probe				= probe_default,
 	.acpi_madt_oem_check		= NULL,
-	.apic_id_registered		= apic_id_registered,
+	.apic_id_registered		= default_apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
 	.int_dest_mode			= INT_DEST_MODE,
arch/x86/mach-generic/es7000.c +1 -1
index 23fe6f1..d68ca0b 100644
@@ -105,7 +105,7 @@ struct genapic apic_es7000 = {
 	.name				= "es7000",
 	.probe				= probe_es7000,
 	.acpi_madt_oem_check		= es7000_acpi_madt_oem_check,
-	.apic_id_registered		= apic_id_registered,
+	.apic_id_registered		= es7000_apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
 	.int_dest_mode			= INT_DEST_MODE,
arch/x86/mach-generic/numaq.c +1 -1
index 9691b4e..b22a79b 100644
@@ -49,7 +49,7 @@ struct genapic apic_numaq = {
 	.name				= "NUMAQ",
 	.probe				= probe_numaq,
 	.acpi_madt_oem_check		= NULL,
-	.apic_id_registered		= apic_id_registered,
+	.apic_id_registered		= numaq_apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
 	.int_dest_mode			= INT_DEST_MODE,
arch/x86/mach-generic/summit.c +1 -1
index 0eea9fb..744fa1b 100644
@@ -42,7 +42,7 @@ struct genapic apic_summit = {
 	.name				= "summit",
 	.probe				= probe_summit,
 	.acpi_madt_oem_check		= summit_acpi_madt_oem_check,
-	.apic_id_registered		= apic_id_registered,
+	.apic_id_registered		= summit_apic_id_registered,
 
 	.int_delivery_mode		= INT_DELIVERY_MODE,
 	.int_dest_mode			= INT_DEST_MODE,
Signature · 1 line
1.6.0.2
#21 lore raw

PATCH 21/114 x86, genapic: rename int_delivery_mode, et. al.

In reply to Ingo Molnar

int_delivery_mode is supposed to mean 'interrupt delivery mode', but it's quite a misnomer as 'int' we usually think of as an integer type ...

The standard naming for such attributes is 'irq' - so rename the following fields and macros:

int_delivery_mode => irq_delivery_mode
INT_DELIVERY_MODE => IRQ_DELIVERY_MODE
int_dest_mode => irq_dest_mode
INT_DEST_MODE => IRQ_DEST_MODE

---
 arch/x86/include/asm/bigsmp/apic.h            |    4 +-
 arch/x86/include/asm/es7000/apic.h            |    4 +-
 arch/x86/include/asm/genapic.h                |    4 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    8 +++---
 arch/x86/include/asm/mach-generic/mach_apic.h |    4 +-
 arch/x86/include/asm/numaq/apic.h             |    4 +-
 arch/x86/include/asm/summit/apic.h            |    4 +-
 arch/x86/kernel/genapic_flat_64.c             |    8 +++---
 arch/x86/kernel/genx2apic_cluster.c           |    4 +-
 arch/x86/kernel/genx2apic_phys.c              |    4 +-
 arch/x86/kernel/genx2apic_uv_x.c              |    4 +-
 arch/x86/kernel/io_apic.c                     |   30 ++++++++++++------------
 arch/x86/mach-generic/bigsmp.c                |    4 +-
 arch/x86/mach-generic/default.c               |    4 +-
 arch/x86/mach-generic/es7000.c                |    8 +++---
 arch/x86/mach-generic/numaq.c                 |    4 +-
 arch/x86/mach-generic/summit.c                |    4 +-
 17 files changed, 53 insertions(+), 53 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +2 -2
index 42c56df..8ff8bba 100644
@@ -21,8 +21,8 @@ static inline const cpumask_t *target_cpus(void)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL	0
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define INT_DELIVERY_MODE	(dest_Fixed)
-#define INT_DEST_MODE		(0)    /* phys delivery to target proc */
+#define IRQ_DELIVERY_MODE	(dest_Fixed)
+#define IRQ_DEST_MODE		(0)    /* phys delivery to target proc */
 #define NO_BALANCE_IRQ		(0)
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
arch/x86/include/asm/es7000/apic.h +2 -2
index a1819b5..830e873 100644
@@ -27,8 +27,8 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ_CLUSTER		(1)
 
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define INT_DELIVERY_MODE	(dest_Fixed)
-#define INT_DEST_MODE		(0)    /* phys delivery to target procs */
+#define IRQ_DELIVERY_MODE	(dest_Fixed)
+#define IRQ_DEST_MODE		(0)    /* phys delivery to target procs */
 #define NO_BALANCE_IRQ		(0)
 #undef  APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL	0x0
arch/x86/include/asm/genapic.h +2 -2
index 108abdf..e998e3d 100644
@@ -23,8 +23,8 @@ struct genapic {
 	int (*acpi_madt_oem_check)(char *oem_id, char *oem_table_id);
 	int (*apic_id_registered)(void);
 
-	u32 int_delivery_mode;
-	u32 int_dest_mode;
+	u32 irq_delivery_mode;
+	u32 irq_dest_mode;
 
 	const struct cpumask *(*target_cpus)(void);
 
arch/x86/include/asm/mach-default/mach_apic.h +4 -4
index 6a454fa..b536479 100644
@@ -22,8 +22,8 @@ static inline const struct cpumask *target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define INT_DELIVERY_MODE (apic->int_delivery_mode)
-#define INT_DEST_MODE (apic->int_dest_mode)
+#define IRQ_DELIVERY_MODE (apic->irq_delivery_mode)
+#define IRQ_DEST_MODE (apic->irq_dest_mode)
 #define TARGET_CPUS	  (apic->target_cpus())
 #define init_apic_ldr (apic->init_apic_ldr)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
@@ -35,8 +35,8 @@ static inline const struct cpumask *target_cpus(void)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void setup_apic_routing(void);
 #else
-#define INT_DELIVERY_MODE dest_LowestPrio
-#define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
+#define IRQ_DELIVERY_MODE dest_LowestPrio
+#define IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
 #define TARGET_CPUS (target_cpus())
 #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
 /*
arch/x86/include/asm/mach-generic/mach_apic.h +2 -2
index cc6e9d7..03492f2 100644
@@ -5,8 +5,8 @@
 
 #define esr_disable (apic->ESR_DISABLE)
 #define NO_BALANCE_IRQ (apic->no_balance_irq)
-#define INT_DELIVERY_MODE (apic->int_delivery_mode)
-#define INT_DEST_MODE (apic->int_dest_mode)
+#define IRQ_DELIVERY_MODE (apic->irq_delivery_mode)
+#define IRQ_DEST_MODE (apic->irq_dest_mode)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL (apic->apic_destination_logical)
 #define TARGET_CPUS	  (apic->target_cpus())
arch/x86/include/asm/numaq/apic.h +2 -2
index 59b62b1..d885e35 100644
@@ -15,8 +15,8 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ (1)
 #define esr_disable (1)
 
-#define INT_DELIVERY_MODE dest_LowestPrio
-#define INT_DEST_MODE 0     /* physical delivery on LOCAL quad */
+#define IRQ_DELIVERY_MODE dest_LowestPrio
+#define IRQ_DEST_MODE 0     /* physical delivery on LOCAL quad */
  
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/include/asm/summit/apic.h +2 -2
index a36ef6e..0b7d0d1 100644
@@ -24,8 +24,8 @@ static inline const cpumask_t *target_cpus(void)
 	return &cpumask_of_cpu(0);
 }
 
-#define INT_DELIVERY_MODE (dest_LowestPrio)
-#define INT_DEST_MODE 1     /* logical delivery broadcast to all procs */
+#define IRQ_DELIVERY_MODE (dest_LowestPrio)
+#define IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/kernel/genapic_flat_64.c +4 -4
index e923337..0a263d6 100644
@@ -180,8 +180,8 @@ struct genapic apic_flat =  {
 	.acpi_madt_oem_check		= flat_acpi_madt_oem_check,
 	.apic_id_registered		= flat_apic_id_registered,
 
-	.int_delivery_mode		= dest_LowestPrio,
-	.int_dest_mode			= (APIC_DEST_LOGICAL != 0),
+	.irq_delivery_mode		= dest_LowestPrio,
+	.irq_dest_mode			= (APIC_DEST_LOGICAL != 0),
 
 	.target_cpus			= flat_target_cpus,
 	.ESR_DISABLE			= 0,
@@ -326,8 +326,8 @@ struct genapic apic_physflat =  {
 	.acpi_madt_oem_check		= physflat_acpi_madt_oem_check,
 	.apic_id_registered		= flat_apic_id_registered,
 
-	.int_delivery_mode		= dest_Fixed,
-	.int_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+	.irq_delivery_mode		= dest_Fixed,
+	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
 
 	.target_cpus			= physflat_target_cpus,
 	.ESR_DISABLE			= 0,
arch/x86/kernel/genx2apic_cluster.c +2 -2
index fc855e5..e9ff7dc 100644
@@ -182,8 +182,8 @@ struct genapic apic_x2apic_cluster = {
 	.acpi_madt_oem_check		= x2apic_acpi_madt_oem_check,
 	.apic_id_registered		= x2apic_apic_id_registered,
 
-	.int_delivery_mode		= dest_LowestPrio,
-	.int_dest_mode			= (APIC_DEST_LOGICAL != 0),
+	.irq_delivery_mode		= dest_LowestPrio,
+	.irq_dest_mode			= (APIC_DEST_LOGICAL != 0),
 
 	.target_cpus			= x2apic_target_cpus,
 	.ESR_DISABLE			= 0,
arch/x86/kernel/genx2apic_phys.c +2 -2
index c98361f..8141b5a 100644
@@ -178,8 +178,8 @@ struct genapic apic_x2apic_phys = {
 	.acpi_madt_oem_check		= x2apic_acpi_madt_oem_check,
 	.apic_id_registered		= x2apic_apic_id_registered,
 
-	.int_delivery_mode		= dest_Fixed,
-	.int_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+	.irq_delivery_mode		= dest_Fixed,
+	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
 
 	.target_cpus			= x2apic_target_cpus,
 	.ESR_DISABLE			= 0,
arch/x86/kernel/genx2apic_uv_x.c +2 -2
index 94f606f..6a73cad 100644
@@ -243,8 +243,8 @@ struct genapic apic_x2apic_uv_x = {
 	.acpi_madt_oem_check		= uv_acpi_madt_oem_check,
 	.apic_id_registered		= uv_apic_id_registered,
 
-	.int_delivery_mode		= dest_Fixed,
-	.int_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+	.irq_delivery_mode		= dest_Fixed,
+	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
 
 	.target_cpus			= uv_target_cpus,
 	.ESR_DISABLE			= 0,
arch/x86/kernel/io_apic.c +15 -15
index 7283234..5f967b9 100644
@@ -1514,9 +1514,9 @@ static int setup_ioapic_entry(int apic_id, int irq,
 		memset(&irte, 0, sizeof(irte));
 
 		irte.present = 1;
-		irte.dst_mode = INT_DEST_MODE;
+		irte.dst_mode = IRQ_DEST_MODE;
 		irte.trigger_mode = trigger;
-		irte.dlvry_mode = INT_DELIVERY_MODE;
+		irte.dlvry_mode = IRQ_DELIVERY_MODE;
 		irte.vector = vector;
 		irte.dest_id = IRTE_DEST(destination);
 
@@ -1529,8 +1529,8 @@ static int setup_ioapic_entry(int apic_id, int irq,
 	} else
 #endif
 	{
-		entry->delivery_mode = INT_DELIVERY_MODE;
-		entry->dest_mode = INT_DEST_MODE;
+		entry->delivery_mode = IRQ_DELIVERY_MODE;
+		entry->dest_mode = IRQ_DEST_MODE;
 		entry->dest = destination;
 	}
 
@@ -1659,10 +1659,10 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin,
 	 * We use logical delivery to get the timer IRQ
 	 * to the first CPU.
 	 */
-	entry.dest_mode = INT_DEST_MODE;
+	entry.dest_mode = IRQ_DEST_MODE;
 	entry.mask = 1;					/* mask IRQ now */
 	entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
-	entry.delivery_mode = INT_DELIVERY_MODE;
+	entry.delivery_mode = IRQ_DELIVERY_MODE;
 	entry.polarity = 0;
 	entry.trigger = 0;
 	entry.vector = vector;
@@ -3279,9 +3279,9 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		memset (&irte, 0, sizeof(irte));
 
 		irte.present = 1;
-		irte.dst_mode = INT_DEST_MODE;
+		irte.dst_mode = IRQ_DEST_MODE;
 		irte.trigger_mode = 0; /* edge */
-		irte.dlvry_mode = INT_DELIVERY_MODE;
+		irte.dlvry_mode = IRQ_DELIVERY_MODE;
 		irte.vector = cfg->vector;
 		irte.dest_id = IRTE_DEST(dest);
 
@@ -3299,10 +3299,10 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		msg->address_hi = MSI_ADDR_BASE_HI;
 		msg->address_lo =
 			MSI_ADDR_BASE_LO |
-			((INT_DEST_MODE == 0) ?
+			((IRQ_DEST_MODE == 0) ?
 				MSI_ADDR_DEST_MODE_PHYSICAL:
 				MSI_ADDR_DEST_MODE_LOGICAL) |
-			((INT_DELIVERY_MODE != dest_LowestPrio) ?
+			((IRQ_DELIVERY_MODE != dest_LowestPrio) ?
 				MSI_ADDR_REDIRECTION_CPU:
 				MSI_ADDR_REDIRECTION_LOWPRI) |
 			MSI_ADDR_DEST_ID(dest);
@@ -3310,7 +3310,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		msg->data =
 			MSI_DATA_TRIGGER_EDGE |
 			MSI_DATA_LEVEL_ASSERT |
-			((INT_DELIVERY_MODE != dest_LowestPrio) ?
+			((IRQ_DELIVERY_MODE != dest_LowestPrio) ?
 				MSI_DATA_DELIVERY_FIXED:
 				MSI_DATA_DELIVERY_LOWPRI) |
 			MSI_DATA_VECTOR(cfg->vector);
@@ -3711,11 +3711,11 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
 			HT_IRQ_LOW_BASE |
 			HT_IRQ_LOW_DEST_ID(dest) |
 			HT_IRQ_LOW_VECTOR(cfg->vector) |
-			((INT_DEST_MODE == 0) ?
+			((IRQ_DEST_MODE == 0) ?
 				HT_IRQ_LOW_DM_PHYSICAL :
 				HT_IRQ_LOW_DM_LOGICAL) |
 			HT_IRQ_LOW_RQEOI_EDGE |
-			((INT_DELIVERY_MODE != dest_LowestPrio) ?
+			((IRQ_DELIVERY_MODE != dest_LowestPrio) ?
 				HT_IRQ_LOW_MT_FIXED :
 				HT_IRQ_LOW_MT_ARBITRATED) |
 			HT_IRQ_LOW_IRQ_MASKED;
@@ -3763,8 +3763,8 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
 	BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long));
 
 	entry->vector = cfg->vector;
-	entry->delivery_mode = INT_DELIVERY_MODE;
-	entry->dest_mode = INT_DEST_MODE;
+	entry->delivery_mode = IRQ_DELIVERY_MODE;
+	entry->dest_mode = IRQ_DEST_MODE;
 	entry->polarity = 0;
 	entry->trigger = 0;
 	entry->mask = 0;
arch/x86/mach-generic/bigsmp.c +2 -2
index 17abf5c..c15c1aa 100644
@@ -64,8 +64,8 @@ struct genapic apic_bigsmp = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= bigsmp_apic_id_registered,
 
-	.int_delivery_mode		= INT_DELIVERY_MODE,
-	.int_dest_mode			= INT_DEST_MODE,
+	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/default.c +2 -2
index 1f30559..d32b175 100644
@@ -31,8 +31,8 @@ struct genapic apic_default = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= default_apic_id_registered,
 
-	.int_delivery_mode		= INT_DELIVERY_MODE,
-	.int_dest_mode			= INT_DEST_MODE,
+	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/es7000.c +4 -4
index d68ca0b..0665389 100644
@@ -21,8 +21,8 @@
 void __init es7000_update_genapic_to_cluster(void)
 {
 	apic->target_cpus = target_cpus_cluster;
-	apic->int_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
-	apic->int_dest_mode = INT_DEST_MODE_CLUSTER;
+	apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
+	apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
 	apic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER;
 
 	apic->init_apic_ldr = init_apic_ldr_cluster;
@@ -107,8 +107,8 @@ struct genapic apic_es7000 = {
 	.acpi_madt_oem_check		= es7000_acpi_madt_oem_check,
 	.apic_id_registered		= es7000_apic_id_registered,
 
-	.int_delivery_mode		= INT_DELIVERY_MODE,
-	.int_dest_mode			= INT_DEST_MODE,
+	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/numaq.c +2 -2
index b22a79b..4019571 100644
@@ -51,8 +51,8 @@ struct genapic apic_numaq = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= numaq_apic_id_registered,
 
-	.int_delivery_mode		= INT_DELIVERY_MODE,
-	.int_dest_mode			= INT_DEST_MODE,
+	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/summit.c +2 -2
index 744fa1b..946da7a 100644
@@ -44,8 +44,8 @@ struct genapic apic_summit = {
 	.acpi_madt_oem_check		= summit_acpi_madt_oem_check,
 	.apic_id_registered		= summit_apic_id_registered,
 
-	.int_delivery_mode		= INT_DELIVERY_MODE,
-	.int_dest_mode			= INT_DEST_MODE,
+	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#22 lore raw

PATCH 22/114 x86, apic: remove IRQ_DEST_MODE / IRQ_DELIVERY_MODE

In reply to Ingo Molnar

Remove the wrapper macros IRQ_DEST_MODE and IRQ_DELIVERY_MODE.

The typical 32-bit and the 64-bit build all dereference via the genapic, so it's pointless to hide that indirection via these ugly macros.

Furthermore, it also obscures subarchitecture details.

So replace it with apic->irq_dest_mode / etc. accesses.

---
 arch/x86/include/asm/bigsmp/apic.h            |    4 +-
 arch/x86/include/asm/es7000/apic.h            |    4 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    5 +--
 arch/x86/include/asm/mach-generic/mach_apic.h |    2 -
 arch/x86/include/asm/numaq/apic.h             |    4 +-
 arch/x86/include/asm/summit/apic.h            |    4 +-
 arch/x86/kernel/io_apic.c                     |   30 ++++++++++++------------
 arch/x86/mach-generic/bigsmp.c                |    4 +-
 arch/x86/mach-generic/default.c               |    4 +-
 arch/x86/mach-generic/es7000.c                |    4 +-
 arch/x86/mach-generic/numaq.c                 |    4 +-
 arch/x86/mach-generic/summit.c                |    4 +-
 12 files changed, 35 insertions(+), 38 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +2 -2
index 8ff8bba..293551b 100644
@@ -21,8 +21,8 @@ static inline const cpumask_t *target_cpus(void)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL	0
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define IRQ_DELIVERY_MODE	(dest_Fixed)
-#define IRQ_DEST_MODE		(0)    /* phys delivery to target proc */
+#define BIGSMP_IRQ_DELIVERY_MODE (dest_Fixed)
+#define BIGSMP_IRQ_DEST_MODE	(0)    /* phys delivery to target proc */
 #define NO_BALANCE_IRQ		(0)
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
arch/x86/include/asm/es7000/apic.h +2 -2
index 830e873..6900166 100644
@@ -27,8 +27,8 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ_CLUSTER		(1)
 
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define IRQ_DELIVERY_MODE	(dest_Fixed)
-#define IRQ_DEST_MODE		(0)    /* phys delivery to target procs */
+#define ES7000_IRQ_DELIVERY_MODE (dest_Fixed)
+#define ES7000_IRQ_DEST_MODE	(0)    /* phys delivery to target procs */
 #define NO_BALANCE_IRQ		(0)
 #undef  APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL	0x0
arch/x86/include/asm/mach-default/mach_apic.h +2 -3
index b536479..eafbf4f 100644
@@ -22,7 +22,6 @@ static inline const struct cpumask *target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define IRQ_DELIVERY_MODE (apic->irq_delivery_mode)
 #define IRQ_DEST_MODE (apic->irq_dest_mode)
 #define TARGET_CPUS	  (apic->target_cpus())
 #define init_apic_ldr (apic->init_apic_ldr)
@@ -35,8 +34,8 @@ static inline const struct cpumask *target_cpus(void)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void setup_apic_routing(void);
 #else
-#define IRQ_DELIVERY_MODE dest_LowestPrio
-#define IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
+#define DEFAULT_IRQ_DELIVERY_MODE dest_LowestPrio
+#define DEFAULT_IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
 #define TARGET_CPUS (target_cpus())
 #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
 /*
arch/x86/include/asm/mach-generic/mach_apic.h +0 -2
index 03492f2..387a5d0 100644
@@ -5,8 +5,6 @@
 
 #define esr_disable (apic->ESR_DISABLE)
 #define NO_BALANCE_IRQ (apic->no_balance_irq)
-#define IRQ_DELIVERY_MODE (apic->irq_delivery_mode)
-#define IRQ_DEST_MODE (apic->irq_dest_mode)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL (apic->apic_destination_logical)
 #define TARGET_CPUS	  (apic->target_cpus())
arch/x86/include/asm/numaq/apic.h +2 -2
index d885e35..7746035 100644
@@ -15,8 +15,8 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ (1)
 #define esr_disable (1)
 
-#define IRQ_DELIVERY_MODE dest_LowestPrio
-#define IRQ_DEST_MODE 0     /* physical delivery on LOCAL quad */
+#define NUMAQ_IRQ_DELIVERY_MODE dest_LowestPrio
+#define NUMAQ_IRQ_DEST_MODE 0     /* physical delivery on LOCAL quad */
  
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/include/asm/summit/apic.h +2 -2
index 0b7d0d1..ea2abe9 100644
@@ -24,8 +24,8 @@ static inline const cpumask_t *target_cpus(void)
 	return &cpumask_of_cpu(0);
 }
 
-#define IRQ_DELIVERY_MODE (dest_LowestPrio)
-#define IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
+#define SUMMIT_IRQ_DELIVERY_MODE (dest_LowestPrio)
+#define SUMMIT_IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/kernel/io_apic.c +15 -15
index 5f967b9..301b657 100644
@@ -1514,9 +1514,9 @@ static int setup_ioapic_entry(int apic_id, int irq,
 		memset(&irte, 0, sizeof(irte));
 
 		irte.present = 1;
-		irte.dst_mode = IRQ_DEST_MODE;
+		irte.dst_mode = apic->irq_dest_mode;
 		irte.trigger_mode = trigger;
-		irte.dlvry_mode = IRQ_DELIVERY_MODE;
+		irte.dlvry_mode = apic->irq_delivery_mode;
 		irte.vector = vector;
 		irte.dest_id = IRTE_DEST(destination);
 
@@ -1529,8 +1529,8 @@ static int setup_ioapic_entry(int apic_id, int irq,
 	} else
 #endif
 	{
-		entry->delivery_mode = IRQ_DELIVERY_MODE;
-		entry->dest_mode = IRQ_DEST_MODE;
+		entry->delivery_mode = apic->irq_delivery_mode;
+		entry->dest_mode = apic->irq_dest_mode;
 		entry->dest = destination;
 	}
 
@@ -1659,10 +1659,10 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin,
 	 * We use logical delivery to get the timer IRQ
 	 * to the first CPU.
 	 */
-	entry.dest_mode = IRQ_DEST_MODE;
+	entry.dest_mode = apic->irq_dest_mode;
 	entry.mask = 1;					/* mask IRQ now */
 	entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
-	entry.delivery_mode = IRQ_DELIVERY_MODE;
+	entry.delivery_mode = apic->irq_delivery_mode;
 	entry.polarity = 0;
 	entry.trigger = 0;
 	entry.vector = vector;
@@ -3279,9 +3279,9 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		memset (&irte, 0, sizeof(irte));
 
 		irte.present = 1;
-		irte.dst_mode = IRQ_DEST_MODE;
+		irte.dst_mode = apic->irq_dest_mode;
 		irte.trigger_mode = 0; /* edge */
-		irte.dlvry_mode = IRQ_DELIVERY_MODE;
+		irte.dlvry_mode = apic->irq_delivery_mode;
 		irte.vector = cfg->vector;
 		irte.dest_id = IRTE_DEST(dest);
 
@@ -3299,10 +3299,10 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		msg->address_hi = MSI_ADDR_BASE_HI;
 		msg->address_lo =
 			MSI_ADDR_BASE_LO |
-			((IRQ_DEST_MODE == 0) ?
+			((apic->irq_dest_mode == 0) ?
 				MSI_ADDR_DEST_MODE_PHYSICAL:
 				MSI_ADDR_DEST_MODE_LOGICAL) |
-			((IRQ_DELIVERY_MODE != dest_LowestPrio) ?
+			((apic->irq_delivery_mode != dest_LowestPrio) ?
 				MSI_ADDR_REDIRECTION_CPU:
 				MSI_ADDR_REDIRECTION_LOWPRI) |
 			MSI_ADDR_DEST_ID(dest);
@@ -3310,7 +3310,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		msg->data =
 			MSI_DATA_TRIGGER_EDGE |
 			MSI_DATA_LEVEL_ASSERT |
-			((IRQ_DELIVERY_MODE != dest_LowestPrio) ?
+			((apic->irq_delivery_mode != dest_LowestPrio) ?
 				MSI_DATA_DELIVERY_FIXED:
 				MSI_DATA_DELIVERY_LOWPRI) |
 			MSI_DATA_VECTOR(cfg->vector);
@@ -3711,11 +3711,11 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
 			HT_IRQ_LOW_BASE |
 			HT_IRQ_LOW_DEST_ID(dest) |
 			HT_IRQ_LOW_VECTOR(cfg->vector) |
-			((IRQ_DEST_MODE == 0) ?
+			((apic->irq_dest_mode == 0) ?
 				HT_IRQ_LOW_DM_PHYSICAL :
 				HT_IRQ_LOW_DM_LOGICAL) |
 			HT_IRQ_LOW_RQEOI_EDGE |
-			((IRQ_DELIVERY_MODE != dest_LowestPrio) ?
+			((apic->irq_delivery_mode != dest_LowestPrio) ?
 				HT_IRQ_LOW_MT_FIXED :
 				HT_IRQ_LOW_MT_ARBITRATED) |
 			HT_IRQ_LOW_IRQ_MASKED;
@@ -3763,8 +3763,8 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
 	BUG_ON(sizeof(struct uv_IO_APIC_route_entry) != sizeof(unsigned long));
 
 	entry->vector = cfg->vector;
-	entry->delivery_mode = IRQ_DELIVERY_MODE;
-	entry->dest_mode = IRQ_DEST_MODE;
+	entry->delivery_mode = apic->irq_delivery_mode;
+	entry->dest_mode = apic->irq_dest_mode;
 	entry->polarity = 0;
 	entry->trigger = 0;
 	entry->mask = 0;
arch/x86/mach-generic/bigsmp.c +2 -2
index c15c1aa..e8c1cec 100644
@@ -64,8 +64,8 @@ struct genapic apic_bigsmp = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= bigsmp_apic_id_registered,
 
-	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= IRQ_DEST_MODE,
+	.irq_delivery_mode		= BIGSMP_IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= BIGSMP_IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/default.c +2 -2
index d32b175..0482106 100644
@@ -31,8 +31,8 @@ struct genapic apic_default = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= default_apic_id_registered,
 
-	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= IRQ_DEST_MODE,
+	.irq_delivery_mode		= DEFAULT_IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= DEFAULT_IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/es7000.c +2 -2
index 0665389..5d97408 100644
@@ -107,8 +107,8 @@ struct genapic apic_es7000 = {
 	.acpi_madt_oem_check		= es7000_acpi_madt_oem_check,
 	.apic_id_registered		= es7000_apic_id_registered,
 
-	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= IRQ_DEST_MODE,
+	.irq_delivery_mode		= ES7000_IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= ES7000_IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/numaq.c +2 -2
index 4019571..77ac669 100644
@@ -51,8 +51,8 @@ struct genapic apic_numaq = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= numaq_apic_id_registered,
 
-	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= IRQ_DEST_MODE,
+	.irq_delivery_mode		= NUMAQ_IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= NUMAQ_IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
arch/x86/mach-generic/summit.c +2 -2
index 946da7a..7b3f43c 100644
@@ -44,8 +44,8 @@ struct genapic apic_summit = {
 	.acpi_madt_oem_check		= summit_acpi_madt_oem_check,
 	.apic_id_registered		= summit_apic_id_registered,
 
-	.irq_delivery_mode		= IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= IRQ_DEST_MODE,
+	.irq_delivery_mode		= SUMMIT_IRQ_DELIVERY_MODE,
+	.irq_dest_mode			= SUMMIT_IRQ_DEST_MODE,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#23 lore raw

PATCH 23/114 x86, apic: remove DEFAULT_IRQ_DELIVERY_MODE and DEFAULT_IRQ_DEST_MODE

In reply to Ingo Molnar

Impact: cleanup

They were only used in a single place and obscured the apic_default template.

---
 arch/x86/include/asm/mach-default/mach_apic.h |    2 --
 arch/x86/mach-generic/default.c               |    5 +++--
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/mach-default/mach_apic.h +0 -2
index eafbf4f..f3b2cd4 100644
@@ -34,8 +34,6 @@ static inline const struct cpumask *target_cpus(void)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void setup_apic_routing(void);
 #else
-#define DEFAULT_IRQ_DELIVERY_MODE dest_LowestPrio
-#define DEFAULT_IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
 #define TARGET_CPUS (target_cpus())
 #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
 /*
arch/x86/mach-generic/default.c +3 -2
index 0482106..fe97b01 100644
@@ -31,8 +31,9 @@ struct genapic apic_default = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= default_apic_id_registered,
 
-	.irq_delivery_mode		= DEFAULT_IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= DEFAULT_IRQ_DEST_MODE,
+	.irq_delivery_mode		= dest_LowestPrio,
+	/* logical delivery broadcast to all CPUs: */
+	.irq_dest_mode			= 1,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#24 lore raw

PATCH 24/114 x86, apic: remove SUMMIT_IRQ_DELIVERY_MODE and SUMMIT_IRQ_DEST_MODE

In reply to Ingo Molnar

Impact: cleanup

They were only used in a single place and obscured the apic_summit template.

---
 arch/x86/include/asm/summit/apic.h |    3 ---
 arch/x86/mach-generic/summit.c     |    5 +++--
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/x86/include/asm/summit/apic.h +0 -3
index ea2abe9..427d088 100644
@@ -24,9 +24,6 @@ static inline const cpumask_t *target_cpus(void)
 	return &cpumask_of_cpu(0);
 }
 
-#define SUMMIT_IRQ_DELIVERY_MODE (dest_LowestPrio)
-#define SUMMIT_IRQ_DEST_MODE 1     /* logical delivery broadcast to all procs */
-
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
 	return 0;
arch/x86/mach-generic/summit.c +3 -2
index 7b3f43c..1b9164b 100644
@@ -44,8 +44,9 @@ struct genapic apic_summit = {
 	.acpi_madt_oem_check		= summit_acpi_madt_oem_check,
 	.apic_id_registered		= summit_apic_id_registered,
 
-	.irq_delivery_mode		= SUMMIT_IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= SUMMIT_IRQ_DEST_MODE,
+	.irq_delivery_mode		= dest_LowestPrio,
+	/* logical delivery broadcast to all CPUs: */
+	.irq_dest_mode			= 1,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#25 lore raw

PATCH 25/114 x86, apic: remove NUMAQ_IRQ_DELIVERY_MODE and NUMAQ_IRQ_DEST_MODE

In reply to Ingo Molnar

Impact: cleanup

They were only used in a single place and obscured the apic_numaq template.

---
 arch/x86/include/asm/numaq/apic.h |    3 ---
 arch/x86/mach-generic/numaq.c     |    5 +++--
 2 files changed, 3 insertions(+), 5 deletions(-)
arch/x86/include/asm/numaq/apic.h +0 -3
index 7746035..a9d8467 100644
@@ -15,9 +15,6 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ (1)
 #define esr_disable (1)
 
-#define NUMAQ_IRQ_DELIVERY_MODE dest_LowestPrio
-#define NUMAQ_IRQ_DEST_MODE 0     /* physical delivery on LOCAL quad */
- 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
 	return physid_isset(apicid, bitmap);
arch/x86/mach-generic/numaq.c +3 -2
index 77ac669..6daddb6 100644
@@ -51,8 +51,9 @@ struct genapic apic_numaq = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= numaq_apic_id_registered,
 
-	.irq_delivery_mode		= NUMAQ_IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= NUMAQ_IRQ_DEST_MODE,
+	.irq_delivery_mode		= dest_LowestPrio,
+	/* physical delivery on LOCAL quad: */
+	.irq_dest_mode			= 0,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#26 lore raw

PATCH 26/114 x86, apic: remove BIGSMP_IRQ_DELIVERY_MODE and BIGSMP_IRQ_DEST_MODE

In reply to Ingo Molnar

Impact: cleanup

They were only used in a single place and obscured the apic_bigsmp driver template.

---
 arch/x86/include/asm/bigsmp/apic.h |    2 --
 arch/x86/mach-generic/bigsmp.c     |    5 +++--
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +0 -2
index 293551b..dca2d5b 100644
@@ -21,8 +21,6 @@ static inline const cpumask_t *target_cpus(void)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL	0
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define BIGSMP_IRQ_DELIVERY_MODE (dest_Fixed)
-#define BIGSMP_IRQ_DEST_MODE	(0)    /* phys delivery to target proc */
 #define NO_BALANCE_IRQ		(0)
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
arch/x86/mach-generic/bigsmp.c +3 -2
index e8c1cec..06be776 100644
@@ -64,8 +64,9 @@ struct genapic apic_bigsmp = {
 	.acpi_madt_oem_check		= NULL,
 	.apic_id_registered		= bigsmp_apic_id_registered,
 
-	.irq_delivery_mode		= BIGSMP_IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= BIGSMP_IRQ_DEST_MODE,
+	.irq_delivery_mode		= dest_Fixed,
+	/* phys delivery to target CPU: */
+	.irq_dest_mode			= 0,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#27 lore raw

PATCH 27/114 x86, apic: remove ES7000_IRQ_DELIVERY_MODE and ES7000_IRQ_DEST_MODE

In reply to Ingo Molnar

Impact: cleanup

They were only used in a single place and obscured the apic_es7000 driver template.

---
 arch/x86/include/asm/es7000/apic.h |    2 --
 arch/x86/mach-generic/es7000.c     |    5 +++--
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/x86/include/asm/es7000/apic.h +0 -2
index 6900166..342416b 100644
@@ -27,8 +27,6 @@ static inline const cpumask_t *target_cpus(void)
 #define NO_BALANCE_IRQ_CLUSTER		(1)
 
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define ES7000_IRQ_DELIVERY_MODE (dest_Fixed)
-#define ES7000_IRQ_DEST_MODE	(0)    /* phys delivery to target procs */
 #define NO_BALANCE_IRQ		(0)
 #undef  APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL	0x0
arch/x86/mach-generic/es7000.c +3 -2
index 5d97408..269a97a 100644
@@ -107,8 +107,9 @@ struct genapic apic_es7000 = {
 	.acpi_madt_oem_check		= es7000_acpi_madt_oem_check,
 	.apic_id_registered		= es7000_apic_id_registered,
 
-	.irq_delivery_mode		= ES7000_IRQ_DELIVERY_MODE,
-	.irq_dest_mode			= ES7000_IRQ_DEST_MODE,
+	.irq_delivery_mode		= dest_Fixed,
+	/* phys delivery to target CPUs: */
+	.irq_dest_mode			= 0,
 
 	.target_cpus			= target_cpus,
 	.ESR_DISABLE			= esr_disable,
Signature · 1 line
1.6.0.2
#28 lore raw

PATCH 28/114 x86, apic: remove IRQ_DEST_MODE

In reply to Ingo Molnar

Remove leftover definition.

---
 arch/x86/include/asm/mach-default/mach_apic.h |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
arch/x86/include/asm/mach-default/mach_apic.h +0 -1
index f3b2cd4..ce3bc48 100644
@@ -22,7 +22,6 @@ static inline const struct cpumask *target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define IRQ_DEST_MODE (apic->irq_dest_mode)
 #define TARGET_CPUS	  (apic->target_cpus())
 #define init_apic_ldr (apic->init_apic_ldr)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
Signature · 1 line
1.6.0.2
#29 lore raw

PATCH 29/114 x86, apic: clean up target_cpus methods

In reply to Ingo Molnar

Impact: cleanup

Clean up all the target_cpus() namespace overlap that exists between bigsmp, es7000, mach-default, numaq and summit - by separating the different functions into different names.

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    4 ++--
 arch/x86/include/asm/mach-default/mach_apic.h |    4 ++--
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index dca2d5b..d6aeca3 100644
@@ -9,7 +9,7 @@ static inline int bigsmp_apic_id_registered(void)
 	return 1;
 }
 
-static inline const cpumask_t *target_cpus(void)
+static inline const cpumask_t *bigsmp_target_cpus(void)
 {
 #ifdef CONFIG_SMP
 	return &cpu_online_map;
arch/x86/include/asm/es7000/apic.h +2 -2
index 342416b..7e5c31a 100644
@@ -16,7 +16,7 @@ static inline const cpumask_t *target_cpus_cluster(void)
 	return &CPU_MASK_ALL;
 }
 
-static inline const cpumask_t *target_cpus(void)
+static inline const cpumask_t *es7000_target_cpus(void)
 {
 	return &cpumask_of_cpu(smp_processor_id());
 }
@@ -83,7 +83,7 @@ static inline void setup_apic_routing(void)
 	printk("Enabling APIC mode:  %s. Using %d I/O APICs, target cpus %lx\n",
 		(apic_version[apic] == 0x14) ?
 			"Physical Cluster" : "Logical Cluster",
-			nr_ioapics, cpus_addr(*target_cpus())[0]);
+			nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
 }
 
 static inline int multi_timer_check(int apic, int irq)
arch/x86/include/asm/mach-default/mach_apic.h +2 -2
index ce3bc48..af1607d 100644
@@ -8,7 +8,7 @@
 
 #define APIC_DFR_VALUE	(APIC_DFR_FLAT)
 
-static inline const struct cpumask *target_cpus(void)
+static inline const struct cpumask *default_target_cpus(void)
 { 
 #ifdef CONFIG_SMP
 	return cpu_online_mask;
@@ -33,7 +33,7 @@ static inline const struct cpumask *target_cpus(void)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void setup_apic_routing(void);
 #else
-#define TARGET_CPUS (target_cpus())
+#define TARGET_CPUS (default_target_cpus())
 #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
 /*
  * Set up the logical destination ID.
arch/x86/include/asm/numaq/apic.h +1 -1
index a9d8467..1111ff9 100644
@@ -7,7 +7,7 @@
 
 #define APIC_DFR_VALUE	(APIC_DFR_CLUSTER)
 
-static inline const cpumask_t *target_cpus(void)
+static inline const cpumask_t *numaq_target_cpus(void)
 {
 	return &CPU_MASK_ALL;
 }
arch/x86/include/asm/summit/apic.h +1 -1
index 427d088..7c1f915 100644
@@ -15,7 +15,7 @@
 
 #define APIC_DFR_VALUE	(APIC_DFR_CLUSTER)
 
-static inline const cpumask_t *target_cpus(void)
+static inline const cpumask_t *summit_target_cpus(void)
 {
 	/* CPU_MASK_ALL (0xff) has undefined behaviour with
 	 * dest_LowestPrio mode logical clustered apic interrupt routing
arch/x86/mach-generic/bigsmp.c +1 -1
index 06be776..d3cead2 100644
@@ -68,7 +68,7 @@ struct genapic apic_bigsmp = {
 	/* phys delivery to target CPU: */
 	.irq_dest_mode			= 0,
 
-	.target_cpus			= target_cpus,
+	.target_cpus			= bigsmp_target_cpus,
 	.ESR_DISABLE			= esr_disable,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
arch/x86/mach-generic/default.c +1 -1
index fe97b01..a483e22 100644
@@ -35,7 +35,7 @@ struct genapic apic_default = {
 	/* logical delivery broadcast to all CPUs: */
 	.irq_dest_mode			= 1,
 
-	.target_cpus			= target_cpus,
+	.target_cpus			= default_target_cpus,
 	.ESR_DISABLE			= esr_disable,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
arch/x86/mach-generic/es7000.c +1 -1
index 269a97a..e31f0c3 100644
@@ -111,7 +111,7 @@ struct genapic apic_es7000 = {
 	/* phys delivery to target CPUs: */
 	.irq_dest_mode			= 0,
 
-	.target_cpus			= target_cpus,
+	.target_cpus			= es7000_target_cpus,
 	.ESR_DISABLE			= esr_disable,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
arch/x86/mach-generic/numaq.c +1 -1
index 6daddb6..4b84b59 100644
@@ -55,7 +55,7 @@ struct genapic apic_numaq = {
 	/* physical delivery on LOCAL quad: */
 	.irq_dest_mode			= 0,
 
-	.target_cpus			= target_cpus,
+	.target_cpus			= numaq_target_cpus,
 	.ESR_DISABLE			= esr_disable,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
arch/x86/mach-generic/summit.c +1 -1
index 1b9164b..e6b956a 100644
@@ -48,7 +48,7 @@ struct genapic apic_summit = {
 	/* logical delivery broadcast to all CPUs: */
 	.irq_dest_mode			= 1,
 
-	.target_cpus			= target_cpus,
+	.target_cpus			= summit_target_cpus,
 	.ESR_DISABLE			= esr_disable,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
Signature · 1 line
1.6.0.2
#30 lore raw

PATCH 30/114 x86, apic: clean up / remove TARGET_CPUS

In reply to Ingo Molnar

Impact: cleanup

use apic->target_cpus() directly instead of the TARGET_CPUS wrapper.

---
 arch/x86/include/asm/es7000/apic.h            |    4 ++--
 arch/x86/include/asm/mach-default/mach_apic.h |    2 --
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/io_apic.c                     |   22 +++++++++++-----------
 5 files changed, 14 insertions(+), 17 deletions(-)
arch/x86/include/asm/es7000/apic.h +2 -2
index 7e5c31a..53adda0 100644
@@ -161,7 +161,7 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 		return 0xFF;
 	/*
 	 * The cpus in the mask must all be on the apic cluster.  If are not
-	 * on the same apicid cluster return default value of TARGET_CPUS.
+	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = cpumask_first(cpumask);
 	apicid = cpu_to_logical_apicid(cpu);
@@ -194,7 +194,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 		return cpu_to_logical_apicid(0);
 	/*
 	 * The cpus in the mask must all be on the apic cluster.  If are not
-	 * on the same apicid cluster return default value of TARGET_CPUS.
+	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = first_cpu(*cpumask);
 	apicid = cpu_to_logical_apicid(cpu);
arch/x86/include/asm/mach-default/mach_apic.h +0 -2
index af1607d..77a9724 100644
@@ -22,7 +22,6 @@ static inline const struct cpumask *default_target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define TARGET_CPUS	  (apic->target_cpus())
 #define init_apic_ldr (apic->init_apic_ldr)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
@@ -33,7 +32,6 @@ static inline const struct cpumask *default_target_cpus(void)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void setup_apic_routing(void);
 #else
-#define TARGET_CPUS (default_target_cpus())
 #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
 /*
  * Set up the logical destination ID.
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 387a5d0..da2d778 100644
@@ -7,7 +7,6 @@
 #define NO_BALANCE_IRQ (apic->no_balance_irq)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL (apic->apic_destination_logical)
-#define TARGET_CPUS	  (apic->target_cpus())
 #define init_apic_ldr (apic->init_apic_ldr)
 #define ioapic_phys_id_map (apic->ioapic_phys_id_map)
 #define setup_apic_routing (apic->setup_apic_routing)
arch/x86/include/asm/summit/apic.h +1 -1
index 7c1f915..cf5036f 100644
@@ -148,7 +148,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 		return (int) 0xFF;
 	/*
 	 * The cpus in the mask must all be on the apic cluster.  If are not
-	 * on the same apicid cluster return default value of TARGET_CPUS.
+	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = first_cpu(*cpumask);
 	apicid = cpu_to_logical_apicid(cpu);
arch/x86/kernel/io_apic.c +11 -11
index 301b657..7503285 100644
@@ -1559,10 +1559,10 @@ static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq
 
 	cfg = desc->chip_data;
 
-	if (assign_irq_vector(irq, cfg, TARGET_CPUS))
+	if (assign_irq_vector(irq, cfg, apic->target_cpus()))
 		return;
 
-	dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
+	dest = cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
 
 	apic_printk(APIC_VERBOSE,KERN_DEBUG
 		    "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
@@ -1661,7 +1661,7 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin,
 	 */
 	entry.dest_mode = apic->irq_dest_mode;
 	entry.mask = 1;					/* mask IRQ now */
-	entry.dest = cpu_mask_to_apicid(TARGET_CPUS);
+	entry.dest = cpu_mask_to_apicid(apic->target_cpus());
 	entry.delivery_mode = apic->irq_delivery_mode;
 	entry.polarity = 0;
 	entry.trigger = 0;
@@ -2877,7 +2877,7 @@ static inline void __init check_timer(void)
 	 * get/set the timer IRQ vector:
 	 */
 	disable_8259A_irq(0);
-	assign_irq_vector(0, cfg, TARGET_CPUS);
+	assign_irq_vector(0, cfg, apic->target_cpus());
 
 	/*
 	 * As IRQ0 is to be enabled in the 8259A, the virtual
@@ -3195,7 +3195,7 @@ unsigned int create_irq_nr(unsigned int irq_want)
 
 		if (cfg_new->vector != 0)
 			continue;
-		if (__assign_irq_vector(new, cfg_new, TARGET_CPUS) == 0)
+		if (__assign_irq_vector(new, cfg_new, apic->target_cpus()) == 0)
 			irq = new;
 		break;
 	}
@@ -3261,11 +3261,11 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 		return -ENXIO;
 
 	cfg = irq_cfg(irq);
-	err = assign_irq_vector(irq, cfg, TARGET_CPUS);
+	err = assign_irq_vector(irq, cfg, apic->target_cpus());
 	if (err)
 		return err;
 
-	dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
+	dest = cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
 
 #ifdef CONFIG_INTR_REMAP
 	if (irq_remapped(irq)) {
@@ -3698,12 +3698,12 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
 		return -ENXIO;
 
 	cfg = irq_cfg(irq);
-	err = assign_irq_vector(irq, cfg, TARGET_CPUS);
+	err = assign_irq_vector(irq, cfg, apic->target_cpus());
 	if (!err) {
 		struct ht_irq_msg msg;
 		unsigned dest;
 
-		dest = cpu_mask_to_apicid_and(cfg->domain, TARGET_CPUS);
+		dest = cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
 
 		msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest);
 
@@ -3987,7 +3987,7 @@ int acpi_get_override_irq(int bus_irq, int *trigger, int *polarity)
 /*
  * This function currently is only a helper for the i386 smp boot process where
  * we need to reprogram the ioredtbls to cater for the cpus which have come online
- * so mask in all cases should simply be TARGET_CPUS
+ * so mask in all cases should simply be apic->target_cpus()
  */
 #ifdef CONFIG_SMP
 void __init setup_ioapic_dest(void)
@@ -4028,7 +4028,7 @@ void __init setup_ioapic_dest(void)
 			    (IRQ_NO_BALANCING | IRQ_AFFINITY_SET))
 				mask = desc->affinity;
 			else
-				mask = TARGET_CPUS;
+				mask = apic->target_cpus();
 
 #ifdef CONFIG_INTR_REMAP
 			if (intr_remapping_enabled)
Signature · 1 line
1.6.0.2
#31 lore raw

PATCH 31/114 x86: clean up esr_disable() methods

In reply to Ingo Molnar

Impact: cleanup

Most subarchitectures want to disable the APIC ESR (Error Status Register), because they generally have hardware hacks that wrap standard CPUs into a bigger system and hence the APIC bus is quite non-standard and weirdnesses (lockups) have been seen with ESR reporting.

Remove the esr_disable macros and put the desired flag into each subarchitecture's genapic template directly.

---
 arch/x86/include/asm/bigsmp/apic.h            |    1 -
 arch/x86/include/asm/es7000/apic.h            |    1 -
 arch/x86/include/asm/mach-default/mach_apic.h |    1 -
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    1 -
 arch/x86/include/asm/summit/apic.h            |    1 -
 arch/x86/kernel/apic.c                        |    4 ++--
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 7 insertions(+), 13 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +0 -1
index d6aeca3..b550cb1 100644
@@ -2,7 +2,6 @@
 #define __ASM_MACH_APIC_H
 
 #define xapic_phys_to_log_apicid(cpu) (per_cpu(x86_bios_cpu_apicid, cpu))
-#define esr_disable (1)
 
 static inline int bigsmp_apic_id_registered(void)
 {
arch/x86/include/asm/es7000/apic.h +0 -1
index 53adda0..aa11c76 100644
@@ -4,7 +4,6 @@
 #include <linux/gfp.h>
 
 #define xapic_phys_to_log_apicid(cpu) per_cpu(x86_bios_cpu_apicid, cpu)
-#define esr_disable (1)
 
 static inline int es7000_apic_id_registered(void)
 {
arch/x86/include/asm/mach-default/mach_apic.h +0 -1
index 77a9724..5f8d17f 100644
@@ -18,7 +18,6 @@ static inline const struct cpumask *default_target_cpus(void)
 } 
 
 #define NO_BALANCE_IRQ (0)
-#define esr_disable (0)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index da2d778..63fe985 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define esr_disable (apic->ESR_DISABLE)
 #define NO_BALANCE_IRQ (apic->no_balance_irq)
 #undef APIC_DEST_LOGICAL
 #define APIC_DEST_LOGICAL (apic->apic_destination_logical)
arch/x86/include/asm/numaq/apic.h +0 -1
index 1111ff9..8ecb3b4 100644
@@ -13,7 +13,6 @@ static inline const cpumask_t *numaq_target_cpus(void)
 }
 
 #define NO_BALANCE_IRQ (1)
-#define esr_disable (1)
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/include/asm/summit/apic.h +0 -1
index cf5036f..84679e6 100644
@@ -4,7 +4,6 @@
 #include <asm/smp.h>
 #include <linux/gfp.h>
 
-#define esr_disable (1)
 #define NO_BALANCE_IRQ (0)
 
 /* In clustered mode, the high nibble of APIC ID is a cluster number.
arch/x86/kernel/apic.c +2 -2
index b6740de..69d8c30 100644
@@ -1107,7 +1107,7 @@ static void __cpuinit lapic_setup_esr(void)
 		return;
 	}
 
-	if (esr_disable) {
+	if (apic->ESR_DISABLE) {
 		/*
 		 * Something untraceable is creating bad interrupts on
 		 * secondary quads ... for the moment, just leave the
@@ -1157,7 +1157,7 @@ void __cpuinit setup_local_APIC(void)
 
 #ifdef CONFIG_X86_32
 	/* Pound the ESR really hard over the head with a big hammer - mbligh */
-	if (lapic_is_integrated() && esr_disable) {
+	if (lapic_is_integrated() && apic->ESR_DISABLE) {
 		apic_write(APIC_ESR, 0);
 		apic_write(APIC_ESR, 0);
 		apic_write(APIC_ESR, 0);
arch/x86/mach-generic/bigsmp.c +1 -1
index d3cead2..f0bb726 100644
@@ -69,7 +69,7 @@ struct genapic apic_bigsmp = {
 	.irq_dest_mode			= 0,
 
 	.target_cpus			= bigsmp_target_cpus,
-	.ESR_DISABLE			= esr_disable,
+	.ESR_DISABLE			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/default.c +1 -1
index a483e22..c30141a 100644
@@ -36,7 +36,7 @@ struct genapic apic_default = {
 	.irq_dest_mode			= 1,
 
 	.target_cpus			= default_target_cpus,
-	.ESR_DISABLE			= esr_disable,
+	.ESR_DISABLE			= 0,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/es7000.c +1 -1
index e31f0c3..e8aa8fd 100644
@@ -112,7 +112,7 @@ struct genapic apic_es7000 = {
 	.irq_dest_mode			= 0,
 
 	.target_cpus			= es7000_target_cpus,
-	.ESR_DISABLE			= esr_disable,
+	.ESR_DISABLE			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/numaq.c +1 -1
index 4b84b59..860edc8 100644
@@ -56,7 +56,7 @@ struct genapic apic_numaq = {
 	.irq_dest_mode			= 0,
 
 	.target_cpus			= numaq_target_cpus,
-	.ESR_DISABLE			= esr_disable,
+	.ESR_DISABLE			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/summit.c +1 -1
index e6b956a..cd5ef11 100644
@@ -49,7 +49,7 @@ struct genapic apic_summit = {
 	.irq_dest_mode			= 1,
 
 	.target_cpus			= summit_target_cpus,
-	.ESR_DISABLE			= esr_disable,
+	.ESR_DISABLE			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
Signature · 1 line
1.6.0.2
#32 lore raw

PATCH 32/114 x86: rename ->ESR_DISABLE to ->disable_esr

In reply to Ingo Molnar

the ->ESR_DISABLE shouting variant was used to enable the esr_disable macro wrappers. Those ugly macros are removed now so we can rename ->ESR_DISABLE to ->disable_esr

---
 arch/x86/include/asm/genapic.h      |    2 +-
 arch/x86/kernel/apic.c              |    4 ++--
 arch/x86/kernel/genapic_flat_64.c   |    4 ++--
 arch/x86/kernel/genx2apic_cluster.c |    2 +-
 arch/x86/kernel/genx2apic_phys.c    |    2 +-
 arch/x86/kernel/genx2apic_uv_x.c    |    2 +-
 arch/x86/mach-generic/bigsmp.c      |    2 +-
 arch/x86/mach-generic/default.c     |    2 +-
 arch/x86/mach-generic/es7000.c      |    2 +-
 arch/x86/mach-generic/numaq.c       |    2 +-
 arch/x86/mach-generic/summit.c      |    2 +-
 11 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/include/asm/genapic.h +1 -1
index e998e3d..7aee4a4 100644
@@ -28,7 +28,7 @@ struct genapic {
 
 	const struct cpumask *(*target_cpus)(void);
 
-	int ESR_DISABLE;
+	int disable_esr;
 
 	int apic_destination_logical;
 	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
arch/x86/kernel/apic.c +2 -2
index 69d8c30..3853ed7 100644
@@ -1107,7 +1107,7 @@ static void __cpuinit lapic_setup_esr(void)
 		return;
 	}
 
-	if (apic->ESR_DISABLE) {
+	if (apic->disable_esr) {
 		/*
 		 * Something untraceable is creating bad interrupts on
 		 * secondary quads ... for the moment, just leave the
@@ -1157,7 +1157,7 @@ void __cpuinit setup_local_APIC(void)
 
 #ifdef CONFIG_X86_32
 	/* Pound the ESR really hard over the head with a big hammer - mbligh */
-	if (lapic_is_integrated() && apic->ESR_DISABLE) {
+	if (lapic_is_integrated() && apic->disable_esr) {
 		apic_write(APIC_ESR, 0);
 		apic_write(APIC_ESR, 0);
 		apic_write(APIC_ESR, 0);
arch/x86/kernel/genapic_flat_64.c +2 -2
index 0a263d6..d437a60 100644
@@ -184,7 +184,7 @@ struct genapic apic_flat =  {
 	.irq_dest_mode			= (APIC_DEST_LOGICAL != 0),
 
 	.target_cpus			= flat_target_cpus,
-	.ESR_DISABLE			= 0,
+	.disable_esr			= 0,
 	.apic_destination_logical	= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
@@ -330,7 +330,7 @@ struct genapic apic_physflat =  {
 	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
 
 	.target_cpus			= physflat_target_cpus,
-	.ESR_DISABLE			= 0,
+	.disable_esr			= 0,
 	.apic_destination_logical	= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
arch/x86/kernel/genx2apic_cluster.c +1 -1
index e9ff7dc..c1cffae 100644
@@ -186,7 +186,7 @@ struct genapic apic_x2apic_cluster = {
 	.irq_dest_mode			= (APIC_DEST_LOGICAL != 0),
 
 	.target_cpus			= x2apic_target_cpus,
-	.ESR_DISABLE			= 0,
+	.disable_esr			= 0,
 	.apic_destination_logical	= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
arch/x86/kernel/genx2apic_phys.c +1 -1
index 8141b5a..c59602b 100644
@@ -182,7 +182,7 @@ struct genapic apic_x2apic_phys = {
 	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
 
 	.target_cpus			= x2apic_target_cpus,
-	.ESR_DISABLE			= 0,
+	.disable_esr			= 0,
 	.apic_destination_logical	= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
arch/x86/kernel/genx2apic_uv_x.c +1 -1
index 6a73cad..525b4e4 100644
@@ -247,7 +247,7 @@ struct genapic apic_x2apic_uv_x = {
 	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
 
 	.target_cpus			= uv_target_cpus,
-	.ESR_DISABLE			= 0,
+	.disable_esr			= 0,
 	.apic_destination_logical	= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
arch/x86/mach-generic/bigsmp.c +1 -1
index f0bb726..fe9bf25 100644
@@ -69,7 +69,7 @@ struct genapic apic_bigsmp = {
 	.irq_dest_mode			= 0,
 
 	.target_cpus			= bigsmp_target_cpus,
-	.ESR_DISABLE			= 1,
+	.disable_esr			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/default.c +1 -1
index c30141a..d3fe801 100644
@@ -36,7 +36,7 @@ struct genapic apic_default = {
 	.irq_dest_mode			= 1,
 
 	.target_cpus			= default_target_cpus,
-	.ESR_DISABLE			= 0,
+	.disable_esr			= 0,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/es7000.c +1 -1
index e8aa8fd..b4f8abf 100644
@@ -112,7 +112,7 @@ struct genapic apic_es7000 = {
 	.irq_dest_mode			= 0,
 
 	.target_cpus			= es7000_target_cpus,
-	.ESR_DISABLE			= 1,
+	.disable_esr			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/numaq.c +1 -1
index 860edc8..f3b7840 100644
@@ -56,7 +56,7 @@ struct genapic apic_numaq = {
 	.irq_dest_mode			= 0,
 
 	.target_cpus			= numaq_target_cpus,
-	.ESR_DISABLE			= 1,
+	.disable_esr			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
arch/x86/mach-generic/summit.c +1 -1
index cd5ef11..95e075b 100644
@@ -49,7 +49,7 @@ struct genapic apic_summit = {
 	.irq_dest_mode			= 1,
 
 	.target_cpus			= summit_target_cpus,
-	.ESR_DISABLE			= 1,
+	.disable_esr			= 1,
 	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
Signature · 1 line
1.6.0.2
#33 lore raw

PATCH 33/114 x86: clean up the APIC_DEST_LOGICAL logic

In reply to Ingo Molnar

Impact: cleanup

The bigsmp and es7000 subarchitectures un-defined APIC_DEST_LOGICAL in a rather nasty way by re-defining it to zero. That is infinitely fragile and makes it very hard to see what to code really does in a given context. The very same constant has different meanings and values - depending on which subarch is enabled.

Untangle this mess by never undefining the constant, but instead propagating the right values into the genapic driver templates.

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 --
 arch/x86/include/asm/es7000/apic.h            |    2 --
 arch/x86/include/asm/mach-generic/mach_apic.h |    2 --
 arch/x86/kernel/genapic_flat_64.c             |   12 ++++++------
 arch/x86/kernel/genx2apic_cluster.c           |   10 +++++-----
 arch/x86/kernel/genx2apic_phys.c              |    2 +-
 arch/x86/kernel/genx2apic_uv_x.c              |    4 ++--
 arch/x86/kernel/io_apic.c                     |    2 +-
 arch/x86/kernel/ipi.c                         |    2 +-
 arch/x86/kernel/smpboot.c                     |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 12 files changed, 19 insertions(+), 25 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +0 -2
index b550cb1..7e6e33a 100644
@@ -17,8 +17,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void)
 #endif
 }
 
-#undef APIC_DEST_LOGICAL
-#define APIC_DEST_LOGICAL	0
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
 #define NO_BALANCE_IRQ		(0)
 
arch/x86/include/asm/es7000/apic.h +0 -2
index aa11c76..0d770fc 100644
@@ -27,8 +27,6 @@ static inline const cpumask_t *es7000_target_cpus(void)
 
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
 #define NO_BALANCE_IRQ		(0)
-#undef  APIC_DEST_LOGICAL
-#define APIC_DEST_LOGICAL	0x0
 
 static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/include/asm/mach-generic/mach_apic.h +0 -2
index 63fe985..00d5fe6 100644
@@ -4,8 +4,6 @@
 #include <asm/genapic.h>
 
 #define NO_BALANCE_IRQ (apic->no_balance_irq)
-#undef APIC_DEST_LOGICAL
-#define APIC_DEST_LOGICAL (apic->apic_destination_logical)
 #define init_apic_ldr (apic->init_apic_ldr)
 #define ioapic_phys_id_map (apic->ioapic_phys_id_map)
 #define setup_apic_routing (apic->setup_apic_routing)
arch/x86/kernel/genapic_flat_64.c +6 -6
index d437a60..fd242c6 100644
@@ -74,7 +74,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector)
 	unsigned long flags;
 
 	local_irq_save(flags);
-	__send_IPI_dest_field(mask, vector, APIC_DEST_LOGICAL);
+	__send_IPI_dest_field(mask, vector, apic->apic_destination_logical);
 	local_irq_restore(flags);
 }
 
@@ -114,7 +114,7 @@ static void flat_send_IPI_allbutself(int vector)
 			_flat_send_IPI_mask(mask, vector);
 		}
 	} else if (num_online_cpus() > 1) {
-		__send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
+		__send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->apic_destination_logical);
 	}
 }
 
@@ -123,7 +123,7 @@ static void flat_send_IPI_all(int vector)
 	if (vector == NMI_VECTOR)
 		flat_send_IPI_mask(cpu_online_mask, vector);
 	else
-		__send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
+		__send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->apic_destination_logical);
 }
 
 static unsigned int get_apic_id(unsigned long x)
@@ -181,11 +181,11 @@ struct genapic apic_flat =  {
 	.apic_id_registered		= flat_apic_id_registered,
 
 	.irq_delivery_mode		= dest_LowestPrio,
-	.irq_dest_mode			= (APIC_DEST_LOGICAL != 0),
+	.irq_dest_mode			= 1, /* logical */
 
 	.target_cpus			= flat_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= 0,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
@@ -327,7 +327,7 @@ struct genapic apic_physflat =  {
 	.apic_id_registered		= flat_apic_id_registered,
 
 	.irq_delivery_mode		= dest_Fixed,
-	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+	.irq_dest_mode			= 0, /* physical */
 
 	.target_cpus			= physflat_target_cpus,
 	.disable_esr			= 0,
arch/x86/kernel/genx2apic_cluster.c +5 -5
index c1cffae..a76e75e 100644
@@ -64,7 +64,7 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
 	for_each_cpu(query_cpu, mask)
 		__x2apic_send_IPI_dest(
 			per_cpu(x86_cpu_to_logical_apicid, query_cpu),
-			vector, APIC_DEST_LOGICAL);
+			vector, apic->apic_destination_logical);
 	local_irq_restore(flags);
 }
 
@@ -80,7 +80,7 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
 		if (query_cpu != this_cpu)
 			__x2apic_send_IPI_dest(
 				per_cpu(x86_cpu_to_logical_apicid, query_cpu),
-				vector, APIC_DEST_LOGICAL);
+				vector, apic->apic_destination_logical);
 	local_irq_restore(flags);
 }
 
@@ -95,7 +95,7 @@ static void x2apic_send_IPI_allbutself(int vector)
 		if (query_cpu != this_cpu)
 			__x2apic_send_IPI_dest(
 				per_cpu(x86_cpu_to_logical_apicid, query_cpu),
-				vector, APIC_DEST_LOGICAL);
+				vector, apic->apic_destination_logical);
 	local_irq_restore(flags);
 }
 
@@ -183,11 +183,11 @@ struct genapic apic_x2apic_cluster = {
 	.apic_id_registered		= x2apic_apic_id_registered,
 
 	.irq_delivery_mode		= dest_LowestPrio,
-	.irq_dest_mode			= (APIC_DEST_LOGICAL != 0),
+	.irq_dest_mode			= 1, /* logical */
 
 	.target_cpus			= x2apic_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= 0,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
arch/x86/kernel/genx2apic_phys.c +1 -1
index c59602b..9b6d68d 100644
@@ -179,7 +179,7 @@ struct genapic apic_x2apic_phys = {
 	.apic_id_registered		= x2apic_apic_id_registered,
 
 	.irq_delivery_mode		= dest_Fixed,
-	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+	.irq_dest_mode			= 0, /* physical */
 
 	.target_cpus			= x2apic_target_cpus,
 	.disable_esr			= 0,
arch/x86/kernel/genx2apic_uv_x.c +2 -2
index 525b4e4..0a75680 100644
@@ -244,11 +244,11 @@ struct genapic apic_x2apic_uv_x = {
 	.apic_id_registered		= uv_apic_id_registered,
 
 	.irq_delivery_mode		= dest_Fixed,
-	.irq_dest_mode			= (APIC_DEST_PHYSICAL != 0),
+	.irq_dest_mode			= 1, /* logical */
 
 	.target_cpus			= uv_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= 0,
+	.apic_destination_logical	= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
arch/x86/kernel/io_apic.c +1 -1
index 7503285..17526d7 100644
@@ -806,7 +806,7 @@ void send_IPI_self(int vector)
 	 * Wait for idle.
 	 */
 	apic_wait_icr_idle();
-	cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | APIC_DEST_LOGICAL;
+	cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | apic->apic_destination_logical;
 	/*
 	 * Send the IPI. The write to APIC_ICR fires this off.
 	 */
arch/x86/kernel/ipi.c +1 -1
index 285bbf8..400b7bd 100644
@@ -30,7 +30,7 @@
 
 static inline int __prepare_ICR(unsigned int shortcut, int vector)
 {
-	unsigned int icr = shortcut | APIC_DEST_LOGICAL;
+	unsigned int icr = shortcut | apic->apic_destination_logical;
 
 	switch (vector) {
 	default:
arch/x86/kernel/smpboot.c +1 -1
index f9dbcff..f0a1737 100644
@@ -583,7 +583,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
 	/* Target chip */
 	/* Boot on the stack */
 	/* Kick the second */
-	apic_icr_write(APIC_DM_NMI | APIC_DEST_LOGICAL, logical_apicid);
+	apic_icr_write(APIC_DM_NMI |  apic->apic_destination_logical, logical_apicid);
 
 	pr_debug("Waiting for send to finish...\n");
 	send_status = safe_apic_wait_icr_idle();
arch/x86/mach-generic/bigsmp.c +1 -1
index fe9bf25..13ee7dc 100644
@@ -70,7 +70,7 @@ struct genapic apic_bigsmp = {
 
 	.target_cpus			= bigsmp_target_cpus,
 	.disable_esr			= 1,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.apic_destination_logical	= 0,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
arch/x86/mach-generic/es7000.c +1 -1
index b4f8abf..61b5da2 100644
@@ -113,7 +113,7 @@ struct genapic apic_es7000 = {
 
 	.target_cpus			= es7000_target_cpus,
 	.disable_esr			= 1,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.apic_destination_logical	= 0,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
Signature · 1 line
1.6.0.2
#34 lore raw

PATCH 34/114 x86, apic: rename genapic::apic_destination_logical to genapic::dest_logical

In reply to Ingo Molnar

This field name was unreasonably long - shorten it.

---
 arch/x86/include/asm/genapic.h      |    2 +-
 arch/x86/kernel/genapic_flat_64.c   |   10 +++++-----
 arch/x86/kernel/genx2apic_cluster.c |    8 ++++----
 arch/x86/kernel/genx2apic_phys.c    |    2 +-
 arch/x86/kernel/genx2apic_uv_x.c    |    2 +-
 arch/x86/kernel/io_apic.c           |    2 +-
 arch/x86/kernel/ipi.c               |    2 +-
 arch/x86/kernel/smpboot.c           |    2 +-
 arch/x86/mach-generic/bigsmp.c      |    2 +-
 arch/x86/mach-generic/default.c     |    2 +-
 arch/x86/mach-generic/es7000.c      |    2 +-
 arch/x86/mach-generic/numaq.c       |    2 +-
 arch/x86/mach-generic/summit.c      |    2 +-
 13 files changed, 20 insertions(+), 20 deletions(-)
arch/x86/include/asm/genapic.h +1 -1
index 7aee4a4..f9d1ec0 100644
@@ -30,7 +30,7 @@ struct genapic {
 
 	int disable_esr;
 
-	int apic_destination_logical;
+	int dest_logical;
 	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
 	unsigned long (*check_apicid_present)(int apicid);
 
arch/x86/kernel/genapic_flat_64.c +5 -5
index fd242c6..d22cbda 100644
@@ -74,7 +74,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector)
 	unsigned long flags;
 
 	local_irq_save(flags);
-	__send_IPI_dest_field(mask, vector, apic->apic_destination_logical);
+	__send_IPI_dest_field(mask, vector, apic->dest_logical);
 	local_irq_restore(flags);
 }
 
@@ -114,7 +114,7 @@ static void flat_send_IPI_allbutself(int vector)
 			_flat_send_IPI_mask(mask, vector);
 		}
 	} else if (num_online_cpus() > 1) {
-		__send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->apic_destination_logical);
+		__send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->dest_logical);
 	}
 }
 
@@ -123,7 +123,7 @@ static void flat_send_IPI_all(int vector)
 	if (vector == NMI_VECTOR)
 		flat_send_IPI_mask(cpu_online_mask, vector);
 	else
-		__send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->apic_destination_logical);
+		__send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical);
 }
 
 static unsigned int get_apic_id(unsigned long x)
@@ -185,7 +185,7 @@ struct genapic apic_flat =  {
 
 	.target_cpus			= flat_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
@@ -331,7 +331,7 @@ struct genapic apic_physflat =  {
 
 	.target_cpus			= physflat_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= 0,
+	.dest_logical			= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
arch/x86/kernel/genx2apic_cluster.c +4 -4
index a76e75e..b91a48e 100644
@@ -64,7 +64,7 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
 	for_each_cpu(query_cpu, mask)
 		__x2apic_send_IPI_dest(
 			per_cpu(x86_cpu_to_logical_apicid, query_cpu),
-			vector, apic->apic_destination_logical);
+			vector, apic->dest_logical);
 	local_irq_restore(flags);
 }
 
@@ -80,7 +80,7 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
 		if (query_cpu != this_cpu)
 			__x2apic_send_IPI_dest(
 				per_cpu(x86_cpu_to_logical_apicid, query_cpu),
-				vector, apic->apic_destination_logical);
+				vector, apic->dest_logical);
 	local_irq_restore(flags);
 }
 
@@ -95,7 +95,7 @@ static void x2apic_send_IPI_allbutself(int vector)
 		if (query_cpu != this_cpu)
 			__x2apic_send_IPI_dest(
 				per_cpu(x86_cpu_to_logical_apicid, query_cpu),
-				vector, apic->apic_destination_logical);
+				vector, apic->dest_logical);
 	local_irq_restore(flags);
 }
 
@@ -187,7 +187,7 @@ struct genapic apic_x2apic_cluster = {
 
 	.target_cpus			= x2apic_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
arch/x86/kernel/genx2apic_phys.c +1 -1
index 9b6d68d..f070e86 100644
@@ -183,7 +183,7 @@ struct genapic apic_x2apic_phys = {
 
 	.target_cpus			= x2apic_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= 0,
+	.dest_logical			= 0,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
arch/x86/kernel/genx2apic_uv_x.c +1 -1
index 0a75680..c8a8915 100644
@@ -248,7 +248,7 @@ struct genapic apic_x2apic_uv_x = {
 
 	.target_cpus			= uv_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
arch/x86/kernel/io_apic.c +1 -1
index 17526d7..7f8b32b 100644
@@ -806,7 +806,7 @@ void send_IPI_self(int vector)
 	 * Wait for idle.
 	 */
 	apic_wait_icr_idle();
-	cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | apic->apic_destination_logical;
+	cfg = APIC_DM_FIXED | APIC_DEST_SELF | vector | apic->dest_logical;
 	/*
 	 * Send the IPI. The write to APIC_ICR fires this off.
 	 */
arch/x86/kernel/ipi.c +1 -1
index 400b7bd..e2e4895 100644
@@ -30,7 +30,7 @@
 
 static inline int __prepare_ICR(unsigned int shortcut, int vector)
 {
-	unsigned int icr = shortcut | apic->apic_destination_logical;
+	unsigned int icr = shortcut | apic->dest_logical;
 
 	switch (vector) {
 	default:
arch/x86/kernel/smpboot.c +1 -1
index f0a1737..45c096f 100644
@@ -583,7 +583,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)
 	/* Target chip */
 	/* Boot on the stack */
 	/* Kick the second */
-	apic_icr_write(APIC_DM_NMI |  apic->apic_destination_logical, logical_apicid);
+	apic_icr_write(APIC_DM_NMI | apic->dest_logical, logical_apicid);
 
 	pr_debug("Waiting for send to finish...\n");
 	send_status = safe_apic_wait_icr_idle();
arch/x86/mach-generic/bigsmp.c +1 -1
index 13ee7dc..7c52840 100644
@@ -70,7 +70,7 @@ struct genapic apic_bigsmp = {
 
 	.target_cpus			= bigsmp_target_cpus,
 	.disable_esr			= 1,
-	.apic_destination_logical	= 0,
+	.dest_logical			= 0,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
arch/x86/mach-generic/default.c +1 -1
index d3fe801..53fa1ad 100644
@@ -37,7 +37,7 @@ struct genapic apic_default = {
 
 	.target_cpus			= default_target_cpus,
 	.disable_esr			= 0,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
arch/x86/mach-generic/es7000.c +1 -1
index 61b5da2..50fed02 100644
@@ -113,7 +113,7 @@ struct genapic apic_es7000 = {
 
 	.target_cpus			= es7000_target_cpus,
 	.disable_esr			= 1,
-	.apic_destination_logical	= 0,
+	.dest_logical			= 0,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
arch/x86/mach-generic/numaq.c +1 -1
index f3b7840..1fb1b1a 100644
@@ -57,7 +57,7 @@ struct genapic apic_numaq = {
 
 	.target_cpus			= numaq_target_cpus,
 	.disable_esr			= 1,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
arch/x86/mach-generic/summit.c +1 -1
index 95e075b..5c27d4d 100644
@@ -50,7 +50,7 @@ struct genapic apic_summit = {
 
 	.target_cpus			= summit_target_cpus,
 	.disable_esr			= 1,
-	.apic_destination_logical	= APIC_DEST_LOGICAL,
+	.dest_logical			= APIC_DEST_LOGICAL,
 	.check_apicid_used		= check_apicid_used,
 	.check_apicid_present		= check_apicid_present,
 
Signature · 1 line
1.6.0.2
#35 lore raw

PATCH 35/114 x86, apic: clean up check_apicid*() callbacks

In reply to Ingo Molnar

Clean up these methods - to make it clearer which function is used in which case.

---
 arch/x86/include/asm/bigsmp/apic.h            |    9 +++++----
 arch/x86/include/asm/es7000/apic.h            |    5 +++--
 arch/x86/include/asm/mach-default/mach_apic.h |    4 ++--
 arch/x86/include/asm/mach-generic/mach_apic.h |    2 --
 arch/x86/include/asm/numaq/apic.h             |    5 +++--
 arch/x86/include/asm/summit/apic.h            |    5 +++--
 arch/x86/kernel/io_apic.c                     |    6 +++---
 arch/x86/mach-generic/bigsmp.c                |    4 ++--
 arch/x86/mach-generic/default.c               |    4 ++--
 arch/x86/mach-generic/es7000.c                |    4 ++--
 arch/x86/mach-generic/numaq.c                 |    4 ++--
 arch/x86/mach-generic/summit.c                |    4 ++--
 12 files changed, 29 insertions(+), 27 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +5 -4
index 7e6e33a..bd52d4d 100644
@@ -20,14 +20,15 @@ static inline const cpumask_t *bigsmp_target_cpus(void)
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
 #define NO_BALANCE_IRQ		(0)
 
-static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
+static inline unsigned long
+bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
-	return (0);
+	return 0;
 }
 
-static inline unsigned long check_apicid_present(int bit)
+static inline unsigned long bigsmp_check_apicid_present(int bit)
 {
-	return (1);
+	return 1;
 }
 
 static inline unsigned long calculate_ldr(int cpu)
arch/x86/include/asm/es7000/apic.h +3 -2
index 0d770fc..cd888da 100644
@@ -28,11 +28,12 @@ static inline const cpumask_t *es7000_target_cpus(void)
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
 #define NO_BALANCE_IRQ		(0)
 
-static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
+static inline unsigned long
+es7000_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
 	return 0;
 }
-static inline unsigned long check_apicid_present(int bit)
+static inline unsigned long es7000_check_apicid_present(int bit)
 {
 	return physid_isset(bit, phys_cpu_present_map);
 }
arch/x86/include/asm/mach-default/mach_apic.h +2 -2
index 5f8d17f..064bc11 100644
@@ -105,12 +105,12 @@ static inline void vector_allocation_domain(int cpu, struct cpumask *retmask)
 }
 #endif
 
-static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
+static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
 	return physid_isset(apicid, bitmap);
 }
 
-static inline unsigned long check_apicid_present(int bit)
+static inline unsigned long default_check_apicid_present(int bit)
 {
 	return physid_isset(bit, phys_cpu_present_map);
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -2
index 00d5fe6..e035f88 100644
@@ -13,9 +13,7 @@
 #define cpu_present_to_apicid (apic->cpu_present_to_apicid)
 #define apicid_to_cpu_present (apic->apicid_to_cpu_present)
 #define setup_portio_remap (apic->setup_portio_remap)
-#define check_apicid_present (apic->check_apicid_present)
 #define check_phys_apicid_present (apic->check_phys_apicid_present)
-#define check_apicid_used (apic->check_apicid_used)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
 #define vector_allocation_domain (apic->vector_allocation_domain)
arch/x86/include/asm/numaq/apic.h +3 -2
index 8ecb3b4..571fdae 100644
@@ -14,11 +14,12 @@ static inline const cpumask_t *numaq_target_cpus(void)
 
 #define NO_BALANCE_IRQ (1)
 
-static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
+static inline unsigned long
+numaq_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
 	return physid_isset(apicid, bitmap);
 }
-static inline unsigned long check_apicid_present(int bit)
+static inline unsigned long numaq_check_apicid_present(int bit)
 {
 	return physid_isset(bit, phys_cpu_present_map);
 }
arch/x86/include/asm/summit/apic.h +3 -2
index 84679e6..482038b 100644
@@ -23,13 +23,14 @@ static inline const cpumask_t *summit_target_cpus(void)
 	return &cpumask_of_cpu(0);
 }
 
-static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
+static inline unsigned long
+summit_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
 	return 0;
 }
 
 /* we don't use the phys_cpu_present_map to indicate apicid presence */
-static inline unsigned long check_apicid_present(int bit)
+static inline unsigned long summit_check_apicid_present(int bit)
 {
 	return 1;
 }
arch/x86/kernel/io_apic.c +3 -3
index 7f8b32b..733ecf1 100644
@@ -2135,7 +2135,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
 		 * system must have a unique ID or we get lots of nice
 		 * 'stuck on smp_invalidate_needed IPI wait' messages.
 		 */
-		if (check_apicid_used(phys_id_present_map,
+		if (apic->check_apicid_used(phys_id_present_map,
 					mp_ioapics[apic_id].apicid)) {
 			printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
 				apic_id, mp_ioapics[apic_id].apicid);
@@ -3878,10 +3878,10 @@ int __init io_apic_get_unique_id(int ioapic, int apic_id)
 	 * Every APIC in a system must have a unique ID or we get lots of nice
 	 * 'stuck on smp_invalidate_needed IPI wait' messages.
 	 */
-	if (check_apicid_used(apic_id_map, apic_id)) {
+	if (apic->check_apicid_used(apic_id_map, apic_id)) {
 
 		for (i = 0; i < get_physical_broadcast(); i++) {
-			if (!check_apicid_used(apic_id_map, i))
+			if (!apic->check_apicid_used(apic_id_map, i))
 				break;
 		}
 
arch/x86/mach-generic/bigsmp.c +2 -2
index 7c52840..aa8443f 100644
@@ -71,8 +71,8 @@ struct genapic apic_bigsmp = {
 	.target_cpus			= bigsmp_target_cpus,
 	.disable_esr			= 1,
 	.dest_logical			= 0,
-	.check_apicid_used		= check_apicid_used,
-	.check_apicid_present		= check_apicid_present,
+	.check_apicid_used		= bigsmp_check_apicid_used,
+	.check_apicid_present		= bigsmp_check_apicid_present,
 
 	.no_balance_irq			= NO_BALANCE_IRQ,
 	.no_ioapic_check		= 0,
arch/x86/mach-generic/default.c +2 -2
index 53fa1ad..47f6b5b 100644
@@ -38,8 +38,8 @@ struct genapic apic_default = {
 	.target_cpus			= default_target_cpus,
 	.disable_esr			= 0,
 	.dest_logical			= APIC_DEST_LOGICAL,
-	.check_apicid_used		= check_apicid_used,
-	.check_apicid_present		= check_apicid_present,
+	.check_apicid_used		= default_check_apicid_used,
+	.check_apicid_present		= default_check_apicid_present,
 
 	.no_balance_irq			= NO_BALANCE_IRQ,
 	.no_ioapic_check		= 0,
arch/x86/mach-generic/es7000.c +2 -2
index 50fed02..5633f32 100644
@@ -114,8 +114,8 @@ struct genapic apic_es7000 = {
 	.target_cpus			= es7000_target_cpus,
 	.disable_esr			= 1,
 	.dest_logical			= 0,
-	.check_apicid_used		= check_apicid_used,
-	.check_apicid_present		= check_apicid_present,
+	.check_apicid_used		= es7000_check_apicid_used,
+	.check_apicid_present		= es7000_check_apicid_present,
 
 	.no_balance_irq			= NO_BALANCE_IRQ,
 	.no_ioapic_check		= 0,
arch/x86/mach-generic/numaq.c +2 -2
index 1fb1b1a..d85206d 100644
@@ -58,8 +58,8 @@ struct genapic apic_numaq = {
 	.target_cpus			= numaq_target_cpus,
 	.disable_esr			= 1,
 	.dest_logical			= APIC_DEST_LOGICAL,
-	.check_apicid_used		= check_apicid_used,
-	.check_apicid_present		= check_apicid_present,
+	.check_apicid_used		= numaq_check_apicid_used,
+	.check_apicid_present		= numaq_check_apicid_present,
 
 	.no_balance_irq			= NO_BALANCE_IRQ,
 	.no_ioapic_check		= 0,
arch/x86/mach-generic/summit.c +2 -2
index 5c27d4d..f54cf73 100644
@@ -51,8 +51,8 @@ struct genapic apic_summit = {
 	.target_cpus			= summit_target_cpus,
 	.disable_esr			= 1,
 	.dest_logical			= APIC_DEST_LOGICAL,
-	.check_apicid_used		= check_apicid_used,
-	.check_apicid_present		= check_apicid_present,
+	.check_apicid_used		= summit_check_apicid_used,
+	.check_apicid_present		= summit_check_apicid_present,
 
 	.no_balance_irq			= NO_BALANCE_IRQ,
 	.no_ioapic_check		= 0,
Signature · 1 line
1.6.0.2
#36 lore raw

PATCH 36/114 x86, apic: remove no_balance_irq and no_ioapic_check flags

In reply to Ingo Molnar

These flags are completely unused. (the in-kernel IRQ balancer has been removed from the upstream kernel.)

---
 arch/x86/include/asm/bigsmp/apic.h            |    1 -
 arch/x86/include/asm/es7000/apic.h            |    2 --
 arch/x86/include/asm/genapic.h                |    3 ---
 arch/x86/include/asm/mach-default/mach_apic.h |    2 --
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 --
 arch/x86/include/asm/summit/apic.h            |    2 --
 arch/x86/kernel/genapic_flat_64.c             |    6 ------
 arch/x86/kernel/genx2apic_cluster.c           |    3 ---
 arch/x86/kernel/genx2apic_phys.c              |    3 ---
 arch/x86/kernel/genx2apic_uv_x.c              |    3 ---
 arch/x86/mach-generic/bigsmp.c                |    3 ---
 arch/x86/mach-generic/default.c               |    3 ---
 arch/x86/mach-generic/es7000.c                |    4 ----
 arch/x86/mach-generic/numaq.c                 |    3 ---
 arch/x86/mach-generic/summit.c                |    3 ---
 16 files changed, 0 insertions(+), 44 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +0 -1
index bd52d4d..9164512 100644
@@ -18,7 +18,6 @@ static inline const cpumask_t *bigsmp_target_cpus(void)
 }
 
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define NO_BALANCE_IRQ		(0)
 
 static inline unsigned long
 bigsmp_check_apicid_used(physid_mask_t bitmap, int apicid)
arch/x86/include/asm/es7000/apic.h +0 -2
index cd888da..847008a 100644
@@ -23,10 +23,8 @@ static inline const cpumask_t *es7000_target_cpus(void)
 #define APIC_DFR_VALUE_CLUSTER		(APIC_DFR_CLUSTER)
 #define INT_DELIVERY_MODE_CLUSTER	(dest_LowestPrio)
 #define INT_DEST_MODE_CLUSTER		(1) /* logical delivery broadcast to all procs */
-#define NO_BALANCE_IRQ_CLUSTER		(1)
 
 #define APIC_DFR_VALUE		(APIC_DFR_FLAT)
-#define NO_BALANCE_IRQ		(0)
 
 static inline unsigned long
 es7000_check_apicid_used(physid_mask_t bitmap, int apicid)
arch/x86/include/asm/genapic.h +0 -3
index f9d1ec0..661898c 100644
@@ -34,9 +34,6 @@ struct genapic {
 	unsigned long (*check_apicid_used)(physid_mask_t bitmap, int apicid);
 	unsigned long (*check_apicid_present)(int apicid);
 
-	int no_balance_irq;
-	int no_ioapic_check;
-
 	void (*vector_allocation_domain)(int cpu, struct cpumask *retmask);
 	void (*init_apic_ldr)(void);
 
arch/x86/include/asm/mach-default/mach_apic.h +0 -2
index 064bc11..8adccf8 100644
@@ -17,8 +17,6 @@ static inline const struct cpumask *default_target_cpus(void)
 #endif
 } 
 
-#define NO_BALANCE_IRQ (0)
-
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
 #define init_apic_ldr (apic->init_apic_ldr)
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index e035f88..4cb9e2b 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define NO_BALANCE_IRQ (apic->no_balance_irq)
 #define init_apic_ldr (apic->init_apic_ldr)
 #define ioapic_phys_id_map (apic->ioapic_phys_id_map)
 #define setup_apic_routing (apic->setup_apic_routing)
arch/x86/include/asm/numaq/apic.h +0 -2
index 571fdae..defee34 100644
@@ -12,8 +12,6 @@ static inline const cpumask_t *numaq_target_cpus(void)
 	return &CPU_MASK_ALL;
 }
 
-#define NO_BALANCE_IRQ (1)
-
 static inline unsigned long
 numaq_check_apicid_used(physid_mask_t bitmap, int apicid)
 {
arch/x86/include/asm/summit/apic.h +0 -2
index 482038b..51df002 100644
@@ -4,8 +4,6 @@
 #include <asm/smp.h>
 #include <linux/gfp.h>
 
-#define NO_BALANCE_IRQ (0)
-
 /* In clustered mode, the high nibble of APIC ID is a cluster number.
  * The low nibble is a 4-bit bitmap. */
 #define XAPIC_DEST_CPUS_SHIFT	4
arch/x86/kernel/genapic_flat_64.c +0 -6
index d22cbda..9446f37 100644
@@ -189,9 +189,6 @@ struct genapic apic_flat =  {
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
-	.no_balance_irq			= 0,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= flat_vector_allocation_domain,
 	.init_apic_ldr			= flat_init_apic_ldr,
 
@@ -335,9 +332,6 @@ struct genapic apic_physflat =  {
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
-	.no_balance_irq			= 0,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= physflat_vector_allocation_domain,
 	/* not needed, but shouldn't hurt: */
 	.init_apic_ldr			= flat_init_apic_ldr,
arch/x86/kernel/genx2apic_cluster.c +0 -3
index b91a48e..2eeca6e 100644
@@ -191,9 +191,6 @@ struct genapic apic_x2apic_cluster = {
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
-	.no_balance_irq			= 0,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= x2apic_vector_allocation_domain,
 	.init_apic_ldr			= init_x2apic_ldr,
 
arch/x86/kernel/genx2apic_phys.c +0 -3
index f070e86..be0ee3e 100644
@@ -187,9 +187,6 @@ struct genapic apic_x2apic_phys = {
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
-	.no_balance_irq			= 0,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= x2apic_vector_allocation_domain,
 	.init_apic_ldr			= init_x2apic_ldr,
 
arch/x86/kernel/genx2apic_uv_x.c +0 -3
index c8a8915..68b423f 100644
@@ -252,9 +252,6 @@ struct genapic apic_x2apic_uv_x = {
 	.check_apicid_used		= NULL,
 	.check_apicid_present		= NULL,
 
-	.no_balance_irq			= 0,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= uv_vector_allocation_domain,
 	.init_apic_ldr			= uv_init_apic_ldr,
 
arch/x86/mach-generic/bigsmp.c +0 -3
index aa8443f..6da251a 100644
@@ -74,9 +74,6 @@ struct genapic apic_bigsmp = {
 	.check_apicid_used		= bigsmp_check_apicid_used,
 	.check_apicid_present		= bigsmp_check_apicid_present,
 
-	.no_balance_irq			= NO_BALANCE_IRQ,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
arch/x86/mach-generic/default.c +0 -3
index 47f6b5b..e89e8c9 100644
@@ -41,9 +41,6 @@ struct genapic apic_default = {
 	.check_apicid_used		= default_check_apicid_used,
 	.check_apicid_present		= default_check_apicid_present,
 
-	.no_balance_irq			= NO_BALANCE_IRQ,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
arch/x86/mach-generic/es7000.c +0 -4
index 5633f32..8e9eeec 100644
@@ -23,7 +23,6 @@ void __init es7000_update_genapic_to_cluster(void)
 	apic->target_cpus = target_cpus_cluster;
 	apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
 	apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
-	apic->no_balance_irq = NO_BALANCE_IRQ_CLUSTER;
 
 	apic->init_apic_ldr = init_apic_ldr_cluster;
 
@@ -117,9 +116,6 @@ struct genapic apic_es7000 = {
 	.check_apicid_used		= es7000_check_apicid_used,
 	.check_apicid_present		= es7000_check_apicid_present,
 
-	.no_balance_irq			= NO_BALANCE_IRQ,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
arch/x86/mach-generic/numaq.c +0 -3
index d85206d..f909189 100644
@@ -61,9 +61,6 @@ struct genapic apic_numaq = {
 	.check_apicid_used		= numaq_check_apicid_used,
 	.check_apicid_present		= numaq_check_apicid_present,
 
-	.no_balance_irq			= NO_BALANCE_IRQ,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
arch/x86/mach-generic/summit.c +0 -3
index f54cf73..99a9bea 100644
@@ -54,9 +54,6 @@ struct genapic apic_summit = {
 	.check_apicid_used		= summit_check_apicid_used,
 	.check_apicid_present		= summit_check_apicid_present,
 
-	.no_balance_irq			= NO_BALANCE_IRQ,
-	.no_ioapic_check		= 0,
-
 	.vector_allocation_domain	= vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
Signature · 1 line
1.6.0.2
#37 lore raw

PATCH 37/114 x86, apic: clean up ->vector_allocation_domain()

In reply to Ingo Molnar

- separate the namespace

- remove macros

- move the default vector-allocation-domain to mach-generic

- fix whitespace damage

---
 arch/x86/include/asm/mach-default/mach_apic.h |   13 -------------
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/kernel/io_apic.c                     |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    4 ++--
 arch/x86/mach-generic/default.c               |   16 +++++++++++++++-
 arch/x86/mach-generic/es7000.c                |    4 ++--
 arch/x86/mach-generic/numaq.c                 |    4 ++--
 arch/x86/mach-generic/summit.c                |    4 ++--
 8 files changed, 24 insertions(+), 24 deletions(-)
arch/x86/include/asm/mach-default/mach_apic.h +0 -13
index 8adccf8..9c56542 100644
@@ -23,7 +23,6 @@ static inline const struct cpumask *default_target_cpus(void)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
 #define phys_pkg_id	(apic->phys_pkg_id)
-#define vector_allocation_domain    (apic->vector_allocation_domain)
 #define read_apic_id()  (GET_APIC_ID(apic_read(APIC_ID)))
 #define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
@@ -89,18 +88,6 @@ static inline int apicid_to_node(int logical_apicid)
 #endif
 }
 
-static inline void vector_allocation_domain(int cpu, struct cpumask *retmask)
-{
-        /* Careful. Some cpus do not strictly honor the set of cpus
-         * specified in the interrupt destination when using lowest
-         * priority interrupt delivery mode.
-         *
-         * In particular there was a hyperthreading cpu observed to
-         * deliver interrupts to the wrong hyperthread when only one
-         * hyperthread was specified in the interrupt desitination.
-         */
-	*retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } };
-}
 #endif
 
 static inline unsigned long default_check_apicid_used(physid_mask_t bitmap, int apicid)
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 4cb9e2b..e94881a 100644
@@ -15,7 +15,6 @@
 #define check_phys_apicid_present (apic->check_phys_apicid_present)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
-#define vector_allocation_domain (apic->vector_allocation_domain)
 #define enable_apic_mode (apic->enable_apic_mode)
 #define phys_pkg_id (apic->phys_pkg_id)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
arch/x86/kernel/io_apic.c +1 -1
index 733ecf1..49899e0 100644
@@ -1316,7 +1316,7 @@ __assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask)
 		int new_cpu;
 		int vector, offset;
 
-		vector_allocation_domain(cpu, tmp_mask);
+		apic->vector_allocation_domain(cpu, tmp_mask);
 
 		vector = current_vector;
 		offset = current_offset;
arch/x86/mach-generic/bigsmp.c +2 -2
index 6da251a..391cc99 100644
@@ -42,7 +42,7 @@ static const struct dmi_system_id bigsmp_dmi_table[] = {
 	 { }
 };
 
-static void vector_allocation_domain(int cpu, cpumask_t *retmask)
+static void bigsmp_vector_allocation_domain(int cpu, cpumask_t *retmask)
 {
 	cpus_clear(*retmask);
 	cpu_set(cpu, *retmask);
@@ -74,7 +74,7 @@ struct genapic apic_bigsmp = {
 	.check_apicid_used		= bigsmp_check_apicid_used,
 	.check_apicid_present		= bigsmp_check_apicid_present,
 
-	.vector_allocation_domain	= vector_allocation_domain,
+	.vector_allocation_domain	= bigsmp_vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
arch/x86/mach-generic/default.c +15 -1
index e89e8c9..6adc3c6 100644
@@ -18,6 +18,20 @@
 #include <asm/mach-default/mach_mpparse.h>
 #include <asm/mach-default/mach_wakecpu.h>
 
+static void default_vector_allocation_domain(int cpu, struct cpumask *retmask)
+{
+	/*
+	 * Careful. Some cpus do not strictly honor the set of cpus
+	 * specified in the interrupt destination when using lowest
+	 * priority interrupt delivery mode.
+	 *
+	 * In particular there was a hyperthreading cpu observed to
+	 * deliver interrupts to the wrong hyperthread when only one
+	 * hyperthread was specified in the interrupt desitination.
+	 */
+	*retmask = (cpumask_t) { { [0] = APIC_ALL_CPUS } };
+}
+
 /* should be called last. */
 static int probe_default(void)
 {
@@ -41,7 +55,7 @@ struct genapic apic_default = {
 	.check_apicid_used		= default_check_apicid_used,
 	.check_apicid_present		= default_check_apicid_present,
 
-	.vector_allocation_domain	= vector_allocation_domain,
+	.vector_allocation_domain	= default_vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
arch/x86/mach-generic/es7000.c +2 -2
index 8e9eeec..bc1f21c 100644
@@ -86,7 +86,7 @@ static int __init es7000_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
 }
 #endif
 
-static void vector_allocation_domain(int cpu, cpumask_t *retmask)
+static void es7000_vector_allocation_domain(int cpu, cpumask_t *retmask)
 {
 	/* Careful. Some cpus do not strictly honor the set of cpus
 	 * specified in the interrupt destination when using lowest
@@ -116,7 +116,7 @@ struct genapic apic_es7000 = {
 	.check_apicid_used		= es7000_check_apicid_used,
 	.check_apicid_present		= es7000_check_apicid_present,
 
-	.vector_allocation_domain	= vector_allocation_domain,
+	.vector_allocation_domain	= es7000_vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
arch/x86/mach-generic/numaq.c +2 -2
index f909189..712882f 100644
@@ -31,7 +31,7 @@ static int probe_numaq(void)
 	return found_numaq;
 }
 
-static void vector_allocation_domain(int cpu, cpumask_t *retmask)
+static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask)
 {
 	/* Careful. Some cpus do not strictly honor the set of cpus
 	 * specified in the interrupt destination when using lowest
@@ -61,7 +61,7 @@ struct genapic apic_numaq = {
 	.check_apicid_used		= numaq_check_apicid_used,
 	.check_apicid_present		= numaq_check_apicid_present,
 
-	.vector_allocation_domain	= vector_allocation_domain,
+	.vector_allocation_domain	= numaq_vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
arch/x86/mach-generic/summit.c +2 -2
index 99a9bea..1834887 100644
@@ -24,7 +24,7 @@ static int probe_summit(void)
 	return 0;
 }
 
-static void vector_allocation_domain(int cpu, cpumask_t *retmask)
+static void summit_vector_allocation_domain(int cpu, cpumask_t *retmask)
 {
 	/* Careful. Some cpus do not strictly honor the set of cpus
 	 * specified in the interrupt destination when using lowest
@@ -54,7 +54,7 @@ struct genapic apic_summit = {
 	.check_apicid_used		= summit_check_apicid_used,
 	.check_apicid_present		= summit_check_apicid_present,
 
-	.vector_allocation_domain	= vector_allocation_domain,
+	.vector_allocation_domain	= summit_vector_allocation_domain,
 	.init_apic_ldr			= init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
Signature · 1 line
1.6.0.2
#38 lore raw

PATCH 38/114 x86, apic: clean up ->init_apic_ldr()

In reply to Ingo Molnar

- separate the namespace

- remove macros

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    4 ++--
 arch/x86/include/asm/mach-default/mach_apic.h |    3 +--
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/apic.c                        |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    4 ++--
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 13 insertions(+), 15 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index 9164512..8194130 100644
@@ -46,7 +46,7 @@ static inline unsigned long calculate_ldr(int cpu)
  * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
  * document number 292116).  So here it goes...
  */
-static inline void init_apic_ldr(void)
+static inline void bigsmp_init_apic_ldr(void)
 {
 	unsigned long val;
 	int cpu = smp_processor_id();
arch/x86/include/asm/es7000/apic.h +2 -2
index 847008a..06f5757 100644
@@ -52,7 +52,7 @@ static inline unsigned long calculate_ldr(int cpu)
  * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
  * document number 292116).  So here it goes...
  */
-static inline void init_apic_ldr_cluster(void)
+static inline void es7000_init_apic_ldr_cluster(void)
 {
 	unsigned long val;
 	int cpu = smp_processor_id();
@@ -62,7 +62,7 @@ static inline void init_apic_ldr_cluster(void)
 	apic_write(APIC_LDR, val);
 }
 
-static inline void init_apic_ldr(void)
+static inline void es7000_init_apic_ldr(void)
 {
 	unsigned long val;
 	int cpu = smp_processor_id();
arch/x86/include/asm/mach-default/mach_apic.h +1 -2
index 9c56542..23e0a2d 100644
@@ -19,7 +19,6 @@ static inline const struct cpumask *default_target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define init_apic_ldr (apic->init_apic_ldr)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
 #define phys_pkg_id	(apic->phys_pkg_id)
@@ -36,7 +35,7 @@ extern void setup_apic_routing(void);
  * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
  * document number 292116).  So here it goes...
  */
-static inline void init_apic_ldr(void)
+static inline void default_init_apic_ldr(void)
 {
 	unsigned long val;
 
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index e94881a..8e51f41 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define init_apic_ldr (apic->init_apic_ldr)
 #define ioapic_phys_id_map (apic->ioapic_phys_id_map)
 #define setup_apic_routing (apic->setup_apic_routing)
 #define multi_timer_check (apic->multi_timer_check)
arch/x86/include/asm/numaq/apic.h +1 -1
index defee34..8022974 100644
@@ -28,7 +28,7 @@ static inline int numaq_apic_id_registered(void)
 	return 1;
 }
 
-static inline void init_apic_ldr(void)
+static inline void numaq_init_apic_ldr(void)
 {
 	/* Already done in NUMA-Q firmware */
 }
arch/x86/include/asm/summit/apic.h +1 -1
index 51df002..9108c89 100644
@@ -37,7 +37,7 @@ static inline unsigned long summit_check_apicid_present(int bit)
 
 extern u8 cpu_2_logical_apicid[];
 
-static inline void init_apic_ldr(void)
+static inline void summit_init_apic_ldr(void)
 {
 	unsigned long val, id;
 	int count = 0;
arch/x86/kernel/apic.c +1 -1
index 3853ed7..b707793 100644
@@ -1179,7 +1179,7 @@ void __cpuinit setup_local_APIC(void)
 	 * an APIC.  See e.g. "AP-388 82489DX User's Manual" (Intel
 	 * document number 292116).  So here it goes...
 	 */
-	init_apic_ldr();
+	apic->init_apic_ldr();
 
 	/*
 	 * Set Task Priority to 'accept all'. We never change this
arch/x86/mach-generic/bigsmp.c +1 -1
index 391cc99..7b7fc47 100644
@@ -75,7 +75,7 @@ struct genapic apic_bigsmp = {
 	.check_apicid_present		= bigsmp_check_apicid_present,
 
 	.vector_allocation_domain	= bigsmp_vector_allocation_domain,
-	.init_apic_ldr			= init_apic_ldr,
+	.init_apic_ldr			= bigsmp_init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
arch/x86/mach-generic/default.c +1 -1
index 6adc3c6..633e848 100644
@@ -56,7 +56,7 @@ struct genapic apic_default = {
 	.check_apicid_present		= default_check_apicid_present,
 
 	.vector_allocation_domain	= default_vector_allocation_domain,
-	.init_apic_ldr			= init_apic_ldr,
+	.init_apic_ldr			= default_init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
arch/x86/mach-generic/es7000.c +2 -2
index bc1f21c..b70833e 100644
@@ -24,7 +24,7 @@ void __init es7000_update_genapic_to_cluster(void)
 	apic->irq_delivery_mode = INT_DELIVERY_MODE_CLUSTER;
 	apic->irq_dest_mode = INT_DEST_MODE_CLUSTER;
 
-	apic->init_apic_ldr = init_apic_ldr_cluster;
+	apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
 
 	apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
 }
@@ -117,7 +117,7 @@ struct genapic apic_es7000 = {
 	.check_apicid_present		= es7000_check_apicid_present,
 
 	.vector_allocation_domain	= es7000_vector_allocation_domain,
-	.init_apic_ldr			= init_apic_ldr,
+	.init_apic_ldr			= es7000_init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
arch/x86/mach-generic/numaq.c +1 -1
index 712882f..a06fda5 100644
@@ -62,7 +62,7 @@ struct genapic apic_numaq = {
 	.check_apicid_present		= numaq_check_apicid_present,
 
 	.vector_allocation_domain	= numaq_vector_allocation_domain,
-	.init_apic_ldr			= init_apic_ldr,
+	.init_apic_ldr			= numaq_init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
arch/x86/mach-generic/summit.c +1 -1
index 1834887..36c552f 100644
@@ -55,7 +55,7 @@ struct genapic apic_summit = {
 	.check_apicid_present		= summit_check_apicid_present,
 
 	.vector_allocation_domain	= summit_vector_allocation_domain,
-	.init_apic_ldr			= init_apic_ldr,
+	.init_apic_ldr			= summit_init_apic_ldr,
 
 	.ioapic_phys_id_map		= ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
Signature · 1 line
1.6.0.2
#39 lore raw

PATCH 39/114 x86, apic: clean up ->ioapic_phys_id_map()

In reply to Ingo Molnar

- separate the namespace

- remove macros

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    3 ++-
 arch/x86/kernel/io_apic.c                     |    4 ++--
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 13 insertions(+), 13 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index 8194130..05116d5 100644
@@ -94,7 +94,7 @@ static inline int cpu_to_logical_apicid(int cpu)
 	return cpu_physical_id(cpu);
 }
 
-static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
+static inline physid_mask_t bigsmp_ioapic_phys_id_map(physid_mask_t phys_map)
 {
 	/* For clustered we don't have a good way to do this yet - hack */
 	return physids_promote(0xFFL);
arch/x86/include/asm/es7000/apic.h +1 -1
index 06f5757..db3e652 100644
@@ -125,7 +125,7 @@ static inline int cpu_to_logical_apicid(int cpu)
 #endif
 }
 
-static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
+static inline physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
 {
 	/* For clustered we don't have a good way to do this yet - hack */
 	return physids_promote(0xff);
arch/x86/include/asm/mach-default/mach_apic.h +1 -1
index 23e0a2d..7abdaae 100644
@@ -99,7 +99,7 @@ static inline unsigned long default_check_apicid_present(int bit)
 	return physid_isset(bit, phys_cpu_present_map);
 }
 
-static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
+static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map)
 {
 	return phys_map;
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 8e51f41..c1c96e6 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define ioapic_phys_id_map (apic->ioapic_phys_id_map)
 #define setup_apic_routing (apic->setup_apic_routing)
 #define multi_timer_check (apic->multi_timer_check)
 #define apicid_to_node (apic->apicid_to_node)
arch/x86/include/asm/numaq/apic.h +1 -1
index 8022974..dc7499b 100644
@@ -48,7 +48,7 @@ static inline int multi_timer_check(int apic, int irq)
 	return apic != 0 && irq == 0;
 }
 
-static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_map)
+static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map)
 {
 	/* We don't have a good way to do this yet - hack */
 	return physids_promote(0xFUL);
arch/x86/include/asm/summit/apic.h +2 -1
index 9108c89..4dafb58 100644
@@ -109,7 +109,8 @@ static inline int cpu_present_to_apicid(int mps_cpu)
 		return BAD_APICID;
 }
 
-static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map)
+static inline physid_mask_t
+ summit_ioapic_phys_id_map(physid_mask_t phys_id_map)
 {
 	/* For clustered we don't have a good way to do this yet - hack */
 	return physids_promote(0x0F);
arch/x86/kernel/io_apic.c +2 -2
index 49899e0..db79ad9 100644
@@ -2108,7 +2108,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
 	 * This is broken; anything with a real cpu count has to
 	 * circumvent this idiocy regardless.
 	 */
-	phys_id_present_map = ioapic_phys_id_map(phys_cpu_present_map);
+	phys_id_present_map = apic->ioapic_phys_id_map(phys_cpu_present_map);
 
 	/*
 	 * Set the IOAPIC ID to the value stored in the MPC table.
@@ -3862,7 +3862,7 @@ int __init io_apic_get_unique_id(int ioapic, int apic_id)
 	 */
 
 	if (physids_empty(apic_id_map))
-		apic_id_map = ioapic_phys_id_map(phys_cpu_present_map);
+		apic_id_map = apic->ioapic_phys_id_map(phys_cpu_present_map);
 
 	spin_lock_irqsave(&ioapic_lock, flags);
 	reg_00.raw = io_apic_read(ioapic, 0);
arch/x86/mach-generic/bigsmp.c +1 -1
index 7b7fc47..f2a3418 100644
@@ -77,7 +77,7 @@ struct genapic apic_bigsmp = {
 	.vector_allocation_domain	= bigsmp_vector_allocation_domain,
 	.init_apic_ldr			= bigsmp_init_apic_ldr,
 
-	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.ioapic_phys_id_map		= bigsmp_ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
arch/x86/mach-generic/default.c +1 -1
index 633e848..c403f3d 100644
@@ -58,7 +58,7 @@ struct genapic apic_default = {
 	.vector_allocation_domain	= default_vector_allocation_domain,
 	.init_apic_ldr			= default_init_apic_ldr,
 
-	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.ioapic_phys_id_map		= default_ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
arch/x86/mach-generic/es7000.c +1 -1
index b70833e..ce09baf 100644
@@ -119,7 +119,7 @@ struct genapic apic_es7000 = {
 	.vector_allocation_domain	= es7000_vector_allocation_domain,
 	.init_apic_ldr			= es7000_init_apic_ldr,
 
-	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.ioapic_phys_id_map		= es7000_ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
arch/x86/mach-generic/numaq.c +1 -1
index a06fda5..5d98f18 100644
@@ -64,7 +64,7 @@ struct genapic apic_numaq = {
 	.vector_allocation_domain	= numaq_vector_allocation_domain,
 	.init_apic_ldr			= numaq_init_apic_ldr,
 
-	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.ioapic_phys_id_map		= numaq_ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
arch/x86/mach-generic/summit.c +1 -1
index 36c552f..6abdd53 100644
@@ -57,7 +57,7 @@ struct genapic apic_summit = {
 	.vector_allocation_domain	= summit_vector_allocation_domain,
 	.init_apic_ldr			= summit_init_apic_ldr,
 
-	.ioapic_phys_id_map		= ioapic_phys_id_map,
+	.ioapic_phys_id_map		= summit_ioapic_phys_id_map,
 	.setup_apic_routing		= setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
Signature · 1 line
1.6.0.2
#40 lore raw

PATCH 40/114 x86, apic: clean up ->setup_apic_routing()

In reply to Ingo Molnar

- separate the namespace

- remove macros

- remove namespace clash on 64-bit

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/genapic.h                |    2 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    4 ++--
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/acpi/boot.c                   |    5 ++---
 arch/x86/kernel/apic.c                        |    2 +-
 arch/x86/kernel/genapic_64.c                  |    2 +-
 arch/x86/kernel/mpparse.c                     |    6 +++---
 arch/x86/kernel/smpboot.c                     |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 17 files changed, 20 insertions(+), 22 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index 05116d5..321ea47 100644
@@ -56,7 +56,7 @@ static inline void bigsmp_init_apic_ldr(void)
 	apic_write(APIC_LDR, val);
 }
 
-static inline void setup_apic_routing(void)
+static inline void bigsmp_setup_apic_routing(void)
 {
 	printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
 		"Physflat", nr_ioapics);
arch/x86/include/asm/es7000/apic.h +1 -1
index db3e652..f118300 100644
@@ -73,7 +73,7 @@ static inline void es7000_init_apic_ldr(void)
 }
 
 extern int apic_version [MAX_APICS];
-static inline void setup_apic_routing(void)
+static inline void es7000_setup_apic_routing(void)
 {
 	int apic = per_cpu(x86_bios_cpu_apicid, smp_processor_id());
 	printk("Enabling APIC mode:  %s. Using %d I/O APICs, target cpus %lx\n",
arch/x86/include/asm/genapic.h +1 -1
index 661898c..38b1202 100644
@@ -107,7 +107,7 @@ extern void apic_send_IPI_self(int vector);
 extern struct genapic apic_x2apic_uv_x;
 DECLARE_PER_CPU(int, x2apic_extra_bits);
 
-extern void setup_apic_routing(void);
+extern void default_setup_apic_routing(void);
 #endif
 
 #endif /* _ASM_X86_GENAPIC_64_H */
arch/x86/include/asm/mach-default/mach_apic.h +2 -2
index 7abdaae..d446774 100644
@@ -25,7 +25,7 @@ static inline const struct cpumask *default_target_cpus(void)
 #define read_apic_id()  (GET_APIC_ID(apic_read(APIC_ID)))
 #define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
-extern void setup_apic_routing(void);
+extern void default_setup_apic_routing(void);
 #else
 #define wakeup_secondary_cpu wakeup_secondary_cpu_via_init
 /*
@@ -70,7 +70,7 @@ static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
 	return cpuid_apic >> index_msb;
 }
 
-static inline void setup_apic_routing(void)
+static inline void default_setup_apic_routing(void)
 {
 #ifdef CONFIG_X86_IO_APIC
 	printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index c1c96e6..ddf3692 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define setup_apic_routing (apic->setup_apic_routing)
 #define multi_timer_check (apic->multi_timer_check)
 #define apicid_to_node (apic->apicid_to_node)
 #define cpu_to_logical_apicid (apic->cpu_to_logical_apicid) 
arch/x86/include/asm/numaq/apic.h +1 -1
index dc7499b..2feb7e7 100644
@@ -33,7 +33,7 @@ static inline void numaq_init_apic_ldr(void)
 	/* Already done in NUMA-Q firmware */
 }
 
-static inline void setup_apic_routing(void)
+static inline void numaq_setup_apic_routing(void)
 {
 	printk("Enabling APIC mode:  %s.  Using %d I/O APICs\n",
 		"NUMA-Q", nr_ioapics);
arch/x86/include/asm/summit/apic.h +1 -1
index 4dafb58..7ec2696 100644
@@ -74,7 +74,7 @@ static inline int summit_apic_id_registered(void)
 	return 1;
 }
 
-static inline void setup_apic_routing(void)
+static inline void summit_setup_apic_routing(void)
 {
 	printk("Enabling APIC mode:  Summit.  Using %d I/O APICs\n",
 						nr_ioapics);
arch/x86/kernel/acpi/boot.c +2 -3
index 314fe0d..5391631 100644
@@ -1360,9 +1360,8 @@ static void __init acpi_process_madt(void)
 				acpi_ioapic = 1;
 
 				smp_found_config = 1;
-#ifdef CONFIG_X86_32
-				setup_apic_routing();
-#endif
+				if (apic->setup_apic_routing)
+					apic->setup_apic_routing();
 			}
 		}
 		if (error == -EINVAL) {
arch/x86/kernel/apic.c +1 -1
index b707793..fcbcc03 100644
@@ -1625,7 +1625,7 @@ int __init APIC_init_uniprocessor(void)
 	enable_IR_x2apic();
 #endif
 #ifdef CONFIG_X86_64
-	setup_apic_routing();
+	default_setup_apic_routing();
 #endif
 
 	verify_local_APIC();
arch/x86/kernel/genapic_64.c +1 -1
index 060945b..d57d213 100644
@@ -44,7 +44,7 @@ static struct genapic *apic_probe[] __initdata = {
 /*
  * Check the APIC IDs in bios_cpu_apicid and choose the APIC mode.
  */
-void __init setup_apic_routing(void)
+void __init default_setup_apic_routing(void)
 {
 	if (apic == &apic_x2apic_phys || apic == &apic_x2apic_cluster) {
 		if (!intr_remapping_enabled)
arch/x86/kernel/mpparse.c +3 -3
index fa6bb26..c8a534a 100644
@@ -390,9 +390,9 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
        generic_bigsmp_probe();
 #endif
 
-#ifdef CONFIG_X86_32
-	setup_apic_routing();
-#endif
+	if (apic->setup_apic_routing)
+		apic->setup_apic_routing();
+
 	if (!num_processors)
 		printk(KERN_ERR "MPTABLE: no processors registered!\n");
 	return num_processors;
arch/x86/kernel/smpboot.c +1 -1
index 45c096f..3791b4a 100644
@@ -1128,7 +1128,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 
 #ifdef CONFIG_X86_64
 	enable_IR_x2apic();
-	setup_apic_routing();
+	default_setup_apic_routing();
 #endif
 
 	if (smp_sanity_check(max_cpus) < 0) {
arch/x86/mach-generic/bigsmp.c +1 -1
index f2a3418..ad3837a 100644
@@ -78,7 +78,7 @@ struct genapic apic_bigsmp = {
 	.init_apic_ldr			= bigsmp_init_apic_ldr,
 
 	.ioapic_phys_id_map		= bigsmp_ioapic_phys_id_map,
-	.setup_apic_routing		= setup_apic_routing,
+	.setup_apic_routing		= bigsmp_setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
arch/x86/mach-generic/default.c +1 -1
index c403f3d..67f287f 100644
@@ -59,7 +59,7 @@ struct genapic apic_default = {
 	.init_apic_ldr			= default_init_apic_ldr,
 
 	.ioapic_phys_id_map		= default_ioapic_phys_id_map,
-	.setup_apic_routing		= setup_apic_routing,
+	.setup_apic_routing		= default_setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
arch/x86/mach-generic/es7000.c +1 -1
index ce09baf..f611729 100644
@@ -120,7 +120,7 @@ struct genapic apic_es7000 = {
 	.init_apic_ldr			= es7000_init_apic_ldr,
 
 	.ioapic_phys_id_map		= es7000_ioapic_phys_id_map,
-	.setup_apic_routing		= setup_apic_routing,
+	.setup_apic_routing		= es7000_setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
arch/x86/mach-generic/numaq.c +1 -1
index 5d98f18..8c137f4 100644
@@ -65,7 +65,7 @@ struct genapic apic_numaq = {
 	.init_apic_ldr			= numaq_init_apic_ldr,
 
 	.ioapic_phys_id_map		= numaq_ioapic_phys_id_map,
-	.setup_apic_routing		= setup_apic_routing,
+	.setup_apic_routing		= numaq_setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
arch/x86/mach-generic/summit.c +1 -1
index 6abdd53..0698566 100644
@@ -58,7 +58,7 @@ struct genapic apic_summit = {
 	.init_apic_ldr			= summit_init_apic_ldr,
 
 	.ioapic_phys_id_map		= summit_ioapic_phys_id_map,
-	.setup_apic_routing		= setup_apic_routing,
+	.setup_apic_routing		= summit_setup_apic_routing,
 	.multi_timer_check		= multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
Signature · 1 line
1.6.0.2
#41 lore raw

PATCH 41/114 x86, apic: streamline the ->multi_timer_check() quirk

In reply to Ingo Molnar

only NUMAQ uses this quirk: to prevent the timer IRQ from being added on secondary nodes.

All other genapic templates can have a NULL ->multi_timer_check() callback.

Also, extend the generic code to treat a NULL pointer accordingly.

---
 arch/x86/include/asm/bigsmp/apic.h            |    5 -----
 arch/x86/include/asm/es7000/apic.h            |    5 -----
 arch/x86/include/asm/mach-default/mach_apic.h |    5 -----
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    5 -----
 arch/x86/kernel/io_apic.c                     |   11 ++++++++---
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 14 insertions(+), 30 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +0 -5
index 321ea47..df59298 100644
@@ -62,11 +62,6 @@ static inline void bigsmp_setup_apic_routing(void)
 		"Physflat", nr_ioapics);
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return (0);
-}
-
 static inline int apicid_to_node(int logical_apicid)
 {
 	return apicid_2_node[hard_smp_processor_id()];
arch/x86/include/asm/es7000/apic.h +0 -5
index f118300..632e4cd 100644
@@ -82,11 +82,6 @@ static inline void es7000_setup_apic_routing(void)
 			nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return 0;
-}
-
 static inline int apicid_to_node(int logical_apicid)
 {
 	return 0;
arch/x86/include/asm/mach-default/mach_apic.h +0 -5
index d446774..f418d47 100644
@@ -104,11 +104,6 @@ static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map)
 	return phys_map;
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return 0;
-}
-
 /* Mapping from cpu number to logical apicid */
 static inline int cpu_to_logical_apicid(int cpu)
 {
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index ddf3692..bdea0a7 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define multi_timer_check (apic->multi_timer_check)
 #define apicid_to_node (apic->apicid_to_node)
 #define cpu_to_logical_apicid (apic->cpu_to_logical_apicid) 
 #define cpu_present_to_apicid (apic->cpu_present_to_apicid)
arch/x86/include/asm/numaq/apic.h +1 -1
index 2feb7e7..22bdf3d 100644
@@ -43,7 +43,7 @@ static inline void numaq_setup_apic_routing(void)
  * Skip adding the timer int on secondary nodes, which causes
  * a small but painful rift in the time-space continuum.
  */
-static inline int multi_timer_check(int apic, int irq)
+static inline int numaq_multi_timer_check(int apic, int irq)
 {
 	return apic != 0 && irq == 0;
 }
arch/x86/include/asm/summit/apic.h +0 -5
index 7ec2696..acb7bd1 100644
@@ -64,11 +64,6 @@ static inline void summit_init_apic_ldr(void)
 	apic_write(APIC_LDR, val);
 }
 
-static inline int multi_timer_check(int apic, int irq)
-{
-	return 0;
-}
-
 static inline int summit_apic_id_registered(void)
 {
 	return 1;
arch/x86/kernel/io_apic.c +8 -3
index db79ad9..282ea11 100644
@@ -1618,10 +1618,15 @@ static void __init setup_IO_APIC_irqs(void)
 			}
 
 			irq = pin_2_irq(idx, apic_id, pin);
-#ifdef CONFIG_X86_32
-			if (multi_timer_check(apic_id, irq))
+
+			/*
+			 * Skip the timer IRQ if there's a quirk handler
+			 * installed and if it returns 1:
+			 */
+			if (apic->multi_timer_check &&
+					apic->multi_timer_check(apic_id, irq))
 				continue;
-#endif
+
 			desc = irq_to_desc_alloc_cpu(irq, cpu);
 			if (!desc) {
 				printk(KERN_INFO "can not get irq_desc for %d\n", irq);
arch/x86/mach-generic/bigsmp.c +1 -1
index ad3837a..d074956 100644
@@ -79,7 +79,7 @@ struct genapic apic_bigsmp = {
 
 	.ioapic_phys_id_map		= bigsmp_ioapic_phys_id_map,
 	.setup_apic_routing		= bigsmp_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
arch/x86/mach-generic/default.c +1 -1
index 67f287f..6a21aa7 100644
@@ -60,7 +60,7 @@ struct genapic apic_default = {
 
 	.ioapic_phys_id_map		= default_ioapic_phys_id_map,
 	.setup_apic_routing		= default_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
arch/x86/mach-generic/es7000.c +1 -1
index f611729..0be59a5 100644
@@ -121,7 +121,7 @@ struct genapic apic_es7000 = {
 
 	.ioapic_phys_id_map		= es7000_ioapic_phys_id_map,
 	.setup_apic_routing		= es7000_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
arch/x86/mach-generic/numaq.c +1 -1
index 8c137f4..da4ed65 100644
@@ -66,7 +66,7 @@ struct genapic apic_numaq = {
 
 	.ioapic_phys_id_map		= numaq_ioapic_phys_id_map,
 	.setup_apic_routing		= numaq_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= numaq_multi_timer_check,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
arch/x86/mach-generic/summit.c +1 -1
index 0698566..b618a18 100644
@@ -59,7 +59,7 @@ struct genapic apic_summit = {
 
 	.ioapic_phys_id_map		= summit_ioapic_phys_id_map,
 	.setup_apic_routing		= summit_setup_apic_routing,
-	.multi_timer_check		= multi_timer_check,
+	.multi_timer_check		= NULL,
 	.apicid_to_node			= apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
Signature · 1 line
1.6.0.2
#42 lore raw

PATCH 42/114 x86, apic: clean up ->apicid_to_node()

In reply to Ingo Molnar

- separate the namespace

- remove macros

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    4 ++--
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/smpboot.c                     |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 12 insertions(+), 13 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index df59298..77f0b73 100644
@@ -62,7 +62,7 @@ static inline void bigsmp_setup_apic_routing(void)
 		"Physflat", nr_ioapics);
 }
 
-static inline int apicid_to_node(int logical_apicid)
+static inline int bigsmp_apicid_to_node(int logical_apicid)
 {
 	return apicid_2_node[hard_smp_processor_id()];
 }
arch/x86/include/asm/es7000/apic.h +1 -1
index 632e4cd..bcdf314 100644
@@ -82,7 +82,7 @@ static inline void es7000_setup_apic_routing(void)
 			nr_ioapics, cpus_addr(*es7000_target_cpus())[0]);
 }
 
-static inline int apicid_to_node(int logical_apicid)
+static inline int es7000_apicid_to_node(int logical_apicid)
 {
 	return 0;
 }
arch/x86/include/asm/mach-default/mach_apic.h +1 -1
index f418d47..2f78209 100644
@@ -78,7 +78,7 @@ static inline void default_setup_apic_routing(void)
 #endif
 }
 
-static inline int apicid_to_node(int logical_apicid)
+static inline int default_apicid_to_node(int logical_apicid)
 {
 #ifdef CONFIG_SMP
 	return apicid_2_node[hard_smp_processor_id()];
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index bdea0a7..b585a8e 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define apicid_to_node (apic->apicid_to_node)
 #define cpu_to_logical_apicid (apic->cpu_to_logical_apicid) 
 #define cpu_present_to_apicid (apic->cpu_present_to_apicid)
 #define apicid_to_cpu_present (apic->apicid_to_cpu_present)
arch/x86/include/asm/numaq/apic.h +2 -2
index 22bdf3d..a0e3b43 100644
@@ -76,14 +76,14 @@ static inline int cpu_present_to_apicid(int mps_cpu)
 		return BAD_APICID;
 }
 
-static inline int apicid_to_node(int logical_apicid) 
+static inline int numaq_apicid_to_node(int logical_apicid) 
 {
 	return logical_apicid >> 4;
 }
 
 static inline physid_mask_t apicid_to_cpu_present(int logical_apicid)
 {
-	int node = apicid_to_node(logical_apicid);
+	int node = numaq_apicid_to_node(logical_apicid);
 	int cpu = __ffs(logical_apicid & 0xf);
 
 	return physid_mask_of_physid(cpu + 4*node);
arch/x86/include/asm/summit/apic.h +1 -1
index acb7bd1..cfff276 100644
@@ -75,7 +75,7 @@ static inline void summit_setup_apic_routing(void)
 						nr_ioapics);
 }
 
-static inline int apicid_to_node(int logical_apicid)
+static inline int summit_apicid_to_node(int logical_apicid)
 {
 #ifdef CONFIG_SMP
 	return apicid_2_node[hard_smp_processor_id()];
arch/x86/kernel/smpboot.c +1 -1
index 3791b4a..1dd4cec 100644
@@ -163,7 +163,7 @@ static void map_cpu_to_logical_apicid(void)
 {
 	int cpu = smp_processor_id();
 	int apicid = logical_smp_processor_id();
-	int node = apicid_to_node(apicid);
+	int node = apic->apicid_to_node(apicid);
 
 	if (!node_online(node))
 		node = first_online_node;
arch/x86/mach-generic/bigsmp.c +1 -1
index d074956..2f41214 100644
@@ -80,7 +80,7 @@ struct genapic apic_bigsmp = {
 	.ioapic_phys_id_map		= bigsmp_ioapic_phys_id_map,
 	.setup_apic_routing		= bigsmp_setup_apic_routing,
 	.multi_timer_check		= NULL,
-	.apicid_to_node			= apicid_to_node,
+	.apicid_to_node			= bigsmp_apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
arch/x86/mach-generic/default.c +1 -1
index 6a21aa7..d391c2d 100644
@@ -61,7 +61,7 @@ struct genapic apic_default = {
 	.ioapic_phys_id_map		= default_ioapic_phys_id_map,
 	.setup_apic_routing		= default_setup_apic_routing,
 	.multi_timer_check		= NULL,
-	.apicid_to_node			= apicid_to_node,
+	.apicid_to_node			= default_apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
arch/x86/mach-generic/es7000.c +1 -1
index 0be59a5..933f2a3 100644
@@ -122,7 +122,7 @@ struct genapic apic_es7000 = {
 	.ioapic_phys_id_map		= es7000_ioapic_phys_id_map,
 	.setup_apic_routing		= es7000_setup_apic_routing,
 	.multi_timer_check		= NULL,
-	.apicid_to_node			= apicid_to_node,
+	.apicid_to_node			= es7000_apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
arch/x86/mach-generic/numaq.c +1 -1
index da4ed65..38344fb 100644
@@ -67,7 +67,7 @@ struct genapic apic_numaq = {
 	.ioapic_phys_id_map		= numaq_ioapic_phys_id_map,
 	.setup_apic_routing		= numaq_setup_apic_routing,
 	.multi_timer_check		= numaq_multi_timer_check,
-	.apicid_to_node			= apicid_to_node,
+	.apicid_to_node			= numaq_apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
arch/x86/mach-generic/summit.c +1 -1
index b618a18..6150604 100644
@@ -60,7 +60,7 @@ struct genapic apic_summit = {
 	.ioapic_phys_id_map		= summit_ioapic_phys_id_map,
 	.setup_apic_routing		= summit_setup_apic_routing,
 	.multi_timer_check		= NULL,
-	.apicid_to_node			= apicid_to_node,
+	.apicid_to_node			= summit_apicid_to_node,
 	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
Signature · 1 line
1.6.0.2
#43 lore raw

PATCH 43/114 x86, apic: clean up ->cpu_to_logical_apicid()

In reply to Ingo Molnar

- separate the namespace

- remove macros

---
 arch/x86/include/asm/bigsmp/apic.h            |    6 +++---
 arch/x86/include/asm/es7000/apic.h            |   16 ++++++++--------
 arch/x86/include/asm/mach-default/mach_apic.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    3 ++-
 arch/x86/include/asm/summit/apic.h            |    8 ++++----
 arch/x86/kernel/ipi.c                         |    4 ++--
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 25 insertions(+), 25 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +3 -3
index 77f0b73..d0d894f 100644
@@ -82,7 +82,7 @@ static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
 
 extern u8 cpu_2_logical_apicid[];
 /* Mapping from cpu number to logical apicid */
-static inline int cpu_to_logical_apicid(int cpu)
+static inline int bigsmp_cpu_to_logical_apicid(int cpu)
 {
 	if (cpu >= nr_cpu_ids)
 		return BAD_APICID;
@@ -115,7 +115,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 	int apicid;	
 
 	cpu = first_cpu(*cpumask);
-	apicid = cpu_to_logical_apicid(cpu);
+	apicid = bigsmp_cpu_to_logical_apicid(cpu);
 	return apicid;
 }
 
@@ -132,7 +132,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 		if (cpumask_test_cpu(cpu, cpu_online_mask))
 			break;
 	if (cpu < nr_cpu_ids)
-		return cpu_to_logical_apicid(cpu);
+		return bigsmp_cpu_to_logical_apicid(cpu);
 
 	return BAD_APICID;
 }
arch/x86/include/asm/es7000/apic.h +8 -8
index bcdf314..e0cd07e 100644
@@ -109,7 +109,7 @@ static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
 
 extern u8 cpu_2_logical_apicid[];
 /* Mapping from cpu number to logical apicid */
-static inline int cpu_to_logical_apicid(int cpu)
+static inline int es7000_cpu_to_logical_apicid(int cpu)
 {
 #ifdef CONFIG_SMP
 	if (cpu >= nr_cpu_ids)
@@ -155,10 +155,10 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = cpumask_first(cpumask);
-	apicid = cpu_to_logical_apicid(cpu);
+	apicid = es7000_cpu_to_logical_apicid(cpu);
 	while (cpus_found < num_bits_set) {
 		if (cpumask_test_cpu(cpu, cpumask)) {
-			int new_apicid = cpu_to_logical_apicid(cpu);
+			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 			if (apicid_cluster(apicid) !=
 					apicid_cluster(new_apicid)){
 				printk ("%s: Not a valid mask!\n", __func__);
@@ -182,20 +182,20 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 	num_bits_set = cpus_weight(*cpumask);
 	/* Return id to all */
 	if (num_bits_set == nr_cpu_ids)
-		return cpu_to_logical_apicid(0);
+		return es7000_cpu_to_logical_apicid(0);
 	/*
 	 * The cpus in the mask must all be on the apic cluster.  If are not
 	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = first_cpu(*cpumask);
-	apicid = cpu_to_logical_apicid(cpu);
+	apicid = es7000_cpu_to_logical_apicid(cpu);
 	while (cpus_found < num_bits_set) {
 		if (cpu_isset(cpu, *cpumask)) {
-			int new_apicid = cpu_to_logical_apicid(cpu);
+			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
 			if (apicid_cluster(apicid) !=
 					apicid_cluster(new_apicid)){
 				printk ("%s: Not a valid mask!\n", __func__);
-				return cpu_to_logical_apicid(0);
+				return es7000_cpu_to_logical_apicid(0);
 			}
 			apicid = new_apicid;
 			cpus_found++;
@@ -209,7 +209,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 						  const struct cpumask *andmask)
 {
-	int apicid = cpu_to_logical_apicid(0);
+	int apicid = es7000_cpu_to_logical_apicid(0);
 	cpumask_var_t cpumask;
 
 	if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
arch/x86/include/asm/mach-default/mach_apic.h +1 -1
index 2f78209..eae3e4b 100644
@@ -105,7 +105,7 @@ static inline physid_mask_t default_ioapic_phys_id_map(physid_mask_t phys_map)
 }
 
 /* Mapping from cpu number to logical apicid */
-static inline int cpu_to_logical_apicid(int cpu)
+static inline int default_cpu_to_logical_apicid(int cpu)
 {
 	return 1 << cpu;
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index b585a8e..2ea913e 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define cpu_to_logical_apicid (apic->cpu_to_logical_apicid) 
 #define cpu_present_to_apicid (apic->cpu_present_to_apicid)
 #define apicid_to_cpu_present (apic->apicid_to_cpu_present)
 #define setup_portio_remap (apic->setup_portio_remap)
arch/x86/include/asm/numaq/apic.h +2 -1
index a0e3b43..6989abd 100644
@@ -56,7 +56,8 @@ static inline physid_mask_t numaq_ioapic_phys_id_map(physid_mask_t phys_map)
 
 /* Mapping from cpu number to logical apicid */
 extern u8 cpu_2_logical_apicid[];
-static inline int cpu_to_logical_apicid(int cpu)
+
+static inline int numaq_cpu_to_logical_apicid(int cpu)
 {
 	if (cpu >= nr_cpu_ids)
 		return BAD_APICID;
arch/x86/include/asm/summit/apic.h +4 -4
index cfff276..d564d7e 100644
@@ -85,7 +85,7 @@ static inline int summit_apicid_to_node(int logical_apicid)
 }
 
 /* Mapping from cpu number to logical apicid */
-static inline int cpu_to_logical_apicid(int cpu)
+static inline int summit_cpu_to_logical_apicid(int cpu)
 {
 #ifdef CONFIG_SMP
 	if (cpu >= nr_cpu_ids)
@@ -145,10 +145,10 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = first_cpu(*cpumask);
-	apicid = cpu_to_logical_apicid(cpu);
+	apicid = summit_cpu_to_logical_apicid(cpu);
 	while (cpus_found < num_bits_set) {
 		if (cpu_isset(cpu, *cpumask)) {
-			int new_apicid = cpu_to_logical_apicid(cpu);
+			int new_apicid = summit_cpu_to_logical_apicid(cpu);
 			if (apicid_cluster(apicid) !=
 					apicid_cluster(new_apicid)){
 				printk ("%s: Not a valid mask!\n", __func__);
@@ -165,7 +165,7 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 						  const struct cpumask *andmask)
 {
-	int apicid = cpu_to_logical_apicid(0);
+	int apicid = summit_cpu_to_logical_apicid(0);
 	cpumask_var_t cpumask;
 
 	if (!alloc_cpumask_var(&cpumask, GFP_ATOMIC))
arch/x86/kernel/ipi.c +2 -2
index e2e4895..367c5e6 100644
@@ -140,7 +140,7 @@ void send_IPI_mask_sequence(const struct cpumask *mask, int vector)
 
 	local_irq_save(flags);
 	for_each_cpu(query_cpu, mask)
-		__send_IPI_dest_field(cpu_to_logical_apicid(query_cpu), vector);
+		__send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu), vector);
 	local_irq_restore(flags);
 }
 
@@ -155,7 +155,7 @@ void send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 	local_irq_save(flags);
 	for_each_cpu(query_cpu, mask)
 		if (query_cpu != this_cpu)
-			__send_IPI_dest_field(cpu_to_logical_apicid(query_cpu),
+			__send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu),
 					      vector);
 	local_irq_restore(flags);
 }
arch/x86/mach-generic/bigsmp.c +1 -1
index 2f41214..cd6f02b 100644
@@ -81,7 +81,7 @@ struct genapic apic_bigsmp = {
 	.setup_apic_routing		= bigsmp_setup_apic_routing,
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= bigsmp_apicid_to_node,
-	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_to_logical_apicid		= bigsmp_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
arch/x86/mach-generic/default.c +1 -1
index d391c2d..ef9b936 100644
@@ -62,7 +62,7 @@ struct genapic apic_default = {
 	.setup_apic_routing		= default_setup_apic_routing,
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= default_apicid_to_node,
-	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
arch/x86/mach-generic/es7000.c +1 -1
index 933f2a3..74bf2b6 100644
@@ -123,7 +123,7 @@ struct genapic apic_es7000 = {
 	.setup_apic_routing		= es7000_setup_apic_routing,
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= es7000_apicid_to_node,
-	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_to_logical_apicid		= es7000_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
arch/x86/mach-generic/numaq.c +1 -1
index 38344fb..461f5be 100644
@@ -68,7 +68,7 @@ struct genapic apic_numaq = {
 	.setup_apic_routing		= numaq_setup_apic_routing,
 	.multi_timer_check		= numaq_multi_timer_check,
 	.apicid_to_node			= numaq_apicid_to_node,
-	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_to_logical_apicid		= numaq_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
arch/x86/mach-generic/summit.c +1 -1
index 6150604..d99be2d 100644
@@ -61,7 +61,7 @@ struct genapic apic_summit = {
 	.setup_apic_routing		= summit_setup_apic_routing,
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= summit_apicid_to_node,
-	.cpu_to_logical_apicid		= cpu_to_logical_apicid,
+	.cpu_to_logical_apicid		= summit_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
Signature · 1 line
1.6.0.2
#44 lore raw

PATCH 44/114 x86, apic: clean up ->cpu_present_to_apicid()

In reply to Ingo Molnar

- separate the namespace

- remove macros

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/genapic.h                |    2 ++
 arch/x86/include/asm/mach-default/mach_apic.h |   11 ++++++++++-
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/genapic_flat_64.c             |    4 ++--
 arch/x86/kernel/genx2apic_cluster.c           |    2 +-
 arch/x86/kernel/genx2apic_phys.c              |    2 +-
 arch/x86/kernel/genx2apic_uv_x.c              |    2 +-
 arch/x86/kernel/smpboot.c                     |    9 ++++++++-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 17 files changed, 34 insertions(+), 17 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index d0d894f..eea5e97 100644
@@ -67,7 +67,7 @@ static inline int bigsmp_apicid_to_node(int logical_apicid)
 	return apicid_2_node[hard_smp_processor_id()];
 }
 
-static inline int cpu_present_to_apicid(int mps_cpu)
+static inline int bigsmp_cpu_present_to_apicid(int mps_cpu)
 {
 	if (mps_cpu < nr_cpu_ids)
 		return (int) per_cpu(x86_bios_cpu_apicid, mps_cpu);
arch/x86/include/asm/es7000/apic.h +1 -1
index e0cd07e..7cdde3d 100644
@@ -88,7 +88,7 @@ static inline int es7000_apicid_to_node(int logical_apicid)
 }
 
 
-static inline int cpu_present_to_apicid(int mps_cpu)
+static inline int es7000_cpu_present_to_apicid(int mps_cpu)
 {
 	if (!mps_cpu)
 		return boot_cpu_physical_apicid;
arch/x86/include/asm/genapic.h +2 -0
index 38b1202..2cb14d5 100644
@@ -108,6 +108,8 @@ extern struct genapic apic_x2apic_uv_x;
 DECLARE_PER_CPU(int, x2apic_extra_bits);
 
 extern void default_setup_apic_routing(void);
+
+extern int default_cpu_present_to_apicid(int mps_cpu);
 #endif
 
 #endif /* _ASM_X86_GENAPIC_64_H */
arch/x86/include/asm/mach-default/mach_apic.h +10 -1
index eae3e4b..15d5627 100644
@@ -110,7 +110,7 @@ static inline int default_cpu_to_logical_apicid(int cpu)
 	return 1 << cpu;
 }
 
-static inline int cpu_present_to_apicid(int mps_cpu)
+static inline int __default_cpu_present_to_apicid(int mps_cpu)
 {
 	if (mps_cpu < nr_cpu_ids && cpu_present(mps_cpu))
 		return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
@@ -118,6 +118,15 @@ static inline int cpu_present_to_apicid(int mps_cpu)
 		return BAD_APICID;
 }
 
+#ifdef CONFIG_X86_32
+static inline int default_cpu_present_to_apicid(int mps_cpu)
+{
+	return __default_cpu_present_to_apicid(mps_cpu);
+}
+#else
+extern int default_cpu_present_to_apicid(int mps_cpu);
+#endif
+
 static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
 {
 	return physid_mask_of_physid(phys_apicid);
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 2ea913e..332fe93 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define cpu_present_to_apicid (apic->cpu_present_to_apicid)
 #define apicid_to_cpu_present (apic->apicid_to_cpu_present)
 #define setup_portio_remap (apic->setup_portio_remap)
 #define check_phys_apicid_present (apic->check_phys_apicid_present)
arch/x86/include/asm/numaq/apic.h +1 -1
index 6989abd..f482b06 100644
@@ -69,7 +69,7 @@ static inline int numaq_cpu_to_logical_apicid(int cpu)
  * cpu to APIC ID relation to properly interact with the intelligent
  * mode of the cluster controller.
  */
-static inline int cpu_present_to_apicid(int mps_cpu)
+static inline int numaq_cpu_present_to_apicid(int mps_cpu)
 {
 	if (mps_cpu < 60)
 		return ((mps_cpu >> 2) << 4) | (1 << (mps_cpu & 0x3));
arch/x86/include/asm/summit/apic.h +1 -1
index d564d7e..fc12736 100644
@@ -96,7 +96,7 @@ static inline int summit_cpu_to_logical_apicid(int cpu)
 #endif
 }
 
-static inline int cpu_present_to_apicid(int mps_cpu)
+static inline int summit_cpu_present_to_apicid(int mps_cpu)
 {
 	if (mps_cpu < nr_cpu_ids)
 		return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
arch/x86/kernel/genapic_flat_64.c +2 -2
index 9446f37..f4a2c1c 100644
@@ -197,7 +197,7 @@ struct genapic apic_flat =  {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= NULL,
 	.cpu_to_logical_apicid		= NULL,
-	.cpu_present_to_apicid		= NULL,
+	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= NULL,
@@ -341,7 +341,7 @@ struct genapic apic_physflat =  {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= NULL,
 	.cpu_to_logical_apicid		= NULL,
-	.cpu_present_to_apicid		= NULL,
+	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= NULL,
arch/x86/kernel/genx2apic_cluster.c +1 -1
index 2eeca6e..710d612 100644
@@ -199,7 +199,7 @@ struct genapic apic_x2apic_cluster = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= NULL,
 	.cpu_to_logical_apicid		= NULL,
-	.cpu_present_to_apicid		= NULL,
+	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= NULL,
arch/x86/kernel/genx2apic_phys.c +1 -1
index be0ee3e..49a4491 100644
@@ -195,7 +195,7 @@ struct genapic apic_x2apic_phys = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= NULL,
 	.cpu_to_logical_apicid		= NULL,
-	.cpu_present_to_apicid		= NULL,
+	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= NULL,
arch/x86/kernel/genx2apic_uv_x.c +1 -1
index 68b423f..a08a635 100644
@@ -260,7 +260,7 @@ struct genapic apic_x2apic_uv_x = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= NULL,
 	.cpu_to_logical_apicid		= NULL,
-	.cpu_present_to_apicid		= NULL,
+	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= NULL,
arch/x86/kernel/smpboot.c +8 -1
index 1dd4cec..812bf39 100644
@@ -903,9 +903,16 @@ do_rest:
 	return boot_error;
 }
 
+#ifdef CONFIG_X86_64
+int default_cpu_present_to_apicid(int mps_cpu)
+{
+	return __default_cpu_present_to_apicid(mps_cpu);
+}
+#endif
+
 int __cpuinit native_cpu_up(unsigned int cpu)
 {
-	int apicid = cpu_present_to_apicid(cpu);
+	int apicid = apic->cpu_present_to_apicid(cpu);
 	unsigned long flags;
 	int err;
 
arch/x86/mach-generic/bigsmp.c +1 -1
index cd6f02b..1eaf18c 100644
@@ -82,7 +82,7 @@ struct genapic apic_bigsmp = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= bigsmp_apicid_to_node,
 	.cpu_to_logical_apicid		= bigsmp_cpu_to_logical_apicid,
-	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.cpu_present_to_apicid		= bigsmp_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
arch/x86/mach-generic/default.c +1 -1
index ef9b936..2903657 100644
@@ -63,7 +63,7 @@ struct genapic apic_default = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= default_apicid_to_node,
 	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
-	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
arch/x86/mach-generic/es7000.c +1 -1
index 74bf2b6..5a3a8ab 100644
@@ -124,7 +124,7 @@ struct genapic apic_es7000 = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= es7000_apicid_to_node,
 	.cpu_to_logical_apicid		= es7000_cpu_to_logical_apicid,
-	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.cpu_present_to_apicid		= es7000_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
arch/x86/mach-generic/numaq.c +1 -1
index 461f5be..d928cae 100644
@@ -69,7 +69,7 @@ struct genapic apic_numaq = {
 	.multi_timer_check		= numaq_multi_timer_check,
 	.apicid_to_node			= numaq_apicid_to_node,
 	.cpu_to_logical_apicid		= numaq_cpu_to_logical_apicid,
-	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.cpu_present_to_apicid		= numaq_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
arch/x86/mach-generic/summit.c +1 -1
index d99be2d..e6bb34e 100644
@@ -62,7 +62,7 @@ struct genapic apic_summit = {
 	.multi_timer_check		= NULL,
 	.apicid_to_node			= summit_apicid_to_node,
 	.cpu_to_logical_apicid		= summit_cpu_to_logical_apicid,
-	.cpu_present_to_apicid		= cpu_present_to_apicid,
+	.cpu_present_to_apicid		= summit_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
Signature · 1 line
1.6.0.2
#45 lore raw

PATCH 45/114 x86, apic: clean up ->apicid_to_cpu_present()

In reply to Ingo Molnar

- separate the namespace

- remove macros

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    4 ++--
 arch/x86/kernel/io_apic.c                     |    4 ++--
 arch/x86/kernel/visws_quirks.c                |    2 +-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 13 files changed, 14 insertions(+), 15 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index eea5e97..0804574 100644
@@ -75,7 +75,7 @@ static inline int bigsmp_cpu_present_to_apicid(int mps_cpu)
 	return BAD_APICID;
 }
 
-static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
+static inline physid_mask_t bigsmp_apicid_to_cpu_present(int phys_apicid)
 {
 	return physid_mask_of_physid(phys_apicid);
 }
arch/x86/include/asm/es7000/apic.h +1 -1
index 7cdde3d..a09e113 100644
@@ -98,7 +98,7 @@ static inline int es7000_cpu_present_to_apicid(int mps_cpu)
 		return BAD_APICID;
 }
 
-static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
+static inline physid_mask_t es7000_apicid_to_cpu_present(int phys_apicid)
 {
 	static int id = 0;
 	physid_mask_t mask;
arch/x86/include/asm/mach-default/mach_apic.h +1 -1
index 15d5627..22683e5 100644
@@ -127,7 +127,7 @@ static inline int default_cpu_present_to_apicid(int mps_cpu)
 extern int default_cpu_present_to_apicid(int mps_cpu);
 #endif
 
-static inline physid_mask_t apicid_to_cpu_present(int phys_apicid)
+static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
 {
 	return physid_mask_of_physid(phys_apicid);
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 332fe93..997618f 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define apicid_to_cpu_present (apic->apicid_to_cpu_present)
 #define setup_portio_remap (apic->setup_portio_remap)
 #define check_phys_apicid_present (apic->check_phys_apicid_present)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
arch/x86/include/asm/numaq/apic.h +1 -1
index f482b06..8ac000f 100644
@@ -82,7 +82,7 @@ static inline int numaq_apicid_to_node(int logical_apicid)
 	return logical_apicid >> 4;
 }
 
-static inline physid_mask_t apicid_to_cpu_present(int logical_apicid)
+static inline physid_mask_t numaq_apicid_to_cpu_present(int logical_apicid)
 {
 	int node = numaq_apicid_to_node(logical_apicid);
 	int cpu = __ffs(logical_apicid & 0xf);
arch/x86/include/asm/summit/apic.h +2 -2
index fc12736..79c1a45 100644
@@ -105,13 +105,13 @@ static inline int summit_cpu_present_to_apicid(int mps_cpu)
 }
 
 static inline physid_mask_t
- summit_ioapic_phys_id_map(physid_mask_t phys_id_map)
+summit_ioapic_phys_id_map(physid_mask_t phys_id_map)
 {
 	/* For clustered we don't have a good way to do this yet - hack */
 	return physids_promote(0x0F);
 }
 
-static inline physid_mask_t apicid_to_cpu_present(int apicid)
+static inline physid_mask_t summit_apicid_to_cpu_present(int apicid)
 {
 	return physid_mask_of_physid(0);
 }
arch/x86/kernel/io_apic.c +2 -2
index 282ea11..3d85d3d 100644
@@ -2155,7 +2155,7 @@ static void __init setup_ioapic_ids_from_mpc(void)
 			mp_ioapics[apic_id].apicid = i;
 		} else {
 			physid_mask_t tmp;
-			tmp = apicid_to_cpu_present(mp_ioapics[apic_id].apicid);
+			tmp = apic->apicid_to_cpu_present(mp_ioapics[apic_id].apicid);
 			apic_printk(APIC_VERBOSE, "Setting %d in the "
 					"phys_id_present_map\n",
 					mp_ioapics[apic_id].apicid);
@@ -3899,7 +3899,7 @@ int __init io_apic_get_unique_id(int ioapic, int apic_id)
 		apic_id = i;
 	}
 
-	tmp = apicid_to_cpu_present(apic_id);
+	tmp = apic->apicid_to_cpu_present(apic_id);
 	physids_or(apic_id_map, apic_id_map, tmp);
 
 	if (reg_00.bits.ID != apic_id) {
arch/x86/kernel/visws_quirks.c +1 -1
index d801d06..2ed5bdf 100644
@@ -200,7 +200,7 @@ static void __init MP_processor_info(struct mpc_cpu *m)
 		return;
 	}
 
-	apic_cpus = apicid_to_cpu_present(m->apicid);
+	apic_cpus = apic->apicid_to_cpu_present(m->apicid);
 	physids_or(phys_cpu_present_map, phys_cpu_present_map, apic_cpus);
 	/*
 	 * Validate version
arch/x86/mach-generic/bigsmp.c +1 -1
index 1eaf18c..6139652 100644
@@ -83,7 +83,7 @@ struct genapic apic_bigsmp = {
 	.apicid_to_node			= bigsmp_apicid_to_node,
 	.cpu_to_logical_apicid		= bigsmp_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= bigsmp_cpu_present_to_apicid,
-	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.apicid_to_cpu_present		= bigsmp_apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
arch/x86/mach-generic/default.c +1 -1
index 2903657..8fc704a 100644
@@ -64,7 +64,7 @@ struct genapic apic_default = {
 	.apicid_to_node			= default_apicid_to_node,
 	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
-	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.apicid_to_cpu_present		= default_apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
arch/x86/mach-generic/es7000.c +1 -1
index 5a3a8ab..1e0e162 100644
@@ -125,7 +125,7 @@ struct genapic apic_es7000 = {
 	.apicid_to_node			= es7000_apicid_to_node,
 	.cpu_to_logical_apicid		= es7000_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= es7000_cpu_present_to_apicid,
-	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.apicid_to_cpu_present		= es7000_apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
arch/x86/mach-generic/numaq.c +1 -1
index d928cae..839b86b 100644
@@ -70,7 +70,7 @@ struct genapic apic_numaq = {
 	.apicid_to_node			= numaq_apicid_to_node,
 	.cpu_to_logical_apicid		= numaq_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= numaq_cpu_present_to_apicid,
-	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.apicid_to_cpu_present		= numaq_apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
arch/x86/mach-generic/summit.c +1 -1
index e6bb34e..b6e3760 100644
@@ -63,7 +63,7 @@ struct genapic apic_summit = {
 	.apicid_to_node			= summit_apicid_to_node,
 	.cpu_to_logical_apicid		= summit_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= summit_cpu_present_to_apicid,
-	.apicid_to_cpu_present		= apicid_to_cpu_present,
+	.apicid_to_cpu_present		= summit_apicid_to_cpu_present,
 	.setup_portio_remap		= setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
Signature · 1 line
1.6.0.2
#46 lore raw

PATCH 46/114 x86: refactor ->setup_portio_remap() subarch methods

In reply to Ingo Molnar

Only NUMAQ has a real ->setup_portio_remap() method, the other subarchitectures define it but keep it empty.

So mark the vector as NULL, extend the generic code to handle NULL -setup_portio_remap() entries and remove all the empty handlers.

Also move the NUMAQ method from the header file into the
apic driver .c file.

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    4 ----
 arch/x86/include/asm/mach-default/mach_apic.h |    4 ----
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |   13 -------------
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/smpboot.c                     |    3 ++-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |   15 ++++++++++++++-
 arch/x86/mach-generic/summit.c                |    2 +-
 12 files changed, 22 insertions(+), 30 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index 0804574..2fa7003 100644
@@ -95,7 +95,7 @@ static inline physid_mask_t bigsmp_ioapic_phys_id_map(physid_mask_t phys_map)
 	return physids_promote(0xFFL);
 }
 
-static inline void setup_portio_remap(void)
+static inline void bigsmp_setup_portio_remap(void)
 {
 }
 
arch/x86/include/asm/es7000/apic.h +0 -4
index a09e113..c5b0eb5 100644
@@ -127,10 +127,6 @@ static inline physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
 }
 
 
-static inline void setup_portio_remap(void)
-{
-}
-
 extern unsigned int boot_cpu_physical_apicid;
 static inline int check_phys_apicid_present(int cpu_physical_apicid)
 {
arch/x86/include/asm/mach-default/mach_apic.h +0 -4
index 22683e5..54c20e1 100644
@@ -132,10 +132,6 @@ static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
 	return physid_mask_of_physid(phys_apicid);
 }
 
-static inline void setup_portio_remap(void)
-{
-}
-
 static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
 {
 	return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 997618f..393a97c 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define setup_portio_remap (apic->setup_portio_remap)
 #define check_phys_apicid_present (apic->check_phys_apicid_present)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
arch/x86/include/asm/numaq/apic.h +0 -13
index 8ac000f..6b62651 100644
@@ -92,19 +92,6 @@ static inline physid_mask_t numaq_apicid_to_cpu_present(int logical_apicid)
 
 extern void *xquad_portio;
 
-static inline void setup_portio_remap(void)
-{
-	int num_quads = num_online_nodes();
-
-	if (num_quads <= 1)
-       		return;
-
-	printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
-	xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
-	printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
-		(u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
-}
-
 static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
 {
 	return (1);
arch/x86/include/asm/summit/apic.h +1 -1
index 79c1a45..131343b 100644
@@ -116,7 +116,7 @@ static inline physid_mask_t summit_apicid_to_cpu_present(int apicid)
 	return physid_mask_of_physid(0);
 }
 
-static inline void setup_portio_remap(void)
+static inline void summit_setup_portio_remap(void)
 {
 }
 
arch/x86/kernel/smpboot.c +2 -1
index 812bf39..0e7d26c 100644
@@ -1170,7 +1170,8 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 
 	map_cpu_to_logical_apicid();
 
-	setup_portio_remap();
+	if (apic->setup_portio_remap)
+		apic->setup_portio_remap();
 
 	smpboot_setup_io_apic();
 	/*
arch/x86/mach-generic/bigsmp.c +1 -1
index 6139652..4247405 100644
@@ -84,7 +84,7 @@ struct genapic apic_bigsmp = {
 	.cpu_to_logical_apicid		= bigsmp_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= bigsmp_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= bigsmp_apicid_to_cpu_present,
-	.setup_portio_remap		= setup_portio_remap,
+	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
arch/x86/mach-generic/default.c +1 -1
index 8fc704a..b48a58d 100644
@@ -65,7 +65,7 @@ struct genapic apic_default = {
 	.cpu_to_logical_apicid		= default_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= default_apicid_to_cpu_present,
-	.setup_portio_remap		= setup_portio_remap,
+	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
arch/x86/mach-generic/es7000.c +1 -1
index 1e0e162..449eca5 100644
@@ -126,7 +126,7 @@ struct genapic apic_es7000 = {
 	.cpu_to_logical_apicid		= es7000_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= es7000_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= es7000_apicid_to_cpu_present,
-	.setup_portio_remap		= setup_portio_remap,
+	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
arch/x86/mach-generic/numaq.c +14 -1
index 839b86b..e60361b 100644
@@ -44,6 +44,19 @@ static void numaq_vector_allocation_domain(int cpu, cpumask_t *retmask)
 	*retmask = (cpumask_t){ { [0] = APIC_ALL_CPUS, } };
 }
 
+static void numaq_setup_portio_remap(void)
+{
+	int num_quads = num_online_nodes();
+
+	if (num_quads <= 1)
+       		return;
+
+	printk("Remapping cross-quad port I/O for %d quads\n", num_quads);
+	xquad_portio = ioremap(XQUAD_PORTIO_BASE, num_quads*XQUAD_PORTIO_QUAD);
+	printk("xquad_portio vaddr 0x%08lx, len %08lx\n",
+		(u_long) xquad_portio, (u_long) num_quads*XQUAD_PORTIO_QUAD);
+}
+
 struct genapic apic_numaq = {
 
 	.name				= "NUMAQ",
@@ -71,7 +84,7 @@ struct genapic apic_numaq = {
 	.cpu_to_logical_apicid		= numaq_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= numaq_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= numaq_apicid_to_cpu_present,
-	.setup_portio_remap		= setup_portio_remap,
+	.setup_portio_remap		= numaq_setup_portio_remap,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
arch/x86/mach-generic/summit.c +1 -1
index b6e3760..ffcf7ca 100644
@@ -64,7 +64,7 @@ struct genapic apic_summit = {
 	.cpu_to_logical_apicid		= summit_cpu_to_logical_apicid,
 	.cpu_present_to_apicid		= summit_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= summit_apicid_to_cpu_present,
-	.setup_portio_remap		= setup_portio_remap,
+	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
Signature · 1 line
1.6.0.2
#47 lore raw

PATCH 47/114 x86: refactor ->check_phys_apicid_present() subarch methods

In reply to Ingo Molnar

- spread out the namespace to per driver methods

- extend it to 64-bit as well so that we can use apic->check_phys_apicid_present() unconditionally

---
 arch/x86/include/asm/bigsmp/apic.h            |    6 +++---
 arch/x86/include/asm/es7000/apic.h            |    4 ++--
 arch/x86/include/asm/genapic.h                |    1 +
 arch/x86/include/asm/mach-default/mach_apic.h |   18 +++++++++++++-----
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    4 ++--
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/genapic_flat_64.c             |    4 ++--
 arch/x86/kernel/genx2apic_cluster.c           |    2 +-
 arch/x86/kernel/genx2apic_phys.c              |    2 +-
 arch/x86/kernel/genx2apic_uv_x.c              |    2 +-
 arch/x86/kernel/smpboot.c                     |    7 ++++++-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 17 files changed, 38 insertions(+), 25 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +3 -3
index 2fa7003..5ba4118 100644
@@ -99,13 +99,13 @@ static inline void bigsmp_setup_portio_remap(void)
 {
 }
 
-static inline void enable_apic_mode(void)
+static inline int bigsmp_check_phys_apicid_present(int boot_cpu_physical_apicid)
 {
+	return 1;
 }
 
-static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
+static inline void enable_apic_mode(void)
 {
-	return (1);
 }
 
 /* As we are using single CPU as destination, pick only one CPU here */
arch/x86/include/asm/es7000/apic.h +2 -2
index c5b0eb5..717c27f 100644
@@ -126,9 +126,9 @@ static inline physid_mask_t es7000_ioapic_phys_id_map(physid_mask_t phys_map)
 	return physids_promote(0xff);
 }
 
-
 extern unsigned int boot_cpu_physical_apicid;
-static inline int check_phys_apicid_present(int cpu_physical_apicid)
+
+static inline int es7000_check_phys_apicid_present(int cpu_physical_apicid)
 {
 	boot_cpu_physical_apicid = read_apic_id();
 	return (1);
arch/x86/include/asm/genapic.h +1 -0
index 2cb14d5..f292fd0 100644
@@ -110,6 +110,7 @@ DECLARE_PER_CPU(int, x2apic_extra_bits);
 extern void default_setup_apic_routing(void);
 
 extern int default_cpu_present_to_apicid(int mps_cpu);
+extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid);
 #endif
 
 #endif /* _ASM_X86_GENAPIC_64_H */
arch/x86/include/asm/mach-default/mach_apic.h +13 -5
index 54c20e1..0a824d3 100644
@@ -118,13 +118,26 @@ static inline int __default_cpu_present_to_apicid(int mps_cpu)
 		return BAD_APICID;
 }
 
+static inline int
+__default_check_phys_apicid_present(int boot_cpu_physical_apicid)
+{
+	return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
+}
+
 #ifdef CONFIG_X86_32
 static inline int default_cpu_present_to_apicid(int mps_cpu)
 {
 	return __default_cpu_present_to_apicid(mps_cpu);
 }
+
+static inline int
+default_check_phys_apicid_present(int boot_cpu_physical_apicid)
+{
+	return __default_check_phys_apicid_present(boot_cpu_physical_apicid);
+}
 #else
 extern int default_cpu_present_to_apicid(int mps_cpu);
+extern int default_check_phys_apicid_present(int boot_cpu_physical_apicid);
 #endif
 
 static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
@@ -132,11 +145,6 @@ static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
 	return physid_mask_of_physid(phys_apicid);
 }
 
-static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
-{
-	return physid_isset(boot_cpu_physical_apicid, phys_cpu_present_map);
-}
-
 static inline void enable_apic_mode(void)
 {
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 393a97c..efd762d 100644
@@ -3,7 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define check_phys_apicid_present (apic->check_phys_apicid_present)
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
 #define enable_apic_mode (apic->enable_apic_mode)
arch/x86/include/asm/numaq/apic.h +2 -2
index 6b62651..3be735e 100644
@@ -92,9 +92,9 @@ static inline physid_mask_t numaq_apicid_to_cpu_present(int logical_apicid)
 
 extern void *xquad_portio;
 
-static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
+static inline int numaq_check_phys_apicid_present(int boot_cpu_physical_apicid)
 {
-	return (1);
+	return 1;
 }
 
 static inline void enable_apic_mode(void)
arch/x86/include/asm/summit/apic.h +1 -1
index 131343b..fe578f6 100644
@@ -120,7 +120,7 @@ static inline void summit_setup_portio_remap(void)
 {
 }
 
-static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
+static inline int summit_check_phys_apicid_present(int boot_cpu_physical_apicid)
 {
 	return 1;
 }
arch/x86/kernel/genapic_flat_64.c +2 -2
index f4a2c1c..78adf71 100644
@@ -200,7 +200,7 @@ struct genapic apic_flat =  {
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= NULL,
+	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= NULL,
@@ -344,7 +344,7 @@ struct genapic apic_physflat =  {
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= NULL,
+	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= NULL,
arch/x86/kernel/genx2apic_cluster.c +1 -1
index 710d612..7062e24 100644
@@ -202,7 +202,7 @@ struct genapic apic_x2apic_cluster = {
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= NULL,
+	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= NULL,
arch/x86/kernel/genx2apic_phys.c +1 -1
index 49a4491..7177a11 100644
@@ -198,7 +198,7 @@ struct genapic apic_x2apic_phys = {
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= NULL,
+	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= NULL,
arch/x86/kernel/genx2apic_uv_x.c +1 -1
index a08a635..debd721 100644
@@ -263,7 +263,7 @@ struct genapic apic_x2apic_uv_x = {
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= NULL,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= NULL,
+	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= NULL,
arch/x86/kernel/smpboot.c +6 -1
index 0e7d26c..ab83be2 100644
@@ -908,6 +908,11 @@ int default_cpu_present_to_apicid(int mps_cpu)
 {
 	return __default_cpu_present_to_apicid(mps_cpu);
 }
+
+int default_check_phys_apicid_present(int boot_cpu_physical_apicid)
+{
+	return __default_check_phys_apicid_present(boot_cpu_physical_apicid);
+}
 #endif
 
 int __cpuinit native_cpu_up(unsigned int cpu)
@@ -1058,7 +1063,7 @@ static int __init smp_sanity_check(unsigned max_cpus)
 	 * Should not be necessary because the MP table should list the boot
 	 * CPU too, but we do it for the sake of robustness anyway.
 	 */
-	if (!check_phys_apicid_present(boot_cpu_physical_apicid)) {
+	if (!apic->check_phys_apicid_present(boot_cpu_physical_apicid)) {
 		printk(KERN_NOTICE
 			"weird, boot CPU (#%d) not listed by the BIOS.\n",
 			boot_cpu_physical_apicid);
arch/x86/mach-generic/bigsmp.c +1 -1
index 4247405..82743d1 100644
@@ -85,7 +85,7 @@ struct genapic apic_bigsmp = {
 	.cpu_present_to_apicid		= bigsmp_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= bigsmp_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= check_phys_apicid_present,
+	.check_phys_apicid_present	= bigsmp_check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
arch/x86/mach-generic/default.c +1 -1
index b48a58d..d0374c6 100644
@@ -66,7 +66,7 @@ struct genapic apic_default = {
 	.cpu_present_to_apicid		= default_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= default_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= check_phys_apicid_present,
+	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
arch/x86/mach-generic/es7000.c +1 -1
index 449eca5..52b3eb5 100644
@@ -127,7 +127,7 @@ struct genapic apic_es7000 = {
 	.cpu_present_to_apicid		= es7000_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= es7000_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= check_phys_apicid_present,
+	.check_phys_apicid_present	= es7000_check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
arch/x86/mach-generic/numaq.c +1 -1
index e60361b..7ec2ca4 100644
@@ -85,7 +85,7 @@ struct genapic apic_numaq = {
 	.cpu_present_to_apicid		= numaq_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= numaq_apicid_to_cpu_present,
 	.setup_portio_remap		= numaq_setup_portio_remap,
-	.check_phys_apicid_present	= check_phys_apicid_present,
+	.check_phys_apicid_present	= numaq_check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
arch/x86/mach-generic/summit.c +1 -1
index ffcf7ca..acf12de 100644
@@ -65,7 +65,7 @@ struct genapic apic_summit = {
 	.cpu_present_to_apicid		= summit_cpu_present_to_apicid,
 	.apicid_to_cpu_present		= summit_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
-	.check_phys_apicid_present	= check_phys_apicid_present,
+	.check_phys_apicid_present	= summit_check_phys_apicid_present,
 	.enable_apic_mode		= enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
Signature · 1 line
1.6.0.2
#48 lore raw

PATCH 48/114 x86: refactor ->enable_apic_mode() subarch methods

In reply to Ingo Molnar

Only ES7000 has a real ->enable_apic_mode() method, the other subarchitectures define it but keep it empty.

So mark the vector as NULL, extend the generic code to handle NULL -setup_portio_remap() entries and remove all the empty handlers.

---
 arch/x86/include/asm/bigsmp/apic.h            |    4 ----
 arch/x86/include/asm/mach-default/mach_apic.h |    3 ---
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    4 ----
 arch/x86/include/asm/summit/apic.h            |    4 ----
 arch/x86/kernel/apic.c                        |    3 ++-
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    6 +++---
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 11 files changed, 9 insertions(+), 24 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +0 -4
index 5ba4118..f49d440 100644
@@ -104,10 +104,6 @@ static inline int bigsmp_check_phys_apicid_present(int boot_cpu_physical_apicid)
 	return 1;
 }
 
-static inline void enable_apic_mode(void)
-{
-}
-
 /* As we are using single CPU as destination, pick only one CPU here */
 static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
arch/x86/include/asm/mach-default/mach_apic.h +0 -3
index 0a824d3..3647c92 100644
@@ -145,8 +145,5 @@ static inline physid_mask_t default_apicid_to_cpu_present(int phys_apicid)
 	return physid_mask_of_physid(phys_apicid);
 }
 
-static inline void enable_apic_mode(void)
-{
-}
 #endif /* CONFIG_X86_LOCAL_APIC */
 #endif /* _ASM_X86_MACH_DEFAULT_MACH_APIC_H */
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index efd762d..6fed521 100644
@@ -5,7 +5,6 @@
 
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
-#define enable_apic_mode (apic->enable_apic_mode)
 #define phys_pkg_id (apic->phys_pkg_id)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 
arch/x86/include/asm/numaq/apic.h +0 -4
index 3be735e..dc93c30 100644
@@ -97,10 +97,6 @@ static inline int numaq_check_phys_apicid_present(int boot_cpu_physical_apicid)
 	return 1;
 }
 
-static inline void enable_apic_mode(void)
-{
-}
-
 /*
  * We use physical apicids here, not logical, so just return the default
  * physical broadcast to stop people from breaking us
arch/x86/include/asm/summit/apic.h +0 -4
index fe578f6..526d19e 100644
@@ -125,10 +125,6 @@ static inline int summit_check_phys_apicid_present(int boot_cpu_physical_apicid)
 	return 1;
 }
 
-static inline void enable_apic_mode(void)
-{
-}
-
 static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
 	int num_bits_set;
arch/x86/kernel/apic.c +2 -1
index fcbcc03..9d6374d 100644
@@ -1763,7 +1763,8 @@ void __init connect_bsp_APIC(void)
 		outb(0x01, 0x23);
 	}
 #endif
-	enable_apic_mode();
+	if (apic->enable_apic_mode)
+		apic->enable_apic_mode();
 }
 
 /**
arch/x86/mach-generic/bigsmp.c +1 -1
index 82743d1..e151b47 100644
@@ -86,7 +86,7 @@ struct genapic apic_bigsmp = {
 	.apicid_to_cpu_present		= bigsmp_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= bigsmp_check_phys_apicid_present,
-	.enable_apic_mode		= enable_apic_mode,
+	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
arch/x86/mach-generic/default.c +1 -1
index d0374c6..ac6be19 100644
@@ -67,7 +67,7 @@ struct genapic apic_default = {
 	.apicid_to_cpu_present		= default_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
-	.enable_apic_mode		= enable_apic_mode,
+	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
arch/x86/mach-generic/es7000.c +3 -3
index 52b3eb5..9acb711 100644
@@ -36,10 +36,10 @@ static int probe_es7000(void)
 }
 
 extern void es7000_sw_apic(void);
-static void __init enable_apic_mode(void)
+
+static void __init es7000_enable_apic_mode(void)
 {
 	es7000_sw_apic();
-	return;
 }
 
 static __init int
@@ -128,7 +128,7 @@ struct genapic apic_es7000 = {
 	.apicid_to_cpu_present		= es7000_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= es7000_check_phys_apicid_present,
-	.enable_apic_mode		= enable_apic_mode,
+	.enable_apic_mode		= es7000_enable_apic_mode,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
arch/x86/mach-generic/numaq.c +1 -1
index 7ec2ca4..8d3358d 100644
@@ -86,7 +86,7 @@ struct genapic apic_numaq = {
 	.apicid_to_cpu_present		= numaq_apicid_to_cpu_present,
 	.setup_portio_remap		= numaq_setup_portio_remap,
 	.check_phys_apicid_present	= numaq_check_phys_apicid_present,
-	.enable_apic_mode		= enable_apic_mode,
+	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
arch/x86/mach-generic/summit.c +1 -1
index acf12de..cb83bcb 100644
@@ -66,7 +66,7 @@ struct genapic apic_summit = {
 	.apicid_to_cpu_present		= summit_apicid_to_cpu_present,
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= summit_check_phys_apicid_present,
-	.enable_apic_mode		= enable_apic_mode,
+	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
Signature · 1 line
1.6.0.2
#49 lore raw

PATCH 49/114 x86, es7000: clean up es7000_enable_apic_mode()

In reply to Ingo Molnar

- eliminate the needless es7000_enable_apic_mode() complication which was not apparent prior the namespace cleanups

- clean up the control flow in es7000_enable_apic_mode()

- other cleanups

---
 arch/x86/include/asm/es7000/apic.h |    2 ++
 arch/x86/kernel/es7000_32.c        |   27 ++++++++++++++-------------
 arch/x86/mach-generic/es7000.c     |    7 -------
 3 files changed, 16 insertions(+), 20 deletions(-)
arch/x86/include/asm/es7000/apic.h +2 -0
index 717c27f..038c4f0 100644
@@ -36,6 +36,8 @@ static inline unsigned long es7000_check_apicid_present(int bit)
 	return physid_isset(bit, phys_cpu_present_map);
 }
 
+extern void es7000_enable_apic_mode(void);
+
 #define apicid_cluster(apicid) (apicid & 0xF0)
 
 static inline unsigned long calculate_ldr(int cpu)
arch/x86/kernel/es7000_32.c +14 -13
index 20a2a43..e73fe18 100644
@@ -359,20 +359,21 @@ es7000_mip_write(struct mip_reg *mip_reg)
 	return status;
 }
 
-void __init
-es7000_sw_apic(void)
+void __init es7000_enable_apic_mode(void)
 {
-	if (es7000_plat) {
-		int mip_status;
-		struct mip_reg es7000_mip_reg;
-
-		printk("ES7000: Enabling APIC mode.\n");
-        	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
-        	es7000_mip_reg.off_0 = MIP_SW_APIC;
-        	es7000_mip_reg.off_38 = (MIP_VALID);
-        	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0)
-              		printk("es7000_sw_apic: command failed, status = %x\n",
-				mip_status);
+	struct mip_reg es7000_mip_reg;
+	int mip_status;
+
+	if (!es7000_plat)
 		return;
+
+	printk("ES7000: Enabling APIC mode.\n");
+       	memset(&es7000_mip_reg, 0, sizeof(struct mip_reg));
+       	es7000_mip_reg.off_0 = MIP_SW_APIC;
+       	es7000_mip_reg.off_38 = MIP_VALID;
+
+       	while ((mip_status = es7000_mip_write(&es7000_mip_reg)) != 0) {
+		printk("es7000_enable_apic_mode: command failed, status = %x\n",
+			mip_status);
 	}
 }
arch/x86/mach-generic/es7000.c +0 -7
index 9acb711..1185964 100644
@@ -35,13 +35,6 @@ static int probe_es7000(void)
 	return 0;
 }
 
-extern void es7000_sw_apic(void);
-
-static void __init es7000_enable_apic_mode(void)
-{
-	es7000_sw_apic();
-}
-
 static __init int
 mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
Signature · 1 line
1.6.0.2
#50 lore raw

PATCH 50/114 x86, apic: unify phys_pkg_id()

In reply to Ingo Molnar

- unify the call signature of 64-bit to that of 32-bit

- clean up the types all around

- clean up namespace contamination

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/genapic.h                |    6 +-----
 arch/x86/include/asm/mach-default/mach_apic.h |    2 +-
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    5 +++--
 arch/x86/kernel/cpu/addon_cpuid_features.c    |   10 +---------
 arch/x86/kernel/cpu/common.c                  |   11 +----------
 arch/x86/kernel/genapic_flat_64.c             |    6 +++---
 arch/x86/kernel/genx2apic_cluster.c           |    4 ++--
 arch/x86/kernel/genx2apic_phys.c              |    4 ++--
 arch/x86/kernel/genx2apic_uv_x.c              |    4 ++--
 12 files changed, 19 insertions(+), 39 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index f49d440..b7cba5b 100644
@@ -133,7 +133,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return BAD_APICID;
 }
 
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/es7000/apic.h +1 -1
index 038c4f0..d2c6c20 100644
@@ -221,7 +221,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 	return apicid;
 }
 
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/genapic.h +1 -5
index f292fd0..14b19de 100644
@@ -48,11 +48,7 @@ struct genapic {
 	void (*setup_portio_remap)(void);
 	int (*check_phys_apicid_present)(int boot_cpu_physical_apicid);
 	void (*enable_apic_mode)(void);
-#ifdef CONFIG_X86_32
-	u32 (*phys_pkg_id)(u32 cpuid_apic, int index_msb);
-#else
-	unsigned int (*phys_pkg_id)(int index_msb);
-#endif
+	int (*phys_pkg_id)(int cpuid_apic, int index_msb);
 
 	/*
 	 * When one of the next two hooks returns 1 the genapic
arch/x86/include/asm/mach-default/mach_apic.h +1 -1
index 3647c92..55797a3 100644
@@ -65,7 +65,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return (unsigned int)(mask1 & mask2 & mask3);
 }
 
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/numaq/apic.h +1 -1
index dc93c30..bc2c8a4 100644
@@ -113,7 +113,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 }
 
 /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/summit/apic.h +3 -2
index 526d19e..64cd441 100644
@@ -175,13 +175,14 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 	return apicid;
 }
 
-/* cpuid returns the value latched in the HW at reset, not the APIC ID
+/*
+ * cpuid returns the value latched in the HW at reset, not the APIC ID
  * register's value.  For any box whose BIOS changes APIC IDs, like
  * clustered APIC systems, we must use hard_smp_processor_id.
  *
  * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
  */
-static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
+static inline int phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return hard_smp_processor_id() >> index_msb;
 }
arch/x86/kernel/cpu/addon_cpuid_features.c +1 -9
index 4e581fd..84f8e4a 100644
@@ -116,7 +116,6 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
 
 	core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
 
-#ifdef CONFIG_X86_32
 	c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width)
 						 & core_select_mask;
 	c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width);
@@ -124,14 +123,7 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
 	 * Reinit the apicid, now that we have extended initial_apicid.
 	 */
 	c->apicid = phys_pkg_id(c->initial_apicid, 0);
-#else
-	c->cpu_core_id = phys_pkg_id(ht_mask_width) & core_select_mask;
-	c->phys_proc_id = phys_pkg_id(core_plus_mask_width);
-	/*
-	 * Reinit the apicid, now that we have extended initial_apicid.
-	 */
-	c->apicid = phys_pkg_id(0);
-#endif
+
 	c->x86_max_cores = (core_level_siblings / smp_num_siblings);
 
 
arch/x86/kernel/cpu/common.c +1 -10
index 275e2cb..93c491c 100644
@@ -442,11 +442,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 		}
 
 		index_msb = get_count_order(smp_num_siblings);
-#ifdef CONFIG_X86_64
-		c->phys_proc_id = phys_pkg_id(index_msb);
-#else
 		c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb);
-#endif
 
 		smp_num_siblings = smp_num_siblings / c->x86_max_cores;
 
@@ -454,13 +450,8 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
 		core_bits = get_count_order(c->x86_max_cores);
 
-#ifdef CONFIG_X86_64
-		c->cpu_core_id = phys_pkg_id(index_msb) &
-					       ((1 << core_bits) - 1);
-#else
 		c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) &
 					       ((1 << core_bits) - 1);
-#endif
 	}
 
 out:
@@ -742,7 +733,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
 		this_cpu->c_identify(c);
 
 #ifdef CONFIG_X86_64
-	c->apicid = phys_pkg_id(0);
+	c->apicid = phys_pkg_id(c->initial_apicid, 0);
 #endif
 
 	/*
arch/x86/kernel/genapic_flat_64.c +3 -3
index 78adf71..cc9e07b 100644
@@ -169,7 +169,7 @@ static unsigned int flat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return mask1 & mask2;
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int flat_phys_pkg_id(int initial_apic_id, int index_msb)
 {
 	return hard_smp_processor_id() >> index_msb;
 }
@@ -202,7 +202,7 @@ struct genapic apic_flat =  {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= flat_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
@@ -346,7 +346,7 @@ struct genapic apic_physflat =  {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= flat_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
arch/x86/kernel/genx2apic_cluster.c +2 -2
index 7062e24..18b6f14 100644
@@ -157,7 +157,7 @@ static unsigned long set_apic_id(unsigned int id)
 	return x;
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int x2apic_cluster_phys_pkg_id(int initial_apicid, int index_msb)
 {
 	return current_cpu_data.initial_apicid >> index_msb;
 }
@@ -204,7 +204,7 @@ struct genapic apic_x2apic_cluster = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= x2apic_cluster_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
arch/x86/kernel/genx2apic_phys.c +2 -2
index 7177a11..2cb6f49 100644
@@ -156,7 +156,7 @@ static unsigned long set_apic_id(unsigned int id)
 	return x;
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int x2apic_phys_pkg_id(int initial_apicid, int index_msb)
 {
 	return current_cpu_data.initial_apicid >> index_msb;
 }
@@ -200,7 +200,7 @@ struct genapic apic_x2apic_phys = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= x2apic_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
arch/x86/kernel/genx2apic_uv_x.c +2 -2
index debd721..67e7658 100644
@@ -226,7 +226,7 @@ static unsigned int uv_read_apic_id(void)
 	return get_apic_id(apic_read(APIC_ID));
 }
 
-static unsigned int phys_pkg_id(int index_msb)
+static int uv_phys_pkg_id(int initial_apicid, int index_msb)
 {
 	return uv_read_apic_id() >> index_msb;
 }
@@ -265,7 +265,7 @@ struct genapic apic_x2apic_uv_x = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= uv_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
Signature · 1 line
1.6.0.2
#51 lore raw

PATCH 51/114 x86, apic: refactor ->phys_pkg_id()

In reply to Ingo Molnar

Refactor the ->phys_pkg_id() methods:

- namespace separation

- macro wrapper removal

- open-coded calls to the methods in the generic code

---
 arch/x86/include/asm/bigsmp/apic.h            |    2 +-
 arch/x86/include/asm/es7000/apic.h            |    2 +-
 arch/x86/include/asm/mach-default/mach_apic.h |    3 +--
 arch/x86/include/asm/mach-generic/mach_apic.h |    1 -
 arch/x86/include/asm/numaq/apic.h             |    2 +-
 arch/x86/include/asm/summit/apic.h            |    2 +-
 arch/x86/kernel/cpu/addon_cpuid_features.c    |    6 +++---
 arch/x86/kernel/cpu/common.c                  |    8 ++++----
 arch/x86/mach-generic/bigsmp.c                |    2 +-
 arch/x86/mach-generic/default.c               |    2 +-
 arch/x86/mach-generic/es7000.c                |    2 +-
 arch/x86/mach-generic/numaq.c                 |    2 +-
 arch/x86/mach-generic/summit.c                |    2 +-
 13 files changed, 17 insertions(+), 19 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +1 -1
index b7cba5b..1230f5d 100644
@@ -133,7 +133,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return BAD_APICID;
 }
 
-static inline int phys_pkg_id(int cpuid_apic, int index_msb)
+static inline int bigsmp_phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/es7000/apic.h +1 -1
index d2c6c20..f183dfb 100644
@@ -221,7 +221,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 	return apicid;
 }
 
-static inline int phys_pkg_id(int cpuid_apic, int index_msb)
+static inline int es7000_phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/mach-default/mach_apic.h +1 -2
index 55797a3..d060528 100644
@@ -21,7 +21,6 @@ static inline const struct cpumask *default_target_cpus(void)
 #include <asm/genapic.h>
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
-#define phys_pkg_id	(apic->phys_pkg_id)
 #define read_apic_id()  (GET_APIC_ID(apic_read(APIC_ID)))
 #define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
@@ -65,7 +64,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return (unsigned int)(mask1 & mask2 & mask3);
 }
 
-static inline int phys_pkg_id(int cpuid_apic, int index_msb)
+static inline int default_phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/mach-generic/mach_apic.h +0 -1
index 6fed521..1eeb5b6 100644
@@ -5,7 +5,6 @@
 
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
-#define phys_pkg_id (apic->phys_pkg_id)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 
 extern void generic_bigsmp_probe(void);
arch/x86/include/asm/numaq/apic.h +1 -1
index bc2c8a4..765c4d5 100644
@@ -113,7 +113,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 }
 
 /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
-static inline int phys_pkg_id(int cpuid_apic, int index_msb)
+static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return cpuid_apic >> index_msb;
 }
arch/x86/include/asm/summit/apic.h +1 -1
index 64cd441..fa6b3b4 100644
@@ -182,7 +182,7 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
  *
  * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
  */
-static inline int phys_pkg_id(int cpuid_apic, int index_msb)
+static inline int summit_phys_pkg_id(int cpuid_apic, int index_msb)
 {
 	return hard_smp_processor_id() >> index_msb;
 }
arch/x86/kernel/cpu/addon_cpuid_features.c +3 -3
index 84f8e4a..e8bb892 100644
@@ -116,13 +116,13 @@ void __cpuinit detect_extended_topology(struct cpuinfo_x86 *c)
 
 	core_select_mask = (~(-1 << core_plus_mask_width)) >> ht_mask_width;
 
-	c->cpu_core_id = phys_pkg_id(c->initial_apicid, ht_mask_width)
+	c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, ht_mask_width)
 						 & core_select_mask;
-	c->phys_proc_id = phys_pkg_id(c->initial_apicid, core_plus_mask_width);
+	c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, core_plus_mask_width);
 	/*
 	 * Reinit the apicid, now that we have extended initial_apicid.
 	 */
-	c->apicid = phys_pkg_id(c->initial_apicid, 0);
+	c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
 
 	c->x86_max_cores = (core_level_siblings / smp_num_siblings);
 
arch/x86/kernel/cpu/common.c +4 -4
index 93c491c..055b9c3 100644
@@ -442,7 +442,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 		}
 
 		index_msb = get_count_order(smp_num_siblings);
-		c->phys_proc_id = phys_pkg_id(c->initial_apicid, index_msb);
+		c->phys_proc_id = apic->phys_pkg_id(c->initial_apicid, index_msb);
 
 		smp_num_siblings = smp_num_siblings / c->x86_max_cores;
 
@@ -450,7 +450,7 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
 		core_bits = get_count_order(c->x86_max_cores);
 
-		c->cpu_core_id = phys_pkg_id(c->initial_apicid, index_msb) &
+		c->cpu_core_id = apic->phys_pkg_id(c->initial_apicid, index_msb) &
 					       ((1 << core_bits) - 1);
 	}
 
@@ -686,7 +686,7 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
 		c->initial_apicid = (cpuid_ebx(1) >> 24) & 0xFF;
 #ifdef CONFIG_X86_32
 # ifdef CONFIG_X86_HT
-		c->apicid = phys_pkg_id(c->initial_apicid, 0);
+		c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
 # else
 		c->apicid = c->initial_apicid;
 # endif
@@ -733,7 +733,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
 		this_cpu->c_identify(c);
 
 #ifdef CONFIG_X86_64
-	c->apicid = phys_pkg_id(c->initial_apicid, 0);
+	c->apicid = apic->phys_pkg_id(c->initial_apicid, 0);
 #endif
 
 	/*
arch/x86/mach-generic/bigsmp.c +1 -1
index e151b47..d04b389 100644
@@ -87,7 +87,7 @@ struct genapic apic_bigsmp = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= bigsmp_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= bigsmp_phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
arch/x86/mach-generic/default.c +1 -1
index ac6be19..5c9266f 100644
@@ -68,7 +68,7 @@ struct genapic apic_default = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= default_phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
arch/x86/mach-generic/es7000.c +1 -1
index 1185964..52787e3 100644
@@ -122,7 +122,7 @@ struct genapic apic_es7000 = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= es7000_check_phys_apicid_present,
 	.enable_apic_mode		= es7000_enable_apic_mode,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= es7000_phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
arch/x86/mach-generic/numaq.c +1 -1
index 8d3358d..6a1134e 100644
@@ -87,7 +87,7 @@ struct genapic apic_numaq = {
 	.setup_portio_remap		= numaq_setup_portio_remap,
 	.check_phys_apicid_present	= numaq_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= numaq_phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
arch/x86/mach-generic/summit.c +1 -1
index cb83bcb..2d6843a 100644
@@ -67,7 +67,7 @@ struct genapic apic_summit = {
 	.setup_portio_remap		= NULL,
 	.check_phys_apicid_present	= summit_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
-	.phys_pkg_id			= phys_pkg_id,
+	.phys_pkg_id			= summit_phys_pkg_id,
 	.mps_oem_check			= mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
Signature · 1 line
1.6.0.2
#52 lore raw

PATCH 52/114 x86, smp: clean up mps_oem_check()

In reply to Ingo Molnar

Impact: cleanup

- allow NULL ->mps_oem_check() entries

- clean up the code flow

---
 arch/x86/include/asm/genapic.h |    3 +--
 arch/x86/mach-generic/probe.c  |   22 +++++++++++++---------
 2 files changed, 14 insertions(+), 11 deletions(-)
arch/x86/include/asm/genapic.h +1 -2
index 14b19de..8bb1c73 100644
@@ -55,8 +55,7 @@ struct genapic {
 	 * is switched to this. Essentially they are additional
 	 * probe functions:
 	 */
-	int (*mps_oem_check)(struct mpc_table *mpc, char *oem,
-			     char *productid);
+	int (*mps_oem_check)(struct mpc_table *mpc, char *oem, char *productid);
 
 	unsigned int (*get_apic_id)(unsigned long x);
 	unsigned long (*set_apic_id)(unsigned int id);
arch/x86/mach-generic/probe.c +13 -9
index a21e2b1..799a70f 100644
@@ -113,17 +113,21 @@ void __init generic_apic_probe(void)
 int __init mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
 	int i;
+
 	for (i = 0; apic_probe[i]; ++i) {
-		if (apic_probe[i]->mps_oem_check(mpc, oem, productid)) {
-			if (!cmdline_apic) {
-				apic = apic_probe[i];
-				if (x86_quirks->update_genapic)
-					x86_quirks->update_genapic();
-				printk(KERN_INFO "Switched to APIC driver `%s'.\n",
-				       apic->name);
-			}
-			return 1;
+		if (!apic_probe[i]->mps_oem_check)
+			continue;
+		if (!apic_probe[i]->mps_oem_check(mpc, oem, productid))
+			continue;
+
+		if (!cmdline_apic) {
+			apic = apic_probe[i];
+			if (x86_quirks->update_genapic)
+				x86_quirks->update_genapic();
+			printk(KERN_INFO "Switched to APIC driver `%s'.\n",
+			       apic->name);
 		}
+		return 1;
 	}
 	return 0;
 }
Signature · 1 line
1.6.0.2
#53 lore raw

PATCH 53/114 x86, mpparse: call the generic quirk handlers early

In reply to Ingo Molnar

Call all the registered MPS quirk handlers early. These methods scan low RAM typically for specific signatures so are safe to be called early.

---
 arch/x86/kernel/mpparse.c |   11 +----------
 1 files changed, 1 insertions(+), 10 deletions(-)
arch/x86/kernel/mpparse.c +1 -10
index c8a534a..f6fb192 100644
@@ -292,16 +292,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 		return 0;
 
 #ifdef CONFIG_X86_32
-	/*
-	 * need to make sure summit and es7000's mps_oem_check is safe to be
-	 * called early via genericarch 's mps_oem_check
-	 */
-	if (early) {
-#ifdef CONFIG_X86_NUMAQ
-		numaq_mps_oem_check(mpc, oem, str);
-#endif
-	} else
-		mps_oem_check(mpc, oem, str);
+	mps_oem_check(mpc, oem, str);
 #endif
 	/* save the local APIC address, it might be non-default */
 	if (!acpi_lapic)
Signature · 1 line
1.6.0.2
#54 lore raw

PATCH 54/114 x86: consolidate the ->mps_oem_check() code

In reply to Ingo Molnar

- spread out the mps_oem_check() namespace on a per APIC driver basis

---
 arch/x86/include/asm/es7000/mpparse.h            |    6 ------
 arch/x86/include/asm/mach-default/mach_mpparse.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_mpparse.h |    3 +--
 arch/x86/include/asm/summit/mpparse.h            |    4 ++--
 arch/x86/kernel/mpparse.c                        |    2 +-
 arch/x86/mach-generic/bigsmp.c                   |    2 +-
 arch/x86/mach-generic/default.c                  |    2 +-
 arch/x86/mach-generic/es7000.c                   |    5 +++--
 arch/x86/mach-generic/numaq.c                    |    4 ++--
 arch/x86/mach-generic/probe.c                    |    3 ++-
 arch/x86/mach-generic/summit.c                   |    2 +-
 11 files changed, 15 insertions(+), 20 deletions(-)
arch/x86/include/asm/es7000/mpparse.h +0 -6
index 30692c4..662eb1e 100644
@@ -8,13 +8,7 @@ extern int find_unisys_acpi_oem_table(unsigned long *oem_addr);
 extern void unmap_unisys_acpi_oem_table(unsigned long oem_addr);
 extern void setup_unisys(void);
 
-#ifndef CONFIG_X86_GENERICARCH
-extern int default_acpi_madt_oem_check(char *oem_id, char *oem_table_id);
-extern int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid);
-#endif
-
 #ifdef CONFIG_ACPI
-
 static inline int es7000_check_dsdt(void)
 {
 	struct acpi_table_header header;
arch/x86/include/asm/mach-default/mach_mpparse.h +1 -1
index 8fa0177..af0da14 100644
@@ -2,7 +2,7 @@
 #define _ASM_X86_MACH_DEFAULT_MACH_MPPARSE_H
 
 static inline int
-mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
+generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
 	return 0;
 }
arch/x86/include/asm/mach-generic/mach_mpparse.h +1 -2
index f497d96..22bfb56 100644
@@ -1,8 +1,7 @@
 #ifndef _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H
 #define _ASM_X86_MACH_GENERIC_MACH_MPPARSE_H
 
-
-extern int mps_oem_check(struct mpc_table *, char *, char *);
+extern int generic_mps_oem_check(struct mpc_table *, char *, char *);
 
 extern int default_acpi_madt_oem_check(char *, char *);
 
arch/x86/include/asm/summit/mpparse.h +2 -2
index 555ed82..4bbcce3 100644
@@ -11,8 +11,8 @@ extern void setup_summit(void);
 #define setup_summit()	{}
 #endif
 
-static inline int mps_oem_check(struct mpc_table *mpc, char *oem,
-		char *productid)
+static inline int
+summit_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
 	if (!strncmp(oem, "IBM ENSW", 8) &&
 			(!strncmp(productid, "VIGIL SMP", 9)
arch/x86/kernel/mpparse.c +1 -1
index f6fb192..b12fa5c 100644
@@ -292,7 +292,7 @@ static int __init smp_read_mpc(struct mpc_table *mpc, unsigned early)
 		return 0;
 
 #ifdef CONFIG_X86_32
-	mps_oem_check(mpc, oem, str);
+	generic_mps_oem_check(mpc, oem, str);
 #endif
 	/* save the local APIC address, it might be non-default */
 	if (!acpi_lapic)
arch/x86/mach-generic/bigsmp.c +1 -1
index d04b389..6bf6aaf 100644
@@ -88,7 +88,7 @@ struct genapic apic_bigsmp = {
 	.check_phys_apicid_present	= bigsmp_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= bigsmp_phys_pkg_id,
-	.mps_oem_check			= mps_oem_check,
+	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
 	.set_apic_id			= NULL,
arch/x86/mach-generic/default.c +1 -1
index 5c9266f..e5f85cd 100644
@@ -69,7 +69,7 @@ struct genapic apic_default = {
 	.check_phys_apicid_present	= default_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= default_phys_pkg_id,
-	.mps_oem_check			= mps_oem_check,
+	.mps_oem_check			= NULL,
 
 	.get_apic_id			= get_apic_id,
 	.set_apic_id			= NULL,
arch/x86/mach-generic/es7000.c +3 -2
index 52787e3..f861163 100644
@@ -36,11 +36,12 @@ static int probe_es7000(void)
 }
 
 static __init int
-mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
+es7000_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
 	if (mpc->oemptr) {
 		struct mpc_oemtable *oem_table =
 			(struct mpc_oemtable *)mpc->oemptr;
+
 		if (!strncmp(oem, "UNISYS", 6))
 			return parse_unisys_oem((char *)oem_table);
 	}
@@ -123,7 +124,7 @@ struct genapic apic_es7000 = {
 	.check_phys_apicid_present	= es7000_check_phys_apicid_present,
 	.enable_apic_mode		= es7000_enable_apic_mode,
 	.phys_pkg_id			= es7000_phys_pkg_id,
-	.mps_oem_check			= mps_oem_check,
+	.mps_oem_check			= es7000_mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
 	.set_apic_id			= NULL,
arch/x86/mach-generic/numaq.c +2 -2
index 6a1134e..517882c 100644
@@ -19,7 +19,7 @@
 #include <asm/numaq/wakecpu.h>
 #include <asm/numaq.h>
 
-static int mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
+static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
 	numaq_mps_oem_check(mpc, oem, productid);
 	return found_numaq;
@@ -88,7 +88,7 @@ struct genapic apic_numaq = {
 	.check_phys_apicid_present	= numaq_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= numaq_phys_pkg_id,
-	.mps_oem_check			= mps_oem_check,
+	.mps_oem_check			= __numaq_mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
 	.set_apic_id			= NULL,
arch/x86/mach-generic/probe.c +2 -1
index 799a70f..ab68c6e 100644
@@ -110,7 +110,8 @@ void __init generic_apic_probe(void)
 
 /* These functions can switch the APIC even after the initial ->probe() */
 
-int __init mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
+int __init
+generic_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
 {
 	int i;
 
arch/x86/mach-generic/summit.c +1 -1
index 2d6843a..719e944 100644
@@ -68,7 +68,7 @@ struct genapic apic_summit = {
 	.check_phys_apicid_present	= summit_check_phys_apicid_present,
 	.enable_apic_mode		= NULL,
 	.phys_pkg_id			= summit_phys_pkg_id,
-	.mps_oem_check			= mps_oem_check,
+	.mps_oem_check			= summit_mps_oem_check,
 
 	.get_apic_id			= get_apic_id,
 	.set_apic_id			= NULL,
Signature · 1 line
1.6.0.2
#55 lore raw

PATCH 55/114 x86, apic: refactor ->get_apic_id() & GET_APIC_ID()

In reply to Ingo Molnar

- spread out the namespace on a per driver basis

- get rid of macro wrappers

- small cleanups

---
 arch/x86/include/asm/bigsmp/apicdef.h            |    6 ++----
 arch/x86/include/asm/es7000/apicdef.h            |    6 ++----
 arch/x86/include/asm/mach-default/mach_apic.h    |    2 +-
 arch/x86/include/asm/mach-default/mach_apicdef.h |   10 +++++-----
 arch/x86/include/asm/mach-generic/mach_apicdef.h |    1 -
 arch/x86/include/asm/numaq/apicdef.h             |    7 ++-----
 arch/x86/include/asm/smp.h                       |    2 +-
 arch/x86/include/asm/summit/apicdef.h            |    6 ++----
 arch/x86/kernel/genapic_flat_64.c                |    9 +++++----
 arch/x86/kernel/genx2apic_cluster.c              |    4 ++--
 arch/x86/kernel/genx2apic_phys.c                 |    4 ++--
 arch/x86/kernel/genx2apic_uv_x.c                 |    6 +++---
 arch/x86/mach-generic/bigsmp.c                   |    2 +-
 arch/x86/mach-generic/default.c                  |    2 +-
 arch/x86/mach-generic/es7000.c                   |    2 +-
 arch/x86/mach-generic/numaq.c                    |    2 +-
 arch/x86/mach-generic/summit.c                   |    2 +-
 17 files changed, 32 insertions(+), 41 deletions(-)
arch/x86/include/asm/bigsmp/apicdef.h +2 -4
index 392c3f5..ed25dd6 100644
@@ -3,11 +3,9 @@
 
 #define		APIC_ID_MASK		(0xFF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned bigsmp_get_apic_id(unsigned long x)
 {
-	return (((x)>>24)&0xFF);
+	return (x >> 24) & 0xFF;
 }
 
-#define		GET_APIC_ID(x)	get_apic_id(x)
-
 #endif
arch/x86/include/asm/es7000/apicdef.h +2 -4
index 8b234a3..e237917 100644
@@ -3,11 +3,9 @@
 
 #define		APIC_ID_MASK		(0xFF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned int es7000_get_apic_id(unsigned long x)
 {
-	return (((x)>>24)&0xFF);
+	return (x >> 24) & 0xFF;
 }
 
-#define		GET_APIC_ID(x)	get_apic_id(x)
-
 #endif
arch/x86/include/asm/mach-default/mach_apic.h +1 -1
index d060528..8719208 100644
@@ -21,7 +21,7 @@ static inline const struct cpumask *default_target_cpus(void)
 #include <asm/genapic.h>
 #define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
 #define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
-#define read_apic_id()  (GET_APIC_ID(apic_read(APIC_ID)))
+#define read_apic_id()  (apic->get_apic_id(apic_read(APIC_ID)))
 #define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void default_setup_apic_routing(void);
arch/x86/include/asm/mach-default/mach_apicdef.h +5 -5
index b4dcc09..e84d437 100644
@@ -5,20 +5,20 @@
 
 #ifdef CONFIG_X86_64
 #define	APIC_ID_MASK		(apic->apic_id_mask)
-#define GET_APIC_ID(x)		(apic->get_apic_id(x))
 #define	SET_APIC_ID(x)		(apic->set_apic_id(x))
 #else
 #define		APIC_ID_MASK		(0xF<<24)
-static inline unsigned get_apic_id(unsigned long x) 
+
+static inline unsigned default_get_apic_id(unsigned long x) 
 {
 	unsigned int ver = GET_APIC_VERSION(apic_read(APIC_LVR));
+
 	if (APIC_XAPIC(ver))
-		return (((x)>>24)&0xFF);
+		return (x >> 24) & 0xFF;
 	else
-		return (((x)>>24)&0xF);
+		return (x >> 24) & 0x0F;
 } 
 
-#define		GET_APIC_ID(x)	get_apic_id(x)
 #endif
 
 #endif /* _ASM_X86_MACH_DEFAULT_MACH_APICDEF_H */
arch/x86/include/asm/mach-generic/mach_apicdef.h +0 -1
index acc9add..645520b 100644
@@ -4,7 +4,6 @@
 #ifndef APIC_DEFINITION
 #include <asm/genapic.h>
 
-#define GET_APIC_ID (apic->get_apic_id)
 #define APIC_ID_MASK (apic->apic_id_mask)
 #endif
 
arch/x86/include/asm/numaq/apicdef.h +2 -5
index e012a46..29f5e3d 100644
@@ -1,14 +1,11 @@
 #ifndef __ASM_NUMAQ_APICDEF_H
 #define __ASM_NUMAQ_APICDEF_H
 
-
 #define APIC_ID_MASK (0xF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned int numaq_get_apic_id(unsigned long x)
 {
-	        return (((x)>>24)&0x0F);
+	return (x >> 24) & 0x0F;
 }
 
-#define         GET_APIC_ID(x)  get_apic_id(x)
-
 #endif
arch/x86/include/asm/smp.h +1 -1
index 45ef8a1..c63d480 100644
@@ -189,7 +189,7 @@ static inline unsigned int read_apic_id(void)
 
 	reg = *(u32 *)(APIC_BASE + APIC_ID);
 
-	return GET_APIC_ID(reg);
+	return apic->get_apic_id(reg);
 }
 #endif
 
arch/x86/include/asm/summit/apicdef.h +2 -4
index f3fbca1..4286528 100644
@@ -3,11 +3,9 @@
 
 #define		APIC_ID_MASK		(0xFF<<24)
 
-static inline unsigned get_apic_id(unsigned long x)
+static inline unsigned summit_get_apic_id(unsigned long x)
 {
-	return (x>>24)&0xFF;
+	return (x >> 24) & 0xFF;
 }
 
-#define		GET_APIC_ID(x)	get_apic_id(x)
-
 #endif
arch/x86/kernel/genapic_flat_64.c +5 -4
index cc9e07b..ab47091 100644
@@ -126,11 +126,12 @@ static void flat_send_IPI_all(int vector)
 		__send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical);
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int flat_get_apic_id(unsigned long x)
 {
 	unsigned int id;
 
 	id = (((x)>>24) & 0xFFu);
+
 	return id;
 }
 
@@ -146,7 +147,7 @@ static unsigned int read_xapic_id(void)
 {
 	unsigned int id;
 
-	id = get_apic_id(apic_read(APIC_ID));
+	id = flat_get_apic_id(apic_read(APIC_ID));
 	return id;
 }
 
@@ -205,7 +206,7 @@ struct genapic apic_flat =  {
 	.phys_pkg_id			= flat_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= flat_get_apic_id,
 	.set_apic_id			= set_apic_id,
 	.apic_id_mask			= 0xFFu << 24,
 
@@ -349,7 +350,7 @@ struct genapic apic_physflat =  {
 	.phys_pkg_id			= flat_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= flat_get_apic_id,
 	.set_apic_id			= set_apic_id,
 	.apic_id_mask			= 0xFFu<<24,
 
arch/x86/kernel/genx2apic_cluster.c +2 -2
index 18b6f14..c7557e0 100644
@@ -141,7 +141,7 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return BAD_APICID;
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int x2apic_cluster_phys_get_apic_id(unsigned long x)
 {
 	unsigned int id;
 
@@ -207,7 +207,7 @@ struct genapic apic_x2apic_cluster = {
 	.phys_pkg_id			= x2apic_cluster_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= x2apic_cluster_phys_get_apic_id,
 	.set_apic_id			= set_apic_id,
 	.apic_id_mask			= 0xFFFFFFFFu,
 
arch/x86/kernel/genx2apic_phys.c +2 -2
index 2cb6f49..80cba49 100644
@@ -140,7 +140,7 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return BAD_APICID;
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int x2apic_phys_get_apic_id(unsigned long x)
 {
 	unsigned int id;
 
@@ -203,7 +203,7 @@ struct genapic apic_x2apic_phys = {
 	.phys_pkg_id			= x2apic_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= x2apic_phys_get_apic_id,
 	.set_apic_id			= set_apic_id,
 	.apic_id_mask			= 0xFFFFFFFFu,
 
arch/x86/kernel/genx2apic_uv_x.c +3 -3
index 67e7658..50310b9 100644
@@ -201,7 +201,7 @@ static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	return BAD_APICID;
 }
 
-static unsigned int get_apic_id(unsigned long x)
+static unsigned int x2apic_get_apic_id(unsigned long x)
 {
 	unsigned int id;
 
@@ -223,7 +223,7 @@ static unsigned long set_apic_id(unsigned int id)
 static unsigned int uv_read_apic_id(void)
 {
 
-	return get_apic_id(apic_read(APIC_ID));
+	return x2apic_get_apic_id(apic_read(APIC_ID));
 }
 
 static int uv_phys_pkg_id(int initial_apicid, int index_msb)
@@ -268,7 +268,7 @@ struct genapic apic_x2apic_uv_x = {
 	.phys_pkg_id			= uv_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= x2apic_get_apic_id,
 	.set_apic_id			= set_apic_id,
 	.apic_id_mask			= 0xFFFFFFFFu,
 
arch/x86/mach-generic/bigsmp.c +1 -1
index 6bf6aaf..9eca977 100644
@@ -90,7 +90,7 @@ struct genapic apic_bigsmp = {
 	.phys_pkg_id			= bigsmp_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= bigsmp_get_apic_id,
 	.set_apic_id			= NULL,
 	.apic_id_mask			= APIC_ID_MASK,
 
arch/x86/mach-generic/default.c +1 -1
index e5f85cd..d51a3f0 100644
@@ -71,7 +71,7 @@ struct genapic apic_default = {
 	.phys_pkg_id			= default_phys_pkg_id,
 	.mps_oem_check			= NULL,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= default_get_apic_id,
 	.set_apic_id			= NULL,
 	.apic_id_mask			= APIC_ID_MASK,
 
arch/x86/mach-generic/es7000.c +1 -1
index f861163..1944675 100644
@@ -126,7 +126,7 @@ struct genapic apic_es7000 = {
 	.phys_pkg_id			= es7000_phys_pkg_id,
 	.mps_oem_check			= es7000_mps_oem_check,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= es7000_get_apic_id,
 	.set_apic_id			= NULL,
 	.apic_id_mask			= APIC_ID_MASK,
 
arch/x86/mach-generic/numaq.c +1 -1
index 517882c..fcbba84 100644
@@ -90,7 +90,7 @@ struct genapic apic_numaq = {
 	.phys_pkg_id			= numaq_phys_pkg_id,
 	.mps_oem_check			= __numaq_mps_oem_check,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= numaq_get_apic_id,
 	.set_apic_id			= NULL,
 	.apic_id_mask			= APIC_ID_MASK,
 
arch/x86/mach-generic/summit.c +1 -1
index 719e944..5650eaf 100644
@@ -70,7 +70,7 @@ struct genapic apic_summit = {
 	.phys_pkg_id			= summit_phys_pkg_id,
 	.mps_oem_check			= summit_mps_oem_check,
 
-	.get_apic_id			= get_apic_id,
+	.get_apic_id			= summit_get_apic_id,
 	.set_apic_id			= NULL,
 	.apic_id_mask			= APIC_ID_MASK,
 
Signature · 1 line
1.6.0.2
#56 lore raw

PATCH 56/114 x86, apic: refactor ->apic_id_mask & APIC_ID_MASK

In reply to Ingo Molnar

- spread out the namespace on a per driver basis

- get rid of wrapper macros

---
 arch/x86/include/asm/bigsmp/apicdef.h            |    2 +-
 arch/x86/include/asm/es7000/apicdef.h            |    2 +-
 arch/x86/include/asm/mach-default/mach_apicdef.h |    3 +--
 arch/x86/include/asm/mach-generic/mach_apicdef.h |    2 --
 arch/x86/include/asm/numaq/apicdef.h             |    2 +-
 arch/x86/include/asm/summit/apicdef.h            |    2 +-
 arch/x86/kernel/apic.c                           |    4 ++--
 arch/x86/kernel/genapic_flat_64.c                |    2 +-
 arch/x86/mach-generic/bigsmp.c                   |    2 +-
 arch/x86/mach-generic/default.c                  |    2 +-
 arch/x86/mach-generic/es7000.c                   |    2 +-
 arch/x86/mach-generic/numaq.c                    |    2 +-
 arch/x86/mach-generic/summit.c                   |    2 +-
 13 files changed, 13 insertions(+), 16 deletions(-)
arch/x86/include/asm/bigsmp/apicdef.h +1 -1
index ed25dd6..6e58781 100644
@@ -1,7 +1,7 @@
 #ifndef __ASM_MACH_APICDEF_H
 #define __ASM_MACH_APICDEF_H
 
-#define		APIC_ID_MASK		(0xFF<<24)
+#define		BIGSMP_APIC_ID_MASK		(0xFF<<24)
 
 static inline unsigned bigsmp_get_apic_id(unsigned long x)
 {
arch/x86/include/asm/es7000/apicdef.h +1 -1
index e237917..476da0c 100644
@@ -1,7 +1,7 @@
 #ifndef __ASM_ES7000_APICDEF_H
 #define __ASM_ES7000_APICDEF_H
 
-#define		APIC_ID_MASK		(0xFF<<24)
+#define		ES7000_APIC_ID_MASK		(0xFF<<24)
 
 static inline unsigned int es7000_get_apic_id(unsigned long x)
 {
arch/x86/include/asm/mach-default/mach_apicdef.h +1 -2
index e84d437..8318d12 100644
@@ -4,10 +4,9 @@
 #include <asm/apic.h>
 
 #ifdef CONFIG_X86_64
-#define	APIC_ID_MASK		(apic->apic_id_mask)
 #define	SET_APIC_ID(x)		(apic->set_apic_id(x))
 #else
-#define		APIC_ID_MASK		(0xF<<24)
+#define		DEFAULT_APIC_ID_MASK	(0x0F<<24)
 
 static inline unsigned default_get_apic_id(unsigned long x) 
 {
arch/x86/include/asm/mach-generic/mach_apicdef.h +0 -2
index 645520b..61caa65 100644
@@ -3,8 +3,6 @@
 
 #ifndef APIC_DEFINITION
 #include <asm/genapic.h>
-
-#define APIC_ID_MASK (apic->apic_id_mask)
 #endif
 
 #endif /* _ASM_X86_MACH_GENERIC_MACH_APICDEF_H */
arch/x86/include/asm/numaq/apicdef.h +1 -1
index 29f5e3d..6f2cc5d 100644
@@ -1,7 +1,7 @@
 #ifndef __ASM_NUMAQ_APICDEF_H
 #define __ASM_NUMAQ_APICDEF_H
 
-#define APIC_ID_MASK (0xF<<24)
+#define NUMAQ_APIC_ID_MASK (0xF<<24)
 
 static inline unsigned int numaq_get_apic_id(unsigned long x)
 {
arch/x86/include/asm/summit/apicdef.h +1 -1
index 4286528..0373f0c 100644
@@ -1,7 +1,7 @@
 #ifndef __ASM_SUMMIT_APICDEF_H
 #define __ASM_SUMMIT_APICDEF_H
 
-#define		APIC_ID_MASK		(0xFF<<24)
+#define		SUMMIT_APIC_ID_MASK		(0xFF<<24)
 
 static inline unsigned summit_get_apic_id(unsigned long x)
 {
arch/x86/kernel/apic.c +2 -2
index 9d6374d..5f7f3a9 100644
@@ -1009,11 +1009,11 @@ int __init verify_local_APIC(void)
 	 */
 	reg0 = apic_read(APIC_ID);
 	apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg0);
-	apic_write(APIC_ID, reg0 ^ APIC_ID_MASK);
+	apic_write(APIC_ID, reg0 ^ apic->apic_id_mask);
 	reg1 = apic_read(APIC_ID);
 	apic_printk(APIC_DEBUG, "Getting ID: %x\n", reg1);
 	apic_write(APIC_ID, reg0);
-	if (reg1 != (reg0 ^ APIC_ID_MASK))
+	if (reg1 != (reg0 ^ apic->apic_id_mask))
 		return 0;
 
 	/*
arch/x86/kernel/genapic_flat_64.c +1 -1
index ab47091..78baa55 100644
@@ -352,7 +352,7 @@ struct genapic apic_physflat =  {
 
 	.get_apic_id			= flat_get_apic_id,
 	.set_apic_id			= set_apic_id,
-	.apic_id_mask			= 0xFFu<<24,
+	.apic_id_mask			= 0xFFu << 24,
 
 	.cpu_mask_to_apicid		= physflat_cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= physflat_cpu_mask_to_apicid_and,
arch/x86/mach-generic/bigsmp.c +1 -1
index 9eca977..1f4ad4f 100644
@@ -92,7 +92,7 @@ struct genapic apic_bigsmp = {
 
 	.get_apic_id			= bigsmp_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= APIC_ID_MASK,
+	.apic_id_mask			= BIGSMP_APIC_ID_MASK,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/default.c +1 -1
index d51a3f0..239af25 100644
@@ -73,7 +73,7 @@ struct genapic apic_default = {
 
 	.get_apic_id			= default_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= APIC_ID_MASK,
+	.apic_id_mask			= DEFAULT_APIC_ID_MASK,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/es7000.c +1 -1
index 1944675..21fb33e 100644
@@ -128,7 +128,7 @@ struct genapic apic_es7000 = {
 
 	.get_apic_id			= es7000_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= APIC_ID_MASK,
+	.apic_id_mask			= ES7000_APIC_ID_MASK,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/numaq.c +1 -1
index fcbba84..27d2d1f 100644
@@ -92,7 +92,7 @@ struct genapic apic_numaq = {
 
 	.get_apic_id			= numaq_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= APIC_ID_MASK,
+	.apic_id_mask			= NUMAQ_APIC_ID_MASK,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/summit.c +1 -1
index 5650eaf..f24cba1 100644
@@ -72,7 +72,7 @@ struct genapic apic_summit = {
 
 	.get_apic_id			= summit_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= APIC_ID_MASK,
+	.apic_id_mask			= SUMMIT_APIC_ID_MASK,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
Signature · 1 line
1.6.0.2
#57 lore raw

PATCH 57/114 x86, apic: get rid of *_APIC_ID_MASK definitions

In reply to Ingo Molnar

Impact: cleanup

Remove the *_APIC_ID_MASK subarch definitions and move them straight to the genapic driver initialization code.

---
 arch/x86/include/asm/bigsmp/apicdef.h            |    2 --
 arch/x86/include/asm/es7000/apicdef.h            |    2 --
 arch/x86/include/asm/mach-default/mach_apicdef.h |    1 -
 arch/x86/include/asm/numaq/apicdef.h             |    2 --
 arch/x86/include/asm/summit/apicdef.h            |    2 --
 arch/x86/mach-generic/bigsmp.c                   |    2 +-
 arch/x86/mach-generic/default.c                  |    2 +-
 arch/x86/mach-generic/es7000.c                   |    2 +-
 arch/x86/mach-generic/numaq.c                    |    2 +-
 arch/x86/mach-generic/summit.c                   |    2 +-
 10 files changed, 5 insertions(+), 14 deletions(-)
arch/x86/include/asm/bigsmp/apicdef.h +0 -2
index 6e58781..e58dee8 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_MACH_APICDEF_H
 #define __ASM_MACH_APICDEF_H
 
-#define		BIGSMP_APIC_ID_MASK		(0xFF<<24)
-
 static inline unsigned bigsmp_get_apic_id(unsigned long x)
 {
 	return (x >> 24) & 0xFF;
arch/x86/include/asm/es7000/apicdef.h +0 -2
index 476da0c..c74881a 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_ES7000_APICDEF_H
 #define __ASM_ES7000_APICDEF_H
 
-#define		ES7000_APIC_ID_MASK		(0xFF<<24)
-
 static inline unsigned int es7000_get_apic_id(unsigned long x)
 {
 	return (x >> 24) & 0xFF;
arch/x86/include/asm/mach-default/mach_apicdef.h +0 -1
index 8318d12..5141085 100644
@@ -6,7 +6,6 @@
 #ifdef CONFIG_X86_64
 #define	SET_APIC_ID(x)		(apic->set_apic_id(x))
 #else
-#define		DEFAULT_APIC_ID_MASK	(0x0F<<24)
 
 static inline unsigned default_get_apic_id(unsigned long x) 
 {
arch/x86/include/asm/numaq/apicdef.h +0 -2
index 6f2cc5d..cd927d5 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_NUMAQ_APICDEF_H
 #define __ASM_NUMAQ_APICDEF_H
 
-#define NUMAQ_APIC_ID_MASK (0xF<<24)
-
 static inline unsigned int numaq_get_apic_id(unsigned long x)
 {
 	return (x >> 24) & 0x0F;
arch/x86/include/asm/summit/apicdef.h +0 -2
index 0373f0c..c24b0df 100644
@@ -1,8 +1,6 @@
 #ifndef __ASM_SUMMIT_APICDEF_H
 #define __ASM_SUMMIT_APICDEF_H
 
-#define		SUMMIT_APIC_ID_MASK		(0xFF<<24)
-
 static inline unsigned summit_get_apic_id(unsigned long x)
 {
 	return (x >> 24) & 0xFF;
arch/x86/mach-generic/bigsmp.c +1 -1
index 1f4ad4f..ee52c59 100644
@@ -92,7 +92,7 @@ struct genapic apic_bigsmp = {
 
 	.get_apic_id			= bigsmp_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= BIGSMP_APIC_ID_MASK,
+	.apic_id_mask			= 0xFF << 24,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/default.c +1 -1
index 239af25..e4ed7e6 100644
@@ -73,7 +73,7 @@ struct genapic apic_default = {
 
 	.get_apic_id			= default_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= DEFAULT_APIC_ID_MASK,
+	.apic_id_mask			= 0x0F << 24,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/es7000.c +1 -1
index 21fb33e..3d046de 100644
@@ -128,7 +128,7 @@ struct genapic apic_es7000 = {
 
 	.get_apic_id			= es7000_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= ES7000_APIC_ID_MASK,
+	.apic_id_mask			= 0xFF << 24,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/numaq.c +1 -1
index 27d2d1f..a7bf1aa 100644
@@ -92,7 +92,7 @@ struct genapic apic_numaq = {
 
 	.get_apic_id			= numaq_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= NUMAQ_APIC_ID_MASK,
+	.apic_id_mask			= 0x0F << 24,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
arch/x86/mach-generic/summit.c +1 -1
index f24cba1..a0ae6b9 100644
@@ -72,7 +72,7 @@ struct genapic apic_summit = {
 
 	.get_apic_id			= summit_get_apic_id,
 	.set_apic_id			= NULL,
-	.apic_id_mask			= SUMMIT_APIC_ID_MASK,
+	.apic_id_mask			= 0xFF << 24,
 
 	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
Signature · 1 line
1.6.0.2
#58 lore raw

PATCH 58/114 x86, apic: refactor ->cpu_mask_to_apicid*()

In reply to Ingo Molnar

- spread out the namespace on a per driver basis

- clean up the functions

- get rid of macros

---
 arch/x86/include/asm/bigsmp/apic.h            |   17 ++++++--------
 arch/x86/include/asm/es7000/apic.h            |   29 +++++++++++++++---------
 arch/x86/include/asm/mach-default/mach_apic.h |   10 ++++----
 arch/x86/include/asm/mach-generic/mach_apic.h |    2 -
 arch/x86/include/asm/numaq/apic.h             |   11 +++++----
 arch/x86/include/asm/summit/apic.h            |   21 +++++++++++-------
 arch/x86/kernel/genapic_flat_64.c             |    4 ++-
 arch/x86/kernel/genx2apic_cluster.c           |   15 +++++++-----
 arch/x86/kernel/genx2apic_phys.c              |   15 +++++++-----
 arch/x86/kernel/genx2apic_uv_x.c              |   14 +++++++-----
 arch/x86/kernel/io_apic.c                     |   21 ++++++++++-------
 arch/x86/mach-generic/bigsmp.c                |    4 +-
 arch/x86/mach-generic/default.c               |    4 +-
 arch/x86/mach-generic/es7000.c                |    6 ++--
 arch/x86/mach-generic/numaq.c                 |    4 +-
 arch/x86/mach-generic/summit.c                |    4 +-
 16 files changed, 101 insertions(+), 80 deletions(-)
arch/x86/include/asm/bigsmp/apic.h +7 -10
index 1230f5d..ee29d66 100644
@@ -105,18 +105,14 @@ static inline int bigsmp_check_phys_apicid_present(int boot_cpu_physical_apicid)
 }
 
 /* As we are using single CPU as destination, pick only one CPU here */
-static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
+static inline unsigned int bigsmp_cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
-	int cpu;
-	int apicid;	
-
-	cpu = first_cpu(*cpumask);
-	apicid = bigsmp_cpu_to_logical_apicid(cpu);
-	return apicid;
+	return bigsmp_cpu_to_logical_apicid(first_cpu(*cpumask));
 }
 
-static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-						  const struct cpumask *andmask)
+static inline unsigned int
+bigsmp_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+			      const struct cpumask *andmask)
 {
 	int cpu;
 
@@ -124,9 +120,10 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
 	 * May as well be the first.
 	 */
-	for_each_cpu_and(cpu, cpumask, andmask)
+	for_each_cpu_and(cpu, cpumask, andmask) {
 		if (cpumask_test_cpu(cpu, cpu_online_mask))
 			break;
+	}
 	if (cpu < nr_cpu_ids)
 		return bigsmp_cpu_to_logical_apicid(cpu);
 
arch/x86/include/asm/es7000/apic.h +18 -11
index f183dfb..b89b45d 100644
@@ -137,12 +137,12 @@ static inline int es7000_check_phys_apicid_present(int cpu_physical_apicid)
 }
 
 static inline unsigned int
-cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
+es7000_cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 {
-	int num_bits_set;
 	int cpus_found = 0;
-	int cpu;
+	int num_bits_set;
 	int apicid;
+	int cpu;
 
 	num_bits_set = cpumask_weight(cpumask);
 	/* Return id to all */
@@ -154,12 +154,15 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 	 */
 	cpu = cpumask_first(cpumask);
 	apicid = es7000_cpu_to_logical_apicid(cpu);
+
 	while (cpus_found < num_bits_set) {
 		if (cpumask_test_cpu(cpu, cpumask)) {
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
+
 			if (apicid_cluster(apicid) !=
-					apicid_cluster(new_apicid)){
+					apicid_cluster(new_apicid)) {
 				printk ("%s: Not a valid mask!\n", __func__);
+
 				return 0xFF;
 			}
 			apicid = new_apicid;
@@ -170,12 +173,12 @@ cpu_mask_to_apicid_cluster(const struct cpumask *cpumask)
 	return apicid;
 }
 
-static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
+static inline unsigned int es7000_cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
-	int num_bits_set;
 	int cpus_found = 0;
-	int cpu;
+	int num_bits_set;
 	int apicid;
+	int cpu;
 
 	num_bits_set = cpus_weight(*cpumask);
 	/* Return id to all */
@@ -190,9 +193,11 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 	while (cpus_found < num_bits_set) {
 		if (cpu_isset(cpu, *cpumask)) {
 			int new_apicid = es7000_cpu_to_logical_apicid(cpu);
+
 			if (apicid_cluster(apicid) !=
-					apicid_cluster(new_apicid)){
+					apicid_cluster(new_apicid)) {
 				printk ("%s: Not a valid mask!\n", __func__);
+
 				return es7000_cpu_to_logical_apicid(0);
 			}
 			apicid = new_apicid;
@@ -204,8 +209,9 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 }
 
 
-static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
-						  const struct cpumask *andmask)
+static inline unsigned int
+es7000_cpu_mask_to_apicid_and(const struct cpumask *inmask,
+			      const struct cpumask *andmask)
 {
 	int apicid = es7000_cpu_to_logical_apicid(0);
 	cpumask_var_t cpumask;
@@ -215,9 +221,10 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 
 	cpumask_and(cpumask, inmask, andmask);
 	cpumask_and(cpumask, cpumask, cpu_online_mask);
-	apicid = cpu_mask_to_apicid(cpumask);
+	apicid = es7000_cpu_mask_to_apicid(cpumask);
 
 	free_cpumask_var(cpumask);
+
 	return apicid;
 }
 
arch/x86/include/asm/mach-default/mach_apic.h +5 -5
index 8719208..8972f84 100644
@@ -19,8 +19,6 @@ static inline const struct cpumask *default_target_cpus(void)
 
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
-#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
-#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
 #define read_apic_id()  (apic->get_apic_id(apic_read(APIC_ID)))
 #define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
@@ -49,13 +47,15 @@ static inline int default_apic_id_registered(void)
 	return physid_isset(read_apic_id(), phys_cpu_present_map);
 }
 
-static inline unsigned int cpu_mask_to_apicid(const struct cpumask *cpumask)
+static inline unsigned int
+default_cpu_mask_to_apicid(const struct cpumask *cpumask)
 {
 	return cpumask_bits(cpumask)[0];
 }
 
-static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-						  const struct cpumask *andmask)
+static inline unsigned int
+default_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+			       const struct cpumask *andmask)
 {
 	unsigned long mask1 = cpumask_bits(cpumask)[0];
 	unsigned long mask2 = cpumask_bits(andmask)[0];
arch/x86/include/asm/mach-generic/mach_apic.h +0 -2
index 1eeb5b6..ca460e4 100644
@@ -3,8 +3,6 @@
 
 #include <asm/genapic.h>
 
-#define cpu_mask_to_apicid (apic->cpu_mask_to_apicid)
-#define cpu_mask_to_apicid_and (apic->cpu_mask_to_apicid_and)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 
 extern void generic_bigsmp_probe(void);
arch/x86/include/asm/numaq/apic.h +6 -5
index 765c4d5..ce95e79 100644
@@ -101,15 +101,16 @@ static inline int numaq_check_phys_apicid_present(int boot_cpu_physical_apicid)
  * We use physical apicids here, not logical, so just return the default
  * physical broadcast to stop people from breaking us
  */
-static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
+static inline unsigned int numaq_cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
-	return (int) 0xF;
+	return 0x0F;
 }
 
-static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-						  const struct cpumask *andmask)
+static inline unsigned int
+numaq_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+			     const struct cpumask *andmask)
 {
-	return (int) 0xF;
+	return 0x0F;
 }
 
 /* No NUMA-Q box has a HT CPU, but it can't hurt to use the default code. */
arch/x86/include/asm/summit/apic.h +13 -8
index fa6b3b4..15b8dbd 100644
@@ -125,29 +125,32 @@ static inline int summit_check_phys_apicid_present(int boot_cpu_physical_apicid)
 	return 1;
 }
 
-static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
+static inline unsigned int summit_cpu_mask_to_apicid(const cpumask_t *cpumask)
 {
-	int num_bits_set;
 	int cpus_found = 0;
-	int cpu;
+	int num_bits_set;
 	int apicid;
+	int cpu;
 
 	num_bits_set = cpus_weight(*cpumask);
 	/* Return id to all */
 	if (num_bits_set >= nr_cpu_ids)
-		return (int) 0xFF;
+		return 0xFF;
 	/*
 	 * The cpus in the mask must all be on the apic cluster.  If are not
 	 * on the same apicid cluster return default value of target_cpus():
 	 */
 	cpu = first_cpu(*cpumask);
 	apicid = summit_cpu_to_logical_apicid(cpu);
+
 	while (cpus_found < num_bits_set) {
 		if (cpu_isset(cpu, *cpumask)) {
 			int new_apicid = summit_cpu_to_logical_apicid(cpu);
+
 			if (apicid_cluster(apicid) !=
-					apicid_cluster(new_apicid)){
+					apicid_cluster(new_apicid)) {
 				printk ("%s: Not a valid mask!\n", __func__);
+
 				return 0xFF;
 			}
 			apicid = apicid | new_apicid;
@@ -158,8 +161,9 @@ static inline unsigned int cpu_mask_to_apicid(const cpumask_t *cpumask)
 	return apicid;
 }
 
-static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
-						  const struct cpumask *andmask)
+static inline unsigned int
+summit_cpu_mask_to_apicid_and(const struct cpumask *inmask,
+			      const struct cpumask *andmask)
 {
 	int apicid = summit_cpu_to_logical_apicid(0);
 	cpumask_var_t cpumask;
@@ -169,9 +173,10 @@ static inline unsigned int cpu_mask_to_apicid_and(const struct cpumask *inmask,
 
 	cpumask_and(cpumask, inmask, andmask);
 	cpumask_and(cpumask, cpumask, cpu_online_mask);
-	apicid = cpu_mask_to_apicid(cpumask);
+	apicid = summit_cpu_mask_to_apicid(cpumask);
 
 	free_cpumask_var(cpumask);
+
 	return apicid;
 }
 
arch/x86/kernel/genapic_flat_64.c +3 -1
index 78baa55..b941b11 100644
@@ -309,11 +309,13 @@ physflat_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
 	 * May as well be the first.
 	 */
-	for_each_cpu_and(cpu, cpumask, andmask)
+	for_each_cpu_and(cpu, cpumask, andmask) {
 		if (cpumask_test_cpu(cpu, cpu_online_mask))
 			break;
+	}
 	if (cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_apicid, cpu);
+
 	return BAD_APICID;
 }
 
arch/x86/kernel/genx2apic_cluster.c +9 -6
index c7557e0..62f9fcc 100644
@@ -111,21 +111,21 @@ static int x2apic_apic_id_registered(void)
 
 static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
 {
-	int cpu;
-
 	/*
 	 * We're using fixed IRQ delivery, can only return one logical APIC ID.
 	 * May as well be the first.
 	 */
-	cpu = cpumask_first(cpumask);
+	int cpu = cpumask_first(cpumask);
+
 	if ((unsigned)cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_logical_apicid, cpu);
 	else
 		return BAD_APICID;
 }
 
-static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-						  const struct cpumask *andmask)
+static unsigned int
+x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+			      const struct cpumask *andmask)
 {
 	int cpu;
 
@@ -133,11 +133,14 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	 * We're using fixed IRQ delivery, can only return one logical APIC ID.
 	 * May as well be the first.
 	 */
-	for_each_cpu_and(cpu, cpumask, andmask)
+	for_each_cpu_and(cpu, cpumask, andmask) {
 		if (cpumask_test_cpu(cpu, cpu_online_mask))
 			break;
+	}
+
 	if (cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_logical_apicid, cpu);
+
 	return BAD_APICID;
 }
 
arch/x86/kernel/genx2apic_phys.c +9 -6
index 80cba49..3da1675 100644
@@ -110,21 +110,21 @@ static int x2apic_apic_id_registered(void)
 
 static unsigned int x2apic_cpu_mask_to_apicid(const struct cpumask *cpumask)
 {
-	int cpu;
-
 	/*
 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
 	 * May as well be the first.
 	 */
-	cpu = cpumask_first(cpumask);
+	int cpu = cpumask_first(cpumask);
+
 	if ((unsigned)cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_apicid, cpu);
 	else
 		return BAD_APICID;
 }
 
-static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-						  const struct cpumask *andmask)
+static unsigned int
+x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+			      const struct cpumask *andmask)
 {
 	int cpu;
 
@@ -132,11 +132,14 @@ static unsigned int x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
 	 * May as well be the first.
 	 */
-	for_each_cpu_and(cpu, cpumask, andmask)
+	for_each_cpu_and(cpu, cpumask, andmask) {
 		if (cpumask_test_cpu(cpu, cpu_online_mask))
 			break;
+	}
+
 	if (cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_apicid, cpu);
+
 	return BAD_APICID;
 }
 
arch/x86/kernel/genx2apic_uv_x.c +8 -6
index 50310b9..f957878 100644
@@ -171,21 +171,21 @@ static void uv_init_apic_ldr(void)
 
 static unsigned int uv_cpu_mask_to_apicid(const struct cpumask *cpumask)
 {
-	int cpu;
-
 	/*
 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
 	 * May as well be the first.
 	 */
-	cpu = cpumask_first(cpumask);
+	int cpu = cpumask_first(cpumask);
+
 	if ((unsigned)cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_apicid, cpu);
 	else
 		return BAD_APICID;
 }
 
-static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
-					      const struct cpumask *andmask)
+static unsigned int
+uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
+			  const struct cpumask *andmask)
 {
 	int cpu;
 
@@ -193,11 +193,13 @@ static unsigned int uv_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 	 * We're using fixed IRQ delivery, can only return one phys APIC ID.
 	 * May as well be the first.
 	 */
-	for_each_cpu_and(cpu, cpumask, andmask)
+	for_each_cpu_and(cpu, cpumask, andmask) {
 		if (cpumask_test_cpu(cpu, cpu_online_mask))
 			break;
+	}
 	if (cpu < nr_cpu_ids)
 		return per_cpu(x86_cpu_to_apicid, cpu);
+
 	return BAD_APICID;
 }
 
arch/x86/kernel/io_apic.c +12 -9
index 3d85d3d..01a2505 100644
@@ -563,8 +563,9 @@ static int
 assign_irq_vector(int irq, struct irq_cfg *cfg, const struct cpumask *mask);
 
 /*
- * Either sets desc->affinity to a valid value, and returns cpu_mask_to_apicid
- * of that, or returns BAD_APICID and leaves desc->affinity untouched.
+ * Either sets desc->affinity to a valid value, and returns
+ * ->cpu_mask_to_apicid of that, or returns BAD_APICID and
+ * leaves desc->affinity untouched.
  */
 static unsigned int
 set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask)
@@ -582,7 +583,8 @@ set_desc_affinity(struct irq_desc *desc, const struct cpumask *mask)
 
 	cpumask_and(desc->affinity, cfg->domain, mask);
 	set_extra_move_desc(desc, mask);
-	return cpu_mask_to_apicid_and(desc->affinity, cpu_online_mask);
+
+	return apic->cpu_mask_to_apicid_and(desc->affinity, cpu_online_mask);
 }
 
 static void
@@ -1562,7 +1564,7 @@ static void setup_IO_APIC_irq(int apic_id, int pin, unsigned int irq, struct irq
 	if (assign_irq_vector(irq, cfg, apic->target_cpus()))
 		return;
 
-	dest = cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
+	dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
 
 	apic_printk(APIC_VERBOSE,KERN_DEBUG
 		    "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
@@ -1666,7 +1668,7 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin,
 	 */
 	entry.dest_mode = apic->irq_dest_mode;
 	entry.mask = 1;					/* mask IRQ now */
-	entry.dest = cpu_mask_to_apicid(apic->target_cpus());
+	entry.dest = apic->cpu_mask_to_apicid(apic->target_cpus());
 	entry.delivery_mode = apic->irq_delivery_mode;
 	entry.polarity = 0;
 	entry.trigger = 0;
@@ -2367,7 +2369,7 @@ migrate_ioapic_irq_desc(struct irq_desc *desc, const struct cpumask *mask)
 
 	set_extra_move_desc(desc, mask);
 
-	dest = cpu_mask_to_apicid_and(cfg->domain, mask);
+	dest = apic->cpu_mask_to_apicid_and(cfg->domain, mask);
 
 	modify_ioapic_rte = desc->status & IRQ_LEVEL;
 	if (modify_ioapic_rte) {
@@ -3270,7 +3272,7 @@ static int msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_ms
 	if (err)
 		return err;
 
-	dest = cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
+	dest = apic->cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
 
 #ifdef CONFIG_INTR_REMAP
 	if (irq_remapped(irq)) {
@@ -3708,7 +3710,8 @@ int arch_setup_ht_irq(unsigned int irq, struct pci_dev *dev)
 		struct ht_irq_msg msg;
 		unsigned dest;
 
-		dest = cpu_mask_to_apicid_and(cfg->domain, apic->target_cpus());
+		dest = apic->cpu_mask_to_apicid_and(cfg->domain,
+						    apic->target_cpus());
 
 		msg.address_hi = HT_IRQ_HIGH_DEST_ID(dest);
 
@@ -3773,7 +3776,7 @@ int arch_enable_uv_irq(char *irq_name, unsigned int irq, int cpu, int mmr_blade,
 	entry->polarity = 0;
 	entry->trigger = 0;
 	entry->mask = 0;
-	entry->dest = cpu_mask_to_apicid(eligible_cpu);
+	entry->dest = apic->cpu_mask_to_apicid(eligible_cpu);
 
 	mmr_pnode = uv_blade_to_pnode(mmr_blade);
 	uv_write_global_mmr64(mmr_pnode, mmr_offset, mmr_value);
arch/x86/mach-generic/bigsmp.c +2 -2
index ee52c59..22c2c7b 100644
@@ -94,8 +94,8 @@ struct genapic apic_bigsmp = {
 	.set_apic_id			= NULL,
 	.apic_id_mask			= 0xFF << 24,
 
-	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+	.cpu_mask_to_apicid		= bigsmp_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= bigsmp_cpu_mask_to_apicid_and,
 
 	.send_IPI_mask			= send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
arch/x86/mach-generic/default.c +2 -2
index e4ed7e6..477ebec 100644
@@ -75,8 +75,8 @@ struct genapic apic_default = {
 	.set_apic_id			= NULL,
 	.apic_id_mask			= 0x0F << 24,
 
-	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+	.cpu_mask_to_apicid		= default_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= default_cpu_mask_to_apicid_and,
 
 	.send_IPI_mask			= send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
arch/x86/mach-generic/es7000.c +3 -3
index 3d046de..d758cf6 100644
@@ -26,7 +26,7 @@ void __init es7000_update_genapic_to_cluster(void)
 
 	apic->init_apic_ldr = es7000_init_apic_ldr_cluster;
 
-	apic->cpu_mask_to_apicid = cpu_mask_to_apicid_cluster;
+	apic->cpu_mask_to_apicid = es7000_cpu_mask_to_apicid_cluster;
 }
 
 static int probe_es7000(void)
@@ -130,8 +130,8 @@ struct genapic apic_es7000 = {
 	.set_apic_id			= NULL,
 	.apic_id_mask			= 0xFF << 24,
 
-	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+	.cpu_mask_to_apicid		= es7000_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= es7000_cpu_mask_to_apicid_and,
 
 	.send_IPI_mask			= send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
arch/x86/mach-generic/numaq.c +2 -2
index a7bf1aa..eb7d56a 100644
@@ -94,8 +94,8 @@ struct genapic apic_numaq = {
 	.set_apic_id			= NULL,
 	.apic_id_mask			= 0x0F << 24,
 
-	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+	.cpu_mask_to_apicid		= numaq_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= numaq_cpu_mask_to_apicid_and,
 
 	.send_IPI_mask			= send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
arch/x86/mach-generic/summit.c +2 -2
index a0ae6b9..8c29305 100644
@@ -74,8 +74,8 @@ struct genapic apic_summit = {
 	.set_apic_id			= NULL,
 	.apic_id_mask			= 0xFF << 24,
 
-	.cpu_mask_to_apicid		= cpu_mask_to_apicid,
-	.cpu_mask_to_apicid_and		= cpu_mask_to_apicid_and,
+	.cpu_mask_to_apicid		= summit_cpu_mask_to_apicid,
+	.cpu_mask_to_apicid_and		= summit_cpu_mask_to_apicid_and,
 
 	.send_IPI_mask			= send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
Signature · 1 line
1.6.0.2
#59 lore raw

PATCH 59/114 x86, apic: untangle the send_IPI_*() jungle

In reply to Ingo Molnar

Our send_IPI_*() methods and definitions are a twisted mess: the same symbol is defined to different things depending on .config details, in a non-transparent way.

- spread out the quirks into separately named per apic driver methods

- prefix the standard PC methods with default_

- get rid of wrapper macro obfuscation

- clean up various details

---
 arch/x86/include/asm/bigsmp/ipi.h             |   44 +++++-----
 arch/x86/include/asm/es7000/ipi.h             |   44 +++++-----
 arch/x86/include/asm/hw_irq.h                 |    4 +-
 arch/x86/include/asm/ipi.h                    |   38 ++++----
 arch/x86/include/asm/mach-default/mach_apic.h |    1 -
 arch/x86/include/asm/mach-default/mach_ipi.h  |  122 ++++++++++++-------------
 arch/x86/include/asm/mach-generic/mach_ipi.h  |    4 -
 arch/x86/include/asm/numaq/ipi.h              |   44 +++++-----
 arch/x86/include/asm/summit/ipi.h             |   52 +++++-----
 arch/x86/kernel/apic.c                        |    2 +-
 arch/x86/kernel/genapic_64.c                  |    2 +-
 arch/x86/kernel/genapic_flat_64.c             |   24 +++--
 arch/x86/kernel/genx2apic_cluster.c           |   38 ++++----
 arch/x86/kernel/genx2apic_phys.c              |   36 +++----
 arch/x86/kernel/genx2apic_uv_x.c              |   21 +++--
 arch/x86/kernel/io_apic.c                     |   10 +-
 arch/x86/kernel/ipi.c                         |   28 +++---
 arch/x86/kernel/kgdb.c                        |    2 +-
 arch/x86/kernel/reboot.c                      |    2 +-
 arch/x86/kernel/smp.c                         |   10 +-
 arch/x86/mach-generic/bigsmp.c                |    6 +-
 arch/x86/mach-generic/default.c               |    6 +-
 arch/x86/mach-generic/es7000.c                |    6 +-
 arch/x86/mach-generic/numaq.c                 |    6 +-
 arch/x86/mach-generic/summit.c                |    6 +-
 arch/x86/mm/tlb.c                             |    2 +-
 26 files changed, 279 insertions(+), 281 deletions(-)

rewrite arch/x86/include/asm/bigsmp/ipi.h (81%) rewrite arch/x86/include/asm/es7000/ipi.h (81%) rewrite arch/x86/include/asm/mach-default/mach_ipi.h (65%) rewrite arch/x86/include/asm/numaq/ipi.h (81%) rewrite arch/x86/include/asm/summit/ipi.h (66%)

arch/x86/include/asm/bigsmp/ipi.h +22 -22
dissimilarity index 81%
index 27fcd01..a91db69 100644
@@ -1,22 +1,22 @@
-#ifndef __ASM_MACH_IPI_H
-#define __ASM_MACH_IPI_H
-
-void send_IPI_mask_sequence(const struct cpumask *mask, int vector);
-void send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
-
-static inline void send_IPI_mask(const struct cpumask *mask, int vector)
-{
-	send_IPI_mask_sequence(mask, vector);
-}
-
-static inline void send_IPI_allbutself(int vector)
-{
-	send_IPI_mask_allbutself(cpu_online_mask, vector);
-}
-
-static inline void send_IPI_all(int vector)
-{
-	send_IPI_mask(cpu_online_mask, vector);
-}
-
-#endif /* __ASM_MACH_IPI_H */
+#ifndef __ASM_MACH_IPI_H
+#define __ASM_MACH_IPI_H
+
+void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector);
+void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector);
+
+static inline void default_send_IPI_mask(const struct cpumask *mask, int vector)
+{
+	default_send_IPI_mask_sequence(mask, vector);
+}
+
+static inline void bigsmp_send_IPI_allbutself(int vector)
+{
+	default_send_IPI_mask_allbutself(cpu_online_mask, vector);
+}
+
+static inline void bigsmp_send_IPI_all(int vector)
+{
+	default_send_IPI_mask(cpu_online_mask, vector);
+}
+
+#endif /* __ASM_MACH_IPI_H */
arch/x86/include/asm/es7000/ipi.h +22 -22

44 lines not on this page · raw message

arch/x86/include/asm/hw_irq.h +2 -2
index 8de644b..bfa921f 100644
@@ -73,9 +73,9 @@ extern void enable_IO_APIC(void);
 
 /* IPI functions */
 #ifdef CONFIG_X86_32
-extern void send_IPI_self(int vector);
+extern void default_send_IPI_self(int vector);
 #endif
-extern void send_IPI(int dest, int vector);
+extern void default_send_IPI(int dest, int vector);
 
 /* Statistics */
 extern atomic_t irq_err_count;
arch/x86/include/asm/ipi.h +20 -18
index c745a30..a8d717f 100644
@@ -55,8 +55,9 @@ static inline void __xapic_wait_icr_idle(void)
 		cpu_relax();
 }
 
-static inline void __send_IPI_shortcut(unsigned int shortcut, int vector,
-				       unsigned int dest)
+static inline void
+__default_send_IPI_shortcut(unsigned int shortcut,
+			    int vector, unsigned int dest)
 {
 	/*
 	 * Subtle. In the case of the 'never do double writes' workaround
@@ -87,8 +88,8 @@ static inline void __send_IPI_shortcut(unsigned int shortcut, int vector,
  * This is used to send an IPI with no shorthand notation (the destination is
  * specified in bits 56 to 63 of the ICR).
  */
-static inline void __send_IPI_dest_field(unsigned int mask, int vector,
-					 unsigned int dest)
+static inline void
+ __default_send_IPI_dest_field(unsigned int mask, int vector, unsigned int dest)
 {
 	unsigned long cfg;
 
@@ -117,11 +118,11 @@ static inline void __send_IPI_dest_field(unsigned int mask, int vector,
 	native_apic_mem_write(APIC_ICR, cfg);
 }
 
-static inline void send_IPI_mask_sequence(const struct cpumask *mask,
-					  int vector)
+static inline void
+default_send_IPI_mask_sequence(const struct cpumask *mask, int vector)
 {
-	unsigned long flags;
 	unsigned long query_cpu;
+	unsigned long flags;
 
 	/*
 	 * Hack. The clustered APIC addressing mode doesn't allow us to send
@@ -130,27 +131,28 @@ static inline void send_IPI_mask_sequence(const struct cpumask *mask,
 	 */
 	local_irq_save(flags);
 	for_each_cpu(query_cpu, mask) {
-		__send_IPI_dest_field(per_cpu(x86_cpu_to_apicid, query_cpu),
-				      vector, APIC_DEST_PHYSICAL);
+		__default_send_IPI_dest_field(per_cpu(x86_cpu_to_apicid,
+				query_cpu), vector, APIC_DEST_PHYSICAL);
 	}
 	local_irq_restore(flags);
 }
 
-static inline void send_IPI_mask_allbutself(const struct cpumask *mask,
-					    int vector)
+static inline void
+default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
-	unsigned long flags;
-	unsigned int query_cpu;
 	unsigned int this_cpu = smp_processor_id();
+	unsigned int query_cpu;
+	unsigned long flags;
 
 	/* See Hack comment above */
 
 	local_irq_save(flags);
-	for_each_cpu(query_cpu, mask)
-		if (query_cpu != this_cpu)
-			__send_IPI_dest_field(
-				per_cpu(x86_cpu_to_apicid, query_cpu),
-				vector, APIC_DEST_PHYSICAL);
+	for_each_cpu(query_cpu, mask) {
+		if (query_cpu == this_cpu)
+			continue;
+		__default_send_IPI_dest_field(per_cpu(x86_cpu_to_apicid,
+				 query_cpu), vector, APIC_DEST_PHYSICAL);
+	}
 	local_irq_restore(flags);
 }
 
arch/x86/include/asm/mach-default/mach_apic.h +0 -1
index 8972f84..2e4104c 100644
@@ -20,7 +20,6 @@ static inline const struct cpumask *default_target_cpus(void)
 #ifdef CONFIG_X86_64
 #include <asm/genapic.h>
 #define read_apic_id()  (apic->get_apic_id(apic_read(APIC_ID)))
-#define send_IPI_self (apic->send_IPI_self)
 #define wakeup_secondary_cpu (apic->wakeup_cpu)
 extern void default_setup_apic_routing(void);
 #else
arch/x86/include/asm/mach-default/mach_ipi.h +58 -64

122 lines not on this page · raw message

arch/x86/include/asm/mach-generic/mach_ipi.h +0 -4
index 75e54bd..5691c09 100644
@@ -3,8 +3,4 @@
 
 #include <asm/genapic.h>
 
-#define send_IPI_mask (apic->send_IPI_mask)
-#define send_IPI_allbutself (apic->send_IPI_allbutself)
-#define send_IPI_all (apic->send_IPI_all)
-
 #endif /* _ASM_X86_MACH_GENERIC_MACH_IPI_H */
arch/x86/include/asm/numaq/ipi.h +22 -22

44 lines not on this page · raw message

arch/x86/include/asm/summit/ipi.h +26 -26

52 lines not on this page · raw message

arch/x86/kernel/apic.c +1 -1
index 5f7f3a9..84b8e7c 100644
@@ -475,7 +475,7 @@ static void lapic_timer_setup(enum clock_event_mode mode,
 static void lapic_timer_broadcast(const struct cpumask *mask)
 {
 #ifdef CONFIG_SMP
-	send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
+	apic->send_IPI_mask(mask, LOCAL_TIMER_VECTOR);
 #endif
 }
 
arch/x86/kernel/genapic_64.c +1 -1
index d57d213..820dea5 100644
@@ -65,7 +65,7 @@ void __init default_setup_apic_routing(void)
 
 void apic_send_IPI_self(int vector)
 {
-	__send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
+	__default_send_IPI_shortcut(APIC_DEST_SELF, vector, APIC_DEST_PHYSICAL);
 }
 
 int __init default_acpi_madt_oem_check(char *oem_id, char *oem_table_id)
arch/x86/kernel/genapic_flat_64.c +14 -10
index b941b11..7c648cc 100644
@@ -74,7 +74,7 @@ static inline void _flat_send_IPI_mask(unsigned long mask, int vector)
 	unsigned long flags;
 
 	local_irq_save(flags);
-	__send_IPI_dest_field(mask, vector, apic->dest_logical);
+	__default_send_IPI_dest_field(mask, vector, apic->dest_logical);
 	local_irq_restore(flags);
 }
 
@@ -85,14 +85,15 @@ static void flat_send_IPI_mask(const struct cpumask *cpumask, int vector)
 	_flat_send_IPI_mask(mask, vector);
 }
 
-static void flat_send_IPI_mask_allbutself(const struct cpumask *cpumask,
-					  int vector)
+static void
+ flat_send_IPI_mask_allbutself(const struct cpumask *cpumask, int vector)
 {
 	unsigned long mask = cpumask_bits(cpumask)[0];
 	int cpu = smp_processor_id();
 
 	if (cpu < BITS_PER_LONG)
 		clear_bit(cpu, &mask);
+
 	_flat_send_IPI_mask(mask, vector);
 }
 
@@ -114,16 +115,19 @@ static void flat_send_IPI_allbutself(int vector)
 			_flat_send_IPI_mask(mask, vector);
 		}
 	} else if (num_online_cpus() > 1) {
-		__send_IPI_shortcut(APIC_DEST_ALLBUT, vector, apic->dest_logical);
+		__default_send_IPI_shortcut(APIC_DEST_ALLBUT,
+					    vector, apic->dest_logical);
 	}
 }
 
 static void flat_send_IPI_all(int vector)
 {
-	if (vector == NMI_VECTOR)
+	if (vector == NMI_VECTOR) {
 		flat_send_IPI_mask(cpu_online_mask, vector);
-	else
-		__send_IPI_shortcut(APIC_DEST_ALLINC, vector, apic->dest_logical);
+	} else {
+		__default_send_IPI_shortcut(APIC_DEST_ALLINC,
+					    vector, apic->dest_logical);
+	}
 }
 
 static unsigned int flat_get_apic_id(unsigned long x)
@@ -265,18 +269,18 @@ static void physflat_vector_allocation_domain(int cpu, struct cpumask *retmask)
 
 static void physflat_send_IPI_mask(const struct cpumask *cpumask, int vector)
 {
-	send_IPI_mask_sequence(cpumask, vector);
+	default_send_IPI_mask_sequence(cpumask, vector);
 }
 
 static void physflat_send_IPI_mask_allbutself(const struct cpumask *cpumask,
 					      int vector)
 {
-	send_IPI_mask_allbutself(cpumask, vector);
+	default_send_IPI_mask_allbutself(cpumask, vector);
 }
 
 static void physflat_send_IPI_allbutself(int vector)
 {
-	send_IPI_mask_allbutself(cpu_online_mask, vector);
+	default_send_IPI_mask_allbutself(cpu_online_mask, vector);
 }
 
 static void physflat_send_IPI_all(int vector)
arch/x86/kernel/genx2apic_cluster.c +21 -17
index 62f9fcc..2d97726 100644
@@ -36,8 +36,8 @@ static void x2apic_vector_allocation_domain(int cpu, struct cpumask *retmask)
 	cpumask_set_cpu(cpu, retmask);
 }
 
-static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
-				   unsigned int dest)
+static void
+ __x2apic_send_IPI_dest(unsigned int apicid, int vector, unsigned int dest)
 {
 	unsigned long cfg;
 
@@ -57,45 +57,50 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
  */
 static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
 {
-	unsigned long flags;
 	unsigned long query_cpu;
+	unsigned long flags;
 
 	local_irq_save(flags);
-	for_each_cpu(query_cpu, mask)
+	for_each_cpu(query_cpu, mask) {
 		__x2apic_send_IPI_dest(
 			per_cpu(x86_cpu_to_logical_apicid, query_cpu),
 			vector, apic->dest_logical);
+	}
 	local_irq_restore(flags);
 }
 
-static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
-					    int vector)
+static void
+ x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
-	unsigned long flags;
-	unsigned long query_cpu;
 	unsigned long this_cpu = smp_processor_id();
+	unsigned long query_cpu;
+	unsigned long flags;
 
 	local_irq_save(flags);
-	for_each_cpu(query_cpu, mask)
-		if (query_cpu != this_cpu)
-			__x2apic_send_IPI_dest(
+	for_each_cpu(query_cpu, mask) {
+		if (query_cpu == this_cpu)
+			continue;
+		__x2apic_send_IPI_dest(
 				per_cpu(x86_cpu_to_logical_apicid, query_cpu),
 				vector, apic->dest_logical);
+	}
 	local_irq_restore(flags);
 }
 
 static void x2apic_send_IPI_allbutself(int vector)
 {
-	unsigned long flags;
-	unsigned long query_cpu;
 	unsigned long this_cpu = smp_processor_id();
+	unsigned long query_cpu;
+	unsigned long flags;
 
 	local_irq_save(flags);
-	for_each_online_cpu(query_cpu)
-		if (query_cpu != this_cpu)
-			__x2apic_send_IPI_dest(
+	for_each_online_cpu(query_cpu) {
+		if (query_cpu == this_cpu)
+			continue;
+		__x2apic_send_IPI_dest(
 				per_cpu(x86_cpu_to_logical_apicid, query_cpu),
 				vector, apic->dest_logical);
+	}
 	local_irq_restore(flags);
 }
 
@@ -175,7 +180,6 @@ static void init_x2apic_ldr(void)
 	int cpu = smp_processor_id();
 
 	per_cpu(x86_cpu_to_logical_apicid, cpu) = apic_read(APIC_LDR);
-	return;
 }
 
 struct genapic apic_x2apic_cluster = {
arch/x86/kernel/genx2apic_phys.c +15 -21
index 3da1675..74777c2 100644
@@ -55,8 +55,8 @@ static void __x2apic_send_IPI_dest(unsigned int apicid, int vector,
 
 static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
 {
-	unsigned long flags;
 	unsigned long query_cpu;
+	unsigned long flags;
 
 	local_irq_save(flags);
 	for_each_cpu(query_cpu, mask) {
@@ -66,12 +66,12 @@ static void x2apic_send_IPI_mask(const struct cpumask *mask, int vector)
 	local_irq_restore(flags);
 }
 
-static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
-					    int vector)
+static void
+ x2apic_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
-	unsigned long flags;
-	unsigned long query_cpu;
 	unsigned long this_cpu = smp_processor_id();
+	unsigned long query_cpu;
+	unsigned long flags;
 
 	local_irq_save(flags);
 	for_each_cpu(query_cpu, mask) {
@@ -85,16 +85,17 @@ static void x2apic_send_IPI_mask_allbutself(const struct cpumask *mask,
 
 static void x2apic_send_IPI_allbutself(int vector)
 {
-	unsigned long flags;
-	unsigned long query_cpu;
 	unsigned long this_cpu = smp_processor_id();
+	unsigned long query_cpu;
+	unsigned long flags;
 
 	local_irq_save(flags);
-	for_each_online_cpu(query_cpu)
-		if (query_cpu != this_cpu)
-			__x2apic_send_IPI_dest(
-				per_cpu(x86_cpu_to_apicid, query_cpu),
-				vector, APIC_DEST_PHYSICAL);
+	for_each_online_cpu(query_cpu) {
+		if (query_cpu == this_cpu)
+			continue;
+		__x2apic_send_IPI_dest(per_cpu(x86_cpu_to_apicid, query_cpu),
+				       vector, APIC_DEST_PHYSICAL);
+	}
 	local_irq_restore(flags);
 }
 
@@ -145,18 +146,12 @@ x2apic_cpu_mask_to_apicid_and(const struct cpumask *cpumask,
 
 static unsigned int x2apic_phys_get_apic_id(unsigned long x)
 {
-	unsigned int id;
-
-	id = x;
-	return id;
+	return x;
 }
 
 static unsigned long set_apic_id(unsigned int id)
 {
-	unsigned long x;
-
-	x = id;
-	return x;
+	return id;
 }
 
 static int x2apic_phys_pkg_id(int initial_apicid, int index_msb)
@@ -171,7 +166,6 @@ static void x2apic_send_IPI_self(int vector)
 
 static void init_x2apic_ldr(void)
 {
-	return;
 }
 
 struct genapic apic_x2apic_phys = {
arch/x86/kernel/genx2apic_uv_x.c +12 -9
index f957878..24b9f42 100644
@@ -118,12 +118,13 @@ static void uv_send_IPI_one(int cpu, int vector)
 	int pnode;
 
 	apicid = per_cpu(x86_cpu_to_apicid, cpu);
-	lapicid = apicid & 0x3f;		/* ZZZ macro needed */
+	lapicid = apicid & 0x3f; /* ZZZ macro needed */
 	pnode = uv_apicid_to_pnode(apicid);
-	val =
-	    (1UL << UVH_IPI_INT_SEND_SHFT) | (lapicid <<
-					      UVH_IPI_INT_APIC_ID_SHFT) |
-	    (vector << UVH_IPI_INT_VECTOR_SHFT);
+
+	val = (     1UL << UVH_IPI_INT_SEND_SHFT    ) |
+	      ( lapicid << UVH_IPI_INT_APIC_ID_SHFT ) |
+	      (  vector << UVH_IPI_INT_VECTOR_SHFT  );
+
 	uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
 }
 
@@ -137,22 +138,24 @@ static void uv_send_IPI_mask(const struct cpumask *mask, int vector)
 
 static void uv_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
-	unsigned int cpu;
 	unsigned int this_cpu = smp_processor_id();
+	unsigned int cpu;
 
-	for_each_cpu(cpu, mask)
+	for_each_cpu(cpu, mask) {
 		if (cpu != this_cpu)
 			uv_send_IPI_one(cpu, vector);
+	}
 }
 
 static void uv_send_IPI_allbutself(int vector)
 {
-	unsigned int cpu;
 	unsigned int this_cpu = smp_processor_id();
+	unsigned int cpu;
 
-	for_each_online_cpu(cpu)
+	for_each_online_cpu(cpu) {
 		if (cpu != this_cpu)
 			uv_send_IPI_one(cpu, vector);
+	}
 }
 
 static void uv_send_IPI_all(int vector)
arch/x86/kernel/io_apic.c +5 -5
index 01a2505..e90970c 100644
@@ -514,11 +514,11 @@ static void send_cleanup_vector(struct irq_cfg *cfg)
 		for_each_cpu_and(i, cfg->old_domain, cpu_online_mask)
 			cfg->move_cleanup_count++;
 		for_each_cpu_and(i, cfg->old_domain, cpu_online_mask)
-			send_IPI_mask(cpumask_of(i), IRQ_MOVE_CLEANUP_VECTOR);
+			apic->send_IPI_mask(cpumask_of(i), IRQ_MOVE_CLEANUP_VECTOR);
 	} else {
 		cpumask_and(cleanup_mask, cfg->old_domain, cpu_online_mask);
 		cfg->move_cleanup_count = cpumask_weight(cleanup_mask);
-		send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
+		apic->send_IPI_mask(cleanup_mask, IRQ_MOVE_CLEANUP_VECTOR);
 		free_cpumask_var(cleanup_mask);
 	}
 	cfg->move_in_progress = 0;
@@ -800,7 +800,7 @@ static void clear_IO_APIC (void)
 }
 
 #if !defined(CONFIG_SMP) && defined(CONFIG_X86_32)
-void send_IPI_self(int vector)
+void default_send_IPI_self(int vector)
 {
 	unsigned int cfg;
 
@@ -2297,7 +2297,7 @@ static int ioapic_retrigger_irq(unsigned int irq)
 	unsigned long flags;
 
 	spin_lock_irqsave(&vector_lock, flags);
-	send_IPI_mask(cpumask_of(cpumask_first(cfg->domain)), cfg->vector);
+	apic->send_IPI_mask(cpumask_of(cpumask_first(cfg->domain)), cfg->vector);
 	spin_unlock_irqrestore(&vector_lock, flags);
 
 	return 1;
@@ -2305,7 +2305,7 @@ static int ioapic_retrigger_irq(unsigned int irq)
 #else
 static int ioapic_retrigger_irq(unsigned int irq)
 {
-	send_IPI_self(irq_cfg(irq)->vector);
+	apic->send_IPI_self(irq_cfg(irq)->vector);
 
 	return 1;
 }
arch/x86/kernel/ipi.c +15 -13
index 367c5e6..e16c41b 100644
@@ -48,7 +48,7 @@ static inline int __prepare_ICR2(unsigned int mask)
 	return SET_APIC_DEST_FIELD(mask);
 }
 
-void __send_IPI_shortcut(unsigned int shortcut, int vector)
+void __default_send_IPI_shortcut(unsigned int shortcut, int vector)
 {
 	/*
 	 * Subtle. In the case of the 'never do double writes' workaround
@@ -75,16 +75,16 @@ void __send_IPI_shortcut(unsigned int shortcut, int vector)
 	apic_write(APIC_ICR, cfg);
 }
 
-void send_IPI_self(int vector)
+void default_send_IPI_self(int vector)
 {
-	__send_IPI_shortcut(APIC_DEST_SELF, vector);
+	__default_send_IPI_shortcut(APIC_DEST_SELF, vector);
 }
 
 /*
  * This is used to send an IPI with no shorthand notation (the destination is
  * specified in bits 56 to 63 of the ICR).
  */
-static inline void __send_IPI_dest_field(unsigned long mask, int vector)
+static inline void __default_send_IPI_dest_field(unsigned long mask, int vector)
 {
 	unsigned long cfg;
 
@@ -116,18 +116,18 @@ static inline void __send_IPI_dest_field(unsigned long mask, int vector)
 /*
  * This is only used on smaller machines.
  */
-void send_IPI_mask_bitmask(const struct cpumask *cpumask, int vector)
+void default_send_IPI_mask_bitmask(const struct cpumask *cpumask, int vector)
 {
 	unsigned long mask = cpumask_bits(cpumask)[0];
 	unsigned long flags;
 
 	local_irq_save(flags);
 	WARN_ON(mask & ~cpumask_bits(cpu_online_mask)[0]);
-	__send_IPI_dest_field(mask, vector);
+	__default_send_IPI_dest_field(mask, vector);
 	local_irq_restore(flags);
 }
 
-void send_IPI_mask_sequence(const struct cpumask *mask, int vector)
+void default_send_IPI_mask_sequence(const struct cpumask *mask, int vector)
 {
 	unsigned long flags;
 	unsigned int query_cpu;
@@ -140,11 +140,11 @@ void send_IPI_mask_sequence(const struct cpumask *mask, int vector)
 
 	local_irq_save(flags);
 	for_each_cpu(query_cpu, mask)
-		__send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu), vector);
+		__default_send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu), vector);
 	local_irq_restore(flags);
 }
 
-void send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
+void default_send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 {
 	unsigned long flags;
 	unsigned int query_cpu;
@@ -153,10 +153,12 @@ void send_IPI_mask_allbutself(const struct cpumask *mask, int vector)
 	/* See Hack comment above */
 
 	local_irq_save(flags);
-	for_each_cpu(query_cpu, mask)
-		if (query_cpu != this_cpu)
-			__send_IPI_dest_field(apic->cpu_to_logical_apicid(query_cpu),
-					      vector);
+	for_each_cpu(query_cpu, mask) {
+		if (query_cpu == this_cpu)
+			continue;
+		__default_send_IPI_dest_field(
+			apic->cpu_to_logical_apicid(query_cpu), vector);
+	}
 	local_irq_restore(flags);
 }
 
arch/x86/kernel/kgdb.c +1 -1
index 10435a1..b62a381 100644
@@ -347,7 +347,7 @@ void kgdb_post_primary_code(struct pt_regs *regs, int e_vector, int err_code)
  */
 void kgdb_roundup_cpus(unsigned long flags)
 {
-	send_IPI_allbutself(APIC_DM_NMI);
+	apic->send_IPI_allbutself(APIC_DM_NMI);
 }
 #endif
 
arch/x86/kernel/reboot.c +1 -1
index f8536fe..38dace2 100644
@@ -651,7 +651,7 @@ static int crash_nmi_callback(struct notifier_block *self,
 
 static void smp_send_nmi_allbutself(void)
 {
-	send_IPI_allbutself(NMI_VECTOR);
+	apic->send_IPI_allbutself(NMI_VECTOR);
 }
 
 static struct notifier_block crash_nmi_nb = {
arch/x86/kernel/smp.c +5 -5
index e6faa33..c48ba6c 100644
@@ -118,12 +118,12 @@ static void native_smp_send_reschedule(int cpu)
 		WARN_ON(1);
 		return;
 	}
-	send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR);
+	apic->send_IPI_mask(cpumask_of(cpu), RESCHEDULE_VECTOR);
 }
 
 void native_send_call_func_single_ipi(int cpu)
 {
-	send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_SINGLE_VECTOR);
+	apic->send_IPI_mask(cpumask_of(cpu), CALL_FUNCTION_SINGLE_VECTOR);
 }
 
 void native_send_call_func_ipi(const struct cpumask *mask)
@@ -131,7 +131,7 @@ void native_send_call_func_ipi(const struct cpumask *mask)
 	cpumask_var_t allbutself;
 
 	if (!alloc_cpumask_var(&allbutself, GFP_ATOMIC)) {
-		send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
+		apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
 		return;
 	}
 
@@ -140,9 +140,9 @@ void native_send_call_func_ipi(const struct cpumask *mask)
 
 	if (cpumask_equal(mask, allbutself) &&
 	    cpumask_equal(cpu_online_mask, cpu_callout_mask))
-		send_IPI_allbutself(CALL_FUNCTION_VECTOR);
+		apic->send_IPI_allbutself(CALL_FUNCTION_VECTOR);
 	else
-		send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
+		apic->send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
 
 	free_cpumask_var(allbutself);
 }
arch/x86/mach-generic/bigsmp.c +3 -3
index 22c2c7b..4782b55 100644
@@ -97,10 +97,10 @@ struct genapic apic_bigsmp = {
 	.cpu_mask_to_apicid		= bigsmp_cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= bigsmp_cpu_mask_to_apicid_and,
 
-	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask			= default_send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
-	.send_IPI_allbutself		= send_IPI_allbutself,
-	.send_IPI_all			= send_IPI_all,
+	.send_IPI_allbutself		= bigsmp_send_IPI_allbutself,
+	.send_IPI_all			= bigsmp_send_IPI_all,
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
arch/x86/mach-generic/default.c +3 -3
index 477ebec..bf4670d 100644
@@ -78,10 +78,10 @@ struct genapic apic_default = {
 	.cpu_mask_to_apicid		= default_cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= default_cpu_mask_to_apicid_and,
 
-	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask			= default_send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
-	.send_IPI_allbutself		= send_IPI_allbutself,
-	.send_IPI_all			= send_IPI_all,
+	.send_IPI_allbutself		= default_send_IPI_allbutself,
+	.send_IPI_all			= default_send_IPI_all,
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
arch/x86/mach-generic/es7000.c +3 -3
index d758cf6..d36642e 100644
@@ -133,10 +133,10 @@ struct genapic apic_es7000 = {
 	.cpu_mask_to_apicid		= es7000_cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= es7000_cpu_mask_to_apicid_and,
 
-	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask			= es7000_send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
-	.send_IPI_allbutself		= send_IPI_allbutself,
-	.send_IPI_all			= send_IPI_all,
+	.send_IPI_allbutself		= es7000_send_IPI_allbutself,
+	.send_IPI_all			= es7000_send_IPI_all,
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
arch/x86/mach-generic/numaq.c +3 -3
index eb7d56a..135b183 100644
@@ -97,10 +97,10 @@ struct genapic apic_numaq = {
 	.cpu_mask_to_apicid		= numaq_cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= numaq_cpu_mask_to_apicid_and,
 
-	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask			= numaq_send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
-	.send_IPI_allbutself		= send_IPI_allbutself,
-	.send_IPI_all			= send_IPI_all,
+	.send_IPI_allbutself		= numaq_send_IPI_allbutself,
+	.send_IPI_all			= numaq_send_IPI_all,
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
arch/x86/mach-generic/summit.c +3 -3
index 8c29305..77196a4 100644
@@ -77,10 +77,10 @@ struct genapic apic_summit = {
 	.cpu_mask_to_apicid		= summit_cpu_mask_to_apicid,
 	.cpu_mask_to_apicid_and		= summit_cpu_mask_to_apicid_and,
 
-	.send_IPI_mask			= send_IPI_mask,
+	.send_IPI_mask			= summit_send_IPI_mask,
 	.send_IPI_mask_allbutself	= NULL,
-	.send_IPI_allbutself		= send_IPI_allbutself,
-	.send_IPI_all			= send_IPI_all,
+	.send_IPI_allbutself		= summit_send_IPI_allbutself,
+	.send_IPI_all			= summit_send_IPI_all,
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
arch/x86/mm/tlb.c +1 -1
index 72a6d4e..6348e11 100644
@@ -196,7 +196,7 @@ static void flush_tlb_others_ipi(const struct cpumask *cpumask,
 	 * We have to send the IPI only to
 	 * CPUs affected.
 	 */
-	send_IPI_mask(to_cpumask(f->flush_cpumask),
+	apic->send_IPI_mask(to_cpumask(f->flush_cpumask),
 		      INVALIDATE_TLB_VECTOR_START + sender);
 
 	while (!cpumask_empty(to_cpumask(f->flush_cpumask)))
Signature · 1 line
1.6.0.2
#60 lore raw

PATCH 60/114 x86, smp: clean up ->trampoline_phys_low/high handling

In reply to Ingo Molnar

- spread out the namespace on a per apic driver basis

- remove wrapper macros

---
 arch/x86/include/asm/es7000/wakecpu.h             |    4 ++--
 arch/x86/include/asm/mach-default/mach_wakecpu.h  |    4 ++--
 arch/x86/include/asm/mach-default/smpboot_hooks.h |    6 +++---
 arch/x86/include/asm/mach-generic/mach_wakecpu.h  |    2 --
 arch/x86/include/asm/numaq/wakecpu.h              |   12 ++++++------
 arch/x86/mach-generic/bigsmp.c                    |    4 ++--
 arch/x86/mach-generic/default.c                   |    4 ++--
 arch/x86/mach-generic/es7000.c                    |    4 ++--
 arch/x86/mach-generic/numaq.c                     |    4 ++--
 arch/x86/mach-generic/summit.c                    |    4 ++--
 10 files changed, 23 insertions(+), 25 deletions(-)
arch/x86/include/asm/es7000/wakecpu.h +2 -2
index 78f0daa..4c01be6 100644
@@ -1,8 +1,8 @@
 #ifndef __ASM_ES7000_WAKECPU_H
 #define __ASM_ES7000_WAKECPU_H
 
-#define TRAMPOLINE_PHYS_LOW	0x467
-#define TRAMPOLINE_PHYS_HIGH	0x469
+#define ES7000_TRAMPOLINE_PHYS_LOW	0x467
+#define ES7000_TRAMPOLINE_PHYS_HIGH	0x469
 
 static inline void wait_for_init_deassert(atomic_t *deassert)
 {
arch/x86/include/asm/mach-default/mach_wakecpu.h +2 -2
index 89897a6..0a8d786 100644
@@ -1,8 +1,8 @@
 #ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
 #define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
 
-#define TRAMPOLINE_PHYS_LOW (0x467)
-#define TRAMPOLINE_PHYS_HIGH (0x469)
+#define DEFAULT_TRAMPOLINE_PHYS_LOW (0x467)
+#define DEFAULT_TRAMPOLINE_PHYS_HIGH (0x469)
 
 static inline void wait_for_init_deassert(atomic_t *deassert)
 {
arch/x86/include/asm/mach-default/smpboot_hooks.h +3 -3
index 23bf521..1def601 100644
@@ -13,10 +13,10 @@ static inline void smpboot_setup_warm_reset_vector(unsigned long start_eip)
 	CMOS_WRITE(0xa, 0xf);
 	local_flush_tlb();
 	pr_debug("1.\n");
-	*((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) =
+	*((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_high)) =
 								 start_eip >> 4;
 	pr_debug("2.\n");
-	*((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) =
+	*((volatile unsigned short *)phys_to_virt(apic->trampoline_phys_low)) =
 							 start_eip & 0xf;
 	pr_debug("3.\n");
 }
@@ -34,7 +34,7 @@ static inline void smpboot_restore_warm_reset_vector(void)
 	 */
 	CMOS_WRITE(0, 0xf);
 
-	*((volatile long *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0;
+	*((volatile long *)phys_to_virt(apic->trampoline_phys_low)) = 0;
 }
 
 static inline void __init smpboot_setup_io_apic(void)
arch/x86/include/asm/mach-generic/mach_wakecpu.h +0 -2
index 22006bb..2031377 100644
@@ -1,8 +1,6 @@
 #ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 #define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 
-#define TRAMPOLINE_PHYS_LOW (apic->trampoline_phys_low)
-#define TRAMPOLINE_PHYS_HIGH (apic->trampoline_phys_high)
 #define wait_for_init_deassert (apic->wait_for_init_deassert)
 #define smp_callin_clear_local_apic (apic->smp_callin_clear_local_apic)
 #define store_NMI_vector (apic->store_NMI_vector)
arch/x86/include/asm/numaq/wakecpu.h +6 -6
index 6f499df..8b6c16d 100644
@@ -3,8 +3,8 @@
 
 /* This file copes with machines that wakeup secondary CPUs by NMIs */
 
-#define TRAMPOLINE_PHYS_LOW (0x8)
-#define TRAMPOLINE_PHYS_HIGH (0xa)
+#define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8)
+#define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa)
 
 /* We don't do anything here because we use NMI's to boot instead */
 static inline void wait_for_init_deassert(atomic_t *deassert)
@@ -24,17 +24,17 @@ static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
 {
 	printk("Storing NMI vector\n");
 	*high =
-	  *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH));
+	  *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH));
 	*low =
-	  *((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW));
+	  *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW));
 }
 
 static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
 {
 	printk("Restoring NMI vector\n");
-	*((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_HIGH)) =
+	*((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH)) =
 								 *high;
-	*((volatile unsigned short *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) =
+	*((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW)) =
 								 *low;
 }
 
arch/x86/mach-generic/bigsmp.c +2 -2
index 4782b55..a317fbe 100644
@@ -104,8 +104,8 @@ struct genapic apic_bigsmp = {
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
-	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= wait_for_init_deassert,
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
arch/x86/mach-generic/default.c +2 -2
index bf4670d..17d8f9c 100644
@@ -85,8 +85,8 @@ struct genapic apic_default = {
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
-	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= wait_for_init_deassert,
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
arch/x86/mach-generic/es7000.c +2 -2
index d36642e..871e854 100644
@@ -140,8 +140,8 @@ struct genapic apic_es7000 = {
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
-	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= wait_for_init_deassert,
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
arch/x86/mach-generic/numaq.c +2 -2
index 135b183..0b496ab 100644
@@ -104,8 +104,8 @@ struct genapic apic_numaq = {
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
-	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.trampoline_phys_low		= NUMAQ_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= NUMAQ_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= wait_for_init_deassert,
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
arch/x86/mach-generic/summit.c +2 -2
index 77196a4..c4799cd 100644
@@ -84,8 +84,8 @@ struct genapic apic_summit = {
 	.send_IPI_self			= NULL,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= TRAMPOLINE_PHYS_LOW,
-	.trampoline_phys_high		= TRAMPOLINE_PHYS_HIGH,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= wait_for_init_deassert,
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
Signature · 1 line
1.6.0.2
#61 lore raw

PATCH 61/114 x86: set ->trampoline_phys_low/high on 64-bit too

In reply to Ingo Molnar

64-bit x86 has zero for ->trampoline_phys_low/high, but the smpboot code can use these values - so it's better to set them up to their correct values.

---
 arch/x86/include/asm/genapic.h                   |    6 ++++++
 arch/x86/include/asm/mach-default/mach_wakecpu.h |    3 ---
 arch/x86/kernel/genapic_flat_64.c                |    8 ++++----
 arch/x86/kernel/genx2apic_cluster.c              |    4 ++--
 arch/x86/kernel/genx2apic_phys.c                 |    4 ++--
 arch/x86/kernel/genx2apic_uv_x.c                 |    4 ++--
 6 files changed, 16 insertions(+), 13 deletions(-)
arch/x86/include/asm/genapic.h +6 -0
index 8bb1c73..90e83a7 100644
@@ -88,6 +88,12 @@ struct genapic {
 
 extern struct genapic *apic;
 
+/*
+ * Warm reset vector default position:
+ */
+#define DEFAULT_TRAMPOLINE_PHYS_LOW		0x467
+#define DEFAULT_TRAMPOLINE_PHYS_HIGH		0x469
+
 #ifdef CONFIG_X86_32
 extern void es7000_update_genapic_to_cluster(void);
 #else
arch/x86/include/asm/mach-default/mach_wakecpu.h +0 -3
index 0a8d786..a327a67 100644
@@ -1,9 +1,6 @@
 #ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
 #define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
 
-#define DEFAULT_TRAMPOLINE_PHYS_LOW (0x467)
-#define DEFAULT_TRAMPOLINE_PHYS_HIGH (0x469)
-
 static inline void wait_for_init_deassert(atomic_t *deassert)
 {
 	while (!atomic_read(deassert))
arch/x86/kernel/genapic_flat_64.c +4 -4
index 7c648cc..3a28d6a 100644
@@ -224,8 +224,8 @@ struct genapic apic_flat =  {
 	.send_IPI_self			= apic_send_IPI_self,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= 0,
-	.trampoline_phys_high		= 0,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
@@ -370,8 +370,8 @@ struct genapic apic_physflat =  {
 	.send_IPI_self			= apic_send_IPI_self,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= 0,
-	.trampoline_phys_high		= 0,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
arch/x86/kernel/genx2apic_cluster.c +2 -2
index 2d97726..abc5ee3 100644
@@ -228,8 +228,8 @@ struct genapic apic_x2apic_cluster = {
 	.send_IPI_self			= x2apic_send_IPI_self,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= 0,
-	.trampoline_phys_high		= 0,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
arch/x86/kernel/genx2apic_phys.c +2 -2
index 74777c2..dc815ef 100644
@@ -214,8 +214,8 @@ struct genapic apic_x2apic_phys = {
 	.send_IPI_self			= x2apic_send_IPI_self,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= 0,
-	.trampoline_phys_high		= 0,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
arch/x86/kernel/genx2apic_uv_x.c +2 -2
index 24b9f42..b590873 100644
@@ -287,8 +287,8 @@ struct genapic apic_x2apic_uv_x = {
 	.send_IPI_self			= uv_send_IPI_self,
 
 	.wakeup_cpu			= NULL,
-	.trampoline_phys_low		= 0,
-	.trampoline_phys_high		= 0,
+	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
+	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
Signature · 1 line
1.6.0.2
#62 lore raw

PATCH 62/114 x86, smp: refactor ->wait_for_init_deassert()

In reply to Ingo Molnar

- spread out the namespace on a per APIC driver basis

- handle a NULL ->wait_for_init_deassert() as a 'dont wait' default method

- remove NUMAQ and Summit handlers

---
 arch/x86/include/asm/es7000/wakecpu.h            |    2 +-
 arch/x86/include/asm/mach-default/mach_wakecpu.h |    2 +-
 arch/x86/include/asm/mach-generic/mach_wakecpu.h |    1 -
 arch/x86/include/asm/numaq/wakecpu.h             |    5 -----
 arch/x86/kernel/es7000_32.c                      |    6 +-----
 arch/x86/kernel/smpboot.c                        |    3 ++-
 arch/x86/mach-generic/bigsmp.c                   |    4 +++-
 arch/x86/mach-generic/default.c                  |    4 +++-
 arch/x86/mach-generic/es7000.c                   |    4 +++-
 arch/x86/mach-generic/numaq.c                    |    5 ++++-
 arch/x86/mach-generic/summit.c                   |    4 +++-
 11 files changed, 21 insertions(+), 19 deletions(-)
arch/x86/include/asm/es7000/wakecpu.h +1 -1
index 4c01be6..5c4d05f 100644
@@ -4,7 +4,7 @@
 #define ES7000_TRAMPOLINE_PHYS_LOW	0x467
 #define ES7000_TRAMPOLINE_PHYS_HIGH	0x469
 
-static inline void wait_for_init_deassert(atomic_t *deassert)
+static inline void es7000_wait_for_init_deassert(atomic_t *deassert)
 {
 #ifndef CONFIG_ES7000_CLUSTERED_APIC
 	while (!atomic_read(deassert))
arch/x86/include/asm/mach-default/mach_wakecpu.h +1 -1
index a327a67..1d34c69 100644
@@ -1,7 +1,7 @@
 #ifndef _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
 #define _ASM_X86_MACH_DEFAULT_MACH_WAKECPU_H
 
-static inline void wait_for_init_deassert(atomic_t *deassert)
+static inline void default_wait_for_init_deassert(atomic_t *deassert)
 {
 	while (!atomic_read(deassert))
 		cpu_relax();
arch/x86/include/asm/mach-generic/mach_wakecpu.h +0 -1
index 2031377..58e5412 100644
@@ -1,7 +1,6 @@
 #ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 #define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 
-#define wait_for_init_deassert (apic->wait_for_init_deassert)
 #define smp_callin_clear_local_apic (apic->smp_callin_clear_local_apic)
 #define store_NMI_vector (apic->store_NMI_vector)
 #define restore_NMI_vector (apic->restore_NMI_vector)
arch/x86/include/asm/numaq/wakecpu.h +0 -5
index 8b6c16d..884b95c 100644
@@ -6,11 +6,6 @@
 #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8)
 #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa)
 
-/* We don't do anything here because we use NMI's to boot instead */
-static inline void wait_for_init_deassert(atomic_t *deassert)
-{
-}
-
 /*
  * Because we use NMIs rather than the INIT-STARTUP sequence to
  * bootstrap the CPUs, the APIC may be in a weird state. Kick it.
arch/x86/kernel/es7000_32.c +1 -5
index e73fe18..d7f433e 100644
@@ -182,10 +182,6 @@ static int wakeup_secondary_cpu_via_mip(int cpu, unsigned long eip)
 	return 0;
 }
 
-static void noop_wait_for_deassert(atomic_t *deassert_not_used)
-{
-}
-
 static int __init es7000_update_genapic(void)
 {
 	apic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
@@ -194,7 +190,7 @@ static int __init es7000_update_genapic(void)
 	if (boot_cpu_data.x86 == 6 &&
 	    (boot_cpu_data.x86_model >= 7 || boot_cpu_data.x86_model <= 11)) {
 		es7000_update_genapic_to_cluster();
-		apic->wait_for_init_deassert = noop_wait_for_deassert;
+		apic->wait_for_init_deassert = NULL;
 		apic->wakeup_cpu = wakeup_secondary_cpu_via_mip;
 	}
 
arch/x86/kernel/smpboot.c +2 -1
index ab83be2..558af37 100644
@@ -196,7 +196,8 @@ static void __cpuinit smp_callin(void)
 	 * our local APIC.  We have to wait for the IPI or we'll
 	 * lock up on an APIC access.
 	 */
-	wait_for_init_deassert(&init_deasserted);
+	if (apic->wait_for_init_deassert)
+		apic->wait_for_init_deassert(&init_deasserted);
 
 	/*
 	 * (This works even if the APIC is not enabled.)
arch/x86/mach-generic/bigsmp.c +3 -1
index a317fbe..40910bf 100644
@@ -106,7 +106,9 @@ struct genapic apic_bigsmp = {
 	.wakeup_cpu			= NULL,
 	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
 	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
-	.wait_for_init_deassert		= wait_for_init_deassert,
+
+	.wait_for_init_deassert		= default_wait_for_init_deassert,
+
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
arch/x86/mach-generic/default.c +3 -1
index 17d8f9c..c246484 100644
@@ -87,7 +87,9 @@ struct genapic apic_default = {
 	.wakeup_cpu			= NULL,
 	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
 	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
-	.wait_for_init_deassert		= wait_for_init_deassert,
+
+	.wait_for_init_deassert		= default_wait_for_init_deassert,
+
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
arch/x86/mach-generic/es7000.c +3 -1
index 871e854..4cb3984 100644
@@ -142,7 +142,9 @@ struct genapic apic_es7000 = {
 	.wakeup_cpu			= NULL,
 	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
 	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
-	.wait_for_init_deassert		= wait_for_init_deassert,
+
+	.wait_for_init_deassert		= default_wait_for_init_deassert,
+
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
arch/x86/mach-generic/numaq.c +4 -1
index 0b496ab..fb03867 100644
@@ -106,7 +106,10 @@ struct genapic apic_numaq = {
 	.wakeup_cpu			= NULL,
 	.trampoline_phys_low		= NUMAQ_TRAMPOLINE_PHYS_LOW,
 	.trampoline_phys_high		= NUMAQ_TRAMPOLINE_PHYS_HIGH,
-	.wait_for_init_deassert		= wait_for_init_deassert,
+
+	/* We don't do anything here because we use NMI's to boot instead */
+	.wait_for_init_deassert		= NULL,
+
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
arch/x86/mach-generic/summit.c +3 -1
index c4799cd..fdca78b 100644
@@ -86,7 +86,9 @@ struct genapic apic_summit = {
 	.wakeup_cpu			= NULL,
 	.trampoline_phys_low		= DEFAULT_TRAMPOLINE_PHYS_LOW,
 	.trampoline_phys_high		= DEFAULT_TRAMPOLINE_PHYS_HIGH,
-	.wait_for_init_deassert		= wait_for_init_deassert,
+
+	.wait_for_init_deassert		= default_wait_for_init_deassert,
+
 	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
Signature · 1 line
1.6.0.2
#63 lore raw

PATCH 63/114 x86, smp: refactor ->smp_callin_clear_local_apic() methods

In reply to Ingo Molnar

Only NUMAQ does something substantial here, because it initializes via NMIs (not via INIT as standard SMP startup) - so it needs to reset the APIC.

- extend the generic code to handle NULL methods

- clear out dummy methods and replace them with NULL

- clean up: remove wrapper macros, etc.

---
 arch/x86/include/asm/es7000/wakecpu.h            |    5 -----
 arch/x86/include/asm/mach-default/mach_wakecpu.h |    5 -----
 arch/x86/include/asm/mach-generic/mach_wakecpu.h |    1 -
 arch/x86/include/asm/numaq/wakecpu.h             |    4 ++--
 arch/x86/kernel/smpboot.c                        |    3 ++-
 arch/x86/mach-generic/bigsmp.c                   |    3 ++-
 arch/x86/mach-generic/default.c                  |    2 +-
 arch/x86/mach-generic/es7000.c                   |    4 +++-
 arch/x86/mach-generic/numaq.c                    |    2 +-
 arch/x86/mach-generic/summit.c                   |    3 ++-
 10 files changed, 13 insertions(+), 19 deletions(-)
arch/x86/include/asm/es7000/wakecpu.h +0 -5
index 5c4d05f..e8e0396 100644
@@ -13,11 +13,6 @@ static inline void es7000_wait_for_init_deassert(atomic_t *deassert)
 	return;
 }
 
-/* Nothing to do for most platforms, since cleared by the INIT cycle */
-static inline void smp_callin_clear_local_apic(void)
-{
-}
-
 static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
 {
 }
arch/x86/include/asm/mach-default/mach_wakecpu.h +0 -5
index 1d34c69..d059807 100644
@@ -8,11 +8,6 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert)
 	return;
 }
 
-/* Nothing to do for most platforms, since cleared by the INIT cycle */
-static inline void smp_callin_clear_local_apic(void)
-{
-}
-
 static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
 {
 }
arch/x86/include/asm/mach-generic/mach_wakecpu.h +0 -1
index 58e5412..30515a1 100644
@@ -1,7 +1,6 @@
 #ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 #define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 
-#define smp_callin_clear_local_apic (apic->smp_callin_clear_local_apic)
 #define store_NMI_vector (apic->store_NMI_vector)
 #define restore_NMI_vector (apic->restore_NMI_vector)
 #define inquire_remote_apic (apic->inquire_remote_apic)
arch/x86/include/asm/numaq/wakecpu.h +2 -2
index 884b95c..61d0a7d 100644
@@ -8,9 +8,9 @@
 
 /*
  * Because we use NMIs rather than the INIT-STARTUP sequence to
- * bootstrap the CPUs, the APIC may be in a weird state. Kick it.
+ * bootstrap the CPUs, the APIC may be in a weird state. Kick it:
  */
-static inline void smp_callin_clear_local_apic(void)
+static inline void numaq_smp_callin_clear_local_apic(void)
 {
 	clear_local_APIC();
 }
arch/x86/kernel/smpboot.c +2 -1
index 558af37..10873a4 100644
@@ -244,7 +244,8 @@ static void __cpuinit smp_callin(void)
 	 */
 
 	pr_debug("CALLIN, before setup_local_APIC().\n");
-	smp_callin_clear_local_apic();
+	if (apic->smp_callin_clear_local_apic)
+		apic->smp_callin_clear_local_apic();
 	setup_local_APIC();
 	end_local_APIC_setup();
 	map_cpu_to_logical_apicid();
arch/x86/mach-generic/bigsmp.c +2 -1
index 40910bf..bd069e7 100644
@@ -109,7 +109,8 @@ struct genapic apic_bigsmp = {
 
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
-	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.smp_callin_clear_local_apic	= NULL,
+
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
arch/x86/mach-generic/default.c +1 -1
index c246484..a25e6ef 100644
@@ -90,7 +90,7 @@ struct genapic apic_default = {
 
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
-	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
arch/x86/mach-generic/es7000.c +3 -1
index 4cb3984..ab41b54 100644
@@ -145,7 +145,9 @@ struct genapic apic_es7000 = {
 
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
-	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	/* Nothing to do for most platforms, since cleared by the INIT cycle: */
+	.smp_callin_clear_local_apic	= NULL,
+
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
arch/x86/mach-generic/numaq.c +1 -1
index fb03867..4d3924f 100644
@@ -110,7 +110,7 @@ struct genapic apic_numaq = {
 	/* We don't do anything here because we use NMI's to boot instead */
 	.wait_for_init_deassert		= NULL,
 
-	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.smp_callin_clear_local_apic	= numaq_smp_callin_clear_local_apic,
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
arch/x86/mach-generic/summit.c +2 -1
index fdca78b..2595baa 100644
@@ -89,7 +89,8 @@ struct genapic apic_summit = {
 
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
-	.smp_callin_clear_local_apic	= smp_callin_clear_local_apic,
+	.smp_callin_clear_local_apic	= NULL,
+
 	.store_NMI_vector		= store_NMI_vector,
 	.restore_NMI_vector		= restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
Signature · 1 line
1.6.0.2
#64 lore raw

PATCH 64/114 x86, smp: refactor ->store/restore_NMI_vector() methods

In reply to Ingo Molnar

Only NUMAQ does something substantial here, because it initializes via NMIs (not via INIT as standard SMP startup) - so it needs to store and restore the NMI vector.

- extend the generic code to handle NULL methods

- clear out dummy methods and replace them with NULL

- clean up: remove wrapper macros, etc.

---
 arch/x86/include/asm/es7000/wakecpu.h            |    8 --------
 arch/x86/include/asm/mach-default/mach_wakecpu.h |    8 --------
 arch/x86/include/asm/mach-generic/mach_wakecpu.h |    2 --
 arch/x86/include/asm/numaq/wakecpu.h             |    6 ++++--
 arch/x86/kernel/smpboot.c                        |    3 ++-
 arch/x86/mach-generic/bigsmp.c                   |    5 ++---
 arch/x86/mach-generic/default.c                  |    4 ++--
 arch/x86/mach-generic/es7000.c                   |    5 ++---
 arch/x86/mach-generic/numaq.c                    |    4 ++--
 arch/x86/mach-generic/summit.c                   |    5 ++---
 10 files changed, 16 insertions(+), 34 deletions(-)
arch/x86/include/asm/es7000/wakecpu.h +0 -8
index e8e0396..71a3a41 100644
@@ -13,14 +13,6 @@ static inline void es7000_wait_for_init_deassert(atomic_t *deassert)
 	return;
 }
 
-static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
-{
-}
-
-static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
-{
-}
-
 extern void __inquire_remote_apic(int apicid);
 
 static inline void inquire_remote_apic(int apicid)
arch/x86/include/asm/mach-default/mach_wakecpu.h +0 -8
index d059807..656bb5e 100644
@@ -8,14 +8,6 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert)
 	return;
 }
 
-static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
-{
-}
-
-static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
-{
-}
-
 #ifdef CONFIG_SMP
 extern void __inquire_remote_apic(int apicid);
 #else /* CONFIG_SMP */
arch/x86/include/asm/mach-generic/mach_wakecpu.h +0 -2
index 30515a1..93207df 100644
@@ -1,8 +1,6 @@
 #ifndef _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 #define _ASM_X86_MACH_GENERIC_MACH_WAKECPU_H
 
-#define store_NMI_vector (apic->store_NMI_vector)
-#define restore_NMI_vector (apic->restore_NMI_vector)
 #define inquire_remote_apic (apic->inquire_remote_apic)
 
 #endif /* _ASM_X86_MACH_GENERIC_MACH_APIC_H */
arch/x86/include/asm/numaq/wakecpu.h +4 -2
index 61d0a7d..1232017 100644
@@ -15,7 +15,8 @@ static inline void numaq_smp_callin_clear_local_apic(void)
 	clear_local_APIC();
 }
 
-static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
+static inline void
+numaq_store_NMI_vector(unsigned short *high, unsigned short *low)
 {
 	printk("Storing NMI vector\n");
 	*high =
@@ -24,7 +25,8 @@ static inline void store_NMI_vector(unsigned short *high, unsigned short *low)
 	  *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW));
 }
 
-static inline void restore_NMI_vector(unsigned short *high, unsigned short *low)
+static inline void
+numaq_restore_NMI_vector(unsigned short *high, unsigned short *low)
 {
 	printk("Restoring NMI vector\n");
 	*((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH)) =
arch/x86/kernel/smpboot.c +2 -1
index 10873a4..1492024 100644
@@ -826,7 +826,8 @@ do_rest:
 
 		pr_debug("Setting warm reset code and vector.\n");
 
-		store_NMI_vector(&nmi_high, &nmi_low);
+		if (apic->store_NMI_vector)
+			apic->store_NMI_vector(&nmi_high, &nmi_low);
 
 		smpboot_setup_warm_reset_vector(start_ip);
 		/*
arch/x86/mach-generic/bigsmp.c +2 -3
index bd069e7..ecdb230 100644
@@ -110,8 +110,7 @@ struct genapic apic_bigsmp = {
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
 	.smp_callin_clear_local_apic	= NULL,
-
-	.store_NMI_vector		= store_NMI_vector,
-	.restore_NMI_vector		= restore_NMI_vector,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/default.c +2 -2
index a25e6ef..9509256 100644
@@ -91,7 +91,7 @@ struct genapic apic_default = {
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
 	.smp_callin_clear_local_apic	= NULL,
-	.store_NMI_vector		= store_NMI_vector,
-	.restore_NMI_vector		= restore_NMI_vector,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/es7000.c +2 -3
index ab41b54..1319070 100644
@@ -147,8 +147,7 @@ struct genapic apic_es7000 = {
 
 	/* Nothing to do for most platforms, since cleared by the INIT cycle: */
 	.smp_callin_clear_local_apic	= NULL,
-
-	.store_NMI_vector		= store_NMI_vector,
-	.restore_NMI_vector		= restore_NMI_vector,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/numaq.c +2 -2
index 4d3924f..d7f7fcf 100644
@@ -111,7 +111,7 @@ struct genapic apic_numaq = {
 	.wait_for_init_deassert		= NULL,
 
 	.smp_callin_clear_local_apic	= numaq_smp_callin_clear_local_apic,
-	.store_NMI_vector		= store_NMI_vector,
-	.restore_NMI_vector		= restore_NMI_vector,
+	.store_NMI_vector		= numaq_store_NMI_vector,
+	.restore_NMI_vector		= numaq_restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/summit.c +2 -3
index 2595baa..46fca79 100644
@@ -90,8 +90,7 @@ struct genapic apic_summit = {
 	.wait_for_init_deassert		= default_wait_for_init_deassert,
 
 	.smp_callin_clear_local_apic	= NULL,
-
-	.store_NMI_vector		= store_NMI_vector,
-	.restore_NMI_vector		= restore_NMI_vector,
+	.store_NMI_vector		= NULL,
+	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
Signature · 1 line
1.6.0.2
#65 lore raw

PATCH 65/114 x86, smp: remove ->restore_NMI_vector()

In reply to Ingo Molnar

Nothing actually restores the NMI vector - so remove this logic altogether.

---
 arch/x86/include/asm/genapic.h       |    1 -
 arch/x86/include/asm/numaq/wakecpu.h |   10 ----------
 arch/x86/kernel/genapic_flat_64.c    |    2 --
 arch/x86/kernel/genx2apic_cluster.c  |    1 -
 arch/x86/kernel/genx2apic_phys.c     |    1 -
 arch/x86/kernel/genx2apic_uv_x.c     |    1 -
 arch/x86/mach-generic/bigsmp.c       |    1 -
 arch/x86/mach-generic/default.c      |    1 -
 arch/x86/mach-generic/es7000.c       |    1 -
 arch/x86/mach-generic/numaq.c        |    1 -
 arch/x86/mach-generic/summit.c       |    1 -
 11 files changed, 0 insertions(+), 21 deletions(-)
arch/x86/include/asm/genapic.h +0 -1
index 90e83a7..e5f9c56 100644
@@ -82,7 +82,6 @@ struct genapic {
 	void (*wait_for_init_deassert)(atomic_t *deassert);
 	void (*smp_callin_clear_local_apic)(void);
 	void (*store_NMI_vector)(unsigned short *high, unsigned short *low);
-	void (*restore_NMI_vector)(unsigned short *high, unsigned short *low);
 	void (*inquire_remote_apic)(int apicid);
 };
 
arch/x86/include/asm/numaq/wakecpu.h +0 -10
index 1232017..920dcfe 100644
@@ -25,16 +25,6 @@ numaq_store_NMI_vector(unsigned short *high, unsigned short *low)
 	  *((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW));
 }
 
-static inline void
-numaq_restore_NMI_vector(unsigned short *high, unsigned short *low)
-{
-	printk("Restoring NMI vector\n");
-	*((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_HIGH)) =
-								 *high;
-	*((volatile unsigned short *)phys_to_virt(NUMAQ_TRAMPOLINE_PHYS_LOW)) =
-								 *low;
-}
-
 static inline void inquire_remote_apic(int apicid)
 {
 }
arch/x86/kernel/genapic_flat_64.c +0 -2
index 3a28d6a..e9237f5 100644
@@ -229,7 +229,6 @@ struct genapic apic_flat =  {
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= NULL,
 };
 
@@ -375,6 +374,5 @@ struct genapic apic_physflat =  {
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= NULL,
 };
arch/x86/kernel/genx2apic_cluster.c +0 -1
index abc5ee3..7c87156 100644
@@ -233,6 +233,5 @@ struct genapic apic_x2apic_cluster = {
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= NULL,
 };
arch/x86/kernel/genx2apic_phys.c +0 -1
index dc815ef..5cbae8a 100644
@@ -219,6 +219,5 @@ struct genapic apic_x2apic_phys = {
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= NULL,
 };
arch/x86/kernel/genx2apic_uv_x.c +0 -1
index b590873..6adb5e6 100644
@@ -292,7 +292,6 @@ struct genapic apic_x2apic_uv_x = {
 	.wait_for_init_deassert		= NULL,
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= NULL,
 };
 
arch/x86/mach-generic/bigsmp.c +0 -1
index ecdb230..d9377af 100644
@@ -111,6 +111,5 @@ struct genapic apic_bigsmp = {
 
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/default.c +0 -1
index 9509256..b004257 100644
@@ -92,6 +92,5 @@ struct genapic apic_default = {
 
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/es7000.c +0 -1
index 1319070..62673a8 100644
@@ -148,6 +148,5 @@ struct genapic apic_es7000 = {
 	/* Nothing to do for most platforms, since cleared by the INIT cycle: */
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/numaq.c +0 -1
index d7f7fcf..2c33415 100644
@@ -112,6 +112,5 @@ struct genapic apic_numaq = {
 
 	.smp_callin_clear_local_apic	= numaq_smp_callin_clear_local_apic,
 	.store_NMI_vector		= numaq_store_NMI_vector,
-	.restore_NMI_vector		= numaq_restore_NMI_vector,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
arch/x86/mach-generic/summit.c +0 -1
index 46fca79..c2471a9 100644
@@ -91,6 +91,5 @@ struct genapic apic_summit = {
 
 	.smp_callin_clear_local_apic	= NULL,
 	.store_NMI_vector		= NULL,
-	.restore_NMI_vector		= NULL,
 	.inquire_remote_apic		= inquire_remote_apic,
 };
Signature · 1 line
1.6.0.2