]> git.proxmox.com Git - qemu.git/log
qemu.git
13 years agoUpdate for 0.12.5 release v0.12.5
Aurelien Jarno [Thu, 22 Jul 2010 12:39:04 +0000 (14:39 +0200)]
Update for 0.12.5 release

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoaudio/alsa: Handle SND_PCM_STATE_SETUP in alsa_poll_handler
malc [Sun, 28 Feb 2010 15:34:21 +0000 (18:34 +0300)]
audio/alsa: Handle SND_PCM_STATE_SETUP in alsa_poll_handler

Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit d9812b033a17c82f9e933757c1c3ef364e3ba62d)

13 years agoblock: Handle multiwrite errors only when all requests have completed
Kevin Wolf [Thu, 1 Jul 2010 14:08:51 +0000 (16:08 +0200)]
block: Handle multiwrite errors only when all requests have completed

Don't try to be clever by freeing all temporary data and calling all callbacks
when the return value (an error) is certain. Doing so has at least two
important problems:

* The temporary data that is freed (qiov, possibly zero buffer) is still used
  by the requests that have not yet completed.
* Calling the callbacks for all requests in the multiwrite means for the caller
  that it may free buffers etc. which are still in use.

Just remember the error value and do the cleanup when all requests have
completed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit de189a1b4a471d37a2909e97646654fc9751b52f)

13 years agoblock: Fix early failure in multiwrite
Kevin Wolf [Wed, 14 Jul 2010 10:42:02 +0000 (12:42 +0200)]
block: Fix early failure in multiwrite

bdrv_aio_writev may call the callback immediately (and it will commonly do so
in error cases). Current code doesn't consider this. For details see the
comment added by this patch.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 453f9a1652629e5805995b165be2e634c8487139)

Conflicts:

block.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovpc: Use bdrv_(p)write_sync for metadata writes
Kevin Wolf [Wed, 14 Jul 2010 11:08:45 +0000 (13:08 +0200)]
vpc: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 078a458e077d6b0db262c4b05fee51d01de2d1d2)

Conflicts:

block/vpc.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovmdk: Use bdrv_(p)write_sync for metadata writes
Kevin Wolf [Wed, 14 Jul 2010 11:08:04 +0000 (13:08 +0200)]
vmdk: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit b8852e87d9d113096342c3e0977266cda0fe9ee5)

Conflicts:

block/vmdk.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Use bdrv_(p)write_sync for metadata writes
Kevin Wolf [Wed, 14 Jul 2010 10:11:51 +0000 (12:11 +0200)]
qcow2: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 8b3b720620a1137a1b794fc3ed64734236f94e06)

Conflicts:

block/qcow2-cluster.c
block/qcow2-refcount.c
block/qcow2-snapshot.c
block/qcow2.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow: Use bdrv_(p)write_sync for metadata writes
Kevin Wolf [Wed, 14 Jul 2010 10:02:53 +0000 (12:02 +0200)]
qcow: Use bdrv_(p)write_sync for metadata writes

Use bdrv_(p)write_sync to ensure metadata integrity in case of a crash.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 5e5557d97026d1d3325e0e7b0ba593366da2f3dc)

Conflicts:

block/qcow.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Add bdrv_(p)write_sync
Kevin Wolf [Wed, 16 Jun 2010 14:38:15 +0000 (16:38 +0200)]
block: Add bdrv_(p)write_sync

Add new functions that write and flush the written data to disk immediately.
This is what needs to be used for image format metadata to maintain integrity
for cache=... modes that don't use O_DSYNC. (Actually, we only need barriers,
and therefore the functions are defined as such, but flushes is what is
implemented in this patch - we can try to change that later)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f08145fe16470aca09304099888f68cfbc5d1de7)

13 years agoqcow2: Restore L1 entry on l2_allocate failure
Kevin Wolf [Mon, 7 Jun 2010 14:43:22 +0000 (16:43 +0200)]
qcow2: Restore L1 entry on l2_allocate failure

If writing the L1 table to disk failed, we need to restore its old content in
memory to avoid inconsistencies.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 68dba0bf455e60061bb3c9c40ef0d82916372664)

13 years agoblock/vdi: Fix image opening and creation for odd disk sizes
Kevin Wolf [Wed, 14 Jul 2010 09:50:47 +0000 (11:50 +0200)]
block/vdi: Fix image opening and creation for odd disk sizes

The fix is based on a patch from Kevin Wolf. Here his comment:

"The number of blocks needs to be rounded up to cover all of the virtual hard
disk. Without this fix, we can't even open our own images if their size is not
a multiple of the block size."

While Kevin's patch addressed vdi_create, my modification also fixes
vdi_open which now accepts images with odd disk sizes.

v3:
Don't allow reading of disk images with too large disk sizes.
Neither VBoxManage nor old versions of qemu-img read such images.
This change requires rounding of odd disk sizes before we do the checks.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: François Revol <revol@free.fr>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit f21dc3a4652eeb82117d7d55d975278fe1444b26)

Conflicts:

block/vdi.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock/vpc: Fix conversion from size to disk geometry
Stefan Weil [Mon, 10 May 2010 19:46:26 +0000 (21:46 +0200)]
block/vpc: Fix conversion from size to disk geometry

The VHD algorithm calculates a disk geometry
which is usually smaller than the requested size.

QEMU tried to round up but failed for certain sizes:

qemu-img create -f vpc disk.vpc 9437184
would create an image with 9435136 bytes
(which is too small for qemu-img convert).

Instead of hacking the geometry algorithm, the patch
increases the number of sectors until we get enough
sectors.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit dede4188cc817a039154ed2ecd7f3285f6b94056)

13 years agoqcow2: Remove abort on free_clusters failure
Kevin Wolf [Wed, 21 Apr 2010 09:37:52 +0000 (11:37 +0200)]
qcow2: Remove abort on free_clusters failure

While it's true that during regular operation free_clusters failure would be a
bug, an I/O error can always happen. There's no need to kill the VM, the worst
thing that can happen (and it will) is that we leak some clusters.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 003fad6e2cae5311d3aea996388c90e3ab17de90)

13 years agovmdk: Fix COW
Kevin Wolf [Fri, 16 Apr 2010 17:28:14 +0000 (19:28 +0200)]
vmdk: Fix COW

