Commit graph

12110 commits

Author SHA1 Message Date
Alexander Graf 17e6a53f82 Fix leul_to_cpu on big endian hosts
Commit 213acd2e introduced leul_to_cpu with a special code path for big endian
hosts. Unfortunately that code used preprocessor magic that didn't work.

This patch replaces the explicit ##s by glue() which is proven to work reliably,
enabling me to compile qemu on ppc again.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-31 20:55:23 +02:00
Lars Munch e03c22a98c arm: fix arm kernel boot for non zero start addr
Booting an arm kernel has been broken a while when booting from non zero start
address. This is due to the order of events: board init loads the kernel and
sets register 15 to the start address and then qemu_system_reset reset the cpu
making register 15 zero again.

This patch fixes the usage of the register 15 start address trick in
combination with arm_load_kernel.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-31 19:40:41 +02:00
Thomas Monjalon 0f89cc7b6c target-ppc: remove useless line
This line was a bit clear.
The next lines set or reset this bit (LE) depending of another bit (ILE).
So the first line is useless.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-31 19:18:25 +02:00
Thomas Monjalon c3d420ead1 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>
2010-05-31 19:17:44 +02:00
Isaku Yamahata e075e788c9 pci-hotplug: make them aware of pci domain.
add helper function which converts root bus to pci domain.
make them aware of pci domain.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31 16:39:55 +03:00
Isaku Yamahata 1b4e8f732d msix: remove duplicated defines.
remove defines which are already defined in pci_regs.h

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31 16:33:52 +03:00
Isaku Yamahata 0c6fcb6210 pci.h: remove unused constants.
So remove unused constants,
PCI_STATUS_RESERVED_MASK_LO, PCI_STATUS_RESERVED_MASK_HI,
PCI_COMMAND_RESERVED, PCI_COMMAND_RESERVED_MASK_HI.
They were used once, but they aren't used anymore.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31 16:33:52 +03:00
Isaku Yamahata 3c18685f43 pci: add const to pci_is_express(), pci_config_size().
add const to pci_is_express(), pci_config_size().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31 16:33:52 +03:00
Isaku Yamahata 5e434f4e60 pci: clean up of pci_set_default_subsystem_id().
Use pci accessor function.
don't return value because it always return 0 and
the caller doesn't check the return value.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-05-31 16:33:52 +03:00
Blue Swirl aa6f63fff6 mc146818rtc: improve debugging
Add a separate flag for debugging coalesced interrupts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-30 19:20:07 +00:00
Artyom Tarasenko da7ed37955 sparc32 SuperSPARC MMU Breakpoint Action register (SS-20 OBP fix)
SuperSPARC MMU Breakpoint Action register is used by OBP at boot

The patch allows booting Solaris and some other OS with
SPARCStation-20 OBP.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 21:22:02 +00:00
Blue Swirl 471fd34221 pc: improve debugging
Add a DPRINTF macro and use it for ISA and PIC interrupts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 20:23:49 +00:00
Blue Swirl 0a3c592166 apic: improve debugging
Add a DPRINTF macro. Use TARGET_FMT_plx for printing target_phys_addr_t
items. Add a separate flag for debugging coalescing interrupts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 20:23:48 +00:00
Blue Swirl 8ac02ff882 i8259: improve debugging
Add a DPRINTF macro.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 20:23:19 +00:00
Blue Swirl 03ae77d6d2 sparc64: fix user emulator build
Accesses with _nucleus prefix are not available when building user
emulators:
  CC    sparc64-linux-user/op_helper.o
cc1: warnings being treated as errors
/src/qemu/target-sparc/op_helper.c: In function 'helper_ldda_asi':
/src/qemu/target-sparc/op_helper.c:3063: error: implicit declaration of function 'ldq_nucleus'

