]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agomigration: do not overwrite zero pages
Peter Lieven [Mon, 10 Jun 2013 10:14:20 +0000 (12:14 +0200)]
migration: do not overwrite zero pages

on incoming migration do not memset pages to zero if they already read as zero.
this will allocate a new zero page and consume memory unnecessarily. even
if we madvise a MADV_DONTNEED later this will only deallocate the memory
asynchronously.

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoRevert "migration: do not sent zero pages in bulk stage"
Peter Lieven [Mon, 10 Jun 2013 10:14:19 +0000 (12:14 +0200)]
Revert "migration: do not sent zero pages in bulk stage"

Not sending zero pages breaks migration if a page is zero
at the source but not at the destination. This can e.g. happen
if different BIOS versions are used at source and destination.
It has also been reported that migration on pseries is completely
broken with this patch.

This effectively reverts commit f1c72795af573b24a7da5eb52375c9aba8a37972.

Conflicts:

arch_init.c

Signed-off-by: Peter Lieven <pl@kamp.de>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoarch_init/ram_load: add error message for block length mismatch
Alon Levy [Sun, 12 May 2013 11:16:28 +0000 (14:16 +0300)]
arch_init/ram_load: add error message for block length mismatch

Makes it easier to debug situations where the source and target have
different ram blocks in a device and migration fails due to that, for
instance a BAR size change on a PCI device.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
10 years agoMerge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into staging
Anthony Liguori [Tue, 25 Jun 2013 19:14:13 +0000 (14:14 -0500)]
Merge remote-tracking branch 'pmaydell/arm-devs.for-upstream' into staging

# By Peter Crosthwaite (3) and others
# Via Peter Maydell
* pmaydell/arm-devs.for-upstream:
  nand: Don't inherit from Sysbus
  block/nand: Convert Sysbus::init to Device::realize
  block/nand: QOM casting sweep
  i.MX31: Fix PRCS bit test
  arm/boot: Free dtb blob memory after use
  i.MX: Rework functions/types name and use new style initialization
  i.MX: Implement a more complete version of the GPT timer.
  ARM: Allow dumping of device tree

Message-id: 1372184516-32397-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'pmaydell/target-arm.for-upstream' into staging
Anthony Liguori [Tue, 25 Jun 2013 19:14:09 +0000 (14:14 -0500)]
Merge remote-tracking branch 'pmaydell/target-arm.for-upstream' into staging

# By Peter Maydell
# Via Peter Maydell
* pmaydell/target-arm.for-upstream:
  target-arm: Make LPAE feature imply V7MP
  target-arm: Use tuple list to sync cp regs with KVM
  target-arm: Reinitialize all KVM VCPU registers on reset
  target-arm: Initialize cpreg list from KVM when using KVM
  target-arm: Convert TCG to using (index,value) list for cp migration
  target-arm: mark up cpregs for no-migrate or raw access
  target-arm: Add raw_readfn and raw_writefn to ARMCPRegInfo
  target-arm: Allow special cpregs to have flags set

Message-id: 1372181592-32170-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging
Anthony Liguori [Tue, 25 Jun 2013 19:14:05 +0000 (14:14 -0500)]
Merge remote-tracking branch 'cohuck/virtio-ccw-upstr' into staging

# By Cornelia Huck (2) and Christian Borntraeger (1)
# Via Cornelia Huck
* cohuck/virtio-ccw-upstr:
  virtio-ccw: Wire up guest and host notifies.
  virtio-ccw: Wire up ioeventfd.
  s390/virtio-ccw: Fix virtio reset

Message-id: 1372177538-9812-1-git-send-email-cornelia.huck@de.ibm.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'sstabellini/xen-20130625' into staging
Anthony Liguori [Tue, 25 Jun 2013 19:14:00 +0000 (14:14 -0500)]
Merge remote-tracking branch 'sstabellini/xen-20130625' into staging

# By Paul Durrant (2) and Stefano Stabellini (1)
# Via Stefano Stabellini
* sstabellini/xen-20130625:
  Move hardcoded initialization of xen-platform device.
  Allow use of pc machine type (accel=xen) for Xen HVM domains.
  Revert "xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)"

Message-id: alpine.DEB.2.02.1306251323220.4782@kaball.uk.xensource.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agonand: Don't inherit from Sysbus
Peter Crosthwaite [Tue, 18 Jun 2013 11:12:41 +0000 (21:12 +1000)]
nand: Don't inherit from Sysbus

Nand chips are not sysbus devices - they do not have any sense of MMIO,
nor interrupts. Re-parent to TYPE_DEVICE accordingly.

Cc: afaerber@suse.de
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock/nand: Convert Sysbus::init to Device::realize
Peter Crosthwaite [Tue, 18 Jun 2013 11:11:52 +0000 (21:11 +1000)]
block/nand: Convert Sysbus::init to Device::realize

The prescribed transition from Sysbus::init function to a
Device::realize.

Cc: afaerber@suse.de
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoblock/nand: QOM casting sweep
Peter Crosthwaite [Tue, 18 Jun 2013 11:10:44 +0000 (21:10 +1000)]
block/nand: QOM casting sweep

