Am 07.06.2013 19:28, schrieb Jason J. Herne:
> From: "Jason J. Herne" <jjhe...@us.ibm.com>
> 
> In preparation for treating cpus as devices

CPUs *are* devices since multiple releases now, so this is badly put.

> we need to separate machine
> initialization into two stages:
> 1. Initialization that needs to be done before cpu devices can be created.
> 2. Initialization that requires cpu devices to already be created.
> 
> This is accomplished by creating an optional post-cpu initialization function
> for QEMUMachine.

Whatever you are using it for, this sounds wrong to me.

Machine init is supposed to use less code and more QOM infrastructure,
with a future goal of replacing most code with a config file
instantiating and wiring up devices.

And please don't forget to CC me on the next CPU series.

Regards,
Andreas

> 
> Signed-off-by: Jason J. Herne <jjhe...@us.ibm.com>
> ---
>  include/hw/boards.h |    3 ++-
>  vl.c                |    4 ++++
>  2 files changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index fb7c6f1..ed427a1 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -19,7 +19,7 @@ typedef struct QEMUMachineInitArgs {
>  } QEMUMachineInitArgs;
>  
>  typedef void QEMUMachineInitFunc(QEMUMachineInitArgs *args);
> -
> +typedef void QEMUMachineInitPostCpusFunc(void);
>  typedef void QEMUMachineResetFunc(void);
>  
>  typedef void QEMUMachineHotAddCPUFunc(const int64_t id, Error **errp);
> @@ -29,6 +29,7 @@ typedef struct QEMUMachine {
>      const char *alias;
>      const char *desc;
>      QEMUMachineInitFunc *init;
> +    QEMUMachineInitPostCpusFunc *post_cpu_init;
>      QEMUMachineResetFunc *reset;
>      QEMUMachineHotAddCPUFunc *hot_add_cpu;
>      BlockInterfaceType block_default_type;
> diff --git a/vl.c b/vl.c
> index 47ab45d..71e1e6d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -4305,6 +4305,10 @@ int main(int argc, char **argv, char **envp)
>                                   .cpu_model = cpu_model };
>      machine->init(&args);
>  
> +    if (machine->post_cpu_init) {
> +        machine->post_cpu_init();
> +    }
> +
>      audio_init();
>  
>      cpu_synchronize_all_post_init();

-- 
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