sdk/emulator/qemu.git
12 years agoehci: Fix setting of halt bit from usbcmd register updates
Hans de Goede [Wed, 15 Aug 2012 15:08:54 +0000 (17:08 +0200)]
ehci: Fix setting of halt bit from usbcmd register updates

This fixes linux guests started without any USB devices not seeing newly
plugged devices until "lsusb" is done inside the guest.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoehci: fix Interrupt Threshold Control implementation
Gerd Hoffmann [Wed, 15 Aug 2012 11:55:40 +0000 (13:55 +0200)]
ehci: fix Interrupt Threshold Control implementation

First, not all interrupts are subject to Interrupt Threshold Control,
some of them must be delivered without delay.

Second, Interrupt Threshold Control state must be part of vmstate,
otherwise we might loose IRQs on migration.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: update uas product id
Gerd Hoffmann [Fri, 10 Aug 2012 11:06:05 +0000 (13:06 +0200)]
usb: update uas product id

Pick other product id to fix clash with audio.

Current usage list (after applying this patch):

46f4:0001 -- usb-storage
46f4:0002 -- usb-audio
46f4:0003 -- usb-uas

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb: async control xfer fixup
Gerd Hoffmann [Thu, 9 Aug 2012 08:57:32 +0000 (10:57 +0200)]
usb: async control xfer fixup

Need to clear p->result after copying setup data using usb_packet_copy()
because we'll reuse the USBPacket for the data transfer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoMerge remote-tracking branch 'agraf/s390-for-upstream' into staging
Anthony Liguori [Wed, 15 Aug 2012 19:59:48 +0000 (14:59 -0500)]
Merge remote-tracking branch 'agraf/s390-for-upstream' into staging

* agraf/s390-for-upstream:
  s390: provide interface for service interrupt/introduce interrupt.c
  s390: Fix error handling and condition code of service call

12 years agoMerge remote-tracking branch 'agraf/ppc-for-upstream' into staging
Anthony Liguori [Wed, 15 Aug 2012 19:59:21 +0000 (14:59 -0500)]
Merge remote-tracking branch 'agraf/ppc-for-upstream' into staging

* agraf/ppc-for-upstream: (24 commits)
  openpic: Added BRR1 register
  pseries: Update SLOF firmware image
  pseries dma: DMA window params added to PHB and DT population changed
  pseries: Add PCI MSI/MSI-X support
  pseries: Add trace event for PCI irqs
  pseries: Export find_phb() utility function for PCI code
  pseries: added allocator for a block of IRQs
  pseries: Separate PCI RTAS setup from common from emulation specific PCI setup
  pseries: Rework irq assignment to avoid carrying qemu_irqs around
  pseries: Remove extraneous prints
  pseries: Update SLOF
  PPC: spapr: Remove global variable
  PPC: spapr: Rework VGA select logic
  xbzrle: fix compilation on ppc32
  spapr: Add support for -vga option
  Add one new file vga-pci.h and cleanup on all platforms
  Revert "PPC: e500: Use new MPIC dt format"
  ppc: Fix bug in handling of PAPR hypercall exits
  PPC: e500: add generic e500 platform
  PPC: e500: split mpc8544ds machine from generic e500 code
  ...

12 years agowin32: provide separate macros for weak decls and definitions
Anthony Liguori [Wed, 15 Aug 2012 03:17:36 +0000 (22:17 -0500)]
win32: provide separate macros for weak decls and definitions

mingw32 seems to want the declaration to also carry the weak attribute.
Strangely, gcc on Linux absolutely does not want the declaration to be marked
as weak.  This may not be the right fix, but it seems to do the trick.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Wed, 15 Aug 2012 18:25:54 +0000 (13:25 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  ivshmem, qdev-monitor: fix order of qerror parameters
  iov_send_recv(): Handle zero bytes case even if OS does not
  framebuffer: Fix spelling in comment (leight -> height)
  Spelling fix in comment (peripherans -> peripherals)
  docs: Fix spelling (propery -> property)
  trace: Fix "Qemu" -> "QEMU"
  cputlb.c: Fix out of date comment
  ehci: fix assertion typo
  Makefile: Avoid explicit list of directories in clean target

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Wed, 15 Aug 2012 18:25:47 +0000 (13:25 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  qemu-iotests: Fix 030 after switch to GenericError
  block: Flush parent to OS with cache=unsafe
  iscsi: Fix NULL dereferences / races between task completion and abort
  monitor: Clean up fd sets on monitor disconnect
  block: Enable qemu_open/close to work with fd sets
  block: Convert close calls to qemu_close
  block: Convert open calls to qemu_open
  block: Prevent detection of /dev/fdset/ as floppy
  qapi: Introduce add-fd, remove-fd, query-fdsets
  qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg

12 years agoopenpic: Added BRR1 register
Bharat Bhushan [Tue, 14 Aug 2012 04:30:55 +0000 (04:30 +0000)]
openpic: Added BRR1 register

Linux mpic driver uses (changes may be in pipeline to get upstreamed soon)
BRR1. This patch adds the support to emulate readonly FSL BRR1 register.

Currently QEMU does not fully emulate any version on MPIC, so the MPIC
Major number and Minor number are set to 0.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Update SLOF firmware image
David Gibson [Tue, 7 Aug 2012 16:10:39 +0000 (16:10 +0000)]
pseries: Update SLOF firmware image

This updates SLOF to handle the necessary device tree properties for MSI
and MSI-X.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries dma: DMA window params added to PHB and DT population changed
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:38 +0000 (16:10 +0000)]
pseries dma: DMA window params added to PHB and DT population changed

Previously the only PCI bus supported was the emulated PCI bus with
fixed DMA window with start at 0 and size 1GB. As we are going to support
PCI pass through which DMA window properties are set by the host
kernel, we have to support DMA windows with parameters other than default.

This patch adds:

1. DMA window properties to sPAPRPHBState: LIOBN (bus id), start,
size of the window.

2. An additional function spapr_dma_dt() to populate DMA window
properties in the device tree which simply accepts all the parameters
and does not try to guess what kind of IOMMU is given to it.
The original spapr_dma_dt() is renamed to spapr_tcet_dma_dt().

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Add PCI MSI/MSI-X support
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:37 +0000 (16:10 +0000)]
pseries: Add PCI MSI/MSI-X support

