Ian Jackson [Fri, 28 Mar 2008 16:10:30 +0000 (16:10 +0000)]
Use ioemu block drivers through blktap; import other Xen-specific files.
Add support for a tap:ioemu pseudo driver. Devices using this driver
won't use tapdisk (containing the code duplication) any more, but will
connect to the qemu-dm of the domain. In this way no working
configuration should be broken right now as you can still choose to
use the tapdisk drivers.
Signed-off-by: Kevin Wolf <kwolf@suse.de>
Also, import and update various Xen-specific files from xen-unstable
tip 17307:b667e220e556.
Ian Jackson [Fri, 28 Mar 2008 14:47:12 +0000 (14:47 +0000)]
Fix L1 table endianess of qcow images created by tapdisk
The qemu/ioemu implementation of the qcow format uses a big endian L1
table. tapdisk omits the necessary conversion, so qcow images have the
wrong endianess and cannot be read by correct implementations of qcow.
This patch detects broken tapdisk images and converts their L1 tables
to big endian when the image file is opened in ioemu for the first
time. The fixed image has a new flag EXTHDR_L1_BIG_ENDIAN set in the
extended header.
Note that a converted image cannot be opened by tapdisk again.
Ian Jackson [Mon, 17 Mar 2008 15:48:42 +0000 (15:48 +0000)]
Remove most uses of phys_ram_base in hw/pc.c
In this patch, I remove all the direct uses of phys_ram_base
from hw/pc.c, except for those presently needed to construct the
arguments to the vga init functions.
This involved:
* Getting rid of various additions and subtractions of phys_ram_base
* Changing the types of the guest physical addresses in load_linux
from uint8_t* to target_phys_addr_t
* Replacing calls to memcpy and pstrcpy with
cpu_physical_memory_write (and a new pstrcpy_targphys function)
* Replacing most calls to fread with a new fread_targphys function
* Deprecating load_image in favour of a new load_image_targphys
* Removing (rather than fixing up) the unused function load_kernel
I noticed that load_image doesn't take a buffer size argument - it
just overwrites the destination buffer with file data, extending as
long as the file happens to be. In most cases this is probably not an
exploitable vulnerability, but it seems poor practice. Hence
load_image_targphys's extra argument.
Ian Jackson [Fri, 28 Mar 2008 16:54:09 +0000 (16:54 +0000)]
Perform emulated IDE flushes asynchronously.
We arrange for the WIN_FLUSH_CACHE and WIN_FLUSH_CACHE_EXT
commands to use a new bdrv_aio_flush facility.
If there is an error, the ATA-7 spec says that we are supposed to know
which is the first block whose flush failed and leave that in the
block offset registers. However since we are using f(data)sync that's
not possible for us. There is sadly no way for us to report the error
which won't encourage the guest to try to understand what went wrong
and then do the flush again expecting the remaining blocks to be
written (as specified by ATA-7).
So if the asynchronous flush fails, we kill the disk by detaching
->bs. This makes it vanish: we don't generate any more interrupts,
leave status set to busy, and ignore future commands (and discard any
in-flight IO). Alan Cox reports that this will probably induce the
best available behaviour in guests (retry for a while and then give
up). Fine-grained error reporting is available if the guest turns off
the write cache.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Modified-by: Ian Jackson <ian.jackson@eu.citrix.com> Signed-off-by: Kouya Shimura <kouya@jp.fujitsu.com>
Ian Jackson [Thu, 27 Mar 2008 17:58:45 +0000 (17:58 +0000)]
make write cacheing controllable by guest
This patch implements the ATA write cache feature. This enables a
guest to control, in the standard way, whether disk writes are
immediately committed to disk before the IDE command completes, or may
be buffered in the host.
In this patch, by default buffering is off, which provides better
reliability but may have a performance impact. It would be
straightforward to change the default, or perhaps offer a command-line
option, if that would be preferred.
This patch is derived from one which was originally submitted to the
Xen tree by Rik van Riel <riel@redhat.com> and includes code to save
the write_cache setting from Samuel Thibault.
From: Rik van Riel <riel@redhat.com> Signed-off-by: Christian Limpach <Christian.Limpach@xensource.com> Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Ian Jackson [Wed, 13 Feb 2008 16:24:30 +0000 (16:24 +0000)]
check return value from read() and write() properly
The system calls read and write may return less than the whole amount
requested for a number of reasons. So the idioms
if (read(fd, &object, sizeof(object)) != sizeof(object)) goto fail;
and even worse
if (read(fd, &object, sizeof(object)) < 0) goto fail;
are wrong. Additionally, read and write may sometimes return EINTR on
some systems so interruption is not desired or expected a loop is
needed.
Ian Jackson [Wed, 13 Feb 2008 16:20:09 +0000 (16:20 +0000)]
Remove clone-and-hack qemu_malloc et al.
qemu-img.c has copies of qemu_malloc et al, which are already provided
in osdep.c. The attached patch removes these from qemu-img.c and
adds osdep.o to BLOCK_OBJS.
Ian Jackson [Wed, 13 Feb 2008 16:18:49 +0000 (16:18 +0000)]
Make it possible to disable AF_UNIX (unix-domain) sockets
The patch below makes it possible to disable AF_UNIX (unix-domain)
sockets in host environments which do not define _WIN32, by adding
-DNO_UNIX_SOCKETS to the compiler flags. This is useful in the
effectively-embedded qemu host which are going to be using for device
emulation in Xen.
Ian Jackson [Wed, 13 Feb 2008 16:17:54 +0000 (16:17 +0000)]
qemu's audio subdirectory contains a copy of BSD's sys-queue.h, which
defines a bunch of LIST_ macros. This makes it difficult to build a
program made partly out of qemu and partly out of the Linux kernel,
since Linux has a different set of LIST_ macros. It might also cause
trouble when mixing with BSD-derived code.
Under the circumstances it's probably best to rename the versions in
qemu. The attached patch does this.
edgar_igl [Sat, 15 Mar 2008 20:45:05 +0000 (20:45 +0000)]
More TCG conversions for CRIS.
* Bit swap insn (bitwise not, endian swap and bit reverse).
* Muls and mulu.
* Extended arithmetics.
* Parts of the condition code handling.
* Use tcg_const_tl.
aurel32 [Thu, 13 Mar 2008 19:23:00 +0000 (19:23 +0000)]
ds1225y nvram: Fix some bugs
- whole nvram was erased in some conditions
- fix out of range accesses
- improve reading speed by keeping contents in memory
- rename capacity to chip_size
aurel32 [Thu, 13 Mar 2008 19:20:33 +0000 (19:20 +0000)]
Slowdown SDL while minimized
When SDL is invisible/minimized, there is no need to keep calling the
VGA refresh 33 times per second. This patch reduces in that case the
rate to 2 times per second, which should be responsive enough for the
un-minimizing event.