qemu
14 years agovmstate: port pckbd device
Juan Quintela [Thu, 10 Sep 2009 01:04:41 +0000 (03:04 +0200)]
vmstate: port pckbd device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: port vmmouse device
Juan Quintela [Thu, 10 Sep 2009 01:04:40 +0000 (03:04 +0200)]
vmstate: port vmmouse device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: port dma device
Juan Quintela [Thu, 10 Sep 2009 01:04:39 +0000 (03:04 +0200)]
vmstate: port dma device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: add support for arrays of uint16_t
Juan Quintela [Thu, 10 Sep 2009 01:04:38 +0000 (03:04 +0200)]
vmstate: add support for arrays of uint16_t

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: port fdc device
Juan Quintela [Thu, 10 Sep 2009 01:04:37 +0000 (03:04 +0200)]
vmstate: port fdc device

We can't move fifo back to an embeded array because it needs to be aligned

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: add support for uint8_t equal
Juan Quintela [Thu, 10 Sep 2009 01:04:36 +0000 (03:04 +0200)]
vmstate: add support for uint8_t equal

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: port i8259 device
Juan Quintela [Thu, 10 Sep 2009 01:04:35 +0000 (03:04 +0200)]
vmstate: port i8259 device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: port fw_cfg device
Juan Quintela [Thu, 10 Sep 2009 01:04:34 +0000 (03:04 +0200)]
vmstate: port fw_cfg device

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: port cpu_comon
Juan Quintela [Thu, 10 Sep 2009 01:04:33 +0000 (03:04 +0200)]
vmstate: port cpu_comon

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: Add pre/post_save() hooks
Juan Quintela [Thu, 10 Sep 2009 01:04:32 +0000 (03:04 +0200)]
vmstate: Add pre/post_save() hooks

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: Add pre_load() hook
Juan Quintela [Thu, 10 Sep 2009 01:04:31 +0000 (03:04 +0200)]
vmstate: Add pre_load() hook

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: rename run_after_load() -> post_load()
Juan Quintela [Thu, 10 Sep 2009 01:04:30 +0000 (03:04 +0200)]
vmstate: rename run_after_load() -> post_load()

This naming was used in kvm tree, and is easier to remember

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovmstate: add sensible arguments to vmstate_unregister()
Juan Quintela [Thu, 10 Sep 2009 01:04:29 +0000 (03:04 +0200)]
vmstate: add sensible arguments to vmstate_unregister()

vmsd alone is not enugh, because we can have several structs saved with the same description (vmsd).

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoMake get_ticks_per_sec() a static inline
Anthony Liguori [Fri, 11 Sep 2009 15:28:26 +0000 (10:28 -0500)]
Make get_ticks_per_sec() a static inline

ticks_per_sec is a constant.  There's no need to store it as a variable as it
never changes since our time is based on units.

Convert get_ticks_per_sec() to a static inline and move the constant into
qemu-timer.h.  Remove all references to QEMU_TIMER_BASE so that we consistently
use this interface.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agotimers: move them to VMState
Juan Quintela [Thu, 10 Sep 2009 01:04:28 +0000 (03:04 +0200)]
timers: move them to VMState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agotimers: Createt TimersState and put all timers state there
Juan Quintela [Thu, 10 Sep 2009 01:04:27 +0000 (03:04 +0200)]
timers: Createt TimersState and put all timers state there

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoUnexport ticks_per_sec variable. Create get_ticks_per_sec() function
Juan Quintela [Thu, 10 Sep 2009 01:04:26 +0000 (03:04 +0200)]
Unexport ticks_per_sec variable. Create get_ticks_per_sec() function

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agotimers: remove useless check
Juan Quintela [Thu, 10 Sep 2009 01:04:25 +0000 (03:04 +0200)]
timers: remove useless check

loadvm_state is called from: vl.c during startup, vmstart() is called after finishing loading.  The other caller do_loadvm() does the call after a vm_stop().  At both places where we can be saving state we are stoped a few lines before

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoRemove SaveVM v2 support
Juan Quintela [Thu, 10 Sep 2009 01:04:24 +0000 (03:04 +0200)]
Remove SaveVM v2 support

