GitHub/MotorolaMobilityLLC/kernel-slsi.git
16 years agox86: merge smp_store_cpu_info
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:05 +0000 (14:25 -0300)]
x86: merge smp_store_cpu_info

now that it is the same between arches, put it into smpboot.c

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: call identify_secondary_cpu in smp_store_cpu_info
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:04 +0000 (14:25 -0300)]
x86: call identify_secondary_cpu in smp_store_cpu_info

Call it conditionally for secondary cpus. This behaviour
matches i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use identify_boot_cpu
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:03 +0000 (14:25 -0300)]
x86: use identify_boot_cpu

Call this function instead of identify_cpu in bugs_64.c

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: provide specialized identification routines for x86_64
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:02 +0000 (14:25 -0300)]
x86: provide specialized identification routines for x86_64

provide two specialized identify_secondary_cpu() and identify_boot_cpu()
routines for x86_64. Although not strictly needed, they are functionally
correct, and will ease integration with i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: decouple call to print_cpu_info from smp_store_cpu_info
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:01 +0000 (14:25 -0300)]
x86: decouple call to print_cpu_info from smp_store_cpu_info

This will ease integration with i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add an smp_apply_quirks to smpboot_32.c
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:00 +0000 (14:25 -0300)]
x86: add an smp_apply_quirks to smpboot_32.c

The split of smp_store_cpu_info in a quirks-only part
will ease integration with x86_64

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use start_ipi_hook in x86_64
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:24:59 +0000 (14:24 -0300)]
x86: use start_ipi_hook in x86_64

It is used to match i386. The definition for the non-paravirt
case is moved to smp.h instead of smp_32.h

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use apic_*_around instead of apic_write in x86_64
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:24:58 +0000 (14:24 -0300)]
x86: use apic_*_around instead of apic_write in x86_64

This patch replaces apic_read() for apic_read_around()
and apic_write for apic_write_around() in smpboot_64.c
We do it to have a common usage between x86_64 and i386.
In the former, it will always simply expand to apic_write

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add loglevel to printks
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:24:57 +0000 (14:24 -0300)]
x86: add loglevel to printks

Add loglevel facilities to printks in __inquire_remote_apic.
the levels are the ones to match x86_64 ones.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: change var types in __inquire_remote_apic
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:24:56 +0000 (14:24 -0300)]
x86: change var types in __inquire_remote_apic

change some variables' types in __inquire_remote_apic to
match x86_64

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86 iommu: add more documentation
Pavel Machek [Wed, 19 Mar 2008 14:58:11 +0000 (15:58 +0100)]
x86 iommu: add more documentation

Fix coding style in pci-dma_64.c and add stubs for documentation. I
hope someone fills the rest, I understand maybe off and soft...

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move mp_bus_id_to_node to numa.c
Alexey Starikovskiy [Tue, 11 Mar 2008 19:55:48 +0000 (22:55 +0300)]
x86: move mp_bus_id_to_node to numa.c

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move mp_bus_id_to_local to numa.c
Alexey Starikovskiy [Tue, 11 Mar 2008 19:55:42 +0000 (22:55 +0300)]
x86: move mp_bus_id_to_local to numa.c

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make mp_bus_id_to_type optional
Alexey Starikovskiy [Thu, 20 Mar 2008 11:55:02 +0000 (14:55 +0300)]
x86: make mp_bus_id_to_type optional

[ mingo@elte.hu: fix boot regression. ]

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: rearrange bus_type parse
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:56 +0000 (14:54 +0300)]
x86: rearrange bus_type parse

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use not_pci bitmap #6
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:49 +0000 (14:54 +0300)]
x86: use not_pci bitmap #6

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use not_pci bitmap #5
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:43 +0000 (14:54 +0300)]
x86: use not_pci bitmap #5

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use not_pci bitmap #4
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:36 +0000 (14:54 +0300)]
x86: use not_pci bitmap #4

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use not_pci bitmap #3
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:30 +0000 (14:54 +0300)]
x86: use not_pci bitmap #3

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use not_pci bitmap #2
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:24 +0000 (14:54 +0300)]
x86: use not_pci bitmap #2

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use not_pci bitmap #1
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:18 +0000 (14:54 +0300)]
x86: use not_pci bitmap #1

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add mp_bus_not_pci bitmap to mpparse_32.c
Alexey Starikovskiy [Thu, 20 Mar 2008 11:54:09 +0000 (14:54 +0300)]
x86: add mp_bus_not_pci bitmap to mpparse_32.c

