Commit Graph

9773 Commits

Author SHA1 Message Date
Isaku Yamahata e369cad7cd pci: introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
introduce constant PCI_NUM_PINS for the number of interrupt pins, 4.
and use it.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:04 -06:00
Isaku Yamahata 2e49d64ac7 pci: fix PCI_DPRINTF() wrt variadic macro.
add missing ## in PCI_DPRINTF() to compile.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:04 -06:00
Paolo Bonzini 783c4f5835 Makefile: make qemu-io dependent on config-host.h
This is needed also for qemu-io, but not for qemu-nbd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:03 -06:00
Gerd Hoffmann 43b443b668 scsi: move scsi-disk.h -> scsi.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:03 -06:00
Gerd Hoffmann 1cd3af5480 scsi: move scsi.h -> esp.h
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:03 -06:00
Uri Lublin fafce63d99 Makefile: make qemu-img dependant on config-host.h
Since config-host.h is generated by the Makefile (1215c6e76),
building (only) qemu-img fails:

[user@f12-uri qemu]$ make distclean (or git clone qemu)
[user@f12-uri qemu]$ ./configure ...
[user@f12-uri qemu]$ make qemu-img
GEN  config-all-devices.mak
GEN   qemu-img-cmds.h
CC    qemu-img.o
In file included from qemu-img.c:24:
qemu-common.h:32:25: error: config-host.h: No such file or directory

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:03 -06:00
Dustin Kirkland 184bd04845 whitelist host virtio networking features
This patch is a followup to 8eca6b1bc7,
fixing crashes when guests with 2.6.25 virtio drivers have saturated
virtio network connections.

https://bugs.edge.launchpad.net/ubuntu/+source/qemu-kvm/+bug/458521

That patch should have been whitelisting *_HOST_* rather than the the
*_GUEST_* features.

I tested this by running an Ubuntu 8.04 Hardy guest (2.6.24 kernel +
2.6.25-virtio driver).  I saturated both the incoming, and outgoing
network connection with nc, seeing sustained 6MB/s up and 6MB/s down
bitrates for ~20 minutes.  Previously, this crashed immediately.  Now,
the guest does not crash and maintains network connectivity throughout
the test.

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:03 -06:00
Kevin Wolf 9f56640c85 qemu-img: Allow creating zero sized images
A size of 0 should be valid and cannot be treated as "missing value". Use -1
for this purpose instead.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:03 -06:00
Mark McLoughlin 5819c91806 tap: drain queue in tap_send()
Okay, let's try re-enabling the drain-entire-queue behaviour, with a
difference - before each subsequent packet, use qemu_can_send_packet()
to check that we can send it. This is similar to how we check before
polling the tap fd and avoids having to drop a packet if the receiver
cannot handle it.

This patch should be a performance improvement since we no longer have
to go through the mainloop for each packet.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Mark McLoughlin cdd5cc12ba virtio-net: split the has_buffers() logic from can_receive()
We should only return zero from receive() for a condition which we'll
get notification of when it changes. Currently, we're returning zero
if the guest driver is not ready, but we won't ever flush our queue
when that status changes.

Also, don't check buffer space in can_receive(), but instead just allow
receive() to return zero when this condition occurs and have the caller
handle queueing the packet.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Mark McLoughlin 839f368f2b net/queue: queue packets even if sender doesn't supply a callback
Now that we disable any receiver whose queue is full, we do not require
senders to handle a zero return by supplying a sent callback.

This is a second step towards allowing can_receive() handlers to return
true even if no buffer space is available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Mark McLoughlin 893379efd0 net: disable receiving if client returns zero
If a receiver returns zero, that means its queue is full and it will
notify us when room is available using qemu_flush_queued_packets().

Take note of that and disable that receiver until it flushes its queue.

This is a first step towards allowing can_receive() handlers to return
true even if no buffer space is available.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Mark McLoughlin be1636b3ab tap: disable draining queue in one go
If qemu_send_packet_async() returns zero, it means the packet has been
queued and the sent callback will be invoked once it has been flushed.