In previosu series I remove v2 support for RAM (that was the version that was
supported when SaveVM v3 appeared).  Now we can't load RAM for any image saved in SaveVM v2, we can as well remove SaveVM v2 entirely.

Note: That SaveVM RAM was at v2 when General SaveVM support went from v2 to v3 makes talking about versions confusing at least

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoram: Remove SaveVM Version 2 support
Juan Quintela [Thu, 10 Sep 2009 01:04:23 +0000 (03:04 +0200)]
ram: Remove SaveVM Version 2 support

It don't work.  It fails in this check

        if (qemu_get_be32(f) != last_ram_offset)

With 512MB of ram, values were for me:

v = 20c00000 last_ram_offset = 20840000

Last time that some code changed that was this one.

    commit 94a6b54fd6d2d3321066cb4db7abeeb417af9365
    Implement dynamic guest ram allocation.
    (I.e. it has been broken since at least April)

Going back to the previous commit, ram load correctly, but vga screen gets
corrupted and ide don't load correctly.  At this point I decide that removing
support is the only viable thing.

The last user of the ram_compress_* were RAM_SAVE_FLAG_FULL flag, but
that flag was never ever been stored in an image. Mark the flag obsolete
and remove the functions.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoram: remove support for loading v1
Juan Quintela [Thu, 10 Sep 2009 01:04:22 +0000 (03:04 +0200)]
ram: remove support for loading v1

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomove mux focus field from CharDriverState to MuxDriver
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:55 +0000 (10:58 +0200)]
move mux focus field from CharDriverState to MuxDriver

Now that monitor stopped using focus we can make it internal
to the mux driver.

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

14 years agomonitor: fix muxing
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:54 +0000 (10:58 +0200)]
monitor: fix muxing

make the mux driver send mux_in and mux_out events when switching
focus while hooking up more handlers.

stop using CharDriverState->focus in monitor.c, track state using
the mux events instead.  This also removes the implicit assumtion
that a muxed monitor allways has mux channel 0.

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

14 years agoqdev: add parser for chardev properties
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:53 +0000 (10:58 +0200)]
qdev: add parser for chardev properties

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

14 years agoAllow -serial chardev:<name>
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:52 +0000 (10:58 +0200)]
Allow -serial chardev:<name>

Lets put -chardev into use now.  With this patch applied chardev:name is
accepted as chardev specification everywhere, i.e. now you can:

-chardev stdio,id=ttyS0
-serial chardev:ttyS0

which does the same as '-serial stdio".

Muxing can be done this way:

-chardev stdio,id=mux,mux=on
-serial chardev:mux
-monitor chardev:mux

You can mux more than two streams.

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

14 years agoconvert udp chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:51 +0000 (10:58 +0200)]
convert udp chardev to QemuOpts.

While being at it: create a new inet_dgram_opts() function for udp setup,
so udp can handle IPv6 now.

new cmd line syntax:
    -chardev udp,id=name,host=remotehost,port=remoteport,\
localaddr=bindaddr,localport=bindport

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

14 years agoconvert mux chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:50 +0000 (10:58 +0200)]
convert mux chardev to QemuOpts.

new cmd line syntax:  you can add mux=1 to any chardev to enable muxing,
then attach it multiple times, like this:

-chardev pty,name=mux,mux=on

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

14 years agoconvert vc chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:49 +0000 (10:58 +0200)]
convert vc chardev to QemuOpts.

new cmd line syntax:
    -chardev vc,id=name
    -chardev vc,id=name,width=pixels,height=pixels
    -chardev vc,id=name,cols=chars,rows=chars

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

14 years agoconvert tty + parport chardevs to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:48 +0000 (10:58 +0200)]
convert tty + parport chardevs to QemuOpts.

new cmd line syntax:
    -chardev tty,id=name,path=/dev/tty*
    -chardev parport,id=name,path=/dev/parport*

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

14 years agoconvert windows console chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:47 +0000 (10:58 +0200)]
convert windows console chardev to QemuOpts.

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

14 years agoconvert braille chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:46 +0000 (10:58 +0200)]
convert braille chardev to QemuOpts.

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

14 years agoconvert msmouse chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:45 +0000 (10:58 +0200)]
convert msmouse chardev to QemuOpts.

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

