sdk/emulator/qemu.git
15 years agopcnet: Change casts to DO_UPCAST() for PCIPCNetState
Juan Quintela [Mon, 24 Aug 2009 16:42:57 +0000 (18:42 +0200)]
pcnet: Change casts to DO_UPCAST() for PCIPCNetState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd pci_cirrus_vga_{save/load} functions, then remove vga.pci_dev use
Juan Quintela [Mon, 24 Aug 2009 16:42:56 +0000 (18:42 +0200)]
Add pci_cirrus_vga_{save/load} functions, then remove vga.pci_dev use

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocirrus_vga: Change casts to DO_UPCAST() for PCICirrusVGAState
Juan Quintela [Mon, 24 Aug 2009 16:42:55 +0000 (18:42 +0200)]
cirrus_vga: Change casts to DO_UPCAST() for PCICirrusVGAState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocirrus_vga: remove pointless cast from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:54 +0000 (18:42 +0200)]
cirrus_vga: remove pointless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd pci_ne2000_{save/load} functions, then remove pci_dev NE2000State field
Juan Quintela [Mon, 24 Aug 2009 16:42:53 +0000 (18:42 +0200)]
Add pci_ne2000_{save/load} functions, then remove pci_dev NE2000State field

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoWe need PCINE2000State for save/load functions
Juan Quintela [Mon, 24 Aug 2009 16:42:52 +0000 (18:42 +0200)]
We need PCINE2000State for save/load functions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agone2000: Change casts to DO_UPCAST() for PCINE2000State
Juan Quintela [Mon, 24 Aug 2009 16:42:51 +0000 (18:42 +0200)]
ne2000: Change casts to DO_UPCAST() for PCINE2000State

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agone2000: pci_dev has this very value with the right type
Juan Quintela [Mon, 24 Aug 2009 16:42:50 +0000 (18:42 +0200)]
ne2000: pci_dev has this very value with the right type

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agone2000: remove casts from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:49 +0000 (18:42 +0200)]
ne2000: remove casts from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agousb-ohci: Change casts to DO_UPCAST() for OHCIPCIState
Juan Quintela [Mon, 24 Aug 2009 16:42:48 +0000 (18:42 +0200)]
usb-ohci: Change casts to DO_UPCAST() for OHCIPCIState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoEverything outside of vga.c should use VGACommonState
Juan Quintela [Mon, 24 Aug 2009 16:42:47 +0000 (18:42 +0200)]
Everything outside of vga.c should use VGACommonState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovga: Rename vga_state -> vga
Juan Quintela [Mon, 24 Aug 2009 16:42:46 +0000 (18:42 +0200)]
vga: Rename vga_state -> vga

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoIntroduce vga_common_reset() to be able to typcheck vga_reset()
Juan Quintela [Mon, 24 Aug 2009 16:42:45 +0000 (18:42 +0200)]
Introduce vga_common_reset() to be able to typcheck vga_reset()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: LSIState is a DeviceHost
Juan Quintela [Mon, 24 Aug 2009 16:42:44 +0000 (18:42 +0200)]
lsi53c895a: LSIState is a DeviceHost

Go figure.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)
Juan Quintela [Mon, 24 Aug 2009 16:42:43 +0000 (18:42 +0200)]
lsi53c895a: rename PCIDevice field from pci_dev to dev (consistence)

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: use DO_UPCAST to cast from PCIDevice
Juan Quintela [Mon, 24 Aug 2009 16:42:42 +0000 (18:42 +0200)]
lsi53c895a: use DO_UPCAST to cast from PCIDevice

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agolsi53c895a: remove pointless cast from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:41 +0000 (18:42 +0200)]
lsi53c895a: remove pointless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agortl8139: remove pointless cast from void *
Juan Quintela [Mon, 24 Aug 2009 16:42:40 +0000 (18:42 +0200)]
rtl8139: remove pointless cast from void *

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agortl8139: Remove unneeded double indirection of PCIRTL8139State
Juan Quintela [Mon, 24 Aug 2009 16:42:39 +0000 (18:42 +0200)]
rtl8139: Remove unneeded double indirection of PCIRTL8139State

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: Remove unused indirection of PCIDevice
Juan Quintela [Mon, 24 Aug 2009 16:42:37 +0000 (18:42 +0200)]
eepro100: Remove unused indirection of PCIDevice

