History log of /haiku/src/system/kernel/arch/x86/arch_smp.cpp
Revision Date Author Comments
# 46b84791 28-Sep-2023 Puck Meerburg <puck@puckipedia.com>

arch/x86: Fix sending ICIs to more than one cluster, send one at a time.

The structure of a logical APIC destination is made up of a 16-bit
bitfield of cluster-local IDs, as well as a 16-bit cluster ID. When
sending an ICI to multiple cores in different clusters, these cannot simply be ORed together.
Fixes #17233

Change-Id: Ifa84da51eccd85c1eff529749ffa00bc2159899e
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6919
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Reviewed-by: Jérôme Duval <jerome.duval@gmail.com>


# 8cf8e537 05-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86: Inline atomic functions and memory barriers


# 9a6868d5 26-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Fix build with kernel debugging disabled


# e3d001ff 19-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Implement multicast ICIs


# bcfdf881 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

apps, kernel: Remove B_MAX_CPU_COUNT


# e6ea745e 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# d897a478 17-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Allow reassigning IRQs to logical processors


# 6a164daa 17-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Track load produced by interrupt handlers


# 78777340 26-Aug-2013 Jérôme Duval <jerome.duval@gmail.com>

Added x2APIC support.

* Mostly useful for virtualization at the moment. Works in QEmu.
* Can be enabled by safemode settings/menu.
* Please note that x2APIC normally requires use of VT-d interrupt remapping feature
on real hardware, which we don't support yet.


# 76a1175d 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.


# 5e9bb17d 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Renamed remaining i386_* functions to x86_* for consistency.


# c1cd48b7 21-Feb-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: Fix fpu on non-apic systems

* If apic is not present, the smp code never gets called
to set up the fpu.
* Detect lack of apic, and set up fpu in arch_cpu.
* Should fix #8346 and #8348


# 3f1eed70 14-Feb-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: x86 SSE improvements

* Prepend x86_ to non-static x86 code
* Add x86_init_fpu function to kernel header
* Don't init fpu multiple times on smp systems
* Verified fpu is still started on smp and non-smp
* SSE code still generates general protection faults
on smp systems though


# 8dd1e875 20-Jan-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: Fix FPU SSE + MMX instruction usage.

* Rename init_sse to init_fpu and handle FPU setup.
* Stop trying to set up FPU before VM init.
We tried to set up the FPU before VM init, then
set it up again after VM init with SSE extensions,
this caused SSE and MMX applications to crash.
* Be more logical in FPU setup by detecting CPU flag prior
to enabling FPU. (it's unlikely Haiku will run on
a processor without a fpu... but lets be consistant)
* SSE2 gcc code now runs (faster even) without GPF
* tqh confirms his previously crashing mmx code now works
* The non-SSE FPU enable after VM init needs tested!


# fc2d7cb0 12-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

* Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically
be used to mark certain io interrupt vectors as reserved and to allocate from
the still free ones. It is a kernel private API for now though.
* Make the MSI code use that functionality instead of implementing its own which
slims it down considerably and also removes quite a bit of hardcoded knowledge
about the interrupt layout that didn't really belong there.
* Mark the various in-use interrupts as reserved from the components that
actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9623c482 11-Jun-2010 Travis Geiselbrecht <geist@foobox.com>

SMP: remove the tracking of apic id -> cpu id. Don't pass between bootloader and kernel.

Kernel doesn't use it, and it could be regenerated in the kernel if it did need it.

This also unlocks the apic range the bios can use. Previously the apic ids would have
to fit within 0..MAX_CPUS or it'd reject the cpu. Some boxes (mine in particular)
seem to sparsely populate the apic id so that the range is pretty large.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37108 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 33fbe254 13-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
in the assumption of apic local interrupt, MSI or IPI. This also removes
the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
calls in the SMP and timer code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36221 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 655f3b41 11-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Seperate the generic (local) APIC stuff into it's own file and use it from the
other places where previously the same functionality was duplicated. Also
seperated the header which was originally arch_smp.h into apic.h and arch_smp.h
again as some of it is MP and not actually APIC.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36182 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 08876f2b 03-Mar-2010 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Move the code which checks for disabled apic earlier (in the boot loader).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35741 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e50cf876 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd185b41 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

*.c -> *.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34417 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 8cf8e537740789b1b103f0aa0736dbfcf55359c2 05-Jan-2014 Pawel Dziepak <pdziepak@quarnos.org>

kernel/x86: Inline atomic functions and memory barriers


# 9a6868d5657e17b8d57896888f5198c5ab6c4bd4 26-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Fix build with kernel debugging disabled


# e3d001ff02e087a2392c2c46a7ac2d78d3bc12f6 19-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

x86: Implement multicast ICIs


# bcfdf88186a46a982b684c89dc76b4f6c3d53bf4 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

apps, kernel: Remove B_MAX_CPU_COUNT


# e6ea745e8114d5fa05ab0ccab92c070e2dcdcfb7 06-Dec-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Use SMP_MAX_CPUS instead of B_MAX_CPU_COUNT


# d897a478d7c01054aad29b23f7f545073c797530 17-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Allow reassigning IRQs to logical processors


# 6a164daad43169daf0a407fb1f6b0484671ff466 17-Nov-2013 Pawel Dziepak <pdziepak@quarnos.org>

kernel: Track load produced by interrupt handlers


# 787773400ce9ee4ce71d9255e1be8fac66584615 26-Aug-2013 Jérôme Duval <jerome.duval@gmail.com>

Added x2APIC support.