Define and use standard QOM cast macro. Remove usages of DO_UPCAST and
direct -> style casting.

Cc: afaerber@suse.de
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoi.MX31: Fix PRCS bit test
Stefan Weil [Sun, 9 Jun 2013 20:44:22 +0000 (22:44 +0200)]
i.MX31: Fix PRCS bit test

cppcheck detected a condition which was always false.

According to the MCIMX31 Reference Manual, the PRCS bits have to be 01
to select the Frequency Pre-Multiplier (FPM). PRCS uses bits 1 and 2,
so we have to test for 2.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au>
Message-id: 1370810662-32320-1-git-send-email-sw@weilnetz.de
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoarm/boot: Free dtb blob memory after use
Peter Maydell [Tue, 25 Jun 2013 17:34:13 +0000 (18:34 +0100)]
arm/boot: Free dtb blob memory after use

The dtb blob returned by load_device_tree() is in memory allocated
with g_malloc(). Free it accordingly once we have copied its
contents into the guest memory. To make this easy, we need also to
clean up the error handling in load_dtb() so that we consistently
handle errors in the same way (by printing a message and then
returning -1, rather than either plowing on or exiting immediately).

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

10 years agoi.MX: Rework functions/types name and use new style initialization
Jean-Christophe DUBOIS [Tue, 25 Jun 2013 17:34:13 +0000 (18:34 +0100)]
i.MX: Rework functions/types name and use new style initialization

* use dynamic cast whenever possible
* Change function names to some more meaningful prefix
* Change type names to a more meaningful one
* use new style device initialization

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Message-id: 1369898943-1993-3-git-send-email-jcd@tribudubois.net
Reviewed-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoi.MX: Implement a more complete version of the GPT timer.
Jean-Christophe DUBOIS [Tue, 25 Jun 2013 17:34:13 +0000 (18:34 +0100)]
i.MX: Implement a more complete version of the GPT timer.

* implement compare 1 2 and 3 registers
* simplify Debug printf

Signed-off-by: Jean-Christophe DUBOIS <jcd@tribudubois.net>
Message-id: 1369898943-1993-2-git-send-email-jcd@tribudubois.net
Reviewed-by: Peter Chubb <peter.chubb@nicta.com.au>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agoARM: Allow dumping of device tree
John Rigby [Tue, 25 Jun 2013 17:34:13 +0000 (18:34 +0100)]
ARM: Allow dumping of device tree

By calling qemu_devtree_dumpdtb near the end of load_dtb.

Signed-off-by: John Rigby <john.rigby@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Make LPAE feature imply V7MP
Peter Maydell [Tue, 25 Jun 2013 17:16:08 +0000 (18:16 +0100)]
target-arm: Make LPAE feature imply V7MP

The v7 ARM ARM specifies that the Large Physical Address
Extension requires implementation of the Multiprocessing
Extensions, so make our LPAE feature imply V7MP rather
than specifying both in the A15 CPU initfn.

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

10 years agotarget-arm: Use tuple list to sync cp regs with KVM
Peter Maydell [Tue, 25 Jun 2013 17:16:07 +0000 (18:16 +0100)]
target-arm: Use tuple list to sync cp regs with KVM

Use the tuple list of cp registers for syncing KVM state to QEMU,
rather than only syncing a very minimal set by hand.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Reinitialize all KVM VCPU registers on reset
Peter Maydell [Tue, 25 Jun 2013 17:16:07 +0000 (18:16 +0100)]
target-arm: Reinitialize all KVM VCPU registers on reset

Since the ARM KVM API doesn't include a "reset this VCPU"
ioctl, we have to capture the initial values of every
register it knows about so that we can reset the VCPU
by feeding those values back again.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Initialize cpreg list from KVM when using KVM
Peter Maydell [Tue, 25 Jun 2013 17:16:07 +0000 (18:16 +0100)]
target-arm: Initialize cpreg list from KVM when using KVM

When using KVM, use the kernel's initial state to set up the
cpreg list, and sync to and from the kernel when doing
migration.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Convert TCG to using (index,value) list for cp migration
Peter Maydell [Tue, 25 Jun 2013 17:16:07 +0000 (18:16 +0100)]
target-arm: Convert TCG to using (index,value) list for cp migration

Convert the TCG ARM target to using an (index,value) list for migrating
coprocessors. The primary benefit of the (index,value) list is for
passing state between KVM and QEMU, but it works for TCG-to-TCG
migration as well and is a useful self-contained first step.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: mark up cpregs for no-migrate or raw access
Peter Maydell [Tue, 25 Jun 2013 17:16:07 +0000 (18:16 +0100)]
target-arm: mark up cpregs for no-migrate or raw access

Mark up coprocessor register definitions to add raw access
functions or mark the register as non-migratable where necessary.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Add raw_readfn and raw_writefn to ARMCPRegInfo
Peter Maydell [Tue, 25 Jun 2013 17:16:06 +0000 (18:16 +0100)]
target-arm: Add raw_readfn and raw_writefn to ARMCPRegInfo