Signed-off: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: get boot_cpu_id as early for k8_scan_nodes
Yinghai Lu [Tue, 19 Feb 2008 11:21:06 +0000 (03:21 -0800)]
x86: get boot_cpu_id as early for k8_scan_nodes

When acpi=off or there is no SRAT defined, apicid_to_node is got from K8
Northbridge PCI configuration space in k8_scan_nodes() in
arch/x86_64/mm/k8toplogy.c.

The problem is that it assumes bsp apic id is 0 at that point.

For four socket system with Quad core cpus installed, all cpus apic id
is offset by 4, and bsp apic id is 4.

For eight socket system with dual core cpus installed, all cpus apic id
is offset by 2, and bsp apic id is 2.

We need get boot_cpu_id --- bsp apic id, before k8_scan_nodes by called.

So create early_acpi_boot_init and early_get_smp_config for get boot_cpu_id.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move quad_local_to_mp_bus_id to numa.c
Alexey Starikovskiy [Tue, 11 Mar 2008 16:45:48 +0000 (19:45 +0300)]
x86: move quad_local_to_mp_bus_id to numa.c

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: correct/clarify comment in nops.h
Mikael Pettersson [Tue, 11 Mar 2008 15:43:31 +0000 (16:43 +0100)]
x86: correct/clarify comment in nops.h

<asm-x86/nops.h> describes certain multibyte instructions as
"generic" nops when in fact they aren't nops at all in 64-bit
mode (missing REX.W causing truncation of a register).

Update the comment to state that K8 or P6 style nops should be
used in 64-bit mode. This matches what the alternatives code does.

Signed-off-by: Mikael Pettersson <mikpe@it.uu.se>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: Remove redundant display of free swap space in show_mem()
Johannes Weiner [Mon, 10 Mar 2008 20:10:57 +0000 (21:10 +0100)]
x86: Remove redundant display of free swap space in show_mem()

Signed-off-by: Johannes Weiner <hannes@saeurebad.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: prevent unconditional writes to DebugCtl MSR
Jan Beulich [Mon, 10 Mar 2008 13:11:17 +0000 (13:11 +0000)]
x86: prevent unconditional writes to DebugCtl MSR

Otherwise, enabling (or better, subsequent disabling) of single
stepping would cause a kernel oops on CPUs not having this MSR.

The patch could have been added a conditional to the MSR write in
user_disable_single_step(), but centralizing the updates seems safer
and (looking forward) better manageable.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Markus Metzger <markus.t.metzger@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: Don't send RESCHEDULE_VECTOR to offlined cpus
Gautham R Shenoy [Mon, 10 Mar 2008 12:14:03 +0000 (17:44 +0530)]
x86: Don't send RESCHEDULE_VECTOR to offlined cpus

In the x86 native_smp_send_reschedule_function(), don't send the IPI if the
cpu has gone offline already. Warn nevertheless!!

Signed-off-by: Gautham R Shenoy <ego@in.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add AMD Northbridge MSR definition
stephane eranian [Fri, 7 Mar 2008 21:05:39 +0000 (13:05 -0800)]
x86: add AMD Northbridge MSR definition

adds AMD Northbridge config MSR definition

Signed-off-by: Stephane Eranian <eranian@gmail.com>
Signed-off-by: Robert Richter <robert.richter@amd.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add cpu_has_arch_perfmon
stephane eranian [Fri, 7 Mar 2008 21:05:27 +0000 (13:05 -0800)]
x86: add cpu_has_arch_perfmon

adds cpu_has_arch_perfmon to test presence of architectural perfmon on
Intel x86 processor

Signed-off-by: Stephane Eranian <eranian@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: cleanup duplicate includes
Joe Perches [Sun, 9 Mar 2008 19:35:00 +0000 (12:35 -0700)]
x86: cleanup duplicate includes

