sdk/emulator/qemu.git
11 years agolinux-user: pass correct host flags to eventfd2 call
Petar Jovanovic [Mon, 8 Apr 2013 18:26:10 +0000 (20:26 +0200)]
linux-user: pass correct host flags to eventfd2 call

This change makes conversion of TARGET_O_NONBLOCK and TARGET_O_CLOEXEC flags
to host flags before calling eventfd for TARGET_NR_eventfd2.

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 agotarget-moxie: Fix VMState registration
Peter Maydell [Mon, 8 Apr 2013 15:51:46 +0000 (16:51 +0100)]
target-moxie: Fix VMState registration

Register the CPU VMState in the correct way, via cpu_class_set_vmsd(),
rather than doing it in two different wrong ways (once by providing
cpu_save and cpu_load functions, and once by setting the vmsd field in
DeviceClass).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovirtio-9p: Fix virtio-9p no longer building after hw-dirs branch merge
Hans de Goede [Tue, 9 Apr 2013 08:22:35 +0000 (10:22 +0200)]
virtio-9p: Fix virtio-9p no longer building after hw-dirs branch merge

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Message-id: 1365495755-10902-1-git-send-email-hdegoede@redhat.com
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'bonzini/hw-dirs' into staging
Anthony Liguori [Mon, 8 Apr 2013 18:12:32 +0000 (13:12 -0500)]
Merge remote-tracking branch 'bonzini/hw-dirs' into staging

# By Paolo Bonzini
# Via Paolo Bonzini
* bonzini/hw-dirs: (35 commits)
  hw: move private headers to hw/ subdirectories.
  MAINTAINERS: update for source code movement
  hw: move last file to hw/arm/
  hw: move hw/kvm/ to hw/i386/kvm
  hw: move ARM CPU cores to hw/cpu/, configure with default-configs/
  hw: move other devices to hw/misc/, configure with default-configs/
  hw: move NVRAM interfaces to hw/nvram/, configure with default-configs/
  hw: move GPIO interfaces to hw/gpio/, configure with default-configs/
  hw: move interrupt controllers to hw/intc/, configure with default-configs/
  hw: move DMA controllers to hw/dma/, configure with default-configs/
  hw: move VFIO and ivshmem to hw/misc/
  hw: move PCI bridges to hw/pci-* or hw/ARCH
  hw: move SD/MMC devices to hw/sd/, configure with default-configs/
  hw: move timer devices to hw/timer/, configure with default-configs/
  hw: move ISA bridges and devices to hw/isa/, configure with default-configs/
  hw: move char devices to hw/char/, configure via default-configs/
  hw: move more files to hw/xen/
  hw: move SCSI controllers to hw/scsi/, configure via default-configs/
  hw: move SSI controllers to hw/ssi/, configure via default-configs/
  hw: move I2C controllers to hw/i2c/, configure via default-configs/
  ...