This patch implements MSI and MSI-X support for the pseries PCI host
bridge.  To do this it adds:

 * A "config_space_address to msi_table" map, since the MSI RTAS calls
take a PCI config space address as an identifier.

 * A MSIX memory region to catch msi_notify()/msix_notiry() from
virtio-pci and pass them to the guest via qemu_irq_pulse().

 * RTAS call "ibm,change-msi" which sets up MSI vectors for a
device. Note that this call may configure and return lesser number of
vectors than requested.

 * RTAS call "ibm,query-interrupt-source-number" which translates MSI
vector to interrupt controller (XICS) IRQ number.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: fix error case ndev < 0]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Add trace event for PCI irqs
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:36 +0000 (16:10 +0000)]
pseries: Add trace event for PCI irqs

This adds a trace event in the pseries PCI specific set_irq() function to
assist in debugging.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: add trace.h include]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Export find_phb() utility function for PCI code
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:35 +0000 (16:10 +0000)]
pseries: Export find_phb() utility function for PCI code

The pseries PCI code makes use of an internal find_dev() function which
locates a PCIDevice * given a (platform specific) bus ID and device
address.  Internally this needs to first locate the host bridge on which
the device resides based on the bus ID.  This patch exposes that host
bridge lookup as a separate function, which we will need later in the MSI
and VFIO code.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: drop trace.h inclusion]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: added allocator for a block of IRQs
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:34 +0000 (16:10 +0000)]
pseries: added allocator for a block of IRQs

The patch adds a simple helper which allocates a consecutive sequence
of IRQs calling spapr_allocate_irq for each and checks that allocated
IRQs go consequently.

The patch is required for upcoming support of MSI/MSIX on POWER.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Separate PCI RTAS setup from common from emulation specific PCI setup
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:33 +0000 (16:10 +0000)]
pseries: Separate PCI RTAS setup from common from emulation specific PCI setup

Currently the RTAS functions for handling PCI are registered from the
class init code for the PCI host bridge.  That sort of makes sense
now, but will break in the future when vfio gives us multiple types of
host bridge for pseries (emulated and pass-through, at least).  The
RTAS functions will be common across all host bridge types (and will
call out to different places internally depending on the type).

So, this patch moves the RTAS registration into its own function
called direct from the machine setup code.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Rework irq assignment to avoid carrying qemu_irqs around
Alexey Kardashevskiy [Tue, 7 Aug 2012 16:10:32 +0000 (16:10 +0000)]
pseries: Rework irq assignment to avoid carrying qemu_irqs around

Currently, the interfaces in the pseries machine code for assignment
and setup of interrupts pass around qemu_irq objects.  That was done
in an attempt not to be too closely linked to the specific XICS
interrupt controller.  However interactions with the device tree setup
made that attempt rather futile, and XICS is part of the PAPR spec
anyway, so this really just meant we had to carry both the qemu_irq
pointers and the XICS irq numbers around.

This mess will just get worse when we add upcoming PCI MSI support,
since that will require tracking a bunch more interrupt.  Therefore,
this patch reworks the spapr code to just use XICS irq numbers
(roughly equivalent to GSIs on x86) and only retrieve the qemu_irq
pointers from the XICS code when we need them (a trivial lookup).

This is a reworked and generalized version of an earlier spapr_pci
specific patch from Alexey Kardashevskiy.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
[agraf: fix checkpath warning]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Remove extraneous prints
David Gibson [Tue, 7 Aug 2012 16:10:31 +0000 (16:10 +0000)]
pseries: Remove extraneous prints

The pseries machine prints several messages to stderr whenever it starts up
and another whenever the vm is reset.  It's not normal for qemu machines to
do this though, so this patch removes them.  We can put them back
conditional on a DEBUG symbol if we really need them in future.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries: Update SLOF
Benjamin Herrenschmidt [Mon, 30 Jul 2012 20:09:01 +0000 (20:09 +0000)]
pseries: Update SLOF

This patch updates the SLOF version, introducing a number of fixes:
 * add proper graphics support
 * fix bugs with graphical terminal under grub2
 * fix bugs in handling of 64-bit unit addresses
 * fix VSCSI representation to be closer to PowerVM
 * fix bugs which caused grub2 to crash

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: spapr: Remove global variable
Alexander Graf [Tue, 14 Aug 2012 11:22:13 +0000 (13:22 +0200)]
PPC: spapr: Remove global variable

