Commit Graph

19317 Commits

Author SHA1 Message Date
Stefan Weil 071c939458 Replace Qemu by QEMU in user visible documentation
The official spelling is QEMU.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 13:58:06 +00:00
Wanpeng Li 97a33880e7 remove useless comments in dma
This comment is useless, just removes it and makes the codes clear.

Signed-off-by: Wanpeng Li <liwp@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 13:46:35 +00:00
Stefan Weil 3b2aba2f13 tci: Support targets with CONFIG_TCG_PASS_AREG0 (fix broken build)
Builds with --enable-tcg-interpreter failed because more and more
targets (currently alpha and sparc) replaced the global env in AREG0
by function parameters.

Convert the TCG interpreter to use the new helper functions and add
defines for those targets which still use AREG0.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 13:44:01 +00:00
Blue Swirl adcd61f7fc Merge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu
* 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio/qemu:
  Userspace ARM BE8 support
  elf.h: Update EF_ARM_ constants to newer ABI versions
  arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
  linux-user/arm/syscall_nr.h: Add syscall number for ppoll
  linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
  linux-user/syscall.c: Fix indentation in prctl handling
  linux-user: reserve 4GB of vmem for 32-on-64
  linux-user: resolve reserved_va vma downwards
  linux-user: take RESERVED_VA into account for g2h_valid()
  linux-user: fix fallocate
  linux-user: Add ioctl for BLKBSZGET
  linux-user: add BLKSSZGET ioctl wrapper
  linux-user: fix BLK ioctl arguments
  linux-user: add struct old_dev_t compat
  linux-user: implement device mapper ioctls
  linux-user: target_argv is placed on ts->bprm->argv and can't be freed()
  linux-user: improve fake /proc/self/stat making `ps` not segfault.
2012-04-07 11:45:25 +00:00
Stefan Weil 6375e09e79 w64: Fix data type of tb_next and other variables used for host addresses
QEMU host addresses must use uintptr_t to be portable for hosts with
an unusual size of long (w64).

tb_jmp_offset is an uint16_t value, therefore the local variable offset
in function tb_set_jmp_target was changed from unsigned long to uint16_t.

The type cast to long in function tb_add_jump now also uses uintptr_t.
For the bit operation used here, the signedness of the type cast does
not matter.

Some remaining unsigned long values are either only used for ARM assembler
code or will be fixed in a later patch for PPC.

v2:
Fix signature of tb_find_pc in exec.c, too (hint from Blue Swirl, thanks).
There remain lots of other long / unsigned long in exec.c which must be
replaced by uintptr_t. This will be done in a separate patch. Here
only one of these type casts is fixed.

v3:
Also fix signature of page_unprotect.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 11:27:45 +00:00
Peter Maydell 760e141613 softfloat: roundAndPackInt{32, 64}: Don't assume int32 is 32 bits
Fix code in roundAndPackInt32 that assumed that int32 was only
32 bits, by simply using int32_t instead. Fix the parallel bug
in roundAndPackInt64 as well, although that one is only theoretical
since it's unlikely that int64 will ever be more than 64 bits.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 11:15:55 +00:00
Peter Maydell b3a6a2e041 softfloat: float*_to_int32_round_to_zero: don't assume int32 is 32 bits
Code in the float64_to_int32_round_to_zero() function was assuming
that int32 would not be wider than 32 bits; this meant it might
not correctly detect the overflow case. We take the simple approach
of using int32_t. Also fix equivalent issues in the functions
for other float sizes.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 11:15:44 +00:00
Paolo Bonzini a52d28afb4 configure: require glib 2.12, 2.20 for mingw32
These are pretty sane requirements to move forward with glib usage.
2.12 is the version found in RHEL/CentOS 5, and 2.20 is the
first version to support g_poll.  Without g_poll, we cannot
integrate well with the glib main loop.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 10:04:46 +00:00
Paolo Bonzini ea26ce765c main-loop: integrate glib sources for w32
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:34:18 +00:00
Paolo Bonzini 06ac7d4979 main-loop: replace WaitForMultipleObjects with g_poll
On w32, glib implements g_poll using WaitForMultipleObjects
or MsgWaitForMultipleObjects.  This means that we can simplify
our code by switching to g_poll, and at the same time prepare for
adding back glib sources.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:34:17 +00:00
Paolo Bonzini d3385eb448 main-loop: interrupt wait when data arrives on a socket
Right now, the main loop is not interrupted when data arrives on a
socket.  To fix this, register each socket to interrupt the main loop
with WSAEventSelect.  This does not replace select, it only communicates
a change in socket state that requires a select call.