Once there, there is no way that we don't have a PCI Device at save/load time. Remove the check

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: cast a void * makes no sense
Juan Quintela [Mon, 24 Aug 2009 16:42:36 +0000 (18:42 +0200)]
eepro100: cast a void * makes no sense

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoeepro100: convert casts to DO_UPCAST()
Juan Quintela [Mon, 24 Aug 2009 16:42:35 +0000 (18:42 +0200)]
eepro100: convert casts to DO_UPCAST()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Read host DNS config on demand
Ed Swierk [Fri, 21 Aug 2009 02:00:31 +0000 (19:00 -0700)]
slirp: Read host DNS config on demand

Currently the qemu user-mode networking stack reads the host DNS
configuration (/etc/resolv.conf or the Windows equivalent) only once
when qemu starts.  This causes name lookups in the guest to fail if the
host is moved to a different network from which the original DNS servers
are unreachable, a common occurrence when the host is a laptop.

This patch changes the slirp code to read the host DNS configuration on
demand, caching the results for at most 1 second to avoid unnecessary
overhead if name lookups occur in rapid succession.  On non-Windows
hosts, /etc/resolv.conf is re-read only if the file has been replaced or
if its size or mtime has changed.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Remove our_addr code
Ed Swierk [Fri, 21 Aug 2009 02:00:25 +0000 (19:00 -0700)]
slirp: Remove our_addr code

Three problems with our_addr:

- It's determined only once when qemu starts, but the address can change
(just like the DNS configuration can).

- It's supposed to be the IP address of a host network interface, but
there's no guarantee that gethostbyname(gethostname()) actually does
that: the host might be a laptop that has only a loopback interface up,
or the hostname might be localhost.localdomain, etc.

- It's useless at best: get_dns_addr() calls it, there's no reason to
send DNS requests to a different IP address if you're running a DNS
server on the host and resolv.conf points to 127.0.0.1.

These problems are easily solved by removing the code.

Signed-off-by: Ed Swierk <eswierk@aristanetworks.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoswitch balloon initialization to -device.
Gerd Hoffmann [Fri, 14 Aug 2009 08:34:22 +0000 (10:34 +0200)]
switch balloon initialization to -device.

With that patch applied "-balloon virtio,args" becomes a shortcut for
"-device virtio-balloon-pci,args".

Side effects:
 - ballon device gains support for id=<tag>.
 - ballon device is off by default now.
 - initialization order changes, which may in different pci slot
   assignment depending on the VM configuration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: move code to hw/ide/
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:26 +0000 (15:22 +0200)]
ide: move code to hw/ide/

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: add save/restore support for mmio
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:25 +0000 (15:22 +0200)]
ide: add save/restore support for mmio

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: add save/restore support for isa
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:24 +0000 (15:22 +0200)]
ide: add save/restore support for isa

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-microdrive.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:23 +0000 (15:22 +0200)]
ide: split away ide-microdrive.c

create ide-microdrive.c and place microdrive support there.
only build ide-microdrive support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-mmio.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:22 +0000 (15:22 +0200)]
ide: split away ide-mmio.c

create ide-mmio.c and place mmio support there.
only build ide-mmio support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-macio.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:21 +0000 (15:22 +0200)]
ide: split away ide-macio.c

create ide-macio.c and place macio support there.
only build ide-macio support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-pci.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:20 +0000 (15:22 +0200)]
ide: split away ide-pci.c

create ide-pci.c and place pci bus support there.
only build ide-pci support for platforms using it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Fix build (merge with isa mmio split)

15 years agoide: split away ide-isa.c
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:19 +0000 (15:22 +0200)]
ide: split away ide-isa.c

