Hi,
cyr1x wrote:Brendan wrote:
[*]You shouldn't broadcast the INIT-SIPI-SIPI sequence, ...
I wonder why Intel do exactly this in their manuals. Are they just lazy or is there something ...?
Or is that code only meant for the BIOS?
AFAIK Intel's example in the Software Developer's Manual is for BIOS developers.
Intel's Multi-processor Specification has "Appendix B - Operating System Programming Guidelines", which doesn't directly state "You must not broadcast", but does have at least one clue (bold highlighting is mine):
Intel MP Spec, B.4 Application Processor Startup wrote:If the MP configuration table does not exist on an MP-compliant system, the system must be of default configuration type. The MP specification requires local APIC IDs to be numbered sequentially, starting at zero for all default configurations. As a result, the BSP can determine the AP’s local APIC ID in default, two-processor configurations by reading its own local APIC ID. Since there are only two possible local APIC IDs in this case, zero and one, when the APIC ID of the BSP is one, the APIC ID of the AP is zero, and vice versa. This is important, because a BSP cannot start up an AP unless it already knows the local APIC ID.
You don't need to know an AP CPU's APIC ID if you broadcast, but Intel says an OS must know an AP CPUs APIC ID...
Of course this document was last updated in 1997, which is several years before Intel introduced hyper-threading.
Owen wrote:Brendan wrote:
- You shouldn't assume the local APIC/s are at 0xFEE00000. It's likely they are, but this isn't guaranteed. Parse the MP specification tables and/or ACPI tables instead.
Any reason not to just read the APIC base MSR?
The APIC base MSR would be fine, except that it's a Model Specific Register. Basically it's not supported on 80486 or Pentium CPUs (and only became an "Architectural MSR" with P6). If you check that the CPU is a P6 or later Intel CPU first then it should be fine. For other CPU manufacturers (especially smaller ones like Cyrix, SiS, VIA, etc) you'll probably crash on any CPU; although maybe that can be avoided by checking the CPUID feature flags (on CPUs that support CPUID).
To be honest, you need to parse the MP Specification tables and/or ACPI tables anyway (to get local APIC IDs), and reading the local APIC base MSR sounds like more hassle than it's worth to me.
Owen wrote:Not that it's relevant to me - I remap all my APICs to a determined section of physical address space (The very top of whatever the processor supports) anyway - though I am assuming that all long mode capable CPUs support doing this.
You remap the local APICs simply because you think you can, or are you trying to make sure that PCI MSI (Message Signalled Interrupts) won't work for 32-bit PCI cards?
Cheers,
Brendan