Skip to content

Commit

Permalink
acpi,smp: always use APIC ID for CPU identifiers
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Nov 24, 2023
1 parent 5078fc7 commit df83537
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
20 changes: 9 additions & 11 deletions common/acpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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: {
Expand Down
4 changes: 2 additions & 2 deletions common/percpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion include/percpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit df83537

Please sign in to comment.