When trying to do COW, VMDK wrote the data back to the backing file. This
problem was revealed by the patch that made backing files read-only. This patch
does not only fix the problem, but also simplifies the VMDK code a bit.

This fixes the backing file qemu-iotests cases for VMDK.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit c336500df5bf08492f4e7796b2193cd4976f3548)

13 years agoqcow2: Fix creation of large images
Kevin Wolf [Wed, 14 Jul 2010 08:33:49 +0000 (10:33 +0200)]
qcow2: Fix creation of large images

qcow_create2 assumes that the new image will only need one cluster for its
refcount table initially. Obviously that's not true any more when the image is
big enough (exact value depends on the cluster size).

This patch calculates the refcount table size dynamically.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 4768fa902c3860f2fe34403e6e1c83bfca6da034)

Conflicts:

block/qcow2.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovmdk: fix double free
Kevin Wolf [Wed, 14 Jul 2010 08:30:31 +0000 (10:30 +0200)]
vmdk: fix double free

fail_gd error case would also free rgd_buf that was already freed

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit a161329b61106ab093aab6d3227ac85e0b8251a9)

Conflicts:

block/vmdk.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-options: add documentation for stdio signal=on|off
Aurelien Jarno [Tue, 13 Jul 2010 19:13:12 +0000 (21:13 +0200)]
qemu-options: add documentation for stdio signal=on|off

Commit 5989020bc11f8ba448d6fb79f4562f882a693d89 introduced a chardev
option to disable signals on stdio. Add the corresponding documentation.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm : fix parallel saturated subtraction implementation
Chih-Min Chao [Mon, 28 Jun 2010 15:54:06 +0000 (23:54 +0800)]
target-arm : fix parallel saturated subtraction implementation

Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 4c4fd3f852dbb3a7dbcc59110d03d3d15ada5f72)

13 years agotarget-arm : fix thumb2 parallel add/sub opcode decoding
Chih-Min Chao [Mon, 28 Jun 2010 15:54:05 +0000 (23:54 +0800)]
target-arm : fix thumb2 parallel add/sub opcode decoding

Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit ed89a2f1b11db03fbdb0ddab93c25913a16c0374)

13 years agotarget-arm: fix addsub/subadd implementation
Chih-Min Chao [Mon, 28 Jun 2010 15:54:04 +0000 (23:54 +0800)]
target-arm: fix addsub/subadd implementation

Signed-off-by: Chih-Min Chao <cmchao@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit bb42e28bdb56a05faca83bd760c1581af2f73a4b)

13 years agotarget-i386: fix xchg rax,r8
Richard Henderson [Thu, 1 Jul 2010 16:42:21 +0000 (09:42 -0700)]
target-i386: fix xchg rax,r8

We were ignoring REX_B while special-casing NOP, i.e. xchg eax,eax.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 7418027ea4fec276455abd4291558bc58a0a7ba7)

13 years agoblock/vvfat.c: fix warnings with _FORTIFY_SOURCE
Kirill A. Shutemov [Tue, 19 Jan 2010 23:56:14 +0000 (00:56 +0100)]
block/vvfat.c: fix warnings with _FORTIFY_SOURCE

CC    block/vvfat.o
cc1: warnings being treated as errors
block/vvfat.c: In function 'commit_one_file':
block/vvfat.c:2259: error: ignoring return value of 'ftruncate', declared with attribute warn_unused_result
make: *** [block/vvfat.o] Error 1
  CC    block/vvfat.o
In file included from /usr/include/stdio.h:912,
                 from ./qemu-common.h:19,
                 from block/vvfat.c:27:
In function 'snprintf',
    inlined from 'init_directories' at block/vvfat.c:871,
    inlined from 'vvfat_open' at block/vvfat.c:1068:
/usr/include/bits/stdio2.h:65: error: call to __builtin___snprintf_chk will always overflow destination buffer
make: *** [block/vvfat.o] Error 1

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2dedf83ef0cc3463783d6b71bf1b25476f691f3a)

13 years agoaudio/alsa: Spelling typo (paramters)
Vagrant Cascadian [Fri, 26 Feb 2010 21:39:46 +0000 (13:39 -0800)]
audio/alsa: Spelling typo (paramters)

Trivial patch to fix the spelling of "parameters".

Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit f093feb735ab57171b6fe16f54b7d3b989907d98)

13 years agotarget-mips: fix DINSU instruction
Aurelien Jarno [Wed, 30 Jun 2010 18:00:31 +0000 (20:00 +0200)]
target-mips: fix DINSU instruction

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoCorrect definitions for FD_CMD_SAVE and FD_CMD_RESTORE
Jes Sorensen [Fri, 11 Jun 2010 14:02:34 +0000 (16:02 +0200)]
Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE

Correct definitions for FD_CMD_SAVE and FD_CMD_RESTORE in hw/fdc.c

Per https://bugs.launchpad.net/qemu/+bug/424453 the correct values
for FD_CMD_SAVE is 0x2e and FD_CMD_RESTORE is 0x4e. Verified against
the Intel 82078 manual which can be found at:
http://wiki.qemu.org/Documentation/HardwareManuals page 22.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit bb350a5e9b961a8c3940b3451c329ff07c027aa1)

13 years agoqcow2: Fix corruption after error in update_refcount
Kevin Wolf [Fri, 28 May 2010 10:21:27 +0000 (12:21 +0200)]
qcow2: Fix corruption after error in update_refcount

After it is done with updating refcounts in the cache, update_refcount writes
all changed entries to disk. If a refcount block allocation fails, however,
there was no change yet and therefore first_index = last_index = -1. Don't
treat -1 as a normal sector index (resulting in a 512 byte write!) but return
without updating anything in this case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 86fa8da83771238de55dc44819a1a27bafef5353)

13 years agoqcow2: Fix corruption after refblock allocation
Kevin Wolf [Fri, 28 May 2010 10:05:45 +0000 (12:05 +0200)]
qcow2: Fix corruption after refblock allocation

Refblock allocation code needs to take into consideration that update_refcount
will load a different refcount block into the cache, so it must initialize the
cache for a new refcount block only afterwards. Not doing this means that not
only the refcount in the wrong block is updated, but also that the caller will
work on the wrong block.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 25408c09502be036e5575754fe54019ed4ed5dfa)

