Commit Graph

8724 Commits

Author SHA1 Message Date
Gerd Hoffmann e5bc776fa9 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>
2009-09-11 10:19:48 -05:00
Gerd Hoffmann f4c94c7c51 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>
2009-09-11 10:19:48 -05:00
Gerd Hoffmann 108af7b957 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>
2009-09-11 10:19:48 -05:00
Gerd Hoffmann 62b6adfbe0 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>
2009-09-11 10:19:48 -05:00
Gerd Hoffmann 2af2bf6760 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>
2009-09-11 10:19:48 -05:00
Gerd Hoffmann 7d31544ff6 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>
2009-09-11 10:19:47 -05:00
Gerd Hoffmann 191bc01bc9 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>
2009-09-11 10:19:47 -05:00
Gerd Hoffmann 9d868d4517 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>
2009-09-11 10:19:47 -05:00
Gerd Hoffmann 96729cbd29 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>
2009-09-11 10:19:47 -05:00
Markus Armbruster d03f09ccde 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>
2009-09-11 10:19:47 -05:00
Yan Vugenfirer ed757e140c 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>
2009-09-11 10:19:47 -05:00
Christoph Hellwig aa659be3dc 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>
2009-09-11 10:19:46 -05:00
Christoph Hellwig b0484ae464 ide: use bdrv_aio_flush
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:19:46 -05:00
Christoph Hellwig b2e12bc6e3 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>
2009-09-11 10:19:46 -05:00
Christoph Hellwig 6f1953c4c1 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>
2009-09-11 10:19:46 -05:00
Christoph Hellwig e900a7b748 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>
2009-09-11 10:19:46 -05:00
Michael S. Tsirkin b8193adbda 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>
2009-09-11 10:19:46 -05:00
Michael S. Tsirkin 711bf3d954 qemu: make virtio-blk PCI compliant by default
commit bf011293fa 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>
2009-09-11 10:19:46 -05:00
Jim Paris c4c0e236be 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>
2009-09-11 10:19:42 -05:00
Stefan Weil aeec26d348 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>
2009-09-11 10:19:34 -05:00
Kevin Wolf 91553dcc9e 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>
2009-09-11 10:18:06 -05:00
Kevin Wolf 40b4f53967 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>
2009-09-11 10:18:06 -05:00
Anthony Liguori 1c3173b9ed Revert "don't call cpu_sychronize_state from reset handlers"
This reverts commit 733318ea9c.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-09-11 10:18:06 -05:00
Edgar E. Iglesias 02b33596d0 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>
2009-09-11 10:38:31 +02:00
Edgar E. Iglesias a12f650781 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>
2009-09-11 10:35:27 +02:00
Edgar E. Iglesias 97f90cbfe8 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>
2009-09-11 10:27:38 +02:00
Aurelien Jarno 487a4d60bc Update OpenBIOS images to r577
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2009-09-11 09:13:04 +02:00
malc abb6ae2c00 X86_64: Use proper jumps/calls when displacement exceeds +-2G
Signed-off-by: malc <av1474@comtv.ru>
2009-09-11 01:38:52 +04:00
malc 3c854e4770 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>
2009-09-10 21:09:09 +04:00
malc fbd5de9b69 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>
2009-09-10 20:27:36 +04:00
malc 720036a5bb Add information w.r.t default GUS IRQ assigment 2009-09-10 20:05:59 +04:00
malc 31226166bb Fix formatting 2009-09-10 19:59:50 +04:00
malc a5e8e46bfb Fix formatting, get rid of conf and fix description 2009-09-10 19:59:41 +04:00
malc 41875be5b4 Fix formatting and and description field 2009-09-10 19:59:00 +04:00
Gerd Hoffmann 32e0c8260d qdev/isa: convert real time clock
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:01 +04:00
Gerd Hoffmann 11d23c352d 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>
2009-09-10 19:48:01 +04:00
Gerd Hoffmann 9453c5bc26 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>
2009-09-10 19:48:01 +04:00
Gerd Hoffmann 9df34396d5 qdev/isa: convert gravis ultrasound
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:00 +04:00
Gerd Hoffmann f8ba784657 qdev/isa: convert cs4231a sound card
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:00 +04:00
Gerd Hoffmann f7b4f61f63 qdev/isa: convert soundblaster
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:48:00 +04:00
Gerd Hoffmann 924f6d72d3 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>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 787aa97a3e 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>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 2e15e23b8a 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>
2009-09-10 19:47:59 +04:00
Gerd Hoffmann 86c8615784 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>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 316940b062 qdev: add property type for 32bit signed integers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 679a37afc4 isapc: pick a more sane default cpu for such old hardware.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2009-09-10 19:47:58 +04:00
Gerd Hoffmann 2c8d934020 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>
2009-09-10 19:47:57 +04:00
malc c4a735f9cb Allow to unscale the output window with a Ctrl-Alt-u hotkey
Signed-off-by: malc <av1474@comtv.ru>
2009-09-10 05:16:16 +04:00
Juan Quintela 13f5545daa 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>
2009-09-09 18:20:58 -05:00
Glauber Costa 733318ea9c 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>
2009-09-09 17:31:27 -05:00