create ide-isa.c and place isa bus support there.
only build ide-isa support for platforms using it.
also create ide.h header file.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: split away ide-internal.h
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:18 +0000 (15:22 +0200)]
ide: split away ide-internal.h

move lots of IDE defines to the new file.
also make a bunch of functions non-static
and add declaration for them.  Needed by
the following patches of this series.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoide: add IDEBus struct, cleanups
Gerd Hoffmann [Thu, 20 Aug 2009 13:22:17 +0000 (15:22 +0200)]
ide: add IDEBus struct, cleanups

The current IDE code uses an array of two IDEState structs to maintain
the IDE bus.  This patch adds a IDEBus to be used instead and does a
bunch of cleanups:

 * move ide bus state from IDEState to IDEBus.
 * drop a bunch of ugly pointer arithmetics to figure the active
   interface, explicitly save the interface number instead.
 * add helper functions to save/restore idebus state.

It also fixes a save/restore bug: loadvm allways stores the command in
the master's IDEState, even when it was saved from the slave.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev error logging
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:08 +0000 (10:36 +0200)]
qdev error logging

Use the new qemu_error() function in qdev.c

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-pci error logging
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:07 +0000 (10:36 +0200)]
virtio-pci error logging

Use the new qemu_error() function for virtio-blk-pci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoadd qemu_error() + friends
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:06 +0000 (10:36 +0200)]
add qemu_error() + friends

This patch adds some functions for error reporting to address the
problem that error messages should be routed to different destinations
depending on the context of the caller, i.e. monitor command errors
should go to the monitor, command line errors to stderr.

qemu_error() is a printf-like function to report errors.

qemu_errors_to_file() and qemu_errors_to_mon() switch the destination
for the error message to the specified file or monitor.  When setting a
new destination the old one will be kept.  One can switch back using
qemu_errors_to_previous().  i.e. it works like a stack.

main() calls qemu_errors_to_file(stderr), so errors go to stderr by
default.  monitor callbacks are wrapped into qemu_errors_to_mon() +
qemu_errors_to_previous(), so any errors triggered by monitor commands
will go to the monitor.

Each thread has its own error message destination.  qemu-kvm probably
should add a qemu_errors_to_file(stderr) call to the i/o-thread
initialization code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: add return value to init() callbacks.
Gerd Hoffmann [Fri, 14 Aug 2009 08:36:05 +0000 (10:36 +0200)]
qdev: add return value to init() callbacks.

Sorry folks, but it has to be.  One more of these invasive qdev patches.

We have a serious design bug in the qdev interface:  device init
callbacks can't signal failure because the init() callback has no
return value.  This patch fixes it.

We have already one case in-tree where this is needed:
Try -device virtio-blk-pci (without drive= specified) and watch qemu
segfault.  This patch fixes it.

With usb+scsi being converted to qdev we'll get more devices where the
init callback can fail for various reasons.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix stack buffer overflows in eepro100.c tx
Reimar Döffinger [Thu, 20 Aug 2009 10:34:22 +0000 (12:34 +0200)]
fix stack buffer overflows in eepro100.c tx

Hello,
the real world issue is that the hardware allows sends up to 2600 bytes,
and for some reason FreeBSD sometimes sends frames larger than the
ethernet frame size (102+1460 is the maximum I have seen so far),
overflowing the on-stack tx buffer of the driver.
Independent of that, the code should avoid allowing the guest to
overwrite the stack.
This is a minimal patch to fix the issue (you could leave out the size
change of the buf array as well, networking still seems to work either
way). Obviously there are better ways to handle it, but a proper fix IMO
would involve first getting rid of the code duplication and given the
number of patches pending for that code I see no point in working on that now.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoCheck block driver read error in pflash_cfi0x
Vijay Kumar [Fri, 21 Aug 2009 04:57:38 +0000 (10:27 +0530)]
Check block driver read error in pflash_cfi0x

If a flash file of size smaller than the flash size is specified in
the -pflash option, the block driver returns error. But the
pflash_cfi0x ignores the error. This results in a flash content of all
zeroes. And the simulation aborts while executing code.

This patch adds the checks for errors from bdrv_read and escalates it
to the calling code.

