Stefan Weil [Wed, 31 Aug 2011 10:38:00 +0000 (12:38 +0200)]
Add new macro QEMU_PACKED for packed C structures
A packed struct needs different gcc attributes for compilations
with MinGW compilers because glib-2.0 adds compiler flag
-mms-bitfields which modifies the packing algorithm.
Attribute gcc_struct reverses the negative effects of -mms-bitfields.
QEMU_PACKED sets this attribute and must be used for any packed
struct which is affected by -mms-bitfields.
Brad [Sun, 28 Aug 2011 08:01:33 +0000 (04:01 -0400)]
Fix install(1) usage to be compatible with OpenBSD's install(1).
Fix install(1) usage to be compatible with OpenBSD's install(1).
When creating a directory via the -d flag the -p flag cannot be
used at the same time. Also in the context of installing QEMU it
doesn't make sense to use the -p flag anyway so use the [default]
-c flag instead.
Anthony Liguori [Mon, 22 Aug 2011 13:24:58 +0000 (08:24 -0500)]
main: force enabling of I/O thread
Enabling the I/O thread by default seems like an important part of declaring
1.0. Besides allowing true SMP support with KVM, the I/O thread means that the
TCG VCPU doesn't have to multiplex itself with the I/O dispatch routines which
currently requires a (racey) signal based alarm system.
I know there have been concerns about performance. I think so far the ones that
have come up (virtio-net) are most likely due to secondary reasons like
decreased batching.
I think we ought to force enabling I/O thread early in 1.0 development and
commit to resolving any lingering issues.
Stefan Hajnoczi [Thu, 25 Aug 2011 08:18:52 +0000 (09:18 +0100)]
build: sort objects to remove duplicates for link
Avoid duplicate object files during the link. There are legitimate
cases where a link command-line would include duplicate object files
because two independent subsystems both depend on common infrastructure.
Use GNU make's $(sort) function to remove duplicate object files from
the link command-line.
Anthony Liguori [Mon, 22 Aug 2011 13:12:53 +0000 (08:12 -0500)]
main: switch qemu_set_fd_handler to g_io_add_watch
This patch changes qemu_set_fd_handler to be implemented in terms of
g_io_add_watch(). The semantics are a bit different so some glue is required.
qemu_set_fd_handler2 is much harder to convert because of its use of polling.
The glib main loop has the major of advantage of having a proven thread safe
architecture. By using the glib main loop instead of our own, it will allow us
to eventually introduce multiple I/O threads.
I'm pretty sure that this will work on Win32, but I would appreciate some help
testing. I think the semantics of g_io_channel_unix_new() are really just tied
to the notion of a "unix fd" and not necessarily unix itself.
Anthony Liguori [Mon, 22 Aug 2011 13:12:52 +0000 (08:12 -0500)]
Add glib support to main loop
This allows GSources to be used to register callback events in QEMU. This is
useful as it allows us to take greater advantage of glib and also because it
allows us to write code that is more easily testable outside of QEMU since we
can make use of glib's main loop in unit tests.
All new code should use glib's callback mechanisms for registering fd events
which are very well documented at:
Peter Maydell [Thu, 1 Sep 2011 15:45:01 +0000 (16:45 +0100)]
tcg/ppc/tcg-target.c: Avoid 'set but not used' gcc warnings
Move the declaration and initialisation of some variables in
tcg_out_qemu_ld and tcg_out_qemu_st inside CONFIG_SOFTMMU, to
avoid the "variable set but not used" warning of gcc 4.6.
Stefan Hajnoczi [Thu, 25 Aug 2011 17:03:49 +0000 (18:03 +0100)]
simpletrace: fix process() argument count
The simpletrace.process() function invokes analyzer methods with the
wrong number of arguments if a timestamp should be included. This patch
fixes the issue so that trace analysis scripts can make use of
timestamps.
Lluís [Wed, 31 Aug 2011 18:31:45 +0000 (20:31 +0200)]
trace: [simple] disable all trace points by default
Note that this refers to the backend-specific state (whether the output must be
generated), not the event "disabled" property (which always uses the "nop"
backend).
Lluís [Wed, 31 Aug 2011 18:31:31 +0000 (20:31 +0200)]
trace: add "-trace events" argument to control initial state
The "-trace events" argument can be used to provide a file with a list of trace
event names that will be enabled prior to starting execution, thus providing
early tracing.
This saves the user from manually toggling event states through the monitor
interface or whichever backend-specific interface.
Lluís [Wed, 31 Aug 2011 18:31:24 +0000 (20:31 +0200)]
trace: always compile support for controlling and querying trace event states
The current interface is generic for this small set of operations, and thus
other backends can easily modify the "trace/control.c" file to add their own
implementation.
Lluís [Wed, 31 Aug 2011 18:31:18 +0000 (20:31 +0200)]
trace: separate trace event control and query routines from the simple backend
Generalize the 'st_print_trace_events' and 'st_change_trace_event_state' into
backend-specific 'trace_print_events' and 'trace_event_set_state' (respectively)
in the "trace/control.h" file.
Lluís [Wed, 31 Aug 2011 18:31:03 +0000 (20:31 +0200)]
trace: avoid conditional code compilation during option parsing
A default implementation for backend-specific routines is provided in
"trace/default.c", which backends can override by setting "trace_default=no" in
"configure".
Lluís [Wed, 31 Aug 2011 18:30:37 +0000 (20:30 +0200)]
build: [simple] Include qemu-timer-common.o in trace-obj-y
Helper programs like qemu-ga use tracing primitives, but qemu-timer-common.o
(also used by simpletrace.o) is not necessarily included in the linkage line.
Peter Maydell [Tue, 30 Aug 2011 17:36:56 +0000 (18:36 +0100)]
tusb6010: Convert to qdev
Convert the tusb6010 to qdev.
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]> Signed-off-by: Edgar E. Iglesias <[email protected]>
Kevin Wolf [Fri, 26 Aug 2011 13:27:13 +0000 (15:27 +0200)]
qemu-img: Require larger zero areas for sparse handling
By default, require 4k of consecutive zero bytes for qemu-img to make the
output file sparse by not issuing a write request for the zeroed parts. Add an
-S option to allow users to tune this setting.
This helps to avoid situations where a lot of zero sectors and data sectors are
mixed and qemu-img tended to issue many tiny 512 byte writes.
Avi Kivity [Mon, 29 Aug 2011 06:12:49 +0000 (09:12 +0300)]
memory: fix rom_device I/O mode
When adding a rom_device in I/O mode, we incorrectly masked off the low
bits, resulting in a pure RAM map. Fix my masking off the high bits and
IO_MEM_ROMD, yielding a pure I/O map.
Peter Maydell [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
omap_gpmc: Implement prefetch engine
This commit implements the prefetch engine feature of the GPMC
which can be used for NAND devices. This includes both interrupt
driven and DMA-filling modes.
Juha Riihimäki [Sun, 28 Aug 2011 16:22:20 +0000 (16:22 +0000)]
omap_gpmc: Accept a zero mask field on omap3630
OMAP3630 adds an extra bit of address masking, so a mask of
0xb1111 is valid. Unfortunately the GPMC_REVISION is the same as
on the OMAP3430 which only has three bits of address masking, so
we have to derive this feature directly from the OMAP revision
rather than from the GPMC revision.
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]>
Peter Maydell [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Support NAND devices
Support accesses to NAND devices, both by mapping them into
the GPMC address space, and via the NAND_COMMAND, NAND_ADDRESS
and NAND_DATA GPMC registers.
Juha Riihimäki [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Calculate revision from OMAP model
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]>
Juha Riihimäki [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Take omap_mpu_state* in omap_gpmc_init
Take a pointer to the omap mpu state struct in omap_gpmc_init.
Some details of GPMC behaviour depend on the OMAP version we
are a part of.
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]>
Peter Maydell [Sun, 28 Aug 2011 16:22:19 +0000 (16:22 +0000)]
omap_gpmc: Fix handling of FIFOTHRESHOLDSTATUS bit
The OMAP3 TRM is inconsistent about whether the GPMC FIFOTHRESHOLDSTATUS
bit should be set when FIFOPOINTER > FIFOTHRESHOLD or when it is >=
FIFOTHRESHOLD. Apparently the underlying functional spec from which
the TRM was created states that the behaviour is ">=", and this also
makes more conceptual sense.
Peter Maydell [Sun, 28 Aug 2011 16:22:18 +0000 (16:22 +0000)]
omap_gpmc: Refactor omap_gpmc_cs_map and omap_gpmc_cs_unmap
Refactor the omap_gpmc_cs_map/unmap functions:
* take the omap_gpmc_s* and a chipselect id rather than the
omap_gpmc_cs_file_s*, so they have access to the general gpmc
member fields
* extract the base and mask from the config registers in the functions
rather than at every callsite
* check for CSVALID in the functions rather than at every callsite
Peter Maydell [Sun, 28 Aug 2011 16:22:18 +0000 (16:22 +0000)]
omap_gpmc: Clean up omap_gpmc_attach MemoryRegion conversion
Now that all callers of omap_gpmc_attach pass in a MemoryRegion*,
we can remove the base_update and unmap function pointer arguments,
and the opaque pointer that was passed into these callbacks.
We can also remove the base and size fields from omap_gpmc_cs_file_s
as these are no longer necessary (you don't need the base/size
to unmap a MemoryRegion the way you did to undo a mapping made
with cpu_register_physical_memory()).
Juha Riihimäki [Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)]
hw/onenand: Minor spacing fixes
Minor whitespace-only cleanup (separated out from the qdevifying
patch for clarity).
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]>
Juha Riihimäki [Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)]
hw/onenand: Qdevify
Qdevify the ONENAND device.
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]>
Juha Riihimäki [Sun, 28 Aug 2011 16:33:02 +0000 (16:33 +0000)]
hw/onenand: Remove unnecessary argument from onenand_command()
Refactor onenand_command() -- since it is essentially a method of
the device object, it doesn't make sense to pass in something as
an argument which is one of the object's own member fields.
Signed-off-by: Juha Riihimäki <[email protected]>
[Riku Voipio: Fixes and restructuring patchset] Signed-off-by: Riku Voipio <[email protected]>
[Peter Maydell: More fixes and cleanups for upstream submission] Signed-off-by: Peter Maydell <[email protected]>
Peter Maydell [Sun, 28 Aug 2011 16:22:17 +0000 (16:22 +0000)]
hw/sysbus: Add sysbus_mmio_get_region()
Add a sysbus_mmio_get_region() which allows users of sysbus
devices to turn a (SysBusDevice*, mmioidx) tuple into a
MemoryRegion*. This enables some useful simplifications of
devices which pass through another device's mmio region
(either directly or by implementing some kind of memory
controller device).
Blue Swirl [Sat, 30 Jul 2011 19:18:32 +0000 (19:18 +0000)]
TCG: improve optimizer debugging
Use enum TCGOpcode instead of plain old int so that the name of
current op can be seen in GDB. Add a default case to switch
so that GCC does not complain about unhandled enum cases.
Gerd Hoffmann [Fri, 26 Aug 2011 09:16:10 +0000 (11:16 +0200)]
Fix linker scripts
Remove PROVIDE_HIDDEN and ONLY_IF_{RO,RW} from linker scripts to make
them work with older binutils versions. Fixes *-bsd-user build on
OpenBSD 4.9 which ships binutils 2.15.
Brad [Mon, 22 Aug 2011 20:39:59 +0000 (16:39 -0400)]
Fix build on OpenBSD with BSD userland emu and smartcard NSS enabled
The first issue is the hard coded POSIX Real Time extensions library in the
libcacard/Makefile. From looking at the code it doesn't seem this is necessary
anyway. Robert Relyea seems to think it most likely isn't necessary.
The second issue was the missing exclusion of the BSD userland binary
builds from the addition of this Makefile target for the smartcard NSS
code which breaks the builds if smartcard NSS support is enabled.
Account the total latency for read/write/flush requests. This allows
management tools to average it based on a snapshot of the nr ops
counters and allow checking for SLAs or provide statistics.
When the vhost notifier is disabled, the userspace handler runs
immediately: virtio_pci_set_host_notifier_internal might
call virtio_queue_notify_vq.
Since the VQ state and the tap backend state aren't
recovered yet, this causes
"Guest moved used index from XXX to YYY" assertions.
The solution is to split out host notifier handling
from vhost VQ setup and disable notifiers as our last step
when we stop vhost-net. For symmetry enable them first thing
on start.
Jan Kiszka [Thu, 25 Aug 2011 09:10:13 +0000 (11:10 +0200)]
vga: Silence bogus gcc warning about uninitialized variables
Some gcc versions do not properly detect that all possible cases are
covered and base and size are always initialized. Please gcc by defining
a pseudo default case.
Decouple the I/O accounting from bdrv_aio_readv/writev/flush and
make the hardware models call directly into the accounting helpers.
This means:
- we do not count internal requests from image formats in addition
to guest originating I/O
- we do not double count I/O ops if the device model handles it
chunk wise
- we only account I/O once it actuall is done
- can extent I/O accounting to synchronous or coroutine I/O easily
- implement I/O latency tracking easily (see the next patch)
I've conveted the existing device model callers to the new model,
device models that are using synchronous I/O and weren't accounted
before haven't been updated yet. Also scsi hasn't been converted
to the end-to-end accounting as I want to defer that after the pending
scsi layer overhaul.
Jamie Iles [Wed, 10 Aug 2011 14:18:42 +0000 (15:18 +0100)]
monitor: fix build breakage for !CONFIG_VNC
Commit c62f6d1 (monitor: fix build breakage with --disable-vnc)
conditionalised some VNC setup code but left an unused variable. Move
the variable into the conditional code to fix the build breakage.
Avi Kivity [Mon, 1 Aug 2011 08:04:39 +0000 (11:04 +0300)]
piix_pci: wrap memory update in a transaction
The code will remap all PAMs, even if just one is updated, resulting
in reduced performance. Wrap in a transaction to detect that those
other PAMs have not changed.