Signed-off-by: Joe Perches <joe@perches.com>
 arch/x86/kernel/reboot.c      |    1 -
 include/asm-x86/elf.h         |    5 ++---
 include/asm-x86/posix_types.h |    8 +-------
 include/asm-x86/processor.h   |    3 +--
 include/asm-x86/unistd.h      |    8 +-------
 5 files changed, 5 insertions(+), 20 deletions(-)

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: coding style fixes to arch/x86/kernel/setup_32.c
Paolo Ciarrocchi [Fri, 7 Mar 2008 18:26:26 +0000 (19:26 +0100)]
x86: coding style fixes to arch/x86/kernel/setup_32.c

Fix:

  ERROR: do not initialise externals to 0 or NULL

Signed-off-by: Paolo Ciarrocchi <paolo.ciarrocchi@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: sort address_markers for dump_pagetables
Yinghai Lu [Sat, 8 Mar 2008 03:17:55 +0000 (19:17 -0800)]
x86: sort address_markers for dump_pagetables

otherwise Vmemmap and High Kernel Mapping string is not showing up.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: introduce initial apicid
Yinghai Lu [Thu, 6 Mar 2008 21:46:39 +0000 (13:46 -0800)]
x86: introduce initial apicid

store initial_apicid from early identify. it is could be different from
phys_proc_id later.

also print it out in /proc/cpuinfo.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove mach_reboot.h
Ingo Molnar [Thu, 6 Mar 2008 17:38:52 +0000 (18:38 +0100)]
x86: remove mach_reboot.h

all reboot details are handled in reboot.c and quirks are handled
via reboot_fixups_32.c.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: enhance DEBUG_RODATA support for hotplug and kprobes
Mathieu Desnoyers [Sat, 2 Feb 2008 20:42:20 +0000 (15:42 -0500)]
x86: enhance DEBUG_RODATA support for hotplug and kprobes

Standardize DEBUG_RODATA, removing special cases for hotplug and kprobes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: pageexec@freemail.hu
Cc: akpm@linux-foundation.org
CC: Andi Kleen <andi@firstfloor.org>
CC: pageexec@freemail.hu
CC: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
16 years agox86: enhance DEBUG_RODATA support - alternatives
Mathieu Desnoyers [Thu, 6 Mar 2008 13:48:49 +0000 (08:48 -0500)]
x86: enhance DEBUG_RODATA support - alternatives

Fix a memcpy that should be a text_poke (in apply_alternatives).

Use kernel_wp_save/kernel_wp_restore in text_poke to support DEBUG_RODATA
correctly and so the CPU HOTPLUG special case can be removed.

Add text_poke_early, for alternatives and paravirt boot-time and module load
time patching.

Changelog:

- Fix text_set and text_poke alignment check (mixed up bitwise and and or)
- Remove text_set
- Export add_nops, so it can be used by others.
- Document text_poke_early.
- Remove clflush, since it breaks some VIA architectures and is not strictly
  necessary.
- Add kerneldoc to text_poke and text_poke_early.
- Create a second vmap instead of using the WP bit to support Xen and VMI.
- Move local_irq disable within text_poke and text_poke_early to be able to
  be sleepable in these functions.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: Andi Kleen <andi@firstfloor.org>
CC: pageexec@freemail.hu
CC: H. Peter Anvin <hpa@zytor.com>
CC: Jeremy Fitzhardinge <jeremy@goop.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: replace remaining __FUNCTION__ occurances
Harvey Harrison [Mon, 3 Mar 2008 19:37:23 +0000 (11:37 -0800)]
x86: replace remaining __FUNCTION__ occurances

__FUNCTION__ is gcc-specific, use __func__

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: show apicid for cpu in proc
Yinghai Lu [Thu, 6 Mar 2008 09:13:34 +0000 (01:13 -0800)]
x86: show apicid for cpu in proc

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fix amd_detect_cmp
Yinghai Lu [Thu, 6 Mar 2008 09:11:11 +0000 (01:11 -0800)]
x86: fix amd_detect_cmp

for system with apicid lifting, boot cpu apicid will be 4

got:

  CPU: L1 I Cache: 64K (64 bytes/line), D cache 64K (64 bytes/line)
  CPU: L2 Cache: 512K (64 bytes/line)
  CPU 0/4 -> Node 0
  CPU: Physical Processor ID: 1
  CPU: Processor Core ID: 0

