Compare commits

...
16 Commits
Author SHA1 Message Date
Aurelien Jarno b38d3f24d2 exec-all.h: increase MAX_OP_PER_INSTR to 96 from 64
The x86_64 ror instruction on a 32-bit host can generate up to 77 TCG
ops. Some more space should be left for opc that are added at the end
of the translation.

Thanks to Laurent Desnogues for the debugging help.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-22 23:33:44 +02:00
Aurelien Jarno 5c59f6c246 Fix Linux task preemption on Versatile board
Backport from master:

  Recent versions of the Linux kernel will not preempt CPU-intensive
  tasks unless the clock used by sched_clock() works.  On -M versatilepb
  that's the 24MHz timer in the system controller.  It's a very simple
  timer, so implement it.

Signed-off-by: Daniel Jacobowitz <dan@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-15 00:53:00 +02:00
Aurelien Jarno 36170c5faf curses: save 250MB of memory
Don't call curses_resize() at the end of curses_display_init() as height
and width are not yet defined. It will be called later by code from
vl.c.

This save 250MB of memory when using -curses.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-15 00:27:40 +02:00
Chris Webb c2723a9606 vnc: rework VncState release workflow
Split socket closing and releasing of VncState into two steps. First close
the socket and set the variable to -1 to indicate shutdown in progress. Do
the actual release in a few places where we can be sure it doesn't cause
trouble in form of use-after-free. Add some checks for a valid socket handle
to make sure we don't try to use the closed socket.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Backported to 0.10-stable, removing references to vs->force_update and
changing vnc_disconnect_finish() to match the code in the 0.10 version of
vnc_client_io_error() in place of the master branch version.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-27 05:23:11 -04:00
Zachary Amsden 07ca62486b Don't segfault when changing VNC password on an SDL display.
Signed-off-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:28:30 -04:00
Chris Lalancette 0cbbf2533e Fix detached migration with exec.
When trying to do detached migration with exec, I found that
the monitor wouldn't always return in a timely manner.  I
tracked this down to exec_start_outgoing_migration.  It
appeared we were setting the fd to NONBLOCK'ing, but in
point of fact we weren't.

This bugfix should also go onto the stable 0.10 branch

Signed-off-by: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:28:06 -04:00
Torsten Duwe f3c7245f23 BACKPORT: Fix segfault of qemu-system-arm with PXA target
qemu-system-arm (0.10.5) segfaults when invoked with a PXA machine target,
e.g. -M tosa. The reason is fairly obvious:

[backport: current code uses struct scoop_info_s instead of a typedef ]

Signed-off-by: Torsten Duwe <duwe@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrzej Zaborowski <balrogg@gmail.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:27:36 -04:00
Gleb Natapov d4779e9572 make windows notice media change
Windows seems to be very stupid about cdrom media change. It polls
cdrom status and if status goes ready->media not present->ready
it assumes that media was changed. If "media not present" step doesn't
happen even if "medium may have changed" was seen it assumes media
haven't changed. Fake "media not present" step.

Filip Navara did a great job debugging this issue in Windows and this is
what he found out:

BINGO! ... The media present notifications were broken ever since
Windows 2000 it seems. The media change is detected properly and it's
passed to ClassSetMediaChangeState function which in turn calls
ClasspInternalSetMediaChangeState. This function is responsible for
changing some internal state of the device object and sending the PnP
events which later result in application notifications. It has this
tiny bit of code (not copied byte for byte):

if (oldMediaState == NewState) {
  // Media is in the same state it was before.
  return;
}

so the end result is that for the case of UNIT NEEDS ATTENTION /
MEDIUM MAY HAVE CHANGED without NOT READY in-between is really broken.
It results in the internal media change counter incremented, so the
media contents are re-read when necessary, instead of relying on the
cache, but the notifications to applications are never sent.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-Id:

Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:22:06 -04:00
Bill Paul 18bae8a516 e1000.c doesn't properly emulate EERD and ICS registers
Once again, the emulation of the EERD and ICS registers in e1000.c is
incorrect. Nobody has noticed this before because none of the Intel-written
e1000 drivers use these registers, and all of the independently written open
source drivers copy Intel's example, so they don't use them either.
Regardless, these registers are documented in the programmer's manuals, and
their emulated behavior doesn't match the verified behavior of real hardware,
so any software that does use them doesn't function correctly.

-Bill

Signed-off-by: Bill Paul <wpaul@windriver.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:16:58 -04:00
Gerd Hoffmann 74ccfe8b7e BACKPORT: vnc: fix copyrect screen corruption
When sending a copyrect command to the vnc client, we must also update
the local server surface.  Otherwise the server's and the client's idea
of the screen content run out of sync and screen updates don't work
correctly.

[ backport: uses ds_get_data() instead of direct dereference ]
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:12:14 -04:00
Paolo Bonzini e24c7580cb fix migration to obey -S
Since migration returns right away, starting the VM right
after calling qemu_start_incoming_migration is wrong even
if -S is not passed.  We have to do this after migration
has completed.