This is only possible where the NIC's receive() handler returns zero
and promises to notify the networking core that room is available in its
queue again.

In the case where the receive handler does not have this capability
(and its queue fills up) it returns -1 and the networking core does not
queue up the packet. This condition is indicated by a -1 return from
qemu_send_packet_async().

Currently, tap handles this condition simply by dropping the packet. It
should do its best to avoid getting into this situation by checking such
NIC's have room for a packet before copying the packet from the tap
interface.

tap_send() used to achieve this by only reading a single packet before
returning to the mainloop. That way, tap_can_send() is called before
reading each packet.

tap_send() was changed to completely drain the tap interface queue
without taking into account the situation where the NIC returns an
error and the packet is not queued. Let's start fixing this by
reverting to the previous behaviour of reading one packet at a time.

Reported-by: Scott Tsai <scottt.tw@gmail.com>
Tested-by: Sven Rudolph <Sven_Rudolph@drewag.de>
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Markus Armbruster eb852011ab Configurable block format whitelist
We have code for a quite a few block formats.  While I trust that all
of these formats are useful at least for some people in some
circumstances, some of them are of a kind that friends don't let
friends use in production.

This patch provides an optional block format whitelist, default off.
If a whitelist is configured with --block-drv-whitelist, QEMU proper
can use only whitelisted formats.  Other programs, like qemu-img, are
not affected.

Drivers for formats off the whitelist still participate in format
probing, to ensure all programs probe exactly the same.  Without that,
QEMU proper would be prone to treat images with a format off the
whitelist as raw when the image's format is probed.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Markus Armbruster 39a51dfda8 qdev: Tag isa-fdc, PIIX3 IDE and PIIX4 IDE as no-user
These devices are created automatically, and attempting to create
another one with -device fails with "qemu: hardware error:
register_ioport_write: invalid opaque".

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:02 -06:00
Naphtali Sprei c79662f7f7 Pass the drive's readonly attribute to the guest OS
Implemented for virtio-blk and for scsi

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:01 -06:00
Naphtali Sprei 59f2689d90 Added readonly flag to -drive command
This is a slightly revised patch for adding readonly flag to the -drive command.
Even though this patch is "stand-alone", it assumes a previous related patch (in Anthony staging tree), that passes
the readonly attribute of the drive to the guest OS, applied first.

This enables sharing same image between guests, with readonly access.
Implementaion mark the drive as read_only and changes the flags when actually opening the file.
The readonly attribute of a qcow also passed to it's base file.
For ide that cannot pass the readonly attribute to the guest OS, disallow the readonly flag.

Also, return error code from bdrv_truncate for readonly drive.

Signed-off-by: Naphtali Sprei <nsprei@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:01 -06:00
Stefan Weil d191d12d5f qcow2: Allow qcow2 disk images with size zero
Images with disk size 0 may be used for
VM snapshots, but not to save normal block data.

It is possible to create such images using
qemu-img, but opening them later fails.

So even "qemu-img info image.qcow2" is not
possible for an image created with
"qemu-img create -f qcow2 image.qcow2 0".

This is fixed here.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-09 08:43:01 -06:00
Blue Swirl b4558d7481 (x86/Sparc/PPC)-user: fix cpu_copy
b55a37c981 moved the call to cpu_reset
to user emulators. But cpu_copy also initializes a CPU structure, so add the
call also there.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 16:34:12 +00:00
Blue Swirl 4a64356397 IDE: Fix reset handling
Problem: x86 systems could not survive a few system_resets.