14 years agoconvert stdio chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:44 +0000 (10:58 +0200)]
convert stdio chardev to QemuOpts.

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

14 years agoconvert pty chardev to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:43 +0000 (10:58 +0200)]
convert pty chardev to QemuOpts.

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

14 years agoconvert unix+tcp chardevs to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:42 +0000 (10:58 +0200)]
convert unix+tcp chardevs to QemuOpts.

new cmd line syntax:
  unix socket:
    -chardev socket,id=name,path=/path/to/socket
  tcp socket:
    -chardev socket,id=name,host=hostaddr|ipaddr,port=portnr

server and nowait options work as usual.  Alternatively you can use
server=[on|off] + wait=[on|off] syntax.

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

14 years agosockets: add inet_listen_opts
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:41 +0000 (10:58 +0200)]
sockets: add inet_listen_opts

Add inet_listen_opts().  Does the same as inet_listen(), but uses
QemuOpts.  inet_listen() is a compatibility wrapper for
inet_listen_opts() now and should go away some day.

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

14 years agosockets: add inet_connect_opts
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:40 +0000 (10:58 +0200)]
sockets: add inet_connect_opts

Add inet_connect_opts().  Does the same as inet_connect(), but uses
QemuOpts.  inet_connect() is a compatibility wrapper for
inet_connect_opts() now and should go away some day.

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

14 years agosockets: add unix_*_opts for windows.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:39 +0000 (10:58 +0200)]
sockets: add unix_*_opts for windows.

Add unix_*_opts function dummys for windows.

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

14 years agosockets: add unix_listen_opts
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:38 +0000 (10:58 +0200)]
sockets: add unix_listen_opts

Add unix_listen_opts().  Does the same as unix_listen(), but uses
QemuOpts.  unix_listen() is a compatibility wrapper for
unix_listen_opts() now and should go away some day.

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

14 years agosockets: add unix_connect_opts
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:37 +0000 (10:58 +0200)]
sockets: add unix_connect_opts

Add unix_connect_opts().  Does the same as unix_connect(), but uses
QemuOpts.  unix_connect() is a compatibility wrapper for
unix_connect_opts() now and should go away some day.

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

14 years agoconvert file+pipe chardevs to QemuOpts.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:36 +0000 (10:58 +0200)]
convert file+pipe chardevs to QemuOpts.

new cmd line syntax:
    -chardev file,id=name,path=/path/to/file
    -chardev pipe,id=name,path=/path/to/pipe

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

14 years agoswitch chardev to QemuOpts: infrastructure, null device
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:35 +0000 (10:58 +0200)]
switch chardev to QemuOpts: infrastructure, null device

start switching chardevs to QemuOpts.  This patch adds the
infrastructure and converts the null device.

The patch brings two new functions:

qemu_chr_open_opts()
same as qemu_chr_open(), but uses QemuOpts instead of a
option char string.

qemu_chr_parse_compat()
accepts a traditional chardev option string, returns the
corresponding QemuOpts instance, to handle backward
compatibility.

The patch also adds a new -chardev switch which can be used to create
named+unconnected chardevs, like this:

-chardev null,id=test

This uses the new qemu_chr_open_opts.  Thus with this patch alone only
the null device works.  The other devices will follow ...

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

14 years agoqemu-option.h include protectors
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:34 +0000 (10:58 +0200)]
qemu-option.h include protectors

qemu-option.h has no protection against including it twice.
This patch adds the usual "#ifndef header" bits.

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

14 years agoQemuOpts: split option parser into two functions.
Gerd Hoffmann [Thu, 10 Sep 2009 08:58:33 +0000 (10:58 +0200)]
QemuOpts: split option parser into two functions.

looking for id= and creating a new QemuOpts instance is splitted from
the actual option parser code now, so the parser can be called from
other contexts too.

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

14 years agoqdev: Fix i6300 upcast
Markus Armbruster [Fri, 4 Sep 2009 22:13:04 +0000 (00:13 +0200)]
qdev: Fix i6300 upcast

Use DO_UPCAST() instead of container_of() to go from PCIDevice to
I6300State.  This ensures that PCIDevice is the first member of struct
I6300State.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoVirtIO: Fix QEMU crash during Windows PNP tests
Yan Vugenfirer [Tue, 8 Sep 2009 14:49:41 +0000 (10:49 -0400)]
VirtIO: Fix QEMU crash during Windows PNP tests

