From: Alex Hornung Date: Sun, 29 Jul 2012 15:28:00 +0000 (+0000) Subject: mptable - use the table's cpu_flags X-Git-Url: https://gitweb.dragonflybsd.org/~alexh/dragonfly.git/commitdiff_plain/b7fe87d9c44618d094a0afadc408e5466a726604 mptable - use the table's cpu_flags * Sometimes the CPUs are marked as disabled in the APIC table, and for good reason (e.g. a machine having only 24 cores, but 32 appearing in the APIC table, 8 of them disabled). * Just in case, provide an override that falls back to the old behaviour. This is the tunable hw.lapic_force_enable. It will force all lapic entries to be marked as enabled. It is however not the default. * When parsing, don't error out when a lapic id is invalid (255) but it is disabled. Reported-by: Mihai Carabas, Francois Tigeot --- diff --git a/sys/platform/pc32/acpica5/acpi_madt.c b/sys/platform/pc32/acpica5/acpi_madt.c index b7c3097ad4..fa03da7e37 100644 --- a/sys/platform/pc32/acpica5/acpi_madt.c +++ b/sys/platform/pc32/acpica5/acpi_madt.c @@ -393,13 +393,14 @@ madt_lapic_probe_callback(void *xarg, const struct acpi_madt_ent *ent) const struct acpi_madt_lapic *lapic_ent; lapic_ent = (const struct acpi_madt_lapic *)ent; - if (lapic_ent->ml_flags & MADT_LAPIC_ENABLED) + if (lapic_ent->ml_flags & MADT_LAPIC_ENABLED) { arg->cpu_count++; - if (lapic_ent->ml_apic_id == APICID_MAX) { - kprintf("madt_lapic_probe: " - "invalid LAPIC apic id %d\n", - lapic_ent->ml_apic_id); - return EINVAL; + if (lapic_ent->ml_apic_id == APICID_MAX) { + kprintf("madt_lapic_probe: " + "invalid LAPIC apic id %d\n", + lapic_ent->ml_apic_id); + return EINVAL; + } } } else if (ent->me_type == MADT_ENT_LAPIC_ADDR) { const struct acpi_madt_lapic_addr *lapic_addr_ent; diff --git a/sys/platform/pc32/i386/mptable.c b/sys/platform/pc32/i386/mptable.c index 5076266789..745adee444 100644 --- a/sys/platform/pc32/i386/mptable.c +++ b/sys/platform/pc32/i386/mptable.c @@ -77,6 +77,9 @@ extern u_int base_memory; extern int imcr_present; extern int naps; +static int force_enable = 0; +TUNABLE_INT("hw.lapic_force_enable", &force_enable); + #define BIOS_BASE (0xf0000) #define BIOS_BASE2 (0xe0000) #define BIOS_SIZE (0x10000) @@ -701,7 +704,7 @@ mptable_lapic_pass2_callback(void *xarg, const void *pos, int type) */ bzero(&proc, sizeof(proc)); proc.type = 0; - proc.cpu_flags = PROCENTRY_FLAG_EN; + proc.cpu_flags = (force_enable) ? PROCENTRY_FLAG_EN : ent->cpu_flags; proc.apic_id = ent->apic_id; for (i = 1; i < arg->logical_cpus; i++) { diff --git a/sys/platform/pc64/acpica5/acpi_madt.c b/sys/platform/pc64/acpica5/acpi_madt.c index f1a71729a5..5c3d74aaa1 100644 --- a/sys/platform/pc64/acpica5/acpi_madt.c +++ b/sys/platform/pc64/acpica5/acpi_madt.c @@ -393,13 +393,14 @@ madt_lapic_probe_callback(void *xarg, const struct acpi_madt_ent *ent) const struct acpi_madt_lapic *lapic_ent; lapic_ent = (const struct acpi_madt_lapic *)ent; - if (lapic_ent->ml_flags & MADT_LAPIC_ENABLED) + if (lapic_ent->ml_flags & MADT_LAPIC_ENABLED) { arg->cpu_count++; - if (lapic_ent->ml_apic_id == APICID_MAX) { - kprintf("madt_lapic_probe: " - "invalid LAPIC apic id %d\n", - lapic_ent->ml_apic_id); - return EINVAL; + if (lapic_ent->ml_apic_id == APICID_MAX) { + kprintf("madt_lapic_probe: " + "invalid LAPIC apic id %d\n", + lapic_ent->ml_apic_id); + return EINVAL; + } } } else if (ent->me_type == MADT_ENT_LAPIC_ADDR) { const struct acpi_madt_lapic_addr *lapic_addr_ent; diff --git a/sys/platform/pc64/x86_64/mptable.c b/sys/platform/pc64/x86_64/mptable.c index 92eb052709..088bee6596 100644 --- a/sys/platform/pc64/x86_64/mptable.c +++ b/sys/platform/pc64/x86_64/mptable.c @@ -77,6 +77,9 @@ extern u_long ebda_addr; extern int imcr_present; extern int naps; +static int force_enable = 0; +TUNABLE_INT("hw.lapic_force_enable", &force_enable); + #define BIOS_BASE (0xf0000) #define BIOS_BASE2 (0xe0000) #define BIOS_SIZE (0x10000) @@ -702,7 +705,7 @@ mptable_lapic_pass2_callback(void *xarg, const void *pos, int type) */ bzero(&proc, sizeof(proc)); proc.type = 0; - proc.cpu_flags = PROCENTRY_FLAG_EN; + proc.cpu_flags = (force_enable) ? PROCENTRY_FLAG_EN : ent->cpu_flags; proc.apic_id = ent->apic_id; for (i = 1; i < arg->logical_cpus; i++) {