Cc: Glauber Costa  <glommer@redhat.com>
Cc: Anthony Liguori  <aliguori@us.ibm.com>

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-08-25 16:07:34 -04:00
Glauber Costa f16f83481c fix broken migration
While fixing migration with -S, commit
89befdd1a6 broke the rest of us. Poor
glommer, with a poor family, spare him his life from this monstruosity.

Since the unconditional vm_start, not autostart was the villain, I'm putting
back autostart. Let me know if you prefer other solutions, it doesn't really matter,
doesn't really matter to me.

Any way the wind blows...

Signed-off-by: Glauber Costa <glommer@redhat.com>
CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-07-29 10:39:04 -04:00
Kevin Wolf b358a08e7b vmdk: Fix backing file handling
Instead of storing the backing file in its own BlockDriverState, VMDK uses the
BlockDriverState of the raw image file it opened. This is wrong and breaks
functions that access the backing file or protocols. This fix replaces all
occurrences of s->hd->backing_* with bs->backing_*.

This fixes qemu-iotests failure in 020 (Commit changes to backing file).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-07-23 10:39:19 -04:00
Nolan f81eed9ddb BACKPORT: Add save/restore support to the LSI logic SCSI device model.
This patch requires "Handle BH's queued by AIO completions in
qemu_aio_flush()" to work reliably.  The combination of those two
patches survived 300+ migrations with heavy IO load running in the
guest.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-07-23 10:38:13 -04:00
Nolan 0dd99a1e37 Handle BH's queued by AIO completions in qemu_aio_flush()
Without this, the call to qemu_aio_flush during migration doesn't
actually flush all in-flight SCSI IOs.

Signed-off-by: Nolan Leake <nolan <at> sigbus.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-07-23 10:37:30 -04:00
Naphtali Sprei 07fdfe83cf fix for bad macaddr of e1000 in Windows 2003 server with original MS driver
The sequence of reading from eeprom is "offset by one" moved because of a false
detection of a clock cycle after an eeprom reset. Keeping the last clock value
after a reset keeps it in sync.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
2009-07-20 10:14:11 -04:00
14 changed files with 341 additions and 85 deletions

No files matched your search