Hello,

In some cases bus driver can deassert "bus master" bit in PCI command
register. The driver will no longer be able to update related registers in
the device. Eventually it will cause QEMU to exit in "virtqueue_num_heads"
function.

Attached path that fixes the described issue.

Best regards,
Yan Vugenfirer.

>From 3fdafbdfad676ec8479dc073cff70bf356868bfe Mon Sep 17 00:00:00 2001
From: Yan Vugenfirer <yvugenfi@redhat.com>
Date: Tue, 8 Sep 2009 10:08:14 -0400
Subject: [PATCH] VirtIO: Fix QEMU crash during Windows PNP tests

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovirtio-blk: add volatile writecache feature
Christoph Hellwig [Fri, 4 Sep 2009 17:02:23 +0000 (19:02 +0200)]
virtio-blk: add volatile writecache feature

Add a new VIRTIO_BLK_F_WCACHE feature to virtio-blk to indicate that we have
a volatile write cache that needs controlled flushing.  Implement a
VIRTIO_BLK_T_FLUSH operation to flush it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoide: use bdrv_aio_flush
Christoph Hellwig [Fri, 4 Sep 2009 17:02:06 +0000 (19:02 +0200)]
ide: use bdrv_aio_flush

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoblock: add aio_flush operation
Christoph Hellwig [Fri, 4 Sep 2009 17:01:49 +0000 (19:01 +0200)]
block: add aio_flush operation

Instead stalling the VCPU while serving a cache flush try to do it
asynchronously.  Use our good old helper thread pool to issue an
asynchronous fdatasync for raw-posix.  Note that while Linux AIO
implements a fdatasync operation it is not useful for us because
it isn't actually implement in asynchronous fashion.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoblock: use fdatasync instead of fsync if possible
Christoph Hellwig [Fri, 4 Sep 2009 17:01:32 +0000 (19:01 +0200)]
block: use fdatasync instead of fsync if possible

If we are flushing the caches for our image files we only care about the
data (including the metadata required for accessing it) but not things
like timestamp updates.  So try to use fdatasync instead of fsync to
implement the flush operations.

Unfortunately many operating systems still do not support fdatasync,
so we add a qemu_fdatasync wrapper that uses fdatasync if available
as per the _POSIX_SYNCHRONIZED_IO feature macro or fsync otherwise.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoblock: add enable_write_cache flag
Christoph Hellwig [Fri, 4 Sep 2009 17:01:15 +0000 (19:01 +0200)]
block: add enable_write_cache flag

Add a enable_write_cache flag in the block driver state, and use it to
decide if we claim to have a volatile write cache that needs controlled
flushing from the guest.  The flag is off if cache=writethrough is
defined because O_DSYNC guarantees that every write goes to stable
storage, and it is on for cache=none and cache=writeback.

Both scsi-disk and ide now use the new flage, changing from their
defaults of always off (ide) or always on (scsi-disk).

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqemu: init all queues to NO_VECTOR value
Michael S. Tsirkin [Mon, 7 Sep 2009 18:20:15 +0000 (21:20 +0300)]
qemu: init all queues to NO_VECTOR value

initialize vectors for all vqs to VIRTIO_NO_VECTOR rather than 0 which
is a valid vector. This fixes migration which happened before driver
was loaded.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Amit Shah <amit.shah@redhat.com>
Tested-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqemu: make virtio-blk PCI compliant by default
Michael S. Tsirkin [Mon, 7 Sep 2009 18:14:37 +0000 (21:14 +0300)]
qemu: make virtio-blk PCI compliant by default

commit bf011293faaa7f87e4de83185931e7411b794128 made virtio-blk-pci not
PCI-compliant, since it makes region 0 (which is an i/o region)
size > 256, and, since PCI 2.1, i/o regions are limited to 256 bytes size.

When the ATA serial number feature is off, which is the default,
make the device spec compliant again, by making region 0 smaller.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reported-by: Vadim Rozenfeld <vrozenfe@redhat.com>
Tested-by: Vadim Rozenfeld <vrozenfe@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agousb-linux.c: fix buffer overflow
Jim Paris [Mon, 24 Aug 2009 18:56:12 +0000 (14:56 -0400)]
usb-linux.c: fix buffer overflow

In usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and
length to the kernel.  However, the length was provided by the caller
of dev->handle_packet, and is not checked, so the kernel might provide
too much data and overflow our buffer.

For example, hw/usb-uhci.c could set the length to 2047.
hw/usb-ohci.c looks like it might go up to 4096 or 8192.

This causes a qemu crash, as reported here:
  http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html

This patch increases the usb-linux.c buffer size to 2048 to fix the
specific device reported, and adds a check to avoid the overflow in
any case.

Signed-off-by: Jim Paris <jim@jtan.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFix conditional compilation (MIPS host)
Stefan Weil [Sun, 6 Sep 2009 17:55:12 +0000 (19:55 +0200)]
Fix conditional compilation (MIPS host)

Compilation for MIPS host (not part of official QEMU)
checks __mips_isa_rev which is not always defined.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agovirtio-blk: Use bdrv_aio_multiwrite
Kevin Wolf [Wed, 9 Sep 2009 15:53:38 +0000 (17:53 +0200)]
virtio-blk: Use bdrv_aio_multiwrite

It is quite common for virtio-blk to submit more than one write request in a
row to the qemu block layer. Use bdrv_aio_multiwrite to allow block drivers to
optimize its handling of the requests.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoAdd bdrv_aio_multiwrite
Kevin Wolf [Wed, 9 Sep 2009 15:53:37 +0000 (17:53 +0200)]
Add bdrv_aio_multiwrite

One performance problem of qcow2 during the initial image growth are
sequential writes that are not cluster aligned. In this case, when a first
requests requires to allocate a new cluster but writes only to the first
couple of sectors in that cluster, the rest of the cluster is zeroed - just
to be overwritten by the following second request that fills up the cluster.

Let's try to merge sequential write requests to the same cluster, so we can
avoid to write the zero padding to the disk in the first place.

As a nice side effect, also other formats take advantage of dealing with less
and larger requests.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoRevert "don't call cpu_sychronize_state from reset handlers"
Anthony Liguori [Thu, 10 Sep 2009 13:45:43 +0000 (08:45 -0500)]
Revert "don't call cpu_sychronize_state from reset handlers"

This reverts commit 733318ea9c6d846a6a047b87619e7d9d6e9707d1.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomicroblaze: Trap if QEMU finds an unknown insns.
Edgar E. Iglesias [Fri, 11 Sep 2009 08:38:31 +0000 (10:38 +0200)]
microblaze: Trap if QEMU finds an unknown insns.

If PVR settings enable illegal insn trap, trap when QEMU finds an
insn it knows nothing about.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agomicroblaze: Correct prio between MMU and unaligned exceptions.
Edgar E. Iglesias [Fri, 11 Sep 2009 08:35:27 +0000 (10:35 +0200)]
microblaze: Correct prio between MMU and unaligned exceptions.

The microblaze gives MMU faults priority. For stores we still
have a flaw that the value leaks to memory in the case of an
unaligned exception.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agomicroblaze: HW Exception fixes.
Edgar E. Iglesias [Fri, 11 Sep 2009 08:27:38 +0000 (10:27 +0200)]
microblaze: HW Exception fixes.

* Correct PVR checks for masking off individual exceptions.
* Correct FPU exception code.
* Set EAR on unaligned and unassigned exceptions.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>

14 years agoUpdate OpenBIOS images to r577
Aurelien Jarno [Fri, 11 Sep 2009 07:13:04 +0000 (09:13 +0200)]
Update OpenBIOS images to r577

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>

14 years agoX86_64: Use proper jumps/calls when displacement exceeds +-2G
malc [Thu, 3 Sep 2009 00:20:01 +0000 (04:20 +0400)]
X86_64: Use proper jumps/calls when displacement exceeds +-2G

Signed-off-by: malc <av1474@comtv.ru>

14 years agoRemove bit-rotten threshold handling
malc [Thu, 10 Sep 2009 17:08:53 +0000 (21:08 +0400)]
Remove bit-rotten threshold handling

Thanks to Toshiya Takeda for bringing up an unrelated issue which led
to this.

