grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Handling multiple cores by GRUB


From: Brendan Trotter
Subject: Re: Handling multiple cores by GRUB
Date: Tue, 13 Oct 2009 10:06:59 +1030

Hi,

On Mon, Oct 12, 2009 at 10:51 PM, Swapnil Pimpale
<address@hidden> wrote:
> Actually we are doing an academic project in which we need to have two cores
> of Intel Core 2 Duo, running inside the GRUB simultaneously. For that we
> need to send an IPI from primary core to the secondary core.  Can you
> suggest any pointers to implement this? Has someone done anything similar to
> this before?

Is there any sane reason for this? None of GRUB's code is designed for
multiple CPUs, and I'd assume that no firmware is designed to handle
multiple CPUs either (I know that "PC BIOS" isn't), and I expect that
if you wasted your time and got multiple CPUs running inside GRUB then
one of the CPUs would do everything while any extra CPU/s would do
nothing (until an OS is started and you need to shut down the "do
nothing" CPU/s).

The method for starting extra CPUs (for 80x86 only) is:
- find the ACPI "APIC" table and get the address of the local APIC and
the APIC ID for the CPU/s you want to start
- if there's no ACPI, use the "Multi-Processor Specification" tables
to find the address of the local APIC and the APIC ID for the CPU/s
you want to start (you shouldn't need to do this on modern systems)
- get the local APIC version (from either ACPI, MP spec or directly
from the BSP's local APIC) and determine what type of APIC it is
- (for "xAPIC" only) send an INIT IPI
- (for "xAPIC" only) wait 10 ms
- (for "xAPIC" only) send a SIPI IPI
- (for "xAPIC" only) wait for up to 200 us for the other CPU to set a
"I started" flag
- (for "xAPIC" only) if the "I started" flag wasn't set in time, send
another SIPI IPI
- (for "xAPIC" only) if the "I started" flag wasn't set in time, wait
for a while (at least 200 s, but typically several seconds for the
other CPU to set a "I started" flag

The SIPI IPI includes the address that you want the other CPU to start
executing. This needs to be on a page boundary and must be below
0x00100000. The other CPU will start in real mode, and one of the
first things it should do is set some sort of "I started" flag (to
tell the first CPU that it can stop waiting and that there hasn't been
some sort of "CPU failed to start" error).

For different types of local APIC there's variations, but you probably
don't need to care about the old 82489DX local APICs (only used on
80486 and early Pentium); and the new "x2APIC" is compatible with the
"xAPIC" (unless there's a very large number of CPUs present and the
APIC ID for the CPU/s you want to start is above 0x000000FF).

For reference materials, see Intel's System Programming Guide, Intel's
Multi-Processor Specification (even if you're using ACPI), the ACPI
specification, and generic OS development resources (e.g.
http://www.osdev.org/, the #osdev IRC channel, etc).


Cheers,

Brendan




reply via email to

[Prev in Thread] Current Thread [Next in Thread]