Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evolve #26

Closed
wants to merge 55 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
7e213f8
block: Make essential BlockDriver objects public
XanClic Dec 2, 2014
e81703b
block: Omit bdrv_find_format for essential drivers
XanClic Dec 2, 2014
1961d1c
block/vvfat: qcow driver may not be found
XanClic Dec 2, 2014
0fc9a06
block/nfs: Add create_opts
XanClic Dec 2, 2014
6065d54
block: Check create_opts before image creation
XanClic Dec 2, 2014
10be14e
qemu-img: Check create_opts before image creation
XanClic Dec 2, 2014
b15bfd0
qemu-img: Check create_opts before image amendment
XanClic Dec 2, 2014
0a0a984
iotests: Only kill NBD server if it runs
XanClic Dec 2, 2014
ff15187
iotests: Add test for unsupported image creation
XanClic Dec 2, 2014
1e85e69
qcow2: Prevent numerical overflow
XanClic Dec 2, 2014
6f45cda
qcow2: Flushing the caches in qcow2_close may fail
XanClic Dec 2, 2014
9b3f3d6
qcow2: Respect bdrv_truncate() error
XanClic Dec 2, 2014
6950b92
block/raw-posix: Fix ret in raw_open_common()
XanClic Dec 2, 2014
9fc6075
block migration: fix return value
Nov 25, 2014
63a3acd
qcow2: Fix header extension size check
kevmw Nov 25, 2014
9f8da03
qcow2.py: Add required padding for header extensions
kevmw Nov 25, 2014
ebd2bd2
block: Don't probe for unknown backing file format
kevmw Nov 25, 2014
51d703f
linuxboot: fix loading old kernels
bonzini Dec 11, 2014
6569578
audio: Don't free hw resources until after hw backend is stopped
pm215 Dec 16, 2014
27ad3df
target-xtensa: fix translation for opcodes crossing page boundary
jcmvbkbc Dec 14, 2014
718ab31
target-xtensa: test cross-page opcode
jcmvbkbc Dec 14, 2014
83dbd88
migration/block: fix pending() return value
Dec 30, 2014
f738ade
atomic: fix position of volatile qualifier
bonzini Nov 4, 2014
cb3360d
PPC: Fix crash on spapr_tce_table_finalize()
dgibson Dec 8, 2014
e1ce0c3
vl.c: fix regression when reading machine type from config file
marcel-apf Jan 7, 2015
e54bcad
serial: reset thri_pending on IER writes with THRI=0
bonzini Dec 12, 2014
fdb2ed4
serial: refine serial_thr_ipending_needed
bonzini Dec 22, 2014
49725cd
pckbd: set bits 2-3-6-7 of the output port by default
bonzini Dec 22, 2014
09e2753
linux-user: Fix broken m68k signal handling on 64 bit hosts
pm215 Dec 22, 2014
b0a231a
scsi: fix cancellation when I/O was completed but DMA was not.
bonzini Jan 12, 2015
8d1fdb1
target-i386: fix movntsd on big-endian hosts
bonzini Jan 7, 2015
0d09315
vt82c686: avoid out-of-bounds read
bonzini Dec 10, 2014
451b9e2
virtio: fix feature bit checks
cohuck Dec 12, 2014
e60fb7a
sb16: fix interrupt acknowledgement
bonzini Jan 20, 2015
4ac8b01
hw/input/hid.c Fix capslock hid code
Jan 21, 2015
3750d25
target-arm/translate-a64: Fix wrong mmu_idx usage for LDT/STT
pm215 Feb 5, 2015
4d49de6
vfio-pci: Fix missing unparent of dynamically allocated MemoryRegion
awilliam Feb 4, 2015
a9eb2b6
qemu-thread: fix qemu_event without futexes
bonzini Feb 2, 2015
6833856
libcacard: stop linking against every single 3rd party library
berrange Feb 3, 2015
2a020d2
fix mc146818rtc wrong subsection name to avoid vmstate_subsection_loa…
Feb 5, 2015
7d389a2
block/iscsi: fix uninitialized variable
Lekensteyn Dec 23, 2014
987aba5
qtest: Fix deadloop by running main loop AIO context's timers
Jan 19, 2015
a97f9a7
exec: change default exception_index value for migration to -1
bonzini Dec 19, 2014
3d1cd59
update ipxe from 69313ed to 35c5379
kraxel Dec 17, 2014
00fd890
target-mips: fix broken snapshotting
Jan 26, 2015
3e04f97
kvm/apic: fix 2.2->2.1 migration
bonzini Dec 10, 2014
4ec1b9b
qdev: Avoid type assertion in qdev_build_hotpluggable_device_list()
junmuzi Nov 5, 2014
a958b9b
linux-user: Check for cpu_init() errors
ehabkost Feb 3, 2015
6c699aa
xen-hvm: increase maxmem before calling xc_domain_populate_physmap
Dec 3, 2014
dab0efc
pc: acpi: fix WindowsXP BSOD when memory hotplug is enabled
Dec 19, 2014
16765a5
acpi-test: update expected DSDT
mdroth Mar 7, 2015
c4ca8af
acpi: update generated hex files
mdroth Mar 7, 2015
07db685
coroutine: Fix use after free with qemu_coroutine_yield()
kevmw Feb 10, 2015
c70221d
vpc: Fix size in fixed image creation
kevmw Feb 11, 2015
2001e19
Update version for v2.2.1 release
mdroth Mar 10, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.2.0
2.2.1
2 changes: 1 addition & 1 deletion audio/audio_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,9 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
audio_detach_capture (hw);
#endif
QLIST_REMOVE (hw, entries);
glue (hw->pcm_ops->fini_, TYPE) (hw);
glue (s->nb_hw_voices_, TYPE) += 1;
glue (audio_pcm_hw_free_resources_ ,TYPE) (hw);
glue (hw->pcm_ops->fini_, TYPE) (hw);
g_free (hw);
*hwp = NULL;
}
Expand Down
14 changes: 11 additions & 3 deletions block-migration.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
{
int ret;
int64_t last_ftell = qemu_ftell(f);
int64_t delta_ftell;

DPRINTF("Enter save live iterate submitted %d transferred %d\n",
block_mig_state.submitted, block_mig_state.transferred);
Expand Down Expand Up @@ -702,7 +703,14 @@ static int block_save_iterate(QEMUFile *f, void *opaque)
}