13 years agoblock: Fix multiwrite with overlapping requests
Kevin Wolf [Fri, 21 May 2010 09:09:42 +0000 (11:09 +0200)]
block: Fix multiwrite with overlapping requests

With overlapping requests, the total number of sectors is smaller than the sum
of the nb_sectors of both requests.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit cbf1dff2f1033cadcb15c0ffc9c0a3d039d8ed42)

13 years agoqcow2: Fix error handling in l2_allocate
Kevin Wolf [Fri, 28 May 2010 17:12:24 +0000 (19:12 +0200)]
qcow2: Fix error handling in l2_allocate

l2_allocate has some intermediate states in which the image is inconsistent.
Change the order to write to the L1 table only after the new L2 table has
successfully been initialized.

Also reset the L2 cache in failure case, it's very likely wrong.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 175e11526e2613b3dc031c23fec3107aa4a80307)

Conflicts:

block/qcow2-cluster.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqcow2: Clear L2 table cache after write error
Kevin Wolf [Fri, 28 May 2010 17:06:31 +0000 (19:06 +0200)]
qcow2: Clear L2 table cache after write error

If the L2 table was already updated in cache, but writing it to disk has
failed, we must not continue using the changed version in the cache to stay
consistent with what's on the disk.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 1b7c801b40ce90795397bb566d019c9b76ef9c13)

Conflicts:

block/qcow2-cluster.c

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: Fix ide_dma_cancel
Kevin Wolf [Tue, 4 May 2010 14:35:24 +0000 (16:35 +0200)]
ide: Fix ide_dma_cancel

When cancelling a request, bdrv_aio_cancel may decide that it waits for
completion of a request rather than for cancellation. IDE therefore can't
abandon its DMA status before calling bdrv_aio_cancel; otherwise the callback
of a completed request would use invalid data.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 38d8dfa193e9a45f0f08b06aab2ba2a94f40a041)

13 years agousb-bus: fix no params
Luiz Capitulino [Wed, 2 Jun 2010 20:19:56 +0000 (17:19 -0300)]
usb-bus: fix no params

After commit 702f3e0fb52c124c07f215426eeadb70a716643f, the params is
nerver NULL. It should check *params instead of params to determine
whether the params is empty.

Signed-off-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 98f22dc172e1ebd5341da3de0d67666442566f72)

13 years agoAvoid crash on '-usbdevice <device>' without parameters
Jan Kiszka [Wed, 2 Jun 2010 20:19:55 +0000 (17:19 -0300)]
Avoid crash on '-usbdevice <device>' without parameters

Many usbdevice_init implementors assume params is non-NULL.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 702f3e0fb52c124c07f215426eeadb70a716643f)

13 years agoFix -usbdevice crash
Paul Brook [Wed, 2 Jun 2010 20:19:54 +0000 (17:19 -0300)]
Fix -usbdevice crash

If -usbdevice is used on a machine with no USB busses, usb_create
will fail and return NULL.  Patch below handles this failure gracefully
rather than crashing when we try to init the device.

Signed-off-by: Paul Brook <paul@codesourcery.com>
(cherry picked from commit d44168fffa07fc57e61a37da65e9348661dec887)

13 years agoFix multiboot compilation
Alexander Graf [Tue, 1 Jun 2010 23:56:50 +0000 (01:56 +0200)]
Fix multiboot compilation

Commit dd4239d6574ca41c94fc0d0f77ddc728510ffc57 broke multiboot. It replaced the
instruction "rep insb (%dx), %es:(%edi)" by the binary output of
"addr32 rep insb (%dx), %es:(%di)".

Linuxboot calls the respective helper function in a code16 section. So the
original instruction was automatically translated to its "addr32" equivalent.
For multiboot, we're running in code32 so gcc didn't add the "addr32" which
breaks the instruction.

This patch splits that helper function in one which uses addr32 and one which
does not, so everyone's happy.

The good news is that nobody probably cared so far. The bundled multiboot.bin
binary was built before the change and is thus correct.

Please also put this patch into -stable.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 590bf491a49670843ee902c47f7ab1de5e9acd06)

13 years agoFix missing symbols in .rel/.rela.plt sections
Loïc Minier [Sun, 31 Jan 2010 11:22:52 +0000 (12:22 +0100)]
Fix missing symbols in .rel/.rela.plt sections

Fix .rel.plt sections in the output to not only include .rel.plt
sections from the input but also the .rel.iplt sections and to define
the hidden symbols __rel_iplt_start and __rel_iplt_end around
.rel.iplt as otherwise we get undefined references to these when
linking statically to a multilib libc.a.  This fixes the static build
under i386.

Apply similar logic to rela.plt/.iplt and __rela_iplt/_plt_start/_end to
fix the static build under amd64.

Signed-off-by: Loïc Minier <lool@dooz.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 845f2c2812d9ed24b36c02a3d06ee83aeafe8b49)

13 years agotarget-ppc: fix RFI by clearing some bits of MSR
Thomas Monjalon [Fri, 28 May 2010 19:07:32 +0000 (21:07 +0200)]
target-ppc: fix RFI by clearing some bits of MSR

Since commit 2ada0ed, "Return From Interrupt" is broken for PPC processors
because some interrupt specifics bits of SRR1 are copied to MSR.

SRR1 is a save of MSR during interrupt.
During RFI, MSR must be restored from SRR1.
But some bits of SRR1 are interrupt-specific and are not used for MSR saving.

This is the specification (ISA 2.06) at chapter 6.4.3 (Interrupt Processing):
"2. Bits 33:36 and 42:47 of SRR1 or HSRR1 are loaded with information specific
    to the interrupt type.
 3. Bits 0:32, 37:41, and 48:63 of SRR1 or HSRR1 are loaded with a copy of the
    corresponding bits of the MSR."

Below is a representation of MSR bits which are not saved:
0:15 16:31 32  33:36    37:41      42:47     48:63
——— | ——— | — X X X X — — — — — X X X X X X | ————
0000 0000 |    7   |   8   |   3   |   F    | 0000

