qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 07/21] cpu: introduce get_arch_id() method and o


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH 07/21] cpu: introduce get_arch_id() method and override it for target-i386
Date: Wed, 24 Apr 2013 19:51:35 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Am 23.04.2013 10:29, schrieb Igor Mammedov:
> get_arch_id() adds possibility for generic code to get guest visible
> CPU ID without accessing CPUArchState. If target doesn't override it,
> it will return cpu_index.
> 
> Override it on target-i386 to return APIC ID.
> 
> Signed-off-by: Igor Mammedov <address@hidden>
> Reviewed-by: Eduardo Habkost <address@hidden>
> Reviewed-by: liguang <address@hidden>
> Acked-by: Michael S. Tsirkin <address@hidden>
> ---
>  * it will be used later by new cpu_exists() generic function and
>    acpi_piix.
>  * s/cpu_firmware_id/cpu_arch_id/
> ---
>  include/qom/cpu.h |    2 ++
>  qom/cpu.c         |    6 ++++++
>  target-i386/cpu.c |   10 ++++++++++
>  3 files changed, 18 insertions(+), 0 deletions(-)

Thanks, applied to qom-cpu (with two minor changes below and rewording
wrt target vs. QOM class):

https://github.com/afaerber/qemu-cpu/commits/qom-cpu

> 
> diff --git a/include/qom/cpu.h b/include/qom/cpu.h
> index d6a0e80..639b436 100644
> --- a/include/qom/cpu.h
> +++ b/include/qom/cpu.h
> @@ -45,6 +45,7 @@ typedef struct CPUState CPUState;
>   * instantiatable CPU type.
>   * @reset: Callback to reset the #CPUState to its initial state.
>   * @do_interrupt: Callback for interrupt handling.
> + * @get_arch_id: Callback for getting architecture depended CPU ID

"dependent"

>   * @vmsd: State description for migration.
>   *
>   * Represents a CPU family or model.
[...]
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index e2302d8..a415fa3 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2272,6 +2272,14 @@ static void x86_cpu_initfn(Object *obj)
>      }
>  }
>  
> +static int64_t x86_cpu_get_arch_id(CPUState *cpu)
> +{
> +    X86CPU *x86cpu = X86_CPU(cpu);
> +    CPUX86State *env = &x86cpu->env;
> +
> +    return env->cpuid_apic_id;
> +}
> +
>  static void x86_cpu_common_class_init(ObjectClass *oc, void *data)
>  {
>      X86CPUClass *xcc = X86_CPU_CLASS(oc);
[snip]

To stay consistent in our X86CPU naming conventions:

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index a415fa3..f34ba23 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -2272,10 +2272,10 @@ static void x86_cpu_initfn(Object *obj)
     }
 }

-static int64_t x86_cpu_get_arch_id(CPUState *cpu)
+static int64_t x86_cpu_get_arch_id(CPUState *cs)
 {
-    X86CPU *x86cpu = X86_CPU(cpu);
-    CPUX86State *env = &x86cpu->env;
+    X86CPU *cpu = X86_CPU(cs);
+    CPUX86State *env = &cpu->env;

     return env->cpuid_apic_id;
 }

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg



reply via email to

[Prev in Thread] Current Thread [Next in Thread]