Skip to content

acpi,smp: always use APIC ID for CPU identifiers #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions common/acpi.c
Original file line number Diff line number Diff line change
@@ -248,16 +248,15 @@ static int process_madt_entries(void) {
if (!enabled)
break;

cpu_t *cpu = get_cpu(madt_cpu->apic_proc_id)
?: add_cpu(madt_cpu->apic_proc_id, false, enabled);
cpu_t *cpu =
get_cpu(madt_cpu->apic_id) ?: add_cpu(madt_cpu->apic_id, false, enabled);
cpu->flags.enabled = enabled;

percpu_t *percpu = cpu->percpu;
percpu->cpu_id = madt_cpu->apic_proc_id;
percpu->apic_id = madt_cpu->apic_id;
percpu->acpi_id = madt_cpu->apic_proc_id;

printk("ACPI: [MADT] APIC Processor ID: %u, APIC ID: %u, Flags: %08x\n",
cpu->id, percpu->apic_id, madt_cpu->flags);
printk("ACPI: [MADT] ACPI Processor ID: %u, APIC ID: %u, Flags: %08x\n",
percpu->acpi_id, percpu->apic_id, madt_cpu->flags);
break;
}
case ACPI_MADT_TYPE_IOAPIC: {
@@ -475,15 +474,14 @@ static void madt_parser(ACPI_SUBTABLE_HEADER *entry, void *arg) {
if (!enabled)
break;

cpu_t *cpu =
get_cpu(lapic->ProcessorId) ?: add_cpu(lapic->ProcessorId, false, enabled);
cpu_t *cpu = get_cpu(lapic->Id) ?: add_cpu(lapic->Id, false, enabled);
cpu->flags.enabled = enabled;

percpu_t *percpu = cpu->percpu;
percpu->apic_id = lapic->Id;
percpu->acpi_id = lapic->ProcessorId;

printk("ACPI: [MADT] APIC Processor ID: %u, APIC ID: %u, Flags: %08x\n", cpu->id,
percpu->apic_id, lapic->LapicFlags);
printk("ACPI: [MADT] ACPI Processor ID: %u, APIC ID: %u, Flags: %08x\n",
percpu->acpi_id, percpu->apic_id, lapic->LapicFlags);
break;
}
case ACPI_MADT_TYPE_IO_APIC: {
4 changes: 2 additions & 2 deletions common/percpu.c
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ percpu_t *get_percpu_page(unsigned int cpu) {
percpu_t *percpu;

list_for_each_entry (percpu, &percpu_frames, list) {
if (percpu->cpu_id == cpu)
if (percpu->apic_id == cpu)
return percpu;
}

@@ -54,7 +54,7 @@ percpu_t *get_percpu_page(unsigned int cpu) {
BUG_ON(!percpu);
memset(percpu, 0, PAGE_SIZE);

percpu->cpu_id = cpu;
percpu->apic_id = cpu;

list_add(&percpu->list, &percpu_frames);
return percpu;
2 changes: 1 addition & 1 deletion include/percpu.h
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@
struct percpu {
list_head_t list;

unsigned int cpu_id;
uint32_t acpi_id;
uint32_t apic_id;
uint32_t sapic_uid;
uint8_t sapic_id;