History:
In the initial Qemu implementation (e1833e1), the mask 0x783F0000 was used for
saving MSR in SRR1. But all the bits 32:47 were cleared during RFI restoring.
This was wrong. The commit 2ada0ed explains that this breaks Altivec.
Indeed, bit 38 (for Altivec support) must be saved and restored.
The change of 2ada0ed was to restore all the bits of SRR1 to MSR.
But it's also wrong.

Explanation:
As an example, let's see what's happening after a TLB miss.
According to the e300 manual (E300CORERM table 5-6), the TLB miss interrupts
set the bits 44-47 for KEY, I/D, WAY and S/L. These bits are specifics to the
interrupt and must not be copied into MSR at the end of the interrupt.
With the current implementation, a TLB miss overwrite bits POW, TGPR and ILE.

Fix:
It shouldn't be needed to filter-out bits on MSR saving when interrupt occurs.
Specific bits overwrite MSR ones in SRR1.
But at the end of interrupt (RFI), specifics bits must be cleared before
restoring MSR from SRR1. The mask 0x783F0000 apply here.

Discussion:
The bits of the mask 0x783F0000 are cleared after an interrupt.
I cannot find a specification which talks about this
but I assume it is the truth since Linux can run this way.
Maybe it's not perfect but it's better (works for e300).

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit c3d420ead1aee9fcfd12be11cbdf6b1620134773)

13 years agoFix typo in balloon help
Riccardo Magliocchetti [Wed, 19 May 2010 16:49:28 +0000 (18:49 +0200)]
Fix typo in balloon help

Fix launchpad #563883

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 3c05613a6a51da833105c1bf3db4917d917f5a3a)

13 years agoarm_timer: fix oneshot mode
Rabin Vincent [Sun, 2 May 2010 09:50:52 +0000 (15:20 +0530)]
arm_timer: fix oneshot mode

In oneshot mode, the delta needs to come from the TimerLoad register,
not the maximum limit.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit a9cf98d939c4f6539fad7e7d812ea16d96ba3dc9)

13 years agoarm_timer: reload timer when enabled
Rabin Vincent [Sun, 2 May 2010 09:50:51 +0000 (15:20 +0530)]
arm_timer: reload timer when enabled

Reload the timer when TimerControl is written, if the timer is to be
enabled.  Otherwise, if an earlier write to TimerLoad was done while
periodic mode was not set, s->delta may incorrectly still have the value
of the maximum limit instead of the value written to TimerLoad.

This problem is evident on versatileap on current linux-next, which
enables TIMER_CTRL_32BIT before writing to TimerLoad and then enabling
periodic mode and starting the timer.  This causes the first periodic
tick to be scheduled to occur after 0xffffffff periods, leading to a
perceived hang while the kernel waits for the first timer tick.

Signed-off-by: Rabin Vincent <rabin@rab.in>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit d6759902cb467c002086853d2eb38fb969c29f7f)

13 years agoqemu-sockets: avoid strlen of NULL pointer
Jens Osterkamp [Mon, 12 Apr 2010 08:51:01 +0000 (10:51 +0200)]
qemu-sockets: avoid strlen of NULL pointer

If the user wants to create a chardev of type socket but forgets to give a
host= option, qemu_opt_get returns NULL. This NULL pointer is then fed into
strlen a few lines below without a check which results in a segfault.
This fixes it.

Signed-off-by: Jens Osterkamp <jens@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit e23a22e620e84f42bdbd473b82672654e7c8de73)

13 years agoblock: fix aio_flush segfaults for read-only protocols (e.g. curl)
Avi Kivity [Sun, 16 May 2010 11:59:57 +0000 (14:59 +0300)]
block: fix aio_flush segfaults for read-only protocols (e.g. curl)

Not all block format drivers expose an io_flush method (reasonable for
read-only protocols), so calling io_flush there will immediately segfault.

Fix by checking for the method's existence before calling it.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit c53a7285b4377e91f30b7742c7e12c16d6bf86f0)

13 years agovirtio-blk: fix barrier support
Christoph Hellwig [Wed, 19 May 2010 10:40:09 +0000 (12:40 +0200)]
virtio-blk: fix barrier support

Before issuing the barrier to the block driver we need to flush our oustanding
queue of write requests, as the flush is supposed to be issued after them.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 618fbb84299780af96e3d4c4b6f2148656fe3708)

13 years agoblock: fix sector comparism in multiwrite_req_compare
Christoph Hellwig [Wed, 19 May 2010 18:53:10 +0000 (20:53 +0200)]
block: fix sector comparism in multiwrite_req_compare

The difference between the start sectors of two requests can be larger
than the size of the "int" type, which can lead to a not correctly
sorted multiwrite array and thus spurious I/O errors and filesystem
corruption due to incorrect request merges.

So instead of doing the cute sector arithmetics trick spell out the
exact comparisms.

Spotted by Kevin Wolf based on a testcase from Michael Tokarev.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 77be4366baface6613cfc312ba281f8e5860997c)

13 years agopci: irq_state vmstate breakage
Michael S. Tsirkin [Sun, 9 May 2010 16:15:16 +0000 (19:15 +0300)]
pci: irq_state vmstate breakage

Code for saving irq_state got vm_state
macros wrong, passing in the wrong parameter.
As a result, we both saved a wrong value
and restored it to a wrong offset.

This leads to device and bus irq counts getting
out of sync, which in turn leads to interrupts getting lost or
never cleared, such as
https://bugzilla.redhat.com/show_bug.cgi?id=588133

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
(cherry picked from commit c3f8f61157625d0bb5bfc135047573de48fdc675)

13 years agoqemu-img: use the heap instead of the huge stack array for win32
TeLeMan [Mon, 8 Feb 2010 08:20:00 +0000 (16:20 +0800)]
qemu-img: use the heap instead of the huge stack array for win32

The default stack size of PE is 1MB on win32 and IO_BUF_SIZE in
img_convert() & img_rebase() is 2MB, so qemu-img will crash when doing
"convert" & "rebase" on win32.
Although we can improve the stack size of PE to resolve it, I think we
should avoid using the huge stack variables.

Signed-off-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 72ff25e4e98d6dba9286d032b9ff5432553bbad5)

