sdk/emulator/qemu.git
13 years agoMakefile: Remove 'tarbin' target
Peter Maydell [Fri, 16 Sep 2011 14:40:16 +0000 (15:40 +0100)]
Makefile: Remove 'tarbin' target

Remove the 'tarbin' target -- it isn't used as part of the official
QEMU release process, and it's out of date (various new bios files
were never added to its list of files). It's better not to provide
it at all than to have a broken makefile target we never use or test.

(Creating a tarball by just pulling in binaries that have been installed
directly to the system you're running the build on is a bad idea anyway:
the better way to create a binary tarball would be just to install to
a temporary DESTDIR and then tar up that.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqemu-char: use qemu_set_fd_handler/2 consistently
Marcelo Tosatti [Fri, 16 Sep 2011 21:19:55 +0000 (18:19 -0300)]
qemu-char: use qemu_set_fd_handler/2 consistently

Now that qemu_set_fd_handler and qemu_set_fd_handler2 have different
implementations, one using qemu iohandlers and the other glib, it is not
safe to mix the two when inserting/deleting handlers.

Fixes kvm-autotest.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoadlib: remove write-only variable
Hervé Poussineau [Sun, 18 Sep 2011 14:27:23 +0000 (16:27 +0200)]
adlib: remove write-only variable

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoirq: introduce qemu_irq_proxy()
Avi Kivity [Sun, 18 Sep 2011 12:58:26 +0000 (15:58 +0300)]
irq: introduce qemu_irq_proxy()

In some cases we have a circular dependency involving irqs - the irq
controller depends on a bus, which in turn depends on the irq controller.
Add qemu_irq_proxy() which acts as a passthrough, except that the target
irq may be set later on.

Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoBarriers in qemu-barrier.h should not be x86 specific
David Gibson [Tue, 20 Sep 2011 02:05:21 +0000 (12:05 +1000)]
Barriers in qemu-barrier.h should not be x86 specific

qemu-barrier.h contains a few macros implementing memory barrier
primitives used in several places throughout qemu.  However, apart
from the compiler-only barrier, the defined wmb() is correct only for
x86, or platforms which are similarly strongly ordered.

This patch addresses the FIXME about this by making the wmb() macro
arch dependent.  On x86, it remains a compiler barrier only, but with
a comment explaining in more detail the conditions under which this is
correct.  On weakly-ordered powerpc, an "eieio" instruction is used,
again with explanation of the conditions under which it is sufficient.

On other platforms, we use the __sync_synchronize() primitive,
available in sufficiently recent gcc (4.2 and after?).  This should
implement a full barrier which will be sufficient on all platforms,
although it may be overkill in some cases.  Other platforms can add
optimized versions in future if it's worth it for them.

Without proper memory barriers, it is easy to reproduce ordering
problems with virtio on powerpc; specifically, the QEMU puts new
element into the "used" ring and then updates the ring free-running
counter.  Without a barrier between these under the right
circumstances, the guest linux driver can receive an interrupt, read
the counter change but find the ring element to be handled still has
an old value, leading to an "id %u is not a head!\n" error message.
Similar problems are likely to be possible with kvm on other weakly
ordered platforms.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovirtio: Use global memory barrier macros
David Gibson [Tue, 20 Sep 2011 02:05:20 +0000 (12:05 +1000)]
virtio: Use global memory barrier macros

The virtio code uses wmb() macros in several places, as required by the
SMP-aware virtio protocol.  However the wmb() macro is locally defined
to be a compiler barrier only.  This is probably sufficient on x86
due to its strong storage ordering model, but it certainly isn't on other
platforms, such as ppc.

In any case, qemu already has some globally defined memory barrier macros
in qemu-barrier.h.  This patch, therefore converts virtio.c to use those
barrier macros.  The macros in qemu-barrier.h are also wrong (or at least,
safe for x86 only) but this way at least there's only one place to fix
them.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoFix and clean code which tests the gcc version
Stefan Weil [Fri, 16 Sep 2011 20:03:08 +0000 (22:03 +0200)]
Fix and clean code which tests the gcc version

The code which tests whether gcc supports warn_unused_result was wrong.
Remove the wrong test from configure and replace it by code using
macro QEMU_GNUC_PREREQ in compiler.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoMove macro QEMU_GNUC_PREREQ to compiler.h
Stefan Weil [Fri, 16 Sep 2011 20:03:07 +0000 (22:03 +0200)]
Move macro QEMU_GNUC_PREREQ to compiler.h

The macro is compiler specific and does not depend on the operating system.

Move macro QEMU_GNUC_PREREQ from osdep.h to compiler.h
and use it to simplify existing code.

host-utils.h uses this macro, so it now needs compiler.h
instead of osdep.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci-devfn: check that device/slot number is within range
Donald Dutile [Wed, 21 Sep 2011 19:25:11 +0000 (15:25 -0400)]
pci-devfn: check that device/slot number is within range

Need to check that guest slot/device number is not > 31 or walk off
the devfn table when checking if a devfn is available or not in a guest.

before this fix, passing in an addr=abc  or addr=34,
can crash qemu, sometimes fail gracefully if data past end
of devfn table fails the availability test.

with this fix, get clean error:
Property 'pci-assign.addr' doesn't take value '34'

also tested when no addr= param passed for guest (pcicfg) address,
and that worked as well.

Signed-off-by: Don Dutile <ddutile@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoisapc: give system address space when pci is disabled
Hervé Poussineau [Sun, 18 Sep 2011 16:04:51 +0000 (18:04 +0200)]
isapc: give system address space when pci is disabled

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agobuild: fix race with creating qapi-generated
Michael Roth [Wed, 7 Sep 2011 23:40:52 +0000 (18:40 -0500)]
build: fix race with creating qapi-generated

Since qapi-generated/ is a global QEMU include path, we need to make
sure it is created before anything is compiled, so do this in the
configure phase rather than via the Makefile.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agocirrus: Unbreak ISA support
Jan Kiszka [Wed, 21 Sep 2011 18:49:32 +0000 (20:49 +0200)]
cirrus: Unbreak ISA support

Do not try to map against the PCI bar in the ISA version of the device.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovga: Unbreak ISA support
Jan Kiszka [Wed, 21 Sep 2011 18:49:31 +0000 (20:49 +0200)]
vga: Unbreak ISA support

We need to initialize legacy_address_space during ISA VGA setup so that
the chain-4 alias can be registered properly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopc: Disable HPET for ISA machine
Jan Kiszka [Wed, 21 Sep 2011 18:49:30 +0000 (20:49 +0200)]
pc: Disable HPET for ISA machine

There was no HPET on ISA boxes.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopc: Unbreak ROM mapping for ISA machine
Jan Kiszka [Wed, 21 Sep 2011 18:49:29 +0000 (20:49 +0200)]
pc: Unbreak ROM mapping for ISA machine

This is based on the original fix by Hervé Poussineau: pc_memory_init
actually takes a memory region for mapping BIOS and extension ROMs. That
equals the PCI memory region if PCI is available, but must be system
memory in the ISA case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoe1000: Don't set the Capabilities List bit
dann frazier [Wed, 21 Sep 2011 20:06:25 +0000 (14:06 -0600)]
e1000: Don't set the Capabilities List bit

[Originally sent to qemu-kvm list, but I was redirected here]

The Capabilities Pointer is NULL, so this bit shouldn't be set. The state of
this bit doesn't appear to change any behavior on Linux/Windows versions we've
tested, but it does cause Windows' PCI/PCI Express Compliance Test to balk.

I happen to have a physical 82540EM controller, and it also sets the
Capabilities Bit, but it actually has items on the capabilities list to go
with it :)

Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agocore: remove qemu_service_io
Frediano Ziglio [Thu, 22 Sep 2011 09:26:15 +0000 (11:26 +0200)]
core: remove qemu_service_io