Clear most of IDE state when reset. Implement the missing reset handlers.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 14:13:05 +00:00
Blue Swirl b55a37c981 user: move CPU reset call to main.c for x86/PPC/Sparc
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 10:37:06 +00:00
Blue Swirl d84bda46de PPC: rename cpu_ppc_reset to cpu_reset for consistency
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 10:36:04 +00:00
Blue Swirl 44a9935465 Sparc64/x86: remove unneeded calls to device reset
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 10:05:03 +00:00
Blue Swirl e43941318d PPC: remove unneeded calls to device reset
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 09:32:21 +00:00
Blue Swirl a01d6ef446 sparc32 (mostly): remove unneeded calls to device reset
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 08:55:24 +00:00
Glauber Costa c169998802 v3: don't call reset functions on cpu initialization
There is absolutely no need to call reset functions when initializing
devices. Since we are already registering them, calling qemu_system_reset()
should suffice. Actually, it is what happens when we reboot the machine,
and using the same process instead of a special case semantics will even
allow us to find bugs easier.

Furthermore, the fact that we initialize things like the cpu quite early,
leads to the need to introduce synchronization stuff like qemu_system_cond.
This patch removes it entirely. All we need to do is call qemu_system_reset()
only when we're already sure the system is up and running

I tested it with qemu (with and without io-thread) and qemu-kvm, and it
seems to be doing okay - although qemu-kvm uses a slightly different patch.

[ v2: user mode still needs cpu_reset, so put it in ifdef. ]
[ v3: leave qemu_system_cond for now. ]

Signed-off-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-07 08:06:58 +00:00
malc cae334cd6b vga: fix line comparison
Line counter doesn't wrap.

Signed-off-by: malc <av1474@comtv.ru>
2009-11-06 16:08:41 +03:00
malc d1984194f3 vga: Respect Line Compare Register in text modes
Unbreaks setup screen of Act1/PL

Signed-off-by: malc <av1474@comtv.ru>
2009-11-06 03:46:12 +03:00
Artyom Tarasenko 3e6ba50340 Sparc: fix carry flag handling (Solaris bootblk fix)
The page 108 of the SPARC Version 8 Architecture Manual describes
that addcc and addxcc shall compute carry flag the same way.
The page 110 claims the same about subcc and subxcc instructions.
This patch fixes carry computation in corner cases and removes redundant code.
The most visible effect of the patch is enabling Solaris boot when using OBP.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
[blauwirbel@gmail.com: cleaned up formatting]
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2009-11-04 19:38:26 +00:00
Andrzej Zaborowski 2d7adea4fe hw/sd: Support SDHC size cards
This patch adds SHDC support (-sd sd.img, where sd.img is
larger than 1GB) to qemu.

Signed-off-by: Jason S. McMullan <jason.mcmullan@gmail.com>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
2009-11-03 15:28:19 +01:00
Anthony Liguori 2d9f27d2fd Fix the build when srcdir == objdir
You would only see this error on a fresh clone when srcdir == objdir.  configure
will fail because roms/pcbios doesn't exist.

git submodule integration doesn't cleanup very well when switching between
branches so you'll get an roms/pcbios directory from normal operations if you
switch between old branches.

Thanks to a mistake in configure, if you build outside of srcdir, you'll also
get a valid roms/pcbios.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-11-02 15:50:27 -06:00
Anthony Liguori ed7193ec1d Unbreak Linux build
commit 71f4effce7
  Author: Alexander Graf <agraf@suse.de>
  Date:   Fri Oct 30 22:27:00 2009 +0100

      Unbreak tap compilation on OS X

Broke the build on Linux due to a bad #if guard

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 16:45:20 -05:00
Anthony Liguori ec9f735638 Update gpxe roms to have BANNER_TIMEOUT=0
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 16:44:26 -05:00
Alexander Graf 71f4effce7 Unbreak tap compilation on OS X
Currently compiling the tap sources breaks on Mac OS X. This is because of:

  1) tap-linux.h requiring Linux includes
  2) typos
  3) missing #includes

This patch adds what's necessary to compile tap happily on Mac OS X.
I haven't tested if using tap actually works, but I don't think that's a
major issue as that code was probably seriously untested before already.

