summaryrefslogtreecommitdiff
path: root/hw/block
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2016-04-15 18:26:49 +0100
committerPeter Maydell <peter.maydell@linaro.org>2016-04-15 18:26:49 +0100
commit072035eba1ceb87a987cc03d756fc2da3f3ba058 (patch)
treed159bc2cee4ffb68ebc17081143b7ff30bcfc1d8 /hw/block
parentc7b45f12828c1ba7105dbc029c63d7de68eaa91c (diff)
parentcdc8845331cf789636dfa88dc47e22fcdaef4057 (diff)
downloadqemu-072035eba1ceb87a987cc03d756fc2da3f3ba058.tar.gz
Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging
Block layer patches for 2.6.0-rc3 # gpg: Signature made Fri 15 Apr 2016 17:02:23 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: nbd: Don't kill server on client that doesn't request TLS nbd: fix assert() on qemu-nbd stop nbd: Don't fail handshake on NBD_OPT_LIST descriptions qemu-iotests: 041: More robust assertion on quorum node qemu-iotests: place valgrind log file in scratch dir qemu-iotests: tests: do not set unused tmp variable qemu-iotests: common.rc: drop unused _do() qemu-iotests: drop unused _within_tolerance() filter Fix pflash migration block: Don't ignore flags in blk_{,co,aio}_write_zeroes() block/vpc: update comments to be compliant w/coding guidelines block/vpc: set errp in vpc_open block/vpc: make checks on max table size a bit more lax block/vpc: Use the correct max sector count for VHD images block/vpc: use current_size field for XenConverter VHD images vpc: use current_size field for XenServer VHD images block/vpc: set errp in vpc_create block: Fix blk_aio_write_zeroes() qemu-io: Support 'aio_write -z' Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/block')
-rw-r--r--hw/block/pflash_cfi01.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index c475c2aea7..106a775232 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -46,6 +46,7 @@
#include "exec/address-spaces.h"
#include "qemu/host-utils.h"
#include "hw/sysbus.h"
+#include "sysemu/sysemu.h"
#define PFLASH_BUG(fmt, ...) \
do { \
@@ -97,6 +98,7 @@ struct pflash_t {
MemoryRegion mem;
char *name;
void *storage;
+ VMChangeStateEntry *vmstate;
};
static int pflash_post_load(void *opaque, int version_id);
@@ -944,13 +946,25 @@ MemoryRegion *pflash_cfi01_get_memory(pflash_t *fl)
return &fl->mem;
}
+static void postload_update_cb(void *opaque, int running, RunState state)
+{
+ pflash_t *pfl = opaque;
+
+ /* This is called after bdrv_invalidate_cache_all. */
+ qemu_del_vm_change_state_handler(pfl->vmstate);
+ pfl->vmstate = NULL;
+
+ DPRINTF("%s: updating bdrv for %s\n", __func__, pfl->name);
+ pflash_update(pfl, 0, pfl->sector_len * pfl->nb_blocs);
+}
+
static int pflash_post_load(void *opaque, int version_id)
{
pflash_t *pfl = opaque;
if (!pfl->ro) {
- DPRINTF("%s: updating bdrv for %s\n", __func__, pfl->name);
- pflash_update(pfl, 0, pfl->sector_len * pfl->nb_blocs);
+ pfl->vmstate = qemu_add_vm_change_state_handler(postload_update_cb,
+ pfl);
}
return 0;
}