qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 16/17] accel: Save AccelState on MachineState


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH v2 16/17] accel: Save AccelState on MachineState when initializing
Date: Fri, 26 Sep 2014 17:11:15 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1

Il 29/08/2014 22:31, Eduardo Habkost ha scritto:
> This will allow machine initialization code to get the accelerator
> object if necessary.
> 
> Signed-off-by: Eduardo Habkost <address@hidden>
> ---
>  hw/core/accel.c         | 3 +++
>  include/hw/boards.h     | 1 +
>  include/qemu/typedefs.h | 2 ++
>  3 files changed, 6 insertions(+)
> 
> diff --git a/hw/core/accel.c b/hw/core/accel.c
> index 66ee1fa..2e1ea76 100644
> --- a/hw/core/accel.c
> +++ b/hw/core/accel.c
> @@ -32,6 +32,7 @@
>  #include "sysemu/qtest.h"
>  #include "hw/xen/xen.h"
>  #include "qom/object.h"
> +#include "hw/boards.h"
>  
>  int tcg_tb_size;
>  static bool tcg_allowed = true;
> @@ -64,9 +65,11 @@ static int accel_init_machine(AccelClass *acc, 
> MachineState *ms)
>      const char *cname = object_class_get_name(oc);
>      AccelState *accel = ACCEL(object_new(cname));
>      int ret;
> +    ms->accelerator = accel;
>      *(acc->allowed) = true;
>      ret = acc->init_machine(ms);
>      if (ret < 0) {
> +        ms->accelerator = NULL;
>          *(acc->allowed) = false;
>          object_unref(OBJECT(accel));
>      }
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 605a970..1cff2b4 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -132,6 +132,7 @@ struct MachineState {
>      char *kernel_cmdline;
>      char *initrd_filename;
>      const char *cpu_model;
> +    AccelState *accelerator;
>  };
>  
>  #endif
> diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
> index 04df51b..446af93 100644
> --- a/include/qemu/typedefs.h
> +++ b/include/qemu/typedefs.h
> @@ -30,6 +30,8 @@ typedef struct MemoryListener MemoryListener;
>  
>  typedef struct MemoryMappingList MemoryMappingList;
>  
> +typedef struct AccelState AccelState;
> +
>  typedef struct QEMUMachine QEMUMachine;
>  typedef struct MachineClass MachineClass;
>  typedef struct MachineState MachineState;
> 

I would just squash this with the previous patch.  Apart from this,

Reviewed-by: Paolo Bonzini <address@hidden>

Paolo



reply via email to

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