From 62ef3760d4e400849fc663474227bb4668244455 Mon Sep 17 00:00:00 2001 From: Michael Roth Date: Thu, 17 Nov 2016 19:40:27 -0600 Subject: spapr: migration support for CAS-negotiated option vectors With the additional of the OV5_HP_EVT option vector, we now have certain functionality (namely, memory unplug) that checks at run-time for whether or not the guest negotiated the option via CAS. Because we don't currently migrate these negotiated values, we are unable to unplug memory from a guest after it's been migrated until after the guest is rebooted and CAS-negotiation is repeated. This patch fixes this by adding CAS-negotiated options to the migration stream. We do this using a subsection, since the negotiated value of OV5_HP_EVT is the only option currently needed to maintain proper functionality for a running guest. Signed-off-by: Michael Roth Signed-off-by: David Gibson --- include/hw/ppc/spapr_ovec.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/hw/ppc/spapr_ovec.h b/include/hw/ppc/spapr_ovec.h index 6a06da3..355a344 100644 --- a/include/hw/ppc/spapr_ovec.h +++ b/include/hw/ppc/spapr_ovec.h @@ -37,6 +37,7 @@ #define _SPAPR_OVEC_H #include "cpu.h" +#include "migration/vmstate.h" typedef struct sPAPROptionVector sPAPROptionVector; @@ -64,4 +65,7 @@ sPAPROptionVector *spapr_ovec_parse_vector(target_ulong table_addr, int vector); int spapr_ovec_populate_dt(void *fdt, int fdt_offset, sPAPROptionVector *ov, const char *name); +/* migration */ +extern const VMStateDescription vmstate_spapr_ovec; + #endif /* !defined (_SPAPR_OVEC_H) */ -- cgit v1.1 From 3fed86eefc15cda07270225731399ecd787153b8 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Mon, 21 Nov 2016 10:50:02 +1100 Subject: migration: Add VMSTATE_UINTTL_TEST() include/migration/cpu.h defines VMSTATE_UINTTL() and several variants for migrating target_ulong fields. It's defined in terms of VMSTATE_UINT32() or VMSTATE_UINT64() as appropriate. It doesn't, however, include a VMSTATE_UINTTL_TEST() variant, which I'm going to need shortly. So, add it. Signed-off-by: David Gibson Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Thomas Huth Reviewed-by: Greg Kurz --- include/migration/cpu.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/migration/cpu.h b/include/migration/cpu.h index f3abbab..f3d5dfc 100644 --- a/include/migration/cpu.h +++ b/include/migration/cpu.h @@ -18,6 +18,8 @@ VMSTATE_UINT64_EQUAL_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL_TEST(_f, _s, _t) \ + VMSTATE_UINT64_TEST(_f, _s, _t) #define vmstate_info_uinttl vmstate_info_uint64 #else #define qemu_put_betl qemu_put_be32 @@ -35,6 +37,8 @@ VMSTATE_UINT32_EQUAL_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) +#define VMSTATE_UINTTL_TEST(_f, _s, _t) \ + VMSTATE_UINT32_TEST(_f, _s, _t) #define vmstate_info_uinttl vmstate_info_uint32 #endif -- cgit v1.1 From 5c4537bded40640b166ec77e112592174b048c21 Mon Sep 17 00:00:00 2001 From: David Gibson Date: Wed, 23 Nov 2016 10:26:38 +1100 Subject: spapr: Fix 2.7<->2.8 migration of PCI host bridge daa2369 "spapr_pci: Add a 64-bit MMIO window" subtly broke migration from qemu-2.7 to the current version. It split the device's MMIO window into two pieces for 32-bit and 64-bit MMIO. The patch included backwards compatibility code to convert the old property into the new format. However, the property value was also transferred in the migration stream and compared with a (probably unwise) VMSTATE_EQUAL. So, the "raw" value from 2.7 is compared to the new style converted value from (pre-)2.8 giving a mismatch and migration failure. Along with the actual field that caused the breakage, there are several other ill-advised VMSTATE_EQUAL()s. To fix forwards migration, we read the values in the stream into scratch variables and ignore them, instead of comparing for equality. To fix backwards migration, we populate those scratch variables in pre_save() with adjusted values to match the old behaviour. To permit the eventual possibility of removing this cruft from the stream, we only include these compatibility fields if a new 'pre-2.8-migration' property is set. We clear it on the pseries-2.8 machine type, which obviously can't be migrated backwards, but set it on earlier machine type versions. Signed-off-by: David Gibson Reviewed-by: Dr. David Alan Gilbert Reviewed-by: Thomas Huth Reviewed-by: Greg Kurz Reviewed-by: Alexey Kardashevskiy --- include/hw/pci-host/spapr.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/hw/pci-host/spapr.h b/include/hw/pci-host/spapr.h index b92c1b5..092294e 100644 --- a/include/hw/pci-host/spapr.h +++ b/include/hw/pci-host/spapr.h @@ -79,6 +79,12 @@ struct sPAPRPHBState { uint64_t dma64_win_addr; uint32_t numa_node; + + /* Fields for migration compatibility hacks */ + bool pre_2_8_migration; + uint32_t mig_liobn; + hwaddr mig_mem_win_addr, mig_mem_win_size; + hwaddr mig_io_win_addr, mig_io_win_size; }; #define SPAPR_PCI_MEM_WIN_BUS_OFFSET 0x80000000ULL -- cgit v1.1