so try to offset apicid back before get phys_proc_id with bits shift.
then we can get correct socket ID

also remove remove cpu_data(0) reference.

because cpu_data(0) only be ready after smp_prepare_cpus with the assignment
from boot_cpu_data to current_cpu_data aka cpu_data(0).

and check_bugs()==>identify_cpu(&boot_cpu_data) is quite before than
smp_prepare_cpus. So just use boot_cpu_id instead.

Signed-off-by: Yinghai Lu <yhlu.kernel@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add KERN_INFO to show_unhandled_signals printout
Ingo Molnar [Thu, 6 Mar 2008 09:43:17 +0000 (10:43 +0100)]
x86: add KERN_INFO to show_unhandled_signals printout

Before:
   total: 0 errors, 1 warnings, 678 lines checked
After:
   total: 0 errors, 0 warnings, 678 lines checked

No code changed:

arch/x86/kernel/signal_32.o:

   text    data     bss     dec     hex filename
   5333       0       4    5337    14d9 signal_32.o.before
   5336       0       4    5340    14dc signal_32.o.after

md5:
   c279e98012a2808e90cfa2a7787e42a4  signal_32.o.before.asm
   c279e98012a2808e90cfa2a7787e42a4  signal_32.o.after.asm

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move extern declaration to vdso.h
Ingo Molnar [Thu, 6 Mar 2008 09:39:07 +0000 (10:39 +0100)]
x86: move extern declaration to vdso.h

Before:
   total: 0 errors, 3 warnings, 685 lines checked
After:
   total: 0 errors, 1 warnings, 678 lines checked

No code changed:

arch/x86/kernel/signal_32.o:

   text    data     bss     dec     hex filename
   5333       0       4    5337    14d9 signal_32.o.before
   5333       0       4    5337    14d9 signal_32.o.after

md5:
   c279e98012a2808e90cfa2a7787e42a4  signal_32.o.before.asm
   c279e98012a2808e90cfa2a7787e42a4  signal_32.o.after.asm

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: clean up arch/x86/kernel/signal_32.c
Ingo Molnar [Thu, 6 Mar 2008 09:33:08 +0000 (10:33 +0100)]
x86: clean up arch/x86/kernel/signal_32.c

Before:
   total: 21 errors, 6 warnings, 665 lines checked
After:
   total: 0 errors, 3 warnings, 685 lines checked

No code changed:

arch/x86/kernel/signal_32.o:

   text    data     bss     dec     hex filename
   5333       0       4    5337    14d9 signal_32.o.before
   5333       0       4    5337    14d9 signal_32.o.after

md5:
   c279e98012a2808e90cfa2a7787e42a4  signal_32.o.before.asm
   c279e98012a2808e90cfa2a7787e42a4  signal_32.o.after.asm

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove DEBUG_SIG
Ingo Molnar [Thu, 6 Mar 2008 09:24:04 +0000 (10:24 +0100)]
x86: remove DEBUG_SIG

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: arch/x86/kernel/cpu/feature_names.c - use angle brackets for include
Joe Perches [Wed, 5 Mar 2008 00:47:00 +0000 (16:47 -0800)]
x86: arch/x86/kernel/cpu/feature_names.c - use angle brackets for include

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: include/asm-x86/mutex_32.h - use angle brackets for include
Joe Perches [Wed, 5 Mar 2008 00:46:27 +0000 (16:46 -0800)]
x86: include/asm-x86/mutex_32.h - use angle brackets for include

Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: clean up i387.c
Ingo Molnar [Wed, 5 Mar 2008 14:37:32 +0000 (15:37 +0100)]
x86: clean up i387.c

minor coding style cleanups.

Before:
   total: 0 errors, 3 warnings, 479 lines checked
After:
   total: 0 errors, 1 warnings, 483 lines checked

No code changed:

arch/x86/kernel/i387.o:

   text    data     bss     dec     hex filename
   2379       4       8    2391     957 i387.o.before
   2379       4       8    2391     957 i387.o.after