Since the interrupt fires only once per recv call, or only once
after a send call returns EWOULDBLOCK we can activate it on all events
unconditionally.  If QEMU is momentarily uninterested on some condition,
the main loop will not busy wait.  Instead, it may get one extra wakeup,
but then it will ignore the condition until progress occurs and/or
qemu_set_fd_handler is called to set a callback.  At this point the
condition will be tested via select and the callback will be invoked
even if it is still disabled on the event.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:34:16 +00:00
Paolo Bonzini 15455536df main-loop: disable fd_set-based glib integration under w32
Using select with glib pollfds is wrong under w32.  Restrict
the code to the POSIX case.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:34:15 +00:00
Paolo Bonzini 4dae83aeac main loop: use msec-based timeout in glib_select_fill
The timeval-based timeout is not needed until we actually invoke select,
so compute it only then.  Also group the two calls that modify the
timeout, glib_select_fill and os_host_main_loop_wait.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:34:15 +00:00
Andreas Färber ab7ab3d74c target-sparc: QOM'ify CPU
Embed CPUSPARCState as first member of SPARCCPU.
Drop cpu_sparc_close() in favor of object_delete() and a finalizer.
Let cpu_state_reset() call cpu_reset().

Make TYPE_SPARC_CPU non-abstract for now.
Distinguish between "sparc-cpu" and "sparc64-cpu".

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:25:21 +00:00
Andreas Färber 88ca012a1f target-sparc: Rename cpu_init.c
Align QOM'ified targets, with a view to simplify Makefile.target.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-07 08:24:44 +00:00
Paul Brook d8fd295499 Userspace ARM BE8 support
Add support for ARM BE8 userspace binaries.
i.e. big-endian data and little-endian code.
In principle LE8 mode is also possible, but AFAIK has never actually
been implemented/used.

System emulation doesn't have any useable big-endian board models,
but should in principle work once you fix that.
Dynamic endianness switching requires messing with data accesses,
preferably with TCG cooperation, and is orthogonal to BE8 support.

