lkml.org 
[lkml]   [2012]   [Jan]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 47/50] ACPI: processor: fix acpi_get_cpuid for UP processor
    Date
    From: Lin Ming <ming.m.lin@intel.com>

    For UP processor, it is likely that no _MAT method or MADT table defined.
    So currently acpi_get_cpuid(...) always return -1 for UP processor.
    This is wrong. It should return valid value for CPU0.

    In the other hand, BIOS may define multiple CPU handles even for UP
    processor, for example

    Scope (_PR)
    {
    Processor (CPU0, 0x00, 0x00000410, 0x06) {}
    Processor (CPU1, 0x01, 0x00000410, 0x06) {}
    Processor (CPU2, 0x02, 0x00000410, 0x06) {}
    Processor (CPU3, 0x03, 0x00000410, 0x06) {}
    }

    We should only return valid value for CPU0's acpi handle.
    And return invalid value for others.

    http://marc.info/?t=132329819900003&r=1&w=2

    Cc: stable@vger.kernel.org
    Reported-and-tested-by: wallak@free.fr
    Signed-off-by: Lin Ming <ming.m.lin@intel.com>
    Signed-off-by: Len Brown <len.brown@intel.com>
    ---
    drivers/acpi/processor_core.c | 26 ++++++++++++++++++++++++--
    1 files changed, 24 insertions(+), 2 deletions(-)

    diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c
    index 3a0428e..c850de4 100644
    --- a/drivers/acpi/processor_core.c
    +++ b/drivers/acpi/processor_core.c
    @@ -173,8 +173,30 @@ int acpi_get_cpuid(acpi_handle handle, int type, u32 acpi_id)
    apic_id = map_mat_entry(handle, type, acpi_id);
    if (apic_id == -1)
    apic_id = map_madt_entry(type, acpi_id);
    - if (apic_id == -1)
    - return apic_id;
    + if (apic_id == -1) {
    + /*
    + * On UP processor, there is no _MAT or MADT table.
    + * So above apic_id is always set to -1.
    + *
    + * BIOS may define multiple CPU handles even for UP processor.
    + * For example,
    + *
    + * Scope (_PR)
    + * {
    + * Processor (CPU0, 0x00, 0x00000410, 0x06) {}
    + * Processor (CPU1, 0x01, 0x00000410, 0x06) {}
    + * Processor (CPU2, 0x02, 0x00000410, 0x06) {}
    + * Processor (CPU3, 0x03, 0x00000410, 0x06) {}
    + * }
    + *
    + * Ignores apic_id and always return 0 for CPU0's handle.
    + * Return -1 for other CPU's handle.
    + */
    + if (acpi_id == 0)
    + return acpi_id;
    + else
    + return apic_id;
    + }

    #ifdef CONFIG_SMP
    for_each_possible_cpu(i) {
    --
    1.7.9.rc1


    \
     
     \ /
      Last update: 2012-01-17 14:25    [W:2.624 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site