For reading and writing register values from the kernel for KVM,
we need to provide accessor functions which are guaranteed to succeed
and don't impose access checks, mask out unwritable bits, etc.
Define new fields raw_readfn and raw_writefn for this purpose;
these only need to be provided if there is a readfn or writefn
already and it is not suitable.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agotarget-arm: Allow special cpregs to have flags set
Peter Maydell [Tue, 25 Jun 2013 17:16:06 +0000 (18:16 +0100)]
target-arm: Allow special cpregs to have flags set

Relax the "is this a valid ARMCPRegInfo type value?" check to permit
"special" cpregs to have flags other than ARM_CP_SPECIAL set. At
the moment none of the other flags are relevant for special regs,
but the migration related flag we're about to introduce can apply
here too.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10 years agovirtio-ccw: Wire up guest and host notifies.
Cornelia Huck [Tue, 19 Feb 2013 12:48:17 +0000 (13:48 +0100)]
virtio-ccw: Wire up guest and host notifies.

Guest and host notifiers are needed by vhost. We use ioeventfds for
the guest notifiers, but need to fall back on qemu injecting interrupts
for the host notifiers.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agovirtio-ccw: Wire up ioeventfd.
Cornelia Huck [Fri, 15 Feb 2013 09:18:43 +0000 (10:18 +0100)]
virtio-ccw: Wire up ioeventfd.

On hosts that support ioeventfd, make use of it for host-to-guest
notifications via diagnose 500.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agos390/virtio-ccw: Fix virtio reset
Christian Borntraeger [Fri, 7 Jun 2013 10:18:46 +0000 (12:18 +0200)]
s390/virtio-ccw: Fix virtio reset

On virtio reset we must reset the indicator to avoid stale interrupts,
e.g. after a reset.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
10 years agoMove hardcoded initialization of xen-platform device.
Paul Durrant [Tue, 25 Jun 2013 11:46:44 +0000 (11:46 +0000)]
Move hardcoded initialization of xen-platform device.

Creation of the xen-platform device is currently hardcoded into machine
type pc's initialization code, guarded by a test for the whether the xen
accelerator is enabled. This patch moves the creation of xen-platform into
the initialization code of the xenfv machine type. This maintains backwards
compatibility for that machine type but allows more flexibility if another
machine type is used with Xen HVM domains.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoAllow use of pc machine type (accel=xen) for Xen HVM domains.
Paul Durrant [Tue, 25 Jun 2013 11:46:37 +0000 (11:46 +0000)]
Allow use of pc machine type (accel=xen) for Xen HVM domains.

Xen HVM domains normally spawn QEMU with a dedicated xenfv machine type. The
initialization code for this machine type can easily be pulled into the
generic pc initialization code and guarded with a test for whether the xen
accelerator options is specified, which is more consistent with the way
other accelerators are used.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoRevert "xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)"
Stefano Stabellini [Tue, 25 Jun 2013 11:43:04 +0000 (11:43 +0000)]
Revert "xen: start PCI hole at 0xe0000000 (same as pc_init1 and qemu-xen-traditional)"

This reverts commit 9f24a8030a70ea4954b5b8c48f606012f086f65f.

The start of the PCI hole is actually set to 0xf0000000 by hvmloader.
In order to retain ABI compatibility with Xen we leave the start of the
PCI hole at 0xf0000000 in QEMU (for Xen) too.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
10 years agoMerge remote-tracking branch 'stefanha/block' into staging
Anthony Liguori [Mon, 24 Jun 2013 19:33:17 +0000 (14:33 -0500)]
Merge remote-tracking branch 'stefanha/block' into staging

# By Kevin Wolf (22) and Fam Zheng (1)
# Via Stefan Hajnoczi
* stefanha/block: (23 commits)
  vmdk: refuse to open higher version than supported
  block: Always enable discard on the protocol level
  qcow2: Batch discards
  qcow2: Options to enable discard for freed clusters
  qcow2: Add refcount update reason to all callers
  Revert "block: Disable driver-specific options for 1.5"
  ide: Clean up ide_exec_cmd()
  ide: Convert SMART commands to ide_cmd_table handler
  ide: Convert CF-ATA commands to ide_cmd_table handler
  ide: Convert ATAPI commands to ide_cmd_table handler
  ide: Convert SEEK to ide_cmd_table handler
  ide: Convert FLUSH CACHE to ide_cmd_table handler
  ide: Convert SET FEATURES to ide_cmd_table handler
  ide: Convert CHECK POWER MDOE to ide_cmd_table handler
  ide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handler
  ide: Convert DMA read/write commands to ide_cmd_table handler
  ide: Convert PIO read/write commands to ide_cmd_table handler
  ide: Convert read/write multiple commands to ide_cmd_table handler
  ide: Convert verify commands to ide_cmd_table handler
  ide: Convert cmd_nop commands to ide_cmd_table handler
  ...

Message-id: 1372065035-19601-1-git-send-email-stefanha@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'spice/spice.v71' into staging
Anthony Liguori [Mon, 24 Jun 2013 19:33:09 +0000 (14:33 -0500)]
Merge remote-tracking branch 'spice/spice.v71' into staging

