diff mbox

[v7,2/4] s390x: Convert QEMUMachine to MachineClass

Message ID 1402630619-4408-3-git-send-email-aik@ozlabs.ru
State New
Headers show

Commit Message

Alexey Kardashevskiy June 13, 2014, 3:36 a.m. UTC
This converts s390-virtio and s390-ccw-virtio machines to QOM MachineClass.
This brings ability to add interfaces to the machine classes. The first
interface for addition will be NMI.

The patch is mechanical so no change in behavior is expected.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/s390x/s390-virtio-ccw.c | 43 +++++++++++++++++++++++++++----------------
 hw/s390x/s390-virtio.c     | 44 +++++++++++++++++++++++++++-----------------
 2 files changed, 54 insertions(+), 33 deletions(-)

Comments

Alexey Kardashevskiy June 13, 2014, 3:44 a.m. UTC | #1
btw only this patche from the series got "[Qemu-devel]" in the subject line
and others did not, why? Lists of emails are almost the same, only Eric
Blake got kicked off (added him manually to this email cc:), is that
connected? :) Why is that subject thing happening? Thanks.



On 06/13/2014 01:36 PM, Alexey Kardashevskiy wrote:
> This converts s390-virtio and s390-ccw-virtio machines to QOM MachineClass.
> This brings ability to add interfaces to the machine classes. The first
> interface for addition will be NMI.
> 
> The patch is mechanical so no change in behavior is expected.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  hw/s390x/s390-virtio-ccw.c | 43 +++++++++++++++++++++++++++----------------
>  hw/s390x/s390-virtio.c     | 44 +++++++++++++++++++++++++++-----------------
>  2 files changed, 54 insertions(+), 33 deletions(-)
> 
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 42f5cec..05311b8 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -18,6 +18,8 @@
>  #include "css.h"
>  #include "virtio-ccw.h"
>  
> +#define TYPE_S390_CCW_MACHINE               "s390-ccw-machine"
> +
>  void io_subsystem_reset(void)
>  {
>      DeviceState *css, *sclp, *flic;
> @@ -134,24 +136,33 @@ static void ccw_init(MachineState *machine)
>      s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
>  }
>  
> -static QEMUMachine ccw_machine = {
> -    .name = "s390-ccw-virtio",
> -    .alias = "s390-ccw",
> -    .desc = "VirtIO-ccw based S390 machine",
> -    .init = ccw_init,
> -    .block_default_type = IF_VIRTIO,
> -    .no_cdrom = 1,
> -    .no_floppy = 1,
> -    .no_serial = 1,
> -    .no_parallel = 1,
> -    .no_sdcard = 1,
> -    .use_sclp = 1,
> -    .max_cpus = 255,
> +static void ccw_machine_class_init(ObjectClass *oc, void *data)
> +{
> +    MachineClass *mc = MACHINE_CLASS(oc);
> +
> +    mc->name = "s390-ccw-virtio";
> +    mc->alias = "s390-ccw";
> +    mc->desc = "VirtIO-ccw based S390 machine";
> +    mc->init = ccw_init;
> +    mc->block_default_type = IF_VIRTIO;
> +    mc->no_cdrom = 1;
> +    mc->no_floppy = 1;
> +    mc->no_serial = 1;
> +    mc->no_parallel = 1;
> +    mc->no_sdcard = 1;
> +    mc->use_sclp = 1,
> +    mc->max_cpus = 255;
> +}
> +
> +static const TypeInfo ccw_machine_info = {
> +    .name          = TYPE_S390_CCW_MACHINE,
> +    .parent        = TYPE_MACHINE,
> +    .class_init    = ccw_machine_class_init,
>  };
>  
> -static void ccw_machine_init(void)
> +static void ccw_machine_register_types(void)
>  {
> -    qemu_register_machine(&ccw_machine);
> +    type_register_static(&ccw_machine_info);
>  }
>  
> -machine_init(ccw_machine_init)
> +type_init(ccw_machine_register_types)
> diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
> index 93c7ace..f1e0dbc 100644
> --- a/hw/s390x/s390-virtio.c
> +++ b/hw/s390x/s390-virtio.c
> @@ -51,6 +51,7 @@
>  
>  #define MAX_BLK_DEVS                    10
>  #define ZIPL_FILENAME                   "s390-zipl.rom"
> +#define TYPE_S390_MACHINE               "s390-machine"
>  
>  static VirtIOS390Bus *s390_bus;
>  static S390CPU **ipi_states;
> @@ -279,25 +280,34 @@ static void s390_init(MachineState *machine)
>      s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");
>  }
>  
> -static QEMUMachine s390_machine = {
> -    .name = "s390-virtio",
> -    .alias = "s390",
> -    .desc = "VirtIO based S390 machine",
> -    .init = s390_init,
> -    .block_default_type = IF_VIRTIO,
> -    .no_cdrom = 1,
> -    .no_floppy = 1,
> -    .no_serial = 1,
> -    .no_parallel = 1,
> -    .no_sdcard = 1,
> -    .use_virtcon = 1,
> -    .max_cpus = 255,
> -    .is_default = 1,
> +static void s390_machine_class_init(ObjectClass *oc, void *data)
> +{
> +    MachineClass *mc = MACHINE_CLASS(oc);
> +
> +    mc->name = "s390-virtio";
> +    mc->alias = "s390";
> +    mc->desc = "VirtIO based S390 machine";
> +    mc->init = s390_init;
> +    mc->block_default_type = IF_VIRTIO;
> +    mc->max_cpus = 255;
> +    mc->no_serial = 1;
> +    mc->no_parallel = 1;
> +    mc->use_virtcon = 1;
> +    mc->no_floppy = 1;
> +    mc->no_cdrom = 1;
> +    mc->no_sdcard = 1;
> +    mc->is_default = 1;
> +}
> +
> +static const TypeInfo s390_machine_info = {
> +    .name          = TYPE_S390_MACHINE,
> +    .parent        = TYPE_MACHINE,
> +    .class_init    = s390_machine_class_init,
>  };
>  
> -static void s390_machine_init(void)
> +static void s390_machine_register_types(void)
>  {
> -    qemu_register_machine(&s390_machine);
> +    type_register_static(&s390_machine_info);
>  }
>  
> -machine_init(s390_machine_init);
> +type_init(s390_machine_register_types)
>
Cornelia Huck June 13, 2014, 5:56 a.m. UTC | #2
On Fri, 13 Jun 2014 13:36:57 +1000
Alexey Kardashevskiy <aik@ozlabs.ru> wrote:

> This converts s390-virtio and s390-ccw-virtio machines to QOM MachineClass.
> This brings ability to add interfaces to the machine classes. The first
> interface for addition will be NMI.
> 
> The patch is mechanical so no change in behavior is expected.
> 
> Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
> ---
>  hw/s390x/s390-virtio-ccw.c | 43 +++++++++++++++++++++++++++----------------
>  hw/s390x/s390-virtio.c     | 44 +++++++++++++++++++++++++++-----------------
>  2 files changed, 54 insertions(+), 33 deletions(-)
> 
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Eric Blake June 13, 2014, 12:47 p.m. UTC | #3
On 06/12/2014 09:44 PM, Alexey Kardashevskiy wrote:
> btw only this patche from the series got "[Qemu-devel]" in the subject line
> and others did not, why? Lists of emails are almost the same, only Eric
> Blake got kicked off (added him manually to this email cc:), is that
> connected? :) Why is that subject thing happening? Thanks.

