Commit graph

12657 commits

Author SHA1 Message Date
Kevin Wolf b8a83a4f79 cutils: qemu_iovec_copy and qemu_iovec_memset
This adds two functions that work on QEMUIOVectors and will be used by the next
qcow2 patches.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Christoph Hellwig 1b2adf2803 ide: propagate the required alignment
IDE is a bit ugly in this respect.  For one it doesn't really keep track
of a sector size - most of the protocol is in units of 512 bytes, and we
assume 2048 bytes for CDROMs which is correct most of the time.

Second IDE allocates an I/O buffer long before we know if we're dealing
with a CDROM or not, so increase the alignment for the io_buffer
unconditionally.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Christoph Hellwig 73fdb1e195 scsi-disk: propagate the required alignment
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Christoph Hellwig 316a7af350 virtio-blk: propagate the required alignment
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Kevin Wolf 9f8e668eb1 qcow2: Get rid of additional sync on COW
We always have a sync for the refcount update when a new cluster is
allocated. If we move this past the COW, we can save an additional sync.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Kevin Wolf 29216ed14f qcow2: Move sync out of qcow2_alloc_clusters
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Kevin Wolf 1c4c28149f qcow2: Move sync out of update_refcount
Note that the flush is omitted intentionally in qcow2_free_clusters. If
anything, we can leak clusters here if we lose the writes.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Kevin Wolf c01828fb51 qcow2: Move sync out of write_refcount_block_entries
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Laurent Vivier c2e2872bf4 nbd: correctly manage default port
block/nbd.c: use default port number when none is specified
qemu-nbd.c:  use IANA-assigned port number: 10809

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Laurent Vivier 5fe16888d3 Improve qemu-nbd performance by 4400 %
This patch allows to reduce the boot time from an NBD server from 225 seconds to
5 seconds (time between the "boot cd:0" and the kernel init) for the
following command lines:

./qemu-nbd -t ../ISO/debian-500-powerpc-netinst.iso
and
./ppc-softmmu/qemu-system-ppc -cdrom nbd:localhost:1024

This patch combines the reply header and payload send operation.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Christoph Hellwig 581b9e29f3 raw-posix: handle > 512 byte alignment correctly
Replace the hardcoded handling of 512 byte alignment with bs->buffer_alignment
to handle larger sector size devices correctly.

Note that we can not rely on it to be initialize in bdrv_open, so deal
with the worst case there.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Christoph Hellwig 72aef7318f use qemu_blockalign consistently
Use qemu_blockalign for all allocations in the block layer.  This allows
increasing the required alignment, which is need to support O_DIRECT on
devices with large block sizes.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-09-21 15:39:42 +02:00
Kevin Wolf a655211ac6 vvfat: Use cache=unsafe
The qcow file used for write support in vvfat is a temporary file,
so we can use cache=unsafe there. Without this, write support is just
too slow to be of any use.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
2010-09-21 15:39:42 +02:00
Kevin Wolf 9217e26f43 vvfat: Fix double free for opening the image rw
Allocation and deallocation of bs->opaque is not in the control of a
block driver. Therefore it should not set bs->opaque to a data structure
used by another bs, or closing the image will lead to a double free.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
2010-09-21 15:39:42 +02:00
Kevin Wolf ac48e389d0 vvfat: Fix segfault on write to read-only disk
vvfat tries to set the readonly flag in its open function, but nowadays
this is overwritted with the readonly=... command line option. Check in
bdrv_write if the vvfat was opened read-only and return an error in this
case.

Without this check, vvfat tries to access the qcow bs, which is NULL
without enabled write support.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
2010-09-21 15:39:42 +02:00
Anthony Liguori a287916c71 Merge remote branch 'mst/for_anthony' into staging 2010-09-20 13:22:20 -05:00
Stefan Hajnoczi 78aeb23ede e1000: Pad short frames to minimum size (60 bytes)
The OpenIndiana (Solaris) e1000g driver drops frames that are too long
or too short.  It expects to receive frames of at least the Ethernet
minimum size.  ARP requests in particular are small and will be dropped
if they are not padded appropriately, preventing a Solaris VM from
becoming visible on the network.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-20 20:03:39 +02:00
Blue Swirl 952afb719f mingw: use ASLR, no-SEH and DEP if available
If the linker supports the flags --dynamicbase, --no-seh,
or --nxcompat, use them.

