qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eduardo Habkost <ehabkost@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Subject: [Qemu-devel] [PULL 29/29] migration/i386: Remove support for pre-0.12 formats
Date: Thu, 11 May 2017 16:18:43 -0300	[thread overview]
Message-ID: <20170511191843.13784-30-ehabkost@redhat.com> (raw)
In-Reply-To: <20170511191843.13784-1-ehabkost@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Remove support for versions of the CPU state prior to 11
which is the version used in qemu 0.12 - you'd be pretty
lucky if you got a migration stream to work from anything
that old anyway.  This doesn't affect the machine type
definition in any way.

My main reason for doing this is the hack for sysenter_esp/eip
that uses .get/.put's in state versions less than 7 (that's
prior to somewhere before 0.10).

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-Id: <20170405190024.27581-4-dgilbert@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 target/i386/machine.c | 115 +++++++++++++++-----------------------------------
 1 file changed, 34 insertions(+), 81 deletions(-)

diff --git a/target/i386/machine.c b/target/i386/machine.c
index 0b4756b35f..3cb272948e 100644
--- a/target/i386/machine.c
+++ b/target/i386/machine.c
@@ -178,44 +178,6 @@ static const VMStateDescription vmstate_fpreg = {
     }
 };
 
-static bool version_is_5(void *opaque, int version_id)
-{
-    return version_id == 5;
-}
-
-#ifdef TARGET_X86_64
-static bool less_than_7(void *opaque, int version_id)
-{
-    return version_id < 7;
-}
-
-static int get_uint64_as_uint32(QEMUFile *f, void *pv, size_t size,
-                                VMStateField *field)
-{
-    uint64_t *v = pv;
-    *v = qemu_get_be32(f);
-    return 0;
-}
-
-static int put_uint64_as_uint32(QEMUFile *f, void *pv, size_t size,
-                                VMStateField *field, QJSON *vmdesc)
-{
-    uint64_t *v = pv;
-    qemu_put_be32(f, *v);
-
-    return 0;
-}
-
-static const VMStateInfo vmstate_hack_uint64_as_uint32 = {
-    .name = "uint64_as_uint32",
-    .get  = get_uint64_as_uint32,
-    .put  = put_uint64_as_uint32,
-};
-
-#define VMSTATE_HACK_UINT32(_f, _s, _t)                                  \
-    VMSTATE_SINGLE_TEST(_f, _s, _t, 0, vmstate_hack_uint64_as_uint32, uint64_t)
-#endif
-
 static void cpu_pre_save(void *opaque)
 {
     X86CPU *cpu = opaque;
@@ -842,7 +804,7 @@ static const VMStateDescription vmstate_mcg_ext_ctl = {
 VMStateDescription vmstate_x86_cpu = {
     .name = "cpu",
     .version_id = 12,
-    .minimum_version_id = 3,
+    .minimum_version_id = 11,
     .pre_save = cpu_pre_save,
     .post_load = cpu_post_load,
     .fields = (VMStateField[]) {
@@ -865,16 +827,8 @@ VMStateDescription vmstate_x86_cpu = {
         VMSTATE_SEGMENT(env.idt, X86CPU),
 
         VMSTATE_UINT32(env.sysenter_cs, X86CPU),
-#ifdef TARGET_X86_64
-        /* Hack: In v7 size changed from 32 to 64 bits on x86_64 */
-        VMSTATE_HACK_UINT32(env.sysenter_esp, X86CPU, less_than_7),
-        VMSTATE_HACK_UINT32(env.sysenter_eip, X86CPU, less_than_7),
-        VMSTATE_UINTTL_V(env.sysenter_esp, X86CPU, 7),
-        VMSTATE_UINTTL_V(env.sysenter_eip, X86CPU, 7),
-#else
         VMSTATE_UINTTL(env.sysenter_esp, X86CPU),
         VMSTATE_UINTTL(env.sysenter_eip, X86CPU),
-#endif
 
         VMSTATE_UINTTL(env.cr[0], X86CPU),
         VMSTATE_UINTTL(env.cr[2], X86CPU),
@@ -895,46 +849,45 @@ VMStateDescription vmstate_x86_cpu = {
         VMSTATE_UINT64(env.fmask, X86CPU),
         VMSTATE_UINT64(env.kernelgsbase, X86CPU),
 #endif
-        VMSTATE_UINT32_V(env.smbase, X86CPU, 4),
-
-        VMSTATE_UINT64_V(env.pat, X86CPU, 5),
-        VMSTATE_UINT32_V(env.hflags2, X86CPU, 5),
-
-        VMSTATE_UINT32_TEST(parent_obj.halted, X86CPU, version_is_5),
-        VMSTATE_UINT64_V(env.vm_hsave, X86CPU, 5),
-        VMSTATE_UINT64_V(env.vm_vmcb, X86CPU, 5),
-        VMSTATE_UINT64_V(env.tsc_offset, X86CPU, 5),
-        VMSTATE_UINT64_V(env.intercept, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_cr_read, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_cr_write, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_dr_read, X86CPU, 5),
-        VMSTATE_UINT16_V(env.intercept_dr_write, X86CPU, 5),
-        VMSTATE_UINT32_V(env.intercept_exceptions, X86CPU, 5),
-        VMSTATE_UINT8_V(env.v_tpr, X86CPU, 5),
+        VMSTATE_UINT32(env.smbase, X86CPU),
+
+        VMSTATE_UINT64(env.pat, X86CPU),
+        VMSTATE_UINT32(env.hflags2, X86CPU),
+
+        VMSTATE_UINT64(env.vm_hsave, X86CPU),
+        VMSTATE_UINT64(env.vm_vmcb, X86CPU),
+        VMSTATE_UINT64(env.tsc_offset, X86CPU),
+        VMSTATE_UINT64(env.intercept, X86CPU),
+        VMSTATE_UINT16(env.intercept_cr_read, X86CPU),
+        VMSTATE_UINT16(env.intercept_cr_write, X86CPU),
+        VMSTATE_UINT16(env.intercept_dr_read, X86CPU),
+        VMSTATE_UINT16(env.intercept_dr_write, X86CPU),
+        VMSTATE_UINT32(env.intercept_exceptions, X86CPU),
+        VMSTATE_UINT8(env.v_tpr, X86CPU),
         /* MTRRs */
-        VMSTATE_UINT64_ARRAY_V(env.mtrr_fixed, X86CPU, 11, 8),
-        VMSTATE_UINT64_V(env.mtrr_deftype, X86CPU, 8),
+        VMSTATE_UINT64_ARRAY(env.mtrr_fixed, X86CPU, 11),
+        VMSTATE_UINT64(env.mtrr_deftype, X86CPU),
         VMSTATE_MTRR_VARS(env.mtrr_var, X86CPU, MSR_MTRRcap_VCNT, 8),
         /* KVM-related states */
-        VMSTATE_INT32_V(env.interrupt_injected, X86CPU, 9),
-        VMSTATE_UINT32_V(env.mp_state, X86CPU, 9),
-        VMSTATE_UINT64_V(env.tsc, X86CPU, 9),
-        VMSTATE_INT32_V(env.exception_injected, X86CPU, 11),
-        VMSTATE_UINT8_V(env.soft_interrupt, X86CPU, 11),
-        VMSTATE_UINT8_V(env.nmi_injected, X86CPU, 11),
-        VMSTATE_UINT8_V(env.nmi_pending, X86CPU, 11),
-        VMSTATE_UINT8_V(env.has_error_code, X86CPU, 11),
-        VMSTATE_UINT32_V(env.sipi_vector, X86CPU, 11),
+        VMSTATE_INT32(env.interrupt_injected, X86CPU),
+        VMSTATE_UINT32(env.mp_state, X86CPU),
+        VMSTATE_UINT64(env.tsc, X86CPU),
+        VMSTATE_INT32(env.exception_injected, X86CPU),
+        VMSTATE_UINT8(env.soft_interrupt, X86CPU),
+        VMSTATE_UINT8(env.nmi_injected, X86CPU),
+        VMSTATE_UINT8(env.nmi_pending, X86CPU),
+        VMSTATE_UINT8(env.has_error_code, X86CPU),
+        VMSTATE_UINT32(env.sipi_vector, X86CPU),
         /* MCE */
-        VMSTATE_UINT64_V(env.mcg_cap, X86CPU, 10),
-        VMSTATE_UINT64_V(env.mcg_status, X86CPU, 10),
-        VMSTATE_UINT64_V(env.mcg_ctl, X86CPU, 10),
-        VMSTATE_UINT64_ARRAY_V(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4, 10),
+        VMSTATE_UINT64(env.mcg_cap, X86CPU),
+        VMSTATE_UINT64(env.mcg_status, X86CPU),
+        VMSTATE_UINT64(env.mcg_ctl, X86CPU),
+        VMSTATE_UINT64_ARRAY(env.mce_banks, X86CPU, MCE_BANKS_DEF * 4),
         /* rdtscp */
-        VMSTATE_UINT64_V(env.tsc_aux, X86CPU, 11),
+        VMSTATE_UINT64(env.tsc_aux, X86CPU),
         /* KVM pvclock msr */
-        VMSTATE_UINT64_V(env.system_time_msr, X86CPU, 11),
-        VMSTATE_UINT64_V(env.wall_clock_msr, X86CPU, 11),
+        VMSTATE_UINT64(env.system_time_msr, X86CPU),
+        VMSTATE_UINT64(env.wall_clock_msr, X86CPU),
         /* XSAVE related fields */
         VMSTATE_UINT64_V(env.xcr0, X86CPU, 12),
         VMSTATE_UINT64_V(env.xstate_bv, X86CPU, 12),
-- 
2.11.0.259.g40922b1

  parent reply	other threads:[~2017-05-11 19:19 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 19:18 [Qemu-devel] [PULL 00/29] x86 and machine queue, 2017-05-11 Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 01/29] i386: rewrite way CPUID index is validated Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 02/29] numa: Allow setting NUMA distance for different NUMA nodes Eduardo Habkost
2017-05-30 10:45   ` Peter Maydell
2017-05-30 14:01     ` Eduardo Habkost
2017-05-30 15:28       ` Eric Blake
2017-05-30 18:10         ` Eduardo Habkost
2017-05-30 18:21           ` Eric Blake
2017-05-30 17:08       ` Peter Maydell
2017-05-30 17:12         ` Daniel P. Berrange
2017-05-11 19:18 ` [Qemu-devel] [PULL 03/29] numa: equally distribute memory on nodes Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 04/29] tests: acpi: extend cphp and memhp testcase with numa distance check Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 05/29] tests: add CPUs to numa node mapping test Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 06/29] hw/arm/virt: extract mp-affinity calculation in separate function Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 07/29] hw/arm/virt: use machine->possible_cpus for storing possible topology info Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 08/29] hw/arm/virt: explicitly allocate cpu_index for cpus Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 09/29] numa: move source of default CPUs to NUMA node mapping into boards Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 10/29] spapr: add node-id property to sPAPR core Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 11/29] pc: add node-id property to CPU Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 12/29] virt-arm: " Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 13/29] numa: add check that board supports cpu_index to node mapping Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 14/29] numa: mirror cpu to node mapping in MachineState::possible_cpus Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 15/29] numa: do default mapping based on possible_cpus instead of node_cpu bitmaps Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 16/29] pc: get numa node mapping from possible_cpus instead of numa_get_node_for_cpu() Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 17/29] spapr: " Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 18/29] virt-arm: " Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 19/29] QMP: include CpuInstanceProperties into query_cpus output output Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 20/29] tests: numa: add case for QMP command query-cpus Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 21/29] numa: remove no longer need numa_post_machine_init() Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 22/29] machine: call machine init from wrapper Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 23/29] numa: use possible_cpus for not mapped CPUs check Eduardo Habkost
2017-05-17  8:07   ` Markus Armbruster
2017-05-17  9:09     ` Igor Mammedov
2017-05-11 19:18 ` [Qemu-devel] [PULL 24/29] numa: remove node_cpu bitmaps as they are no longer used Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 25/29] numa: add '-numa cpu, ...' option for property based node mapping Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 26/29] tests: check -numa node, cpu=props_list usecase Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 27/29] migration/i386: Remove old non-softfloat 64bit FP support Eduardo Habkost
2017-05-11 19:18 ` [Qemu-devel] [PULL 28/29] vmstatification: i386 FPReg Eduardo Habkost
2017-05-11 19:18 ` Eduardo Habkost [this message]
2017-05-15 13:15 ` [Qemu-devel] [PULL 00/29] x86 and machine queue, 2017-05-11 Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170511191843.13784-30-ehabkost@redhat.com \
    --to=ehabkost@redhat.com \
    --cc=dgilbert@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).