Global variables are bad. Let's move spapr_has_graphics into the
machine state struct.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: spapr: Rework VGA select logic
Alexander Graf [Tue, 14 Aug 2012 11:11:49 +0000 (13:11 +0200)]
PPC: spapr: Rework VGA select logic

When selecting our VGA adapter, we want to:

  * fail completely when we can't satisfy the user's request
  * support -nographic where no VGA adapter should be spawned

This patch reworks the logic so we fulfill the two conditions above.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoxbzrle: fix compilation on ppc32
Alexander Graf [Tue, 14 Aug 2012 10:53:18 +0000 (12:53 +0200)]
xbzrle: fix compilation on ppc32

When compiling the xbzrle code on my ppc32 user space, I hit the following
gcc compiler warning (treated as an error):

  cc1: warnings being treated as errors
  savevm.c: In function ‘xbzrle_encode_buffer’:
  savevm.c:2476: error: overflow in implicit constant conversion

Fix this by making the cast explicit, rather than implicit.

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agospapr: Add support for -vga option
zhlcindy@gmail.com [Mon, 6 Aug 2012 16:42:00 +0000 (16:42 +0000)]
spapr: Add support for -vga option

Also instanciate the USB keyboard and mouse when that option is used
(you can still use -device to create individual devices without all
the defaults)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
[agraf: remove USB bits]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoAdd one new file vga-pci.h and cleanup on all platforms
zhlcindy@gmail.com [Mon, 6 Aug 2012 16:41:59 +0000 (16:41 +0000)]
Add one new file vga-pci.h and cleanup on all platforms

Functions pci_vga_init() and pci_cirrus_vga_init() are declared
in pc.h. That prevents other platforms (e.g. sPAPR) to use them.

This patch is to create one new file vga-pci.h and move the
declarations to vga-pci.h, so that they can be shared by
all platforms. This patch also cleans up on all platforms.

Signed-off-by: Li Zhang <zhlcindy@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoRevert "PPC: e500: Use new MPIC dt format"
Alexander Graf [Thu, 9 Aug 2012 20:57:14 +0000 (22:57 +0200)]
Revert "PPC: e500: Use new MPIC dt format"

This reverts commit 518c7fb44f2182cde943dc64f88cb2fd4e4ff6b5. It breaks
new Linux guests with SMP, because IPIs get mapped to large vectors which
our MPIC emulation does not implement.

Conflicts:

hw/ppc/e500.c

12 years agoppc: Fix bug in handling of PAPR hypercall exits
David Gibson [Mon, 6 Aug 2012 18:44:45 +0000 (18:44 +0000)]
ppc: Fix bug in handling of PAPR hypercall exits

Currently for powerpc, kvm_arch_handle_exit() always returns 1, meaning
that its caller - kvm_cpu_exec() - will always exit immediately afterwards
to the loop in qemu_kvm_cpu_thread_fn().

There's no need to do this.  Once we've handled the hypercall there's no
reason we can't go straight around and KVM_RUN again, which is what ret = 0
will signal.  The only exception might be for hypercalls which affect the
state of cpu_can_run(), however the only one that might do this is H_CEDE
and for kvm that is always handled in the kernel, not qemu.

Furtherm setting ret = 0 means that when exit_requested is set from a
hypercall, we will enter KVM_RUN once more with a signal which lets the
the kernel do its internal logic to complete the hypercall with out
actually executing any more guest code.  This is important if our hypercall
also triggered a reset, which previously would re-initialize everything
without completing the hypercall.  This caused the kernel to get confused
because it thought the guest was still in the middle of a hypercall when
it has actually been reset.

This patch therefore changes to ret = 0, which is both a bugfix and a small
optimization.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: add generic e500 platform
Scott Wood [Mon, 2 Jul 2012 13:03:21 +0000 (13:03 +0000)]
PPC: e500: add generic e500 platform

This gives the kernel a paravirtualized machine to target, without
requiring both sides to pretend to be targeting a specific board
that likely has little to do with the host in KVM scenarios.  This
avoids the need to add new boards to QEMU, just to be able to
run KVM on new CPUs.

Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: conditionalize on CONFIG_FDT]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: split mpc8544ds machine from generic e500 code
Scott Wood [Mon, 2 Jul 2012 13:03:20 +0000 (13:03 +0000)]
PPC: e500: split mpc8544ds machine from generic e500 code

Currently the only mpc8544ds-ism that is factored out is
toplevel compatible and model.  In the future the generic e500
code is expected to become more generic.

Signed-off-by: Scott Wood <scottwood@freescale.com>
[agraf: conditionalize on CONFIG_FDT]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: change internal references away from mpc8544ds
Scott Wood [Mon, 2 Jul 2012 13:03:19 +0000 (13:03 +0000)]
PPC: e500: change internal references away from mpc8544ds

No functional changes -- machine is still outwardly mpc8544ds.

The references that are not changed contain mpc8544 hardware details that
need to be parameterized if/when a different e500 platform wants to
change them.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoPPC: e500: rename mpc8544ds into generic file
Scott Wood [Mon, 2 Jul 2012 13:03:18 +0000 (13:03 +0000)]
PPC: e500: rename mpc8544ds into generic file

Rename the file (with no changes other than fixing up the header paths)
in preparation for refactoring into a generic e500 platform.  Also move
it into the newly created ppc/ directory.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
[agraf: conditionalize on CONFIG_FDT]
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries pci: spapr_populate_pci_devices renamed to spapr_populate_pci_dt
Alexey Kardashevskiy [Wed, 13 Jun 2012 18:40:06 +0000 (18:40 +0000)]
pseries pci: spapr_populate_pci_devices renamed to spapr_populate_pci_dt