Signed-off-by: Vijay Kumar B. <vijaykumar@bravegnu.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Simplify cpu_synchronize_state()
Avi Kivity [Mon, 17 Aug 2009 20:19:53 +0000 (23:19 +0300)]
kvm: Simplify cpu_synchronize_state()

cpu_synchronize_state() is a little unreadable since the 'modified'
argument isn't self-explanatory.  Simplify it by making it always
synchronize the kernel state into qemu, and automatically flush the
registers back to the kernel if they've been synchronized on this
exit.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqdev: convert watchdogs
Markus Armbruster [Fri, 21 Aug 2009 08:31:34 +0000 (10:31 +0200)]
qdev: convert watchdogs

-watchdog NAME is now equivalent to -device NAME, except it treats
option argument '?' specially, and supports only one watchdog.

A side effect is that a device created with -watchdog may now receive
a different PCI address.

i6300esb is now available on any machine with a PCI bus, not just PCs.
ib700 is still PC only, but that could be changed easily.

The only remaining use of struct WatchdogTimerModel and
watchdog_add_model() is supporting '-watchdog ?'.  Should be replaced
by searching device_info_list for watchdog devices when we can
identify them there.

Also fixes ib700 not to use vm_clock before it is initialized: in
wdt_ib700_init(), called from register_watchdogs(), which runs before
init_timers().  The bug made ib700_write_enable_reg() crash in
qemu_del_timer().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoClean up upcast from PCIDevice to I6300State
Markus Armbruster [Fri, 21 Aug 2009 08:31:33 +0000 (10:31 +0200)]
Clean up upcast from PCIDevice to I6300State

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMove watchdog, watchdog_action, give them internal linkage
Markus Armbruster [Fri, 21 Aug 2009 08:31:32 +0000 (10:31 +0200)]
Move watchdog, watchdog_action, give them internal linkage

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-blk: handle NULL returns from bdrv_aio_{read, write}
Christoph Hellwig [Thu, 13 Aug 2009 14:49:56 +0000 (16:49 +0200)]
virtio-blk: handle NULL returns from bdrv_aio_{read, write}

The bdrv_aio_{read,write} routines can return a NULL pointer when the
I/O submission fails.  Currently we ignore this and will wait forever
for an I/O completion and leading to a hang of the guest.

I can easily reproduce this using the native Linux AIO patch, but it's
also possible using normal pthreads-based AIO.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoraw-posix: add Linux native AIO support
Christoph Hellwig [Thu, 20 Aug 2009 14:58:35 +0000 (16:58 +0200)]
raw-posix: add Linux native AIO support

Now that do have a nicer interface to work against we can add Linux native
AIO support.  It's an extremly thing layer just setting up an iocb for
the io_submit system call in the submission path, and registering an
eventfd with the qemu poll handler to do complete the iocbs directly
from there.

This started out based on Anthony's earlier AIO patch, but after
estimated 42,000 rewrites and just as many build system changes
there's not much left of it.

To enable native kernel aio use the aio=native sub-command on the
drive command line.  I have also added an option to qemu-io to
test the aio support without needing a guest.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoraw-posix: refactor AIO support
Christoph Hellwig [Thu, 20 Aug 2009 14:58:19 +0000 (16:58 +0200)]
raw-posix: refactor AIO support

Currently the raw-posix.c code contains a lot of knowledge about the
asynchronous I/O scheme that is mostly implemented in posix-aio-compat.c.
All this code does not really belong here and is getting a bit in the
way of implementing native AIO on Linux.

So instead move all the guts of the AIO implementation into
posix-aio-compat.c (which might need a better name, btw).

There's now a very small interface between the AIO providers and raw-posix.c:

 - an init routine is called from raw_open_common to return an AIO context
   for this drive.  An AIO implementation may either re-use one context
   for all drives, or use a different one for each as the Linux native
   AIO support will do.
 - an submit routine is called from the aio_reav/writev methods to submit
   an AIO request

