qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH V3 2/5] vl.c: copy QEMUMachine's fields to Machi


From: Andreas Färber
Subject: Re: [Qemu-devel] [PATCH V3 2/5] vl.c: copy QEMUMachine's fields to MachineClass
Date: Fri, 25 Apr 2014 19:40:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

Am 09.04.2014 19:34, schrieb Marcel Apfelbaum:
> In order to eliminate the QEMUMachine indirection,
> add its fields directly to MachineClass.
> Do not remove yet qemu_machine field because it is

Either "not yet" or "field yet" - I went for the former.

> still in use by sparpr.

sPAPR - fixed.

> 
> Signed-off-by: Marcel Apfelbaum <address@hidden>
> ---
>  include/hw/boards.h | 23 +++++++++++++++++++++++
>  vl.c                | 23 +++++++++++++++++++++++
>  2 files changed, 46 insertions(+)
> 
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index aaaa871..138346d 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -77,6 +77,29 @@ struct MachineClass {
>      /*< public >*/
>  
>      QEMUMachine *qemu_machine;

I've inserted a white line here, like you did below.

> +    const char *name;
> +    const char *alias;
> +    const char *desc;
> +
> +    void (*init)(QEMUMachineInitArgs *args);
> +    void (*reset)(void);
> +    void (*hot_add_cpu)(const int64_t id, Error **errp);
> +    int (*kvm_type)(const char *arg);
> +
> +    BlockInterfaceType block_default_type;
> +    int max_cpus;
> +    unsigned int no_serial:1,
> +        no_parallel:1,
> +        use_virtcon:1,
> +        use_sclp:1,
> +        no_floppy:1,
> +        no_cdrom:1,
> +        no_sdcard:1;
> +    int is_default;
> +    const char *default_machine_opts;
> +    const char *default_boot_order;
> +    GlobalProperty *compat_props;
> +    const char *hw_version;
>  };
>  
>  /**
> diff --git a/vl.c b/vl.c
> index 9975e5a..0b0202d 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -1583,8 +1583,31 @@ MachineState *current_machine;
>  static void machine_class_init(ObjectClass *oc, void *data)
>  {
>      MachineClass *mc = MACHINE_CLASS(oc);
> +    QEMUMachine *qm = data;
>  
>      mc->qemu_machine = data;
> +
> +    mc->name = qm->name;
> +    mc->alias = qm->alias;
> +    mc->desc = qm->desc;
> +    mc->init = qm->init;
> +    mc->reset = qm->reset;
> +    mc->hot_add_cpu = qm->hot_add_cpu;
> +    mc->kvm_type = qm->kvm_type;
> +    mc->block_default_type = qm->block_default_type;
> +    mc->max_cpus = qm->max_cpus;
> +    mc->no_serial = qm->no_serial;
> +    mc->no_parallel = qm->no_parallel;
> +    mc->use_virtcon = qm->use_virtcon;
> +    mc->use_sclp = qm->use_sclp;
> +    mc->no_floppy = qm->no_floppy;
> +    mc->no_cdrom = qm->no_cdrom;
> +    mc->no_sdcard = qm->no_sdcard;
> +    mc->is_default = qm->is_default;
> +    mc->default_machine_opts = qm->default_machine_opts;
> +    mc->default_boot_order = qm->default_boot_order;
> +    mc->compat_props = qm->compat_props;
> +    mc->hw_version = qm->hw_version;
>  }
>  
>  int qemu_register_machine(QEMUMachine *m)

This is incomplete and breaks pseries with 3/5. Fixing up by duplicating
the above vl.c hunk as follows:

diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index a11e121..ae62700 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1493,9 +1493,32 @@ static void spapr_machine_class_init(ObjectClass
*oc, void *data)
 {
     MachineClass *mc = MACHINE_CLASS(oc);
     FWPathProviderClass *fwc = FW_PATH_PROVIDER_CLASS(oc);
+    QEMUMachine *qm = data;

     mc->qemu_machine = data;
     fwc->get_dev_path = spapr_get_fw_dev_path;
+
+    mc->name = qm->name;
+    mc->alias = qm->alias;
+    mc->desc = qm->desc;
+    mc->init = qm->init;
+    mc->reset = qm->reset;
+    mc->hot_add_cpu = qm->hot_add_cpu;
+    mc->kvm_type = qm->kvm_type;
+    mc->block_default_type = qm->block_default_type;
+    mc->max_cpus = qm->max_cpus;
+    mc->no_serial = qm->no_serial;
+    mc->no_parallel = qm->no_parallel;
+    mc->use_virtcon = qm->use_virtcon;
+    mc->use_sclp = qm->use_sclp;
+    mc->no_floppy = qm->no_floppy;
+    mc->no_cdrom = qm->no_cdrom;
+    mc->no_sdcard = qm->no_sdcard;
+    mc->is_default = qm->is_default;
+    mc->default_machine_opts = qm->default_machine_opts;
+    mc->default_boot_order = qm->default_boot_order;
+    mc->compat_props = qm->compat_props;
+    mc->hw_version = qm->hw_version;
 }

 static const TypeInfo spapr_machine_info = {

Regards,
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]