[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] [PATCH][DOM0] Export apic_id for acpi_processor object



After checking, the get_apci_id is mainly map_mat_entry(), the  call to 
map_madt_entry()  is something questinable.

For the map_madt_entry(), we have two choice: either export the map_mat_entry() 
in drivers/acpi/processor_core.c, or implement it in 
driver/xen/acpi_processor.c also.

I noticed this same logic (i.e. the map_mat_entry() in 
drivers/acpi/processor_core.c)  has been duplicated in 
arch/x86/kernel/acpi/boot.c already as followed, so any idea from your side?

In arch/x86/kernel/acpi/boot.c
static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
{
    struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
    union acpi_object *obj;
    struct acpi_madt_local_apic *lapic;
    cpumask_var_t tmp_map, new_map;
    u8 physid;
    int cpu;
    int retval = -ENOMEM;

    if (ACPI_FAILURE(acpi_evaluate_object(handle, "_MAT", NULL, &buffer)))
        return -EINVAL;

    if (!buffer.length || !buffer.pointer)
        return -EINVAL;

    obj = buffer.pointer;
    if (obj->type != ACPI_TYPE_BUFFER ||
        obj->buffer.length < sizeof(*lapic)) {
        kfree(buffer.pointer);
        return -EINVAL;
    }

    lapic = (struct acpi_madt_local_apic *)obj->buffer.pointer;

    if (lapic->header.type != ACPI_MADT_TYPE_LOCAL_APIC ||
        !(lapic->lapic_flags & ACPI_MADT_ENABLED)) {
        kfree(buffer.pointer);
        return -EINVAL;
    }

    physid = lapic->id;

--jyh


xen-devel-bounces@xxxxxxxxxxxxxxxxxxx wrote:
> Change the acpi code to export apic_id for the acpi_processor object
> 
> From: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
> 
> Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
> 
> 
> ---
> 
> drivers/acpi/processor_core.c |   16 ++++++++++++++++
> include/linux/acpi.h          |    1 +
> 2 files changed, 17 insertions(+), 0 deletions(-)
> 
> 
> diff --git a/drivers/acpi/processor_core.c
> b/drivers/acpi/processor_core.c
> index 98010d5..a448ba6 100644
> --- a/drivers/acpi/processor_core.c
> +++ b/drivers/acpi/processor_core.c
> @@ -411,6 +411,11 @@ static int
> acpi_processor_remove_fs(struct acpi_device *device)
> 
> #ifndef CONFIG_SMP
> static int get_cpu_id(acpi_handle handle, int type, u32
> acpi_id) { return -1; }
> +int get_apic_id(acpi_handle handle, int type, u32 acpi_id) +{
> +     return -1;
> +}
> +EXPORT_SYMBOL_GPL(get_apic_id);
> #else
> 
> static struct acpi_table_madt *madt;
> @@ -561,6 +566,17 @@ static int get_cpu_id(acpi_handle handle,
> int type, u32 acpi_id)
>       }
>       return -1;
> }
> +
> +int get_apic_id(acpi_handle handle, int type, u32 acpi_id) +{
> +     int apic_id = -1;
> +
> +     apic_id = map_mat_entry(handle, type, acpi_id);
> +     if (apic_id == -1)
> +             apic_id = map_madt_entry(type, acpi_id);
> +     return apic_id;
> +}
> +EXPORT_SYMBOL_GPL(get_apic_id);
> #endif
> 
> /*
> ---------------------------------------------------------------
> -----------
> diff --git a/include/linux/acpi.h b/include/linux/acpi.h
> index 34321cf..e414fcc 100644
> --- a/include/linux/acpi.h
> +++ b/include/linux/acpi.h
> @@ -85,6 +85,7 @@ int acpi_boot_init (void);
> int acpi_boot_table_init (void);
> int acpi_mps_check (void);
> int acpi_numa_init (void);
> +int get_apic_id(acpi_handle handle, int type, u32 acpi_id);
> 
> int acpi_table_init (void);
> int acpi_table_parse (char *id, acpi_table_handler handler);
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.