There are no indirect calls involved in this interface as we need to
decide which one to call manually.  We will only call the Linux AIO native
init function if we were requested to by vl.c, and we will only call
the native submit function if we are asked to and the request is properly
aligned.  That's also the reason why the alignment check actually does
the inverse move and now goes into raw-posix.c.

The old posix-aio-compat.h headers is removed now that most of it's
content is private to posix-aio-compat.c, and instead we add a new
block/raw-posix-aio.h headers is created containing only the tiny interface
between raw-posix.c and the AIO implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agovirtio-console: rename dvq to ovq
Amit Shah [Thu, 20 Aug 2009 09:33:25 +0000 (15:03 +0530)]
virtio-console: rename dvq to ovq

It isn't obvious what 'dvq' stands for. Since it's the output queue and
the corresponding input queue is called 'ivq', call this 'ovq'

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopci ids: remove redundant defines
Amit Shah [Wed, 12 Aug 2009 19:20:28 +0000 (00:50 +0530)]
pci ids: remove redundant defines

Remove some redundant definitions for PCI classes:
PCI_CLASS_SERIAL_OTHER already exists as PCI_CLASS_COMMUNICATION_OTHER
and PCI_CLASS_PROCESSOR_CO is redefined.

PCI_CLASS_SERIAL_OTHER is not used anywhere.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomultiboot.raw is a generated file
Juan Quintela [Wed, 19 Aug 2009 10:19:31 +0000 (12:19 +0200)]
multiboot.raw is a generated file

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort ACPI to VMState
Juan Quintela [Thu, 20 Aug 2009 17:42:41 +0000 (19:42 +0200)]
Port ACPI to VMState

This uses a run_after_load() function, and VMSTATE_PCI_DEVICE()
It could be made smaller changing the type of pm_io_space_update()
to return an int.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support to run a function after load
Juan Quintela [Thu, 20 Aug 2009 17:42:40 +0000 (19:42 +0200)]
Add VMState support to run a function after load

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort PCIDevice state to VMState
Juan Quintela [Thu, 20 Aug 2009 17:42:39 +0000 (19:42 +0200)]
Port PCIDevice state to VMState

This uses a variant of buffer, with extra checks. Also uses the new
support for cheking that a read value is less or equal than a field.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd version_id to PCIDevice.
Juan Quintela [Thu, 20 Aug 2009 17:42:38 +0000 (19:42 +0200)]
Add version_id to PCIDevice.

It is needed for VMState

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for int32_t check value
Juan Quintela [Thu, 20 Aug 2009 17:42:37 +0000 (19:42 +0200)]
Add VMState support for int32_t check value

We read the saved value and check that it is less or equal than the one
stored in the structure.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort PS2 devices to VMState design
Juan Quintela [Thu, 20 Aug 2009 17:42:36 +0000 (19:42 +0200)]
Port PS2 devices to VMState design

This uses STRUCT and BUFFER

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for static sized buffers (uint_8)
Juan Quintela [Thu, 20 Aug 2009 17:42:35 +0000 (19:42 +0200)]
Add VMState support for static sized buffers (uint_8)

This patch adds support for static sized buffer and typecheks that the buffer is right.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort PCI Bus to VMState design
Juan Quintela [Thu, 20 Aug 2009 17:42:34 +0000 (19:42 +0200)]
Port PCI Bus to VMState design

This uses VARRAY and INT32_EQUAL values

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for variable sized arrays
Juan Quintela [Thu, 20 Aug 2009 17:42:33 +0000 (19:42 +0200)]
Add VMState support for variable sized arrays

This patch add supports for variable sized arrays whose size is
another field of the state.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for int32_t check value
Juan Quintela [Thu, 20 Aug 2009 17:42:32 +0000 (19:42 +0200)]
Add VMState support for int32_t check value

We read the saved value and check that it is the same that the one
is stored in the structure.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort i8254 to new VMState design
Juan Quintela [Thu, 20 Aug 2009 17:42:31 +0000 (19:42 +0200)]
Port i8254 to new VMState design

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for arrays of structs
Juan Quintela [Thu, 20 Aug 2009 17:42:30 +0000 (19:42 +0200)]
Add VMState support for arrays of structs