* Mostly useful for virtualization at the moment. Works in QEmu.
* Can be enabled by safemode settings/menu.
* Please note that x2APIC normally requires use of VT-d interrupt remapping feature
on real hardware, which we don't support yet.


# 76a1175dbe1a314563ca18c0b7fb82695a9730cd 11-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Support for SMP on x86_64.

No major changes to the kernel: just compiled in arch_smp.cpp and fixed the
IDT load in arch_cpu_init_percpu to use the correct limit for x86_64 (uses
sizeof(interrupt_descriptor)). In the boot loader, changed smp_boot_other_cpus
to construct a temporary GDT and get the page directory address from CR3, as
what's in kernel_args will be 64-bit stuff and will not work to switch the
CPUs into 32-bit mode in the trampoline code. Refactored 64-bit kernel entry
code to not use the stack after disabling paging, as the secondary CPUs are
given a 32-bit virtual stack address by the SMP trampoline code which will
no longer work.


# 5e9bb17da7b9cdd76ff9072486fab90688cf8c36 08-Jul-2012 Alex Smith <alex@alex-smith.me.uk>

Renamed remaining i386_* functions to x86_* for consistency.


# c1cd48b72f6be4828edf9a25ed306f354e99dcd0 21-Feb-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: Fix fpu on non-apic systems

* If apic is not present, the smp code never gets called
to set up the fpu.
* Detect lack of apic, and set up fpu in arch_cpu.
* Should fix #8346 and #8348


# 3f1eed704a8c799a40cc005bf4cb904463148d79 14-Feb-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: x86 SSE improvements

* Prepend x86_ to non-static x86 code
* Add x86_init_fpu function to kernel header
* Don't init fpu multiple times on smp systems
* Verified fpu is still started on smp and non-smp
* SSE code still generates general protection faults
on smp systems though


# 8dd1e875c1d3735627166c6639078ae4419e7918 20-Jan-2012 Alexander von Gluck IV <kallisti5@unixzen.com>

kernel: Fix FPU SSE + MMX instruction usage.

* Rename init_sse to init_fpu and handle FPU setup.
* Stop trying to set up FPU before VM init.
We tried to set up the FPU before VM init, then
set it up again after VM init with SSE extensions,
this caused SSE and MMX applications to crash.
* Be more logical in FPU setup by detecting CPU flag prior
to enabling FPU. (it's unlikely Haiku will run on
a processor without a fpu... but lets be consistant)
* SSE2 gcc code now runs (faster even) without GPF
* tqh confirms his previously crashing mmx code now works
* The non-SSE FPU enable after VM init needs tested!


# fc2d7cb04d7ad78424169fd0df4d236de2bb17d1 12-Oct-2011 Michael Lotz <mmlr@mlotz.ch>

* Introduce {reserve|allocate|free}_io_interrupt_vectors() that can generically
be used to mark certain io interrupt vectors as reserved and to allocate from
the still free ones. It is a kernel private API for now though.
* Make the MSI code use that functionality instead of implementing its own which
slims it down considerably and also removes quite a bit of hardcoded knowledge
about the interrupt layout that didn't really belong there.
* Mark the various in-use interrupts as reserved from the components that
actually know about them (PIC, IO-APIC, SMP, APIC timer and interrupt setup).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42832 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 9623c48284a184ff5ef9de6d614a1525ffa79e77 11-Jun-2010 Travis Geiselbrecht <geist@foobox.com>

SMP: remove the tracking of apic id -> cpu id. Don't pass between bootloader and kernel.

Kernel doesn't use it, and it could be regenerated in the kernel if it did need it.

This also unlocks the apic range the bios can use. Previously the apic ids would have
to fit within 0..MAX_CPUS or it'd reject the cpu. Some boxes (mine in particular)
seem to sparsely populate the apic id so that the range is pretty large.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37108 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 33fbe254964dff2c8b8a3e1522bbefff14d51ea1 13-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

* Add code to allocate and free interrupt vectors for message signaled
interrupts (MSI).
* Add the remaining IDT entries and redirection functions in the interrupt code.
* Make the PIC end_of_interrupt() return a result to indicate whether the vector
was handled by this PIC. If it isn't we now issue a apic_end_of_interrupt()
in the assumption of apic local interrupt, MSI or IPI. This also removes
the need for the gUsingIOAPIC global and doing manual apic_end_of_interrupt()
calls in the SMP and timer code.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36221 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 655f3b4161bbc8874ffae4afa337317c9a1d26f1 11-Apr-2010 Michael Lotz <mmlr@mlotz.ch>

Seperate the generic (local) APIC stuff into it's own file and use it from the
other places where previously the same functionality was duplicated. Also
seperated the header which was originally arch_smp.h into apic.h and arch_smp.h
again as some of it is MP and not actually APIC.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36182 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 08876f2b9668da3140c7f868c47a5d599337d6c1 03-Mar-2010 Stefano Ceccherini <stefano.ceccherini@gmail.com>

Move the code which checks for disabled apic earlier (in the boot loader).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35741 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e50cf8765be50a7454c9488db38b638cf90805af 02-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved the VM headers into subdirectory vm/.
* Renamed vm_cache.h/vm_address_space.h to VMCache.h/VMAddressSpace.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34449 a95241bf-73f2-0310-859d-f6bbb57e9c96


# bd185b4117e06c1674c4d214abc3917acedc560d 01-Dec-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

*.c -> *.cpp


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34417 a95241bf-73f2-0310-859d-f6bbb57e9c96