Signed-off-by: malc <av1474@comtv.ru>

14 years agoF_DUPFD_CLOEXEC is not universally available
malc [Sun, 6 Sep 2009 02:31:59 +0000 (06:31 +0400)]
F_DUPFD_CLOEXEC is not universally available

The same issue (and the same patch to the byte) was experienced/proposed
by Vince Weaver.

Signed-off-by: malc <av1474@comtv.ru>

14 years agoAdd information w.r.t default GUS IRQ assigment
malc [Thu, 10 Sep 2009 16:05:59 +0000 (20:05 +0400)]
Add information w.r.t default GUS IRQ assigment

14 years agoFix formatting
malc [Thu, 10 Sep 2009 15:59:50 +0000 (19:59 +0400)]
Fix formatting

14 years agoFix formatting, get rid of conf and fix description
malc [Thu, 10 Sep 2009 15:59:41 +0000 (19:59 +0400)]
Fix formatting, get rid of conf and fix description

14 years agoFix formatting and and description field
malc [Thu, 10 Sep 2009 15:59:00 +0000 (19:59 +0400)]
Fix formatting and and description field

14 years agoqdev/isa: convert real time clock
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:35 +0000 (11:43 +0200)]
qdev/isa: convert real time clock

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev/isa: finish pckbd conversion
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:34 +0000 (11:43 +0200)]
qdev/isa: finish pckbd conversion

drop old init path and switch remaining users to
isa_create_simple().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev/isa: convert ne2000
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:33 +0000 (11:43 +0200)]
qdev/isa: convert ne2000

Also split the isa bits into a separate source file, so we don't drag in
a dependency for isa-bus.o for machines which want ne2k_pci only.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev/isa: convert gravis ultrasound
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:32 +0000 (11:43 +0200)]
qdev/isa: convert gravis ultrasound

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev/isa: convert cs4231a sound card
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:31 +0000 (11:43 +0200)]
qdev/isa: convert cs4231a sound card

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev/isa: convert soundblaster
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:30 +0000 (11:43 +0200)]
qdev/isa: convert soundblaster

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev: add isa_create() function
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:29 +0000 (11:43 +0200)]
qdev: add isa_create() function

Like isa_create_simple, but doesn't call qdev_init, so one can set
properties after creating and before initializing the device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev: tag isabus-bridge as no-user
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:28 +0000 (11:43 +0200)]
qdev: tag isabus-bridge as no-user

isabus-bridge isn't supposed to be added via -device ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev: simplify isa irq assignments
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:27 +0000 (11:43 +0200)]
qdev: simplify isa irq assignments

isa-bus owns the isa irqs now, so it can hand them out directly.
There is no need for the separate isa_connect_irqs step, drop it.

Also hard-code isa interrupts which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev: drop iobase properties from isa bus
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:26 +0000 (11:43 +0200)]
qdev: drop iobase properties from isa bus

Lot of ISA devices work at fixed addresses, so having iobase
as bus property doesn't make much sense.  Devices which can
have different iobases will get a device property.

Also simply hard-code stuff which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoqdev: add property type for 32bit signed integers.
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:25 +0000 (11:43 +0200)]
qdev: add property type for 32bit signed integers.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoisapc: pick a more sane default cpu for such old hardware.
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:24 +0000 (11:43 +0200)]
isapc: pick a more sane default cpu for such old hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoisapc: Fix irq routing
Gerd Hoffmann [Thu, 10 Sep 2009 09:43:23 +0000 (11:43 +0200)]
isapc: Fix irq routing

Only send irqs to ioapic in case we have one.
Fixes qemu segfault.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

14 years agoAllow to unscale the output window with a Ctrl-Alt-u hotkey
malc [Thu, 10 Sep 2009 01:15:07 +0000 (05:15 +0400)]
Allow to unscale the output window with a Ctrl-Alt-u hotkey

Signed-off-by: malc <av1474@comtv.ru>

14 years agoFix VMSTATE_PCI_DEVICE version
Juan Quintela [Wed, 9 Sep 2009 07:46:57 +0000 (09:46 +0200)]
Fix VMSTATE_PCI_DEVICE version

PCI device entries have to have a default version, not 2, because they are
used in the midle of other structures that can have _any_ version number.