13 years agoUpdate for 0.12.4 release v0.12.4
Anthony Liguori [Tue, 4 May 2010 14:17:19 +0000 (09:17 -0500)]
Update for 0.12.4 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoWorkaround for broken OSS_GETVERSION on FreeBSD, part two
Juergen Lock [Tue, 12 Jan 2010 22:48:04 +0000 (23:48 +0100)]
Workaround for broken OSS_GETVERSION on FreeBSD, part two

Turns out on those versions of FreeBSD (>= 7.x) that know OSS_GETVERSION
the ioctl doesn't actually work yet (except in the Linuxolator), so if
building on FreeBSD assume the sound drivers are new enough if the ioctl
returns the errno it does currently on FreeBSD.

(Rev 2 after private discussion with malc.)

Signed-off-by: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 72ff25e4e98d6dba9286d032b9ff5432553bbad5)

14 years agooss: fix fragment setting
malc [Sat, 9 Jan 2010 15:06:54 +0000 (18:06 +0300)]
oss: fix fragment setting

Previous patch introduced subtle regression, in cases when
OSS_GETVERSION fails the code wasn't falling back to
SNDCTL_DSP_SETFRAGMENT.

Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 3d709fe73a77c40e263b3af6e650fd4b519c3562)

14 years agooss: issue OSS_GETVERSION ioctl only when needed
malc [Sat, 9 Jan 2010 14:54:07 +0000 (17:54 +0300)]
oss: issue OSS_GETVERSION ioctl only when needed

Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 6d246526ce3c145b2831285def6983f5de6190d3)

14 years agooss: refactor code around policy setting
malc [Fri, 8 Jan 2010 21:28:40 +0000 (00:28 +0300)]
oss: refactor code around policy setting

This fixes a problem with a previous patch spotted by Juergen Lock,
thanks to him again.

Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit 78d9356d3caad95a74bc9cd65eea5fc7e050c35d)

14 years agooss: workaround for cases when OSS_GETVERSION is not defined
malc [Fri, 8 Jan 2010 08:26:27 +0000 (11:26 +0300)]
oss: workaround for cases when OSS_GETVERSION is not defined

Thanks to Juergen Lock.

Signed-off-by: malc <av1474@comtv.ru>
(cherry picked from commit e726fe7d60d46636c74c1c4a8fac7e4a05efb163)

14 years agoblock: Free iovec arrays allocated by multiwrite_merge()
Stefan Hajnoczi [Wed, 21 Apr 2010 19:35:45 +0000 (20:35 +0100)]
block: Free iovec arrays allocated by multiwrite_merge()

A new iovec array is allocated when creating a merged write request.
This patch ensures that the iovec array is deleted in addition to its
qiov owner.

Reported-by: Leszek Urbanski <tygrys@moo.pl>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit 1e1ea48d42e011b9bdd0d689d184e7cac4617b66)

14 years agolsi: fix segfault in lsi_command_complete
Gerd Hoffmann [Mon, 29 Mar 2010 13:42:57 +0000 (15:42 +0200)]
lsi: fix segfault in lsi_command_complete

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 6ac08101f9de84be1fb7b45f87caed8ba8f3eb5a)

14 years agolsi: pass lsi_request to lsi_reselect
Gerd Hoffmann [Wed, 6 Jan 2010 16:08:04 +0000 (17:08 +0100)]
lsi: pass lsi_request to lsi_reselect

All callers of lsi_reselect have a lsi_request struct at hand anyway.
So just pass it directly instead of having lsi_reselect search for it
using the tag.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit aa4d32c4742e62e09786bd1067a5b98239867e93)

14 years agolsi: move dma_len+dma_buf into lsi_request
Gerd Hoffmann [Wed, 6 Jan 2010 16:08:03 +0000 (17:08 +0100)]
lsi: move dma_len+dma_buf into lsi_request

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit b96a0da06bd782ef290445479a6d4d0de00c2c23)

14 years agolsi: move current_dev into lsi_request
Gerd Hoffmann [Wed, 6 Jan 2010 16:08:02 +0000 (17:08 +0100)]
lsi: move current_dev into lsi_request

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit daa70311e0f7b37cd0ea3c4de0d163ccf1a36abe)

14 years agolsi: have lsi_request for the whole life time of the request.
Gerd Hoffmann [Wed, 6 Jan 2010 16:08:01 +0000 (17:08 +0100)]
lsi: have lsi_request for the whole life time of the request.

Right now lsi_request is allocated when a request is queued and released
when a request is unqueued.  With this patch applied the lsi_request is
kept for the whole lifetime of the scsi request.

Rationale: We can use it for per-request data then.  The patch does that
already for the request tag.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit af12ac9880eacdd79d49a11d5672df7170afb38f)

14 years agolsi: use QTAILQ for lsi_queue
Gerd Hoffmann [Wed, 6 Jan 2010 16:08:00 +0000 (17:08 +0100)]
lsi: use QTAILQ for lsi_queue

Replace the funky array logic for queued commands with standard
qemu list functions.  Also rename lsi_queue to lsi_request.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 042ec49dc52e54153942a089a46ae584152998fb)

14 years agotcp/mips: Change TCG_AREG0 (fp -> s0)
Stefan Weil [Fri, 9 Apr 2010 15:28:40 +0000 (17:28 +0200)]
tcp/mips: Change TCG_AREG0 (fp -> s0)

Register fp (frame pointer) is a bad choice for compilations
without optimisation, because the compiler makes heavy use
of this register (so the resulting code crashes).

Register s0 had been used for TCG_AREG1 in earlier releases,
but was no longer used and is now free for TCG_AREG0.

The resulting code works for compilations without
optimisation (tested with qemu mips in qemu mips
on x86 host).

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosh_pci: fix memory and I/O access
Aurelien Jarno [Sun, 11 Apr 2010 21:59:39 +0000 (23:59 +0200)]
sh_pci: fix memory and I/O access

Since commit 8da3ff180974732fc4272cb4433fef85c1822961 ("MMIO callback
interface changes"), the addresses passed to the I/O functions are an
offset to the start of the area. As a consequence, there is no need to
correct the address using the value of IOBR. This make possible the use
of the default MMIO functions. Moreover the addresses are now remaped
when the value if IOBR change.

The memory area corresponds to the devices behing the PCI bus, it should
not be mapped by the PCI controller. Remove the corresponding code.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry-picked from commit 5ba9e9522cf572715ca1966b292f64fb78342e22)