# By Gerd Hoffmann (1) and Hans de Goede (1)
# Via Gerd Hoffmann
* spice/spice.v71:
  spice: Add -spice disable-agent-file-transfer cmdline option (rhbz#961850)
  qxl: fix Coverity scan SIGN_EXTENSION error

Message-id: 1372060666-18182-1-git-send-email-kraxel@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'kraxel/usb.84' into staging
Anthony Liguori [Mon, 24 Jun 2013 19:33:00 +0000 (14:33 -0500)]
Merge remote-tracking branch 'kraxel/usb.84' into staging

# By Andreas Färber (3) and others
# Via Gerd Hoffmann
* kraxel/usb.84:
  usb: fix serial number for hid devices
  usb: add serial bus property
  usb-host-libusb: set USB_DEV_FLAG_IS_HOST
  usb/host-libusb: Fix building with libusb git master code
  usb/hcd-ehci: Add Faraday FUSBH200 support
  usb/hcd-ehci: Replace PORTSC macros with variables
  usb/hcd-ehci: Add Tegra2 SysBus EHCI device
  usb/hcd-ehci: Split off instance_init from realize
  usb/hcd-ehci-sysbus: Convert to QOM realize

10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Mon, 24 Jun 2013 19:32:33 +0000 (14:32 -0500)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Stefan Weil (5) and others
# Via Michael Tokarev
* mjt/trivial-patches:
  configure: Add signed*signed check to [u]int128_t test
  Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS
  qapi: lack of two commas in dict
  sd: pass bool parameter for sd_init
  qemu-char: use bool in qemu_chr_open_socket and simplify code a bit
  vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client
  block/nand: Formatting sweep
  qxl: Fix QXLRam initialisation.
  acl: acl_add can't insert before last list element, fix
  configure: Fix "ERROR: ERROR: " for missing/incompatible DTC
  audio: Replace static functions in header file by macros, remove GCC_ATTR
  libcacard: Fix cppcheck warning and remove unneeded code
  savevm: Fix potential memory leak
  kvm: Fix potential resource leak (missing fclose)
  qemu-img: Add missing GCC_FMT_ATTR
  qemu-options: trivial fix for -mon args help
  vl: reformat SDL ifdeffery a bit

Message-id: 1371893076-9643-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agocadence_uart: Handle backend tx errors
Edgar E. Iglesias [Tue, 18 Jun 2013 07:22:55 +0000 (09:22 +0200)]
cadence_uart: Handle backend tx errors

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agovmdk: refuse to open higher version than supported
Fam Zheng [Thu, 13 Jun 2013 03:21:29 +0000 (11:21 +0800)]
vmdk: refuse to open higher version than supported

Refuse to open higher version for safety.

Although we try to be compatible with published VMDK spec, VMware has
newer version from ESXi 5.1 exported OVF/OVA, which we have no knowledge
what's changed in it. And it is very likely to have more new versions in
the future, so it's not safe to open them blindly.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoblock: Always enable discard on the protocol level
Kevin Wolf [Wed, 19 Jun 2013 11:44:21 +0000 (13:44 +0200)]
block: Always enable discard on the protocol level

Turning on discard options in qcow2 doesn't help a lot when the discard
requests that it issues are thrown away by the raw-posix layer. This
patch always enables discard functionality on the protocol level so that
it's the image format's responsibility to send (or not) discard
requests. Requests sent by the guest will be allowed or ignored by the
top level BlockDriverState, which depends on the discard=... option like
before.

In particular, this means that even without specifying options, the
qcow2 default of discarding deleted snapshots actually takes effect now,
both for qemu and qemu-img.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Batch discards
Kevin Wolf [Wed, 19 Jun 2013 11:44:20 +0000 (13:44 +0200)]
qcow2: Batch discards

This optimises the discard operation for freed clusters by batching
discard requests (both snapshot deletion and bdrv_discard end up
updating the refcounts cluster by cluster).

Note that we don't discard asynchronously, but keep s->lock held. This
is to avoid that a freed cluster is reallocated and written to while the
discard is still in flight.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Options to enable discard for freed clusters
Kevin Wolf [Wed, 19 Jun 2013 11:44:19 +0000 (13:44 +0200)]
qcow2: Options to enable discard for freed clusters

Deleted snapshots are discarded in the image file by default, discard
requests take their default from the -drive discard=... option and other
places that free clusters must always be enabled explicitly.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoqcow2: Add refcount update reason to all callers
Kevin Wolf [Wed, 19 Jun 2013 11:44:18 +0000 (13:44 +0200)]
qcow2: Add refcount update reason to all callers

This adds a refcount update reason to all callers of update_refcounts(),
so that a follow-up patch can use this information to decide whether
clusters that reach a refcount of 0 should be discarded in the image
file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoRevert "block: Disable driver-specific options for 1.5"
Kevin Wolf [Wed, 19 Jun 2013 11:44:17 +0000 (13:44 +0200)]
Revert "block: Disable driver-specific options for 1.5"

This reverts commit 8ec7d390b0d50b5e5b4b1d8dba7ba40d64a70875.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Clean up ide_exec_cmd()
Kevin Wolf [Tue, 18 Jun 2013 08:26:11 +0000 (10:26 +0200)]
ide: Clean up ide_exec_cmd()

All commands are now converted to ide_cmd_table handlers, so it can be
unconditional now and the old switch block can go.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert SMART commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:10 +0000 (10:26 +0200)]
ide: Convert SMART commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert CF-ATA commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:09 +0000 (10:26 +0200)]
ide: Convert CF-ATA commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert ATAPI commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:08 +0000 (10:26 +0200)]
ide: Convert ATAPI commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert SEEK to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:07 +0000 (10:26 +0200)]
ide: Convert SEEK to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert FLUSH CACHE to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:06 +0000 (10:26 +0200)]
ide: Convert FLUSH CACHE to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert SET FEATURES to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:05 +0000 (10:26 +0200)]
ide: Convert SET FEATURES to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert CHECK POWER MDOE to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:04 +0000 (10:26 +0200)]
ide: Convert CHECK POWER MDOE to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:03 +0000 (10:26 +0200)]
ide: Convert READ NATIVE MAX ADDRESS to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert DMA read/write commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:02 +0000 (10:26 +0200)]
ide: Convert DMA read/write commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert PIO read/write commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:01 +0000 (10:26 +0200)]
ide: Convert PIO read/write commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert read/write multiple commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:26:00 +0000 (10:26 +0200)]
ide: Convert read/write multiple commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert verify commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:25:59 +0000 (10:25 +0200)]
ide: Convert verify commands to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert cmd_nop commands to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:25:58 +0000 (10:25 +0200)]
ide: Convert cmd_nop commands to ide_cmd_table handler