We can't use proper versioning here until we have SubSections support.
Why we didn't noticed before?  Because in a PC, the only device ported with
a version less that 2 is piix_pm, and for that one, default pci values are
right.  If you use a virtio-console, you will see that its state it is not
loaded back.

Thanks to Amit Shah for reporting the problem and help debug the fix.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agodon't call cpu_sychronize_state from reset handlers
Glauber Costa [Wed, 2 Sep 2009 21:18:43 +0000 (17:18 -0400)]
don't call cpu_sychronize_state from reset handlers

Doing this will make the vcpu ioctl be issued from the I/O thread, instead
of cpu thread. The correct behaviour is to call it from within the cpu thread,
as soon as we are ready to go.

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoRTC polling mode broken
Bernhard Kauer [Wed, 2 Sep 2009 07:49:05 +0000 (09:49 +0200)]
RTC polling mode broken

The RTC emulation does not set the IRQ flags independent of the IRQ enable bits.

The original MC146818A datasheet from 1984 notes:
        "flag bits in Register C [...] are set independent of the
        state of the corresponding enable bits in Register B"
Similar sections can be found in newer documentation e.g. in rtc82885.

Qemu and Bochs set the IRQ flags only if they are enabled,
which breaks drivers polling on them.

The following patch corrects this for the update-ended-flag in Qemu only.
It does not fix the handling of the other flags.

Signed-off-by: Bernhard Kauer <kauer@tudos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqemu-kvm: fix segfault when running kvm without /dev/kvm, falling back to non-acceler...
Dustin Kirkland [Thu, 3 Sep 2009 17:31:33 +0000 (12:31 -0500)]
qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back to non-accelerated mode

qemu-kvm: fix segfault when running kvm without /dev/kvm, falling back
to non-accelerated mode

We're seeing segfaults on systems without access to /dev/kvm.  It
looks like the global kvm_allowed is being set just a little too late
in vl.c.  This patch moves the kvm initialization a bit higher in the
vl.c main, just after options processing, and solves the segfaults.
We're carrying this patch in Ubuntu 9.10 Alpha.  Please apply
upstream, or advise if and why this might not be the optimal solution.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Move the kvm_init() call a bit higher to fix a segfault when
/dev/kvm is not available.  The kvm_allowed global needs
to be set correctly a little earlier.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoconfigure: fix Linux AIO detection
Luiz Capitulino [Mon, 31 Aug 2009 16:18:12 +0000 (13:18 -0300)]
configure: fix Linux AIO detection

We should set $linux_aio to 'no' if detection failed, otherwise
its contents will be empty, which is a bug as we test for 'yes'
or 'no'.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFix compilation warnings when DEBUG_BUFFERED_FILE is defined
Pierre Riteau [Tue, 1 Sep 2009 09:57:20 +0000 (11:57 +0200)]
Fix compilation warnings when DEBUG_BUFFERED_FILE is defined

gcc 4.3.2 throws warnings when DEBUG_BUFFERED_FILE is defined, because
we are using the wrong format specifiers to print size_t/ssize_t values.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqcow2: Order concurrent AIO requests on the same unallocated cluster
Kevin Wolf [Mon, 31 Aug 2009 14:48:49 +0000 (16:48 +0200)]
qcow2: Order concurrent AIO requests on the same unallocated cluster

When two AIO requests write to the same cluster, and this cluster is
unallocated, currently both requests allocate a new cluster and the second one
merges the first one when it is completed. This means an cluster allocation, a
read and a cluster deallocation which cause some overhead. If we simply let the
second request wait until the first one is done, we improve overall performance
with AIO requests (specifially, qcow2/virtio combinations).

This patch maintains a list of in-flight requests that have allocated new
clusters. A second request touching the same cluster is limited so that it
either doesn't touch the allocation of the first request (so it can have a
non-overlapping allocation) or it waits for the first request to complete.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoqcow2: Fix metadata preallocation
Kevin Wolf [Mon, 31 Aug 2009 10:26:57 +0000 (12:26 +0200)]
qcow2: Fix metadata preallocation

The wrong version of the preallocation patch has been applied, so this is the
remaining diff.