This patch add supports for arrays of structs

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for structs
Juan Quintela [Thu, 20 Aug 2009 17:42:29 +0000 (19:42 +0200)]
Add VMState support for structs

This patch adds support for saving one VMStateDescription from other
VMStateDescription.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPort apic to new VMState design
Juan Quintela [Thu, 20 Aug 2009 17:42:28 +0000 (19:42 +0200)]
Port apic to new VMState design

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for arrays
Juan Quintela [Thu, 20 Aug 2009 17:42:27 +0000 (19:42 +0200)]
Add VMState support for arrays

This patch adds support for saving arrays inside the struct

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd VMState support for pointers
Juan Quintela [Thu, 20 Aug 2009 17:42:26 +0000 (19:42 +0200)]
Add VMState support for pointers

This patch adds support for saving pointers to values

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoNew VMstate save/load infrastructure
Juan Quintela [Thu, 20 Aug 2009 17:42:25 +0000 (19:42 +0200)]
New VMstate save/load infrastructure

This patch introduces VMState infrastructure, to convert the save/load
functions of devices to a table approach.  This new approach has the
following advantages:
- it is type-safe
- you can't have load/save functions out of sync
- will allows us to have new interesting commands, like dump <device>, that
  shows all its internal state.
- Just now, the only added type is arrays, but we can add structures.
- Uses old load_state() function for loading old state.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd vmstate_load() and vmstate_save() functions
Juan Quintela [Thu, 20 Aug 2009 17:42:24 +0000 (19:42 +0200)]
Add vmstate_load() and vmstate_save() functions

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoUse return value from load_state() call back
Juan Quintela [Thu, 20 Aug 2009 17:42:23 +0000 (19:42 +0200)]
Use return value from load_state() call back

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomake load_vmstate() return errors
Juan Quintela [Thu, 20 Aug 2009 17:42:22 +0000 (19:42 +0200)]
make load_vmstate() return errors

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomove do_loadvm() to monitor.c
Juan Quintela [Thu, 20 Aug 2009 17:42:21 +0000 (19:42 +0200)]
move do_loadvm() to monitor.c

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosplit do_loadvm() into do_loadvm() and load_vmstate()
Juan Quintela [Thu, 20 Aug 2009 17:42:20 +0000 (19:42 +0200)]
split do_loadvm() into do_loadvm() and load_vmstate()

do_loadvm() is now called from the monitor.
load_vmstate() is called by do_loadvm() and when -loadvm command line is used.
Command line don't have to play games with vmstop()/vmstart()

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomove useful type definitons to osdep.h
Juan Quintela [Thu, 20 Aug 2009 17:42:19 +0000 (19:42 +0200)]
move useful type definitons to osdep.h

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Metadata preallocation
Kevin Wolf [Mon, 17 Aug 2009 13:50:10 +0000 (15:50 +0200)]
qcow2: Metadata preallocation

This introduces a qemu-img create option for qcow2 which allows the metadata to
be preallocated, i.e. clusters are reserved in the refcount table and L1/L2
tables, but no data is written to them. Metadata is quite small, so this
happens in almost no time.

Especially with qcow2 on virtio this helps to gain a bit of performance during
the initial writes. However, as soon as create a snapshot, we're back to the
normal slow speed, obviously. So this isn't the real fix, but kind of a cheat
while we're still having trouble with qcow2 on virtio.

Note that the option is disabled by default and needs to be specified
explicitly using qemu-img create -f qcow2 -o preallocation=metadata.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMove isa_connect_irq calls into isa_create_simple
Gerd Hoffmann [Fri, 14 Aug 2009 09:36:16 +0000 (11:36 +0200)]
Move isa_connect_irq calls into isa_create_simple

Now with isa-bus maintaining the isa irqs we can move the
isa_connect_irq() calls into isa_create_simple().

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd isa_reserve_irq().
Jes Sorensen [Fri, 14 Aug 2009 09:36:15 +0000 (11:36 +0200)]
Add isa_reserve_irq().

