]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoraw-posix: Use bdrv_open options instead of filename
Kevin Wolf [Tue, 2 Apr 2013 08:47:40 +0000 (10:47 +0200)]
raw-posix: Use bdrv_open options instead of filename

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Enable filename option
Kevin Wolf [Tue, 9 Apr 2013 12:34:19 +0000 (14:34 +0200)]
block: Enable filename option

This allows using the file.filename option instead of the string that
comes from -drive file=... and is passed around as a separate parameter.
The goal is to get rid of this parameter and use the options QDict more
consistently.

With this option you can access not only the top-level image, but
specify a filename for the backing file (currently only if no backing
file exists, but we'll allow overriding it later)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Add driver-specific options for backing files
Kevin Wolf [Thu, 28 Mar 2013 14:29:24 +0000 (15:29 +0100)]
block: Add driver-specific options for backing files

Options starting in "backing." are passed to the backing file now. If
you don't need to specify the filename for the backing file, you can add
it on the command line instead of in the image file:

$ qemu-nbd -t /tmp/test.img
$ qemu-img create -f qcow2 empty.qcow2 1G
$ qemu-system-x86_64 -drive file=empty.qcow2,backing.file.driver=nbd,\
    backing.file.host=localhost

Note that this doesn't override the backing filename from the image. If
the image has one, this will fail because NBD doesn't want the options
and a filename at the same time.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agoblock: Fail gracefully when using a format driver on protocol level
Kevin Wolf [Tue, 9 Apr 2013 11:19:18 +0000 (13:19 +0200)]
block: Fail gracefully when using a format driver on protocol level

Specifying the wrong driver could fail an assertion:

$ qemu-system-x86_64 -drive file.driver=qcow2,file=x
qemu-system-x86_64: block.c:721: bdrv_open_common: Assertion `file !=
((void *)0)' failed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Fix _filter_qemu
Kevin Wolf [Tue, 16 Apr 2013 09:22:36 +0000 (11:22 +0200)]
qemu-iotests: Fix _filter_qemu

$QEMU_PROG happens to be 'qemu' in my setup, so this sed command
replaces a bit too much. Restrict it to the start of the line and to
when it's followed by a colon, i.e. the form used by error messages.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-img: do not zero-pad the compressed write buffer
Stefan Hajnoczi [Mon, 15 Apr 2013 15:17:33 +0000 (17:17 +0200)]
qemu-img: do not zero-pad the compressed write buffer

bdrv_write_compressed() does not allow requests that span the end of the
device.  Therefore it is useless to zero-pad the last cluster and
thereby exceed the end of the device.

Let image formats handle zero-padding the final compressed cluster, if
necessary.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow: allow sub-cluster compressed write to last cluster
Stefan Hajnoczi [Mon, 15 Apr 2013 15:17:32 +0000 (17:17 +0200)]
qcow: allow sub-cluster compressed write to last cluster

Compression in qcow requires image length to be a multiple of the
cluster size.  Lift this requirement by zero-padding the final cluster
when necessary.  The virtual disk size is still not cluster-aligned, so
the guest cannot access the zero sectors.

Note that this is almost identical to the qcow2 version of this code.
qcow2's compression code is drawn from qcow.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: allow sub-cluster compressed write to last cluster
Stefan Hajnoczi [Mon, 15 Apr 2013 15:17:31 +0000 (17:17 +0200)]
qcow2: allow sub-cluster compressed write to last cluster

Compression in qcow2 requires image length to be a multiple of the
cluster size.  Lift this requirement by zero-padding the final cluster
when necessary.  The virtual disk size is still not cluster-aligned, so
the guest cannot access the zero sectors.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoui/cocoa.m: Fix recent compile breakage
Peter Maydell [Wed, 17 Apr 2013 09:16:35 +0000 (09:16 +0000)]
ui/cocoa.m: Fix recent compile breakage

Fix failures to compile introduced by recent console commits
1dbfa0050381c0d5a6) which removed is_graphic_console() and
vga_hw_update() without updating the cocoa UI backend to match.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoi386 ROR r8/r16 instruction fix
Pavel Dovgaluk [Mon, 15 Apr 2013 06:59:15 +0000 (10:59 +0400)]
i386 ROR r8/r16 instruction fix

Fixed EFLAGS corruption by ROR r8/r16 instruction located at the end of the TB.

Signed-off-by: Pavel Dovgalyuk <pavel.dovgaluk@gmail.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agoqdev: Drop taddr properties
Peter Maydell [Sat, 20 Apr 2013 13:48:28 +0000 (14:48 +0100)]
qdev: Drop taddr properties

Drop all the infrastructure for taddr properties (ie ones which
are 'hwaddr' sized). These are now unused, and any further desired
use would be rather questionable since device properties shouldn't
generally depend on a type that is conceptually variable based on
the target CPU. 32 or 64 bit integer properties should be used instead
as appropriate for the specific device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agohw/sm501: Use correct setter for sysbus-ohci dma-address property
Peter Maydell [Sat, 20 Apr 2013 13:48:27 +0000 (14:48 +0100)]
hw/sm501: Use correct setter for sysbus-ohci dma-address property

The sysbus-ohci dma-address property is declared as a HEX64
property, not a TADDR, so use the correct setter for it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Andreas Färber <afaerber@suse.de>
Tested-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 20 Apr 2013 11:39:08 +0000 (11:39 +0000)]
Merge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  hw/versatile_pci: Drop unnecessary vpb_pci_config_addr()
  versatile_pci: Expose PCI memory space to system
  arm/realview: Fix mapping of PCI regions
  versatile_pci: Implement the PCI controller's control registers
  versatile_pci: Implement the correct PCI IRQ mapping
  versatile_pci: Put the host bridge PCI device at slot 29
  versatile_pci: Use separate PCI I/O space rather than system I/O space
  versatile_pci: Change to subclassing TYPE_PCI_HOST_BRIDGE
  versatile_pci: Update to realize and instance init functions
  versatile_pci: Expose PCI I/O region on Versatile PB
  versatile_pci: Fix hardcoded tabs

11 years agoMerge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 20 Apr 2013 11:38:48 +0000 (11:38 +0000)]
Merge branch 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'target-arm.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Correctly restore FPSCR
  target-arm: Add some missing CPU state fields to VMState
  target-arm: port ARM CPU save/load to use VMState
  target-arm: Reinsert missing return statement in ARM mode SRS decode

11 years agoMerge branch 'linux-user-for-upstream' of git://git.linaro.org/people/rikuvoipio...
Blue Swirl [Sat, 20 Apr 2013 11:38:29 +0000 (11:38 +0000)]
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:
  linux-user: fix setgroups/getgroups for non-UID16 archs
  linux-user: fix undefined shift in copy_to_user_fdset
  linux-user: change do_semop to return target errno when unsuccessful

11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 19 Apr 2013 13:38:16 +0000 (08:38 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

# By Stefan Weil (3) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
  m25p80: Remove bogus include of devices.h
  ssh: Remove unnecessary use of strlen function.
  block/ssh: Add missing gcc format attributes
  linux-user: change do_semop to return target errno when unsuccessful
  w64: Fix compiler warnings (wrong format specifier)
  Remove unneeded type casts
  virtio.h: drop unused function prototypes
  bswap: fix compiler warning

Message-id: 1366371241-23430-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Fri, 19 Apr 2013 13:38:05 +0000 (08:38 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

pci: add pci test device

This adds a new device that we can use for testing PCI PIO and MMIO, with and
without ioeventfd in different configurations.  FAST_MMIO will be added if/when
kvm supports it.  Also included are minor cleanups in kvm APIs that it needs.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 15 Apr 2013 05:42:24 PM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found

# By Michael S. Tsirkin
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
  pci: add pci test device
  kvm: support non datamatch ioeventfd
  kvm: support any size for pio eventfd
  kvm: remove unused APIs

Message-id: cover.1366272004.git.mst@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Fri, 19 Apr 2013 13:37:58 +0000 (08:37 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

# By Jan Kiszka (4) and Marcelo Tosatti (1)
# Via Marcelo Tosatti
* qemu-kvm/uq/master:
  vmxcap: Update according to SDM of January 2013
  target-i386: kvm: save/restore steal time MSR
  vmxcap: Report APIC register emulation and RDTSCP control
  vmxcap: Augment reported information
  vmxcap: Open MSR file in unbuffered mode

Message-id: cover.1366253306.git.mtosatti@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-arm: Correctly restore FPSCR
Peter Maydell [Fri, 19 Apr 2013 11:24:19 +0000 (12:24 +0100)]
target-arm: Correctly restore FPSCR

Use the helper functions to save and restore the FPSCR, so that
we correctly propagate rounding mode and flushing behaviour into
the float_status fields. This also allows us to stop saving the
vector length/stride fields separately.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agotarget-arm: Add some missing CPU state fields to VMState
Peter Maydell [Fri, 19 Apr 2013 11:24:19 +0000 (12:24 +0100)]
target-arm: Add some missing CPU state fields to VMState

A number of CPU state fields were accidentally omitted from
our migration state: some OMAP specific cp15 registers, and
some related to state for load/store exclusive insns. Add them.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agotarget-arm: port ARM CPU save/load to use VMState
Juan Quintela [Fri, 19 Apr 2013 11:24:19 +0000 (12:24 +0100)]
target-arm: port ARM CPU save/load to use VMState

Port the ARM CPU save/load code to use VMState. Some state is
saved in a slightly different order to simplify things -- for
example arrays are saved one after the other rather than 'striped',
and we always save all 32 VFP registers even if the CPU happens
to only have 16.

Use one subsection for each feature.  This means that we don't need to
bump the version field each time that a new feature gets introduced.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[PMM: fixed conflicts, updated to use cpu_class_set_vmsd(),  updated
 with new/removed fields since original patch, changed to use custom
 VMStateInfo for cpsr rather than presave/postload hooks, corrected
 subsection names so vmload doesn't fail]
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agotarget-arm: Reinsert missing return statement in ARM mode SRS decode
Peter Chubb [Fri, 19 Apr 2013 11:24:18 +0000 (12:24 +0100)]
target-arm: Reinsert missing return statement in ARM mode SRS decode

Since patch
   81465888c5306cd94abb9847e560796fd13d3c2f
   target-arm: factor out handling of SRS instruction
the ARM mode SRS instruction has not worked in QEMU.

The problem is a missing return directive that was removed in the
refactoring, so after decoding the instruction, qemu would fall through
to generate an UNDEF exception for an illegal instruction.

Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/versatile_pci: Drop unnecessary vpb_pci_config_addr()
Peter Maydell [Fri, 19 Apr 2013 10:15:21 +0000 (11:15 +0100)]
hw/versatile_pci: Drop unnecessary vpb_pci_config_addr()

Drop the vpb_pci_config_addr() function -- it is unnecessary since
the size of the memory regions means the hwaddr is always within
the 24 bit size. (This function was probably a leftover from when
read/write functions were called with absolute addresses rather
than relative ones.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Expose PCI memory space to system
Peter Maydell [Fri, 19 Apr 2013 10:15:20 +0000 (11:15 +0100)]
versatile_pci: Expose PCI memory space to system

The VersatilePB's PCI controller exposes the PCI memory space to the
system via three regions controlled by the mapping control registers.
Implement this so that guests can actually use MMIO-BAR PCI cards.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoarm/realview: Fix mapping of PCI regions
Peter Maydell [Fri, 19 Apr 2013 10:15:20 +0000 (11:15 +0100)]
arm/realview: Fix mapping of PCI regions

Fix the mapping of the PCI regions for the realview board, which were
all incorrect. (This was never noticed because the Linux kernel
doesn't actually include a PCI driver for the realview boards.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Implement the PCI controller's control registers
Peter Maydell [Fri, 19 Apr 2013 10:15:20 +0000 (11:15 +0100)]
versatile_pci: Implement the PCI controller's control registers

The versatile_pci PCI controller has a set of control registers which
handle the mapping between PCI and system address spaces. Implement
these registers (though for now they have no effect since we don't
implement mapping PCI space into system memory at all).

The most natural order for our sysbus regions has the control
registers at the start, so move all the others down one.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Implement the correct PCI IRQ mapping
Peter Maydell [Fri, 19 Apr 2013 10:15:19 +0000 (11:15 +0100)]
versatile_pci: Implement the correct PCI IRQ mapping

Implement the correct IRQ mapping for the Versatile PCI controller; it
differs between realview and versatile boards, but the previous QEMU
implementation was correct only for the first PCI card on a versatile
board, since we weren't swizzling IRQs based on the slot number.

Since this change would otherwise break any uses of PCI on Linux kernels
which have an equivalent bug (since they have effectively only been
tested against QEMU, not real hardware), we implement a mechanism
for automatically detecting those broken kernels and switching back
to the old mapping. This works by looking at the values the kernel
writes to the PCI_INTERRUPT_LINE register in the config space, which
is effectively the interrupt number the kernel expects the device
to be using.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoversatile_pci: Put the host bridge PCI device at slot 29
Peter Maydell [Fri, 19 Apr 2013 10:15:19 +0000 (11:15 +0100)]
versatile_pci: Put the host bridge PCI device at slot 29

On real hardware the host bridge appears as a PCI device in slot 29,
so make QEMU put its host bridge in that slot too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Use separate PCI I/O space rather than system I/O space
Peter Maydell [Fri, 19 Apr 2013 10:15:18 +0000 (11:15 +0100)]
versatile_pci: Use separate PCI I/O space rather than system I/O space

Rather than overloading the system I/O space (which doesn't even make
any sense on ARM) for PCI I/O, create an memory region in the PCI
controller and use that to represent the I/O space.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Change to subclassing TYPE_PCI_HOST_BRIDGE
Peter Maydell [Fri, 19 Apr 2013 10:15:18 +0000 (11:15 +0100)]
versatile_pci: Change to subclassing TYPE_PCI_HOST_BRIDGE

Change versatile_pci to subclass TYPE_PCI_HOST_BRIDGE and generally
handle PCI in a more QOM-like fashion.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Update to realize and instance init functions
Peter Maydell [Fri, 19 Apr 2013 10:15:18 +0000 (11:15 +0100)]
versatile_pci: Update to realize and instance init functions

Update the Versatile PCI controller to use a realize function rather
than SysBusDevice::init. To reflect the fact that the 'realview_pci'
class is taking most of its implementation from 'versatile_pci' (and
to make the QOM casts work) we make 'realview_pci' a subclass of
'versatile_pci'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Expose PCI I/O region on Versatile PB
Peter Maydell [Fri, 19 Apr 2013 10:15:17 +0000 (11:15 +0100)]
versatile_pci: Expose PCI I/O region on Versatile PB

Comments in the QEMU source code claim that the version of the PCI
controller on the VersatilePB board doesn't support the PCI I/O
region, but this is incorrect; expose that region, map it in the
correct location, and drop the misleading comments.

This change removes the only currently implemented difference
between the realview-pci and versatile-pci models; however there
are other differences in not-yet-implemented functionality, so we
retain the distinction between the two device types.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agoversatile_pci: Fix hardcoded tabs
Peter Maydell [Fri, 19 Apr 2013 10:15:17 +0000 (11:15 +0100)]
versatile_pci: Fix hardcoded tabs

There is just one line in this source file with a hardcoded tab
indent, so just fix it.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Paul Brook <paul@codesourcery.com>
11 years agom25p80: Remove bogus include of devices.h
Peter Crosthwaite [Fri, 19 Apr 2013 02:18:05 +0000 (12:18 +1000)]
m25p80: Remove bogus include of devices.h

I think in the early revisions of this we had an instantiation helper
for the device in devices.h. This was later removed and this header was
left over. Removed

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agossh: Remove unnecessary use of strlen function.
Richard W.M. Jones [Thu, 18 Apr 2013 21:09:33 +0000 (22:09 +0100)]
ssh: Remove unnecessary use of strlen function.

Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock/ssh: Add missing gcc format attributes
Stefan Weil [Thu, 18 Apr 2013 20:21:05 +0000 (22:21 +0200)]
block/ssh: Add missing gcc format attributes

Now gcc will check whether format string and variable arguments match.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agolinux-user: change do_semop to return target errno when unsuccessful
Petar Jovanovic [Thu, 21 Mar 2013 17:57:36 +0000 (18:57 +0100)]
linux-user: change do_semop to return target errno when unsuccessful

do_semop() is called from two places, and one of these fails to convert
return error to target errno when semop fails. This patch changes the
function to always return target errno in case of an unsuccessful call.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agow64: Fix compiler warnings (wrong format specifier)
Stefan Weil [Sat, 13 Apr 2013 20:45:50 +0000 (22:45 +0200)]
w64: Fix compiler warnings (wrong format specifier)

GetLastError() returns a DWORD value which is unsigned long,
so the correct format specifier is %lu.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoRemove unneeded type casts
Stefan Weil [Fri, 12 Apr 2013 18:53:58 +0000 (20:53 +0200)]
Remove unneeded type casts

cpu_physical_memory_read, cpu_physical_memory_write take any pointer
as 2nd argument without needing a type cast.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovirtio.h: drop unused function prototypes
Luiz Capitulino [Fri, 12 Apr 2013 13:12:55 +0000 (09:12 -0400)]
virtio.h: drop unused function prototypes

They are unused since commit 5c7d0962f60498c3f11d402e1c857cb9d5d8568d.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agobswap: fix compiler warning
Alexey Kardashevskiy [Mon, 15 Apr 2013 01:47:56 +0000 (11:47 +1000)]
bswap: fix compiler warning

The bswap functions use memcpy but the bswap.h header itself does not seem to
include it in some configuration such as cross compiling for powerpc64
on x86_64 machine.

The patch explicitly includes string.h.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agolinux-user: fix setgroups/getgroups for non-UID16 archs
Andreas Schwab [Tue, 9 Apr 2013 05:41:33 +0000 (05:41 +0000)]
linux-user: fix setgroups/getgroups for non-UID16 archs

Don't assume target_id is a short.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: fix undefined shift in copy_to_user_fdset
Andreas Schwab [Tue, 9 Apr 2013 01:02:34 +0000 (01:02 +0000)]
linux-user: fix undefined shift in copy_to_user_fdset

If TARGET_ABI_BITS is bigger than 32 we shift by more than the size of int.

Signed-off-by: Andreas Schwab <schwab@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: change do_semop to return target errno when unsuccessful
Petar Jovanovic [Thu, 21 Mar 2013 07:57:36 +0000 (07:57 +0000)]
linux-user: change do_semop to return target errno when unsuccessful

do_semop() is called from two places, and one of these fails to convert
return error to target errno when semop fails. This patch changes the
function to always return target errno in case of an unsuccessful call.

Signed-off-by: Petar Jovanovic <petar.jovanovic@imgtec.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agoconfigure: remove duplicate test
Paolo Bonzini [Wed, 17 Apr 2013 14:26:47 +0000 (16:26 +0200)]
configure: remove duplicate test

We already had a test to add -march=i486 when needed.  Make the
existing test independent of vhost-net, so that it is also used
under Win32.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure: CONFIG_NO_XEN is duplicated
Paolo Bonzini [Wed, 17 Apr 2013 14:26:46 +0000 (16:26 +0200)]
configure: CONFIG_NO_XEN is duplicated

We already define it in Makefile.target.  But we need to avoid a
curious double negation in order to eliminate it.

Tested-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure: eliminate target_libs_softmmu
Paolo Bonzini [Wed, 17 Apr 2013 14:26:45 +0000 (16:26 +0200)]
configure: eliminate target_libs_softmmu

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure: move common libraries to config-host.mak
Paolo Bonzini [Wed, 17 Apr 2013 14:26:44 +0000 (16:26 +0200)]
configure: move common libraries to config-host.mak

Move -lm to the end of the line, so that it can be picked up as a
dependency by pixman in the static build case.

Reviewed-by: Peter Maydell <peter.maydell@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure: move CONFIG_QEMU_LDST_OPTIMIZATION to config-host.mak
Paolo Bonzini [Wed, 17 Apr 2013 14:26:43 +0000 (16:26 +0200)]
configure: move CONFIG_QEMU_LDST_OPTIMIZATION to config-host.mak

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: use abi_llong/ullong instead of target_llong/ullong
Paolo Bonzini [Wed, 17 Apr 2013 14:26:42 +0000 (16:26 +0200)]
elfload: use abi_llong/ullong instead of target_llong/ullong

The alignment is a characteristic of the ABI, not the CPU.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: only give abi_long/ulong the alignment specified by the target
Paolo Bonzini [Wed, 17 Apr 2013 14:26:41 +0000 (16:26 +0200)]
elfload: only give abi_long/ulong the alignment specified by the target

Previously, this was done for target_long/ulong, and propagated to
abi_long/ulong via a typedef.  But target_long/ulong should not
have any specific alignment, it is never used to access guest
memory.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: use abi_int/uint instead of target_int/uint
Paolo Bonzini [Wed, 17 Apr 2013 14:26:40 +0000 (16:26 +0200)]
elfload: use abi_int/uint instead of target_int/uint

The alignment is a characteristic of the ABI, not the CPU.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: use abi_short/ushort instead of target_short/ushort
Paolo Bonzini [Wed, 17 Apr 2013 14:26:39 +0000 (16:26 +0200)]
elfload: use abi_short/ushort instead of target_short/ushort

The alignment is a characteristic of the ABI, not the CPU.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: use tswapreg consistently in elf_core_copy_regs
Paolo Bonzini [Wed, 17 Apr 2013 14:26:38 +0000 (16:26 +0200)]
elfload: use tswapreg consistently in elf_core_copy_regs

Reviewed-by: Peter Maydell <peter.maydell@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: fix size of registers for N32
Paolo Bonzini [Wed, 17 Apr 2013 14:26:37 +0000 (16:26 +0200)]
elfload: fix size of registers for N32

Registers are 64-bit in size for the MIPS n32 ABI.  Define
target_elf_greg_t accordingly, and use the correct function
to do endian swaps.

Reviewed-by: Peter Maydell <peter.maydell@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoelfload: fix size of ABI-dependent fields in core dumps
Paolo Bonzini [Wed, 17 Apr 2013 14:26:36 +0000 (16:26 +0200)]
elfload: fix size of ABI-dependent fields in core dumps

Some fields in core dumps are 32-bit in 32-or-64 environments (ppc64abi32,
sparc32plus).  Use abi_long/ulong for those.

Also, the fields of target_elf_siginfo are ints.  Use tswap32 to convert them.

Reviewed-by: Peter Maydell <peter.maydell@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure: QEMU_INCLUDES are the same for all subtargets
Paolo Bonzini [Wed, 17 Apr 2013 14:26:35 +0000 (16:26 +0200)]
configure: QEMU_INCLUDES are the same for all subtargets

Reviewed-by: Peter Maydell <peter.maydell@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure/Make: Build libfdt from submodule DTC
Peter Crosthwaite [Thu, 18 Apr 2013 04:47:31 +0000 (14:47 +1000)]
configure/Make: Build libfdt from submodule DTC

Configure to use the DTC submodule to build libfdt when no system libfdt
is found. Prompt to install the DTC submodule if --enable-fdt is set but
no DTC can be found.

DTC has no out-of-tree build capability, so the configure will symlink
the Makefile and scripts directory in the out of tree build directory
and pass in all the needed DTC arguments to make out of tree build happen.
Ideally we fix the DTC make to support out of tree, but did it this way to
avoid commits to DTC.

Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agodtc: add submodule
Peter Crosthwaite [Thu, 18 Apr 2013 04:46:53 +0000 (14:46 +1000)]
dtc: add submodule

Add dtc submodule as a fallback for old distros.
Picking version 1.3.0. as this is the most recently tagged stable version.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoconfigure: Put cross compile flags in EXTRA_CFLAGS
Peter Crosthwaite [Thu, 18 Apr 2013 04:46:14 +0000 (14:46 +1000)]
configure: Put cross compile flags in EXTRA_CFLAGS

The cross compile CFLAGS are needed to properly build pixman (and any other
submodules). Only the EXTRA_CFLAGS set is passed to submodules not QEMU_CFLAGS,
so put the cross compile flags in EXTRA_CFLAGS instead.

Signed-off-by: Peter Crosthwaite peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agovmxcap: Update according to SDM of January 2013
Jan Kiszka [Sun, 17 Mar 2013 10:45:50 +0000 (11:45 +0100)]
vmxcap: Update according to SDM of January 2013

This adds reporting of VMCS shadowing, #VE, IA32_SMBASE, unrestricted
VMWRITE and fixes the range of the MSEG revision ID.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agotarget-i386: kvm: save/restore steal time MSR
Marcelo Tosatti [Wed, 20 Feb 2013 02:27:20 +0000 (23:27 -0300)]
target-i386: kvm: save/restore steal time MSR

Read and write steal time MSR, so that reporting is functional across
migration.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
11 years agovmxcap: Report APIC register emulation and RDTSCP control
Jan Kiszka [Mon, 18 Feb 2013 06:56:54 +0000 (07:56 +0100)]
vmxcap: Report APIC register emulation and RDTSCP control

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
11 years agovmxcap: Augment reported information
Jan Kiszka [Wed, 13 Feb 2013 11:44:06 +0000 (12:44 +0100)]
vmxcap: Augment reported information

Parse the Basic VMX Information MSR and add the bit for the new posted
interrupts.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
11 years agovmxcap: Open MSR file in unbuffered mode
Jan Kiszka [Wed, 13 Feb 2013 11:43:10 +0000 (12:43 +0100)]
vmxcap: Open MSR file in unbuffered mode

Python may otherwise decide to to read larger chunks, applying the seek
only on the software buffer. This will return results from the wrong
MSRs.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
11 years agovirtio-net: cleanup: init and exit function.
KONRAD Frederic [Thu, 11 Apr 2013 14:30:02 +0000 (16:30 +0200)]
virtio-net: cleanup: init and exit function.

This remove old init and exit function as they are no longer needed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-8-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net: cleanup: use QOM cast.
KONRAD Frederic [Thu, 11 Apr 2013 14:30:01 +0000 (16:30 +0200)]
virtio-net: cleanup: use QOM cast.

As the virtio-net-pci and virtio-net-s390 are switched to the new API,
we can use QOM casts.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-7-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net-ccw: switch to the new API.
KONRAD Frederic [Thu, 11 Apr 2013 14:30:00 +0000 (16:30 +0200)]
virtio-net-ccw: switch to the new API.

Here the virtio-net-ccw is modified for the new API. The device
virtio-net-ccw extends virtio-ccw-device as before. It creates and
connects a virtio-net-device during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-6-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net-s390: switch to the new API.
KONRAD Frederic [Thu, 11 Apr 2013 14:29:59 +0000 (16:29 +0200)]
virtio-net-s390: switch to the new API.

Here the virtio-net-s390 is modified for the new API. The device
virtio-net-s390 extends virtio-s390-device as before. It creates and
connects a virtio-net-device during the init. The properties are not modified.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-5-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net-pci: switch to the new API.
KONRAD Frederic [Thu, 11 Apr 2013 14:29:58 +0000 (16:29 +0200)]
virtio-net-pci: switch to the new API.

Here the virtio-net-pci is modified for the new API. The device
virtio-net-pci extends virtio-pci. It creates and connects a
virtio-net-device during the init. The properties are not changed.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-4-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio-net: add the virtio-net device.
KONRAD Frederic [Thu, 11 Apr 2013 14:29:57 +0000 (16:29 +0200)]
virtio-net: add the virtio-net device.

Create virtio-net-device which extends virtio-device, so it can be connected on
virtio-bus.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-3-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agovirtio: add two functions to VirtioDeviceClass.
KONRAD Frederic [Thu, 11 Apr 2013 14:29:56 +0000 (16:29 +0200)]
virtio: add two functions to VirtioDeviceClass.

Recent changes need two functions to VirtioDevice. This just add them
into VirtioDeviceClass.

Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com>
Tested-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Message-id: 1365690602-22729-2-git-send-email-fred.konrad@greensocs.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoFix warnings suppressors to honor --disable-werror
Markus Armbruster [Tue, 16 Apr 2013 11:51:06 +0000 (13:51 +0200)]
Fix warnings suppressors to honor --disable-werror

Replace

    #pragma GCC diagnostic ignored FOO
    [Troublesome code...]
    #pragma GCC diagnostic error FOO

by

    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored FOO
    [Troublesome code...]
    #pragma GCC diagnostic pop

Broken in commit 3f4349d, commit 092bb30, and commit c95e308.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1366113066-1340-1-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agofw_cfg: add qtest test case
Anthony Liguori [Tue, 16 Apr 2013 14:45:21 +0000 (09:45 -0500)]
fw_cfg: add qtest test case

This validates some basic characteristics of fw_cfg.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-8-git-send-email-aliguori@us.ibm.com

11 years agoi440fx-test: add test for PAM functionality
Anthony Liguori [Tue, 16 Apr 2013 14:45:20 +0000 (09:45 -0500)]
i440fx-test: add test for PAM functionality

This tests PAM settings for the i440fx.  This test does a lot of
byte MMIO which is fairly slow with qtest today.  But the test
does complete in under 2 seconds.

We don't fully emulate PAM largely because of limitations with
KVM so we #if 0 that part of the test case.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-7-git-send-email-aliguori@us.ibm.com

11 years agoi440fx-test: add test to compare default register values
Anthony Liguori [Tue, 16 Apr 2013 14:45:19 +0000 (09:45 -0500)]
i440fx-test: add test to compare default register values

This test compares all of the default register values against the
spec.  It turns out we deviate in quite a few places.  These
places are really only visible to the BIOS though which is why
this hasn't created any problems.

The deviation actually happens in the core PCI layer so I suspect
it's not a simple fix if we really care to fix it.  For now, just
disable the affected checks.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-6-git-send-email-aliguori@us.ibm.com

11 years agolibqos: add malloc support
Anthony Liguori [Tue, 16 Apr 2013 14:45:18 +0000 (09:45 -0500)]
libqos: add malloc support

This is a very simple allocator for the PC platform.  It should
be possible to add backends for other platforms.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-5-git-send-email-aliguori@us.ibm.com

11 years agolibqos: add fw_cfg support
Anthony Liguori [Tue, 16 Apr 2013 14:45:17 +0000 (09:45 -0500)]
libqos: add fw_cfg support

fw_cfg is needed to get the top of memory which is necessary for
doing PCI allocation and allocating RAM for DMA.

Add a PC version of fw_cfg and enough abstraction to support other
platforms.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-4-git-send-email-aliguori@us.ibm.com

11 years agoqtest: add libqos including PCI support
Anthony Liguori [Tue, 16 Apr 2013 14:45:16 +0000 (09:45 -0500)]
qtest: add libqos including PCI support

This includes basic PCI support for the PC platform.  Enough
abstraction should be present to support non-PC platforms too.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-3-git-send-email-aliguori@us.ibm.com

11 years agoqtest: don't use system command to avoid double fork
Anthony Liguori [Tue, 16 Apr 2013 14:45:15 +0000 (09:45 -0500)]
qtest: don't use system command to avoid double fork

Currently we waitpid on the child process we spawn off that does
nothing more than system() another process.  While this does not
appear to be incorrect, it's wasteful and confusing so get rid of
it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1366123521-4330-2-git-send-email-aliguori@us.ibm.com

11 years agomigration: reflect incoming failure to shell
Eric Blake [Tue, 16 Apr 2013 21:50:41 +0000 (15:50 -0600)]
migration: reflect incoming failure to shell

Management apps like libvirt don't know to pay attention to
stderr unless there is a non-zero exit status.

* migration.c (process_incoming_migration_co): Exit with non-zero
status on failure.

Signed-off-by: Eric Blake <eblake@redhat.com>
Message-id: 1366149041-626-1-git-send-email-eblake@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqbus: remove wrong error messages
Alexey Kardashevskiy [Wed, 17 Apr 2013 07:49:00 +0000 (17:49 +1000)]
qbus: remove wrong error messages

The existing code shows the "Bus '%s' is full" message even if name
is specified and different from bus->name (i.e. match=0).

The patch excludes unnecessary error message.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Message-id: 1366184940-13516-1-git-send-email-aik@ozlabs.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agochardev: remove the headers of Memory chardev driver
Lei Li [Wed, 17 Apr 2013 08:46:54 +0000 (16:46 +0800)]
chardev: remove the headers of Memory chardev driver

Memory chardev driver is no longer used, and Commit:
4bf0bb8014ac2ac61b1004f5d92b2a4594d48017 has droped
it but the headers, so clean it up.

Signed-off-by: Lei Li <lilei@linux.vnet.ibm.com>
Message-id: 1366188414-24214-1-git-send-email-lilei@linux.vnet.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/migration-writev' into staging
Anthony Liguori [Wed, 17 Apr 2013 15:14:07 +0000 (10:14 -0500)]
Merge remote-tracking branch 'bonzini/migration-writev' into staging

# By Paolo Bonzini
# Via Paolo Bonzini
* bonzini/migration-writev:
  qemu-file: do not use stdio for qemu_fdopen
  iov: handle partial writes from sendmsg and recvmsg
  iov: reorganize iov_send_recv, part 3
  iov: reorganize iov_send_recv, part 2
  iov: reorganize iov_send_recv, part 1
  qemu-file: drop socket_put_buffer

Message-id: 1366192012-14872-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-file: do not use stdio for qemu_fdopen
Paolo Bonzini [Wed, 27 Mar 2013 16:36:32 +0000 (17:36 +0100)]
qemu-file: do not use stdio for qemu_fdopen

This uses system calls directly for Unix file descriptors, so that the
efficient writev_buffer can be used.  Pay attention to the possibility
of partial writes in writev.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiov: handle partial writes from sendmsg and recvmsg
Paolo Bonzini [Wed, 27 Mar 2013 16:36:31 +0000 (17:36 +0100)]
iov: handle partial writes from sendmsg and recvmsg

Partial writes can still happen in sendmsg and recvmsg, if a
signal is received in the middle of a write.  To handle this,
retry the operation with a new offset/bytes pair.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiov: reorganize iov_send_recv, part 3
Paolo Bonzini [Wed, 27 Mar 2013 16:36:30 +0000 (17:36 +0100)]
iov: reorganize iov_send_recv, part 3

"si" and "ei" are merged in a single variable.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiov: reorganize iov_send_recv, part 2
Paolo Bonzini [Wed, 27 Mar 2013 16:36:29 +0000 (17:36 +0100)]
iov: reorganize iov_send_recv, part 2

Do not touch the "bytes" argument anymore.  Instead, remember the
original length of the last iovec if we touch it, and restore it
afterwards.

This requires undoing the changes in opposite order.  The previous
algorithm didn't care.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoiov: reorganize iov_send_recv, part 1
Paolo Bonzini [Wed, 27 Mar 2013 16:36:28 +0000 (17:36 +0100)]
iov: reorganize iov_send_recv, part 1

Once the initial part of the iov is dropped, it is not used anymore.
Modify iov/iovcnt directly instead of adjusting them with the "si"
variable.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoqemu-file: drop socket_put_buffer
Paolo Bonzini [Wed, 27 Mar 2013 16:36:27 +0000 (17:36 +0100)]
qemu-file: drop socket_put_buffer

It is enough to implement one of socket_writev_buffer and
socket_put_buffer.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoqom: do nothing on unparent of object without parent
Paolo Bonzini [Tue, 2 Apr 2013 13:50:00 +0000 (15:50 +0200)]
qom: do nothing on unparent of object without parent

Otherwise, device_unparent will fail to get a canonical path of
the object.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1364910600-3418-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqdev: Fix device_add bus assumptions
Andreas Färber [Tue, 16 Apr 2013 01:50:21 +0000 (03:50 +0200)]
qdev: Fix device_add bus assumptions

Drop an unreachable fallback bus assignment to SysBus.

If no ,bus= is specified, only search busses recursively for bus type if
the DeviceClass has a bus_type specified. Handle resulting NULL cases.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Message-id: 1366077021-28882-1-git-send-email-afaerber@suse.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agorng random backend: check for -EAGAIN errors on read
Amit Shah [Tue, 16 Apr 2013 10:28:16 +0000 (15:58 +0530)]
rng random backend: check for -EAGAIN errors on read

Not handling EAGAIN triggers the assert

qemu/backends/rng-random.c:44:entropy_available: assertion failed: (len != -1)
Aborted (core dumped)

This happens when starting a guest with '-device virtio-rng-pci',
issuing a 'cat /dev/hwrng' in the guest, while also doing 'cat
/dev/random' on the host.

Reported-by: yunpingzheng <yunzheng@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Message-id: eacda84dfaf2d99cf6d250b678be4e4d6c2088fb.1366108096.git.amit.shah@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agomigration: initialize RAM to zero
Paolo Bonzini [Tue, 9 Apr 2013 15:43:43 +0000 (17:43 +0200)]
migration: initialize RAM to zero

Using qemu_memalign only leaves the RAM zero by chance, because libc
will usually use mmap to satisfy our huge requests.  But memory will
not be zero when using MALLOC_PERTURB_ with a nonzero value.  In the
case of incoming migration, this breaks a recently-introduced
invariant (commit f1c7279, migration: do not sent zero pages in
bulk stage, 2013-03-26).

To fix this, use mmap ourselves to get a well-aligned, always zero
block for the RAM.  Mmap-ed memory is easy to "trim" at the sides.

This also removes the need to do something special on valgrind
(see commit c2a8238a, Support running QEMU on Valgrind, 2011-10-31),
thus effectively reverts that patch.

Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-id: 1365522223-20153-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.80' into staging
Anthony Liguori [Tue, 16 Apr 2013 15:28:58 +0000 (10:28 -0500)]
Merge remote-tracking branch 'kraxel/usb.80' into staging

# By Gerd Hoffmann (6) and Hans de Goede (1)
# Via Gerd Hoffmann
* kraxel/usb.80:
  use libusb for usb-host
  xhci: fix address device
  xhci: use slotid as device address
  xhci: fix portsc writes
  xhci: add xhci_cap_write
  xhci: remove leftover debug printf
  usb-serial: Remove double call to qemu_chr_add_handlers( NULL )

Message-id: 1366107190-30853-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'spice/spice.v69' into staging
Anthony Liguori [Tue, 16 Apr 2013 15:28:51 +0000 (10:28 -0500)]
Merge remote-tracking branch 'spice/spice.v69' into staging

# By Hans de Goede (5) and others
# Via Gerd Hoffmann
* spice/spice.v69:
  spice-qemu-char: vmc_write: Don't write more bytes then we're asked too
  spice-qemu-char: Remove intermediate buffer
  spice-qemu-char: Add watch support
  spice-qemu-char: Remove #ifdef-ed code for old spice-server compat
  virtio-console: Remove any pending watches on close
  virtio-console: Also throttle when less was written then requested
  spice: (32 bit only) fix surface cmd tracking destruction
  qxl: add 2000x2000 and 2048x2048 video modes
  qxl: add 4k + 8k resolutions

Message-id: 1366106194-28826-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/pixman.v11' into staging
Anthony Liguori [Tue, 16 Apr 2013 15:28:43 +0000 (10:28 -0500)]
Merge remote-tracking branch 'kraxel/pixman.v11' into staging

# By Gerd Hoffmann (22) and Igor Mitsyanko (2)
# Via Gerd Hoffmann
* kraxel/pixman.v11: (24 commits)
  qxl: register QemuConsole for secondary cards
  gtk: custom cursor support
  console: allow pinning displaychangelisteners to consoles
  console: add qemu_console_is_*
  xen: re-enable refresh interval reporting for xenfb
  console: gui timer fixes
  console: add GraphicHwOps
  console: make DisplayState private to console.c
  console: move gui_update+gui_setup_refresh from vl.c into console.c
  console: zap g_width + g_height
  console: simplify screendump
  console: give each QemuConsole its own DisplaySurface
  console: rename vga_hw_*, add QemuConsole param
  console: displaystate init revamp
  console: add trace events
  console: switch color_table_rgb to pixman_color_t
  console: use pixman for font rendering
  console: use pixman for fill+blit
  pixman: render vgafont glyphs into pixman images
  pixman: add qemu_pixman_color()
  ...

Message-id: 1366105178-26744-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Tue, 16 Apr 2013 15:28:36 +0000 (10:28 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

# By Igor Mammedov (8) and others
# Via Andreas Färber
* afaerber/qom-cpu:
  target-cris: Override do_interrupt for pre-v32 CPU cores
  qdev: Set device's parent before calling realize() down inheritance chain
  cpu: Pass CPUState to *cpu_synchronize_post*()
  target-i386: Split out CPU creation and features parsing
  target-i386/cpu.c: Coding style fixes
  ioapic: Replace FROM_SYSBUS() with QOM type cast
  kvmvapic: Replace FROM_SYSBUS() with QOM type cast
  target-i386: Split APIC creation from initialization in x86_cpu_realizefn()
  target-i386: Consolidate error propagation in x86_cpu_realizefn()
  qdev: Add qdev property for bool type
  target-i386: Improve -cpu ? features output
  target-i386: Fix including "host" in -cpu ? output

11 years agouse libusb for usb-host
Gerd Hoffmann [Fri, 30 Nov 2012 15:02:11 +0000 (16:02 +0100)]
use libusb for usb-host

Reimplement usb-host on top of libusb.
Reasons to do this:

 (1) Largely rewritten from scratch, nice opportunity to kill historical
     cruft.
 (2) Offload usbfs handling to libusb.
 (3) Have a single portable code base instead of bsd + linux variants.
 (4) Bring usb-host support to any platform supported by libusbx.

For now this goes side-by-side to the existing code.  That is only to
simplify regression testing though, at the end of the day I want remove
the old code and support libusb exclusively.  Merge early in 1.5 cycle,
remove the old code after 1.5 release or something like this.

Thanks to qdev the old and new code can coexist nicely on linux.  Just
use "-device usb-host-linux" to use the old linux driver instead of the
libusb one (which takes over the "usb-host" name).

The bsd driver isn't qdev'ified so it isn't that easy for bsd.
I didn't bother making it runtime switchable, so you have to rebuild
qemu with --disable-libusb to get back the old code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoxhci: fix address device
Gerd Hoffmann [Fri, 5 Apr 2013 13:18:52 +0000 (15:18 +0200)]
xhci: fix address device

Zero-initialize the set-address dummy USBPacket,
also add buffer to avoid sanity checks triggering.

https://bugzilla.redhat.com/show_bug.cgi?id=929019

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>