Skip to content

Commit

Permalink
x64: Parse X2APIC CPU definitions in MADT table
Browse files Browse the repository at this point in the history
OSv was failing to boot because it only handles the old-style 8-bit
definitions. Fix it to handle the new (ACPI 4.0; 2009) ones too.

Also add the same fallback that parse_mp_table() has, to register CPU#0
if all else fails.

Signed-off-by: David Woodhouse <dwmw2@infradead.org>
  • Loading branch information
dwmw2 authored and wkozaczuk committed Nov 21, 2020
1 parent 7d1a4f1 commit ad36240
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions arch/x64/smp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,22 @@ void parse_madt()
register_cpu(nr_cpus++, lapic->Id, lapic->ProcessorId);
break;
}
case ACPI_MADT_TYPE_LOCAL_X2APIC: {
auto x2apic = get_parent_from_member(s, &ACPI_MADT_LOCAL_X2APIC::Header);
if (!(x2apic->LapicFlags & ACPI_MADT_ENABLED)) {
break;
}
register_cpu(nr_cpus++, x2apic->LocalApicId, x2apic->Uid);
break;
}
default:
break;
}
subtable += s->Length;
}
if (!nr_cpus) { // No MP table was found or no cpu was found in there -> assume uni-processor
register_cpu(nr_cpus++, 0);
}
debug(fmt("%d CPUs detected\n") % nr_cpus);
}

Expand Down

0 comments on commit ad36240

Please sign in to comment.