cmd_nop handles all commands that don't really do anything in our
implementation except setting status register flags.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert WIN_IDENTIFY to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:25:57 +0000 (10:25 +0200)]
ide: Convert WIN_IDENTIFY to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Convert WIN_DSM to ide_cmd_table handler
Kevin Wolf [Tue, 18 Jun 2013 08:25:56 +0000 (10:25 +0200)]
ide: Convert WIN_DSM to ide_cmd_table handler

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agoide: Add handler to ide_cmd_table
Kevin Wolf [Tue, 18 Jun 2013 08:25:55 +0000 (10:25 +0200)]
ide: Add handler to ide_cmd_table

As a preparation for moving all IDE commands into their own function
like in the ATAPI code, introduce a 'handler' callback to ide_cmd_table.

Commands using this new infrastructure get some things handled
automatically:

* The BSY flag is set before calling the handler (in order to avoid bugs
  like the one fixed in f68ec837) and reset on completion.

* The (obsolete) DSC flag in the status register is set on completion if
  the command is flagged with SET_DSC in the command table

* An IRQ is triggered on completion.

* The error register and the ERR flag in the status register are cleared
  before calling the handler and on completion it is asserted that
  either none or both of them are set.

No commands are converted at this point.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
10 years agousb: fix serial number for hid devices
Gerd Hoffmann [Wed, 12 Jun 2013 11:08:45 +0000 (13:08 +0200)]
usb: fix serial number for hid devices

commit 7b074a22dab4bdda9864b933f1bc811a3db42845 changed the serial
number of hid devices.  Add compat properties to keep the old serial
number for qemu 0.12 and older.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb: add serial bus property
Gerd Hoffmann [Wed, 12 Jun 2013 11:01:49 +0000 (13:01 +0200)]
usb: add serial bus property

This patch adds a serial property for all usb devices, which can be
used to set the serial number of a usb device (as listed by lsusb -v)
to a specific value.  Applies to emulated devices only.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb-host-libusb: set USB_DEV_FLAG_IS_HOST
Gerd Hoffmann [Wed, 12 Jun 2013 11:17:02 +0000 (13:17 +0200)]
usb-host-libusb: set USB_DEV_FLAG_IS_HOST

... like host-{linux,bsd}.c do.

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb/host-libusb: Fix building with libusb git master code
Hans de Goede [Thu, 6 Jun 2013 14:39:34 +0000 (16:39 +0200)]
usb/host-libusb: Fix building with libusb git master code

The next libusb release will deprecate libusb_get_port_path, and since
we compile with -Werror, this breaks the build.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb/hcd-ehci: Add Faraday FUSBH200 support
Kuo-Jung Su [Thu, 6 Jun 2013 13:41:13 +0000 (15:41 +0200)]
usb/hcd-ehci: Add Faraday FUSBH200 support

Add Faraday FUSBH200 support, which is slightly different from EHCI spec.
(Or maybe simply a bad/wrong implementation...)

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb/hcd-ehci: Replace PORTSC macros with variables
Kuo-Jung Su [Thu, 6 Jun 2013 13:41:12 +0000 (15:41 +0200)]
usb/hcd-ehci: Replace PORTSC macros with variables

Replace PORTSC macros with variables which could then be
configured in ehci_xxxx_class_init(...)

Signed-off-by: Kuo-Jung Su <dantesu@faraday-tech.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb/hcd-ehci: Add Tegra2 SysBus EHCI device
Andreas Färber [Thu, 6 Jun 2013 13:41:11 +0000 (15:41 +0200)]
usb/hcd-ehci: Add Tegra2 SysBus EHCI device