Message-id: 1365442249-18259-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Mon, 8 Apr 2013 18:12:25 +0000 (13:12 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

# By Dmitry Fleytman
# Via Stefan Hajnoczi
* stefanha/net:
  vmxnet3: const_cpu_to_le64 wrapping for feature bits dropped
  vmxnet3: iPXE compatibility fixes

Message-id: 1365435829-23535-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agohw: move private headers to hw/ subdirectories.
Paolo Bonzini [Mon, 18 Mar 2013 16:36:02 +0000 (17:36 +0100)]
hw: move private headers to hw/ subdirectories.

Many headers are used only in a single directory.  These can be
kept in hw/.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoMAINTAINERS: update for source code movement
Paolo Bonzini [Mon, 4 Feb 2013 14:19:30 +0000 (15:19 +0100)]
MAINTAINERS: update for source code movement

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move last file to hw/arm/
Paolo Bonzini [Wed, 27 Mar 2013 17:49:23 +0000 (18:49 +0100)]
hw: move last file to hw/arm/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move hw/kvm/ to hw/i386/kvm
Paolo Bonzini [Tue, 5 Feb 2013 15:36:44 +0000 (16:36 +0100)]
hw: move hw/kvm/ to hw/i386/kvm

Peter requested the KVM GIC to be in hw/intc.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move ARM CPU cores to hw/cpu/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 15:36:44 +0000 (16:36 +0100)]
hw: move ARM CPU cores to hw/cpu/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move other devices to hw/misc/, configure with default-configs/
Paolo Bonzini [Wed, 3 Apr 2013 16:06:08 +0000 (18:06 +0200)]
hw: move other devices to hw/misc/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move NVRAM interfaces to hw/nvram/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 15:36:44 +0000 (16:36 +0100)]
hw: move NVRAM interfaces to hw/nvram/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move GPIO interfaces to hw/gpio/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 15:36:44 +0000 (16:36 +0100)]
hw: move GPIO interfaces to hw/gpio/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move interrupt controllers to hw/intc/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 15:12:12 +0000 (16:12 +0100)]
hw: move interrupt controllers to hw/intc/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move DMA controllers to hw/dma/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 13:54:35 +0000 (14:54 +0100)]
hw: move DMA controllers to hw/dma/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move VFIO and ivshmem to hw/misc/
Paolo Bonzini [Tue, 5 Feb 2013 14:41:36 +0000 (15:41 +0100)]
hw: move VFIO and ivshmem to hw/misc/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move PCI bridges to hw/pci-* or hw/ARCH
Paolo Bonzini [Tue, 5 Feb 2013 14:06:20 +0000 (15:06 +0100)]
hw: move PCI bridges to hw/pci-* or hw/ARCH

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move SD/MMC devices to hw/sd/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 13:54:35 +0000 (14:54 +0100)]
hw: move SD/MMC devices to hw/sd/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move timer devices to hw/timer/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 13:38:25 +0000 (14:38 +0100)]
hw: move timer devices to hw/timer/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move ISA bridges and devices to hw/isa/, configure with default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 13:13:04 +0000 (14:13 +0100)]
hw: move ISA bridges and devices to hw/isa/, configure with default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move char devices to hw/char/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 12:35:34 +0000 (13:35 +0100)]
hw: move char devices to hw/char/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move more files to hw/xen/
Paolo Bonzini [Tue, 5 Feb 2013 12:25:08 +0000 (13:25 +0100)]
hw: move more files to hw/xen/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move SCSI controllers to hw/scsi/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 12:39:38 +0000 (13:39 +0100)]
hw: move SCSI controllers to hw/scsi/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move SSI controllers to hw/ssi/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 12:20:08 +0000 (13:20 +0100)]
hw: move SSI controllers to hw/ssi/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move I2C controllers to hw/i2c/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 12:07:03 +0000 (13:07 +0100)]
hw: move I2C controllers to hw/i2c/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move display devices to hw/display/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:59:04 +0000 (12:59 +0100)]
hw: move display devices to hw/display/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move audio devices to hw/audio/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:55:19 +0000 (12:55 +0100)]
hw: move audio devices to hw/audio/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move block devices to hw/block/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:55:04 +0000 (12:55 +0100)]
hw: move block devices to hw/block/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move NICs to hw/net/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:33:56 +0000 (12:33 +0100)]
hw: move NICs to hw/net/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move MC146818RTC to hw/timer/, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:30:44 +0000 (12:30 +0100)]
hw: move MC146818RTC to hw/timer/, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move watchdogs to hw/watchdog, configure via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:27:44 +0000 (12:27 +0100)]
hw: move watchdogs to hw/watchdog, configure via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: make all of hw/pci/ configurable via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 13:46:43 +0000 (14:46 +0100)]
hw: make all of hw/pci/ configurable via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: make all of hw/usb/ configurable via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:23:23 +0000 (12:23 +0100)]
hw: make all of hw/usb/ configurable via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: make all of hw/ide/ configurable via default-configs/
Paolo Bonzini [Tue, 5 Feb 2013 11:22:39 +0000 (12:22 +0100)]
hw: make all of hw/ide/ configurable via default-configs/

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move virtio devices to hw/ subdirectories
Paolo Bonzini [Tue, 5 Feb 2013 11:42:31 +0000 (12:42 +0100)]
hw: move virtio devices to hw/ subdirectories

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move target-independent files to subdirectories
Paolo Bonzini [Fri, 1 Mar 2013 12:59:19 +0000 (13:59 +0100)]
hw: move target-independent files to subdirectories

This patch tackles all files that are compiled once, moving
them to subdirectories of hw/.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agomoxie: configure with default-configs file
Paolo Bonzini [Wed, 27 Mar 2013 17:54:12 +0000 (18:54 +0100)]
moxie: configure with default-configs file

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: make subdirectories for devices
Paolo Bonzini [Mon, 4 Feb 2013 10:59:48 +0000 (11:59 +0100)]
hw: make subdirectories for devices

Prepare the new directory structure.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agohw: move headers to include/
Paolo Bonzini [Tue, 5 Feb 2013 16:06:20 +0000 (17:06 +0100)]
hw: move headers to include/

Many of these should be cleaned up with proper qdev-/QOM-ification.
Right now there are many catch-all headers in include/hw/ARCH depending
on cpu.h, and this makes it necessary to compile these files per-target.
However, fixing this does not belong in these patches.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agobuild: enable using $(CONFIG_FOO) on the rhs of config files
Paolo Bonzini [Wed, 3 Apr 2013 15:53:21 +0000 (17:53 +0200)]
build: enable using $(CONFIG_FOO) on the rhs of config files

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoconfigure: Don't fall back to gthread coroutine backend
Peter Maydell [Mon, 8 Apr 2013 11:11:27 +0000 (12:11 +0100)]
configure: Don't fall back to gthread coroutine backend

The gthread coroutine backend is broken and does not produce a working
QEMU; it is only useful for some very limited debugging situations.
Clean up the backend selection logic in configure so that it now runs
"if on windows use windows; else prefer ucontext; else sigaltstack".

To do this we refactor the configure code to separate out "test
whether we have a working ucontext", "pick a default if user didn't
specify" and "validate that user didn't specify something invalid",
rather than having all three of these run together. We also simplify
the Makefile logic so it just links in the backend the configure
script selects.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1365419487-19867-3-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Provide and use convenience error reporting function
Peter Maydell [Mon, 8 Apr 2013 11:11:26 +0000 (12:11 +0100)]
configure: Provide and use convenience error reporting function

