Commit Graph

13125 Commits

Author SHA1 Message Date
Peter Maydell
08e11256f6 ARM: linux-user: Expose iWMMXT registers to signal handlers
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:39 +02:00
Peter Maydell
5f9099d9ce ARM: linux-user: Restore VFP state from ucontext on sigreturn
Restore the VFP registers from the ucontext on return from a signal
handler in linux-user mode. This means that signal handlers cannot
accidentally corrupt the interrupted code's VFP state, and allows
them to deliberately modify the state via the ucontext structure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:39 +02:00
Peter Maydell
0d871bdbaa ARM: linux-user: Expose VFP registers to signal handlers
For ARM linux-user mode signal handlers, fill in the ucontext with
VFP register contents in the same way that the kernel does. We only
do this for v2 format sigframe (2.6.12 and above); this is actually
bug-for-bug compatible with the older kernels, which don't save and
restore VFP registers either.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:39 +02:00
Peter Maydell
0165329578 ARM: Expose vfp_get_fpscr() and vfp_set_fpscr() to C code
Expose the vfp_get_fpscr() and vfp_set_fpscr() functions to C
code as well as generated code, so we can use them to read and
write the FPSCR when saving and restoring VFP registers across
signal handlers in linux-user mode.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:39 +02:00
Peter Maydell
5f0b7c888b ARM: linux-user: Correct size of padding in target_ucontext_v2
The padding in the target_ucontext_v2 is defined by the size of
the target's sigset_t type, not the host's. (This bug only causes
problems when we start using the uc_regspace[] array to expose
VFP registers to userspace signal handlers.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:39 +02:00
Peter Maydell
ef5e4ea587 target-sparc: remove unused functions cpu_lock(), cpu_unlock() 2010-12-03 15:09:39 +02:00
Peter Maydell
3a807decfa ARM: enable XScale/iWMMXT in linux-user mode
In linux-user mode, the XScale/iWMMXT coprocessors must be enabled
at reset so that we can run code that uses these instructions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2010-12-03 15:09:39 +02:00
Jamie Lentin
f3b974cd3b linux-user: Translate getsockopt level option
n setsockopt, the socket level options are translated to the hosts'
architecture before the real syscall is called, e.g.
TARGET_SO_TYPE -> SO_TYPE. This patch does the same with getsockopt.

Tested on a x86 host emulating MIPS.  Without it:-

$ grep getsockopt host.strace
31311 getsockopt(3, SOL_SOCKET, 0x1007 /* SO_??? */, 0xbff17208,
0xbff17204) = -1 ENOPROTOOPT (Protocol not available)

With:-

$ grep getsockopt host.strace
25706 getsockopt(3, SOL_SOCKET, SO_ERROR, [0], [4]) = 0

Whitespace cleanup: Riku Voipio

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2010-12-03 15:09:39 +02:00
Peter Maydell
bee7000807 linux-user: remove unnecessary local from __get_user(), __put_user()
Remove an unnecessary local variable from the __get_user() and
__put_user() macros. This avoids confusing compilation failures
if the name of the local variable ('size') happens to be the
same as the variable the macro user is trying to read/write.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:38 +02:00
Nathan Froyd
48e15fc2de linux-user: fix memory leaks with NPTL emulation
Running programs that create large numbers of threads, such as this
snippet from libstdc++'s pthread7-rope.cc:

  const int max_thread_count = 4;
  const int max_loop_count = 10000;
  ...
  for (int j = 0; j < max_loop_count; j++)
    {
      ...
      for (int i = 0; i < max_thread_count; i++)
	pthread_create (&tid[i], NULL, thread_main, 0);

      for (int i = 0; i < max_thread_count; i++)
	pthread_join (tid[i], NULL);
    }

in user-mode emulation will quickly run out of memory.  This is caused
by a failure to free memory in do_syscall prior to thread exit:

          /* TODO: Free CPU state.  */
          pthread_exit(NULL);

The first step in fixing this is to make all TaskStates used by QEMU
dynamically allocated.  The TaskState used by the initial thread was
not, as it was allocated on main's stack.  So fix that, free the
cpu_env, free the TaskState, and we're home free, right?

Not exactly.  When we create a thread, we do:

        ts = qemu_mallocz(sizeof(TaskState) + NEW_STACK_SIZE);
        ...
        new_stack = ts->stack;
        ...
        ret = pthread_attr_setstack(&attr, new_stack, NEW_STACK_SIZE);

If we blindly free the TaskState, then, we yank the current (host)
thread's stack out from underneath it while it still has things to do,
like calling pthread_exit.  That causes problems, as you might expect.

The solution adopted here is to let the C library allocate the thread's
stack (so the C library can properly clean it up at pthread_exit) and
provide a hint that we want NEW_STACK_SIZE bytes of stack.

With those two changes, we're done, right?  Well, almost.  You see,
we're creating all these host threads and their parent threads never
bother to check that their children are finished.  There's no good place
for the parent threads to do so.  Therefore, we need to create the
threads in a detached state so the parent thread doesn't have to call
pthread_join on the child to release the child's resources; the child
does so automatically.

With those three major changes, we can comfortably run programs like the
above without exhausting memory.  We do need to delete 'stack' from the
TaskState structure.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:38 +02:00
amateur
c65ffe6d6c linux-user: mmap_reserve() not controlled by RESERVED_VA
mmap_reserve() should be called only when RESERVED_VA is enabled.
Otherwise, unmaped virtual address space will never be reusable. This
bug will exhaust virtual address space in extreme conditions.

Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:38 +02:00
Peter Maydell
b0e102dd22 [PATCH] target-arm: remove unused functions cpu_lock(), cpu_unlock()
Signed-off-by: Riku Voipio <riku.voipio@nokia.com>
2010-12-03 15:09:38 +02:00
Anthony Liguori
6a8657528d Fix build
msix.o and msi.o get pulled into the build unconditionally for QMP.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2010-12-02 14:41:59 -06:00
Anthony Liguori
19c71ff41c Merge remote branch 'mst/for_anthony' into staging 2010-12-02 14:16:40 -06:00
Jason Wang
0c600ce2a7 vhost: Fix address calculation in vhost_dev_sync_region()
We still need advance address even we find there's no dirty pages in
current chunk.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2010-12-02 21:13:39 +02:00
Michael S. Tsirkin
3d002df33e migration: allow rate > 4g
I'd like to disable bandwidth limit or make it very high,
Use int64_t all over to make values >= 4g work.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-02 21:13:39 +02:00
Michael S. Tsirkin
b2e0a138e7 migration: stable ram block ordering
This makes ram block ordering under migration stable, ordered by offset.
This is especially useful for migration to exec, for debugging.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jason Wang <jasowang@redhat.com>
2010-12-02 21:13:39 +02:00
Richard Henderson
393f398b69 tcg-ia64: Fix warning in qemu_ld.
The usermode version of qemu_ld doesn't used mem_index,
leading to set-but-not-used warnings.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01 19:48:31 +01:00
Richard Henderson
07f59737d8 tcg-ia64: Fix address compilation in qemu_st.
A typo in the usermode address calculation path; R3 used where R2 needed.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01 19:48:31 +01:00
Richard Henderson
650a217a65 tcg-ia64: Fix tlb read error for 32-bit targets.
Use ld4 not ld8 for reading the tlb of 32-bit targets.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01 19:48:31 +01:00
Richard Henderson
b3b0091f07 tcg-ia64: Implement qemu_ld32.
The port was not properly merged following
86feb1c860

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01 19:48:31 +01:00
Richard Henderson
255108c0e3 tcg-ia64: Provide default GUEST_BASE.
Fix compilation error when GUEST_BASE is not defined.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01 19:48:31 +01:00
Richard Henderson
0909cbde9a tcg: Fix default definition of divu_i32 and remu_i32.
The arguments to tcg_gen_helper32 for these functions were not
updated correctly in rev 2bece2c883.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2010-12-01 19:48:30 +01:00
Michael S. Tsirkin
c924f36a30 Merge remote branch 'origin/master' into pci
Conflicts:
	Makefile.objs
	hw/virtio.c
2010-12-01 07:11:51 +02:00
Anthony Liguori
09fa35e5cd Merge remote branch 'kwolf/for-anthony' into staging 2010-11-30 15:25:34 -06:00
Anthony Liguori
9233da785f Merge remote branch 'qmp/for-anthony' into staging 2010-11-30 15:24:26 -06:00
Anthony Liguori
fd5d5c566a Use a Linux-style MAINTAINERS file
I make no claims that this is accurate or exhaustive but I think it's a
reasonable place to start.

As the file mentions, the purpose of this file is to give contributors
information about who they can go to with questions about a particular piece of
code or who they can ask for review.

If you sign up for a piece of code and indicate that it's Maintained or
Supported, please be prepared to be responsive to questions about that
subsystem.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---

v1 -> v2
 - Sort alphabetically
 - Copy in instructions from linux MAINTAINERS
 - Fix entries based on review feedback
2010-11-30 14:38:55 -06:00
Kevin Wolf
b76876e602 ide: Reset current_addr after stopping DMA
Whenever SSBM is reset in the command register all state information is lost.
Restarting DMA means that current_addr must be reset to the base address of the
PRD table. The OS is not required to change the base address register before
starting a DMA operation, it can reuse the value it wrote for an earlier
request.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:04 +01:00
Kevin Wolf
c29947bbb0 ide: Ignore double DMA transfer starts/stops
You can only start a DMA transfer if it's not running yet, and you can only
cancel it if it's running.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:02 +01:00
Kevin Wolf
e3982b3cf6 ide: Set bus master inactive on error
BMIDEA in the status register must be cleared on error. This makes FreeBSD
respond (more) correctly to I/O errors.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:01 +01:00
Kevin Wolf
8337606d35 ide: Factor ide_dma_set_inactive out
Several places that stop a DMA transfer duplicate this code. Factor it out into
a common function.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-29 16:15:01 +01:00
Paul Brook
661a1799ba Add pcnet-pci.c
Add file missing from last commit.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 11:56:02 +00:00
Paul Brook
a4c75a21f3 Split out common pcnet code
The core pcnet emulation code is used by both the PCI "pcnet" device
and the SPARC "lance" device.  Split the common code frm the PCI code so
that that can be configures independantly.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 11:23:34 +00:00
Paul Brook
129cac5b5a Remove PCI from sparc32 target
None of the (current) sparc32 machines have a PCI bus, so remove the PCI
code from these configs.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 10:33:55 +00:00
Paul Brook
cf66924f81 Detect missing config includes
Terminate make_device_config.sh if the awk command fails.
Typically this means a missing file.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 00:58:07 +00:00
Paul Brook
050e27c8c9 Fix previous commit
Fix breakage from previous commit (missing pci.mak, and incorrect
include in default-configs/s390x-softmmu.mak).

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 00:34:15 +00:00
Paul Brook
01af7daf55 VirtIO config option
Make virtio devices optional.  Selecting individual devices is not useful
as the host bindings are all in one file.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 00:06:13 +00:00
Paul Brook
f8f5cfbaa4 PCI config include
Split PCI config options into a separate file

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-27 00:06:13 +00:00
Paul Brook
bd9141bb2e Include directives in default configs
Allow default configs to be split into several files.

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-26 18:47:45 +00:00
Paul Brook
6e14404aab Add missing dependency.
Teach Makefile that cmd.o depends on a generated header (specifically
config-host.h).

Signed-off-by: Paul Brook <paul@codesourcery.com>
2010-11-26 18:46:03 +00:00
Christoph Hellwig
11a3cb8159 raw-posix: raw_pwrite comment fixup
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-26 19:02:52 +01:00
Hannes Reinecke
2dd791b630 scsi-disk: Remove duplicate cdb parsing
We parse the CDB twice, which is completely unnecessary.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:51:50 +01:00
Hannes Reinecke
a6d96eb78b scsi: Move sense handling into the driver
The current sense handling in scsi-bus is only used by the
scsi-disk driver; the scsi-generic driver is using its own.
So we should move the current sense handling into the
scsi-disk driver.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:19:28 +01:00
Hannes Reinecke
39d989823f scsi: INQUIRY VPD fixes
We should announce and support the block device characterics page
only on block devices, not on CDROMs. And the VPD page 0x83 has
an off-by-one error.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:15:23 +01:00
Hannes Reinecke
f017132793 scsi: Return SAM status codes
Traditionally, the linux stack is using SCSI status codes
which are shifted by one as compared to those defined in SAM.
A SCSI emulation should naturally return the SAM defined codes,
not the linux ones.
So to avoid any confusion this patch modifies the existing
definitions to match those found in SAM and removes any
(now obsolete) byte-shift from the returned status codes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 12:00:10 +01:00
Hannes Reinecke
622b520fb4 scsi: Increase the number of possible devices
The SCSI parallel interface has a limit of 8 devices, but
not the SCSI stack in general. So we should be removing the
hard-coded limit and use MAX_SCSI_DEVS instead.
And we only need to scan those devices which are allocated
by the bus.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-25 11:57:32 +01:00
Kevin Wolf
80465c5016 block: Remove unused s->hd in various drivers
All drivers use bs->file instead of s->hd for quite a while now, so it's time
to remove s->hd.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2010-11-24 17:31:06 +01:00
Stefano Stabellini
5cbdebe39e qemu and qemu-xen: support empty write barriers in xen_disk
This patch can be applied to both qemu-xen and qemu and adds support
for empty write barriers to xen_disk.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24 17:31:06 +01:00
Avi Kivity
9fbef1ac7c ide: convert bmdma address ioport to ioport_register()
cmd646, via compile tested, pci lightly boot tested.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24 17:31:06 +01:00
Marcelo Tosatti
62155e2b51 block migration: do not submit multiple AIOs for same sector (v2)
An old version of this patch was applied to master, so this contains the
differences between v1 and v2.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2010-11-24 17:31:06 +01:00