md5:
   e1434553a3b4ff1f52ad97a68b1fad8a  i387.o.before.asm
   e1434553a3b4ff1f52ad97a68b1fad8a  i387.o.after.asm

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add comments to processor.h
Ingo Molnar [Wed, 5 Mar 2008 14:15:42 +0000 (15:15 +0100)]
x86: add comments to processor.h

add comments to the FPU structures of processor.h.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use cpu_relax instead of rep_nop
Glauber Costa [Mon, 3 Mar 2008 17:13:14 +0000 (14:13 -0300)]
x86: use cpu_relax instead of rep_nop

This is done for smpboot_32.c

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use wait_for_init_deassert in x86_64
Glauber Costa [Mon, 3 Mar 2008 17:13:13 +0000 (14:13 -0300)]
x86: use wait_for_init_deassert in x86_64

wraps the busy loop for wait_for_init_deasserted() in a function,
so smp_callin in x86_64 looks like more i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify setup_trampoline
Glauber Costa [Mon, 3 Mar 2008 17:13:12 +0000 (14:13 -0300)]
x86: unify setup_trampoline

setup_trampoline() looks very similar between architectures, and this
patch unifies them. The i386 version allocates bootmem memory, while
the x86_64 version uses a fixed address.

In this patch, we initialize the global trampoline_base to the x86_64 version,
and i386 allocation can later override it.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: adapt voyager's setup_trampoline
Glauber Costa [Mon, 3 Mar 2008 17:13:11 +0000 (14:13 -0300)]
x86: adapt voyager's setup_trampoline

make setup_trampoline non-static. This way, it won't conflict
with the extern declaration in smp.h

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: adapt voyager's trampoline_base
Glauber Costa [Mon, 3 Mar 2008 17:13:10 +0000 (14:13 -0300)]
x86: adapt voyager's trampoline_base

Change voyager's trampoline base to unsigned char *
instead of u32. This way, it won't conflict with
the other architectures when including smp.h

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move trampoline arrays extern definition to smp.h
Glauber Costa [Mon, 3 Mar 2008 17:13:09 +0000 (14:13 -0300)]
x86: move trampoline arrays extern definition to smp.h

In here, they can serve both architectures

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make x86_64 accept the max_cpus parameter
Glauber Costa [Mon, 3 Mar 2008 17:13:08 +0000 (14:13 -0300)]
x86: make x86_64 accept the max_cpus parameter

The parameter passing parsing is done in the common smpboot.c

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge __cpu_disable and cpu_die
Glauber Costa [Mon, 3 Mar 2008 17:13:07 +0000 (14:13 -0300)]
x86: merge __cpu_disable and cpu_die

They are now equal, and are moved to a common file

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: do not clear cpu_online_map
Glauber Costa [Mon, 3 Mar 2008 17:13:06 +0000 (14:13 -0300)]
x86: do not clear cpu_online_map

it was already cleared two lines above, and so, this removal
is bogus

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use remove_from_maps in cpu_disable
Glauber Costa [Mon, 3 Mar 2008 17:13:05 +0000 (14:13 -0300)]
x86: use remove_from_maps in cpu_disable

it is already used in x86_64. In i386, it only
removes from cpu_online_map

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove vector_lock around cpu_online_map
Glauber Costa [Mon, 3 Mar 2008 17:13:04 +0000 (14:13 -0300)]
x86: remove vector_lock around cpu_online_map

This lock does not protect cpu_online_map, so its
length can be shortened, and in some cases, removed.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move cpu_coregroup_map to common file
Glauber Costa [Mon, 3 Mar 2008 17:13:03 +0000 (14:13 -0300)]
x86: move cpu_coregroup_map to common file

it is equal between architectures

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move sibling functions to common file
Glauber Costa [Mon, 3 Mar 2008 17:13:02 +0000 (14:13 -0300)]
x86: move sibling functions to common file

set_cpu_sibling_map() and remove_sibling_info() are
equal between architectures, and are now moved to common
file

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move hotplug related extern definitions to smp.h
Glauber Costa [Mon, 3 Mar 2008 17:13:01 +0000 (14:13 -0300)]
x86: move hotplug related extern definitions to smp.h