Provide a convenience function for reporting an error and exiting,
and update various places in the configure script to use it.
This allows us to be a little more consistent about how format
our error messages and makes the calling code shorter.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1365419487-19867-2-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-char: really fix behavior on can_read = 0
Paolo Bonzini [Mon, 8 Apr 2013 13:03:15 +0000 (15:03 +0200)]
qemu-char: really fix behavior on can_read = 0

I misread the glib manual, g_source_remove does not let you re-attach
the source later.  This behavior (called "blocking" the source in glib)
is present in glib's source code, but private and not available outside
glib; hence, we have to resort to re-creating the source every time.

In fact, g_source_remove and g_source_destroy are the same thing,
except g_source_destroy is O(1) while g_source_remove scans a potentially
very long list of GSources in the current main loop.  Ugh.  Better
use g_source_destroy explicitly, and leave "tags" to those dummies who
cannot track their pointers' lifetimes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1365426195-12596-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mdroth/qga-pull-4-2-13' into staging
Anthony Liguori [Mon, 8 Apr 2013 15:37:06 +0000 (10:37 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-4-2-13' into staging

# By Laszlo Ersek (2) and others
# Via Michael Roth
* mdroth/qga-pull-4-2-13:
  qemu-ga: ga_get_fd_handle(): abort if fd_counter overflows
  qga schema: document generic QERR_UNSUPPORTED
  qga schema: mark optional GuestLogicalProcessor.can-offline with #optional
  qga: add windows implementation for guest-set-time
  qga: add windows implementation for guest-get-time

11 years agoMerge remote-tracking branch 'kraxel/usb.79' into staging
Anthony Liguori [Mon, 8 Apr 2013 15:36:40 +0000 (10:36 -0500)]
Merge remote-tracking branch 'kraxel/usb.79' into staging

# By Gerd Hoffmann (7) and Hans de Goede (3)
# Via Gerd Hoffmann
* kraxel/usb.79:
  usb-tablet: Don't claim wakeup capability for USB-2 version
  usb: update docs for bus name change
  usb-hub: report status changes only once
  usb-hub: limit chain length
  xhci: zap unused name field
  xhci: remove unimplemented printfs
  xhci: remove leftover debug printf
  xhci: fix numintrs sanity checks
  usb-redir: Add flow control support
  usb-redir: Fix crash on migration with no client connected

11 years agovmxnet3: const_cpu_to_le64 wrapping for feature bits dropped
Dmitry Fleytman [Thu, 28 Mar 2013 08:53:30 +0000 (10:53 +0200)]
vmxnet3: const_cpu_to_le64 wrapping for feature bits dropped

Byte swap is redundant because shared memory reading functions
already swap bytes when required

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovmxnet3: iPXE compatibility fixes
Dmitry Fleytman [Thu, 28 Mar 2013 08:53:29 +0000 (10:53 +0200)]
vmxnet3: iPXE compatibility fixes

iPXE vmxnet3 driver makes a few assumptions regarding device operation
that were missed during testing with Linux and Windows drivers.
This patch adds following logic:
  1. Additional GET commands processing added
  2. Max number of RX chunks should be set to 1 when driver passes 0
     via corresponding shared memory field
  3. Enforecement for max chunks number added

Signed-off-by: Dmitry Fleytman <dmitry@daynix.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoMerge branch 'arm-devs.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Sat, 6 Apr 2013 12:53:54 +0000 (12:53 +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/nand.c: Fix nand erase operation
  cadence_uart: Flush queued characters on reset
  pl330: Don't inhibit ES bits on INTEN
  pflash_cfi01: Implement migration support
  pflash_cfi01: Drop unused 'bypass' field
  hw/arm_gic_common: Use vmstate struct rather than save/load functions
  arm_gic: Fix sizes of state fields in preparation for vmstate support
  vmstate: Add support for two dimensional arrays
  hw/onenand.c: fix migration of dynamically allocated buffer "otp"
  hw/sd.c: fix migration of dynamically allocated buffer "buf"
  vmstate.h: introduce VMSTATE_BUFFER_POINTER_UNSAFE macro
  hw/arm_mptimer: Save the timer state
  pl050: Don't send always-constant is_mouse field
  hw/arm/nseries: don't print to stdout or stderr

11 years agomain-loop: drop the BQL if the I/O appears to be spinning
Anthony Liguori [Fri, 5 Apr 2013 13:46:00 +0000 (08:46 -0500)]
main-loop: drop the BQL if the I/O appears to be spinning

The char-flow refactoring introduced a busy-wait that depended on
an action from the VCPU thread.  However, the VCPU thread could
never take that action because the busy-wait starved the VCPU thread
of the BQL because it never dropped the mutex while running select.

Paolo doesn't want to drop this optimization for fear that we will
stop detecting these busy waits.  I'm afraid to keep this optimization
even with the busy-wait fixed because I think a similar problem can
occur just with heavy I/O thread load manifesting itself as VCPU pauses.

As a compromise, introduce an artificial timeout after a thousand
iterations but print a rate limited warning when this happens.  This
let's us still detect when this condition occurs without it being
a fatal error.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1365169560-11012-1-git-send-email-aliguori@us.ibm.com

11 years agoqemu-char: eliminate busy waiting on can_read returning zero
Paolo Bonzini [Fri, 5 Apr 2013 15:59:33 +0000 (17:59 +0200)]
qemu-char: eliminate busy waiting on can_read returning zero

The character backend refactoring introduced an undesirable busy wait.
The busy wait happens if can_read returns zero and there is data available
on the character device's file descriptor.  Then, the I/O watch will
fire continuously and, with TCG, the CPU thread will never run.

    1) Char backend asks front end if it can write
    2) Front end says no
    3) poll() finds the char backend's descriptor is available
    4) Goto (1)

