Patchwork [qom-cpu,for-1.4,5/6] target-s390x: Mark as unmigratable

login
register
mail settings
Submitter Andreas Färber
Date Jan. 28, 2013, 12:13 a.m.
Message ID <1359331989-12528-6-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/216083/
State New
Headers show

Comments

Andreas Färber - Jan. 28, 2013, 12:13 a.m.
CPU_SAVE_VERSION was undefined, so "cpu_common" VMState and
cpu_{save,load}() were not registered. They were no-ops.
Therefore there is no backwards compatibility to keep, so we can mark
S390CPU as unmigratable at device level.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-s390x/Makefile.objs |    1 -
 target-s390x/cpu.c         |   10 +++++++++-
 target-s390x/machine.c     |   30 ------------------------------
 3 Dateien geändert, 9 Zeilen hinzugefügt(+), 32 Zeilen entfernt(-)
 delete mode 100644 target-s390x/machine.c
Alexander Graf - Jan. 28, 2013, 8:34 a.m.
On 01/28/2013 01:13 AM, Andreas Färber wrote:
> CPU_SAVE_VERSION was undefined, so "cpu_common" VMState and
> cpu_{save,load}() were not registered. They were no-ops.
> Therefore there is no backwards compatibility to keep, so we can mark
> S390CPU as unmigratable at device level.
>
> Signed-off-by: Andreas Färber<afaerber@suse.de>

Semantically

   Acked-by: Alexander Graf <agraf@suse.de>

but from the style or modeling perspective, I can't really say much :).


Alex

> ---
>   target-s390x/Makefile.objs |    1 -
>   target-s390x/cpu.c         |   10 +++++++++-
>   target-s390x/machine.c     |   30 ------------------------------
>   3 Dateien geändert, 9 Zeilen hinzugefügt(+), 32 Zeilen entfernt(-)
>   delete mode 100644 target-s390x/machine.c
>
> diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs
> index e728abf..a4a4c1a 100644
> --- a/target-s390x/Makefile.objs
> +++ b/target-s390x/Makefile.objs
> @@ -1,4 +1,3 @@
>   obj-y += translate.o helper.o cpu.o interrupt.o
>   obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o
> -obj-$(CONFIG_SOFTMMU) += machine.o
>   obj-$(CONFIG_KVM) += kvm.o
> diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
> index 0b68db8..a0c4479 100644
> --- a/target-s390x/cpu.c
> +++ b/target-s390x/cpu.c
> @@ -26,8 +26,8 @@
>   #include "cpu.h"
>   #include "qemu-common.h"
>   #include "qemu/timer.h"
> -#ifndef CONFIG_USER_ONLY
>   #include "hw/hw.h"
> +#ifndef CONFIG_USER_ONLY
>   #include "sysemu/arch_init.h"
>   #endif
>
> @@ -135,13 +135,21 @@ static void s390_cpu_finalize(Object *obj)
>   #endif
>   }
>
> +static const VMStateDescription vmstate_s390_cpu = {
> +    .name = "cpu",
> +    .unmigratable = 1,
> +};
> +
>   static void s390_cpu_class_init(ObjectClass *oc, void *data)
>   {
>       S390CPUClass *scc = S390_CPU_CLASS(oc);
>       CPUClass *cc = CPU_CLASS(scc);
> +    DeviceClass *dc = DEVICE_CLASS(oc);
>
>       scc->parent_reset = cc->reset;
>       cc->reset = s390_cpu_reset;
> +
> +    dc->vmsd =&vmstate_s390_cpu;
>   }
>
>   static const TypeInfo s390_cpu_type_info = {
> diff --git a/target-s390x/machine.c b/target-s390x/machine.c
> deleted file mode 100644
> index 3e79be6..0000000
> --- a/target-s390x/machine.c
> +++ /dev/null
> @@ -1,30 +0,0 @@
> -/*
> - * QEMU S390x machine definitions
> - *
> - * Copyright (c) 2009 Alexander Graf<agraf@suse.de>
> - *
> - * This library is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU Lesser General Public
> - * License as published by the Free Software Foundation; either
> - * version 2 of the License, or (at your option) any later version.
> - *
> - * This library is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> - * Lesser General Public License for more details.
> - *
> - * You should have received a copy of the GNU Lesser General Public
> - * License along with this library; if not, see<http://www.gnu.org/licenses/>.
> - */
> -
> -#include "hw/hw.h"
> -#include "hw/boards.h"
> -
> -void cpu_save(QEMUFile *f, void *opaque)
> -{
> -}
> -
> -int cpu_load(QEMUFile *f, void *opaque, int version_id)
> -{
> -    return 0;
> -}

Patch

diff --git a/target-s390x/Makefile.objs b/target-s390x/Makefile.objs
index e728abf..a4a4c1a 100644
--- a/target-s390x/Makefile.objs
+++ b/target-s390x/Makefile.objs
@@ -1,4 +1,3 @@ 
 obj-y += translate.o helper.o cpu.o interrupt.o
 obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o
-obj-$(CONFIG_SOFTMMU) += machine.o
 obj-$(CONFIG_KVM) += kvm.o
diff --git a/target-s390x/cpu.c b/target-s390x/cpu.c
index 0b68db8..a0c4479 100644
--- a/target-s390x/cpu.c
+++ b/target-s390x/cpu.c
@@ -26,8 +26,8 @@ 
 #include "cpu.h"
 #include "qemu-common.h"
 #include "qemu/timer.h"
-#ifndef CONFIG_USER_ONLY
 #include "hw/hw.h"
+#ifndef CONFIG_USER_ONLY
 #include "sysemu/arch_init.h"
 #endif
 
@@ -135,13 +135,21 @@  static void s390_cpu_finalize(Object *obj)
 #endif
 }
 
+static const VMStateDescription vmstate_s390_cpu = {
+    .name = "cpu",
+    .unmigratable = 1,
+};
+
 static void s390_cpu_class_init(ObjectClass *oc, void *data)
 {
     S390CPUClass *scc = S390_CPU_CLASS(oc);
     CPUClass *cc = CPU_CLASS(scc);
+    DeviceClass *dc = DEVICE_CLASS(oc);
 
     scc->parent_reset = cc->reset;
     cc->reset = s390_cpu_reset;
+
+    dc->vmsd = &vmstate_s390_cpu;
 }
 
 static const TypeInfo s390_cpu_type_info = {
diff --git a/target-s390x/machine.c b/target-s390x/machine.c
deleted file mode 100644
index 3e79be6..0000000
--- a/target-s390x/machine.c
+++ /dev/null
@@ -1,30 +0,0 @@ 
-/*
- * QEMU S390x machine definitions
- *
- * Copyright (c) 2009 Alexander Graf <agraf@suse.de>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#include "hw/hw.h"
-#include "hw/boards.h"
-
-void cpu_save(QEMUFile *f, void *opaque)
-{
-}
-
-int cpu_load(QEMUFile *f, void *opaque, int version_id)
-{
-    return 0;
-}