We can't use truncate to grow the image file to the right size because we don't
know if metadata has been written after the last data cluster. In this case
truncate would shrink the file and destroy its metadata. Write a zero sector at
the end of the virtual disk instead to ensure that the file is big enough.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agofix VNC SASL detection
Juan Quintela [Mon, 31 Aug 2009 15:16:43 +0000 (17:16 +0200)]
fix VNC SASL detection

This test was missing the change to != no.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agooptionrom: make clean should remove raw and .d
Juan Quintela [Sun, 30 Aug 2009 22:41:35 +0000 (00:41 +0200)]
optionrom: make clean should remove raw and .d

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agootionrom: Use local CFLAGS no global one
Juan Quintela [Sun, 30 Aug 2009 22:48:46 +0000 (00:48 +0200)]
otionrom: Use local CFLAGS no global one

It is needed by %.o : %.c rule.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoRemove CFLAGS parameter in cc-option
Juan Quintela [Sun, 30 Aug 2009 22:48:45 +0000 (00:48 +0200)]
Remove CFLAGS parameter in cc-option

With cc-option we are testing if gcc just accept a particular option, we don't need CFLAGS at all.  And this fixes the recursive problem with CFLAGS

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agoFix for commit 3f9cb1c14dc368f41447db5f78d6248c4f100ad4
Naphtali Sprei [Mon, 31 Aug 2009 16:20:58 +0000 (19:20 +0300)]
Fix for commit 3f9cb1c14dc368f41447db5f78d6248c4f100ad4

Here's a patch to fix the issue introduced by me, as Reimar Döffinger pointed out,

Reimar Döffinger wrote:
> On Thu, Aug 13, 2009 at 03:01:20PM +0300, Naphtali Sprei wrote:
>> Bug fix for segfault when run as i82551 HW:
>> Use Extended TBD only when HW supports it (i82558 and up).
>>
>> Added assertions to guard from such buffer overflow
>> Introduce the MAX_TCB_BYTE_COUNT macro
>> Allocate buf big enough as HW needs (MAX_ETH_FRAME_SIZE -> MAX_TCB_BYTE_COUNT)
>>
>>
>> I don't feel 100% OK with the "s->device >= i82558B" condition
>> since it relies on the numeric (hex) value of those defines, which currently
>> is correct, but changes (which I don't forsee now) might break it.
>
> It seems this was applied. Unfortunately this breaks things on FreeBSD.
> There seem to be multiple issues.
> First, the intel document says the 82551, 82550, 82559 models are all
> supersets of the 82558. Or in other words: they all support this
> feature.
> Only the 82557 does not.
> But then even for that the FreeBSD driver will fail.
> The reason for that is this line:
>     eeprom_contents[0xa] = 0x4000;
> the value here must be 0x01000 for all 82557 models it seems.

 Correct the logic of determining devices that supports
 extended TxCB: only the 82557 do not support it.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomv from strdup to qemu_strdup in qemu-option.c
Jean-Christophe DUBOIS [Wed, 2 Sep 2009 22:37:00 +0000 (00:37 +0200)]
mv from strdup to qemu_strdup in qemu-option.c

one place is using strdup() instead of qemu_strdup

Fix it

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agomv strdup to qemu_strdup in vl.c
Jean-Christophe DUBOIS [Wed, 2 Sep 2009 21:59:06 +0000 (23:59 +0200)]
mv strdup to qemu_strdup in vl.c

There are few places in vl.c not using the qemu version of
malloc/free/strdup.

Fix it.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agofix vl.c compilation if CONFIG_KVM is not defined
Jean-Christophe DUBOIS [Wed, 2 Sep 2009 21:59:04 +0000 (23:59 +0200)]
fix vl.c compilation if CONFIG_KVM is not defined

vl.c will not link if CONFIG_KVM is not defined.

This patch fixes the problem.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

14 years agofix PATH_MAX conditional compilation
Jean-Christophe DUBOIS [Wed, 2 Sep 2009 21:59:02 +0000 (23:59 +0200)]
fix PATH_MAX conditional compilation

PATH_MAX is used elsewhere in the qemu source tree without protection.

In addtion the actual code would not compile if PATH_MAX is not defined

Last the free() call is wrong as p is not malloc()ed.

Signed-off-by: Jean-Christophe Dubois <jcd@tribudubois.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>