spapr_populate_pci_devices() populates the device tree only with bus
properties and has nothing to do with the devices on it as PCI BAR
allocation is done by the system firmware (SLOF).

New name - spapr_populate_pci_dt() - describes the functionality better.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agopseries pci: removed redundant busdev
Alexey Kardashevskiy [Wed, 13 Jun 2012 18:38:50 +0000 (18:38 +0000)]
pseries pci: removed redundant busdev

The PCIHostState struct already contains SysBusDevice so
the one in sPAPRPHBState has to go.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoMerge remote-tracking branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Wed, 15 Aug 2012 16:15:02 +0000 (11:15 -0500)]
Merge remote-tracking branch 'qemu-kvm/uq/master' into staging

* qemu-kvm/uq/master:
  update-linux-headers.sh: Pull in asm-generic/kvm_para.h
  kvmvapic: Disable if there is insufficient memory
  kvm: i8254: Finish time conversion fix
  kvm: i8254: Cache kernel clock offset in KVMPITState

12 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Wed, 15 Aug 2012 16:14:06 +0000 (11:14 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  trace/simple: Replace asprintf by g_strdup_printf
  trace/simple: Fix compiler warning for 32 bit hosts
  trace: avoid pointer aliasing in trace_record_finish()
  trace: drop unused TraceBufferRecord->next_tbuf_idx field
  trace: remove unnecessary write_to_buffer() typecasting
  trace: rename TraceRecordHeader to TraceLogHeader

12 years agos390: provide interface for service interrupt/introduce interrupt.c
Christian Borntraeger [Mon, 23 Jul 2012 21:37:05 +0000 (21:37 +0000)]
s390: provide interface for service interrupt/introduce interrupt.c

This patch creates interrupt.c. The first user is a callback for hw/*
code to trigger an service interrupt for a given sccb value. Several
interrupt types for s390 are floating (can be delivered to all CPUs).
so this code does not belong to a specific CPU.
Other interrupts (like the virtio one) are also floating and can be
moved here later on.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agos390: Fix error handling and condition code of service call
Christian Borntraeger [Mon, 23 Jul 2012 21:37:04 +0000 (21:37 +0000)]
s390: Fix error handling and condition code of service call

Invalid sccb addresses will cause specification or addressing exception.
Lets add those checks. Furthermore, the good case (cc=0) was incorrect
for KVM, we did not set the CC at all. We now use return codes < 0
as program checks and return codes > 0 as condition code values.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoivshmem, qdev-monitor: fix order of qerror parameters
Alberto Garcia [Tue, 14 Aug 2012 11:41:28 +0000 (14:41 +0300)]
ivshmem, qdev-monitor: fix order of qerror parameters

Now that the QERR_ macros no longer contain a json dictionary,
the order of some parameters needs to be fixed for them to appear
correctly.

Signed-off-by: Alberto Garcia <agarcia@igalia.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoiov_send_recv(): Handle zero bytes case even if OS does not
Peter Maydell [Sat, 11 Aug 2012 21:24:35 +0000 (22:24 +0100)]
iov_send_recv(): Handle zero bytes case even if OS does not

POSIX allows sendmsg() and recvmsg() to fail EMSGSIZE if passed a zero
msg.msg_iovlen (in particular the MacOS X implementation will do this).
Handle the case where iov_send_recv() is passed a zero byte count
explicitly, to avoid accidentally depending on the OS to treat zero
msg_iovlen as a no-op.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoframebuffer: Fix spelling in comment (leight -> height)
Stefan Weil [Sat, 11 Aug 2012 19:32:02 +0000 (21:32 +0200)]
framebuffer: Fix spelling in comment (leight -> height)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoSpelling fix in comment (peripherans -> peripherals)
Stefan Weil [Fri, 10 Aug 2012 19:56:46 +0000 (21:56 +0200)]
Spelling fix in comment (peripherans -> peripherals)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agodocs: Fix spelling (propery -> property)
Stefan Weil [Fri, 10 Aug 2012 19:53:02 +0000 (21:53 +0200)]
docs: Fix spelling (propery -> property)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace: Fix "Qemu" -> "QEMU"
Stefan Weil [Fri, 10 Aug 2012 19:48:07 +0000 (21:48 +0200)]
trace: Fix "Qemu" -> "QEMU"

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agocputlb.c: Fix out of date comment
Peter Maydell [Fri, 10 Aug 2012 16:14:05 +0000 (17:14 +0100)]
cputlb.c: Fix out of date comment

The comment about the return address from get_page_addr_code() was
well out of date as phys_ram_base has not existed for some time.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoehci: fix assertion typo
Alejandro Martinez Ruiz [Tue, 14 Aug 2012 14:13:02 +0000 (16:13 +0200)]
ehci: fix assertion typo

Signed-off-by: Alejandro Martinez Ruiz <alex@securiforest.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMakefile: Avoid explicit list of directories in clean target
Peter Maydell [Wed, 15 Aug 2012 11:29:24 +0000 (12:29 +0100)]
Makefile: Avoid explicit list of directories in clean target

Avoid having an explicit list of directories in the 'clean'
target by using 'find' to remove all .o and .d files instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoqemu-iotests: Fix 030 after switch to GenericError
Kevin Wolf [Wed, 15 Aug 2012 12:08:56 +0000 (14:08 +0200)]
qemu-iotests: Fix 030 after switch to GenericError

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoblock: Flush parent to OS with cache=unsafe
Kevin Wolf [Wed, 15 Aug 2012 10:52:45 +0000 (12:52 +0200)]
block: Flush parent to OS with cache=unsafe

Commit 29cdb251 already added a comment that no unnecessary flushes to
disk will occur, this patch makes the code even get to the point of the
comment. This is mostly theoretical because in practice we only stack
one format on top of one protocol, the former implementing flush_to_os
and the latter only flush_to_disk. It starts to matter when drivers that
are not on top implement flush_to_os.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoiscsi: Fix NULL dereferences / races between task completion and abort
Stefan Priebe [Wed, 15 Aug 2012 07:09:54 +0000 (09:09 +0200)]
iscsi: Fix NULL dereferences / races between task completion and abort

Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>
Acked-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agomonitor: Clean up fd sets on monitor disconnect
Corey Bryant [Tue, 14 Aug 2012 20:43:48 +0000 (16:43 -0400)]
monitor: Clean up fd sets on monitor disconnect

Fd sets are shared by all monitor connections.  Fd sets are considered
to be in use while at least one monitor is connected.  When the last
monitor disconnects, all fds that are members of an fd set with no
outstanding dup references are closed.  This prevents any fd leakage
associated with a client disconnect prior to using a passed fd.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Enable qemu_open/close to work with fd sets
Corey Bryant [Tue, 14 Aug 2012 20:43:47 +0000 (16:43 -0400)]
block: Enable qemu_open/close to work with fd sets

When qemu_open is passed a filename of the "/dev/fdset/nnn"
format (where nnn is the fdset ID), an fd with matching access
mode flags will be searched for within the specified monitor
fd set.  If the fd is found, a dup of the fd will be returned
from qemu_open.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Convert close calls to qemu_close
Corey Bryant [Tue, 14 Aug 2012 20:43:46 +0000 (16:43 -0400)]
block: Convert close calls to qemu_close

This patch converts all block layer close calls, that correspond
to qemu_open calls, to qemu_close.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Convert open calls to qemu_open
Corey Bryant [Tue, 14 Aug 2012 20:43:45 +0000 (16:43 -0400)]
block: Convert open calls to qemu_open

This patch converts all block layer open calls to qemu_open.

Note that this adds the O_CLOEXEC flag to the changed open paths
when the O_CLOEXEC macro is defined.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Prevent detection of /dev/fdset/ as floppy
Corey Bryant [Tue, 14 Aug 2012 20:43:44 +0000 (16:43 -0400)]
block: Prevent detection of /dev/fdset/ as floppy

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqapi: Introduce add-fd, remove-fd, query-fdsets
Corey Bryant [Tue, 14 Aug 2012 20:43:43 +0000 (16:43 -0400)]
qapi: Introduce add-fd, remove-fd, query-fdsets

This patch adds support that enables passing of file descriptors
to the QEMU monitor where they will be stored in specified file
descriptor sets.

A file descriptor set can be used by a client like libvirt to
store file descriptors for the same file.  This allows the
client to open a file with different access modes (O_RDWR,
O_WRONLY, O_RDONLY) and add/remove the passed fds to/from an fd
set as needed.  This will allow QEMU to (in a later patch in this
series) "open" and "reopen" the same file by dup()ing the fd in
the fd set that corresponds to the file, where the fd has the
matching access mode flag that QEMU requests.

The new QMP commands are:
  add-fd: Add a file descriptor to an fd set
  remove-fd: Remove a file descriptor from an fd set
  query-fdsets: Return information describing all fd sets

Note: These commands are not compatible with the existing getfd
and closefd QMP commands.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg
Corey Bryant [Tue, 14 Aug 2012 20:43:42 +0000 (16:43 -0400)]
qemu-char: Add MSG_CMSG_CLOEXEC flag to recvmsg

Set the close-on-exec flag for the file descriptor received
via SCM_RIGHTS.

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoupdate-linux-headers.sh: Pull in asm-generic/kvm_para.h
Peter Maydell [Wed, 25 Jul 2012 15:29:07 +0000 (16:29 +0100)]
update-linux-headers.sh: Pull in asm-generic/kvm_para.h

Add asm-generic/kvm_para.h to the set of non-architecture specific
KVM kernel headers we copy into QEMU. This header may be included
by an architecture's kvm_para.h header.

Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvmvapic: Disable if there is insufficient memory
Jan Kiszka [Tue, 14 Aug 2012 11:43:12 +0000 (13:43 +0200)]
kvmvapic: Disable if there is insufficient memory

We need at least 1M of RAM to map the option ROM. Otherwise, we will
corrupt host memory or even crash:

    $ qemu-system-x86_64 -nodefaults --enable-kvm -vnc :0 -m 640k
    Segmentation fault (core dumped)

Reported-and-tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: i8254: Finish time conversion fix
Jan Kiszka [Tue, 14 Aug 2012 08:24:47 +0000 (10:24 +0200)]
kvm: i8254: Finish time conversion fix

0cdd3d1444 fixed reading back the counter load time from the kernel
while assuming the kernel would always update its load time on writing
the state. That is only true for channel 1, and so pit_get_channel_info
returned wrong output pin states for high counter values.

Fix this by applying the offset also on kvm_pit_put. Now we also need to
update the offset when we write the state while the VM is stopped as it
keeps on changing in that state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agokvm: i8254: Cache kernel clock offset in KVMPITState
Jan Kiszka [Tue, 14 Aug 2012 08:24:03 +0000 (10:24 +0200)]
kvm: i8254: Cache kernel clock offset in KVMPITState

To prepare the final fix for clock calibration issues with the in-kernel
PIT, we want to cache the offset between vmclock and the clock used by
the in-kernel PIT. So far, we only need to update it when the VM state
changes between running and stopped because we only read the in-kernel
PIT state while the VM is running.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
12 years agoMerge remote-tracking branch 'origin/master' into staging
Anthony Liguori [Tue, 14 Aug 2012 20:19:50 +0000 (15:19 -0500)]
Merge remote-tracking branch 'origin/master' into staging

* origin/master:
  linux-user: ARM: Ignore immediate value for svc in thumb mode
  linux-user: Use init_guest_space when -R and -B are specified
  linux-user: Factor out guest space probing into a function
  flatload: fix bss clearing
  linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
  linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
  linux-user: pass sockaddr from host to target
  x86: switch to AREG0 free mode
  x86: avoid AREG0 in segmentation helpers
  x86: avoid AREG0 for misc helpers
  x86: use wrappers for memory access helpers
  x86: avoid AREG0 for SMM helpers
  x86: avoid AREG0 for SVM helpers
  x86: avoid AREG0 for integer helpers
  x86: avoid AREG0 for condition code helpers
  x86: avoid AREG0 for FPU helpers
  linux-user: Move target_to_host_errno_table[] setup out of ioctl loop
  linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions
  linux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSET

12 years agoMerge branch 'linux-user.next' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Tue, 14 Aug 2012 19:50:22 +0000 (19:50 +0000)]
Merge branch 'linux-user.next' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'linux-user.next' of git://git.linaro.org/people/pmaydell/qemu-arm:
  linux-user: ARM: Ignore immediate value for svc in thumb mode
  linux-user: Use init_guest_space when -R and -B are specified
  linux-user: Factor out guest space probing into a function
  flatload: fix bss clearing
  linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
  linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
  linux-user: pass sockaddr from host to target
  linux-user: Move target_to_host_errno_table[] setup out of ioctl loop
  linux-user: Fix SNDCTL_DSP_MAP{IN, OUT}BUF ioctl definitions
  linux-user: Fix incorrect TARGET_BLKBSZGET, TARGET_BLKBSZSET

12 years agolinux-user: ARM: Ignore immediate value for svc in thumb mode
Alexander Graf [Tue, 29 May 2012 05:30:26 +0000 (05:30 +0000)]
linux-user: ARM: Ignore immediate value for svc in thumb mode

When running in thumb mode, Linux doesn't evaluate the immediate value
of the svc instruction, but instead just always assumes the syscall number
to be in r7.

This fixes executing go_bootstrap while building go for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agolinux-user: Use init_guest_space when -R and -B are specified
Meador Inge [Thu, 26 Jul 2012 16:50:02 +0000 (16:50 +0000)]
linux-user: Use init_guest_space when -R and -B are specified

Roll the code used to initialize the guest memory space when -R
or -B is used into 'init_guest_space' and then call 'init_guest_space'
from the driver.  This way the reserved guest memory space can
be probed for.  Calling 'mmap' just once as is currently done is not
guaranteed to succeed since the host address space validation might fail.

Signed-off-by: Meador Inge <meadori@codesourcery.com>
[PMM: Fixed minor whitespace errors.]
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agolinux-user: Factor out guest space probing into a function
Meador Inge [Thu, 26 Jul 2012 16:50:01 +0000 (16:50 +0000)]
linux-user: Factor out guest space probing into a function

Signed-off-by: Meador Inge <meadori@codesourcery.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoflatload: fix bss clearing
Mike Frysinger [Mon, 9 Jul 2012 03:04:57 +0000 (03:04 +0000)]
flatload: fix bss clearing

The current bss clear logic assumes the target mmap address and host
address are the same.  Use g2h to translate from the target address
space to the host so we can call memset on it.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agolinux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type
Jing Huang [Tue, 24 Jul 2012 14:01:42 +0000 (14:01 +0000)]
linux-user: make host_to_target_cmsg support SO_TIMESTAMP cmsg_type

Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agolinux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option
Jing Huang [Tue, 24 Jul 2012 13:59:23 +0000 (13:59 +0000)]
linux-user: make do_setsockopt support SOL_RAW ICMP_FILTER socket option

Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agolinux-user: pass sockaddr from host to target
Jing Huang [Tue, 24 Jul 2012 13:58:02 +0000 (13:58 +0000)]
linux-user: pass sockaddr from host to target

Signed-off-by: Jing Huang <jing.huang.pku@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agox86: switch to AREG0 free mode
Blue Swirl [Sun, 29 Apr 2012 20:35:48 +0000 (20:35 +0000)]
x86: switch to AREG0 free mode

Add an explicit CPUX86State parameter instead of relying on AREG0.

Remove temporary wrappers and switch to AREG0 free mode.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 in segmentation helpers
Blue Swirl [Sun, 29 Apr 2012 19:47:06 +0000 (19:47 +0000)]
x86: avoid AREG0 in segmentation helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Rename remains of op_helper.c to seg_helper.c.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for misc helpers
Blue Swirl [Sun, 29 Apr 2012 18:42:47 +0000 (18:42 +0000)]
x86: avoid AREG0 for misc helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: use wrappers for memory access helpers
Blue Swirl [Sun, 29 Apr 2012 19:11:01 +0000 (19:11 +0000)]
x86: use wrappers for memory access helpers

Switch to wrapped versions of memory access functions.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for SMM helpers
Blue Swirl [Sun, 29 Apr 2012 17:54:21 +0000 (17:54 +0000)]
x86: avoid AREG0 for SMM helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for SVM helpers
Blue Swirl [Sun, 29 Apr 2012 15:51:49 +0000 (15:51 +0000)]
x86: avoid AREG0 for SVM helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for integer helpers
Blue Swirl [Sun, 29 Apr 2012 14:11:56 +0000 (14:11 +0000)]
x86: avoid AREG0 for integer helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for condition code helpers
Blue Swirl [Sun, 29 Apr 2012 12:45:34 +0000 (12:45 +0000)]
x86: avoid AREG0 for condition code helpers

Add an explicit CPUX86State parameter instead of relying on AREG0.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agox86: avoid AREG0 for FPU helpers
Blue Swirl [Sat, 28 Apr 2012 21:28:09 +0000 (21:28 +0000)]
x86: avoid AREG0 for FPU helpers

Make FPU helpers take a parameter for CPUState instead
of relying on global env.

Introduce temporary wrappers for FPU load and store ops. Remove
wrappers for non-AREG0 code. Don't call unconverted helpers
directly.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge remote-tracking branch 'kraxel/seabios-5a02306' into staging
Anthony Liguori [Tue, 14 Aug 2012 18:46:35 +0000 (13:46 -0500)]
Merge remote-tracking branch 'kraxel/seabios-5a02306' into staging

* kraxel/seabios-5a02306:
  update seabios to latest master

12 years agoMAINTAINERS: Update email address for Stefan Hajnoczi
Stefan Hajnoczi [Tue, 14 Aug 2012 09:10:09 +0000 (10:10 +0100)]
MAINTAINERS: Update email address for Stefan Hajnoczi

Switch to my personal email address.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agotrace/simple: Replace asprintf by g_strdup_printf
Stefan Weil [Mon, 13 Aug 2012 19:51:16 +0000 (21:51 +0200)]
trace/simple: Replace asprintf by g_strdup_printf

asprintf is not available for all hosts. g_strdup_printf is
more portable and simplifies the code because if does not
need error handling.

The static variable does not need an explicit assignment to be NULL.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace/simple: Fix compiler warning for 32 bit hosts
Stefan Weil [Mon, 13 Aug 2012 19:50:56 +0000 (21:50 +0200)]
trace/simple: Fix compiler warning for 32 bit hosts

gcc complains when a 32 bit pointer is casted to a 64 bit integer.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace: avoid pointer aliasing in trace_record_finish()
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:15 +0000 (18:52 +0530)]
trace: avoid pointer aliasing in trace_record_finish()

Declaring a TraceRecord on the stack works fine.  No need for a
uint8_t array and pointer aliasing.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace: drop unused TraceBufferRecord->next_tbuf_idx field
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:14 +0000 (18:52 +0530)]
trace: drop unused TraceBufferRecord->next_tbuf_idx field

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace: remove unnecessary write_to_buffer() typecasting
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:13 +0000 (18:52 +0530)]
trace: remove unnecessary write_to_buffer() typecasting

The buffer argument is void* so it is not necessary to cast.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agotrace: rename TraceRecordHeader to TraceLogHeader
Harsh Prateek Bora [Fri, 20 Jul 2012 13:22:12 +0000 (18:52 +0530)]
trace: rename TraceRecordHeader to TraceLogHeader

The TraceRecordHeader is really the header for the entire trace log
file.  It's not per-record header so make this obvious by renaming it.

Signed-off-by: Harsh Prateek Bora <harsh@linux.vnet.ibm.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 13 Aug 2012 21:12:35 +0000 (16:12 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp: (48 commits)
  target-ppc: add implementation of query-cpu-definitions (v2)
  target-i386: add implementation of query-cpu-definitions (v2)
  qapi: add query-cpu-definitions command (v2)
  compiler: add macro for GCC weak symbols
  qapi: add query-machines command
  qapi: mark QOM commands stable
  qmp: introduce device-list-properties command
  qmp: add SUSPEND_DISK event
  qmp: qmp-events.txt: add missing doc for the SUSPEND event
  qmp: qmp-events.txt: put events in alphabetical order
  qmp: emit the WAKEUP event when the guest is put to run
  qmp: don't emit the RESET event on wakeup from S3
  scripts: qapi-commands.py: qmp-commands.h: include qdict.h
  docs: writing-qmp-commands.txt: update error section
  error, qerror: drop QDict member
  qerror: drop qerror_table and qerror_format()
  error, qerror: pass desc string to error calls
  error: drop error_get_qobject()/error_set_qobject()
  qemu-ga: switch to the new error format on the wire
  qmp: switch to the new error format on the wire
  ...

12 years agoMerge remote-tracking branch 'quintela/migration-next-20120808' into staging
Anthony Liguori [Mon, 13 Aug 2012 21:02:11 +0000 (16:02 -0500)]
Merge remote-tracking branch 'quintela/migration-next-20120808' into staging

* quintela/migration-next-20120808:
  Restart optimization on stage3 update version
  Add XBZRLE statistics
  Add migration accounting for normal and duplicate pages
  Change total_time to total-time in MigrationStats
  Add migrate_set_cache_size command
  Add XBZRLE to ram_save_block and ram_save_live
  Add xbzrle_encode_buffer and xbzrle_decode_buffer functions
  Add uleb encoding/decoding functions
  Add cache handling functions
  Add XBZRLE documentation
  Add migrate-set-capabilities
  Add migration capabilities

12 years agoMerge remote-tracking branch 'pmaydell/arm-devs.next' into staging
Anthony Liguori [Mon, 13 Aug 2012 20:59:11 +0000 (15:59 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.next' into staging

* pmaydell/arm-devs.next:
  arm: Move some ARM devices into libhw
  ssd0323: abort() instead of exit(1) on error.
  hw/sd.c: make sd_wp_addr() return bool
  hw/sd.c: make sd_dataready() return bool
  hw/sd.c: convert binary variables to bool
  hw/sd.c: introduce wrapper for conversion address to wp group
  hw/sd.c: make sd_wp_addr() accept 64 bit address argument
  hw/sd.c: convert wp_groups in SDState to bitfield
  armv7m: Guard against no -kernel argument
  hw/armv7m_nvic: Fix incorrect default for num-irqs property

12 years agotarget-ppc: add implementation of query-cpu-definitions (v2)
Anthony Liguori [Fri, 10 Aug 2012 16:04:15 +0000 (11:04 -0500)]
target-ppc: add implementation of query-cpu-definitions (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agotarget-i386: add implementation of query-cpu-definitions (v2)
Anthony Liguori [Fri, 10 Aug 2012 16:04:14 +0000 (11:04 -0500)]
target-i386: add implementation of query-cpu-definitions (v2)

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: add query-cpu-definitions command (v2)
Anthony Liguori [Fri, 10 Aug 2012 16:04:13 +0000 (11:04 -0500)]
qapi: add query-cpu-definitions command (v2)

This command attempts to map to the behavior of -cpu ?.  Unfortunately, the
output of this command differs wildly across targets.

To accommodate this, we use a weak symbol to implement a default version of the
command that fails with a QERR_NOT_SUPPORTED error code.  Targets can then
override and implement this command if it makes sense for them.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agocompiler: add macro for GCC weak symbols
Anthony Liguori [Fri, 10 Aug 2012 16:04:12 +0000 (11:04 -0500)]
compiler: add macro for GCC weak symbols

This lets us provide a default implementation of a symbol which targets can
override.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: add query-machines command
Anthony Liguori [Fri, 10 Aug 2012 16:04:11 +0000 (11:04 -0500)]
qapi: add query-machines command

This provides the same output as -M ? but in a structured way.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqapi: mark QOM commands stable
Anthony Liguori [Fri, 10 Aug 2012 16:04:10 +0000 (11:04 -0500)]
qapi: mark QOM commands stable

We've had a cycle to tweak.  It is time to commit to supporting them.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: introduce device-list-properties command
Anthony Liguori [Fri, 10 Aug 2012 16:04:09 +0000 (11:04 -0500)]
qmp: introduce device-list-properties command

This can be used in conjunction with qom-list-types to determine the supported
set of devices and their parameters.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: add SUSPEND_DISK event
Luiz Capitulino [Wed, 8 Aug 2012 20:03:01 +0000 (17:03 -0300)]
qmp: add SUSPEND_DISK event

Emitted when the guest makes a request to enter S4 state.

There are three possible ways of having this event, as described here:

 http://lists.gnu.org/archive/html/qemu-devel/2012-07/msg02307.html

I've decided to add a new event and make it indepedent of SHUTDOWN.
This means that the SHUTDOWN event will eventually follow the
SUSPEND_DISK event.

I've choosen this way because of two reasons:

 1. Having an indepedent event makes it possible to query for its
    existence by using query-events

 2. In the future, we may allow the user to change what QEMU should
    do as a result of the guest entering S4. So it's a good idea to
    keep both events separated

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: qmp-events.txt: add missing doc for the SUSPEND event
Luiz Capitulino [Thu, 9 Aug 2012 15:02:21 +0000 (12:02 -0300)]
qmp: qmp-events.txt: add missing doc for the SUSPEND event

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqmp: qmp-events.txt: put events in alphabetical order
Luiz Capitulino [Thu, 9 Aug 2012 14:40:27 +0000 (11:40 -0300)]
qmp: qmp-events.txt: put events in alphabetical order

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoqmp: emit the WAKEUP event when the guest is put to run
Luiz Capitulino [Thu, 9 Aug 2012 14:27:30 +0000 (11:27 -0300)]
qmp: emit the WAKEUP event when the guest is put to run

Today, the WAKEUP event is emitted when a wakeup _request_ is made.
This could be the system_wakeup command, for example.

A better semantic would be to emit the event when the guest is
already running, as that's what matters in the end. This commit does
that change.

In theory, this could break compatibility. In practice, it shouldn't
happen though, as clients shouldn't rely on timing characteristics of
the events. That is, a client relying that the guest is not running
when the event arrives may break if the event arrives after the guest
is already running.

This commit also adds the missing documentation for the WAKEUP event.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>