qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset it


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH 4/5] qom-cpu: during cpu reset, it will reset its child
Date: Tue, 10 Jul 2012 10:41:59 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0

Il 10/07/2012 08:16, Liu Ping Fan ha scritto:
> This will give the embeded logic module, such as apic has the
> opportunity to reset.
> 
> Signed-off-by: Liu Ping Fan <address@hidden>
> ---
>  qom/cpu.c |   16 ++++++++++++++++
>  1 files changed, 16 insertions(+), 0 deletions(-)
> 
> diff --git a/qom/cpu.c b/qom/cpu.c
> index 5b36046..6aea8e6 100644
> --- a/qom/cpu.c
> +++ b/qom/cpu.c
> @@ -20,10 +20,26 @@
>  
>  #include "qemu/cpu.h"
>  #include "qemu-common.h"
> +#include "hw/qdev.h"
> +
> +static int cpu_reset_kid(Object *child, void *opaque)
> +{
> +    if (object_is_type_str(child, TYPE_DEVICE)) {
> +        device_reset(DEVICE(child));
> +    } else if (object_is_type_str(child, TYPE_BUS)) {
> +        bus_reset(BUS(child));
> +    } else {
> +        printf("cpu's child must be DEVICE or BUS");
> +        abort();
> +    }
> +    return 0;
> +}
>  
>  void cpu_reset(CPUState *cpu)
>  {
>      CPUClass *klass = CPU_GET_CLASS(cpu);
> +    Object *obj = OBJECT(cpu);
> +    object_child_foreach(obj, cpu_reset_kid, NULL);

Ok, now I see what you want to do.  Next time, please add meaningful
commit messages to all patches in the series, even those that only add
infrastructure.

It really looks like time is ripe to make CPUs children of Device, so
you can just use qdev_reset_all to reset the CPU.

Paolo

>      if (klass->reset != NULL) {
>          (*klass->reset)(cpu);
> 





reply via email to

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