Merge remote branch 'qmp/for-stable-0.13' into stable-0.13
diff --git a/VERSION b/VERSION
index 5cbf646..73b08a1 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.12.92
+0.12.93
diff --git a/block.c b/block.c
index e6087f3..85c8d3e 100644
--- a/block.c
+++ b/block.c
@@ -523,7 +523,6 @@
BlockDriver *drv)
{
int ret;
- int probed = 0;
if (flags & BDRV_O_SNAPSHOT) {
BlockDriverState *bs1;
@@ -584,7 +583,6 @@
/* Find the right image format driver */
if (!drv) {
ret = find_image_format(filename, &drv);
- probed = 1;
}
if (!drv) {
@@ -597,8 +595,6 @@
goto unlink_and_fail;
}
- bs->probed = probed;
-
/* If there is a backing file, use it */
if ((flags & BDRV_O_NO_BACKING) == 0 && bs->backing_file[0] != '\0') {
char backing_filename[PATH_MAX];
diff --git a/block/raw.c b/block/raw.c
index 61e6748..9108779 100644
--- a/block/raw.c
+++ b/block/raw.c
@@ -9,82 +9,15 @@
return 0;
}
-/* check for the user attempting to write something that looks like a
- block format header to the beginning of the image and fail out.
-*/
-static int check_for_block_signature(BlockDriverState *bs, const uint8_t *buf)
-{
- static const uint8_t signatures[][4] = {
- { 'Q', 'F', 'I', 0xfb }, /* qcow/qcow2 */
- { 'C', 'O', 'W', 'D' }, /* VMDK3 */
- { 'V', 'M', 'D', 'K' }, /* VMDK4 */
- { 'O', 'O', 'O', 'M' }, /* UML COW */
- {}
- };
- int i;
-
- for (i = 0; signatures[i][0] != 0; i++) {
- if (memcmp(buf, signatures[i], 4) == 0) {
- return 1;
- }
- }
-
- return 0;
-}
-
-static int check_write_unsafe(BlockDriverState *bs, int64_t sector_num,
- const uint8_t *buf, int nb_sectors)
-{
- /* assume that if the user specifies the format explicitly, then assume
- that they will continue to do so and provide no safety net */
- if (!bs->probed) {
- return 0;
- }
-
- if (sector_num == 0 && nb_sectors > 0) {
- return check_for_block_signature(bs, buf);
- }
-
- return 0;
-}
-
static int raw_read(BlockDriverState *bs, int64_t sector_num,
uint8_t *buf, int nb_sectors)
{
return bdrv_read(bs->file, sector_num, buf, nb_sectors);
}
-static int raw_write_scrubbed_bootsect(BlockDriverState *bs,
- const uint8_t *buf)
-{
- uint8_t bootsect[512];
-
- /* scrub the dangerous signature */
- memcpy(bootsect, buf, 512);
- memset(bootsect, 0, 4);
-
- return bdrv_write(bs->file, 0, bootsect, 1);
-}
-
static int raw_write(BlockDriverState *bs, int64_t sector_num,
const uint8_t *buf, int nb_sectors)
{
- if (check_write_unsafe(bs, sector_num, buf, nb_sectors)) {
- int ret;
-
- ret = raw_write_scrubbed_bootsect(bs, buf);
- if (ret < 0) {
- return ret;
- }
-
- ret = bdrv_write(bs->file, 1, buf + 512, nb_sectors - 1);
- if (ret < 0) {
- return ret;
- }
-
- return ret + 512;
- }
-
return bdrv_write(bs->file, sector_num, buf, nb_sectors);
}
@@ -95,73 +28,10 @@
return bdrv_aio_readv(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
}
-typedef struct RawScrubberBounce
-{
- BlockDriverCompletionFunc *cb;
- void *opaque;
- QEMUIOVector qiov;
-} RawScrubberBounce;
-
-static void raw_aio_writev_scrubbed(void *opaque, int ret)
-{
- RawScrubberBounce *b = opaque;
-
- if (ret < 0) {
- b->cb(b->opaque, ret);
- } else {
- b->cb(b->opaque, ret + 512);
- }
-
- qemu_iovec_destroy(&b->qiov);
- qemu_free(b);
-}
-
static BlockDriverAIOCB *raw_aio_writev(BlockDriverState *bs,
int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
BlockDriverCompletionFunc *cb, void *opaque)
{
- const uint8_t *first_buf;
- int first_buf_index = 0, i;
-
- /* This is probably being paranoid, but handle cases of zero size
- vectors. */
- for (i = 0; i < qiov->niov; i++) {
- if (qiov->iov[i].iov_len) {
- assert(qiov->iov[i].iov_len >= 512);
- first_buf_index = i;
- break;
- }
- }
-
- first_buf = qiov->iov[first_buf_index].iov_base;
-
- if (check_write_unsafe(bs, sector_num, first_buf, nb_sectors)) {
- RawScrubberBounce *b;
- int ret;
-
- /* write the first sector using sync I/O */
- ret = raw_write_scrubbed_bootsect(bs, first_buf);
- if (ret < 0) {
- return NULL;
- }
-
- /* adjust request to be everything but first sector */
-
- b = qemu_malloc(sizeof(*b));
- b->cb = cb;
- b->opaque = opaque;
-
- qemu_iovec_init(&b->qiov, qiov->nalloc);
- qemu_iovec_concat(&b->qiov, qiov, qiov->size);
-
- b->qiov.size -= 512;
- b->qiov.iov[first_buf_index].iov_base += 512;
- b->qiov.iov[first_buf_index].iov_len -= 512;
-
- return bdrv_aio_writev(bs->file, sector_num + 1, &b->qiov,
- nb_sectors - 1, raw_aio_writev_scrubbed, b);
- }
-
return bdrv_aio_writev(bs->file, sector_num, qiov, nb_sectors, cb, opaque);
}
diff --git a/block_int.h b/block_int.h
index b863451..e8e7156 100644
--- a/block_int.h
+++ b/block_int.h
@@ -148,7 +148,6 @@
int encrypted; /* if true, the media is encrypted */
int valid_key; /* if true, a valid encryption key has been set */
int sg; /* if true, the device is a /dev/sg* */
- int probed; /* if true, format was probed automatically */
/* event callback when inserting/removing */
void (*change_cb)(void *opaque);
void *change_opaque;
diff --git a/buffered_file.c b/buffered_file.c
index be147d6..1836e7e 100644
--- a/buffered_file.c
+++ b/buffered_file.c
@@ -156,6 +156,14 @@
offset = size;
}
+ if (pos == 0 && size == 0) {
+ DPRINTF("file is ready\n");
+ if (s->bytes_xfer <= s->xfer_limit) {
+ DPRINTF("notifying client\n");
+ s->put_ready(s->opaque);
+ }
+ }
+
return offset;
}
diff --git a/hw/escc.c b/hw/escc.c
index 6d2fd36..8714239 100644
--- a/hw/escc.c
+++ b/hw/escc.c
@@ -65,6 +65,8 @@
* 2006-Aug-10 Igor Kovalenko : Renamed KBDQueue to SERIOQueue, implemented
* serial mouse queue.
* Implemented serial mouse protocol.
+ *
+ * 2010-May-23 Artyom Tarasenko: Reworked IUS logic
*/
#ifdef DEBUG_SERIAL
@@ -279,7 +281,7 @@
static int escc_update_irq_chn(ChannelState *s)
{
- if ((((s->wregs[W_INTR] & INTR_TXINT) && s->txint == 1) ||
+ if ((((s->wregs[W_INTR] & INTR_TXINT) && (s->txint == 1)) ||
// tx ints enabled, pending
((((s->wregs[W_INTR] & INTR_RXMODEMSK) == INTR_RXINT1ST) ||
((s->wregs[W_INTR] & INTR_RXMODEMSK) == INTR_RXINTALL)) &&
@@ -342,24 +344,22 @@
static inline void set_rxint(ChannelState *s)
{
s->rxint = 1;
- if (!s->txint_under_svc) {
- s->rxint_under_svc = 1;
- if (s->chn == chn_a) {
- if (s->wregs[W_MINTR] & MINTR_STATUSHI)
- s->otherchn->rregs[R_IVEC] = IVEC_HIRXINTA;
- else
- s->otherchn->rregs[R_IVEC] = IVEC_LORXINTA;
- } else {
- if (s->wregs[W_MINTR] & MINTR_STATUSHI)
- s->rregs[R_IVEC] = IVEC_HIRXINTB;
- else
- s->rregs[R_IVEC] = IVEC_LORXINTB;
- }
- }
- if (s->chn == chn_a)
+ /* XXX: missing daisy chainnig: chn_b rx should have a lower priority
+ than chn_a rx/tx/special_condition service*/
+ s->rxint_under_svc = 1;
+ if (s->chn == chn_a) {
s->rregs[R_INTR] |= INTR_RXINTA;
- else
+ if (s->wregs[W_MINTR] & MINTR_STATUSHI)
+ s->otherchn->rregs[R_IVEC] = IVEC_HIRXINTA;
+ else
+ s->otherchn->rregs[R_IVEC] = IVEC_LORXINTA;
+ } else {
s->otherchn->rregs[R_INTR] |= INTR_RXINTB;
+ if (s->wregs[W_MINTR] & MINTR_STATUSHI)
+ s->rregs[R_IVEC] = IVEC_HIRXINTB;
+ else
+ s->rregs[R_IVEC] = IVEC_LORXINTB;
+ }
escc_update_irq(s);
}
@@ -369,19 +369,17 @@
if (!s->rxint_under_svc) {
s->txint_under_svc = 1;
if (s->chn == chn_a) {
+ s->rregs[R_INTR] |= INTR_TXINTA;
if (s->wregs[W_MINTR] & MINTR_STATUSHI)
s->otherchn->rregs[R_IVEC] = IVEC_HITXINTA;
else
s->otherchn->rregs[R_IVEC] = IVEC_LOTXINTA;
} else {
s->rregs[R_IVEC] = IVEC_TXINTB;
+ s->otherchn->rregs[R_INTR] |= INTR_TXINTB;
}
- }
- if (s->chn == chn_a)
- s->rregs[R_INTR] |= INTR_TXINTA;
- else
- s->otherchn->rregs[R_INTR] |= INTR_TXINTB;
escc_update_irq(s);
+ }
}
static inline void clr_rxint(ChannelState *s)
@@ -417,6 +415,7 @@
s->otherchn->rregs[R_IVEC] = IVEC_LONOINT;
s->rregs[R_INTR] &= ~INTR_TXINTA;
} else {
+ s->otherchn->rregs[R_INTR] &= ~INTR_TXINTB;
if (s->wregs[W_MINTR] & MINTR_STATUSHI)
s->rregs[R_IVEC] = IVEC_HINOINT;
else
@@ -515,10 +514,15 @@
clr_txint(s);
break;
case CMD_CLR_IUS:
- if (s->rxint_under_svc)
- clr_rxint(s);
- else if (s->txint_under_svc)
- clr_txint(s);
+ if (s->rxint_under_svc) {
+ s->rxint_under_svc = 0;
+ if (s->txint) {
+ set_txint(s);
+ }
+ } else if (s->txint_under_svc) {
+ s->txint_under_svc = 0;
+ }
+ escc_update_irq(s);
break;
default:
break;
diff --git a/hw/slavio_timer.c b/hw/slavio_timer.c
index d787553..c125de4 100644
--- a/hw/slavio_timer.c
+++ b/hw/slavio_timer.c
@@ -377,12 +377,12 @@
curr_timer->limit = 0;
curr_timer->count = 0;
curr_timer->reached = 0;
- if (i < s->num_cpus) {
+ if (i <= s->num_cpus) {
ptimer_set_limit(curr_timer->timer,
LIMIT_TO_PERIODS(TIMER_MAX_COUNT32), 1);
ptimer_run(curr_timer->timer, 0);
+ curr_timer->running = 1;
}
- curr_timer->running = 1;
}
s->cputimer_mode = 0;
}
diff --git a/ui/vnc.c b/ui/vnc.c
index 7fc40ac..c7a1831 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -1184,7 +1184,7 @@
vnc_lock_output(vs);
if (vs->output.offset) {
vnc_client_write_locked(opaque);
- } else {
+ } else if (vs->csock != -1) {
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, NULL, vs);
}
vnc_unlock_output(vs);