Mailman is stupid. If someone is subscribed to a list, and has enabled
the option to avoid duplicate mail from the list when they are also
listed in cc, then mailman stupidly thinks it should remove that person
from the cc list before broadcasting the message to the list.

If you see [Qemu-devel] in the subject line, you got the message through
mailman, and some cc's may have been stripped.  If you don't see the
prefix, then you got the mail directly through other means (probably
through being listed in cc).  Either way, I get the whole thread, but it
makes it rather arbitrary whether I get replies to the mail through the
list or in person, depending on whether others reply to their direct
mail or to the mail they got through the list.
diff mbox

Patch

diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
index 42f5cec..05311b8 100644
--- a/hw/s390x/s390-virtio-ccw.c
+++ b/hw/s390x/s390-virtio-ccw.c
@@ -18,6 +18,8 @@ 
 #include "css.h"
 #include "virtio-ccw.h"
 
+#define TYPE_S390_CCW_MACHINE               "s390-ccw-machine"
+
 void io_subsystem_reset(void)
 {
     DeviceState *css, *sclp, *flic;
@@ -134,24 +136,33 @@  static void ccw_init(MachineState *machine)
     s390_create_virtio_net(BUS(css_bus), "virtio-net-ccw");
 }
 
-static QEMUMachine ccw_machine = {
-    .name = "s390-ccw-virtio",
-    .alias = "s390-ccw",
-    .desc = "VirtIO-ccw based S390 machine",
-    .init = ccw_init,
-    .block_default_type = IF_VIRTIO,
-    .no_cdrom = 1,
-    .no_floppy = 1,
-    .no_serial = 1,
-    .no_parallel = 1,
-    .no_sdcard = 1,
-    .use_sclp = 1,
-    .max_cpus = 255,
+static void ccw_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->name = "s390-ccw-virtio";
+    mc->alias = "s390-ccw";
+    mc->desc = "VirtIO-ccw based S390 machine";
+    mc->init = ccw_init;
+    mc->block_default_type = IF_VIRTIO;
+    mc->no_cdrom = 1;
+    mc->no_floppy = 1;
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
+    mc->no_sdcard = 1;
+    mc->use_sclp = 1,
+    mc->max_cpus = 255;
+}
+
+static const TypeInfo ccw_machine_info = {
+    .name          = TYPE_S390_CCW_MACHINE,
+    .parent        = TYPE_MACHINE,
+    .class_init    = ccw_machine_class_init,
 };
 