This prepares an EHCI device for the Nvidia Tegra2 SoC family.
Values based on patch by Vincent Palatin and verified against TRM v01p.

Cc: Vincent Palatin <vpalatin@chromium.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb/hcd-ehci: Split off instance_init from realize
Andreas Färber [Thu, 6 Jun 2013 13:41:10 +0000 (15:41 +0200)]
usb/hcd-ehci: Split off instance_init from realize

This makes the mem MemoryRegion available to derived instance_inits.

Keep the bus in realize for now since naming breaks in instance_init.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agousb/hcd-ehci-sysbus: Convert to QOM realize
Andreas Färber [Thu, 6 Jun 2013 13:41:09 +0000 (15:41 +0200)]
usb/hcd-ehci-sysbus: Convert to QOM realize

The SysBus qdev initfn merely calls SysBusDeviceClass::init, so we can
replace it with a realizefn already. This avoids getting into any initfn
ambiguity with the upcoming Faraday EHCI implementation.

Rename internal usb_ehci_initfn() to usb_ehci_realize() to allow to
return Errors from common initialization code as well.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agospice: Add -spice disable-agent-file-transfer cmdline option (rhbz#961850)
Hans de Goede [Sat, 8 Jun 2013 13:37:27 +0000 (15:37 +0200)]
spice: Add -spice disable-agent-file-transfer cmdline option (rhbz#961850)

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoqxl: fix Coverity scan SIGN_EXTENSION error
Gerd Hoffmann [Mon, 3 Jun 2013 08:36:54 +0000 (10:36 +0200)]
qxl: fix Coverity scan SIGN_EXTENSION error

Cc: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
10 years agoconfigure: Add signed*signed check to [u]int128_t test
Peter Maydell [Fri, 21 Jun 2013 13:01:31 +0000 (14:01 +0100)]
configure: Add signed*signed check to [u]int128_t test

clang 3.3 with -fsanitize=undefined will fail to link code containing an
int128_t * int128_t multiply (http://llvm.org/bugs/show_bug.cgi?id=16404)
so add this to our configure test for whether [u]int128_t are usable.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoMakefile: pass include directives to dtc via CPPFLAGS, not CFLAGS
Peter Maydell [Fri, 21 Jun 2013 13:00:17 +0000 (14:00 +0100)]
Makefile: pass include directives to dtc via CPPFLAGS, not CFLAGS

The dtc submodule's makefile expects -I include directives to be
in CPPFLAGS, not CFLAGS. Getting this wrong meant that the include
directive would not be applied when generating the dependency .d
files. This in turn meant that we couldn't build libfdt when
doing an out of tree build with clang. (gcc's dependency output
is slightly different from clang in this situation so it happened
to work.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqapi: lack of two commas in dict
Amos Kong [Wed, 19 Jun 2013 09:23:27 +0000 (17:23 +0800)]
qapi: lack of two commas in dict

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agosd: pass bool parameter for sd_init
liguang [Tue, 18 Jun 2013 03:45:36 +0000 (11:45 +0800)]
sd: pass bool parameter for sd_init

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-char: use bool in qemu_chr_open_socket and simplify code a bit
liguang [Tue, 18 Jun 2013 03:45:35 +0000 (11:45 +0800)]
qemu-char: use bool in qemu_chr_open_socket and simplify code a bit

Local variables is_* should be bool by usage.
While at it, simplify the logic/code a bit.

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client
Michael Tokarev [Tue, 11 Jun 2013 11:42:44 +0000 (15:42 +0400)]
vnc: use booleans for vnc_connect, vnc_listen_read and vnc_display_add_client

Some arguments to these functions are booleans - either by declaration,
or by actual usage, but sometimes value of 0 or 1 is passed for a bool,
and sometimes it is declared as int but a bool value, or true/false,
is passed to it instead.  Clean it up a bit.

Cc: liguang <lig.fnst@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoblock/nand: Formatting sweep
Peter Crosthwaite [Tue, 18 Jun 2013 11:08:57 +0000 (21:08 +1000)]
block/nand: Formatting sweep

Make this code closer to passing checkpatch. Mostly missing braces, but
a few rogue tabs in there as well.

Cc: qemu-trivial@nongnu.org
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqxl: Fix QXLRam initialisation.
Anthony PERARD [Mon, 17 Jun 2013 16:38:26 +0000 (17:38 +0100)]
qxl: Fix QXLRam initialisation.

The qxl driver expect NULL for QXLRam.memory_configs, but this is never
initialized.

If memory is set to 0xc2c2.., it leads to a spice-critical error when
trying to start qxl.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoacl: acl_add can't insert before last list element, fix
Markus Armbruster [Tue, 18 Jun 2013 08:05:23 +0000 (10:05 +0200)]
acl: acl_add can't insert before last list element, fix

Watch this:

    $ upstream-qemu -nodefaults -S -vnc :0,acl,sasl -monitor stdio
    QEMU 1.5.50 monitor - type 'help' for more information
    (qemu) acl_add vnc.username drei allow
    acl: added rule at position 1
    (qemu) acl_show vnc.username
    policy: deny
    1: allow drei
    (qemu) acl_add vnc.username zwei allow 1
    acl: added rule at position 2
    (qemu) acl_show vnc.username
    policy: deny
    1: allow drei
    2: allow zwei
    (qemu) acl_add vnc.username eins allow 1
    acl: added rule at position 1
    (qemu) acl_show vnc.username
    policy: deny
    1: allow eins
    2: allow drei
    3: allow zwei

The second acl_add inserts at position 2 instead of 1.

Root cause is an off-by-one in qemu_acl_insert(): when index ==
acl->nentries, it appends instead of inserting before the last list
element.

Cc: qemu-stable@nongnu.org
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoconfigure: Fix "ERROR: ERROR: " for missing/incompatible DTC
Andreas Färber [Mon, 17 Jun 2013 23:09:06 +0000 (01:09 +0200)]
configure: Fix "ERROR: ERROR: " for missing/incompatible DTC

error_exit already prepends "ERROR: ", so no need to print it manually.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoaudio: Replace static functions in header file by macros, remove GCC_ATTR
Stefan Weil [Sun, 16 Jun 2013 09:19:31 +0000 (11:19 +0200)]
audio: Replace static functions in header file by macros, remove GCC_ATTR

Using macros instead of static functions for dolog and for ldebug
simplifies the code and can also reduce the total code size.

GCC_ATTR was only used in audio_int.h, so it is now unused and
the definition can be removed from compiler.h.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agolibcacard: Fix cppcheck warning and remove unneeded code
Stefan Weil [Sun, 16 Jun 2013 09:08:52 +0000 (11:08 +0200)]
libcacard: Fix cppcheck warning and remove unneeded code

The local function vcard_emul_alloc_arrays always returned PR_TRUE.
Therefore cppcheck complained about code which handled the
non-existent PR_FALSE case.

Remove the function's return value and the dead code.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agosavevm: Fix potential memory leak
Stefan Weil [Sun, 16 Jun 2013 11:33:05 +0000 (13:33 +0200)]
savevm: Fix potential memory leak

The leak was reported by cppcheck. Fix it by moving the g_malloc0 after
the argument validity check.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agokvm: Fix potential resource leak (missing fclose)
Stefan Weil [Sun, 16 Jun 2013 11:37:25 +0000 (13:37 +0200)]
kvm: Fix potential resource leak (missing fclose)

This leak was detected by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-img: Add missing GCC_FMT_ATTR
Stefan Weil [Sun, 16 Jun 2013 15:01:05 +0000 (17:01 +0200)]
qemu-img: Add missing GCC_FMT_ATTR

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoqemu-options: trivial fix for -mon args help
Michael Tokarev [Sat, 15 Jun 2013 09:47:32 +0000 (13:47 +0400)]
qemu-options: trivial fix for -mon args help

It is the (implied sub)option name which is optional, not
the value of that (sub)option, make it so in the help output.
(Introduced by commit 22a0e04b9bb)

Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: reformat SDL ifdeffery a bit
Michael Tokarev [Sat, 15 Jun 2013 10:44:20 +0000 (14:44 +0400)]
vl: reformat SDL ifdeffery a bit

This reformats #ifdef..#endif and case statement a bit,
to make it a bit shorter and matching other cases like that
(no code changes).

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agoMerge remote-tracking branch 'bonzini/iommu-for-anthony' into staging
Anthony Liguori [Thu, 20 Jun 2013 21:53:39 +0000 (16:53 -0500)]
Merge remote-tracking branch 'bonzini/iommu-for-anthony' into staging

# By Paolo Bonzini (12) and others
# Via Paolo Bonzini
* bonzini/iommu-for-anthony: (25 commits)
  memory: render_memory_region: factor out fr constant setters
  memory: as_update_topology_pass: Improve comments
  memory: Fix comment typo
  memory: give name to every AddressSpace
  dma: eliminate DMAContext
  spapr_vio: take care of creating our own AddressSpace/DMAContext
  pci: use memory core for iommu support
  dma: eliminate old-style IOMMU support
  spapr: use memory core for iommu support
  spapr: make IOMMU translation go through IOMMUTLBEntry
  spapr: convert TCE API to use an opaque type
  vfio: abort if an emulated iommu is used
  memory: Add iommu map/unmap notifiers
  memory: iommu support
  memory: make section size a 128-bit integer
  exec: reorganize mem_add to match Int128 version
  Revert "s390x: reduce TARGET_PHYS_ADDR_SPACE_BITS to 62"
  Revert "memory: limit sections in the radix tree to the actual address space size"
  exec: return MemoryRegion from address_space_translate
  exec: Implement subpage_read/write via address_space_rw
  ...

Message-id: 1371739493-10187-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Thu, 20 Jun 2013 21:53:08 +0000 (16:53 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

# By Bas van Sisseren (1) and Gertjan Halkes (1)
# Via Jan Kiszka
* kiszka/queues/slirp:
  make user networking hostfwd work with restrict=y
  fix -net user checks by reordering checks

Message-id: cover.1371638848.git.jan.kiszka@siemens.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agomemory: render_memory_region: factor out fr constant setters
Peter Crosthwaite [Mon, 3 Jun 2013 05:33:29 +0000 (15:33 +1000)]
memory: render_memory_region: factor out fr constant setters

These 4 replicated lines set properties of fr that are constant over
the course of the function. Factor out their repeated setting (and also
guards against them being set multiple times in the loop below).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: as_update_topology_pass: Improve comments
Peter Crosthwaite [Mon, 3 Jun 2013 05:32:42 +0000 (15:32 +1000)]
memory: as_update_topology_pass: Improve comments

These comments were a little difficult to read. First one had
incorrect parenthesis. The part about attributes changing is
really applicable to the region being 'in both' rather than 'in
new'

Second comment has an obscure parenthetic about 'Logging may have
changed'. Made clearer, as this if is supposed to handle the case where
the memory region is unchanged (with the notable exception re logging).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: Fix comment typo
Peter Crosthwaite [Mon, 3 Jun 2013 05:31:56 +0000 (15:31 +1000)]
memory: Fix comment typo

s/ajacent/adjacent

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: give name to every AddressSpace
Alexey Kardashevskiy [Mon, 29 Apr 2013 16:25:51 +0000 (16:25 +0000)]
memory: give name to every AddressSpace

The "info mtree" command in QEMU console prints only "memory" and "I/O"
address spaces while there are actually a lot more other AddressSpace
structs created by PCI and VIO devices. Those devices do not normally
have names and therefore not present in "info mtree" output.

The patch fixes this.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agodma: eliminate DMAContext
Paolo Bonzini [Wed, 10 Apr 2013 16:15:49 +0000 (18:15 +0200)]
dma: eliminate DMAContext

The DMAContext is a simple pointer to an AddressSpace that is now always
already available.  Make everyone hold the address space directly,
and clean up the DMA API to use the AddressSpace directly.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agospapr_vio: take care of creating our own AddressSpace/DMAContext
Paolo Bonzini [Thu, 11 Apr 2013 10:38:50 +0000 (12:38 +0200)]
spapr_vio: take care of creating our own AddressSpace/DMAContext

Fetch the root region from the sPAPRTCETable, and use it to build
an AddressSpace and DMAContext.

Now, everywhere we have a DMAContext we also have access to the
corresponding AddressSpace (either because we create it just before
the DMAContext, or because dma_context_memory's AddressSpace is
trivially address_space_memory).

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agopci: use memory core for iommu support
Avi Kivity [Tue, 30 Oct 2012 11:47:48 +0000 (13:47 +0200)]
pci: use memory core for iommu support

Use the new iommu support in the memory core for iommu support.  The only
user, spapr, is also converted, but it still provides a DMAContext
interface until the non-PCI bits switch to AddressSpace.

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
[ Do not calls memory_region_del_subregion() on the device's
  bus_master_enable_region, it is an alias; return an AddressSpace
  from the IOMMU hook and remove the destructor hook. - David Gibson ]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agodma: eliminate old-style IOMMU support
Paolo Bonzini [Wed, 10 Apr 2013 15:49:04 +0000 (17:49 +0200)]
dma: eliminate old-style IOMMU support

The translate function in the DMAContext is now always NULL.
Remove every reference to it.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agospapr: use memory core for iommu support
Paolo Bonzini [Thu, 11 Apr 2013 10:35:33 +0000 (12:35 +0200)]
spapr: use memory core for iommu support

Now we can stop using a "translating" DMAContext, but we do not yet modify
the sPAPRTCETable users to get an AddressSpace; they keep using the table
via a DMAContext.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agospapr: make IOMMU translation go through IOMMUTLBEntry
Paolo Bonzini [Tue, 16 Apr 2013 13:05:06 +0000 (15:05 +0200)]
spapr: make IOMMU translation go through IOMMUTLBEntry

The next step is to introduce the translation code that will be used for
IOMMU MemoryRegions, but still do the actual translation in a DMAContext.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agospapr: convert TCE API to use an opaque type
Paolo Bonzini [Wed, 10 Apr 2013 15:30:48 +0000 (17:30 +0200)]
spapr: convert TCE API to use an opaque type

The TCE table is currently returned as a DMAContext, and non-type-safe
APIs are called later passing back the DMAContext.  Since we want to move
away from DMAContext, use an opaque type instead, and add an accessor
to retrieve the DMAContext from it.

Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agovfio: abort if an emulated iommu is used
Avi Kivity [Tue, 30 Oct 2012 11:47:49 +0000 (13:47 +0200)]
vfio: abort if an emulated iommu is used

vfio doesn't support guest iommus yet, indicate it to the user
by gently depositing a core on their disk.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Avi Kivity <avi.kivity@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: Add iommu map/unmap notifiers
David Gibson [Tue, 14 May 2013 09:13:56 +0000 (19:13 +1000)]
memory: Add iommu map/unmap notifiers

This patch adds a NotifierList to MemoryRegions which represent IOMMUs
allowing other parts of the code to register interest in mappings or
unmappings from the IOMMU.  All IOMMU implementations will need to call
memory_region_notify_iommu() to inform those waiting on the notifier list,
whenever an IOMMU mapping is made or removed.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>