What we really want is this (note that step 3 avoids the busy wait):

    1) Char backend asks front end if it can write
    2) Front end says no
    3) poll() goes on without char backend's descriptor
    4) Goto (1) until qemu_chr_accept_input() called

    5) Char backend asks front end if it can write
    6) Front end says yes
    7) poll() finds the char backend's descriptor is available
    8) Backend handler called

After this patch, the IOWatchPoll source and the watch source are
separated.  The IOWatchPoll is simply a hook that runs during the prepare
phase on each main loop iteration.  The hook adds/removes the actual
source depending on the return value from can_read.

A simple reproducer is

    qemu-system-i386 -serial mon:stdio

... followed by banging on the terminal as much as you can. :)  Without
this patch, emulation will hang.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1365177573-11817-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 5 Apr 2013 17:52:48 +0000 (12:52 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

# By Peter Crosthwaite (2) and others
# Via Stefan Hajnoczi
* stefanha/trivial-patches:
  xilinx_zynq: Cleanup ssi_create_slave
  petalogix_ml605_mmu: Cleanup ssi_create_slave()
  target-s390: Fix SRNMT
  linux-user: Don't omit comma for strace of rt_sigaction()
  test-visitor-serialization: Fix some memory leaks

11 years agoMerge remote-tracking branch 'sstabellini/xen-2013-04-05' into staging
Anthony Liguori [Fri, 5 Apr 2013 17:52:32 +0000 (12:52 -0500)]
Merge remote-tracking branch 'sstabellini/xen-2013-04-05' into staging

# By Alex Bligh (2) and Felipe Franciosi (2)
# Via Stefano Stabellini
* sstabellini/xen-2013-04-05:
  Allow xen guests to plug disks of 1 TiB or more
  Introduce 64 bit integer write interface to xenstore
  Xen PV backend: Disable use of O_DIRECT by default as it results in crashes.
  Xen PV backend: Move call to bdrv_new from blk_init to blk_connect

11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Fri, 5 Apr 2013 17:49:10 +0000 (12:49 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Stefan Hajnoczi (4) and Kevin Wolf (3)
# Via Kevin Wolf
* kwolf/for-anthony:
  qcow2: Fix L1 write error handling in qcow2_update_snapshot_refcount
  qcow2: Return real error in qcow2_update_snapshot_refcount
  block: clean up I/O throttling wait_time code
  block: drop duplicated slice extension code
  block: keep I/O throttling slice time constant
  block: fix I/O throttling accounting blind spot
  usb-storage: Forward serial number to scsi-disk

11 years agoqcow2: Fix L1 write error handling in qcow2_update_snapshot_refcount
Kevin Wolf [Fri, 5 Apr 2013 10:57:10 +0000 (12:57 +0200)]
qcow2: Fix L1 write error handling in qcow2_update_snapshot_refcount

It ignored the error code, and at least the 'goto fail' is obvious
nonsense as it creates an endless loop (if the next attempt doesn't
magically succeed) and leaves the in-memory L1 table in big-endian
instead of converting it back.

In error cases, there's no point in writing an updated L1 table, so
skip this part for them.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Return real error in qcow2_update_snapshot_refcount
Kevin Wolf [Fri, 5 Apr 2013 10:51:31 +0000 (12:51 +0200)]
qcow2: Return real error in qcow2_update_snapshot_refcount

This fixes the error message triggered by the following script:

    cat > /tmp/blkdebug.cfg <<EOF
    [inject-error]
    event = "cluster_free"
    errno = "28"
    immediately = "off"
    EOF

    $qemu_img create -f qcow2 test.qcow2 10G
    $qemu_img snapshot -c snap test.qcow2
    $qemu_img snapshot -d snap blkdebug:/tmp/blkdebug.cfg:test.qcow2

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: clean up I/O throttling wait_time code
Stefan Hajnoczi [Fri, 5 Apr 2013 09:32:22 +0000 (11:32 +0200)]
block: clean up I/O throttling wait_time code

The wait_time variable is in seconds.  Reflect this in a comment and use
NANOSECONDS_PER_SECOND instead of BLOCK_IO_SLICE_TIME * 10 (which
happens to have the right value).

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: drop duplicated slice extension code
Stefan Hajnoczi [Fri, 5 Apr 2013 09:32:21 +0000 (11:32 +0200)]
block: drop duplicated slice extension code

The current slice is extended when an I/O request exceeds the limit.
There is no need to extend the slice every time we check a request.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: keep I/O throttling slice time constant
Stefan Hajnoczi [Fri, 5 Apr 2013 09:32:20 +0000 (11:32 +0200)]
block: keep I/O throttling slice time constant

It is not necessary to adjust the slice time at runtime.  We already
extend the current slice in order to carry over accounting into the next
slice.  Changing the actual slice time value introduces oscillations.

The guest may experience large changes in throughput or IOPS from one
moment to the next when slice times are adjusted.

Reported-by: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: fix I/O throttling accounting blind spot
Stefan Hajnoczi [Fri, 5 Apr 2013 09:32:19 +0000 (11:32 +0200)]
block: fix I/O throttling accounting blind spot

I/O throttling relies on bdrv_acct_done() which is called when a request
completes.  This leaves a blind spot since we only charge for completed
requests, not submitted requests.

For example, if there is 1 operation remaining in this time slice the
guest could submit 3 operations and they will all be submitted
successfully since they don't actually get accounted for until they
complete.

Originally we probably thought this is okay since the requests will be
accounted when the time slice is extended.  In practice it causes
fluctuations since the guest can exceed its I/O limit and it will be
punished for this later on.

Account for I/O upon submission so that I/O limits are enforced
properly.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Tested-By: Benoit Canet <benoit@irqsave.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agousb-storage: Forward serial number to scsi-disk
Kevin Wolf [Wed, 3 Apr 2013 10:41:46 +0000 (12:41 +0200)]
usb-storage: Forward serial number to scsi-disk

usb-storage takes care to fetch the USB serial number from -drive
options, but it neglected to pass its own 'serial' property to the
scsi-disk it creates. With this patch, the 'serial' qdev property and
the 'serial' option in -drive behave the same and correctly apply the
serial number on both USB and SCSI level.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agohw/nand.c: Fix nand erase operation
Wendy Liang [Wed, 3 Apr 2013 05:33:08 +0000 (15:33 +1000)]
hw/nand.c: Fix nand erase operation

Usually, nand erase operation has only 2 or 3 address cycles.
We need to mask s->addr to zero unset stale high-order bytes in the nand address
before using it as the erase address.

This fixes the NAND erase operation in Linux.

[PC: Generalised to work for any number of address cycles rather than just 3]

Signed-off-by: Wendy Liang <jliang@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1364967188-26711-1-git-send-email-peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agocadence_uart: Flush queued characters on reset
Peter Crosthwaite [Wed, 3 Apr 2013 04:52:21 +0000 (14:52 +1000)]
cadence_uart: Flush queued characters on reset

Reset can be used to empty the rx-fifo. As the fifo full condition is
used to return false from can_receive, queued rx data should be flushed
on reset accordingly.

Cc: Wendy Liang <jliang@xilinx.com>
Cc: Jason Wu <huanyu@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reported-by: Jason Wu <huanyu@xilinx.com>
Message-id: 494c1e005e225c915d295ddfd75d992ad2dabc3c.1364964526.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agopl330: Don't inhibit ES bits on INTEN
Peter Crosthwaite [Tue, 2 Apr 2013 17:59:29 +0000 (17:59 +0000)]
pl330: Don't inhibit ES bits on INTEN

This if-else logic inhibits setting of the event status (ES) bits
when interrupts are enabled. This is incorrect. ES should be set
regardless on INTEN state. INTEN only inhibits the signalling of
events to PL330 threads, not setting of the ES register.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoAllow xen guests to plug disks of 1 TiB or more
Felipe Franciosi [Fri, 5 Apr 2013 15:47:59 +0000 (15:47 +0000)]
Allow xen guests to plug disks of 1 TiB or more

The current xen backend driver implementation uses int64_t variables
to store the size of the corresponding backend disk/file. It also uses
an int64_t variable to store the block size of that image. When writing
the number of sectors (file_size/block_size) to xenstore, however, it
passes these values as 32 bit signed integers. This will cause an
overflow for any disk of 1 TiB or more.

This patch changes the xen backend driver to use a 64 bit integer write
xenstore function.

Signed-off-by: Felipe Franciosi <felipe@paradoxo.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agoIntroduce 64 bit integer write interface to xenstore
Felipe Franciosi [Fri, 5 Apr 2013 15:37:32 +0000 (15:37 +0000)]
Introduce 64 bit integer write interface to xenstore

The current implementation of xen_backend only provides 32 bit integer
functions to write to xenstore. This patch adds two functions that
allow writing 64 bit integers (one generic function and another for
the backend only).

This patch also fixes the size of the char arrays used to represent
these integers as strings (originally 32 bytes, however no more than
12 bytes are needed for 32 bit integers and no more than 21 bytes are
needed for 64 bit integers).

Signed-off-by: Felipe Franciosi <felipe@paradoxo.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agoXen PV backend: Disable use of O_DIRECT by default as it results in crashes.
Alex Bligh [Fri, 5 Apr 2013 15:45:15 +0000 (15:45 +0000)]
Xen PV backend: Disable use of O_DIRECT by default as it results in crashes.

Due to what is almost certainly a kernel bug, writes with O_DIRECT may
continue to reference the page after the write has been marked as
completed, particularly in the case of TCP retransmit. In other
scenarios, this "merely" risks data corruption on the write, but with
Xen pages from domU are only transiently mapped into dom0's memory,
resulting in kernel panics when they are subsequently accessed.

This brings PV devices in line with emulated devices.  Removing
O_DIRECT is safe as barrier operations are now correctly passed
through.

See:
   http://lists.xen.org/archives/html/xen-devel/2012-12/msg01154.html
for more details.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agoXen PV backend: Move call to bdrv_new from blk_init to blk_connect
Alex Bligh [Fri, 5 Apr 2013 15:45:10 +0000 (15:45 +0000)]
Xen PV backend: Move call to bdrv_new from blk_init to blk_connect

This commit delays the point at which bdrv_new (and hence blk_open
on the underlying device) is called from blk_init to blk_connect.
This ensures that in an inbound live migrate, the block device is
not opened until it has been closed at the other end. This is in
preparation for supporting devices with open/close consistency
without using O_DIRECT. This commit does NOT itself change O_DIRECT
semantics.

Signed-off-by: Alex Bligh <alex@alex.org.uk>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
11 years agopflash_cfi01: Implement migration support
Peter Maydell [Fri, 5 Apr 2013 15:18:00 +0000 (16:18 +0100)]
pflash_cfi01: Implement migration support

Add a vmstate to pflash_cfi01, so that it can be live migrated.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363717469-30980-3-git-send-email-peter.maydell@linaro.org

11 years agopflash_cfi01: Drop unused 'bypass' field
Peter Maydell [Fri, 5 Apr 2013 15:18:00 +0000 (16:18 +0100)]
pflash_cfi01: Drop unused 'bypass' field

For pflash_cfi01 the 'bypass' field is set to zero and never changes,
so remove it (it is a leftover from pflash_cfi02, where bypass is
implemented).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363717469-30980-2-git-send-email-peter.maydell@linaro.org

11 years agohw/arm_gic_common: Use vmstate struct rather than save/load functions
Peter Maydell [Fri, 5 Apr 2013 15:18:00 +0000 (16:18 +0100)]
hw/arm_gic_common: Use vmstate struct rather than save/load functions

Update the GIC save/restore to use vmstate rather than hand-rolled
save/load functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 1363975375-3166-4-git-send-email-peter.maydell@linaro.org

11 years agoarm_gic: Fix sizes of state fields in preparation for vmstate support
Peter Maydell [Fri, 5 Apr 2013 15:17:59 +0000 (16:17 +0100)]
arm_gic: Fix sizes of state fields in preparation for vmstate support

In preparation for switching to vmstate for migration support, fix
the sizes of various GIC state fields. In particular, we replace all
the bitfields (which VMState can't deal with) with straightforward
uint8_t values which we do bit operations on. (The bitfields made
more sense when NCPU was set differently in different situations,
but we now always model at the architectural limit of 8.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363975375-3166-3-git-send-email-peter.maydell@linaro.org

11 years agovmstate: Add support for two dimensional arrays
Peter Maydell [Fri, 5 Apr 2013 15:17:59 +0000 (16:17 +0100)]
vmstate: Add support for two dimensional arrays

Add support for migrating two dimensional arrays, by defining
a set of new macros VMSTATE_*_2DARRAY paralleling the existing
VMSTATE_*_ARRAY macros. 2D arrays are handled the same for actual
state serialization; the only difference is that the type check
has to change for a 2D array.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Message-id: 1363975375-3166-2-git-send-email-peter.maydell@linaro.org

11 years agohw/onenand.c: fix migration of dynamically allocated buffer "otp"
Igor Mitsyanko [Fri, 5 Apr 2013 15:17:59 +0000 (16:17 +0100)]
hw/onenand.c: fix migration of dynamically allocated buffer "otp"

VMSTATE_BUFFER_UNSAFE should be used for buffers inlined in device state, not
for buffers allocated dynamically. Change to VMSTATE_BUFFER_POINTER_UNSAFE macro,
which will do migration right.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1362923278-4080-4-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/sd.c: fix migration of dynamically allocated buffer "buf"
Igor Mitsyanko [Fri, 5 Apr 2013 15:17:59 +0000 (16:17 +0100)]
hw/sd.c: fix migration of dynamically allocated buffer "buf"

VMSTATE_BUFFER_UNSAFE should be used for buffers inlined in device state, not
for buffers allocated dynamically. Change to VMSTATE_BUFFER_POINTER_UNSAFE macro,
which will do migration right.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Tested-by: Michael Walle <michael@walle.cc>
Message-id: 1362923278-4080-3-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agovmstate.h: introduce VMSTATE_BUFFER_POINTER_UNSAFE macro
Igor Mitsyanko [Fri, 5 Apr 2013 15:17:58 +0000 (16:17 +0100)]
vmstate.h: introduce VMSTATE_BUFFER_POINTER_UNSAFE macro

Macro could be used to migrate a dynamically allocated buffer of known size.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1362923278-4080-2-git-send-email-i.mitsyanko@gmail.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agohw/arm_mptimer: Save the timer state
Peter Maydell [Fri, 5 Apr 2013 15:17:58 +0000 (16:17 +0100)]
hw/arm_mptimer: Save the timer state

Add a missing VMSTATE_TIMER() entry to the arm_mptimer vmstate
description; this omission meant that we would probably hang on reload
when the timer failed to fire.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Message-id: 1363967348-3044-1-git-send-email-peter.maydell@linaro.org

11 years agopl050: Don't send always-constant is_mouse field
Peter Maydell [Fri, 5 Apr 2013 15:17:58 +0000 (16:17 +0100)]
pl050: Don't send always-constant is_mouse field

The is_mouse field of the pl050 state structure is constant (it tracks
whether this is a 'pl050_keyboard' or 'pl050_mouse'), so there's
no need to include it in the VMState structure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Message-id: 1363628480-29306-1-git-send-email-peter.maydell@linaro.org

11 years agohw/arm/nseries: don't print to stdout or stderr
Peter Maydell [Fri, 5 Apr 2013 15:17:58 +0000 (16:17 +0100)]
hw/arm/nseries: don't print to stdout or stderr

Remove various bits of printing to stdout or stderr from the
nseries code, replacing it with a qemu log message where there's
an appropriate log category, and just dropping the output for
some of the more debug-like printing.

In particular, this will get rid of the 'mipid_reset' message
you currently get from 'make check'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Message-id: 1363368565-24546-1-git-send-email-peter.maydell@linaro.org

11 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Fri, 5 Apr 2013 13:55:14 +0000 (08:55 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Luiz Capitulino
# Via Luiz Capitulino
* luiz/queue/qmp:
  chardev: drop the Memory chardev driver
  hmp: human-monitor-command: stop using the Memory chardev driver
  Monitor: Make output buffer dynamic
  qstring: add qstring_get_length()

11 years agoxilinx_zynq: Cleanup ssi_create_slave
Peter Crosthwaite [Thu, 4 Apr 2013 01:04:12 +0000 (11:04 +1000)]
xilinx_zynq: Cleanup ssi_create_slave

With the recent m25p80 cleanup there is no need to use
ssi_create_slave_no_init() anymore. Just use ssi_create_slave().

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agopetalogix_ml605_mmu: Cleanup ssi_create_slave()
Peter Crosthwaite [Thu, 4 Apr 2013 01:04:11 +0000 (11:04 +1000)]
petalogix_ml605_mmu: Cleanup ssi_create_slave()

With the recent m25p80 cleanup there is no need to use
ssi_create_slave_no_init() anymore. Just use ssi_create_slave().

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-s390: Fix SRNMT
Richard Henderson [Sat, 30 Mar 2013 17:03:25 +0000 (10:03 -0700)]
target-s390: Fix SRNMT

Fallthough into abort = oops.

Cc: qemu-trivial@nongnu.org
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agochardev: drop the Memory chardev driver
Luiz Capitulino [Tue, 2 Apr 2013 19:29:29 +0000 (15:29 -0400)]
chardev: drop the Memory chardev driver

It's not used anymore since the last commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agohmp: human-monitor-command: stop using the Memory chardev driver
Luiz Capitulino [Tue, 2 Apr 2013 19:07:33 +0000 (15:07 -0400)]
hmp: human-monitor-command: stop using the Memory chardev driver

The Memory chardev driver was added because, as the Monitor's output
buffer was static, we needed a way to accumulate the output of an
HMP commmand when ran by human-monitor-command.

However, the Monitor's output buffer is now dynamic, so it's possible
for the human-monitor-command to use it instead of the Memory chardev
driver.

This commit does that change, but there are two important
observations about it:

 1. We need a way to signal to the Monitor that it shouldn't call
    chardev functions when flushing its output. This is done
    by adding a new flag to the Monitor object called skip_flush
(which is set to true by qmp_human_monitor_command())

 2. The current code has buffered semantics: QMP clients will
    only see a command's output if it flushes its output with
a new-line character. This commit changes this to unbuffered,
which means that QMP clients will see a command's output
whenever the command prints anything.

I don't think this will matter in practice though, as I believe
all HMP commands print the new-line character anyway.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoMonitor: Make output buffer dynamic
Luiz Capitulino [Mon, 25 Mar 2013 17:52:26 +0000 (13:52 -0400)]
Monitor: Make output buffer dynamic

Commit f628926bb423fa8a7e0b114511400ea9df38b76a changed monitor_flush()
to retry on qemu_chr_fe_write() errors. However, the Monitor's output
buffer can keep growing while the retry is not issued and this can
cause the buffer to overflow.

To reproduce this issue, just start qemu and type on the Monitor:

(qemu) ?

This will cause an assertion to trig.

To fix this problem this commit makes the Monitor buffer dynamic,
which means that it can grow as much as needed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqstring: add qstring_get_length()
Luiz Capitulino [Mon, 25 Mar 2013 17:46:37 +0000 (13:46 -0400)]
qstring: add qstring_get_length()

Long overdue.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agolinux-user: Don't omit comma for strace of rt_sigaction()
Peter Maydell [Thu, 28 Mar 2013 14:33:24 +0000 (14:33 +0000)]
linux-user: Don't omit comma for strace of rt_sigaction()

Pass the 'last' parameter of print_signal() through to
print_raw_param(); this fixes a problem where we weren't printing
the comma separator for strace of rt_sigaction() when the signal
was an unnamed (ie realtime) one:
  6856 rt_sigaction(230xf6fff870,0xf6fff8fc) = 0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotest-visitor-serialization: Fix some memory leaks
Stefan Berger [Thu, 28 Mar 2013 15:18:40 +0000 (11:18 -0400)]
test-visitor-serialization: Fix some memory leaks

This patch fixes some of the memory leaks in test-visitor-serialization but not all of them.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoAllow clock_gettime() monotonic clock to be utilized on more OS's
Brad Smith [Fri, 5 Apr 2013 00:37:53 +0000 (20:37 -0400)]
Allow clock_gettime() monotonic clock to be utilized on more OS's

Allow the clock_gettime() code using monotonic clock to be utilized on
more POSIX compliannt OS's. This started as a fix for OpenBSD which was
listed in one function as part of the previous hard coded list of OS's
for the functions to support but not in the other.

Signed-off-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20130405003748.GH884@rox.home.comstyle.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopc_acpi_init(): don't bail as soon as failing to find default DSDT
Laszlo Ersek [Wed, 20 Mar 2013 23:23:22 +0000 (00:23 +0100)]
pc_acpi_init(): don't bail as soon as failing to find default DSDT

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-11-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoIntroduce IO_APIC_DEFAULT_ADDRESS for 0xfec00000
Laszlo Ersek [Wed, 20 Mar 2013 23:23:21 +0000 (00:23 +0100)]
Introduce IO_APIC_DEFAULT_ADDRESS for 0xfec00000

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-10-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoextract/unify the constant 0xfee00000 as APIC_DEFAULT_ADDRESS
Laszlo Ersek [Wed, 20 Mar 2013 23:23:20 +0000 (00:23 +0100)]
extract/unify the constant 0xfee00000 as APIC_DEFAULT_ADDRESS

A common dependency of the constant's current users:
- hw/apic_common.c
- hw/i386/kvmvapic.c
- target-i386/cpu.c
is "target-i386/cpu.h".

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-9-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agolike acpi_table_install(), acpi_table_add() should propagate Errors
Laszlo Ersek [Wed, 20 Mar 2013 23:23:19 +0000 (00:23 +0100)]
like acpi_table_install(), acpi_table_add() should propagate Errors

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-8-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoacpi_table_add(): extract and reimplement internals
Laszlo Ersek [Wed, 20 Mar 2013 23:23:18 +0000 (00:23 +0100)]
acpi_table_add(): extract and reimplement internals

The new function acpi_table_install() installs any blob the caller passes
in. In the next patches this function will be promoted from helper role to
extern.

Reimplementing the logic should make it easier to understand. It also
removes a buffer overflow when

    has_header &&
    cumulative_file_size < ACPI_TABLE_HDR_SIZE - ACPI_TABLE_PFX_SIZE

(In that case the g_realloc() call in the read() loop used to shrink the
"acpi_tables" array, causing an out-of-bounds read access when copying the
header out of "acpi_tables".)

The new code isn't more daring alignment-wise than its predecessor:
"acpi_table_header" is packed, and the uint32_t fields are at offsets 6,
26, and 34.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-7-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoacpi_table_add(): accept QemuOpts and parse it with OptsVisitor
Laszlo Ersek [Wed, 20 Mar 2013 23:23:17 +0000 (00:23 +0100)]
acpi_table_add(): accept QemuOpts and parse it with OptsVisitor

As one consequence, strtok() -- which modifies its argument -- is replaced
with g_strsplit().

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-6-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqapi schema: add AcpiTableOptions
Laszlo Ersek [Wed, 20 Mar 2013 23:23:16 +0000 (00:23 +0100)]
qapi schema: add AcpiTableOptions

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-5-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoacpi_table_add(): report fatal errors through an internal Error object
Laszlo Ersek [Wed, 20 Mar 2013 23:23:15 +0000 (00:23 +0100)]
acpi_table_add(): report fatal errors through an internal Error object

The upcoming changes will need a cleanup section at the end of the
function, plus OptsVisitor reports errors via Error. For now keep
channeling any Errors to stderr.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-4-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agochange element type from "char" to "unsigned char" in ACPI table data
Laszlo Ersek [Wed, 20 Mar 2013 23:23:14 +0000 (00:23 +0100)]
change element type from "char" to "unsigned char" in ACPI table data

The data is binary, not textual.

Also, acpi_table_add() abuses the "char *f" pointer -- which normally
points to file names to load -- to poke into the table. Introduce "char
unsigned *table_start" for that purpose.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-3-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agostrip some whitespace
Laszlo Ersek [Wed, 20 Mar 2013 23:23:13 +0000 (00:23 +0100)]
strip some whitespace

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1363821803-3380-2-git-send-email-lersek@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoipoctal232: Convert to use chardev properties directly
Hans de Goede [Wed, 27 Mar 2013 19:29:41 +0000 (20:29 +0100)]
ipoctal232: Convert to use chardev properties directly

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alberto Garcia <agarcia@igalia.com>
Message-id: 1364412581-3672-4-git-send-email-hdegoede@redhat.com
Cc: Alberto Garcia <agarcia@igalia.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>