Tested on Windows Vista: Process Explorer reports that ASLR and DEP
are in use. No effect seen on Wine or Windows XP.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-19 08:36:34 +00:00
Edgar E. Iglesias ebab1720f6 cris: Fix watchdog resets
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-19 00:30:25 +02:00
Edgar E. Iglesias 58aebb946a cris: Fix TLB exec bit protection
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-18 12:34:59 +02:00
Blue Swirl 0b65b9e105 Use gcc warning flag -Wnested-externs
If the compiler supports the warning flag -Wnested-externs, use it.

Avoid the only warning by moving the declaration of xml_builtin to a
more proper place.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 07:02:16 +00:00
Blue Swirl 3ffd710e12 Use gcc warning flag -Wempty-body
If the compiler supports the warning flag -Wempty-body, use it.

Adjust the code to avoid the warnings.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 07:01:48 +00:00
Blue Swirl a21493e009 Use a few more gcc warning flags
If the compiler supports the following warning flags, use them:

-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers
-Wmissing-include-dirs

Currently, these flags don't produce any warnings.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 07:01:05 +00:00
Blue Swirl 6e15cb5f6d Use gcc warning flag -Wtype-limits
If the compiler supports the warning flag -Wtype-limits, use it.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:15 +00:00
Blue Swirl 7d1476898f pxa2xx: fix SSSR TFN logic
Fix SSSR TFN logic: TX FIFO is never filled, so it is always in
underrun condition if SSP is enabled.

This also avoids a gcc warning with -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:15 +00:00
Blue Swirl 1c7242da85 MIPS: fix yield handling
The parameter for yield should be handled as a signed integer
for the comparisons to have any effect.

This also avoids a gcc warning with -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:15 +00:00
Blue Swirl d62d28630d PPC: Suppress gcc warnings with -Wtype-limits
The hack added by c5b76b3810 was not
enough to avoid warnings with gcc flag -Wtype-limits. Add a new macro
to fix both problems.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:15 +00:00
Blue Swirl 95ee3914bf blkdebug: fix enum comparison
The signedness of enum types depend on the compiler implementation.
Therefore the check for negative values may or may not be meaningful.

Fix by explicitly casting to a signed integer.

Since the values are also checked earlier against event_names
table, this is an internal error. Change the 'if' to 'assert'.

This also avoids a warning with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:15 +00:00
Blue Swirl 603ff77610 pxa2xx: remove useless checks
Remove checks which were made useless by r5849,
8da3ff1809.

This also avoids a warning with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:15 +00:00
Blue Swirl 45416789e8 Use range_covers_byte
Use range_covers_byte() instead of comparisons.

This avoids some warnings with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:14 +00:00
Blue Swirl bf1b007123 Introduce range.h
Extract range functions from pci.h. These will be used by later patches
by non-PCI devices. Adjust current users.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:14 +00:00
Blue Swirl f562e716c9 linux-user: improve flatload error checking
Because of the use of unsigned type, possible errors during
load were ignored.

Fix by using a signed type.

This also avoids a warning with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:14 +00:00
Blue Swirl d0b3e4f5f4 linux-user: fix types in a comparison
-1ul is unsigned long, which does not necessarily match abi_ulong
type.

Fix by using abi_long instead.

This also avoids a warning with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:14 +00:00
Blue Swirl 3872425343 linux-user: fix socklen_t comparisons
On many systems, socklen_t is defined as unsigned. This means that
checks for negative values are not meaningful.

Fix by explicitly casting to a signed integer.

This also avoids some warnings with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:14 +00:00
Blue Swirl 093209cd68 Check for errors during BIOS or kernel load
Because of the use of unsigned types, possible errors during
BIOS or kernel load were ignored.