definitions that are inside CONFIG_HOTPLUG_CPU in
the arch-specific smp*.h files are moved to common
header

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make remove_siblinginfo non-static
Glauber Costa [Mon, 3 Mar 2008 17:13:00 +0000 (14:13 -0300)]
x86: make remove_siblinginfo non-static

this is done to match i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make set_cpu_sibling_map nonstatic
Glauber Costa [Mon, 3 Mar 2008 17:12:59 +0000 (14:12 -0300)]
x86: make set_cpu_sibling_map nonstatic

And move its extern definition to smp.h, the common header

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move equal types to common file
Glauber Costa [Mon, 3 Mar 2008 17:12:58 +0000 (14:12 -0300)]
x86: move equal types to common file

move definitions that are now equal in type from
smpboot_{32,64}.c to smpboot.c

cpu_callin_map is put temporarily in smp_64.h (already
exists in smp_32.h), and will soon be merged.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: adjust types in smpcommon_32.c
Glauber Costa [Mon, 3 Mar 2008 17:12:57 +0000 (14:12 -0300)]
x86: adjust types in smpcommon_32.c

so they can have the same type as x86_64

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove cpu_llc_id from processor.h
Glauber Costa [Mon, 3 Mar 2008 17:12:56 +0000 (14:12 -0300)]
x86: remove cpu_llc_id from processor.h

it is already defined in smp.h

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: get rid of smp_32.c and smp_64.c
Glauber Costa [Mon, 3 Mar 2008 17:12:55 +0000 (14:12 -0300)]
x86: get rid of smp_32.c and smp_64.c

This patch merges the copyright notices, and valuable
comments that were left back on smp_{32,64}.c. With that,
files are empty, and are deleted

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: create tlb files
Glauber Costa [Mon, 3 Mar 2008 17:12:54 +0000 (14:12 -0300)]
x86: create tlb files

this patch creates tlb_32.c and tlb_64.c, with
tlb-related functions that used to live in smp*.c files.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: create ipi.c
Glauber Costa [Mon, 3 Mar 2008 17:12:53 +0000 (14:12 -0300)]
x86: create ipi.c

This patch moves all ipi and apic related functions
from smp_32.c to ipi.c

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: create smp.c
Glauber Costa [Mon, 3 Mar 2008 17:12:52 +0000 (14:12 -0300)]
x86: create smp.c

this patch moves all the functions and data structures that look
like exactly the same from smp_{32,64}.c to smp.c

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify smp_send_stop
Glauber Costa [Mon, 3 Mar 2008 17:12:51 +0000 (14:12 -0300)]
x86: unify smp_send_stop

function definition is moved to common header.
x86_64 version is now called native_smp_send_stop

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add reboot_force test to native_smp_send_stop
Glauber Costa [Mon, 3 Mar 2008 17:12:50 +0000 (14:12 -0300)]
x86: add reboot_force test to native_smp_send_stop

This can be safely added to i386. After that,
functions look exactly the same for both arches

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make stop_this_cpu looks exactly equal in both arches
Glauber Costa [Mon, 3 Mar 2008 17:12:49 +0000 (14:12 -0300)]
x86: make stop_this_cpu looks exactly equal in both arches

with the hlt_works change, it is possible to have i386
and x86_64 stop_this_cpu() looking exactly the same. They
can, after that, be merged.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: provide hlt_works function.
Glauber Costa [Mon, 3 Mar 2008 17:12:48 +0000 (14:12 -0300)]
x86: provide hlt_works function.

In x86_64, hlt always work. in i386, we'll query the cpuinfo associated
with this cpu

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: change x86_64 smp_call_function_mask to look alike i386
Glauber Costa [Mon, 3 Mar 2008 17:12:47 +0000 (14:12 -0300)]
x86: change x86_64 smp_call_function_mask to look alike i386

the two versions (the inner version, and the outer version, that takes
the locks) of smp_call_function_mask are made into one. With the changes,
i386 and x86_64 versions look exactly the same.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: provide __smp_call_function
Glauber Costa [Mon, 3 Mar 2008 17:12:46 +0000 (14:12 -0300)]
x86: provide __smp_call_function

This function is used in smp_send_stop(). It's like
smp_call_function_mask, but always go to all online cpus,
and does not take any locks.