14 years agoFix incoming migration with iothread
Marcelo Tosatti [Wed, 3 Feb 2010 23:44:17 +0000 (21:44 -0200)]
Fix incoming migration with iothread

Do not allow the vcpus to execute if the vm is stopped.

Fixes -incoming with CONFIG_IOTHREAD enabled.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
(cherry picked from commit c5f32c99c6855d466737daf1cd262e7e92062f87)

14 years agoFix SIGFPE for vnc display of width/height = 1
Chris Webb [Mon, 8 Mar 2010 14:34:49 +0000 (14:34 +0000)]
Fix SIGFPE for vnc display of width/height = 1

During boot, the screen gets resized to height 1 and a mouse click at this
point will cause a division by zero when calculating the absolute pointer
position from the pixel (x, y). Return a click in the middle of the screen
instead in this case.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit cc39a92cbfc80c70d2b83708a4c9b309c3126ac3)

14 years agonet: remove broken net_set_boot_mask() boot device validation
Eduardo Habkost [Tue, 6 Apr 2010 22:22:07 +0000 (19:22 -0300)]
net: remove broken net_set_boot_mask() boot device validation

There are many problems with net_set_boot_mask():

1) It is broken when using the device model instead of "-net nic". Example:
   $ qemu-system-x86_64 -device rtl8139,vlan=0,id=net0,mac=52:54:00:82:41:fd,bus=pci.0,addr=0x4 -net user,vlan=0,name=hostnet0 -vnc 0.0.0.0:0 -boot n
   Cannot boot from non-existent NIC
   $
2) The mask was previously used to set which boot ROMs were supposed to be
   loaded, but this was changed long time ago. Now all ROM images are loaded,
   and SeaBIOS takes care of jumping to the right boot entry point depending on
   the boot settings.
3) Interpretation and validation of the boot parameter letters is done on
   the machine type code. Examples: PC accepts only a,b,c,d,n as valid boot
   device letters. mac99 accepts only a,b,c,d,e,f.

As a side-effect of this change, qemu-kvm won't abort anymore if using "-boot n"
on a machine with no network devices. Checking if the requested boot device is
valid is now a task for the BIOS or the machine-type code.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Acked-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry-picked from da1fcfda59a6bcbdf58d49243fbced455f2bf78a)

14 years agoqcow2: Remove request from in-flight list after error
Kevin Wolf [Tue, 6 Apr 2010 13:30:14 +0000 (15:30 +0200)]
qcow2: Remove request from in-flight list after error

If we complete a request with a failure we need to remove it from the list of
requests that are in flight. If we don't do it, the next time the same AIOCB is
used for a cluster allocation it will create a loop in the list and qemu will
hang in an endless loop.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit c644db3d53c90ef569ff5a90e9f821b88e7123bb)

14 years agoqcow2: Don't ignore immediate read/write failures
Kevin Wolf [Tue, 6 Apr 2010 13:30:09 +0000 (15:30 +0200)]
qcow2: Don't ignore immediate read/write failures

Returning -EIO is far from optimal, but at least it's an error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 171e3d6b9997c98a97d0c525867f7cd9b640cadd)

14 years agoblock: Fix multiwrite memory leak in error case
Kevin Wolf [Tue, 6 Apr 2010 16:24:07 +0000 (18:24 +0200)]
block: Fix multiwrite memory leak in error case

Previously multiwrite_user_cb was never called if a request in the multiwrite
batch failed right away because it did set mcb->error immediately. Make it look
more like a normal callback to fix this.

Reported-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 7eb58a6c556c3880e6712cbf6d24d681261c5095)

14 years agoblock: Fix error code in multiwrite for immediate failures
Kevin Wolf [Tue, 6 Apr 2010 16:24:06 +0000 (18:24 +0200)]
block: Fix error code in multiwrite for immediate failures

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 0f0b604b00851f2c7160b4195136c1fd27418088)

14 years agoblock: Fix multiwrite error handling
Kevin Wolf [Thu, 1 Apr 2010 20:48:44 +0000 (22:48 +0200)]
block: Fix multiwrite error handling

When two requests of the same multiwrite batch fail, the callback of all
requests in that batch were called twice. This could have any kind of nasty
effects, in my case it lead to use after free and eventually a segfault.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit cb6d3ca07b8f62b47ef30c6a92caa3e8bd71248b)

14 years agoscsi-disk: fix buffer overflow
Gerd Hoffmann [Wed, 10 Mar 2010 16:47:17 +0000 (17:47 +0100)]
scsi-disk: fix buffer overflow

In case s->version is shorter than 4 bytes we overflow the memcpy src
buffer.  Fix it by clearing the target buffer, then copy only the
amount of bytes we actually have.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from 314b1811c15f4e982e4667d9b845aee4b5a63d91)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqcow2: Rewrite alloc_refcount_block/grow_refcount_table
Kevin Wolf [Tue, 23 Feb 2010 15:40:53 +0000 (16:40 +0100)]
qcow2: Rewrite alloc_refcount_block/grow_refcount_table

The current implementation of alloc_refcount_block and grow_refcount_table has
fundamental problems regarding error handling. There are some places where an
I/O error means that the image is going to be corrupted. I have found that the
only way to fix this is to completely rewrite the thing.

In detail, the problem is that the refcount blocks itself are allocated using
alloc_refcount_noref (to avoid endless recursion when updating the refcount of
the new refcount block, which migh access just the same refcount block but its
allocation is not yet completed...). Only at the end of the refcount allocation
the refcount of the refcount block is increased. If an error happens in
between, the refcount block is in use, but has a refcount of zero and will
likely be overwritten later.

The new approach is explained in comments in the code. The trick is basically
to let new refcount blocks describe their own refcount, so their refcount will
be automatically changed when they are hooked up in the refcount table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 92dcb59fd4e1491afa0756ee9c2594869b487d23)

14 years agoqcow2: Factor next_refcount_table_size out
Kevin Wolf [Tue, 23 Feb 2010 15:40:52 +0000 (16:40 +0100)]
qcow2: Factor next_refcount_table_size out

When the refcount table grows, it doesn't only grow by one entry but reserves
some space for future refcount blocks. The algorithm to calculate the number of
entries stays the same with the fixes, so factor it out before replacing the
rest.