-static void ccw_machine_init(void)
+static void ccw_machine_register_types(void)
 {
-    qemu_register_machine(&ccw_machine);
+    type_register_static(&ccw_machine_info);
 }
 
-machine_init(ccw_machine_init)
+type_init(ccw_machine_register_types)
diff --git a/hw/s390x/s390-virtio.c b/hw/s390x/s390-virtio.c
index 93c7ace..f1e0dbc 100644
--- a/hw/s390x/s390-virtio.c
+++ b/hw/s390x/s390-virtio.c
@@ -51,6 +51,7 @@ 
 
 #define MAX_BLK_DEVS                    10
 #define ZIPL_FILENAME                   "s390-zipl.rom"
+#define TYPE_S390_MACHINE               "s390-machine"
 
 static VirtIOS390Bus *s390_bus;
 static S390CPU **ipi_states;
@@ -279,25 +280,34 @@  static void s390_init(MachineState *machine)
     s390_create_virtio_net((BusState *)s390_bus, "virtio-net-s390");
 }
 
-static QEMUMachine s390_machine = {
-    .name = "s390-virtio",
-    .alias = "s390",
-    .desc = "VirtIO based S390 machine",
-    .init = s390_init,
-    .block_default_type = IF_VIRTIO,
-    .no_cdrom = 1,
-    .no_floppy = 1,
-    .no_serial = 1,
-    .no_parallel = 1,
-    .no_sdcard = 1,
-    .use_virtcon = 1,
-    .max_cpus = 255,
-    .is_default = 1,
+static void s390_machine_class_init(ObjectClass *oc, void *data)
+{
+    MachineClass *mc = MACHINE_CLASS(oc);
+
+    mc->name = "s390-virtio";
+    mc->alias = "s390";
+    mc->desc = "VirtIO based S390 machine";
+    mc->init = s390_init;
+    mc->block_default_type = IF_VIRTIO;
+    mc->max_cpus = 255;
+    mc->no_serial = 1;
+    mc->no_parallel = 1;
+    mc->use_virtcon = 1;
+    mc->no_floppy = 1;
+    mc->no_cdrom = 1;
+    mc->no_sdcard = 1;
+    mc->is_default = 1;
+}
+
+static const TypeInfo s390_machine_info = {
+    .name          = TYPE_S390_MACHINE,
+    .parent        = TYPE_MACHINE,
+    .class_init    = s390_machine_class_init,
 };
 
-static void s390_machine_init(void)
+static void s390_machine_register_types(void)
 {
-    qemu_register_machine(&s390_machine);
+    type_register_static(&s390_machine_info);
 }
 
-machine_init(s390_machine_init);
+type_init(s390_machine_register_types)