It is added to x86_64, but will soon be unified in a common file

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: create smpcommon.c
Glauber Costa [Mon, 3 Mar 2008 17:12:45 +0000 (14:12 -0300)]
x86: create smpcommon.c

This patch creates smpcommon.c with functions that are
equal between architectures. The i386-only init_gdt
is ifdef'd.

Note that smpcommon.o figures twice in the Makefile:
this is because sub-architectures like voyager that does
not use the normal smp_$(BITS) files also have to access them

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove irqs disabled warning.
Glauber Costa [Mon, 3 Mar 2008 17:12:44 +0000 (14:12 -0300)]
x86: remove irqs disabled warning.

there's already a warning in the topmost function

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove export for smp_call_function_mask.
Glauber Costa [Mon, 3 Mar 2008 17:12:43 +0000 (14:12 -0300)]
x86: remove export for smp_call_function_mask.

with this removal, exports for both i386 and x86_64,
regarding the "smp_call_function" series are now the same.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move prefill_possible_map to common file
Glauber Costa [Mon, 3 Mar 2008 17:12:42 +0000 (14:12 -0300)]
x86: move prefill_possible_map to common file

this patches moves prefill_possible_map() to smpboot.c
Right now it is x86_64-specific, but nothing intrinsically
prevents it to be used by i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: use disabled_cpus in i386
Glauber Costa [Mon, 3 Mar 2008 17:12:41 +0000 (14:12 -0300)]
x86: use disabled_cpus in i386

this patch allows a cpu to be marked as present but disabled in i386,
just as x86_64 currently does.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move disabled_cpus to common header
Glauber Costa [Mon, 3 Mar 2008 17:12:40 +0000 (14:12 -0300)]
x86: move disabled_cpus to common header

disabled_cpus is (up to now) a x86_64-only contruction.
But it's extern declaration can be moved to common header anyway

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify smp_cpus_done
Glauber Costa [Mon, 3 Mar 2008 17:12:39 +0000 (14:12 -0300)]
x86: unify smp_cpus_done

definition is moved to common header. x86_64 version is now called
native_smp_cpus_done

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify smp_prepare_cpus
Glauber Costa [Mon, 3 Mar 2008 17:12:38 +0000 (14:12 -0300)]
x86: unify smp_prepare_cpus

definition is moved to common header. x86_64 version is now called
native_smp_prepare_cpus

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify prepare_boot_cpu
Glauber Costa [Mon, 3 Mar 2008 17:12:37 +0000 (14:12 -0300)]
x86: unify prepare_boot_cpu

definition is moved to common header. x86_64 version is now called
native_prepare_boot_cpu

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify __cpu_up.
Glauber Costa [Mon, 3 Mar 2008 17:12:36 +0000 (14:12 -0300)]
x86: unify __cpu_up.

function definition is moved to common header. x86_64 version
is now called native_cpu_up

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: unify smp_call_function_mask
Glauber Costa [Mon, 3 Mar 2008 17:12:35 +0000 (14:12 -0300)]
x86: unify smp_call_function_mask

definition is moved to common header, x86_64 function name
now is native_smp_call_function_mask

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge smp_send_reschedule
Glauber Costa [Mon, 3 Mar 2008 17:12:34 +0000 (14:12 -0300)]
x86: merge smp_send_reschedule

function definition is moved to common header, x86_64 version is now called
native_smp_send_reschedule

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move smp_ops extern declaration to common header
Glauber Costa [Mon, 3 Mar 2008 17:12:33 +0000 (14:12 -0300)]
x86: move smp_ops extern declaration to common header

the smp_ops symbol is temporarily defined in smp_64.c, but it will soon
be unified

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: define smp_ops in common header
Glauber Costa [Mon, 3 Mar 2008 17:12:32 +0000 (14:12 -0300)]
x86: define smp_ops in common header

x86_64 will benefit from it
Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge extern variables definitions
Glauber Costa [Mon, 3 Mar 2008 17:12:31 +0000 (14:12 -0300)]
x86: merge extern variables definitions

move extern definitions that are the same between smp_{32,64}.h
to smp.h

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: merge extern function definitions
Glauber Costa [Mon, 3 Mar 2008 17:12:30 +0000 (14:12 -0300)]
x86: merge extern function definitions