I didn't split the patch, because it's only a few lines of code and
splitting is probably not worth the effort here.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 16:38:15 -05:00
Anthony Liguori 195325a4c1 Revert "Fall back to network boot as the last possible boot option"
This reverts commit 94ca5a9859.
2009-10-30 12:42:29 -05:00
Anthony Liguori 94ca5a9859 Fall back to network boot as the last possible boot option
This is similiar to the default with most bare metal systems.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 09:42:36 -05:00
Anthony Liguori 04095e5ff3 Remove e1000 rom loading hack
The gPXE rom supports BEV properly.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 09:42:36 -05:00
Anthony Liguori 74b12befba Switch from etherboot to gPXE
etherboot is deprecated and not under active development anymore.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 09:42:36 -05:00
Anthony Liguori fd64612241 Switch pc bios from pc-bios to seabios
SeaBIOS is a port of pc-bios to GCC.  Besides using a more modern tool chain,
SeaBIOS introduces a number of new features including PMM support, better
BEV and BCV support, and better PnP support.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 09:42:36 -05:00
Anthony Liguori 65e59a08f6 Update SeaBIOS to latest upstream
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 09:42:35 -05:00
Mark McLoughlin 3cbe04c442 virtio-net: fix macaddr config regression
This commit:

    commit 97b15621
    virtio: use qdev properties for configuration.

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

makes a guest using virtio-net see an empty macaddr because we never
copy the macaddr into the location that virtio_net_get_config() uses.

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 09:42:35 -05:00
Michael S. Tsirkin 76f5159d7f qemu/msix: fix table access issues
Fixes a couple of issues with msix table access:
- With misbehaving guests, misaligned 4 byte access could overflow
  msix table and cause qemu to segfault. Since PCI spec requires
  host to only issue dword-aligned accesses, as a fix,
  it's enough to mask the address low bits.
- Tables use pci format, not native format, and so
  we must use pci_[sg]et_long on read/write.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:34 -05:00
Michael S. Tsirkin 79758e95d7 qemu/virtio: make wmb compiler barrier + comments
wmb must be at least a compiler barrier, even without SMP.
Further, we likely need some rmb()/mb() as well:
I have not audited the code but lguest has mb(),
add a comment for now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:34 -05:00
Kevin Wolf 1e5b9d2fcc Remove aio_ctx from paio_* interface
The context parameter in paio_submit isn't used anyway, so there is no reason
why block drivers should need to remember it. This also avoids passing a Linux
AIO context to paio_submit (which doesn't do any harm as long as the parameter
is unused, but it is highly confusing).

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:34 -05:00
Peter Hjalmarsson fa39472763 Add *CFLAGS to LINK in rules.mak
Sometimes when linking with gcc to get a predictable result you are suggested to also apply the compiler flags to the linker command.

For reference, please read:
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Link-Options.html

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:33 -05:00
Stefan Weil 718b8aec62 serial: Add missing bit
Serial frames always start with a start bit.
This bit was missing in frame size calculation.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:32 -05:00
Stefan Weil 45eea13b24 serial: Support additional serial speed values
* Allow any speed value which is defined for Linux
  (and possibly other systems).
* Compare int values instead of double values.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:32 -05:00
Gerd Hoffmann 66a6593a8c usb: print attached status in info qtree
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:32 -05:00
Gerd Hoffmann 26a9e82ac4 usb-host: use qdev for -usbdevice + rework.
Changes:

 * We don't create/delete devices, we attach/detach them instead.
 * The separate autofilter list is gone, we simply walk the list
   of devices directly instead.
 * Autofiltering is done unconditionally now.  Non-auto device scan
   code got dropped.
 * Autofiltering turns off the timer if there is nothing to do, it
   runs only in case there are unattached host devices.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:32 -05:00
Gerd Hoffmann b3e461d3d6 usb-storage: use qdev for -usbdevice
Hook up usb_msd_init.

Also rework handling of encrypted block devices,
move the code out vl.c.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2009-10-30 08:39:31 -05:00