Avoid making such accesses. Fixes breakage by 54a3c0f032.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 10:20:44 +00:00
Artyom Tarasenko 3386376c04 Pad iommu with an empty slot (necessary for SunOS 4.1.4)
On the real hardware (SS-5, LX) the MMU is not padded, but aliased.
Software shouldn't use aliased addresses, neither should it crash
when it uses (on the real hardware it wouldn't). Using empty_slot
instead of aliasing can help with debugging such accesses.

Signed-off-by: Artyom Tarasenko <atar4qemu@googlemail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 08:20:55 +00:00
Igor V. Kovalenko 54a3c0f032 sparc64: fix 128-bit atomic load from nucleus context v1
- change 128-bit atomic loads to reference nucleus context
v0->v1: dropped disassembler change
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-29 07:26:57 +00:00
Paul Brook 68a1c81686 Pre-allocate guest address space
Allow pre-allocation of the guest virtual address space in usermode emulation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-05-29 02:27:35 +01:00
Richard Henderson 0be1d07c0e alpha-linux-user: Fill in SI_CODE for SIGSEGV.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 23:27:20 +02:00
Richard Henderson 680c877af4 linux-user: Use qemu-malloc.c.
Since we're no longer setting PAGE_RESERVED, there's no need to
implement qemu_malloc via mmap.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 23:27:19 +02:00
Richard Henderson 50401022d8 Use calloc in qemu_mallocz.
Avoids the memset if the allocator has gotten new zeroed
storage from the operating system.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 23:27:19 +02:00
Riccardo Magliocchetti 564e2fe8cd linux-user: Fix compilation with DEBUG defined
Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 23:20:34 +02:00
Riccardo Magliocchetti 82f24fccaa Fix hw/gt64xxx.c compilation with DEBUG defined
Use TARGET_FMT_plx as format placeholder for target_phys_addr_t

Signed-off-by: Riccardo Magliocchetti <riccardo.magliocchetti@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 22:08:54 +02:00
Riccardo Magliocchetti 3c05613a6a 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>
2010-05-28 22:08:53 +02:00
Jan Kiszka c1735af1df musicpal: Drop redundant reset call
Reset is now triggered after init, no need for explicit calls anymore.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 21:48:47 +02:00
Stefan Hajnoczi d8e06f973c doc: Update monitor info subcommands
The "info blockstats" documentation was copy-pasted as "info block"
instead of "info blockstats".  The documentation for "commands", "jit",
"numa", "qdm", and "roms" is missing.  This patch resolves these issues
in qemu-monitor.hx.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 21:47:34 +02:00
Avi Kivity 97679527bf Fix overflow in i440fx_init()
The ram_size parameter can be larger than an int, so it may be truncated.

Fix by using the correct type.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 21:33:59 +02:00
Lars Munch 9ba8c3f41d arm: prevent coprocessor IO reset
This prevent coprocessor IO structure from being reset on cpu reset. This was
a problem for PXA which uses coprocessor 6 and 14.

Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 21:25:16 +02:00
Richard Henderson 3e1dbaddbf tcg: Use INDEX_op_qemu_ld32 for 32-bit results.
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-28 20:54:34 +02:00
Nicholas A. Bellinger 1a39685910 block: Add missing bdrv_delete() for SG_IO BlockDriver in find_image_format()
This patch adds a missing bdrv_delete() call in find_image_format() so that a
SG_IO BlockDriver properly releases the temporary BlockDriverState *bs created
from bdrv_file_open()

Signed-off-by: Nicholas A. Bellinger <nab@linux-iscsi.org>
Reported-by: Chris Krumme <chris.krumme@windriver.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:29:17 +02:00
Kevin Wolf 86fa8da837 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>
2010-05-28 13:29:16 +02:00
Kevin Wolf 25408c0950 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>
2010-05-28 13:29:15 +02:00
Kevin Wolf ed0df867d9 qcow2: Return right error code in write_refcount_block_entries
write_refcount_block_entries used to return -EIO for any errors. Change this to
return the real error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:29:13 +02:00
Kevin Wolf 55c17e9821 qcow2: Change l2_load to return 0/-errno
Provide the error code to the caller instead of just indicating success/error.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:29:12 +02:00
Kevin Wolf 1c46efaa0a qcow2: Allow qcow2_get_cluster_offset to return errors
qcow2_get_cluster_offset() looks up a given virtual disk offset and returns the
offset of the corresponding cluster in the image file. Errors (e.g. L2 table
can't be read) are currenctly indicated by a return value of 0, which is
unfortuately the same as for any unallocated cluster. So in effect we can't
check for errors.

This makes the old return value a by-reference parameter and returns the usual
0/-errno error code.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:29:11 +02:00
Jes Sorensen c63782cbe8 block.h: Make BDRV_SECTOR_SIZE 64 bit safe
C defaults to int, so make definition of BDRV_SECTOR_SIZE 64 bit
safe as it and BDRV_SECTOR_MASK may be used against 64 bit addresses.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:14:26 +02:00
Stefan Hajnoczi b587a52c00 posix-aio-compat: Expand tabs that have crept in
This patch expands tabs on a few lines so the code formats nicely and
follows the QEMU coding style.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:14:26 +02:00
Gerd Hoffmann dc33bb3411 drive: allow rerror, werror and readonly for if=none
When creating guest disks the qdev way using ...

  -drive if=none,id=$name,args
  -device $driver,drive=$name

it is not possible to specify rerror, werror and readonly arguments
for drive as drive_init allows/blocks them based on the interface (if=)
specified and none isn't white-listed there.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:14:25 +02:00
MORITA Kazutaka b50cbabc1b add support for protocol driver create_options
This patch enables protocol drivers to use their create options which
are not supported by the format.  For example, protcol drivers can use
a backing_file option with raw format.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:14:25 +02:00
Kevin Wolf 776cbbbd78 qemu-io: Add multiwrite command
The new multiwrite commands allows to use qemu-io for testing
bdrv_aio_multiwrite.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-05-28 13:14:25 +02:00
Kevin Wolf cbf1dff2f1 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>
2010-05-28 13:14:25 +02:00
Kevin Wolf 175e11526e 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>
2010-05-28 13:14:25 +02:00
Kevin Wolf 1b7c801b40 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>
2010-05-28 13:14:25 +02:00
Jes Sorensen 29f91781bd vhost_net.c: v2 Fix build failure introduced by 0bfcd599e3
Fix build failure introduced by 0bfcd599e3

The format statement expects unsigned long on x86_64, but receives
unsigned long long, so gcc exits with an error.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-27 18:57:31 +00:00
Alexander Graf c317728872 Make cache=unsafe the default for -snapshot
When using -snapshot we don't care about data integrity of the cow file
at all, so let's disable flushing there and squeeze out the last drop
of performance we could possibly get.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-27 00:08:09 +02:00
Igor V. Kovalenko d63baf92e3 sparc64: clean up pci bridge map
- remove unused host state and store pci bus pointer only
- do not map host state access into unused 1fe.10000000 range
- reorder pci region registration
- assign pci i/o region to isa_mem_base

Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-26 19:14:21 +00:00
Igor V. Kovalenko 5910b047a0 sparc64: rename sun4u cpu to Ultrasparc IIi
Signed-off-by: Igor V. Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-05-26 19:13:36 +00:00
Alexander Graf 016f5cf6ff Add cache=unsafe parameter to -drive
Usually the guest can tell the host to flush data to disk. In some cases we
don't want to flush though, but try to keep everything in cache.

So let's add a new cache value to -drive that allows us to set the cache
policy to most aggressive, disabling flushes. We call this mode "unsafe",
as guest data is not guaranteed to survive host crashes anymore.

This patch also adds a noop function for aio, so we can do nothing in AIO
fashion.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2010-05-26 20:05:14 +02:00
Gerd Hoffmann d467b679f2 vnc: rich cursor support.
Uses VNC_ENCODING_RICH_CURSOR.  Adding XCURSOR support should be
possible without much trouble.  Shouldn't be needed though as
RICH_CURSOR is a superset of XCURSOR.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-05-24 15:18:24 -05:00
Gerd Hoffmann fbe6d7a48d use new cursor struct + functions for vmware vga and sdl.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-05-24 15:18:24 -05:00