[PATCH v2 02/16] hw/i386/vmport: Add compatability version field

Liran Alon posted 16 patches 5 years, 11 months ago
Maintainers: Eduardo Habkost <ehabkost@redhat.com>, Richard Henderson <rth@twiddle.net>, Paolo Bonzini <pbonzini@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>
There is a newer version of this series
[PATCH v2 02/16] hw/i386/vmport: Add compatability version field
Posted by Liran Alon 5 years, 11 months ago
No functional change.

This is done as a preparation for the following patches which will change
guest-visible behavior. Adding this version field will allow us to
maintain migration compatability from new QEMU version to old QEMU
version (Given machine-type is the compatabile).

Signed-off-by: Liran Alon <liran.alon@oracle.com>
---
 hw/i386/vmport.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/i386/vmport.c b/hw/i386/vmport.c
index 8d7513e2a23c..ca4d95fc017f 100644
--- a/hw/i386/vmport.c
+++ b/hw/i386/vmport.c
@@ -44,6 +44,8 @@ typedef struct VMPortState {
     MemoryRegion io;
     VMPortReadFunc *func[VMPORT_ENTRIES];
     void *opaque[VMPORT_ENTRIES];
+
+    uint8_t version;
 } VMPortState;
 
 static VMPortState *port_state;
@@ -156,6 +158,12 @@ static void vmport_realizefn(DeviceState *dev, Error **errp)
 }
 
 static Property vmport_properties[] = {
+    /*
+     * Used to enforce compatibility for migration.
+     * On every guest-visible change, should make changes conditioned on
+     * version and define proper version for previous machine-types.
+     */
+    DEFINE_PROP_UINT8("version", VMPortState, version, 1),
     DEFINE_PROP_END_OF_LIST(),
 };
 
-- 
2.20.1