As Juan suggested take the opportunity to simplify the code a bit.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 05121aedc41f87e44e41e9cef55f2e49ce7ba94e)

14 years agoblock: avoid creating too large iovecs in multiwrite_merge
Christoph Hellwig [Tue, 26 Jan 2010 13:49:08 +0000 (14:49 +0100)]
block: avoid creating too large iovecs in multiwrite_merge

If we go over the maximum number of iovecs support by syscall we get
back EINVAL from the kernel which translate to I/O errors for the guest.

Add a MAX_IOV defintion for platforms that don't have it.  For now we use
the same 1024 define that's used on Linux and various other platforms,
but until the windows block backend implements some kind of vectored I/O
it doesn't matter.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit e2a305fb13ff0f5cf6ff805555aaa90a5ed5954c)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agojson-parser: Fix segfault on malformed input
Kevin Wolf [Wed, 24 Feb 2010 15:17:58 +0000 (16:17 +0100)]
json-parser: Fix segfault on malformed input

If the parser fails to parse the key in parse_pair, it will access a NULL
pointer. A simple way to trigger this is sending {foo} via QMP. This patch
turns the segfault into a syntax error reply.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit d758d90fe1f74a46042fca665036a23b4d5fe87d)

14 years agolinux-user: switch default ppc64 CPU to 970fx from 970
Aurelien Jarno [Tue, 6 Apr 2010 10:21:05 +0000 (12:21 +0200)]
linux-user: switch default ppc64 CPU to 970fx from 970

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit f7177937a2c0db4c3bb42e3adfde937e9c0734a1)

14 years agotarget-sh4: MMU: fix store queue addresses
Aurelien Jarno [Wed, 3 Feb 2010 17:02:55 +0000 (18:02 +0100)]
target-sh4: MMU: fix store queue addresses

The store queues are located from 0xe0000000 to 0xe3ffffff.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit b1563142123593581895049568c5526b1e91da7b)

14 years agotarget-sh4: MMU: fix ITLB priviledge check
Aurelien Jarno [Mon, 1 Feb 2010 19:07:06 +0000 (20:07 +0100)]
target-sh4: MMU: fix ITLB priviledge check

There is an ITLB access violation if SR_MD=0 (user mode) while
the high bit of the protection key is 0 (priviledge mode).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit bc13ad29e6b7484ccd5e7ee0f5d0f966585eb4c9)

14 years agotarget-sh4: MMU: fix mem_idx computation
Aurelien Jarno [Mon, 1 Feb 2010 18:58:46 +0000 (19:58 +0100)]
target-sh4: MMU: fix mem_idx computation

The mem_idx is wrongly computed. As written in target-sh4/cpu.h, mode 0
corresponds to kernel mode (SR_MD = 1), while mode 1 corresponds to user
mode (SR_MD = 0).

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 33b8f5546cc16eaa3d89fe133a9843c794b65d6c)

14 years agosh7750: handle MMUCR TI bit
Aurelien Jarno [Tue, 2 Feb 2010 18:39:11 +0000 (19:39 +0100)]
sh7750: handle MMUCR TI bit

When the MMUCR TI bit is set, all the UTLB and ITLB entries should be
flushed.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit e781d1285fc3b81d689ba25360c6c272116387fa)

14 years agoUHCI spurious interrut fix
Paul Brook [Sun, 4 Apr 2010 20:48:31 +0000 (21:48 +0100)]
UHCI spurious interrut fix

Only raise an interrupt if the TD has actually completed.

Signed-off-by: Paul Brook <paul@codesourcery.com>
14 years agotcg/mips: fix branch offset during retranslation
Aurelien Jarno [Mon, 29 Mar 2010 00:09:23 +0000 (02:09 +0200)]
tcg/mips: fix branch offset during retranslation

Branch offsets should only be overwritten during relocation, to support
partial retranslation.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 6d8ff4d85ce2f3fc8a18dc8f077f73a4bd19a89a)

14 years agotcg/arm: correctly save/restore registers in prologue/epilogue
Aurelien Jarno [Fri, 5 Mar 2010 07:35:07 +0000 (08:35 +0100)]
tcg/arm: correctly save/restore registers in prologue/epilogue

Since commit 6113d6d3169393c323ac4c82d756a850145a5e7a QEMU crashes
on ARM hosts. This is not a bug of this commit, but a latent bug
revealed by this commit.

The TCG code is called through a procedure call using the prologue
and epilogue code. This code does not save and restore enough registers.
The "Procedure Call Standard for the ARM Architecture" says:

  A subroutine must preserve the contents of the registers r4-r8, r10,
  r11 and SP (and r9 in PCS variants that designate r9 as v6).

The current code only saves and restores r9 to r11, and misses r4 to
r8. The patch fixes that by saving r4 to r12. Theoretically there is
no need to save and restore r12, but an even number of registers have
to be saved as per EABI.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 4e17eae9f2ee49833698aae2753c5bb041510870)

14 years agoworkaround for cmd646 bmdma register access while no dma is active
Igor V. Kovalenko [Sun, 13 Dec 2009 19:03:31 +0000 (19:03 +0000)]
workaround for cmd646 bmdma register access while no dma is active

This is a workaround only, and is a partial revert
of a few changes to BMDMAState which removed pci_dev
field on the way.

- cmd646 pci_from_bm() expects bm->unit value to
correspond with bm data being passed to callback
as opaque pointer. This breaks when write to dma
control register of second channel happens when no
dma operation is in progress, so bm->unit is zero
for second channel, and pci_from_bm() returns garbage
pointer. Crash happens shortly after that while
dereferencing that pointer.

v0->v1: cleaned up dead code from pci_from_bm.

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 90228ee395b71cdd64e6bc844e3d553eb9ef643f)

14 years agoFix corner case in chardev udp: parameter
Jan Kiszka [Sun, 7 Mar 2010 10:28:48 +0000 (11:28 +0100)]
Fix corner case in chardev udp: parameter

The missing '@' broke 'udp::<port>@:<port>' parsing.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 39324ca488ac8f7124b3698d28bf46b90d9acd84)

14 years agoDon't set default monitor when there is a mux'ed one
Jan Kiszka [Sun, 7 Mar 2010 10:28:40 +0000 (11:28 +0100)]
Don't set default monitor when there is a mux'ed one