Fix by using a signed type.

This also avoids some warnings with GCC flag -Wtype-limits.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-18 05:53:14 +00:00
Hervé Poussineau dbf3c4b4ba Make ARP replies at least 64 bytes long
IEEE 802.3 standard requires Ethernet frames to be at least 64 bytes long.
If it is not the case, they will be considered as runt frames, and may be ignored by netcard and/or OS

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-17 12:46:27 +02:00
Hervé Poussineau 0d491754d0 Accept packets with TTL=1
Packets with TTL=1 may be directed to local network (DHCP/DNS servers for example), so don't discard them
This is required by old versions of NetBSD which send DHCP DISCOVER packets with TTL=1

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-17 12:46:27 +02:00
Edgar E. Iglesias abdfd9500e cris: Avoid spurios hw_abort on recursive bus faults
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-16 15:40:27 +02:00
Alexander Graf 41557447d3 PPC: Redesign interrupt trigger path
According to the Book3S spec, the interrupt context starts with an MSR
value that is rather simple. If we leave out the HV case, it's almost
always 0.

To reflect this, let's redesign the way that MSR value gets calculated.
Using this, we also squash the bug where MSR_POW can slip through into
the interrupt handler MSR.

Reported-by: Thomas Monjalon <thomas.monjalon@openwide.fr>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-15 16:18:33 +02:00
Alexander Graf f844c817d7 PPC: Enable hint bits for lwarx/ldarx
The lwarx and ldarx instructions have a bit to give some hint to the
CPU which is safe to ignore. We currently refuse to accept any instruction
with that bit set, as it used to be declared MBZ.

Let's remove the reserved bit and make the instruction work as expected.
This fixes Linux boot for ppc64.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-15 16:18:27 +02:00
Michal Novotny 9a7c487842 serial: Update parameters after load
This is the patch to update serial port parameters after guest is
already loaded.

Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-15 15:35:53 +02:00
Michael S. Tsirkin 6b37c87c96 vhost: fix infinite loop on error path
file.index is unsigned, hence 'while (--file.index >= 0)'
will loop > forever. Change to while (file.index-- > 0).

Reported-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-09-14 16:02:23 +02:00
Stefan Weil 46411f863c Remove wrong semicolon in macro definition
Macros normally should not end with a semicolon,
otherwise their usage results in two statements
where only one statement was expected.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-14 10:58:38 +02:00
Michal Novotny b6601141cd serial: Wrap debug prints around a DPRINTF macro
Signed-off-by: Michal Novotny <minovotn@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-13 14:32:32 +02:00
Blue Swirl 73d7434279 ESP: fix ESP DMA access when DMA is not enabled
Sending ESP a command caused it to trigger DMA immediately
even if DMA was not enabled at the DMA controller.

Add a signal from DMA controller to ESP to tell ESP about changes in
DMA enable bit. Also use the correct function for setting up GPIO outputs.

This fixes NetBSD 1.6.1 through 3.0 boot.

Thanks to Artyom Tarasenko for extensive debugging of the problem.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-11 16:38:33 +00:00
Edgar E. Iglesias 24e0e38b83 powerpc: Avoid TLB related log spamming
Invalid TLB entries are normal and should not spam the log.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2010-09-11 14:29:07 +02:00
Blue Swirl 2184d75b4a trace: fix a regex portability problem
The /bin/sh in Milax has problems with the regex:
Error: invalid trace backend
Please choose a supported trace backend.

Fix it by escaping ')' like the regexes with '('.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-11 10:43:39 +00:00
Blue Swirl dda8521197 trace: fix a typo
There is no qemu_valloc() but qemu_vmalloc().

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 23:54:56 +03:00
Blue Swirl 876f256bde HACKING: add rules for printf-like functions
Add rules for printf-like functions, based on libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:53:11 +00:00
Blue Swirl d241f143c9 HACKING: add string management rules
Add string management rules, somewhat like libvirt HACKING.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-09-10 18:53:05 +00:00