GitHub/LineageOS/G12/android_kernel_amlogic_linux-4.9.git
16 years agox86: use get_bios_ebda in mpparse_64.c
Alexey Starikovskiy [Mon, 17 Mar 2008 19:08:17 +0000 (22:08 +0300)]
x86: use get_bios_ebda in mpparse_64.c

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add uniq_ioapic_id to mpparse_32.c
Alexey Starikovskiy [Mon, 17 Mar 2008 19:08:11 +0000 (22:08 +0300)]
x86: add uniq_ioapic_id to mpparse_32.c

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: add bad_ioapic to mpparse_32.c
Alexey Starikovskiy [Mon, 17 Mar 2008 19:08:05 +0000 (22:08 +0300)]
x86: add bad_ioapic to mpparse_32.c

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: lindent mpparse_64.c
Alexey Starikovskiy [Mon, 17 Mar 2008 19:07:59 +0000 (22:07 +0300)]
x86: lindent mpparse_64.c

Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: remove smpboot_32.c and smpboot_64.c
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:26:14 +0000 (14:26 -0300)]
x86: remove smpboot_32.c and smpboot_64.c

Remove the last leftovers from the files. Move the ones
that are still used to the files they belong, the others
that grep can't reach, simply throw away.

Merge comments ontop of file and that's it: smpboot integrated

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

They are i386 specific (the x86_64 definitions live
elsewhere, and should remain there), so are enclosed around
an ifdef

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

this is the last remaining function in smpboot_32.c
Since it is i386 specific, move it around an ifdef to
smpboot.c

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

With the previous changes, code for native_smp_prepare_cpus()
in i386 and x86_64 now look very similar. merge them into
smpboot.c. Minor differences are inside ifdef

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

x86_64 has two nr_ioapics = 0 statements. In 32-bit, it can be done
too. We do it through the smpboot_clear_io_apic() inline function,
to cope with subarchitectures (visws) that does not compile mpparse in

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: change x86_64 sanity checks to match i386.
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:26:09 +0000 (14:26 -0300)]
x86: change x86_64 sanity checks to match i386.

They are mostly inocuous. APIC_INTEGRATED will expand to 1,
check_phys_apicid_present is checking for the same thing it was before,
etc. But the code is identical to i386 now, and will allow us to
integrate it.

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

This test exists in x86_64 and also applies to i386. So we add it

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: change x86_64 native_smp_prepare_cpus to match i386
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:26:07 +0000 (14:26 -0300)]
x86: change x86_64 native_smp_prepare_cpus to match i386

An APIC test is moved, and code is replaced by the mach-default
already defined function (smpboot_setup_io_apic).
setup_portio_remap() is added, but it is a nop in mach-default.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: assign nr_ioapics = 0 in smpboot_hooks.h
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:26:06 +0000 (14:26 -0300)]
x86: assign nr_ioapics = 0 in smpboot_hooks.h

change smpboot_setup_io_apic() by to match x86_64 behaviour

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

Add function calls to native_smp_prepare_cpus in i386
to match x86_64

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

This patch get rid of smp_boot_cpus(), since it does not
boot any cpu anymore. Its code is split in a way to make
it closer to x86_64

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

if smp configuration is not found at all, hook into 0.
This is done to match x86_64

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

They look similar enough, and are merged. Only difference
(zap_low_mapping for i386) is inside ifdef

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

it is practically the same between arches now, so it is
moved to smpboot.c. Minor differences (gdt initialization)
live inside an ifdef

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

It now looks the same between architectures, so we
merge it in smpboot.c. Minor differences goes inside
an ifdef

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

This is a very large patch, because it depends on a lot
of auxiliary static functions. But they all have been modified
to the point that they're sufficiently close now. So they're just
merged in smpboot.c

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

This is to match i386. The former name was cuter,
but the current is more meaningful and more general,
since cpu_id can be a logical id.

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

voyager would conflict with it, but the types are ultimately
compatible. So remove the extern definition from voyager_smp.c
in favour of the common one

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
16 years agox86: move {un}map_cpu_to_logical_apicid to smpboot.c
Glauber de Oliveira Costa [Wed, 19 Mar 2008 17:25:56 +0000 (14:25 -0300)]
x86: move {un}map_cpu_to_logical_apicid to smpboot.c

Move map_cpu_to_logical_apicid() and unmap_cpu_to_logical_apicid()
to smpboot.c. They take together all the bunch of static functions
they rely upon

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