move extern function definitions that are the same between smp_{32,64}.h
to smp.h

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: commonize smp.h
Glauber Costa [Mon, 3 Mar 2008 17:12:29 +0000 (14:12 -0300)]
x86: commonize smp.h

this is the first step of integrating smp.h between x86_64
and i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fix switch_to() clobbers
Ingo Molnar [Wed, 5 Mar 2008 09:46:38 +0000 (10:46 +0100)]
x86: fix switch_to() clobbers

Liu Pingfan noticed that switch_to() clobbers more registers than its
asm constraints specify.

We get away with this due to luck mostly - schedule()
by its nature only has 'local' state which gets reloaded
automatically. Fix it nevertheless, we could hit this anytime.

it turns out that with the extra constraints gcc manages to make
schedule() even more compact:

   text    data     bss     dec     hex filename
  28626     684    2640   31950    7cce sched.o.before
  28613     684    2640   31937    7cc1 sched.o.after

Reported-by: Liu Pingfan <kernelfans@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: clean up switch_to()
Ingo Molnar [Wed, 5 Mar 2008 09:24:37 +0000 (10:24 +0100)]
x86: clean up switch_to()

Make the code more readable and more hackable:

 - use symbolic asm parameters
 - use readable indentation
 - add comments that explains the details

No code changed:

kernel/sched.o:

   text    data     bss     dec     hex filename
  28626     684    2640   31950    7cce sched.o.before
  28626     684    2640   31950    7cce sched.o.after

md5:
   2823d406c18b781975cdb2e7cfea0059  sched.o.before.asm
   2823d406c18b781975cdb2e7cfea0059  sched.o.after.asm

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: reserve end-of-conventional-memory to 1MB, 64-bit, use paravirt_enabled
Alexander van Heukelum [Tue, 4 Mar 2008 19:12:28 +0000 (20:12 +0100)]
x86: reserve end-of-conventional-memory to 1MB, 64-bit, use paravirt_enabled

Jeremy Fitzhardinge pointed out that looking at the boot_params
struct to determine if the system is running in a paravirtual
environment is not reliable for the Xen case, currently. He also
points out that there already exists a function to determine if
the system is running in a paravirtual environment. So let's use
that instead. This gets rid of the preprocessor test too.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: reserve end-of-conventional-memory to 1MB, 32-bit, use paravirt_enabled
Alexander van Heukelum [Tue, 4 Mar 2008 18:57:42 +0000 (19:57 +0100)]
x86: reserve end-of-conventional-memory to 1MB, 32-bit, use paravirt_enabled

Jeremy Fitzhardinge pointed out that looking at the boot_params
struct to determine if the system is running in a paravirtual
environment is not reliable for the Xen case, currently. He also
points out that there already exists a function to determine if
the system is running in a paravirtual environment. So let's use
that instead. This gets rid of the preprocessor test too.

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: wmb() confusion in system.h
Pavel Machek [Mon, 3 Mar 2008 11:49:09 +0000 (12:49 +0100)]
x86: wmb() confusion in system.h

Comment says wmb is a nop, but it is implemented as lock addl
below... Should it be compiled to nop if we know we are running on
"good" Intel cpu?

At least remove confusing comment for now.

Signed-off-by: Pavel Machek <pavel@suse.cz>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: if we cannot calibrate the TSC, we panic.
Rusty Russell [Tue, 4 Mar 2008 12:07:50 +0000 (23:07 +1100)]
x86: if we cannot calibrate the TSC, we panic.

The current tsc_init() clears the TSC feature bit if the TSC khz
cannot be calculated, causing us to panic in
arch/x86/kernel/cpu/bugs.c check_config().  We should simply mark it
unstable.

Frankly, someone should take an axe to this code.  mark_tsc_unstable()
not only marks it unstable, but sets tsc_enabled to 0, which seems
redundant but is actually important here because means it won't be
used by sched_clock() either.  Perhaps a tristate enum "UNUSABLE,
UNSTABLE, OK" would be clearer, and separate mark_tsc_unstable() and
mark_tsc_broken() functions?

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Ingo Molnar <mingo@elte.hu>