openwrt/staging/blogic.git
16 years agox86: add callin tests to cpu_up
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:55 +0000 (14:25 -0300)]
x86: add callin tests to cpu_up

Now that we boot cpus here, callin_map has this meaning (same
as x86_64)

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

wakeup_secondary_via_INIT => wakeup_secondary_cpu.

This is to match i386, where init is not always used.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: include mach_apic.h in smpboot_64.c and smpboot.c
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:53 +0000 (14:25 -0300)]
x86: include mach_apic.h in smpboot_64.c and smpboot.c

After the inclusion, a lot of files needs fixing for conflicts,
some of them in the headers themselves, to accomodate for both
i386 and x86_64 versions.

[ mingo@elte.hu: build fix ]

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

We don't need __smp_prepare_cpu anymore.

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

This patch provides minor adjustments for do_boot_cpus
in both architectures to allow for integration

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

We do it to make it close to x86_64. The later needs it,
otherwise the nmi watchdog can get into the scene and kill us
with a hammer.

Enabling irqs here used to trigger a bug in i386. This is because
time irq handling relies upon structures that are only initialized
after smp initcalls (More precisely, it will find
per_cpu(hrtimer_bases, cpu)->cb_pending list not initialized and crash)

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

It splits setup_local_APIC in two, providing a function corresponding
to the ending part of it. As a side effect, smp_callin looks the same
between i386 and x86_64.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: wrap esr setting up in i386 in lapic_setup_esr
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:48 +0000 (14:25 -0300)]
x86: wrap esr setting up in i386 in lapic_setup_esr

it is a little bit more complicated than x86_64 due to erratas and
other stuff, but its existance will ease integration

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: modify smp_callin in x86_64 to look like i386
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:47 +0000 (14:25 -0300)]
x86: modify smp_callin in x86_64 to look like i386

We introduce empty macros just to make them look like the same

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: don't span a new worker in __smp_prepare_cpu
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:46 +0000 (14:25 -0300)]
x86: don't span a new worker in __smp_prepare_cpu

We can do it now that do_boot_cpu has its own worker.

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

Use a new worker, with help of the create_idle struct
to fork the idle thread. We now have two workers, the first
of them triggered by __smp_prepare_cpu. But the later is
going away soon.

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

As we now boot cpus from cpu_up, we don't need it.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: boot cpus from cpu_up, instead of prepare_cpus
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:43 +0000 (14:25 -0300)]
x86: boot cpus from cpu_up, instead of prepare_cpus

After all the infrastructure work, we're now prepared
to boot the cpus from cpu_up, and not from prepare_cpus.
So the difference between cold boot and hotplug is effectively
over, and the functions are used to the purposes they're meant to.

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

It was okay when cpus were cold booted before this point.
But with the new state machine, they will not have arrived to
the trampoline yet. zapping low mappings will have the bad effect
of breaking it completely after paging enablement

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: schedule work only if keventd is already running
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:41 +0000 (14:25 -0300)]
x86: schedule work only if keventd is already running

Only call schedule_work if keventd is already running.
This is already the way x86_64 does

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: don't initialize sibling and core maps during preparation
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:39 +0000 (14:25 -0300)]
x86: don't initialize sibling and core maps during preparation

it is redundant, since it is already done by set_cpu_sibling_map()

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

this does not exist, so it will be an empty macro

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

With this, remove its late_initcall marker from nmi_32.c

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

Two more files goes away. nmi_64.h and nmi_32.h gives birth
to nmi.h

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

use mach_traps when it is supposed to be used.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: don't set maps in native_smp_prepare_boot_cpu()
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:34 +0000 (14:25 -0300)]
x86: don't set maps in native_smp_prepare_boot_cpu()

By this time, they are already set in init routines

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

We move it to apic_32.c, since it's irq related anyway,
and only called from that file.

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

We do it and also fix conflicts, which makes x86_64 automatically
closer to i386

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

Do it and also fix conflicts, which automatically makes
x86_64 look closer to i386

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add subarch support (for headers) to x86_64
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:30 +0000 (14:25 -0300)]
x86: add subarch support (for headers) to x86_64

this patch allows x86_64 to use subarch mach_ headers
in practice, since x86_64 does not have any subarch, it
will use mach_default. But it will allow for substantially
less code duplication

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

the cpu count is changed accordingly: now, what matters is
online cpus.
Also, we add those functions for x86_64

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: do smp tainting checks in a separate function
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:28 +0000 (14:25 -0300)]
x86: do smp tainting checks in a separate function

It will ease integration for x86_64

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

Impressing friends is a very important thing.
Do it in a separate function to make it even more
explicit, and ease integration.

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

weighting a map will do.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fill cpu to apicid and present map in mpparse, fix
Ingo Molnar [Wed, 19 Mar 2008 19:26:15 +0000 (20:26 +0100)]
x86: fill cpu to apicid and present map in mpparse, fix

Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: fill cpu to apicid and present map in mpparse
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:25 +0000 (14:25 -0300)]
x86: fill cpu to apicid and present map in mpparse

This is the way x86_64 does, and complement the already
present patch that does the bios cpu to apicid mapping here

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

We fill the per-cpu (or array) that maps
bios cpu id to apicid in mpparse_32.c, the way x86_64 does

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

We use the same routing as x86_64, moved now to setup.c.
Just with a few ifdefs inside.
Note that this routing uses prefill_possible_map().
It has the very nice side effect of allowing hotplugging of
cpus that are marked as present but disabled by acpi bios.

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

missing a semicolon

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: make node to apic mapping declarations unconditional
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:21 +0000 (14:25 -0300)]
x86: make node to apic mapping declarations unconditional

Instead of declaring them inside of X86_64 ifdef, do it
unconditionally

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

this will serve as a reference as to whether or not to
use the per_cpu variables in mpparse. Done the same way
as x86_64

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

This mapping already exists in x86_64, just provide it for
i386

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

take them off smp_{32,64}.h and move to smp.h

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

Done to match x86_64

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

We have already removed the only condition that could fail here.
so just don't test for any return value

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

Do tests before do_boot_cpu in native_cpu_up for i386.
Tests are a little bit broader than originally, and are the
same as x86_64. Test for smp_callin is not applicable right now
and is deferred.

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

Put it in a disable_smp() function, as x86_64 does

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

Isolate all sanity checking in a smp_sanity_check()
function as x86_64 does.

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

goal is to have i386 and x86_64 closer, so we
add barriers to match

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

This patch does not change the behaviour of x86_64, since APIC_INTEGRATED
is always defined as (1). But the code now matches exactly i386 version
(well, this part of the code, at least)

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

it is always integrated, so define as 1.

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

it does not need to be inside lock. Do the way i386 does.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move setup_secondary_clock a little bit down in the function
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:08 +0000 (14:25 -0300)]
x86: move setup_secondary_clock a little bit down in the function

This is done so we call setup_secondary_clock() in the same place x86_64
does. A separate patch for this is appearantly not needed. But clock
initialization is such a delicate thing, that it's safer to do this way

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: don't call local_irq_enable before entering idle
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:07 +0000 (14:25 -0300)]
x86: don't call local_irq_enable before entering idle

the call to idle is guaranteed to do it.

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

This matches x86_64 behaviour, which is a superior one IMHO

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
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>