diff options
-rw-r--r-- | block/qcow2-bitmap.c | 15 | ||||
-rw-r--r-- | block/qcow2.c | 17 | ||||
-rw-r--r-- | block/qcow2.h | 2 | ||||
-rw-r--r-- | block/vmdk.c | 6 | ||||
-rw-r--r-- | hw/ide/core.c | 17 | ||||
-rw-r--r-- | hw/ide/macio.c | 2 | ||||
-rw-r--r-- | linux-user/xtensa/syscall.h | 0 | ||||
-rw-r--r-- | target/hppa/cpu.h | 4 | ||||
-rw-r--r-- | target/hppa/translate.c | 12 | ||||
-rw-r--r-- | target/xtensa/core-dc232b.c | 6 | ||||
-rw-r--r-- | target/xtensa/core-dc232b/gdb-config.inc.c (renamed from target/xtensa/core-dc232b/gdb-config.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-dc232b/xtensa-modules.inc.c (renamed from target/xtensa/core-dc232b/xtensa-modules.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-dc233c.c | 4 | ||||
-rw-r--r-- | target/xtensa/core-dc233c/gdb-config.inc.c (renamed from target/xtensa/core-dc233c/gdb-config.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-dc233c/xtensa-modules.inc.c (renamed from target/xtensa/core-dc233c/xtensa-modules.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-de212.c | 4 | ||||
-rw-r--r-- | target/xtensa/core-de212/gdb-config.inc.c (renamed from target/xtensa/core-de212/gdb-config.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-de212/xtensa-modules.inc.c (renamed from target/xtensa/core-de212/xtensa-modules.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-fsf.c | 2 | ||||
-rw-r--r-- | target/xtensa/core-fsf/xtensa-modules.inc.c (renamed from target/xtensa/core-fsf/xtensa-modules.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-sample_controller.c | 4 | ||||
-rw-r--r-- | target/xtensa/core-sample_controller/gdb-config.inc.c (renamed from target/xtensa/core-sample_controller/gdb-config.c) | 0 | ||||
-rw-r--r-- | target/xtensa/core-sample_controller/xtensa-modules.inc.c (renamed from target/xtensa/core-sample_controller/xtensa-modules.c) | 0 | ||||
-rwxr-xr-x | target/xtensa/import_core.sh | 9 | ||||
-rwxr-xr-x | tests/qemu-iotests/169 | 8 | ||||
-rw-r--r-- | tests/qemu-iotests/169.out | 4 | ||||
-rw-r--r-- | tests/tcg/xtensa/Makefile | 2 |
27 files changed, 75 insertions, 43 deletions
diff --git a/block/qcow2-bitmap.c b/block/qcow2-bitmap.c index 3010adb909..6e93ec43e1 100644 --- a/block/qcow2-bitmap.c +++ b/block/qcow2-bitmap.c @@ -1004,7 +1004,8 @@ fail: return false; } -int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp) +int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated, + Error **errp) { BDRVQcow2State *s = bs->opaque; Qcow2BitmapList *bm_list; @@ -1012,6 +1013,10 @@ int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp) GSList *ro_dirty_bitmaps = NULL; int ret = 0; + if (header_updated != NULL) { + *header_updated = false; + } + if (s->nb_bitmaps == 0) { /* No bitmaps - nothing to do */ return 0; @@ -1055,6 +1060,9 @@ int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp) error_setg_errno(errp, -ret, "Can't update bitmap directory"); goto out; } + if (header_updated != NULL) { + *header_updated = true; + } g_slist_foreach(ro_dirty_bitmaps, set_readonly_helper, false); } @@ -1065,6 +1073,11 @@ out: return ret; } +int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp) +{ + return qcow2_reopen_bitmaps_rw_hint(bs, NULL, errp); +} + /* store_bitmap_data() * Store bitmap to image, filling bitmap table accordingly. */ diff --git a/block/qcow2.c b/block/qcow2.c index cf4f3becae..486f3e83b7 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -1480,7 +1480,22 @@ static int coroutine_fn qcow2_do_open(BlockDriverState *bs, QDict *options, s->autoclear_features &= QCOW2_AUTOCLEAR_MASK; } - if (qcow2_load_dirty_bitmaps(bs, &local_err)) { + if (bdrv_dirty_bitmap_next(bs, NULL)) { + /* It's some kind of reopen with already existing dirty bitmaps. There + * are no known cases where we need loading bitmaps in such situation, + * so it's safer don't load them. + * + * Moreover, if we have some readonly bitmaps and we are reopening for + * rw we should reopen bitmaps correspondingly. + */ + if (bdrv_has_readonly_bitmaps(bs) && + !bdrv_is_read_only(bs) && !(bdrv_get_flags(bs) & BDRV_O_INACTIVE)) + { + bool header_updated = false; + qcow2_reopen_bitmaps_rw_hint(bs, &header_updated, &local_err); + update_header = update_header && !header_updated; + } + } else if (qcow2_load_dirty_bitmaps(bs, &local_err)) { update_header = false; } if (local_err != NULL) { diff --git a/block/qcow2.h b/block/qcow2.h index ccb92a9696..d301f77cea 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -671,6 +671,8 @@ int qcow2_check_bitmaps_refcounts(BlockDriverState *bs, BdrvCheckResult *res, void **refcount_table, int64_t *refcount_table_size); bool qcow2_load_dirty_bitmaps(BlockDriverState *bs, Error **errp); +int qcow2_reopen_bitmaps_rw_hint(BlockDriverState *bs, bool *header_updated, + Error **errp); int qcow2_reopen_bitmaps_rw(BlockDriverState *bs, Error **errp); void qcow2_store_persistent_dirty_bitmaps(BlockDriverState *bs, Error **errp); int qcow2_reopen_bitmaps_ro(BlockDriverState *bs, Error **errp); diff --git a/block/vmdk.c b/block/vmdk.c index f94c49a9c0..84f8bbe480 100644 --- a/block/vmdk.c +++ b/block/vmdk.c @@ -47,6 +47,8 @@ #define VMDK4_FLAG_MARKER (1 << 17) #define VMDK4_GD_AT_END 0xffffffffffffffffULL +#define VMDK_EXTENT_MAX_SECTORS (1ULL << 32) + #define VMDK_GTE_ZEROED 0x1 /* VMDK internal error codes */ @@ -1250,6 +1252,10 @@ static int get_cluster_offset(BlockDriverState *bs, return zeroed ? VMDK_ZEROED : VMDK_UNALLOC; } + if (extent->next_cluster_sector >= VMDK_EXTENT_MAX_SECTORS) { + return VMDK_ERROR; + } + cluster_sector = extent->next_cluster_sector; extent->next_cluster_sector += extent->cluster_sectors; diff --git a/hw/ide/core.c b/hw/ide/core.c index 139c843514..866c659498 100644 --- a/hw/ide/core.c +++ b/hw/ide/core.c @@ -402,7 +402,6 @@ typedef struct TrimAIOCB { QEMUIOVector *qiov; BlockAIOCB *aiocb; int i, j; - bool is_invalid; } TrimAIOCB; static void trim_aio_cancel(BlockAIOCB *acb) @@ -430,11 +429,8 @@ static void ide_trim_bh_cb(void *opaque) { TrimAIOCB *iocb = opaque; - if (iocb->is_invalid) { - ide_dma_error(iocb->s); - } else { - iocb->common.cb(iocb->common.opaque, iocb->ret); - } + iocb->common.cb(iocb->common.opaque, iocb->ret); + qemu_bh_delete(iocb->bh); iocb->bh = NULL; qemu_aio_unref(iocb); @@ -462,7 +458,7 @@ static void ide_issue_trim_cb(void *opaque, int ret) } if (!ide_sect_range_ok(s, sector, count)) { - iocb->is_invalid = true; + iocb->ret = -EINVAL; goto done; } @@ -502,7 +498,6 @@ BlockAIOCB *ide_issue_trim( iocb->qiov = qiov; iocb->i = -1; iocb->j = 0; - iocb->is_invalid = false; ide_issue_trim_cb(iocb, 0); return &iocb->common; } @@ -848,6 +843,12 @@ static void ide_dma_cb(void *opaque, int ret) if (ret == -ECANCELED) { return; } + + if (ret == -EINVAL) { + ide_dma_error(s); + return; + } + if (ret < 0) { if (ide_handle_rw_error(s, -ret, ide_dma_cmd_to_retry(s->dma_cmd))) { s->bus->dma->aiocb = NULL; diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 2e043ef1ea..d3a85cba3b 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -187,7 +187,7 @@ static void pmac_ide_transfer_cb(void *opaque, int ret) break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_blk_io(blk_get_aio_context(s->blk), &s->sg, - offset, 0x1, ide_issue_trim, s->blk, + offset, 0x1, ide_issue_trim, s, pmac_ide_transfer_cb, io, DMA_DIRECTION_TO_DEVICE); break; diff --git a/linux-user/xtensa/syscall.h b/linux-user/xtensa/syscall.h deleted file mode 100644 index e69de29bb2..0000000000 --- a/linux-user/xtensa/syscall.h +++ /dev/null diff --git a/target/hppa/cpu.h b/target/hppa/cpu.h index 19dd12a93e..861bbb1f16 100644 --- a/target/hppa/cpu.h +++ b/target/hppa/cpu.h @@ -305,8 +305,8 @@ static inline void cpu_get_tb_cpu_state(CPUHPPAState *env, target_ulong *pc, incomplete virtual address. This also means that we must separate out current cpu priviledge from the low bits of IAOQ_F. */ #ifdef CONFIG_USER_ONLY - *pc = env->iaoq_f; - *cs_base = env->iaoq_b; + *pc = env->iaoq_f & -4; + *cs_base = env->iaoq_b & -4; #else /* ??? E, T, H, L, B, P bits need to be here, when implemented. */ flags |= env->psw & (PSW_W | PSW_C | PSW_D); diff --git a/target/hppa/translate.c b/target/hppa/translate.c index 6499b392f9..c532889b1f 100644 --- a/target/hppa/translate.c +++ b/target/hppa/translate.c @@ -1909,9 +1909,6 @@ static DisasJumpType do_ibranch(DisasContext *ctx, TCGv_reg dest, */ static TCGv_reg do_ibranch_priv(DisasContext *ctx, TCGv_reg offset) { -#ifdef CONFIG_USER_ONLY - return offset; -#else TCGv_reg dest; switch (ctx->privilege) { case 0: @@ -1931,7 +1928,6 @@ static TCGv_reg do_ibranch_priv(DisasContext *ctx, TCGv_reg offset) break; } return dest; -#endif } #ifdef CONFIG_USER_ONLY @@ -1967,7 +1963,7 @@ static DisasJumpType do_page_zero(DisasContext *ctx) goto do_sigill; } - switch (ctx->iaoq_f) { + switch (ctx->iaoq_f & -4) { case 0x00: /* Null pointer call */ gen_excp_1(EXCP_IMP); return DISAS_NORETURN; @@ -1978,7 +1974,7 @@ static DisasJumpType do_page_zero(DisasContext *ctx) case 0xe0: /* SET_THREAD_POINTER */ tcg_gen_st_reg(cpu_gr[26], cpu_env, offsetof(CPUHPPAState, cr[27])); - tcg_gen_mov_reg(cpu_iaoq_f, cpu_gr[31]); + tcg_gen_ori_reg(cpu_iaoq_f, cpu_gr[31], 3); tcg_gen_addi_reg(cpu_iaoq_b, cpu_iaoq_f, 4); return DISAS_IAQ_N_UPDATED; @@ -4697,8 +4693,8 @@ static int hppa_tr_init_disas_context(DisasContextBase *dcbase, #ifdef CONFIG_USER_ONLY ctx->privilege = MMU_USER_IDX; ctx->mmu_idx = MMU_USER_IDX; - ctx->iaoq_f = ctx->base.pc_first; - ctx->iaoq_b = ctx->base.tb->cs_base; + ctx->iaoq_f = ctx->base.pc_first | MMU_USER_IDX; + ctx->iaoq_b = ctx->base.tb->cs_base | MMU_USER_IDX; #else ctx->privilege = (ctx->tb_flags >> TB_FLAG_PRIV_SHIFT) & 3; ctx->mmu_idx = (ctx->tb_flags & PSW_D ? ctx->privilege : MMU_PHYS_IDX); diff --git a/target/xtensa/core-dc232b.c b/target/xtensa/core-dc232b.c index fe80582df4..7331eeea2f 100644 --- a/target/xtensa/core-dc232b.c +++ b/target/xtensa/core-dc232b.c @@ -35,7 +35,7 @@ #include "overlay_tool.h" #define xtensa_modules xtensa_modules_dc232b -#include "core-dc232b/xtensa-modules.c" +#include "core-dc232b/xtensa-modules.inc.c" static XtensaConfig dc232b __attribute__((unused)) = { .name = "dc232b", @@ -43,11 +43,11 @@ static XtensaConfig dc232b __attribute__((unused)) = { .num_regs = 120, .num_core_regs = 52, .reg = { -#include "core-dc232b/gdb-config.c" +#include "core-dc232b/gdb-config.inc.c" } }, .isa_internal = &xtensa_modules, - .clock_freq_khz = 10000, + .clock_freq_khz = (NANOSECONDS_PER_SECOND / 64) / 1000, DEFAULT_SECTIONS }; diff --git a/target/xtensa/core-dc232b/gdb-config.c b/target/xtensa/core-dc232b/gdb-config.inc.c index 13aba5edec..13aba5edec 100644 --- a/target/xtensa/core-dc232b/gdb-config.c +++ b/target/xtensa/core-dc232b/gdb-config.inc.c diff --git a/target/xtensa/core-dc232b/xtensa-modules.c b/target/xtensa/core-dc232b/xtensa-modules.inc.c index d322c3f52a..d322c3f52a 100644 --- a/target/xtensa/core-dc232b/xtensa-modules.c +++ b/target/xtensa/core-dc232b/xtensa-modules.inc.c diff --git a/target/xtensa/core-dc233c.c b/target/xtensa/core-dc233c.c index 00301c28a2..8296e6fa10 100644 --- a/target/xtensa/core-dc233c.c +++ b/target/xtensa/core-dc233c.c @@ -36,7 +36,7 @@ #include "overlay_tool.h" #define xtensa_modules xtensa_modules_dc233c -#include "core-dc233c/xtensa-modules.c" +#include "core-dc233c/xtensa-modules.inc.c" static XtensaConfig dc233c __attribute__((unused)) = { .name = "dc233c", @@ -44,7 +44,7 @@ static XtensaConfig dc233c __attribute__((unused)) = { .num_regs = 121, .num_core_regs = 52, .reg = { -#include "core-dc233c/gdb-config.c" +#include "core-dc233c/gdb-config.inc.c" } }, .isa_internal = &xtensa_modules, diff --git a/target/xtensa/core-dc233c/gdb-config.c b/target/xtensa/core-dc233c/gdb-config.inc.c index b632341b28..b632341b28 100644 --- a/target/xtensa/core-dc233c/gdb-config.c +++ b/target/xtensa/core-dc233c/gdb-config.inc.c diff --git a/target/xtensa/core-dc233c/xtensa-modules.c b/target/xtensa/core-dc233c/xtensa-modules.inc.c index 7c20f82349..7c20f82349 100644 --- a/target/xtensa/core-dc233c/xtensa-modules.c +++ b/target/xtensa/core-dc233c/xtensa-modules.inc.c diff --git a/target/xtensa/core-de212.c b/target/xtensa/core-de212.c index 466a467f7f..53775a97fa 100644 --- a/target/xtensa/core-de212.c +++ b/target/xtensa/core-de212.c @@ -36,13 +36,13 @@ #include "overlay_tool.h" #define xtensa_modules xtensa_modules_de212 -#include "core-de212/xtensa-modules.c" +#include "core-de212/xtensa-modules.inc.c" static XtensaConfig de212 __attribute__((unused)) = { .name = "de212", .gdb_regmap = { .reg = { -#include "core-de212/gdb-config.c" +#include "core-de212/gdb-config.inc.c" } }, .isa_internal = &xtensa_modules, diff --git a/target/xtensa/core-de212/gdb-config.c b/target/xtensa/core-de212/gdb-config.inc.c index 25510fc34c..25510fc34c 100644 --- a/target/xtensa/core-de212/gdb-config.c +++ b/target/xtensa/core-de212/gdb-config.inc.c diff --git a/target/xtensa/core-de212/xtensa-modules.c b/target/xtensa/core-de212/xtensa-modules.inc.c index ef7674de3a..ef7674de3a 100644 --- a/target/xtensa/core-de212/xtensa-modules.c +++ b/target/xtensa/core-de212/xtensa-modules.inc.c diff --git a/target/xtensa/core-fsf.c b/target/xtensa/core-fsf.c index f41de9a1aa..01932bdc8b 100644 --- a/target/xtensa/core-fsf.c +++ b/target/xtensa/core-fsf.c @@ -36,7 +36,7 @@ #include "overlay_tool.h" #define xtensa_modules xtensa_modules_fsf -#include "core-fsf/xtensa-modules.c" +#include "core-fsf/xtensa-modules.inc.c" static XtensaConfig fsf __attribute__((unused)) = { .name = "fsf", diff --git a/target/xtensa/core-fsf/xtensa-modules.c b/target/xtensa/core-fsf/xtensa-modules.inc.c index f7de2dec15..f7de2dec15 100644 --- a/target/xtensa/core-fsf/xtensa-modules.c +++ b/target/xtensa/core-fsf/xtensa-modules.inc.c diff --git a/target/xtensa/core-sample_controller.c b/target/xtensa/core-sample_controller.c index 879e853a92..c622335ca5 100644 --- a/target/xtensa/core-sample_controller.c +++ b/target/xtensa/core-sample_controller.c @@ -36,13 +36,13 @@ #include "overlay_tool.h" #define xtensa_modules xtensa_modules_sample_controller -#include "core-sample_controller/xtensa-modules.c" +#include "core-sample_controller/xtensa-modules.inc.c" static XtensaConfig sample_controller __attribute__((unused)) = { .name = "sample_controller", .gdb_regmap = { .reg = { -#include "core-sample_controller/gdb-config.c" +#include "core-sample_controller/gdb-config.inc.c" } }, .isa_internal = &xtensa_modules, diff --git a/target/xtensa/core-sample_controller/gdb-config.c b/target/xtensa/core-sample_controller/gdb-config.inc.c index 99e172d819..99e172d819 100644 --- a/target/xtensa/core-sample_controller/gdb-config.c +++ b/target/xtensa/core-sample_controller/gdb-config.inc.c diff --git a/target/xtensa/core-sample_controller/xtensa-modules.c b/target/xtensa/core-sample_controller/xtensa-modules.inc.c index fba41b99ae..fba41b99ae 100644 --- a/target/xtensa/core-sample_controller/xtensa-modules.c +++ b/target/xtensa/core-sample_controller/xtensa-modules.inc.c diff --git a/target/xtensa/import_core.sh b/target/xtensa/import_core.sh index 32255eea9b..af6c610479 100755 --- a/target/xtensa/import_core.sh +++ b/target/xtensa/import_core.sh @@ -22,7 +22,7 @@ mkdir -p "$TARGET" tar -xf "$OVERLAY" -C "$TARGET" --strip-components=1 \ --xform='s/core/core-isa/' config/core.h tar -xf "$OVERLAY" -O gdb/xtensa-config.c | \ - sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.c + sed -n '1,/*\//p;/XTREG/,/XTREG_END/p' > "$TARGET"/gdb-config.inc.c # # Fix up known issues in the xtensa-modules.c # @@ -33,7 +33,8 @@ tar -xf "$OVERLAY" -O binutils/xtensa-modules.c | \ -e '/^uint32 \*bypass_entry(int i)/,/}/d' \ -e '/^#include "ansidecl.h"/d' \ -e '/^Slot_[a-zA-Z0-9_]\+_decode (const xtensa_insnbuf insn)/,/^}/s/^ return 0;$/ return XTENSA_UNDEFINED;/' \ - > "$TARGET"/xtensa-modules.c + -e 's/#include <xtensa-isa.h>/#include "xtensa-isa.h"/' \ + > "$TARGET"/xtensa-modules.inc.c cat <<EOF > "${TARGET}.c" #include "qemu/osdep.h" @@ -47,13 +48,13 @@ cat <<EOF > "${TARGET}.c" #include "overlay_tool.h" #define xtensa_modules xtensa_modules_$NAME -#include "core-$NAME/xtensa-modules.c" +#include "core-$NAME/xtensa-modules.inc.c" static XtensaConfig $NAME __attribute__((unused)) = { .name = "$NAME", .gdb_regmap = { .reg = { -#include "core-$NAME/gdb-config.c" +#include "core-$NAME/gdb-config.inc.c" } }, .isa_internal = &xtensa_modules, diff --git a/tests/qemu-iotests/169 b/tests/qemu-iotests/169 index 3a8db91f6f..153b10b6e7 100755 --- a/tests/qemu-iotests/169 +++ b/tests/qemu-iotests/169 @@ -140,16 +140,14 @@ def inject_test_case(klass, name, method, *args, **kwargs): mc = operator.methodcaller(method, *args, **kwargs) setattr(klass, 'test_' + name, new.instancemethod(mc, None, klass)) -for cmb in list(itertools.product((True, False), repeat=3)): +for cmb in list(itertools.product((True, False), repeat=4)): name = ('_' if cmb[0] else '_not_') + 'persistent_' name += ('_' if cmb[1] else '_not_') + 'migbitmap_' name += '_online' if cmb[2] else '_offline' - - # TODO fix shared-storage bitmap migration and enable cases for it - args = list(cmb) + [False] + name += '_shared' if cmb[3] else '_nonshared' inject_test_case(TestDirtyBitmapMigration, name, 'do_test_migration', - *args) + *list(cmb)) if __name__ == '__main__': diff --git a/tests/qemu-iotests/169.out b/tests/qemu-iotests/169.out index 594c16f49f..b6f257674e 100644 --- a/tests/qemu-iotests/169.out +++ b/tests/qemu-iotests/169.out @@ -1,5 +1,5 @@ -........ +................ ---------------------------------------------------------------------- -Ran 8 tests +Ran 16 tests OK diff --git a/tests/tcg/xtensa/Makefile b/tests/tcg/xtensa/Makefile index 2882c431e4..091518c055 100644 --- a/tests/tcg/xtensa/Makefile +++ b/tests/tcg/xtensa/Makefile @@ -5,7 +5,7 @@ CROSS=xtensa-$(CORE)-elf- ifndef XT SIM = ../../../xtensa-softmmu/qemu-system-xtensa -SIMFLAGS = -M sim -cpu $(CORE) -nographic -semihosting -icount 7 $(EXTFLAGS) -kernel +SIMFLAGS = -M sim -cpu $(CORE) -nographic -semihosting -icount 6 $(EXTFLAGS) -kernel SIMDEBUG = -s -S else SIM = xt-run |