Commit graph

16466 commits

Author SHA1 Message Date
Richard Henderson 098d314a32 i8259: Convert to MemoryRegion
The only non-obvious part is pic_poll_read which used
"addr1 >> 7" to detect whether one referred to either
the master or slave PIC.  Instead, test this directly.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Avi Kivity bac8ad41ab ppc_prep: initialize i8259 after the ISA bus
Succeeding i8259 conversion to ISA requires this.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Avi Kivity a4ac5e64de mips_r4k: initialize i8259 after the ISA bus
Succeeding i8259 conversion to ISA requires this.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:37 +03:00
Avi Kivity e155c99be9 mips_jazz: initialize i8259 after the ISA bus
Succeeding i8259 conversion to ISA requires this.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Avi Kivity 5632ae46d5 mips_malta: move i8259 initialization after piix4 initialization
i8259 is an ISA device (or at least, depends on the ISA infrastructure to
register its ioport); and the ISA bus is supplied by piix4.  Later patches
make this dependency explicit.

Use qemu_irq_proxy() to stop the cycle by adding an extra layer of
indirection.

Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson 60ea6aa8fc i8254: Convert to MemoryRegion
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson beae397945 cs4231a: Convert to MemoryRegion
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson 4bae1efe63 pc: Re-order pc_init1 to initialize the ISA bus before ISA devices
In particular, the i8259 was being initialized before the ISA bus,
leading to a crash.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson 78e2059352 isa: add isa_register_ioport()
To replace isa_init_ioport and isa_init_ioport_range
as the ISA devices are converted to the memory api.

[avi: use memory_region_size()]

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:36 +03:00
Richard Henderson c2d0d01202 isa: Pass i/o address space to isa_bus_new
Not used yet, but at least we're provided with the correct region.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:58:35 +03:00
Richard Henderson e11d64390b pci: add pci_address_space_io()
Returns the I/O address space.  Useful for implementing
PCI-ISA bridge devices.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Avi Kivity <avi@redhat.com>
2011-09-25 14:57:47 +03:00
Peter Maydell 1ce9ce6a61 MAINTAINERS: update maintainer for target-arm and ARM devboards
Add myself as co-maintainer alongside Paul Brook for the TCG ARM
guest implementation (target-arm) and the ARM dev boards (integratorcp,
realview, stellaris, versatilepb).

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Acked-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 13:42:34 -05:00
Peter Maydell 63467ddb61 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>
2011-09-23 13:42:34 -05:00
Marcelo Tosatti 069c159e39 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>
2011-09-23 13:42:33 -05:00
Hervé Poussineau e8beeae4c0 adlib: remove write-only variable
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-09-23 13:42:33 -05:00
Avi Kivity 22ec3283ef 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>
2011-09-23 11:51:05 -05:00
David Gibson e22517086b 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>
2011-09-23 11:51:05 -05:00
David Gibson b90d2f3512 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>
2011-09-23 11:51:05 -05:00
Stefan Weil 87751797c7 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>
2011-09-23 11:51:05 -05:00
Stefan Weil f8b72754c2 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>
2011-09-23 11:51:05 -05:00
Donald Dutile ffe3ce1173 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>
2011-09-23 10:55:34 -05:00
Hervé Poussineau c1d23eaccc 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>
2011-09-23 10:55:34 -05:00
Michael Roth e098fc3fd2 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>
2011-09-23 10:55:34 -05:00
Jan Kiszka 4c08fd1e42 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>
2011-09-23 10:55:33 -05:00
Jan Kiszka 53d6e68255 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>
2011-09-23 10:55:33 -05:00
Jan Kiszka 57285cc3c6 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>
2011-09-23 10:55:33 -05:00
Jan Kiszka 4463aee630 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>
2011-09-23 10:55:33 -05:00
dann frazier dd8e93799f 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>
2011-09-23 10:55:32 -05:00
Frediano Ziglio 74e26c179e 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>
2011-09-23 10:55:32 -05:00
Peter Maydell 7e36b264ce 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>
2011-09-23 08:36:58 +02:00
Peter Maydell 7196345549 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>
2011-09-23 08:36:36 +02:00
Anthony Liguori d85a1302a9 Merge remote-tracking branch 'kwolf/for-anthony' into staging 2011-09-22 10:31:26 -05:00
Anthony Liguori ed95ee87a5 Merge remote-tracking branch 'qemu-kvm-tmp/memory/core' into staging 2011-09-22 10:30:01 -05:00
Anthony Liguori bea09f657f Merge remote-tracking branch 'stefanha/tracing' into staging 2011-09-22 10:29:46 -05:00
Anthony Liguori 9ba2a054db Merge remote-tracking branch 'stefanha/trivial-patches' into staging 2011-09-22 10:29:42 -05:00
Anthony Liguori bdd2672109 Merge remote-tracking branch 'qemu-kvm-tmp/memory/batch' into staging 2011-09-22 10:27:14 -05:00
Nick Thomas 363c3c8535 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>
2011-09-21 15:16:04 +02:00
Nick Thomas c84dcdc1d6 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>
2011-09-21 15:16:02 +02:00
Daniel Verkamp 465f1ab161 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>
2011-09-21 14:32:20 +02:00
Lluís Vilanova 4b710a3cd4 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>
2011-09-21 11:32:37 +01:00
Stefan Hajnoczi 6c2a407426 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>
2011-09-21 11:30:10 +01:00
Stefan Hajnoczi 85aff1586f 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>
2011-09-21 11:30:07 +01:00
Stefan Hajnoczi 598a3f35c5 MAINTAINERS: add tracing subsystem
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21 11:29:45 +01:00
Stefan Hajnoczi 8f6421179a 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>
2011-09-21 11:29:45 +01:00
Christoph Egger 7b0a03a1ea 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>
2011-09-21 11:10:52 +01:00
Stefan Weil 8b3692d136 Remove qemu_host_page_bits
It was introduced with commit 54936004fd
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>
2011-09-21 10:50:59 +01:00
Jan Kiszka 53380ac37f 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>
2011-09-21 10:50:10 +01:00
Jan Kiszka c2162a8b07 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>
2011-09-21 10:49:38 +01:00
Jan Kiszka 43b26fc851 Drop unneeded pthread.h inclusions
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21 10:49:16 +01:00
Paolo Bonzini 903ec8eae6 fix compilation with stderr trace backend
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-09-21 10:49:02 +01:00