+1 -1
View File
@@ -112,7 +112,7 @@ void qemu_aio_flush(void)
LIST_FOREACH(node, &aio_handlers, node) {
ret |= node->io_flush(node->opaque);
}
} while (ret > 0);
} while (qemu_bh_poll() || ret > 0);
}
void qemu_aio_wait(void)
+15 -14
View File
@@ -169,7 +169,7 @@ static int vmdk_is_cid_valid(BlockDriverState *bs)
{
#ifdef CHECK_CID
BDRVVmdkState *s = bs->opaque;
BlockDriverState *p_bs = s->hd->backing_hd;
BlockDriverState *p_bs = bs->backing_hd;
uint32_t cur_pcid;
if (p_bs) {
@@ -337,26 +337,26 @@ static int vmdk_parent_open(BlockDriverState *bs, const char * filename)
p_name += sizeof("parentFileNameHint") + 1;
if ((end_name = strchr(p_name,'\"')) == 0)
return -1;
if ((end_name - p_name) > sizeof (s->hd->backing_file) - 1)
if ((end_name - p_name) > sizeof (bs->backing_file) - 1)
return -1;
pstrcpy(s->hd->backing_file, end_name - p_name + 1, p_name);
if (stat(s->hd->backing_file, &file_buf) != 0) {
pstrcpy(bs->backing_file, end_name - p_name + 1, p_name);
if (stat(bs->backing_file, &file_buf) != 0) {
path_combine(parent_img_name, sizeof(parent_img_name),
filename, s->hd->backing_file);
filename, bs->backing_file);
} else {
pstrcpy(parent_img_name, sizeof(parent_img_name),
s->hd->backing_file);
bs->backing_file);
}
s->hd->backing_hd = bdrv_new("");
if (!s->hd->backing_hd) {
bs->backing_hd = bdrv_new("");
if (!bs->backing_hd) {
failure:
bdrv_close(s->hd);
return -1;
}
parent_open = 1;
if (bdrv_open(s->hd->backing_hd, parent_img_name, BDRV_O_RDONLY) < 0)
if (bdrv_open(bs->backing_hd, parent_img_name, BDRV_O_RDONLY) < 0)
goto failure;
parent_open = 0;
}
@@ -463,13 +463,14 @@ static int get_whole_cluster(BlockDriverState *bs, uint64_t cluster_offset,
// we will be here if it's first write on non-exist grain(cluster).
// try to read from parent image, if exist
if (s->hd->backing_hd) {
BDRVVmdkState *ps = s->hd->backing_hd->opaque;
if (bs->backing_hd) {
BDRVVmdkState *ps = bs->backing_hd->opaque;
if (!vmdk_is_cid_valid(bs))
return -1;
parent_cluster_offset = get_cluster_offset(s->hd->backing_hd, NULL, offset, allocate);
parent_cluster_offset = get_cluster_offset(bs->backing_hd, NULL,
offset, allocate);
if (parent_cluster_offset) {
BDRVVmdkState *act_s = activeBDRV.hd->opaque;
@@ -620,10 +621,10 @@ static int vmdk_read(BlockDriverState *bs, int64_t sector_num,
n = nb_sectors;
if (!cluster_offset) {
// try to read from parent image, if exist
if (s->hd->backing_hd) {
if (bs->backing_hd) {
if (!vmdk_is_cid_valid(bs))
return -1;
ret = bdrv_read(s->hd->backing_hd, sector_num, buf, n);
ret = bdrv_read(bs->backing_hd, sector_num, buf, n);
if (ret < 0)
return -1;
} else {
-3
View File
@@ -370,7 +370,4 @@ void curses_display_init(DisplayState *ds, int full_screen)
ds->surface = qemu_create_displaysurface_from(640, 400, 0, 0, (uint8_t*) screen);
invalidate = 1;
/* Standard VGA initial text mode dimensions */
curses_resize(ds);
}
+1 -1
View File
@@ -35,7 +35,7 @@
typedef struct TranslationBlock TranslationBlock;
/* XXX: make safe guess about sizes */
#define MAX_OP_PER_INSTR 64
#define MAX_OP_PER_INSTR 96
/* A Call op needs up to 6 + 2N parameters (N = number of arguments). */
#define MAX_OPC_PARAM 10
#define OPC_BUF_SIZE 512
+2 -2
View File
@@ -8,6 +8,7 @@
*/
#include "hw.h"
#include "qemu-timer.h"
#include "primecell.h"
#include "sysemu.h"
@@ -70,8 +71,7 @@ static uint32_t arm_sysctl_read(void *opaque, target_phys_addr_t offset)
case 0x58: /* BOOTCS */
return 0;
case 0x5c: /* 24MHz */
/* ??? not implemented. */
return 0;
return muldiv64(qemu_get_clock(vm_clock), 24000000, ticks_per_sec);
case 0x60: /* MISC */
return 0;
case 0x84: /* PROCID0 */
+14 -4
View File
@@ -155,6 +155,7 @@ set_interrupt_cause(E1000State *s, int index, uint32_t val)
if (val)
val |= E1000_ICR_INT_ASSERTED;
s->mac_reg[ICR] = val;
s->mac_reg[ICS] = val;
qemu_set_irq(s->dev.irq[0], (s->mac_reg[IMS] & s->mac_reg[ICR]) != 0);
}
@@ -262,6 +263,11 @@ set_eecd(E1000State *s, int index, uint32_t val)
}
if (!(val & E1000_EECD_CS)) { // rising, no CS (EEPROM reset)
memset(&s->eecd_state, 0, sizeof s->eecd_state);
/*
* restore old_eecd's E1000_EECD_SK (known to be on)
* to avoid false detection of a clock edge
*/
s->eecd_state.old_eecd = E1000_EECD_SK;
return;
}
s->eecd_state.val_in <<= 1;
@@ -282,10 +288,14 @@ flash_eerd_read(E1000State *s, int x)
{
unsigned int index, r = s->mac_reg[EERD] & ~E1000_EEPROM_RW_REG_START;
if ((s->mac_reg[EERD] & E1000_EEPROM_RW_REG_START) == 0)
return (s->mac_reg[EERD]);
if ((index = r >> E1000_EEPROM_RW_ADDR_SHIFT) > EEPROM_CHECKSUM_REG)
return 0;
return (s->eeprom_data[index] << E1000_EEPROM_RW_REG_DATA) |
E1000_EEPROM_RW_REG_DONE | r;
return (E1000_EEPROM_RW_REG_DONE | r);
return ((s->eeprom_data[index] << E1000_EEPROM_RW_REG_DATA) |
E1000_EEPROM_RW_REG_DONE | r);
}
static void
@@ -774,7 +784,7 @@ static uint32_t (*macreg_readops[])(E1000State *, int) = {
getreg(WUFC), getreg(TDT), getreg(CTRL), getreg(LEDCTL),
getreg(MANC), getreg(MDIC), getreg(SWSM), getreg(STATUS),
getreg(TORL), getreg(TOTL), getreg(IMS), getreg(TCTL),
getreg(RDH), getreg(RDT), getreg(VET),
getreg(RDH), getreg(RDT), getreg(VET), getreg(ICS),
[TOTH] = mac_read_clr8, [TORH] = mac_read_clr8, [GPRC] = mac_read_clr4,
[GPTC] = mac_read_clr4, [TPR] = mac_read_clr4, [TPT] = mac_read_clr4,
+25 -13
View File
@@ -418,6 +418,7 @@ typedef struct IDEState {
/* ATAPI specific */
uint8_t sense_key;
uint8_t asc;
uint8_t cdrom_changed;
int packet_transfer_size;
int elementary_transfer_size;
int io_buffer_index;
@@ -1640,9 +1641,10 @@ static void ide_atapi_cmd(IDEState *s)
}
switch(s->io_buffer[0]) {
case GPCMD_TEST_UNIT_READY:
if (bdrv_is_inserted(s->bs)) {
if (bdrv_is_inserted(s->bs) && !s->cdrom_changed) {
ide_atapi_cmd_ok(s);
} else {
s->cdrom_changed = 0;
ide_atapi_cmd_error(s, SENSE_NOT_READY,
ASC_MEDIUM_NOT_PRESENT);
}
@@ -2102,7 +2104,7 @@ static void cdrom_change_cb(void *opaque)
s->sense_key = SENSE_UNIT_ATTENTION;
s->asc = ASC_MEDIUM_MAY_HAVE_CHANGED;
s->cdrom_changed = 1;
ide_set_irq(s);
}
@@ -2870,7 +2872,7 @@ static void ide_save(QEMUFile* f, IDEState *s)
}
/* load per IDE drive data */
static void ide_load(QEMUFile* f, IDEState *s)
static void ide_load(QEMUFile* f, IDEState *s, int version_id)
{
s->mult_sectors=qemu_get_be32(f);
s->identify_set=qemu_get_be32(f);
@@ -2894,6 +2896,13 @@ static void ide_load(QEMUFile* f, IDEState *s)
qemu_get_8s(f, &s->sense_key);
qemu_get_8s(f, &s->asc);
if (version_id == 3) {
qemu_get_8s(f, &s->cdrom_changed);
} else {
if (s->sense_key == SENSE_UNIT_ATTENTION &&
s->asc == ASC_MEDIUM_MAY_HAVE_CHANGED)
s->cdrom_changed = 1;
}
/* XXX: if a transfer is pending, we do not save it yet */
}
@@ -3215,7 +3224,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
PCIIDEState *d = opaque;
int ret, i;
if (version_id != 2)
if (version_id != 2 && version_id != 3)
return -EINVAL;
ret = pci_device_load(&d->dev, f);
if (ret < 0)
@@ -3245,7 +3254,7 @@ static int pci_ide_load(QEMUFile* f, void *opaque, int version_id)
/* per IDE drive data */
for(i = 0; i < 4; i++) {
ide_load(f, &d->ide_if[i]);
ide_load(f, &d->ide_if[i], version_id);
}
return 0;
}
@@ -3335,7 +3344,7 @@ void pci_cmd646_ide_init(PCIBus *bus, BlockDriverState **hd_table,
ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], irq[0]);
ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], irq[1]);
register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d);
qemu_register_reset(cmd646_reset, d);
cmd646_reset(d);
}
@@ -3394,7 +3403,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
if (hd_table[i])
hd_table[i]->private = &d->dev;
register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d);
}
/* hd_table must contain 4 block drivers */
@@ -3430,7 +3439,7 @@ void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
register_savevm("ide", 0, 2, pci_ide_save, pci_ide_load, d);
register_savevm("ide", 0, 3, pci_ide_save, pci_ide_load, d);
}
#if defined(TARGET_PPC)
@@ -3718,7 +3727,7 @@ static int pmac_ide_load(QEMUFile *f, void *opaque, int version_id)
uint8_t drive1_selected;
unsigned int i;
if (version_id != 1)
if (version_id != 1 && version_id != 3)
return -EINVAL;
/* per IDE interface data */
@@ -3728,7 +3737,7 @@ static int pmac_ide_load(QEMUFile *f, void *opaque, int version_id)
/* per IDE drive data */
for(i = 0; i < 2; i++) {
ide_load(f, &s[i]);
ide_load(f, &s[i], version_id);
}
return 0;
}
@@ -3759,7 +3768,7 @@ int pmac_ide_init (BlockDriverState **hd_table, qemu_irq irq,
pmac_ide_memory = cpu_register_io_memory(0, pmac_ide_read,
pmac_ide_write, d);
register_savevm("ide", 0, 1, pmac_ide_save, pmac_ide_load, d);
register_savevm("ide", 0, 3, pmac_ide_save, pmac_ide_load, d);
qemu_register_reset(pmac_ide_reset, d);
pmac_ide_reset(d);
@@ -4152,6 +4161,9 @@ static int md_load(QEMUFile *f, void *opaque, int version_id)
int i;
uint8_t drive1_selected;
if (version_id != 0 && version_id != 3)
return -EINVAL;
qemu_get_8s(f, &s->opt);
qemu_get_8s(f, &s->stat);
qemu_get_8s(f, &s->pins);
@@ -4165,7 +4177,7 @@ static int md_load(QEMUFile *f, void *opaque, int version_id)
s->ide->cur_drive = &s->ide[(drive1_selected != 0)];
for (i = 0; i < 2; i ++)
ide_load(f, &s->ide[i]);
ide_load(f, &s->ide[i], version_id);
return 0;
}
@@ -4396,7 +4408,7 @@ struct pcmcia_card_s *dscm1xxxx_init(BlockDriverState *bdrv)
md->ide->mdata_size = METADATA_SIZE;
md->ide->mdata_storage = (uint8_t *) qemu_mallocz(METADATA_SIZE);
register_savevm("microdrive", -1, 0, md_save, md_load, md);
register_savevm("microdrive", -1, 3, md_save, md_load, md);
return &md->card;
}
+173
View File
@@ -10,6 +10,8 @@
/* ??? Need to check if the {read,write}[wl] routines work properly on
big-endian targets. */
#include <assert.h> \
#include "hw.h"
#include "pci.h"
#include "scsi-disk.h"
@@ -1980,6 +1982,174 @@ void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id)
bd->private = &s->pci_dev;
}
static void lsi_scsi_save(QEMUFile *f, void *opaque)
{
LSIState *s = opaque;
assert(s->dma_buf == NULL);
assert(s->current_dma_len == 0);
assert(s->active_commands == 0);
pci_device_save(&s->pci_dev, f);
qemu_put_sbe32s(f, &s->carry);
qemu_put_sbe32s(f, &s->sense);
qemu_put_sbe32s(f, &s->msg_action);
qemu_put_sbe32s(f, &s->msg_len);
qemu_put_buffer(f, s->msg, sizeof (s->msg));
qemu_put_sbe32s(f, &s->waiting);
qemu_put_be32s(f, &s->dsa);
qemu_put_be32s(f, &s->temp);
qemu_put_be32s(f, &s->dnad);
qemu_put_be32s(f, &s->dbc);
qemu_put_8s(f, &s->istat0);
qemu_put_8s(f, &s->istat1);
qemu_put_8s(f, &s->dcmd);
qemu_put_8s(f, &s->dstat);
qemu_put_8s(f, &s->dien);
qemu_put_8s(f, &s->sist0);
qemu_put_8s(f, &s->sist1);
qemu_put_8s(f, &s->sien0);
qemu_put_8s(f, &s->sien1);
qemu_put_8s(f, &s->mbox0);
qemu_put_8s(f, &s->mbox1);
qemu_put_8s(f, &s->dfifo);
qemu_put_8s(f, &s->ctest2);
qemu_put_8s(f, &s->ctest3);
qemu_put_8s(f, &s->ctest4);
qemu_put_8s(f, &s->ctest5);
qemu_put_8s(f, &s->ccntl0);
qemu_put_8s(f, &s->ccntl1);
qemu_put_be32s(f, &s->dsp);
qemu_put_be32s(f, &s->dsps);
qemu_put_8s(f, &s->dmode);
qemu_put_8s(f, &s->dcntl);
qemu_put_8s(f, &s->scntl0);
qemu_put_8s(f, &s->scntl1);
qemu_put_8s(f, &s->scntl2);
qemu_put_8s(f, &s->scntl3);
qemu_put_8s(f, &s->sstat0);
qemu_put_8s(f, &s->sstat1);
qemu_put_8s(f, &s->scid);
qemu_put_8s(f, &s->sxfer);
qemu_put_8s(f, &s->socl);
qemu_put_8s(f, &s->sdid);
qemu_put_8s(f, &s->ssid);
qemu_put_8s(f, &s->sfbr);
qemu_put_8s(f, &s->stest1);
qemu_put_8s(f, &s->stest2);
qemu_put_8s(f, &s->stest3);
qemu_put_8s(f, &s->sidl);
qemu_put_8s(f, &s->stime0);
qemu_put_8s(f, &s->respid0);
qemu_put_8s(f, &s->respid1);
qemu_put_be32s(f, &s->mmrs);
qemu_put_be32s(f, &s->mmws);
qemu_put_be32s(f, &s->sfs);
qemu_put_be32s(f, &s->drs);
qemu_put_be32s(f, &s->sbms);
qemu_put_be32s(f, &s->dbms);
qemu_put_be32s(f, &s->dnad64);
qemu_put_be32s(f, &s->pmjad1);
qemu_put_be32s(f, &s->pmjad2);
qemu_put_be32s(f, &s->rbc);
qemu_put_be32s(f, &s->ua);
qemu_put_be32s(f, &s->ia);
qemu_put_be32s(f, &s->sbc);
qemu_put_be32s(f, &s->csbc);
qemu_put_buffer(f, (uint8_t *)s->scratch, sizeof (s->scratch));
qemu_put_8s(f, &s->sbr);
qemu_put_buffer(f, (uint8_t *)s->script_ram, sizeof (s->script_ram));
}
static int lsi_scsi_load(QEMUFile *f, void *opaque, int version_id)
{
LSIState *s = opaque;
int ret;
if (version_id > 0) {
return -EINVAL;
}
if ((ret = pci_device_load(&s->pci_dev, f)) < 0)
return ret;
qemu_get_sbe32s(f, &s->carry);
qemu_get_sbe32s(f, &s->sense);
qemu_get_sbe32s(f, &s->msg_action);
qemu_get_sbe32s(f, &s->msg_len);
qemu_get_buffer(f, s->msg, sizeof (s->msg));
qemu_get_sbe32s(f, &s->waiting);
qemu_get_be32s(f, &s->dsa);
qemu_get_be32s(f, &s->temp);
qemu_get_be32s(f, &s->dnad);
qemu_get_be32s(f, &s->dbc);
qemu_get_8s(f, &s->istat0);
qemu_get_8s(f, &s->istat1);
qemu_get_8s(f, &s->dcmd);
qemu_get_8s(f, &s->dstat);
qemu_get_8s(f, &s->dien);
qemu_get_8s(f, &s->sist0);
qemu_get_8s(f, &s->sist1);
qemu_get_8s(f, &s->sien0);
qemu_get_8s(f, &s->sien1);
qemu_get_8s(f, &s->mbox0);
qemu_get_8s(f, &s->mbox1);
qemu_get_8s(f, &s->dfifo);
qemu_get_8s(f, &s->ctest2);
qemu_get_8s(f, &s->ctest3);
qemu_get_8s(f, &s->ctest4);
qemu_get_8s(f, &s->ctest5);
qemu_get_8s(f, &s->ccntl0);
qemu_get_8s(f, &s->ccntl1);
qemu_get_be32s(f, &s->dsp);
qemu_get_be32s(f, &s->dsps);
qemu_get_8s(f, &s->dmode);
qemu_get_8s(f, &s->dcntl);
qemu_get_8s(f, &s->scntl0);
qemu_get_8s(f, &s->scntl1);
qemu_get_8s(f, &s->scntl2);
qemu_get_8s(f, &s->scntl3);
qemu_get_8s(f, &s->sstat0);
qemu_get_8s(f, &s->sstat1);
qemu_get_8s(f, &s->scid);
qemu_get_8s(f, &s->sxfer);
qemu_get_8s(f, &s->socl);
qemu_get_8s(f, &s->sdid);
qemu_get_8s(f, &s->ssid);
qemu_get_8s(f, &s->sfbr);
qemu_get_8s(f, &s->stest1);
qemu_get_8s(f, &s->stest2);
qemu_get_8s(f, &s->stest3);
qemu_get_8s(f, &s->sidl);
qemu_get_8s(f, &s->stime0);
qemu_get_8s(f, &s->respid0);
qemu_get_8s(f, &s->respid1);
qemu_get_be32s(f, &s->mmrs);
qemu_get_be32s(f, &s->mmws);
qemu_get_be32s(f, &s->sfs);
qemu_get_be32s(f, &s->drs);
qemu_get_be32s(f, &s->sbms);
qemu_get_be32s(f, &s->dbms);
qemu_get_be32s(f, &s->dnad64);
qemu_get_be32s(f, &s->pmjad1);
qemu_get_be32s(f, &s->pmjad2);
qemu_get_be32s(f, &s->rbc);
qemu_get_be32s(f, &s->ua);
qemu_get_be32s(f, &s->ia);
qemu_get_be32s(f, &s->sbc);
qemu_get_be32s(f, &s->csbc);
qemu_get_buffer(f, (uint8_t *)s->scratch, sizeof (s->scratch));
qemu_get_8s(f, &s->sbr);
qemu_get_buffer(f, (uint8_t *)s->script_ram, sizeof (s->script_ram));
return 0;
}
static int lsi_scsi_uninit(PCIDevice *d)
{
LSIState *s = (LSIState *) d;
@@ -2038,5 +2208,8 @@ void *lsi_scsi_init(PCIBus *bus, int devfn)
lsi_soft_reset(s);
register_savevm("lsiscsi", -1, 0, lsi_scsi_save, lsi_scsi_load, s);
return s;
}
+1 -1
View File
@@ -160,7 +160,7 @@ static CPUWriteMemoryFunc *scoop_writefn[] = {
void scoop_gpio_set(void *opaque, int line, int level)
{
struct scoop_info_s *s = (struct scoop_info_s *) s;
struct scoop_info_s *s = (struct scoop_info_s *) opaque;
if (level)
s->gpio_level |= (1 << line);
+3 -4
View File
@@ -74,10 +74,7 @@ MigrationState *exec_start_outgoing_migration(const char *command,
goto err_after_open;
}
if (fcntl(s->fd, F_SETFD, O_NONBLOCK) == -1) {
dprintf("Unable to set nonblocking mode on file descriptor\n");
goto err_after_open;
}
socket_set_nonblock(s->fd);
s->opaque = qemu_popen(f, "w");
@@ -122,6 +119,8 @@ static void exec_accept_incoming_migration(void *opaque)
dprintf("successfully loaded vm state\n");
/* we've successfully migrated, close the fd */
qemu_set_fd_handler2(qemu_popen_fd(f), NULL, NULL, NULL, NULL);
if (autostart)
vm_start();
err:
qemu_fclose(f);
+2
View File
@@ -170,6 +170,8 @@ static void tcp_accept_incoming_migration(void *opaque)
/* we've successfully migrated, close the server socket */
qemu_set_fd_handler2(s, NULL, NULL, NULL, NULL);
close(s);
if (autostart)
vm_start();
out_fopen:
qemu_fclose(f);
+1
View File
@@ -77,6 +77,7 @@ int tap_win32_init(VLANState *vlan, const char *model,
/* SLIRP */
void do_info_slirp(void);
extern int autostart;
extern int bios_size;
extern int cirrus_vga_enabled;
extern int std_vga_enabled;
+5 -3
View File
@@ -201,7 +201,7 @@ ram_addr_t ram_size;
int nb_nics;
NICInfo nd_table[MAX_NICS];
int vm_running;
static int autostart;
int autostart;
static int rtc_utc = 1;
static int rtc_date_offset = -1; /* -1 means no change */
int cirrus_vga_enabled = 1;
@@ -5721,10 +5721,12 @@ int main(int argc, char **argv, char **envp)
if (loadvm)
do_loadvm(loadvm);
if (incoming)
if (incoming) {
autostart = 0;
qemu_start_incoming_migration(incoming);
}
if (autostart)
else if (autostart)
vm_start();
if (daemonize) {
+98 -39
View File
@@ -200,6 +200,8 @@ static void vnc_write_u16(VncState *vs, uint16_t value);
static void vnc_write_u8(VncState *vs, uint8_t value);
static void vnc_flush(VncState *vs);
static void vnc_update_client(void *opaque);
static void vnc_disconnect_start(VncState *vs);
static void vnc_disconnect_finish(VncState *vs);
static void vnc_client_read(void *opaque);
static void vnc_colordepth(VncState *vs);
@@ -633,8 +635,14 @@ static void send_framebuffer_update(VncState *vs, int x, int y, int w, int h)
static void vnc_copy(VncState *vs, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
{
uint8_t *src_row;
uint8_t *dst_row;
int y,pitch,depth;
vnc_update_client(vs);
/* send bitblit op to the vnc client */
vnc_write_u8(vs, 0); /* msg id */
vnc_write_u8(vs, 0);
vnc_write_u16(vs, 1); /* number of rects */
@@ -642,18 +650,43 @@ static void vnc_copy(VncState *vs, int src_x, int src_y, int dst_x, int dst_y, i
vnc_write_u16(vs, src_x);
vnc_write_u16(vs, src_y);
vnc_flush(vs);
/* do bitblit op on the local surface too */
pitch = ds_get_linesize(vs->ds);
depth = ds_get_bytes_per_pixel(vs->ds);
src_row = ds_get_data(vs->ds) + pitch * src_y + depth * src_x;
dst_row = ds_get_data(vs->ds) + pitch * dst_y + depth * dst_x;
if (dst_y > src_y) {
/* copy backwards */
src_row += pitch * (h-1);
dst_row += pitch * (h-1);
pitch = -pitch;
}
for (y = 0; y < h; y++) {
memmove(dst_row, src_row, w * depth);
src_row += pitch;
dst_row += pitch;
}
}
static void vnc_dpy_copy(DisplayState *ds, int src_x, int src_y, int dst_x, int dst_y, int w, int h)
{
VncDisplay *vd = ds->opaque;
VncState *vs = vd->clients;
while (vs != NULL) {
VncState *vs, *vn;
for (vs = vd->clients; vs != NULL; vs = vn) {
vn = vs->next;
if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT)) {
vnc_update_client(vs);
/* vs might be free()ed here */
}
}
for (vs = vd->clients; vs != NULL; vs = vs->next) {
if (vnc_has_feature(vs, VNC_FEATURE_COPYRECT))
vnc_copy(vs, src_x, src_y, dst_x, dst_y, w, h);
else /* TODO */
vnc_update(vs, dst_x, dst_y, w, h);
vs = vs->next;
}
}
@@ -763,6 +796,8 @@ static void vnc_update_client(void *opaque)
if (vs->csock != -1) {
qemu_mod_timer(vs->timer, qemu_get_clock(rt_clock) + VNC_REFRESH_INTERVAL);
} else {
vnc_disconnect_finish(vs);
}
}
@@ -832,6 +867,47 @@ static void audio_del(VncState *vs)
}
}
static void vnc_disconnect_start(VncState *vs)
{
if (vs->csock == -1)
return;
qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL);
closesocket(vs->csock);
vs->csock = -1;
}
static void vnc_disconnect_finish(VncState *vs)
{
qemu_del_timer(vs->timer);
qemu_free_timer(vs->timer);
if (vs->input.buffer) qemu_free(vs->input.buffer);
if (vs->output.buffer) qemu_free(vs->output.buffer);
#ifdef CONFIG_VNC_TLS
if (vs->tls_session) {
gnutls_deinit(vs->tls_session);
vs->tls_session = NULL;
}
#endif /* CONFIG_VNC_TLS */
audio_del(vs);
VncState *p, *parent = NULL;
for (p = vs->vd->clients; p != NULL; p = p->next) {
if (p == vs) {
if (parent)
parent->next = p->next;
else
vs->vd->clients = p->next;
break;
}
parent = p;
}
if (!vs->vd->clients)
dcl->idle = 1;
qemu_free(vs->old_data);
qemu_free(vs);
}
static int vnc_client_io_error(VncState *vs, int ret, int last_errno)
{
if (ret == 0 || ret == -1) {
@@ -849,36 +925,7 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno)
}
VNC_DEBUG("Closing down client sock %d %d\n", ret, ret < 0 ? last_errno : 0);
qemu_set_fd_handler2(vs->csock, NULL, NULL, NULL, NULL);
closesocket(vs->csock);
qemu_del_timer(vs->timer);
qemu_free_timer(vs->timer);
if (vs->input.buffer) qemu_free(vs->input.buffer);
if (vs->output.buffer) qemu_free(vs->output.buffer);
#ifdef CONFIG_VNC_TLS
if (vs->tls_session) {
gnutls_deinit(vs->tls_session);
vs->tls_session = NULL;
}
#endif /* CONFIG_VNC_TLS */
audio_del(vs);
VncState *p, *parent = NULL;
for (p = vs->vd->clients; p != NULL; p = p->next) {
if (p == vs) {
if (parent)
parent->next = p->next;
else
vs->vd->clients = p->next;
break;
}
parent = p;
}
if (!vs->vd->clients)
dcl->idle = 1;
qemu_free(vs->old_data);
qemu_free(vs);
vnc_disconnect_start(vs);
return 0;
}
@@ -887,7 +934,8 @@ static int vnc_client_io_error(VncState *vs, int ret, int last_errno)
static void vnc_client_error(VncState *vs)
{
vnc_client_io_error(vs, -1, EINVAL);
VNC_DEBUG("Closing down client sock: protocol error\n");
vnc_disconnect_start(vs);
}
static void vnc_client_write(void *opaque)
@@ -947,8 +995,11 @@ static void vnc_client_read(void *opaque)
#endif /* CONFIG_VNC_TLS */
ret = recv(vs->csock, buffer_end(&vs->input), 4096, 0);
ret = vnc_client_io_error(vs, ret, socket_error());
if (!ret)
if (!ret) {
if (vs->csock == -1)
vnc_disconnect_finish(vs);
return;
}
vs->input.offset += ret;
@@ -957,8 +1008,10 @@ static void vnc_client_read(void *opaque)
int ret;
ret = vs->read_handler(vs, vs->input.buffer, len);
if (vs->csock == -1)
if (vs->csock == -1) {
vnc_disconnect_finish(vs);
return;
}
if (!ret) {
memmove(vs->input.buffer, vs->input.buffer + len, (vs->input.offset - len));
@@ -973,7 +1026,7 @@ static void vnc_write(VncState *vs, const void *data, size_t len)
{
buffer_reserve(&vs->output, len);
if (buffer_empty(&vs->output)) {
if (vs->csock != -1 && buffer_empty(&vs->output)) {
qemu_set_fd_handler2(vs->csock, NULL, vnc_client_read, vnc_client_write, vs);
}
@@ -1014,7 +1067,7 @@ static void vnc_write_u8(VncState *vs, uint8_t value)
static void vnc_flush(VncState *vs)
{
if (vs->output.offset)
if (vs->csock != -1 && vs->output.offset)
vnc_client_write(vs);
}
@@ -2282,11 +2335,13 @@ static void vnc_connect(VncDisplay *vd, int csock)
vnc_read_when(vs, protocol_version, 12);
memset(vs->old_data, 0, ds_get_linesize(vs->ds) * ds_get_height(vs->ds));
memset(vs->dirty_row, 0xFF, sizeof(vs->dirty_row));
vnc_update_client(vs);
reset_keys(vs);
vs->next = vd->clients;
vd->clients = vs;
vnc_update_client(vs);
/* vs might be free()ed here */
}
static void vnc_listen_read(void *opaque)
@@ -2415,6 +2470,10 @@ int vnc_display_password(DisplayState *ds, const char *password)
{
VncDisplay *vs = ds ? (VncDisplay *)ds->opaque : vnc_display;
if (!vs) {
return -1;
}
if (vs->password) {
qemu_free(vs->password);
vs->password = NULL;