qemu_service_io was mainly an alias to qemu_notify_event,
currently used only by PPC for timer hack, so call
qemu_notify_event directly.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agohw/omap_gpmc: Modify correct field when writing IRQSTATUS register
Peter Maydell [Sat, 17 Sep 2011 18:51:49 +0000 (19:51 +0100)]
hw/omap_gpmc: Modify correct field when writing IRQSTATUS register

Writing to IRQSTATUS should affect irqst, not irqen -- error
spotted by Andrzej Zaborowski.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
13 years agohw/omap_gpmc: Add comment about FIFOTHRESHOLDSTATUS bit
Peter Maydell [Sat, 17 Sep 2011 18:51:48 +0000 (19:51 +0100)]
hw/omap_gpmc: Add comment about FIFOTHRESHOLDSTATUS bit

Promote the remark about why we handle FIFOTHRESHOLDSTATUS the
way we do from the commit message of de8af7fe0 to a comment in
the code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Andrzej Zaborowski <andrew.zaborowski@intel.com>
13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 22 Sep 2011 15:31:26 +0000 (10:31 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/core' into staging
Anthony Liguori [Thu, 22 Sep 2011 15:30:01 +0000 (10:30 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/core' into staging

13 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Thu, 22 Sep 2011 15:29:46 +0000 (10:29 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

13 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Thu, 22 Sep 2011 15:29:42 +0000 (10:29 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

13 years agoMerge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging
Anthony Liguori [Thu, 22 Sep 2011 15:27:14 +0000 (10:27 -0500)]
Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging

13 years agoblock/curl: Don't finish AIOCBs too early
Nick Thomas [Wed, 21 Sep 2011 10:55:50 +0000 (11:55 +0100)]
block/curl: Don't finish AIOCBs too early

The previous behaviour was to finish AIOCBs inside curl_aio_readv()
if the data was cached. This caused the following failed assertion
at hw/ide/pci.c:314: bmdma_cmd_writeb

"Assertion `bm->bus->dma->aiocb == ((void *)0)' failed."

By scheduling a QEMUBH and performing the completion inside the
callback, we avoid this problem.

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock/curl: Implement a flush function on the fd handlers
Nick Thomas [Wed, 21 Sep 2011 10:55:49 +0000 (11:55 +0100)]
block/curl: Implement a flush function on the fd handlers

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoahci: add port I/O index-data pair
Daniel Verkamp [Sat, 27 Aug 2011 09:12:28 +0000 (02:12 -0700)]
ahci: add port I/O index-data pair

Implement an I/O space index-data register pair as defined by the AHCI
spec, including the corresponding SATA PCI capability and BAR.

This allows real-mode code to access the AHCI registers; real-mode
code cannot address the memory-mapped register space because it is
beyond the first megabyte.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agotrace: Update docs to use example events that exist
Lluís Vilanova [Tue, 20 Sep 2011 19:03:48 +0000 (21:03 +0200)]
trace: Update docs to use example events that exist

The events 'qemu_malloc' and 'qemu_free' used in the examples no longer exist,
so use 'qemu_vmalloc' and 'qemu_vfree' instead.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agotrace: use binary file open mode in simpletrace
Stefan Hajnoczi [Mon, 5 Sep 2011 17:31:21 +0000 (18:31 +0100)]
trace: use binary file open mode in simpletrace

For Windows portability the simple trace backend must use the 'b' file
open mode.  This prevents the stdio library from mangling 0x0a/0x0d
newline characters.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agotrace: portable simple trace backend using glib
Stefan Hajnoczi [Mon, 5 Sep 2011 07:30:17 +0000 (08:30 +0100)]
trace: portable simple trace backend using glib

Convert the simple trace backend to glib so that it works under Windows.
We cannot use pthread directly but glib provides portable abstractions.
Also use glib atomics instead of newish gcc builtins which may not be
supported on Windows toolchains.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoMAINTAINERS: add tracing subsystem
Stefan Hajnoczi [Sat, 3 Sep 2011 15:24:47 +0000 (16:24 +0100)]
MAINTAINERS: add tracing subsystem

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agotrace: allow trace events with string arguments
Stefan Hajnoczi [Mon, 5 Sep 2011 15:31:45 +0000 (16:31 +0100)]
trace: allow trace events with string arguments

String arguments are useful for producing human-readable traces without
post-processing (e.g. stderr backend).  Although the simple backend
cannot handles strings all others can.  Strings should be allowed and
the simple backend can be extended to support them.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agouse qemu_* ctype functions
Christoph Egger [Wed, 21 Sep 2011 10:10:52 +0000 (11:10 +0100)]
use qemu_* ctype functions

Fix "warning: array subscript has type 'char'" on NetBSD.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoRemove qemu_host_page_bits
Stefan Weil [Sat, 17 Sep 2011 10:25:30 +0000 (12:25 +0200)]
Remove qemu_host_page_bits

It was introduced with commit 54936004fddc52c321cb3f9a9a51140e782bed5d
as host_page_bits but never used.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoAbort on thread layer errors
Jan Kiszka [Wed, 21 Sep 2011 07:28:31 +0000 (09:28 +0200)]
Abort on thread layer errors

Makes it easier to catch the bug in gdb as there is no need to set an
explicit breakpoint.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoSilence make if nothing is to do for libcacard
Jan Kiszka [Wed, 21 Sep 2011 07:18:32 +0000 (09:18 +0200)]
Silence make if nothing is to do for libcacard

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoDrop unneeded pthread.h inclusions
Jan Kiszka [Tue, 20 Sep 2011 15:11:58 +0000 (17:11 +0200)]
Drop unneeded pthread.h inclusions

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agofix compilation with stderr trace backend
Paolo Bonzini [Tue, 13 Sep 2011 15:47:52 +0000 (17:47 +0200)]
fix compilation with stderr trace backend

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoconfigure: Make missing pkg-config an error rather than a warning
Peter Maydell [Thu, 15 Sep 2011 11:15:56 +0000 (12:15 +0100)]
configure: Make missing pkg-config an error rather than a warning

If pkg-config doesn't exist then make configure fail immediately
with a useful error message. Now that glib is a required dependency,
proceeding despite the missing pkg-config will just cause us to
fail later with a misleading message about glib not being present.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agotarget-i386: Remove data type CCTable
Stefan Weil [Wed, 14 Sep 2011 16:27:54 +0000 (18:27 +0200)]
target-i386: Remove data type CCTable

Remove also two assert statements which were the last remaining users.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agonbd: fix non-Linux build failure
Paolo Bonzini [Wed, 21 Sep 2011 07:34:12 +0000 (09:34 +0200)]
nbd: fix non-Linux build failure

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoomap1: convert to memory API (part VI)
Avi Kivity [Tue, 30 Aug 2011 11:53:31 +0000 (14:53 +0300)]
omap1: convert to memory API (part VI)

Easy RAM stuff.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosoc_dma: drop soc_dma_port_add_mem_ram()
Avi Kivity [Tue, 30 Aug 2011 11:46:53 +0000 (14:46 +0300)]
soc_dma: drop soc_dma_port_add_mem_ram()

It's a trivial wrapper for soc_dma_port_add_mem(), which makes
the memory API conversion more difficult because it takes a ram
addr_t.  Drop.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap_lcdc: remove imif, emiff from structure
Avi Kivity [Tue, 30 Aug 2011 08:56:30 +0000 (11:56 +0300)]
omap_lcdc: remove imif, emiff from structure

Not used.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap1: convert to memory API (part V)
Avi Kivity [Mon, 29 Aug 2011 11:14:06 +0000 (14:14 +0300)]
omap1: convert to memory API (part V)

Tricky aliases.

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap1: convert to memory API (part IV)
Avi Kivity [Mon, 29 Aug 2011 11:14:06 +0000 (14:14 +0300)]
omap1: convert to memory API (part IV)

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap1: convert to memory API (part III)
Avi Kivity [Mon, 29 Aug 2011 11:14:06 +0000 (14:14 +0300)]
omap1: convert to memory API (part III)

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap1: convert to memory API (part II)
Avi Kivity [Tue, 9 Aug 2011 16:35:00 +0000 (19:35 +0300)]
omap1: convert to memory API (part II)

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoomap1: convert to memory API (part I)
Avi Kivity [Tue, 9 Aug 2011 16:35:00 +0000 (19:35 +0300)]
omap1: convert to memory API (part I)

Acked-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoRevert "alpha-softmmu: Disable for the 0.15 release branch."
Richard Henderson [Tue, 20 Sep 2011 22:36:24 +0000 (15:36 -0700)]
Revert "alpha-softmmu: Disable for the 0.15 release branch."

This reverts commit 46f08792bb4a69ab8aab897c174d82b006026140.

This was not supposed to be applied to mainline.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoMerge remote-tracking branch 'mst-tmp/for_anthony' into staging
Anthony Liguori [Tue, 20 Sep 2011 20:22:10 +0000 (15:22 -0500)]
Merge remote-tracking branch 'mst-tmp/for_anthony' into staging

13 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 20 Sep 2011 20:21:03 +0000 (15:21 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

13 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Tue, 20 Sep 2011 20:18:10 +0000 (15:18 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

13 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Tue, 20 Sep 2011 20:16:00 +0000 (15:16 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

13 years agopci_bridge: simplify memory regions some more
Michael S. Tsirkin [Tue, 6 Sep 2011 17:58:22 +0000 (20:58 +0300)]
pci_bridge: simplify memory regions some more

replace alloc/free with struct members.
todo: smash with initial implementation after
testing.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agowavaudio: Use stdio instead of QEMUFile
Juan Quintela [Tue, 20 Sep 2011 13:16:27 +0000 (15:16 +0200)]
wavaudio: Use stdio instead of QEMUFile

QEMUFile * is only intended for migration nowadays.  Using it for
anything else just adds pain and a layer of buffers for no good
reason.

Signed-off-by: Juan Quintela <quintela@redhat.com>
CC: malc <av1474@comtv.ru>
Signed-off-by: malc <av1474@comtv.ru>
13 years agowavcapture: Use stdio instead of QEMUFile
Juan Quintela [Tue, 20 Sep 2011 13:16:28 +0000 (15:16 +0200)]
wavcapture: Use stdio instead of QEMUFile

QEMUFile * is only intended for migration nowadays.  Using it for
anything else just adds pain and a layer of buffers for no good
reason.

Signed-off-by: Juan Quintela <quintela@redhat.com>
CC: malc <av1474@comtv.ru>
Signed-off-by: malc <av1474@comtv.ru>
13 years agorbd: allow escaping in config string
Sage Weil [Mon, 19 Sep 2011 20:35:26 +0000 (13:35 -0700)]
rbd: allow escaping in config string

The config string is variously delimited by =, @, and /, depending on the
field.  Allow these characters to be escaped by preceeding them with \.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agolinux-aio: remove process requests callback
Paolo Bonzini [Mon, 19 Sep 2011 15:05:12 +0000 (17:05 +0200)]
linux-aio: remove process requests callback

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: avoid SIGUSR2
Frediano Ziglio [Mon, 19 Sep 2011 14:37:13 +0000 (16:37 +0200)]
block: avoid SIGUSR2

Now that iothread is always compiled sending a signal seems only an
additional step. This patch also avoid writing to two pipe (one from signal
and one in qemu_service_io).

Work with kvm enabled or disabled. strace output is more readable (less syscalls).

[ kwolf: Merged build fix by Paolo Bonzini ]

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi: fix sign extension problems
Paolo Bonzini [Fri, 9 Sep 2011 14:47:26 +0000 (16:47 +0200)]
scsi: fix sign extension problems

When assigning a 32-bit value to cmd->xfer (which is 64-bits)
it can be erroneously sign extended because the intermediate
32-bit computation is signed.  Fix this by standardizing on
the ld*_be_p functions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agorbd: call flush, if available
Sage Weil [Thu, 15 Sep 2011 21:11:11 +0000 (14:11 -0700)]
rbd: call flush, if available

librbd recently added async writeback and flush support.  If the new
rbd_flush() call is available, call it.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agorbd: update comment heading
Sage Weil [Thu, 15 Sep 2011 21:11:10 +0000 (14:11 -0700)]
rbd: update comment heading

Properly document the configuration string syntax and semantics.  Remove
(out of date) details about the librbd implementation.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agorbd: ignore failures when reading from default conf location
Sage Weil [Thu, 15 Sep 2011 21:11:08 +0000 (14:11 -0700)]
rbd: ignore failures when reading from default conf location

If we are reading from the default config location, ignore any failures.
It is perfectly legal for the user to specify exactly the options they need
and to not rely on any config file.

Signed-off-by: Sage Weil <sage@newdream.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoAHCI Port Interrupt Enable register cleaning on soft reset
Alexander Motin [Mon, 12 Sep 2011 08:19:25 +0000 (11:19 +0300)]
AHCI Port Interrupt Enable register cleaning on soft reset

I've found that FreeBSD AHCI driver doesn't work with AHCI hardware
emulation of QEMU 0.15.0. I believe the problem is on QEMU's side. As I
see, it clears port's Interrupt Enable register each time when reset of
any level happens. Is is reasonable for the global controller reset. It
is probably not good, but acceptable for FreeBSD driver for the port
hard reset. But it is IMO wrong for the device soft reset. None of real
hardware I know behaves that way.

Signed-off-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoposix-aio-compat: Removed unused offset variable
Frediano Ziglio [Fri, 16 Sep 2011 11:34:46 +0000 (13:34 +0200)]
posix-aio-compat: Removed unused offset variable

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoVMDK: fix leak of extent_file
Fam Zheng [Mon, 19 Sep 2011 02:26:42 +0000 (10:26 +0800)]
VMDK: fix leak of extent_file

Release extent_file on error in vmdk_parse_extents. Added closing files
in freeing extents.

Signed-off-by: Fam Zheng <famcool@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: lazily allocate bounce buffer
Paolo Bonzini [Fri, 16 Sep 2011 14:40:04 +0000 (16:40 +0200)]
scsi-disk: lazily allocate bounce buffer

It will not be needed for reads and writes if the HBA provides a sglist.
In addition, this lets scsi-disk refuse commands with an excessive
allocation length, as well as limit memory on usual well-behaved guests.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-disk: commonize iovec creation between reads and writes
Paolo Bonzini [Fri, 16 Sep 2011 14:40:03 +0000 (16:40 +0200)]
scsi-disk: commonize iovec creation between reads and writes

Also, consistently use qiov.size instead of iov.iov_len.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agodma-helpers: rewrite completion/cancellation
Paolo Bonzini [Fri, 16 Sep 2011 14:40:02 +0000 (16:40 +0200)]
dma-helpers: rewrite completion/cancellation

This fixes various problems with completion/cancellation:

* if the io_func fails to get an AIOCB, the callback wasn't called

* If DMA encounters a bounce buffer conflict, and the DMA operation is
canceled before the bottom half fires, bad things happen.

* memory is not unmapped after cancellation, again causing problems
when doing DMA to I/O areas

* cancellation could leak the iovec

* the callback was missed if the I/O operation failed without returning
an AIOCB

and probably more that I've missed.  The patch fixes them by sharing
the cleanup code between completion and cancellation.  The dma_bdrv_cb
now returns a boolean completed/not completed flag, and the wrapper
dma_continue takes care of tasks to do upon completion.

Most of these are basically impossible in practice, but it is better
to be tidy...

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agodma-helpers: allow including from target-independent code
Paolo Bonzini [Fri, 16 Sep 2011 14:40:01 +0000 (16:40 +0200)]
dma-helpers: allow including from target-independent code

Target-independent code cannot construct sglists, but it can take
them from the outside as a black box.  Allow this.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agopci: implement bridge filtering
Michael S. Tsirkin [Sun, 4 Sep 2011 13:50:55 +0000 (16:50 +0300)]
pci: implement bridge filtering

Support bridge filtering on top of the memory
API as suggested by Avi Kivity:

Create a memory region for the bridge's address space.  This region is
not directly added to system_memory or its descendants.  Devices under
the bridge see this region as its pci_address_space().  The region is
as large as the entire address space - it does not take into account
any windows.

For each of the three windows (pref, non-pref, vga), create an alias
with the appropriate start and size.  Map the alias into the bridge's
parent's pci_address_space(), as subregions.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci_bridge: use parent bus's address space
Wen Congyang [Fri, 26 Aug 2011 10:00:33 +0000 (13:00 +0300)]
pci_bridge: use parent bus's address space

The switch to the new memory API caused the following problem:

The pci device may call pci_register_bar() to use PCI bus's address
space.  But we don't init PCI bus's address space if it is not bus
0.  A crash was reported:
http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg02243.html

More work will be needed to make bridge filtering work correctly
with the memory API.

Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci: Remove unused mem_base from PCIBus
Jan Kiszka [Mon, 12 Sep 2011 13:17:53 +0000 (15:17 +0200)]
pci: Remove unused mem_base from PCIBus

Obsoleted by f64e02b6cc.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci: interrupt pin documentation update
Michael S. Tsirkin [Sun, 11 Sep 2011 10:40:23 +0000 (13:40 +0300)]
pci: interrupt pin documentation update

Fix up some erroneous comments in code:
interrupt pins are named A-D, the
interrupt pin register is always readonly
and isn't zeroed out on reset.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci: Remove unused pci_reserve_capability
Jan Kiszka [Thu, 8 Sep 2011 10:44:47 +0000 (12:44 +0200)]
pci: Remove unused pci_reserve_capability

eepro100 was the last user. Now pci_add_capability is powerful enough.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agodma-helpers: rename is_write to to_dev
Paolo Bonzini [Fri, 16 Sep 2011 14:40:00 +0000 (16:40 +0200)]
dma-helpers: rename is_write to to_dev

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoscsi-generic: do not disable FUA
Paolo Bonzini [Wed, 14 Sep 2011 13:25:56 +0000 (15:25 +0200)]
scsi-generic: do not disable FUA

I found no rationale for this in the logs, and it is quite bad because
it will make scsi-generic unsafe WRT power failures.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoraw-posix: Fix bdrv_flush error return values
Kevin Wolf [Wed, 14 Sep 2011 09:22:26 +0000 (11:22 +0200)]
raw-posix: Fix bdrv_flush error return values

bdrv_flush is supposed to use 0/-errno return values

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agonbd: support NBD_SET_FLAGS ioctl
Paolo Bonzini [Thu, 8 Sep 2011 15:24:56 +0000 (17:24 +0200)]
nbd: support NBD_SET_FLAGS ioctl

The nbd kernel module cannot enable DISCARD requests unless it is
informed about it.  The flags field in the header is used for this,
and this patch adds support for it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agonbd: sync API definitions with upstream
Paolo Bonzini [Thu, 8 Sep 2011 15:24:55 +0000 (17:24 +0200)]
nbd: sync API definitions with upstream

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agonbd: support feature negotiation
Paolo Bonzini [Thu, 8 Sep 2011 15:24:54 +0000 (17:24 +0200)]
nbd: support feature negotiation

nbd supports writing flags in bytes 24...27 of the header,
and uses that for the read-only flag.  Add support for it
in qemu-nbd.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agomusicpal: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 19:50:06 +0000 (22:50 +0300)]
musicpal: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomips_r4k: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 19:22:38 +0000 (22:22 +0300)]
mips_r4k: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomips_mipssim: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 19:17:28 +0000 (22:17 +0300)]
mips_mipssim: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomips_malta: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 19:14:25 +0000 (22:14 +0300)]
mips_malta: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agomips_jazz: convert to memory API
Avi Kivity [Mon, 8 Aug 2011 18:59:19 +0000 (21:59 +0300)]
mips_jazz: convert to memory API

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agosun4u: don't set up isa_mem_base
Blue Swirl [Sat, 17 Sep 2011 19:16:57 +0000 (19:16 +0000)]
sun4u: don't set up isa_mem_base

Since we use memory API in sun4u.c, after
71579cae30b53c910cd6c47ab4e683f647d36519, setting up isa_mem_base
puts vga.chain4 outside of the physical address space.

Fix by removing obsolete isa_mem_base set up.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomemory: fix subregion collision warning
Michael Walle [Thu, 15 Sep 2011 21:16:49 +0000 (23:16 +0200)]
memory: fix subregion collision warning

Instead of the offset property use the proper addr property to calculate
the offsets.

Additionally, be a little more verbose on the warning and print the
subregion name.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agotcg/ppc64: Only one call output register needed for 64 bit hosts
Stefan Weil [Mon, 5 Sep 2011 09:07:02 +0000 (11:07 +0200)]
tcg/ppc64: Only one call output register needed for 64 bit hosts

The second register is only needed for 32 bit hosts.

Cc: Vassili Karpov <av1474@comtv.ru>
Fine-with-me'd-by: Vassili Karpov <av1474@comtv.ru>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/sparc: Only one call output register needed for 64 bit hosts
Stefan Weil [Mon, 5 Sep 2011 09:07:01 +0000 (11:07 +0200)]
tcg/sparc: Only one call output register needed for 64 bit hosts

The second register is only needed for 32 bit hosts.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/s390: Only one call output register needed for 64 bit hosts
Stefan Weil [Mon, 5 Sep 2011 09:07:00 +0000 (11:07 +0200)]
tcg/s390: Only one call output register needed for 64 bit hosts

The second register is only needed for 32 bit hosts.

Cc: Alexander Graf <agraf@suse.de>
Acked-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/ia64: Only one call output register needed for 64 bit hosts
Stefan Weil [Mon, 5 Sep 2011 09:06:59 +0000 (11:06 +0200)]
tcg/ia64: Only one call output register needed for 64 bit hosts

The second register is never used for ia64 hosts.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/i386: Only one call output register needed for 64 bit hosts
Stefan Weil [Mon, 5 Sep 2011 09:06:58 +0000 (11:06 +0200)]
tcg/i386: Only one call output register needed for 64 bit hosts

The second register is only needed for 32 bit hosts.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-i386: Fix several SSE3 instructions.
Max Reitz [Fri, 16 Sep 2011 15:29:04 +0000 (17:29 +0200)]
target-i386: Fix several SSE3 instructions.

haddp[sd], hsubp[sd] and addsubp[sd] operate on floats, thus it is
necessary to use the appropriate floating point calculation functions.
If this is not done, those functions operate merely on integers, which
is not correct.

Signed-off-by: Max Reitz <max@tyndur.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotrace: add virtio_set_status() trace event
Stefan Hajnoczi [Tue, 13 Sep 2011 12:34:37 +0000 (13:34 +0100)]
trace: add virtio_set_status() trace event

The virtio device lifecycle can be observed by looking at the sequence
of set status operations.  This is especially important for catching the
reset operation (status value 0), which resets the device and all
virtqueues.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotrace: remove trailing double quotes after PRI*64
Stefan Hajnoczi [Tue, 13 Sep 2011 12:34:36 +0000 (13:34 +0100)]
trace: remove trailing double quotes after PRI*64

Now that format strings can end in a PRI*64 macro, remove the
workarounds from the trace-events file.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotrace: allow PRI*64 at beginning and ending of format string
Stefan Hajnoczi [Tue, 13 Sep 2011 12:34:35 +0000 (13:34 +0100)]
trace: allow PRI*64 at beginning and ending of format string

The tracetool parser only picks up PRI*64 and other format string macros
when enclosed between double quoted strings.  Lift this restriction by
extracting everything after the closing ')' as the format string:

  cpu_set_apic_base(uint64_t val) "%016"PRIx64
                                  ^^        ^^

One trick here: it turns out that backslashes in the format string like
"\n" were being interpreted by echo(1).  Fix this by using the POSIX
printf(1) command instead.  Although it normally does not make sense to
include backslashes in trace event format strings, an injected newline
causes tracetool to emit a broken header file and I want to eliminate
cases where broken output is emitted, even if the input was bad.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotrace: remove newline from grlib_irqmp_check_irqs format string
Stefan Hajnoczi [Tue, 13 Sep 2011 12:34:34 +0000 (13:34 +0100)]
trace: remove newline from grlib_irqmp_check_irqs format string

There is no need to put a newline in trace event format strings.  The
backend may use the format string within some context and takes care of
how to display the event.  The stderr backend automatically appends "\n"
whereas the ust backend does not want a newline at all.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMakefile: Fix broken build
Stefan Weil [Fri, 16 Sep 2011 19:50:43 +0000 (21:50 +0200)]
Makefile: Fix broken build

make -C mybuilddir no longer works (regression caused by commit)
388d475815c23901010a25c845eb078d47ee0740.

PWD is the directory of the caller (not mybuilddir),
so BUILD_DIR is set to the wrong value.

GNU make sets CURDIR to the correct value.
Use this macro instead of PWD.

Cc: Lluís Vilanova <vilanova@ac.upc.edu>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>