qemu_put_be64(f, BLK_MIG_FLAG_EOS);
return qemu_ftell(f) - last_ftell;
delta_ftell = qemu_ftell(f) - last_ftell;
if (delta_ftell > 0) {
return 1;
} else if (delta_ftell < 0) {
return -1;
} else {
return 0;
}
}

/* Called with iothread lock taken. */
Expand Down Expand Up @@ -757,8 +765,8 @@ static uint64_t block_save_pending(QEMUFile *f, void *opaque, uint64_t max_size)
block_mig_state.read_done * BLOCK_SIZE;

/* Report at least one block pending during bulk phase */
if (pending == 0 && !block_mig_state.bulk_completed) {
pending = BLOCK_SIZE;
if (pending <= max_size && !block_mig_state.bulk_completed) {
pending = max_size + BLOCK_SIZE;
}
blk_mig_unlock();
qemu_mutex_unlock_iothread();
Expand Down
36 changes: 20 additions & 16 deletions block.c
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,7 @@ BlockDriver *bdrv_find_protocol(const char *filename,
}

if (!path_has_protocol(filename) || !allow_protocol_prefix) {
return bdrv_find_format("file");
return &bdrv_file;
}

p = strchr(filename, ':');
Expand Down Expand Up @@ -658,12 +658,7 @@ static int find_image_format(BlockDriverState *bs, const char *filename,

/* Return the raw BlockDriver * to scsi-generic devices or empty drives */
if (bs->sg || !bdrv_is_inserted(bs) || bdrv_getlength(bs) == 0) {
drv = bdrv_find_format("raw");
if (!drv) {
error_setg(errp, "Could not find raw image format");
ret = -ENOENT;
}
*pdrv = drv;
*pdrv = &bdrv_raw;
return ret;
}

Expand Down Expand Up @@ -1180,7 +1175,6 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
{
char *backing_filename = g_malloc0(PATH_MAX);
int ret = 0;
BlockDriver *back_drv = NULL;
BlockDriverState *backing_hd;
Error *local_err = NULL;

Expand Down Expand Up @@ -1213,14 +1207,14 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)

backing_hd = bdrv_new();

if (bs->backing_format[0] != '\0') {
back_drv = bdrv_find_format(bs->backing_format);
if (bs->backing_format[0] != '\0' && !qdict_haskey(options, "driver")) {
qdict_put(options, "driver", qstring_from_str(bs->backing_format));
}

assert(bs->backing_hd == NULL);
ret = bdrv_open(&backing_hd,
*backing_filename ? backing_filename : NULL, NULL, options,
bdrv_backing_flags(bs->open_flags), back_drv, &local_err);
bdrv_backing_flags(bs->open_flags), NULL, &local_err);
if (ret < 0) {
bdrv_unref(backing_hd);
backing_hd = NULL;
Expand Down Expand Up @@ -1294,7 +1288,6 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp)
/* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
char *tmp_filename = g_malloc0(PATH_MAX + 1);
int64_t total_size;
BlockDriver *bdrv_qcow2;
QemuOpts *opts = NULL;
QDict *snapshot_options;
BlockDriverState *bs_snapshot;
Expand All @@ -1319,11 +1312,10 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp)
goto out;
}

bdrv_qcow2 = bdrv_find_format("qcow2");
opts = qemu_opts_create(bdrv_qcow2->create_opts, NULL, 0,
opts = qemu_opts_create(bdrv_qcow2.create_opts, NULL, 0,
&error_abort);
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_size);
ret = bdrv_create(bdrv_qcow2, tmp_filename, opts, &local_err);
ret = bdrv_create(&bdrv_qcow2, tmp_filename, opts, &local_err);
qemu_opts_del(opts);
if (ret < 0) {
error_setg_errno(errp, -ret, "Could not create temporary overlay "
Expand All @@ -1343,7 +1335,7 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp)
bs_snapshot = bdrv_new();

ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,
flags, bdrv_qcow2, &local_err);
flags, &bdrv_qcow2, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto out;
Expand Down Expand Up @@ -5541,6 +5533,18 @@ void bdrv_img_create(const char *filename, const char *fmt,
return;
}

if (!drv->create_opts) {
error_setg(errp, "Format driver '%s' does not support image creation",
drv->format_name);
return;
}

if (!proto_drv->create_opts) {
error_setg(errp, "Protocol driver '%s' does not support image creation",
proto_drv->format_name);
return;
}

create_opts = qemu_opts_append(create_opts, drv->create_opts);
create_opts = qemu_opts_append(create_opts, proto_drv->create_opts);

Expand Down
2 changes: 1 addition & 1 deletion block/iscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
QemuOpts *opts;
Error *local_err = NULL;
const char *filename;
int i, ret;
int i, ret = 0;

if ((BDRV_SECTOR_SIZE % 512) != 0) {
error_setg(errp, "iSCSI: Invalid BDRV_SECTOR_SIZE. "
Expand Down
15 changes: 15 additions & 0 deletions block/nfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,19 @@ static int nfs_file_open(BlockDriverState *bs, QDict *options, int flags,
return ret;
}

static QemuOptsList nfs_create_opts = {
.name = "nfs-create-opts",
.head = QTAILQ_HEAD_INITIALIZER(nfs_create_opts.head),
.desc = {
{
.name = BLOCK_OPT_SIZE,
.type = QEMU_OPT_SIZE,
.help = "Virtual disk size"
},
{ /* end of list */ }
}
};