Signed-off-by: Paul Brook <paul@codesourcery.com>
[PMM: various changes, mostly as per my suggestions in code review:
 * rebase
 * use EF_ defines rather than hardcoded constants
 * make bswap_code a bool for future VMSTATE macro compatibility
 * update comment in cpu.h about TB flags bit field usage
 * factor out load-code-and-swap into arm_ld*_code functions and
   get_user_code* macros
 * fix stray trailing space at end of line
 * added braces in disas.c to satisfy checkpatch
]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 19:25:57 +03:00
Peter Maydell ef8b0c0474 elf.h: Update EF_ARM_ constants to newer ABI versions
Update the EF_ARM_* constants (for the ELF header e_flags field)
to include the newer flags specified for later versions of the ABI.
(This set of constants is from include/elf/arm.h from binutils-2.17
and so licensed under GPL-v2-or-later.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 19:25:57 +03:00
Benoit Canet adf050b1b9 arm-linux-user: fix elfload.c's AT_HWCAP to reflect cpu features.
The cpu capabilities passed by the elf loader in AT_HWCAP where
a constant.
Make AT_HWCAP reflect the emulated cpu features in order to give
correct clues to eglibc.

Riku Voipio: fixed to apply to current head

Fix :  [Bug 887516] [NEW] VFP support reported for the PXA270

Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 19:06:34 +03:00
Peter Maydell d1b02ea0dc linux-user/arm/syscall_nr.h: Add syscall number for ppoll
The list of ARM syscall numbers was missing the entry for ppoll,
which meant we were accidentally not providing it. (This wasn't
causing any practical issues beyond warnings about unimplemented
syscalls, because glibc will fall back to another code path if the
syscall isn't present.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Peter Maydell db9526b10a linux-user: Add support for prctl PR_GET_NAME and PR_SET_NAME
Add support for the prctl options PR_GET_NAME and PR_SET_NAME,
which take or return a name in a 16 byte buffer pointed to by arg2.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Peter Maydell 1e6722f8b0 linux-user/syscall.c: Fix indentation in prctl handling
Clean up the odd indentation of this switch statement before
we double its size by adding new cases to it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 288e65b9ee linux-user: reserve 4GB of vmem for 32-on-64
When running 32-on-64 bit guests, we should always reserve as much
virtual memory as we possibly can for the guest process, so it can
never overlap with QEMU address space.

Fortunately we already have the infrastructure for that. All that's
missing is some sane default value to also make use of it!

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Peter Maydell 59e9d91c7a linux-user: resolve reserved_va vma downwards
After consulting with Paul Brook, we concluded that it's best to search
the VMA space downwards, so that we don't even get the chance to conflict
with the brk range.

This patch resolves a bunch of allocation conflicts when using -R.

Signed-off-by: Alexander Graf <agraf@suse.de>
[minor changes to get it to apply -- PMM]

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 39879bbbea linux-user: take RESERVED_VA into account for g2h_valid()
When running with -R (RESERVED_VA > 0) all guest virtual addresses
are within the [0..RESERVED_VA] range. Reflect this with g2h_valid()
too so we can safely check for boundaries of our guest address space.

This is required to have the /proc/self/maps code not show maps that
aren't accessible from the guest process's point of view.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 20249ae189 linux-user: fix fallocate
Fallocate gets off_t parameters passed in, so we should also read them out
accordingly.

Signed-off-by: Alexander Graf <agraf@suse.de>

---

v1 -> v2:

  - unbreak 64-bit guests

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 354a000827 linux-user: Add ioctl for BLKBSZGET
This patch adds the ioctl wrapper definition for BLKBSZGET.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 49e9a07752 linux-user: add BLKSSZGET ioctl wrapper
This patch adds an ioctl definition for BLKSSZGET.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf edafea1330 linux-user: fix BLK ioctl arguments
Some BLK ioctls passed sizeof(x) into a macro that already did sizeof() on
the passed in argument, rendering the size information inside the ioctl be
the size of the host default integer type.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 6083abd9aa linux-user: add struct old_dev_t compat
The compat LOOP_SET_STATUS ioctl uses struct old_dev_t in its passed
struct. That variable type is vastly different between different
architectures. Implement wrapping around it so we can use it.

This fixes running arm kpartx on an x86_64 host for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Alexander Graf 56e904ecb2 linux-user: implement device mapper ioctls
This patch implements all ioctls currently implemented by device mapper,
enabling us to run dmsetup and kpartx inside of linux-user.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:58 +03:00
Fabio Erculiani 84803b87a1 linux-user: target_argv is placed on ts->bprm->argv and can't be freed()
TaskState contains linux_bprm struct which encapsulates argv among
other things.
argv might be used around the code and is expected to contain valid
data. Before this patch, ts->bprm->argv was NULL due to it being
freed right after loader_exec().

Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:57 +03:00
Fabio Erculiani e0e65bee16 linux-user: improve fake /proc/self/stat making `ps` not segfault.
With the current fake /proc/self/stat implementation `ps` is
segfaulting because it expects to read PID and argv[0] as first and
second field respectively, with the latter being enclosed between
backets.

Reproducing is as easy as running: `ps` inside qemu-user chroot
with /proc mounted.

Signed-off-by: Fabio Erculiani <lxnay@sabayon.org>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
2012-04-06 18:49:57 +03:00
Blue Swirl 8f8d364f24 Merge branch 's390-for-upstream' of git://repo.or.cz/qemu/agraf
* 's390-for-upstream' of git://repo.or.cz/qemu/agraf:
  target-s390x: Update s390x_{tod,cpu}_timer() to use S390CPU
  target-s390x: QOM'ify CPU init
  target-s390x: QOM'ify CPU reset
  target-s390x: QOM'ify CPU
2012-04-04 20:45:03 +00:00
Artyom Tarasenko a7be9bad33 Improve interrupt handling priority
The vector interrupt has higher priority than interrupt_level_n.
Also check only interrupt_level_n concurency when TL > 0, the traps of
other types may be nested.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-04 19:20:44 +00:00
Artyom Tarasenko 23cf96e197 Fix vector interrupt handling
Don't produce stray irq 5, don't overwrite ivec_data if still busy with
processing of the previous interrupt.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-04 19:20:40 +00:00
Andreas Färber b8ba6799f4 target-s390x: Update s390x_{tod,cpu}_timer() to use S390CPU
In place of CPUS390XState pass S390CPU as opaque from the new initfn.
cpu_interrupt() is anticipated to take a CPUState in the future.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
2012-04-04 19:06:17 +02:00
Andreas Färber 8f22e0df80 target-s390x: QOM'ify CPU init
Move code from cpu_s390x_init() into an initfn.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
2012-04-04 17:35:31 +02:00
Andreas Färber 1ac1a7499b target-s390x: QOM'ify CPU reset
Move code from cpu_state_reset() to s390_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
2012-04-04 17:34:44 +02:00
Andreas Färber 29e4bcb26b target-s390x: QOM'ify CPU
Embed CPUS390XState as first member of S390CPU.
Since -cpu is being ignored, make TYPE_S390_CPU non-abstract.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Tested-by: Christian Borntraeger <borntraeger@de.ibm.com>
2012-04-04 17:29:23 +02:00
Paolo Bonzini f05f6b4adb qdev: put all devices under /machine
Avoid cluttering too much the QOM root.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 15:04:15 -05:00
Paolo Bonzini da57febfed qdev: give all devices a canonical path
A strong limitation of QOM right now is that unconverted ports
(e.g. all...) do not give a canonical path to devices that are
part of the board.  This in turn makes it impossible to replace
PROP_PTR with a QOM link for example.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 15:04:15 -05:00
Paolo Bonzini f424d5c4c9 qdev: add children before qdev_init
We want the composition tree to to be in order by the time we call
qdev_init, so that a single set of the toplevel realize property can
propagate all the way down the composition tree.

This is not the case so far.  Unfortunately, this is incompatible
with calling qdev_init in the constructor wrappers for devices,
so for now we need to unattach some devices that are created through
those wrappers.  This will be fixed by removing qdev_init and instead
setting the toplevel realize property after machine init.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 15:04:15 -05:00
Paolo Bonzini a612b2a663 qom: add container_get
This is QOM "mkdir -p".  It is useful when referring to
container objects such as "/machine".

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 15:04:15 -05:00
Anthony Liguori cefc898806 Merge remote-tracking branch 'kiszka/queues/slirp' into staging
* kiszka/queues/slirp:
  slirp: Signal free input buffer space to io-thread
  w32/slirp: Undefine error constants before their redefinition
  slirp: use socket_set_nonblock
  slirp: clean up conflicts with system headers
2012-04-02 09:46:45 -05:00
Anthony Liguori aba8e41e86 Merge remote-tracking branch 'stefanha/tracing' into staging
* stefanha/tracing:
  tracetool: dtrace: handle in and next reserved words
  tracetool: dtrace disabled-events fix
  Makefile.target: code stp dependency on trace-events
2012-04-02 09:44:35 -05:00
Anthony Liguori dfe844c904 serial: clear LSR.TEMT when populating the TSR
We never actually clear the TEMT (transmit sending register empty) flag when
populating the TSR.  We set the flag, but since it's never cleared, setting it
is sort of pointless..

I found this with a unit test case.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 09:43:17 -05:00
Anthony Liguori 67c5322d70 serial: fix retry logic
I'm not sure if the retry logic has ever worked when not using FIFO mode.  I
found this while writing a test case although code inspection confirms it is
definitely broken.

The TSR retry logic will never actually happen because it is guarded by an
'if (s->tsr_rety > 0)' but this is the only place that can ever make the
variable greater than zero.  That effectively makes the retry logic an 'if (0)'.

I believe this is a typo and the intention was >= 0.  Once this is fixed though,
I see double transmits with my test case.  This is because in the non FIFO
case, serial_xmit may get invoked while LSR.THRE is still high because the
character was processed but the retransmit timer was still active.

We can handle this by simply checking for LSR.THRE and returning early.  It's
possible that the FIFO paths also need some attention.

Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 09:43:16 -05:00
Anthony Liguori 6e92466a7c qtest: use qemu_gettimeofday()
On linux, qemu_timeval will always be two long ints.  On windows, we use our
own struct definition.  This should fix win64.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-02 09:43:16 -05:00
Michael Walle a3b6181e42 milkymist-vgafb: add missing register
This bug existed since the first commit. Fortunately, the affected
registers have no functionality in qemu. This will only prevent the
following warning:
  milkymist_vgafb: write access to unknown register 0x00000034

Signed-off-by: Michael Walle <michael@walle.cc>
2012-04-01 20:30:24 +02:00
Michael Walle 79368f4984 target-lm32: add simple disassembler
Because binutils disassembler is based on libopcode, this is a rewrite from
scratch.

Signed-off-by: Michael Walle <michael@walle.cc>
2012-04-01 20:30:23 +02:00