WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>, Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Subject: RE: [Xen-devel] [PATCH][DOM0] Export apic_id for acpi_processor object
From: "Jiang, Yunhong" <yunhong.jiang@xxxxxxxxx>
Date: Sat, 14 Nov 2009 23:16:57 +0800
Accept-language: en-US
Acceptlanguage: en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Sat, 14 Nov 2009 07:17:26 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <E2263E4A5B2284449EEBD0AAB751098418E55575DC@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <E2263E4A5B2284449EEBD0AAB751098418E55575DC@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcpjrlgGVZ0WbQaTRLy10rhyt5j8HgBjPs5A
Thread-topic: [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

<Prev in Thread] Current Thread [Next in Thread>