This fixes eg. "-nographic -serial mon:stdio [-serial ...]".

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 18141ed67f5ee8c7e8e3f8bffdb24d7b8cdbc270)

14 years agospelling typo (compatibilty) in hw/fw_cfg.c
Vagrant Cascadian [Sun, 14 Mar 2010 08:51:53 +0000 (08:51 +0000)]
spelling typo (compatibilty) in hw/fw_cfg.c

here's a trivial patch to fix the spelling of "compatibility":

Signed-off-by: Vagrant Cascadian <vagrant@freegeek.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 66c80e75752e87a9479577fda1446a7623884f01)

14 years agofdc: fix drive property handling.
Gerd Hoffmann [Wed, 10 Mar 2010 16:30:29 +0000 (17:30 +0100)]
fdc: fix drive property handling.

Fix the floppy controller init wrappers to set the drive properties
only in case the DriveInfo pointers passed in are non NULL.  This allows
to set the properties using -global.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 995bf0ca57e52f4991d7f90c7eb2bbf7bc3f3c44)

14 years agotarget-i386: fix commit c22549204a6edc431e8e4358e61bd56386ff6957
TeLeMan [Fri, 12 Mar 2010 11:38:06 +0000 (19:38 +0800)]
target-i386: fix commit c22549204a6edc431e8e4358e61bd56386ff6957

The commit c22549204a6edc431e8e4358e61bd56386ff6957 led movntps &
movntdq to be translated incorrectly.

Signed-off-by: TeLeMan <geleman@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 2e21e7491ff2af3628a97d4652e7adcc6961c2e9)

14 years agotarget-i386: fix SIB decoding with index = 4
Aurelien Jarno [Sat, 6 Mar 2010 17:02:31 +0000 (18:02 +0100)]
target-i386: fix SIB decoding with index = 4

A SIB byte with an index of 4 means "no scaled index", even if the scale
value is not 0. In 64-bit mode, if REX.X is used, an index of 4 selects
%r12. This is correctly handled by the computation of the index variable,
which includes the index bits, and also the REX.X prefix:

    index = ((code >> 3) & 7) | REX_X(s);

Thanks to Avi Kivity, Jamie Lokier and Malc for the analysis of the
problem and the initial patch.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit b16f827bdf7444b8cd338b9ecb654b4752f47225)

14 years agoFix segfault with ram_size > 4095M without kvm
Ryan Harper [Tue, 23 Feb 2010 15:13:14 +0000 (09:13 -0600)]
Fix segfault with ram_size > 4095M without kvm

Currently, x86_64-softmmu qemu segfaults when trying to use > 4095M memsize.
This patch adds a simple check and error message (much like the 2047 limit on
32-bit hosts) on ram_size in the control path after we determine we're
not using kvm

Upstream qemu-kvm is affected if using the -no-kvm option; this patch address
the segfault there as well.

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotarget-i386: Fix long jumps/calls in long mode with REX.W set
malc [Thu, 4 Mar 2010 12:09:26 +0000 (15:09 +0300)]
target-i386: Fix long jumps/calls in long mode with REX.W set

Signed-off-by: malc <av1474@comtv.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 41b1e61f51b05fd6ca060f901b822f83e0beb6b6)

14 years agotarget-i386: fix lddqu SSE instruction
Aurelien Jarno [Sat, 6 Mar 2010 17:33:53 +0000 (18:33 +0100)]
target-i386: fix lddqu SSE instruction

This instruction load data from memory to register and not the reverse.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit c22549204a6edc431e8e4358e61bd56386ff6957)

14 years agoqemu-char.c: drop debug printfs from qemu_chr_parse_compat
Jan Kiszka [Mon, 18 Jan 2010 11:15:01 +0000 (12:15 +0100)]
qemu-char.c: drop debug printfs from qemu_chr_parse_compat

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit 5bb599023a6478e86152a2e8bc2b21775261b9da)

14 years agofix undefined shifts by >32
Paolo Bonzini [Thu, 4 Feb 2010 13:31:50 +0000 (14:31 +0100)]
fix undefined shifts by >32

This one is for 0.12 too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
(cherry picked from commit 0dfbd514460045e3af1ed6805ab97ffedbbd1ab2)

14 years agoFix qemu -net user,hostfwd= example
Aurelien Jarno [Sat, 27 Feb 2010 09:50:32 +0000 (10:50 +0100)]
Fix qemu -net user,hostfwd= example

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(cherry picked from commit aa375206189b7de7c23ad9de66413fb7d4497940)

14 years agoMerge remote branch 'qemu-kvm/uq/stable-0.12' into stable-0.12 v0.12.3
Anthony Liguori [Tue, 23 Feb 2010 20:08:31 +0000 (14:08 -0600)]
Merge remote branch 'qemu-kvm/uq/stable-0.12' into stable-0.12

14 years agoUpdate version and change for 0.12.3 release
Anthony Liguori [Tue, 23 Feb 2010 20:01:00 +0000 (14:01 -0600)]
Update version and change for 0.12.3 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqcow2: Fix access after end of array
Kevin Wolf [Tue, 16 Feb 2010 14:54:49 +0000 (15:54 +0100)]
qcow2: Fix access after end of array

If a write requests crosses a L2 table boundary and all clusters until the
end of the L2 table are usable for the request, we must not look at the next
L2 entry because we already have arrived at the end of the array.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 4805bb66969622f86376191c94c4748bce91e6be)

14 years agoide save/restore pio/atapi cmd transfer fields and io buffer
Marcelo Tosatti [Thu, 11 Feb 2010 20:19:44 +0000 (18:19 -0200)]
ide save/restore pio/atapi cmd transfer fields and io buffer

Save/restore information necessary to continue in progress PIO/ATAPI CMD
transfers.

This includes the IO buffer.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6)

14 years agonet: Monitor command set_link finds only VLAN clients, fix
Markus Armbruster [Thu, 11 Feb 2010 13:45:02 +0000 (14:45 +0100)]
net: Monitor command set_link finds only VLAN clients, fix

Clients not associated with a VLAN exist since commit d80b9fc6.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
(cherry picked from commit 2583ba97ef1de6040b7d0afd2b66737515de5423)