Introduce isa_reserve_irq() which marks an irq reserved and returns
the appropriate qemu_irq entry from the i8259 table.

isa_reserve_irq() is a temporary interface to be used to allocate ISA
IRQs for devices which have not yet been converted to qdev, and for
special cases which are not suited for qdev conversions, such as the
'ferr'.

This patch goes on top of Gerd Hoffmann's which makes isa-bus.c own
the ISA irq table.

[ added isa-bus.o to some targets to fix build failures  -- kraxel ]

Signed-off-by: Jes Sorensen <jes@sgi.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoisa bus irq changes and fixes.
Gerd Hoffmann [Fri, 14 Aug 2009 09:36:14 +0000 (11:36 +0200)]
isa bus irq changes and fixes.

Changes:

  (1) make isa-bus maintain isa irqs, complain when allocating
      already taken irqs.
  (2) note that (1) works only for isa devices converted to qdev
      already (floppy and ps2/kbd/mouse right now), so more work
      is needed to make this really useful.
  (3) split floppy init into isa and sysbus versions.
  (4) add sysbus->isa bridge & fix -M isapc breakage.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agohw/eepro100.c: Use extended TBD only where applicable
Naphtali Sprei [Thu, 13 Aug 2009 12:01:20 +0000 (15:01 +0300)]
hw/eepro100.c: Use extended TBD only where applicable

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.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopci-hotplug: initialize dinfo to NULL in pci_device_hot_add
Sebastian Herbszt [Sun, 16 Aug 2009 12:07:54 +0000 (14:07 +0200)]
pci-hotplug: initialize dinfo to NULL in pci_device_hot_add

Suppress the following compiler warning emitted by at least gcc version 4.2.1 (SUSE Linux)
and gcc version 3.4.5 (mingw32 special):

hw/pci-hotplug.c: In function 'pci_device_hot_add':
hw/pci-hotplug.c:102: warning: 'dinfo' may be used uninitialized in this function
hw/pci-hotplug.c:102: note: 'dinfo' was declared here

Signed-off-by: Sebastian Herbszt <herbszt@gmx.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock/vdi.c: Fix several bugs
Stefan Weil [Fri, 14 Aug 2009 19:50:02 +0000 (21:50 +0200)]
block/vdi.c: Fix several bugs

* The code for option '-static' was wrong, so image creation
  always created static images.

* Static images created with qemu-img did not set header entry
  blocks_allocated.

* The size of the block map must be rounded to the next multiple
  of SECTOR_SIZE, otherwise the block map is only read partially
  for block map sizes which are not a multiple of SECTOR_SIZE.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agointroduce kvm64 CPU
Andre Przywara [Thu, 20 Aug 2009 21:34:17 +0000 (23:34 +0200)]
introduce kvm64 CPU

In addition to the TCG based qemu64 type let's introduce a kvm64 CPU type,
which is the least common denominator of all KVM-capable x86-CPUs
(based on Intel Pentium 4 Prescott). It can be used as a base type
for migration.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoallow overriding of CPUID level on command line
Andre Przywara [Thu, 20 Aug 2009 19:03:48 +0000 (21:03 +0200)]
allow overriding of CPUID level on command line

The CPUID level determines how many CPUID leafs are exposed to the guest.
Some features (like multi-core) cannot be propagated without the proper
level, but guests maybe confused by bogus entries in some leafs.
So add level= and xlevel= to the list of -cpu options to allow the user to
override the default settings. While at it, merge unnecessary local
variables into one and allow hexadecimal arguments.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoset CPUID bits to present cores and threads topology
Andre Przywara [Wed, 19 Aug 2009 13:42:42 +0000 (15:42 +0200)]
set CPUID bits to present cores and threads topology

Controlled by the enhanced -smp option set the CPUID bits to present the
guest the desired topology. This is vendor specific, but (with the exception
of the CMP_LEGACY bit) not conflicting, so we set all bits everytime.
There is no real multithreading support for AMD CPUs, so report cores
instead.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopush CPUID level to 4 to allow Intel multicore decoding
Andre Przywara [Wed, 19 Aug 2009 13:42:41 +0000 (15:42 +0200)]
push CPUID level to 4 to allow Intel multicore decoding

