[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from
From: |
Igor Mammedov |
Subject: |
Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn() |
Date: |
Tue, 14 Jan 2014 11:40:03 +0100 |
On Tue, 14 Jan 2014 17:27:20 +0800
Chen Fan <address@hidden> wrote:
> the intend of this patch is to register cpu vmstates with apic id instead of
> cpu
> index, due to the property setting of apic_id is behind the cpu
> initialization. so
> we move the registers of cpu vmstate from cpu_exec_init() to
> x86_cpu_realizefn() to
> let the set apicid as the parameter.
>
> Signed-off-by: Chen Fan <address@hidden>
> ---
> exec.c | 5 +++++
> target-i386/cpu.c | 9 +++++++++
> 2 files changed, 14 insertions(+)
>
> diff --git a/exec.c b/exec.c
> index 7e49e8e..9be5855 100644
> --- a/exec.c
> +++ b/exec.c
> @@ -438,7 +438,9 @@ CPUState *qemu_get_cpu(int index)
> void cpu_exec_init(CPUArchState *env)
> {
> CPUState *cpu = ENV_GET_CPU(env);
> +#if !defined(TARGET_I386)
> CPUClass *cc = CPU_GET_CLASS(cpu);
> +#endif
> CPUState *some_cpu;
> int cpu_index;
>
> @@ -460,6 +462,8 @@ void cpu_exec_init(CPUArchState *env)
> #if defined(CONFIG_USER_ONLY)
> cpu_list_unlock();
> #endif
> +
> +#if !defined(TARGET_I386)
> if (qdev_get_vmsd(DEVICE(cpu)) == NULL) {
> vmstate_register(NULL, cpu_index, &vmstate_cpu_common, cpu);
> }
> @@ -472,6 +476,7 @@ void cpu_exec_init(CPUArchState *env)
> if (cc->vmsd != NULL) {
> vmstate_register(NULL, cpu_index, cc->vmsd, cpu);
> }
> +#endif /* !TARGET_I386 */
> }
>
> #if defined(TARGET_HAS_ICE)
> diff --git a/target-i386/cpu.c b/target-i386/cpu.c
> index 967529a..dada6f6 100644
> --- a/target-i386/cpu.c
> +++ b/target-i386/cpu.c
> @@ -2552,6 +2552,7 @@ static void x86_cpu_apic_realize(X86CPU *cpu, Error
> **errp)
> static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
> {
> CPUState *cs = CPU(dev);
> + CPUClass *cc = CPU_GET_CLASS(cs);
> X86CPU *cpu = X86_CPU(dev);
> X86CPUClass *xcc = X86_CPU_GET_CLASS(dev);
> CPUX86State *env = &cpu->env;
> @@ -2615,6 +2616,14 @@ static void x86_cpu_realizefn(DeviceState *dev, Error
> **errp)
> cpu_reset(cs);
>
> xcc->parent_realize(dev, &local_err);
> +
> + if (qdev_get_vmsd(DEVICE(cs)) == NULL) {
> + vmstate_register(NULL, env->cpuid_apic_id, &vmstate_cpu_common, cs);
> + }
> +
> + if (cc->vmsd != NULL) {
> + vmstate_register(NULL, env->cpuid_apic_id, cc->vmsd, cs);
> + }
how about doing it in common CPUclass.realize()
you can use get_arch_id() for getting CPU id, it returns cpu_index by default
and apic_id for target-i386.
Pls note that changing vmstate id should be done only for new machine types
so not to break old qemu -> new qemu migration.
> out:
> if (local_err != NULL) {
> error_propagate(errp, local_err);
- [Qemu-devel] [RFC 0/3] fix migration issues after hotplug a discontinuous cpuid, Chen Fan, 2014/01/14
- [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn(), Chen Fan, 2014/01/14
- Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn(),
Igor Mammedov <=
- Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn(), Chen Fan, 2014/01/15
- Re: [Qemu-devel] [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn(), Igor Mammedov, 2014/01/15
- [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()), Eduardo Habkost, 2014/01/17
- Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()), Igor Mammedov, 2014/01/20
- Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()), Chen Fan, 2014/01/21
- Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()), Igor Mammedov, 2014/01/21
- Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()), Chen Fan, 2014/01/21
- Re: [Qemu-devel] Exposing and calculating CPU APIC IDs (was Re: [RFC 1/3] target-i386: moving registers of vmstate from cpu_exec_init() to x86_cpu_realizefn()), Andreas Färber, 2014/01/21
[Qemu-devel] [RFC 3/3] target-i386: add qmp command 'query-cpus' to display apic_id, Chen Fan, 2014/01/14
[Qemu-devel] [RFC 2/3] target-i386: add -smp X,apics=0x option, Chen Fan, 2014/01/14