static int nfs_file_create(const char *url, QemuOpts *opts, Error **errp)
{
int ret = 0;
Expand Down Expand Up @@ -470,6 +483,8 @@ static BlockDriver bdrv_nfs = {

.instance_size = sizeof(NFSClient),
.bdrv_needs_filename = true,
.create_opts = &nfs_create_opts,

.bdrv_has_zero_init = nfs_has_zero_init,
.bdrv_get_allocated_file_size = nfs_get_allocated_file_size,
.bdrv_truncate = nfs_file_truncate,
Expand Down
2 changes: 1 addition & 1 deletion block/qcow2-cluster.c
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,7 @@ int qcow2_alloc_cluster_offset(BlockDriverState *bs, uint64_t offset,

again:
start = offset;
remaining = *num << BDRV_SECTOR_BITS;
remaining = (uint64_t)*num << BDRV_SECTOR_BITS;
cluster_offset = 0;
*host_offset = 0;
cur_bytes = 0;
Expand Down
33 changes: 22 additions & 11 deletions block/qcow2.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static int qcow2_read_extensions(BlockDriverState *bs, uint64_t start_offset,
#ifdef DEBUG_EXT
printf("ext.magic = 0x%x\n", ext.magic);
#endif
if (ext.len > end_offset - offset) {
if (offset > end_offset || ext.len > end_offset - offset) {
error_setg(errp, "Header extension too large");
return -EINVAL;
}
Expand Down Expand Up @@ -1428,10 +1428,23 @@ static void qcow2_close(BlockDriverState *bs)
s->l1_table = NULL;

if (!(bs->open_flags & BDRV_O_INCOMING)) {
qcow2_cache_flush(bs, s->l2_table_cache);
qcow2_cache_flush(bs, s->refcount_block_cache);
int ret1, ret2;

qcow2_mark_clean(bs);
ret1 = qcow2_cache_flush(bs, s->l2_table_cache);
ret2 = qcow2_cache_flush(bs, s->refcount_block_cache);

if (ret1) {
error_report("Failed to flush the L2 table cache: %s",
strerror(-ret1));
}
if (ret2) {
error_report("Failed to flush the refcount block cache: %s",
strerror(-ret2));
}

if (!ret1 && !ret2) {
qcow2_mark_clean(bs);
}
}

qcow2_cache_destroy(bs, s->l2_table_cache);
Expand Down Expand Up @@ -1915,10 +1928,9 @@ static int qcow2_create2(const char *filename, int64_t total_size,
* refcount of the cluster that is occupied by the header and the refcount
* table)
*/
BlockDriver* drv = bdrv_find_format("qcow2");
assert(drv != NULL);
ret = bdrv_open(&bs, filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH, drv, &local_err);
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_FLUSH,
&bdrv_qcow2, &local_err);
if (ret < 0) {
error_propagate(errp, local_err);
goto out;
Expand Down Expand Up @@ -1970,7 +1982,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
/* Reopen the image without BDRV_O_NO_FLUSH to flush it before returning */
ret = bdrv_open(&bs, filename, NULL, NULL,
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
drv, &local_err);
&bdrv_qcow2, &local_err);
if (local_err) {
error_propagate(errp, local_err);
goto out;
Expand Down Expand Up @@ -2150,8 +2162,7 @@ static int qcow2_write_compressed(BlockDriverState *bs, int64_t sector_num,
/* align end of file to a sector boundary to ease reading with
sector based I/Os */
cluster_offset = bdrv_getlength(bs->file);
bdrv_truncate(bs->file, cluster_offset);
return 0;
return bdrv_truncate(bs->file, cluster_offset);
}

if (nb_sectors != s->cluster_sectors) {
Expand Down Expand Up @@ -2847,7 +2858,7 @@ static QemuOptsList qcow2_create_opts = {
}
};

static BlockDriver bdrv_qcow2 = {
BlockDriver bdrv_qcow2 = {
.format_name = "qcow2",
.instance_size = sizeof(BDRVQcowState),
.bdrv_probe = qcow2_probe,
Expand Down
3 changes: 2 additions & 1 deletion block/raw-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
}

if (fstat(s->fd, &st) < 0) {
ret = -errno;
error_setg_errno(errp, errno, "Could not stat file");
goto fail;
}
Expand Down Expand Up @@ -1684,7 +1685,7 @@ static QemuOptsList raw_create_opts = {
}
};

static BlockDriver bdrv_file = {
BlockDriver bdrv_file = {
.format_name = "file",
.protocol_name = "file",
.instance_size = sizeof(BDRVRawState),
Expand Down
2 changes: 1 addition & 1 deletion block/raw-win32.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ static QemuOptsList raw_create_opts = {
}
};

static BlockDriver bdrv_file = {
BlockDriver bdrv_file = {
.format_name = "file",
.protocol_name = "file",
.instance_size = sizeof(BDRVRawState),
Expand Down
2 changes: 1 addition & 1 deletion block/raw_bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static int raw_probe(const uint8_t *buf, int buf_size, const char *filename)
return 1;
}

static BlockDriver bdrv_raw = {
BlockDriver bdrv_raw = {
.format_name = "raw",
.bdrv_probe = &raw_probe,
.bdrv_reopen_prepare = &raw_reopen_prepare,
Expand Down
10 changes: 3 additions & 7 deletions block/vpc.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,7 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp)
}

total_sectors = (int64_t) cyls * heads * secs_per_cyl;
total_size = total_sectors * BDRV_SECTOR_SIZE;

/* Prepare the Hard Disk Footer */
memset(buf, 0, 1024);
Expand All @@ -822,13 +823,8 @@ static int vpc_create(const char *filename, QemuOpts *opts, Error **errp)
/* Version of Virtual PC 2007 */
footer->major = cpu_to_be16(0x0005);
footer->minor = cpu_to_be16(0x0003);
if (disk_type == VHD_DYNAMIC) {
footer->orig_size = cpu_to_be64(total_sectors * 512);
footer->size = cpu_to_be64(total_sectors * 512);
} else {
footer->orig_size = cpu_to_be64(total_size);
footer->size = cpu_to_be64(total_size);
}
footer->orig_size = cpu_to_be64(total_size);
footer->size = cpu_to_be64(total_size);
footer->cyls = cpu_to_be16(cyls);
footer->heads = heads;
footer->secs_per_cyl = secs_per_cyl;
Expand Down
6 changes: 6 additions & 0 deletions block/vvfat.c
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,12 @@ static int enable_write_target(BDRVVVFATState *s, Error **errp)
}

bdrv_qcow = bdrv_find_format("qcow");
if (!bdrv_qcow) {
error_setg(errp, "Failed to locate qcow driver");
ret = -ENOENT;
goto err;
}

opts = qemu_opts_create(bdrv_qcow->create_opts, NULL, 0, &error_abort);
qemu_opt_set_number(opts, BLOCK_OPT_SIZE, s->sector_count * 512);
qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, "fat:");
Expand Down
4 changes: 4 additions & 0 deletions cpus.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,19 @@ static void icount_warp_rt(void *opaque)
void qtest_clock_warp(int64_t dest)
{
int64_t clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
AioContext *aio_context;
assert(qtest_enabled());
aio_context = qemu_get_aio_context();
while (clock < dest) {
int64_t deadline = qemu_clock_deadline_ns_all(QEMU_CLOCK_VIRTUAL);
int64_t warp = qemu_soonest_timeout(dest - clock, deadline);

seqlock_write_lock(&timers_state.vm_clock_seqlock);
timers_state.qemu_icount_bias += warp;
seqlock_write_unlock(&timers_state.vm_clock_seqlock);

qemu_clock_run_timers(QEMU_CLOCK_VIRTUAL);
timerlist_run_timers(aio_context->tlg.tl[QEMU_CLOCK_VIRTUAL]);
clock = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
}
qemu_clock_notify(QEMU_CLOCK_VIRTUAL);
Expand Down
4 changes: 2 additions & 2 deletions exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ static int cpu_common_pre_load(void *opaque)
{
CPUState *cpu = opaque;

cpu->exception_index = 0;
cpu->exception_index = -1;

return 0;
}
Expand All @@ -443,7 +443,7 @@ static bool cpu_common_exception_index_needed(void *opaque)
{
CPUState *cpu = opaque;

return cpu->exception_index != 0;
return tcg_enabled() && cpu->exception_index != -1;
}

static const VMStateDescription vmstate_cpu_common_exception_index = {
Expand Down
4 changes: 2 additions & 2 deletions hw/audio/sb16.c
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ static IO_READ_PROTO (dsp_read)
retval = (!s->out_data_len || s->highspeed) ? 0 : 0x80;
if (s->mixer_regs[0x82] & 1) {
ack = 1;
s->mixer_regs[0x82] &= 1;
s->mixer_regs[0x82] &= ~1;
qemu_irq_lower (s->pic);
}
break;
Expand All @@ -1008,7 +1008,7 @@ static IO_READ_PROTO (dsp_read)
retval = 0xff;
if (s->mixer_regs[0x82] & 2) {
ack = 1;
s->mixer_regs[0x82] &= 2;
s->mixer_regs[0x82] &= ~2;
qemu_irq_lower (s->pic);
}
break;
Expand Down
Loading