Intel CPUs store the number of cores in CPUID leaf 4. So push
the maxleaf value to 4 to allow the guests access to this leaf.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoextend -smp parsing to include cores= and threads= options
Andre Przywara [Wed, 19 Aug 2009 13:42:40 +0000 (15:42 +0200)]
extend -smp parsing to include cores= and threads= options

For injecting multi-core and multi-threading CPU topology into guests
extend the -smp syntax to accommodate cores and threads specification.
Syntax: -smp smp_value[,cores=nr_cores][,threads=nr_threads]\
[,socket=nr_sockets][,maxcpus=max_cpus]
smp_value is the legacy value specifying the total number of vCPUs for
the guest. If you specify one of cores, threads or sockets this value
can be omitted. Missing values will be computed to fulfill:
smp_value = nr_cores * nr_threads * nr_sockets
where it will favour sockets over cores over threads (to mimic the
current behavior, which will only inject multiple sockets.)
So -smp 4,threads=2 will inject two sockets with 2 threads each,
-smp cores=4 is an abbreviation for -smp 4,cores=4,threads=1,sockets=1.
If max_cpus (the number of hotpluggable CPUs) is omitted, it will
be set to smp_value.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoadd file descriptor migration
Paolo Bonzini [Tue, 18 Aug 2009 13:56:25 +0000 (15:56 +0200)]
add file descriptor migration

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: Chris Lalancette <clalance@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd sparse to new feature convention
Juan Quintela [Wed, 12 Aug 2009 16:29:57 +0000 (18:29 +0200)]
Add sparse to new feature convention

Once there, move to a proper test to see if we are going to use it or not

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd kvm to new feature convention
Juan Quintela [Wed, 12 Aug 2009 16:29:56 +0000 (18:29 +0200)]
Add kvm to new feature convention

Extra error message is only given if --enable-kvm was given

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd xen to new feature convention
Juan Quintela [Wed, 12 Aug 2009 16:29:55 +0000 (18:29 +0200)]
Add xen to new feature convention

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd fdt to new feature convention
Juan Quintela [Wed, 12 Aug 2009 16:29:54 +0000 (18:29 +0200)]
Add fdt to new feature convention

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd sdl to new feature convention
Juan Quintela [Wed, 12 Aug 2009 16:29:53 +0000 (18:29 +0200)]
Add sdl to new feature convention

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename build_docs to docs
Juan Quintela [Wed, 12 Aug 2009 16:29:52 +0000 (18:29 +0200)]
Rename build_docs to docs

All other features are named foo and enabled with --enable-foo.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd build_docs to new feature convention
Juan Quintela [Wed, 12 Aug 2009 16:29:51 +0000 (18:29 +0200)]
Add build_docs to new feature convention

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd bluez to new feature convencion
Juan Quintela [Wed, 12 Aug 2009 16:29:50 +0000 (18:29 +0200)]
Add bluez to new feature convencion

Once there, remove extra check for package and output if bluez was found or not as the other features

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd nptl to new feature convencion
Juan Quintela [Wed, 12 Aug 2009 16:29:49 +0000 (18:29 +0200)]
Add nptl to new feature convencion

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd curl to new feature convencion
Juan Quintela [Wed, 12 Aug 2009 16:29:47 +0000 (18:29 +0200)]
Add curl to new feature convencion

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd curses to new feature convencion
Juan Quintela [Wed, 12 Aug 2009 16:20:30 +0000 (18:20 +0200)]
Add curses to new feature convencion

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd vnc_sasl to new feature convencion
Juan Quintela [Wed, 12 Aug 2009 16:20:29 +0000 (18:20 +0200)]
Add vnc_sasl to new feature convencion

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd vnc_tls to new feature convencion
Juan Quintela [Wed, 12 Aug 2009 16:20:28 +0000 (18:20 +0200)]
Add vnc_tls to new feature convencion

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